This commit is contained in:
parent
0b45288d0b
commit
df0a744556
85
source/level/layerback.cpp
Normal file
85
source/level/layerback.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
/******************************/
|
||||
/*** Solid Tile Layer Class ***/
|
||||
/******************************/
|
||||
|
||||
#include "system\global.h"
|
||||
#include <DStructs.h>
|
||||
#include "utils\utils.h"
|
||||
#include "gfx\prim.h"
|
||||
|
||||
|
||||
#include "LayerTile.h"
|
||||
#include "LayerTileSolid.h"
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
CLayerTileSolid::CLayerTileSolid(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList) : CLayerTile(Hdr,TileList,TriList,QuadList,VtxList)
|
||||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
CLayerTileSolid::~CLayerTileSolid()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CLayerTileSolid::init(DVECTOR &MapPos,int Shift,int Width,int Height)
|
||||
{
|
||||
CLayerTile::init(MapPos,Shift,MapWidth,MapHeight);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerTileSolid::shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerTileSolid::think(DVECTOR &MapPos)
|
||||
{ // Overide default strip scroll update
|
||||
int XPos=MapPos.vx>>MapXYShift;
|
||||
int YPos=MapPos.vy>>MapXYShift;
|
||||
|
||||
ShiftX=XPos&15;
|
||||
ShiftY=YPos&15;
|
||||
|
||||
MapX=XPos>>4;
|
||||
MapY=YPos>>4;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerTileSolid::render()
|
||||
{
|
||||
sPrimGridElem *Grid=GetGridPos(MapX,MapY);
|
||||
s16 TileX,TileY;
|
||||
sOT *ThisOT=OtPtr+LayerOT;
|
||||
|
||||
// Setup shift bits of pos
|
||||
TileY=-ShiftY;
|
||||
|
||||
// Render it!!
|
||||
for (int Y=0; Y<SCREEN_TILE_HEIGHT; Y++)
|
||||
{
|
||||
sPrimGridElem *GridDown= Grid->Down;
|
||||
TileX=-ShiftX;
|
||||
|
||||
for (int X=0; X<SCREEN_TILE_WIDTH; X++)
|
||||
{
|
||||
TSPRT_16 *Prim=&Grid->Prim;
|
||||
/**/ Prim->x0=TileX;
|
||||
/**/ Prim->y0=TileY;
|
||||
addPrimNoCheck(ThisOT,Prim);
|
||||
Grid=Grid->Right;
|
||||
TileX+=TILE_WIDTH;
|
||||
}
|
||||
Grid=GridDown;
|
||||
TileY+=TILE_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
29
source/level/layerback.h
Normal file
29
source/level/layerback.h
Normal file
@ -0,0 +1,29 @@
|
||||
/************************/
|
||||
/*** Back Layer Class ***/
|
||||
/************************/
|
||||
|
||||
#ifndef __LAYER_BACK_H__
|
||||
#define __LAYER_BACK_H__
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
class CLayerBack : public CLayerTile
|
||||
{
|
||||
public:
|
||||
CLayerBack(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList);
|
||||
~CLayerBack();
|
||||
|
||||
void init(DVECTOR &MapPos,int Shift,int Width,int Height);
|
||||
void shutdown();
|
||||
void think(DVECTOR &MapPos);
|
||||
void render();
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user