sgdk
|
00001 00026 #ifndef _MAP_H_ 00027 #define _MAP_H_ 00028 00029 00030 #include "vdp.h" 00031 #include "vdp_tile.h" 00032 #include "pal.h" 00033 00034 00080 typedef struct 00081 { 00082 u16 w; 00083 u16 h; 00084 u16 hp; 00085 u16 compression; 00086 u16 numMetaTile; 00087 u16 numBlock; 00088 Palette *palette; 00089 TileSet *tileset; 00090 u16 *metaTiles; 00091 void *blocks; 00092 void *blockIndexes; 00093 u16 *blockRowOffsets; 00094 } MapDefinition; 00095 00096 00142 typedef struct Map 00143 { 00144 u16 w; 00145 u16 h; 00146 u16 *metaTiles; 00147 void *blocks; 00148 void *blockIndexes; 00149 u16 *blockRowOffsets; 00150 VDPPlane plane; 00151 u16 baseTile; 00152 u32 posX; 00153 u32 posY; 00154 u16 planeWidthMask; 00155 u16 planeHeightMask; 00156 u16 lastXT; 00157 u16 lastYT; 00158 u16 hScrollTable[240]; 00159 u16 vScrollTable[20]; 00160 void (*prepareMapDataColumnCB)(struct Map *map, u16 *bufCol1, u16 *bufCol2, u16 xm, u16 ym, u16 height); 00161 void (*prepareMapDataRowCB)(struct Map *map, u16 *bufRow1, u16 *bufRow2, u16 xm, u16 ym, u16 width); 00162 u16 (*getMetaTileCB)(struct Map *map, u16 x, u16 y); 00163 void (*getMetaTilemapRectCB)(struct Map *map, u16 x, u16 y, u16 w, u16 h, u16* dest); 00164 } Map; 00165 00166 00186 Map* MAP_create(const MapDefinition* mapDef, VDPPlane plane, u16 baseTile); 00187 00206 void MAP_scrollTo(Map* map, u32 x, u32 y); 00207 00231 u16 MAP_getMetaTile(Map* map, u16 x, u16 y); 00255 u16 MAP_getTile(Map* map, u16 x, u16 y); 00284 void MAP_getMetaTilemapRect(Map* map, u16 x, u16 y, u16 w, u16 h, u16* dest); 00316 void MAP_getTilemapRect(Map* map, u16 x, u16 y, u16 w, u16 h, bool column, u16* dest); 00317 00318 00319 #endif // _MAP_H_