equal
deleted
inserted
replaced
1 #ifndef MAP_H |
1 #ifndef MAP_H |
2 #define MAP_H |
2 #define MAP_H |
3 |
3 |
4 #define TILE_X_BITS 8 |
4 #define TILE_X_BITS 8 |
5 #define TILE_Y_BITS 8 |
5 #define TILE_Y_BITS 8 |
|
6 |
|
7 #define TILE_MASK(x) (int)((x) & ((1 << (MapLogX() + MapLogY())) - 1)) |
6 |
8 |
7 extern byte _map_type_and_height[]; |
9 extern byte _map_type_and_height[]; |
8 extern byte _map5[]; |
10 extern byte _map5[]; |
9 extern byte _map3_lo[]; |
11 extern byte _map3_lo[]; |
10 extern byte _map3_hi[]; |
12 extern byte _map3_hi[]; |
21 /* The maximum coordinates */ |
23 /* The maximum coordinates */ |
22 static inline uint MapMaxX(void) { return MapSizeX() - 1; } |
24 static inline uint MapMaxX(void) { return MapSizeX() - 1; } |
23 static inline uint MapMaxY(void) { return MapSizeY() - 1; } |
25 static inline uint MapMaxY(void) { return MapSizeY() - 1; } |
24 /* The number of tiles in the map */ |
26 /* The number of tiles in the map */ |
25 static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); } |
27 static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); } |
|
28 |
|
29 |
|
30 typedef uint16 TileIndex; |
|
31 |
|
32 static inline uint TileX(TileIndex tile) |
|
33 { |
|
34 return tile & MapMaxX(); |
|
35 } |
|
36 |
|
37 static inline uint TileY(TileIndex tile) |
|
38 { |
|
39 return tile >> MapLogX(); |
|
40 } |
|
41 |
26 |
42 |
27 typedef int16 TileIndexDiff; |
43 typedef int16 TileIndexDiff; |
28 |
44 |
29 typedef struct TileIndexDiffC { |
45 typedef struct TileIndexDiffC { |
30 int16 x; |
46 int16 x; |