X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/4cb2d309b35bc7acc33483bdcd0af2a749206369..987c3c8b0cac8854e8802dfbd8e7192739e51b57:/badge/jumpnrun/jumpnrun.h diff --git a/badge/jumpnrun/jumpnrun.h b/badge/jumpnrun/jumpnrun.h index 2437c36..899eebc 100644 --- a/badge/jumpnrun/jumpnrun.h +++ b/badge/jumpnrun/jumpnrun.h @@ -24,19 +24,32 @@ enum { JUMPNRUN_MAX_SPAWNED_ENEMIES = 10 }; +typedef struct jumpnrun_shot { + rectangle old_box; + rectangle current_box; + vec2d inertia; + uint8_t tick; +} jumpnrun_shot; + +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); } + +enum { + JUMPNRUN_MAX_SHOTS = 2 +}; + typedef struct jumpnrun_game_state { jumpnrun_moveable player; uint8_t status; int left; - uint8_t anim_direction; + uint8_t lives; + uint8_t keys; - size_t spawned_enemies_counter; - size_t spawned_enemies[JUMPNRUN_MAX_SPAWNED_ENEMIES]; + jumpnrun_shot shots[JUMPNRUN_MAX_SHOTS]; } jumpnrun_game_state; -rectangle hacker_rect_current(jumpnrun_game_state const *state); - +vec2d hacker_extents(void); void jumpnrun_passive_movement(vec2d *inertia); uint8_t jumpnrun_play(char const *lvname);