SBSPSS/source/level/layertile.h

86 lines
1.9 KiB
C
Raw Normal View History

2000-12-07 02:15:53 +01:00
/************************/
/*** Tile Layer Class ***/
/************************/
#ifndef __LAYER_TILE_H__
#define __LAYER_TILE_H__
/*****************************************************************************/
2000-12-14 17:38:34 +01:00
struct sTileTableElem
2000-12-09 18:22:06 +01:00
{
2000-12-14 17:38:34 +01:00
TSPRT_16 Prim;
sTile *Tile;
u32 TileFlags;
sTileTableElem *Right;
sTileTableElem *Down;
2000-12-09 18:22:06 +01:00
};
2000-12-14 17:38:34 +01:00
struct sTileTable
2000-12-09 18:22:06 +01:00
{
2000-12-12 21:56:51 +01:00
int MapX,MapY;
u32 ShiftXY;
2000-12-14 17:38:34 +01:00
sTileTableElem *Table;
2000-12-09 18:22:06 +01:00
};
/*****************************************************************************/
class CLayerTile
2000-12-07 02:15:53 +01:00
{
public:
2000-12-09 18:22:06 +01:00
enum LAYER_TILE_TYPE
{ // Stored reverse for rendering :o)
LAYER_TILE_TYPE_FORE,
LAYER_TILE_TYPE_ACTION,
LAYER_TILE_TYPE_MID,
LAYER_TILE_TYPE_BACK,
LAYER_TILE_TYPE_MAX
};
enum
2000-12-07 02:15:53 +01:00
{
2000-12-09 18:22:06 +01:00
TILE_WIDTH=16,
TILE_HEIGHT=16,
SCREEN_TILE_WIDTH=32, // fast bits ops :o)
SCREEN_TILE_HEIGHT=16, // fast bits ops :o)
SCREEN_TILE_SIZE=SCREEN_TILE_WIDTH*SCREEN_TILE_HEIGHT
2000-12-07 02:15:53 +01:00
};
2000-12-09 18:22:06 +01:00
2000-12-12 21:56:51 +01:00
CLayerTile(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList);
2000-12-09 18:22:06 +01:00
virtual ~CLayerTile();
2000-12-12 21:56:51 +01:00
virtual void init(VECTOR &MapPos,int Shift,int Width=SCREEN_TILE_WIDTH,int Height=SCREEN_TILE_HEIGHT);
virtual void shutdown();
virtual void think(VECTOR &MapPos);
virtual void render();
2000-12-09 18:22:06 +01:00
2000-12-07 16:56:20 +01:00
2000-12-09 18:22:06 +01:00
protected:
2000-12-14 17:38:34 +01:00
void UpdateWholeMap(sTileTable &ThisMap);
sTileTable &GetTileTable();
2000-12-12 21:56:51 +01:00
int CalcTableOfs(int X,int Y);
int CalcMapOfs(int X,int Y);
2000-12-14 17:38:34 +01:00
void UpdateRow(int MapX,int MapY,sTileTable &ThisMap);
void UpdateColumn(int MapX,int MapY,sTileTable &ThisMap);
2000-12-12 21:56:51 +01:00
void renderSolid();
2000-12-14 17:38:34 +01:00
void render3d();
void RenderBlock(sTile *Tile,u32 Flags);
2000-12-07 02:15:53 +01:00
2000-12-09 18:22:06 +01:00
sLayerHdr *LayerHdr;
2000-12-07 16:56:20 +01:00
sTile *TileList;
sTri *TriList;
sQuad *QuadList;
sVtx *VtxList;
sTileMapElem *Map;
2000-12-07 02:15:53 +01:00
2000-12-14 17:38:34 +01:00
int MapWidth,MapHeight,MapXYShift;
int TileTableWidth,TileTableHeight;
sTileTable TileTable[2]; // Double Buffered
2000-12-07 02:15:53 +01:00
};
/*****************************************************************************/
#endif