(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]

This commit is contained in:
tron
2005-01-07 17:02:43 +00:00
parent fe798488e6
commit 414ac3286b
35 changed files with 220 additions and 208 deletions

16
map.h
View File

@@ -4,6 +4,8 @@
#define TILE_X_BITS 8
#define TILE_Y_BITS 8
#define TILE_MASK(x) (int)((x) & ((1 << (MapLogX() + MapLogY())) - 1))
extern byte _map_type_and_height[];
extern byte _map5[];
extern byte _map3_lo[];
@@ -24,6 +26,20 @@ static inline uint MapMaxY(void) { return MapSizeY() - 1; }
/* The number of tiles in the map */
static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); }
typedef uint16 TileIndex;
static inline uint TileX(TileIndex tile)
{
return tile & MapMaxX();
}
static inline uint TileY(TileIndex tile)
{
return tile >> MapLogX();
}
typedef int16 TileIndexDiff;
typedef struct TileIndexDiffC {