map.h
author bjarni
Tue, 28 Dec 2004 17:18:46 +0000
changeset 819 c425b7e22f6a
parent 817 238bbdaa228b
child 856 918759cedca8
permissions -rw-r--r--
(svn r1290) Added type to typedef struct Engine and filled in the same data as in type in vehicle
it was kind of lame that you should use AircraftVehInfo(), ShipVehInfo() etc. if you wanted to know what type the engine is
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     1
#ifndef MAP_H
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     2
#define MAP_H
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     3
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     4
#define TILE_X_BITS 8
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     5
#define TILE_Y_BITS 8
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     6
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     7
#define TILES_X (1 << TILE_X_BITS)
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     8
#define TILES_Y (1 << TILE_Y_BITS)
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     9
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    10
#define TILE_X_MAX (TILES_X - 1)
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    11
#define TILE_Y_MAX (TILES_Y - 1)
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    12
817
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    13
extern byte   _map_type_and_height[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    14
extern byte   _map5[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    15
extern byte   _map3_lo[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    16
extern byte   _map3_hi[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    17
extern byte   _map_owner[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    18
extern uint16 _map2[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    19
extern byte   _map_extra_bits[];
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    20
689
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    21
// binary logarithm of the map size, try to avoid using this one
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    22
static inline uint MapLogX(void)  { extern uint _map_log_x; return _map_log_x; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    23
static inline uint MapLogY(void)  { extern uint _map_log_y; return _map_log_y; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    24
/* The size of the map */
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    25
static inline uint MapSizeX(void) { return 1 << MapLogX(); }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    26
static inline uint MapSizeY(void) { return 1 << MapLogY(); }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    27
/* The maximum coordinates */
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    28
static inline uint MapMaxX(void) { return MapSizeX() - 1; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    29
static inline uint MapMaxY(void) { return MapSizeY() - 1; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    30
/* The number of tiles in the map */
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    31
static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    32
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    33
#endif