Fix bug with player hit text and prevent fight pickups
This commit is contained in:
parent
f9a91c0922
commit
0b98cad726
18
src/player.c
18
src/player.c
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue