rasterized clamp top/bottom
[gbajam22] / src / level.h
1 #ifndef LEVEL_H_
2 #define LEVEL_H_
3
4 #include <stdint.h>
5
6 enum { MOBS_DEAD, MOBS_IDLE, MOBS_ENGAGE, MOBS_RUN };
7
8 struct mob {
9         uint8_t type;
10         uint8_t x, y;
11         uint8_t state;
12         struct mob *next;
13         struct mob *cellnext;
14
15         void (*update)(void);
16 };
17
18 struct item {
19         uint8_t type;
20         uint8_t x, y;
21         uint8_t pad;
22         struct item *next;
23         struct item *cellnext;
24 };
25
26 enum { CELL_SOLID, CELL_WALK };
27
28 struct cell {
29         uint8_t type;
30         uint8_t x, y;
31         uint8_t pad;
32         struct mob *mobs;
33         struct item *items;
34 };
35
36 struct level {
37         int width, height;
38         unsigned int xmask;
39         struct cell *cells;
40
41         struct mob *mobs;
42         struct item *items;
43 };
44
45
46 struct level *init_level(const char *descstr);
47 void free_level(struct level *lvl);
48
49 #endif  /* LEVEL_H_ */