From e48e8c2cb8cb6a373075f7b50ea7b823508145de Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 28 Nov 2024 10:16:50 +0700 Subject: [PATCH] fix ouch face when health increases significantly (#2055) * restore old CalcPainOffset function --- src/st_stuff.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 2003d782..31600548 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -540,10 +540,15 @@ static int ResolveNumber(sbe_number_t *number, player_t *player) static int CalcPainOffset(sbe_face_t *face, player_t *player) { + static int lasthealthcalc; + static int oldhealth = -1; int health = player->health > 100 ? 100 : player->health; - int lasthealthcalc = - ST_FACESTRIDE * (((100 - health) * ST_NUMPAINFACES) / 101); - face->oldhealth = health; + if (oldhealth != health) + { + lasthealthcalc = + ST_FACESTRIDE * (((100 - health) * ST_NUMPAINFACES) / 101); + oldhealth = health; + } return lasthealthcalc; } @@ -726,6 +731,8 @@ static void UpdateFace(sbe_face_t *face, player_t *player) } --face->facecount; + + face->oldhealth = player->health; } static void UpdateNumber(sbarelem_t *elem, player_t *player)