cdbcf95c402d339a428ecc1d2c746fcea8301d32
[hackover2013-badge-firmware.git] / badge / jumpnrun / jumpnrun.h
1 #ifndef INCLUDED_BADGE2013_JUMPNRUN_H
2 #define INCLUDED_BADGE2013_JUMPNRUN_H
3
4 #include "enemies.h"
5 #include "items.h"
6 #include "levels.h"
7 #include "tiles.h"
8
9 #include "../ui/sprite.h"
10 #include "../util/util.h"
11
12 #include <stdbool.h>
13 #include <stddef.h>
14
15 enum {
16 JUMPNRUN_PLAYING,
17 JUMPNRUN_DEAD,
18 JUMPNRUN_WON,
19 JUMPNRUN_ERROR
20 };
21
22 enum {
23 JUMPNRUN_MAX_SPAWN_MARGIN = BADGE_SPRITE_MAX_WIDTH + 1,
24 JUMPNRUN_MAX_SPAWNED_ENEMIES = 10
25 };
26
27 typedef struct jumpnrun_shot {
28 rectangle old_box;
29 rectangle current_box;
30 vec2d inertia;
31 uint8_t tick;
32 } jumpnrun_shot;
33
34 static inline bool jumpnrun_shot_spawned(jumpnrun_shot const *shot) { return fixed_point_ne(shot->inertia.x, FIXED_INT(0)); }
35 static inline void jumpnrun_shot_despawn(jumpnrun_shot *shot) { shot->inertia.x = FIXED_INT(0); }
36
37 enum {
38 JUMPNRUN_MAX_SHOTS = 2
39 };
40
41 typedef struct jumpnrun_game_state {
42 jumpnrun_moveable player;
43
44 uint8_t status;
45 int left;
46
47 jumpnrun_shot shots[JUMPNRUN_MAX_SHOTS];
48 } jumpnrun_game_state;
49
50 rectangle hacker_rect_current(jumpnrun_game_state const *state);
51
52 void jumpnrun_passive_movement(vec2d *inertia);
53
54 uint8_t jumpnrun_play(char const *lvname);
55
56 #endif
This page took 0.044338 seconds and 3 git commands to generate.