distance function generation from level data, first pass
[raydungeon] / src / level.h
1 #ifndef LEVEL_H_
2 #define LEVEL_H_
3
4 enum { DIR_N, DIR_E, DIR_S, DIR_W };
5
6 enum { CELL_SOLID, CELL_OPEN };
7 #define CELL_WALK       0x0100
8
9 struct level_cell {
10         int type;
11         unsigned int wallflags[4];
12         int visited;
13 };
14
15 struct level_rect {
16         int x, y, w, h;
17         unsigned char dbgcol[4];
18 };
19
20 struct level {
21         int xsz, ysz;
22         float scale;
23         struct level_cell *cells;
24         int sx, sy;
25
26         struct level_rect *rects;       /* darr, empty spaces */
27
28         char *sdf_src;
29 };
30
31 void init_level(struct level *lvl);
32 void destroy_level(struct level *lvl);
33
34 void lvl_gen_rects(struct level *lvl);
35
36 int save_level(const struct level *lvl, const char *fname);
37 int load_level(struct level *lvl, const char *fname);
38
39 #endif  /* LEVEL_H_ */