fix ouch face when health increases significantly (#2055)

* restore old CalcPainOffset function
This commit is contained in:
Roman Fomin 2024-11-28 10:16:50 +07:00 committed by GitHub
parent ac5ec75838
commit e48e8c2cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 CalcPainOffset(sbe_face_t *face, player_t *player)
{ {
static int lasthealthcalc;
static int oldhealth = -1;
int health = player->health > 100 ? 100 : player->health; int health = player->health > 100 ? 100 : player->health;
int lasthealthcalc = if (oldhealth != health)
{
lasthealthcalc =
ST_FACESTRIDE * (((100 - health) * ST_NUMPAINFACES) / 101); ST_FACESTRIDE * (((100 - health) * ST_NUMPAINFACES) / 101);
face->oldhealth = health; oldhealth = health;
}
return lasthealthcalc; return lasthealthcalc;
} }
@ -726,6 +731,8 @@ static void UpdateFace(sbe_face_t *face, player_t *player)
} }
--face->facecount; --face->facecount;
face->oldhealth = player->health;
} }
static void UpdateNumber(sbarelem_t *elem, player_t *player) static void UpdateNumber(sbarelem_t *elem, player_t *player)