map.h
author tron
Mon, 03 Jan 2005 12:56:22 +0000
changeset 856 07dc27d0503e
parent 817 4f9377b7fd2b
child 863 8d09f9331a80
permissions -rw-r--r--
(svn r1337) Use MapMax[XY]() (or MapSize[XY]() if appropriate) instead of TILE_MAX_[XY]
While here replace one erroneous TILE_MAX_X with MapMaxY()
679
e959706a3e4d (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
e959706a3e4d (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
e959706a3e4d (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     3
e959706a3e4d (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
e959706a3e4d (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
e959706a3e4d (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     6
e959706a3e4d (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)
e959706a3e4d (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)
e959706a3e4d (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     9
817
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    10
extern byte   _map_type_and_height[];
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    11
extern byte   _map5[];
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    12
extern byte   _map3_lo[];
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    13
extern byte   _map3_hi[];
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    14
extern byte   _map_owner[];
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    15
extern uint16 _map2[];
4f9377b7fd2b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    16
extern byte   _map_extra_bits[];
679
e959706a3e4d (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    17
689
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    18
// binary logarithm of the map size, try to avoid using this one
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    19
static inline uint MapLogX(void)  { extern uint _map_log_x; return _map_log_x; }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    20
static inline uint MapLogY(void)  { extern uint _map_log_y; return _map_log_y; }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    21
/* The size of the map */
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    22
static inline uint MapSizeX(void) { return 1 << MapLogX(); }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    23
static inline uint MapSizeY(void) { return 1 << MapLogY(); }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    24
/* The maximum coordinates */
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    25
static inline uint MapMaxX(void) { return MapSizeX() - 1; }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    26
static inline uint MapMaxY(void) { return MapSizeY() - 1; }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    27
/* The number of tiles in the map */
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    28
static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); }
1412bc834a8d (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    29
679
e959706a3e4d (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    30
#endif