X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/a7875e0dd83390a47de359df1f33a017ecb3f065..926f4cca0bec5b39f4d45dc9cdece5ddcedbcd95:/badge/jumpnrun/jumpnrun.h diff --git a/badge/jumpnrun/jumpnrun.h b/badge/jumpnrun/jumpnrun.h index e8c2c05..c6613f5 100644 --- a/badge/jumpnrun/jumpnrun.h +++ b/badge/jumpnrun/jumpnrun.h @@ -6,9 +6,8 @@ #include "levels.h" #include "tiles.h" -#include "../util/fixed_point.h" -#include "../util/rectangle.h" #include "../ui/sprite.h" +#include "../util/util.h" #include #include @@ -25,28 +24,31 @@ enum { JUMPNRUN_MAX_SPAWNED_ENEMIES = 10 }; -typedef struct jumpnrun_game_state { - vec2d current_pos; - vec2d inertia; - vec2d inertia_mod; - uint8_t status; - - uint8_t tick_minor; - uint8_t anim_frame; - uint8_t anim_direction; +typedef struct jumpnrun_shot { + rectangle old_box; + rectangle current_box; + vec2d inertia; + uint8_t tick; +} jumpnrun_shot; - int left; +static inline bool jumpnrun_shot_spawned(jumpnrun_shot const *shot) { return fixed_point_ne(shot->inertia.x, FIXED_INT(0)); } +static inline void jumpnrun_shot_despawn(jumpnrun_shot *shot) { shot->inertia.x = FIXED_INT(0); } - bool touching_ground; - uint8_t jumpable_frames; +enum { + JUMPNRUN_MAX_SHOTS = 2 +}; - size_t spawned_enemies_counter; - size_t spawned_enemies[JUMPNRUN_MAX_SPAWNED_ENEMIES]; -} jumpnrun_game_state; +typedef struct jumpnrun_game_state { + jumpnrun_moveable player; -rectangle hacker_rect_current(jumpnrun_game_state const *state); + uint8_t status; + int left; + uint8_t lives; + jumpnrun_shot shots[JUMPNRUN_MAX_SHOTS]; +} jumpnrun_game_state; +vec2d hacker_extents(void); void jumpnrun_passive_movement(vec2d *inertia); uint8_t jumpnrun_play(char const *lvname);