2000-12-07 02:15:53 +01:00
|
|
|
/************************/
|
|
|
|
/*** Tile Layer Class ***/
|
|
|
|
/************************/
|
|
|
|
|
|
|
|
#ifndef __LAYER_TILE_H__
|
|
|
|
#define __LAYER_TILE_H__
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2000-12-09 18:22:06 +01:00
|
|
|
struct sTileMap2dElem
|
|
|
|
{
|
|
|
|
TSPRT_16 Tile;
|
|
|
|
sTileMap2dElem *Right;
|
|
|
|
sTileMap2dElem *Down;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sTileMap2d
|
|
|
|
{
|
2000-12-12 21:56:51 +01:00
|
|
|
int MapX,MapY;
|
|
|
|
u32 ShiftXY;
|
2000-12-09 18:22:06 +01:00
|
|
|
sTileMap2dElem *List;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
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-12 21:56:51 +01:00
|
|
|
void SetMapShift(int Shift) {MapShift=Shift;}
|
|
|
|
int GetWidth() {return(LayerHdr->Width);}
|
|
|
|
int GetHeight() {return(LayerHdr->Height);}
|
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-12 21:56:51 +01:00
|
|
|
sTileMap2d &GetTileMap();
|
|
|
|
int CalcTableOfs(int X,int Y);
|
|
|
|
int CalcMapOfs(int X,int Y);
|
|
|
|
void UpdateRow(int MapX,int MapY,sTileMap2d &ThisMap);
|
|
|
|
void UpdateColumn(int MapX,int MapY,sTileMap2d &ThisMap);
|
|
|
|
|
|
|
|
void renderSolid();
|
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-12 21:56:51 +01:00
|
|
|
int MapShift;
|
2000-12-09 18:22:06 +01:00
|
|
|
int TileMapWidth,TileMapHeight;
|
|
|
|
sTileMap2d TileMap2d[2]; // Double Buffered
|
2000-12-07 02:15:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#endif
|