X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/987c3c8b0cac8854e8802dfbd8e7192739e51b57..ac05cee74d9922fdca433dd2c03fd8542002bb28:/badge/jumpnrun/items.c?ds=sidebyside diff --git a/badge/jumpnrun/items.c b/badge/jumpnrun/items.c index d4fb281..42e83b1 100644 --- a/badge/jumpnrun/items.c +++ b/badge/jumpnrun/items.c @@ -1,12 +1,13 @@ #include "items.h" #include "jumpnrun.h" +#include "game_state.h" static void on_collect_win(jumpnrun_item *self, jumpnrun_game_state *state, jumpnrun_level *lv) { (void) lv; self->flags |= JUMPNRUN_ITEM_COLLECTED; - state->status = JUMPNRUN_WON; + state->flags |= JUMPNRUN_STATE_WON; } static void on_collect_checkpoint(jumpnrun_item *self, @@ -15,7 +16,7 @@ static void on_collect_checkpoint(jumpnrun_item *self, (void) state; self->flags |= JUMPNRUN_ITEM_COLLECTED; lv->start_pos = (vec2d) { self->pos.x, - fixed_point_sub(fixed_point_add(self->pos.y, FIXED_INT(self->type->sprite.height)), hacker_extents().y) + fixed_point_sub(fixed_point_add(self->pos.y, FIXED_INT(self->type->sprite.height)), jumpnrun_player_extents().y) }; } @@ -24,13 +25,13 @@ static void on_collect_key(jumpnrun_item *self, jumpnrun_level *lv) { (void) lv; self->flags |= JUMPNRUN_ITEM_COLLECTED; - ++state->keys; + ++state->player.keys; } static void on_collect_encrypted(jumpnrun_item *self, jumpnrun_game_state *state, jumpnrun_level *lv) { - if(state->keys != 0) { + if(state->player.keys != 0) { on_collect_win(self, state, lv); } }