From d411a7f2098a116d718e4fa05a0c7493b3e83f07 Mon Sep 17 00:00:00 2001 From: XProger Date: Fri, 14 Jan 2022 02:57:34 +0300 Subject: [PATCH] #368 fix "No" sound --- src/fixed/game.h | 4 +++- src/fixed/lara.h | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/fixed/game.h b/src/fixed/game.h index bccd159..064d5ff 100644 --- a/src/fixed/game.h +++ b/src/fixed/game.h @@ -256,7 +256,9 @@ void gameUpdate(int32 frames) if ((inventory.page != INV_PAGE_TITLE) && (inventory.state == INV_STATE_NONE)) { - lara->useItem(inventory.useSlot); + if (lara->useItem(inventory.useSlot)) { + inventory.useSlot = SLOT_MAX; + } } } diff --git a/src/fixed/lara.h b/src/fixed/lara.h index af1a67f..a3d0c8b 100644 --- a/src/fixed/lara.h +++ b/src/fixed/lara.h @@ -3780,7 +3780,7 @@ struct Lara : ItemObj } } - void useItem(InvSlot slot) + bool useItem(InvSlot slot) { switch (slot) { @@ -3801,15 +3801,17 @@ struct Lara : ItemObj if (health < LARA_MAX_HEALTH) { health += (slot == SLOT_MEDIKIT_BIG) ? LARA_MAX_HEALTH : (LARA_MAX_HEALTH >> 1); - if (health > LARA_MAX_HEALTH) + if (health > LARA_MAX_HEALTH) { health = LARA_MAX_HEALTH; + } inventory.remove(slot, 1); extraL->healthTimer = 40; soundPlay(SND_HEALTH, &pos); } break; - default: ; + default: return false; } + return true; } virtual void hit(int32 damage, const vec3i &point, int32 soundId)