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
player_step(Player *p)
action_spent(Player *p)
{
p->total_steps++;
p->steps++;
p->missText->pos = p->sprite->pos;
p->hitText->pos = p->sprite->pos;
p->total_steps++;
for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) {
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
has_collided(Player *player, RoomMatrix *matrix)
{
@ -129,14 +135,14 @@ has_collided(Player *player, RoomMatrix *matrix)
player_monster_kill_check(player, space->monster);
player_step(player);
action_spent(player);
} else if (collided) {
mixer_play_effect(BONK);
gui_log("Ouch! There is something in the way");
}
if (space->items != NULL) {
if (space->items != NULL && !collided) {
LinkedList *items = space->items;
while (items != NULL) {
Item *item = items->data;