sgdk
map.h
Go to the documentation of this file.
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 
00076 typedef struct
00077 {
00078     u16 w;
00079     u16 h;
00080     u16 hp;
00081     u16 compression;
00082     u16 numMetaTile;
00083     u16 numBlock;
00084     u16 *metaTiles;
00085     void* blocks;
00086     void* blockIndexes;
00087     u16* blockRowOffsets;
00088 } MapDefinition;
00089 
00090 
00140 typedef struct Map
00141 {
00142     u16 w;
00143     u16 h;
00144     u16* metaTiles;
00145     void* blocks;
00146     void* blockIndexes;
00147     u16* blockRowOffsets;
00148     VDPPlane plane;
00149     u16 baseTile;
00150     u32 posX;
00151     u32 posY;
00152     u16 wMask;
00153     u16 hMask;
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 
00187 Map* MAP_create(const MapDefinition* mapDef, VDPPlane plane, u16 baseTile);
00188 
00196 void MAP_release(Map* map);
00197 
00216 void MAP_scrollTo(Map* map, u32 x, u32 y);
00232 void MAP_scrollToEx(Map* map, u32 x, u32 y, bool forceRedraw);
00233 
00257 u16 MAP_getMetaTile(Map* map, u16 x, u16 y);
00281 u16 MAP_getTile(Map* map, u16 x, u16 y);
00310 void MAP_getMetaTilemapRect(Map* map, u16 x, u16 y, u16 w, u16 h, u16* dest);
00342 void MAP_getTilemapRect(Map* map, u16 x, u16 y, u16 w, u16 h, bool column, u16* dest);
00343 
00344 
00345 #endif // _MAP_H_
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines