tron@679: #ifndef MAP_H tron@679: #define MAP_H tron@679: tron@679: #define TILE_X_BITS 8 tron@679: #define TILE_Y_BITS 8 tron@679: tron@679: #define TILES_X (1 << TILE_X_BITS) tron@679: #define TILES_Y (1 << TILE_Y_BITS) tron@679: tron@679: #define TILE_X_MAX (TILES_X - 1) tron@679: #define TILE_Y_MAX (TILES_Y - 1) tron@679: tron@679: extern byte _map_type_and_height[TILES_X * TILES_Y]; tron@679: extern byte _map5[TILES_X * TILES_Y]; tron@679: extern byte _map3_lo[TILES_X * TILES_Y]; tron@679: extern byte _map3_hi[TILES_X * TILES_Y]; tron@679: extern byte _map_owner[TILES_X * TILES_Y]; tron@679: extern byte _map2[TILES_X * TILES_Y]; tron@679: extern byte _map_extra_bits[TILES_X * TILES_Y / 4]; tron@679: tron@689: // binary logarithm of the map size, try to avoid using this one tron@689: static inline uint MapLogX(void) { extern uint _map_log_x; return _map_log_x; } tron@689: static inline uint MapLogY(void) { extern uint _map_log_y; return _map_log_y; } tron@689: /* The size of the map */ tron@689: static inline uint MapSizeX(void) { return 1 << MapLogX(); } tron@689: static inline uint MapSizeY(void) { return 1 << MapLogY(); } tron@689: /* The maximum coordinates */ tron@689: static inline uint MapMaxX(void) { return MapSizeX() - 1; } tron@689: static inline uint MapMaxY(void) { return MapSizeY() - 1; } tron@689: /* The number of tiles in the map */ tron@689: static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); } tron@689: tron@679: #endif