added scr_lvled, a bunch of libraries, and improved framework code
[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
29 void init_level(struct level *lvl);
30 void destroy_level(struct level *lvl);
31
32 void lvl_gen_rects(struct level *lvl);
33
34 int save_level(const struct level *lvl, const char *fname);
35 int load_level(struct level *lvl, const char *fname);
36
37 #endif  /* LEVEL_H_ */