Fix bug with player hit text and prevent fight pickups

This commit is contained in:
Linus Probert 2018-03-03 00:54:50 +01:00
parent f9a91c0922
commit 0b98cad726
1 changed files with 12 additions and 6 deletions

View File

@ -78,12 +78,10 @@ player_gain_xp(Player *player, unsigned int xp_gain)
} }
static void static void
player_step(Player *p) action_spent(Player *p)
{ {
p->total_steps++;
p->steps++; p->steps++;
p->missText->pos = p->sprite->pos; p->total_steps++;
p->hitText->pos = p->sprite->pos;
for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) { for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) {
if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0) if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0)
@ -91,6 +89,14 @@ player_step(Player *p)
} }
} }
static void
player_step(Player *p)
{
action_spent(p);
p->missText->pos = p->sprite->pos;
p->hitText->pos = p->sprite->pos;
}
static bool static bool
has_collided(Player *player, RoomMatrix *matrix) has_collided(Player *player, RoomMatrix *matrix)
{ {
@ -129,14 +135,14 @@ has_collided(Player *player, RoomMatrix *matrix)
player_monster_kill_check(player, space->monster); player_monster_kill_check(player, space->monster);
player_step(player); action_spent(player);
} else if (collided) { } else if (collided) {
mixer_play_effect(BONK); mixer_play_effect(BONK);
gui_log("Ouch! There is something in the way"); gui_log("Ouch! There is something in the way");
} }
if (space->items != NULL) { if (space->items != NULL && !collided) {
LinkedList *items = space->items; LinkedList *items = space->items;
while (items != NULL) { while (items != NULL) {
Item *item = items->data; Item *item = items->data;