-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.h
49 lines (33 loc) · 905 Bytes
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef MAP_H
#define MAP_H
#define MAP_X 76
#define MAP_Y 20
#define MAP_OFFSET(x, y) (x) + ((y) * MAP_X)
#include "util.h"
struct monst;
struct map_square {
enum {
TILE_EMPTY,
TILE_WALL_HORIZ,
TILE_WALL_VERT,
TILE_DOOR_LOCKED,
TILE_DOOR_CLOSED,
TILE_DOOR_OPEN,
TILE_DOOR_BORKED,
TILE_STAIR_UP,
TILE_STAIR_DOWN,
TILE_UNREACHABLE
} tile;
struct monst *monster;
};
#define TILE_IS_OPAQUE(t) (t) == TILE_WALL_HORIZ || (t) == TILE_WALL_VERT || (t) == TILE_DOOR_LOCKED || (t) == TILE_DOOR_CLOSED
#define MAP_TILE_IS_OPAQUE(m, x, y) TILE_IS_OPAQUE(m[MAP_OFFSET(x, y)].tile)
typedef struct map_square *map;
map generate_map();
struct coord find_free_square(map);
int can_move_into_square(map, unsigned int, unsigned int);
int is_map_square(int, int);
struct map_square *map_square(map, int, int);
void map_plot(map, unsigned int, unsigned int);
void dump_map(map);
#endif