1 #ifndef INCLUDED_JUMPNRUN_LEVEL_H
2 #define INCLUDED_JUMPNRUN_LEVEL_H
8 #include <badge/util/rectangle.h>
10 #include <drivers/fatfs/ff.h>
15 typedef struct jumpnrun_level_header
{
19 } jumpnrun_level_header
;
21 typedef struct jumpnrun_level
{
22 jumpnrun_level_header header
;
28 jumpnrun_enemy
*enemies
;
32 JUMPNRUN_LEVEL_LOAD_OK
,
33 JUMPNRUN_LEVEL_LOAD_ERROR
36 size_t jumpnrun_level_count(void);
37 void jumpnrun_levels_dump(void);
39 int jumpnrun_load_level_header_from_file(jumpnrun_level
*dest
, FIL
*fd
);
40 int jumpnrun_load_level_from_file (jumpnrun_level
*dest
, FIL
*fd
);
42 // Use stack-local VLAs to store dynamic content.
43 #define JUMPNRUN_LEVEL_MAKE_SPACE(var) \
44 jumpnrun_tile var ## _tiles [var.header.tile_count]; \
45 jumpnrun_item var ## _items [var.header.item_count]; \
46 jumpnrun_enemy var ## _enemies[var.header.enemy_count]; \
48 var.tiles = var ## _tiles; \
49 var.items = var ## _items; \
50 var.enemies = var ## _enemies;