2000-12-07 02:15:53 +01:00
|
|
|
/************************/
|
|
|
|
/*** Tile Layer Class ***/
|
|
|
|
/************************/
|
|
|
|
|
|
|
|
#ifndef __LAYER_TILE_H__
|
|
|
|
#define __LAYER_TILE_H__
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-01-04 22:53:14 +01:00
|
|
|
/*
|
2001-01-03 23:12:25 +01:00
|
|
|
struct sPrimGridElem
|
2000-12-09 18:22:06 +01:00
|
|
|
{
|
2000-12-14 17:38:34 +01:00
|
|
|
TSPRT_16 Prim;
|
2001-01-04 22:53:14 +01:00
|
|
|
// u16 Tile;
|
|
|
|
// u16 Flags;
|
2001-01-03 23:12:25 +01:00
|
|
|
sPrimGridElem *Right;
|
|
|
|
sPrimGridElem *Down;
|
2000-12-09 18:22:06 +01:00
|
|
|
};
|
2001-01-04 22:53:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
struct sPrimGridElem
|
|
|
|
{
|
|
|
|
TSPRT_16 Prim;
|
|
|
|
sPrimGridElem *Right;
|
|
|
|
sPrimGridElem *Down;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sPrimGridElem3d : public sPrimGridElem
|
|
|
|
{
|
|
|
|
u16 Tile;
|
|
|
|
u16 Flags;
|
|
|
|
};
|
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
|
|
|
|
|
|
|
protected:
|
2001-01-04 22:53:14 +01:00
|
|
|
virtual void UpdateWholeMap();
|
|
|
|
virtual void UpdateRow(int MapX,int MapY);
|
|
|
|
virtual void UpdateColumn(int MapX,int MapY);
|
|
|
|
|
2001-01-03 23:12:25 +01:00
|
|
|
sPrimGridElem *GetGridPos(int X,int Y);
|
|
|
|
sTileMapElem *GetMapPos(int X,int Y);
|
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;
|
2000-12-07 02:15:53 +01:00
|
|
|
|
2000-12-14 17:38:34 +01:00
|
|
|
int MapWidth,MapHeight,MapXYShift;
|
2001-01-03 23:12:25 +01:00
|
|
|
int PrimGridWidth,PrimGridHeight;
|
|
|
|
|
|
|
|
int MapX,MapY;
|
|
|
|
u16 ShiftX,ShiftY;
|
2001-01-04 22:53:14 +01:00
|
|
|
|
|
|
|
sTileMapElem *Map;
|
2001-01-03 23:12:25 +01:00
|
|
|
sPrimGridElem *PrimGrid;
|
|
|
|
|
2000-12-07 02:15:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#endif
|