2000-12-07 02:15:53 +01:00
|
|
|
/************************/
|
|
|
|
/*** Tile Layer Class ***/
|
|
|
|
/************************/
|
|
|
|
|
|
|
|
#ifndef __LAYER_TILE_H__
|
|
|
|
#define __LAYER_TILE_H__
|
|
|
|
|
2001-01-16 17:20:45 +01:00
|
|
|
#include <dstructs.h>
|
2001-01-15 16:22:33 +01:00
|
|
|
#include "gfx\prim.h"
|
2000-12-07 02:15:53 +01:00
|
|
|
|
2001-01-16 17:20:45 +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
|
|
|
|
2001-01-15 16:22:33 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
const s32 LayerOT=MAX_OT-1;
|
|
|
|
|
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,
|
2001-01-09 21:38:20 +01:00
|
|
|
SCREEN_TILE_WIDTH=32,
|
|
|
|
SCREEN_TILE_HEIGHT=16,
|
2000-12-09 18:22:06 +01:00
|
|
|
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();
|
|
|
|
|
2001-01-09 21:38:20 +01:00
|
|
|
virtual void init(DVECTOR &MapPos,int Shift,int Width=SCREEN_TILE_WIDTH,int Height=SCREEN_TILE_HEIGHT);
|
2000-12-12 21:56:51 +01:00
|
|
|
virtual void shutdown();
|
2001-01-09 21:38:20 +01:00
|
|
|
virtual void think(DVECTOR &MapPos);
|
2000-12-12 21:56:51 +01:00
|
|
|
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
|