-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathformat_lvl.h
66 lines (52 loc) · 1.47 KB
/
format_lvl.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef FORMAT_LVL_H
#define FORMAT_LVL_H
#include <sys/cdefs.h>
#include <assert.h>
#include <stdint.h>
#include <gamemath/fix16.h>
typedef enum layer_flags {
LAYER_FLAGS_NONE = 0
} layer_flags_t;
typedef enum object_flags {
OBJECT_FLAGS_NONE = 0
} object_flags_t;
typedef struct object {
uint16_t id;
object_flags_t flags;
fix16_t x;
fix16_t y;
} __packed object_t;
typedef struct layer {
uint16_t width;
uint16_t height;
uint32_t pnd_byte_size;
uint32_t cg_byte_size;
uint16_t palette_count;
layer_flags_t flags;
} __packed layer_t;
typedef struct lvl {
const char signature[4];
fix16_t player_x;
fix16_t player_y;
uint32_t playfield_byte_size;
uint32_t near_byte_size;
uint32_t far_byte_size;
uint32_t overlap_byte_size;
uint32_t objects_byte_size;
} __packed lvl_t;
typedef enum map_value_flags {
MAP_VALUE_FLAG_NONE = 0,
MAP_VALUE_FLAG_COLLISION = 1 << 0,
MAP_VALUE_FLAG_INSTANT_KILL = 1 << 1,
MAP_VALUE_FLAG_TRIGGER = 1 << 2,
/* Used for alignment */
MAP_VALUE_FLAG_ALIGNED = 0xFF
} __packed map_value_flags_t;
static_assert(sizeof(map_value_flags_t) == 1);
typedef struct map_value {
uint16_t pnd;
map_value_flags_t flags;
uint8_t index;
} __packed map_value_t;
static_assert(sizeof(map_value_t) == 4);
#endif /* !FORMAT_LVL_H */