diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index 1b89190ca..f7faee70b 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -293,7 +293,8 @@ class FMugShot FMugShotState *CurrentState; int RampageTimer; int LastDamageAngle; - int FaceHealth; + int FaceHealthNow; + int FaceHealthLast; bool bEvilGrin; bool bDamageFaceActive; bool bNormal; diff --git a/src/g_statusbar/sbar_mugshot.cpp b/src/g_statusbar/sbar_mugshot.cpp index 0da401a0f..d494efbe8 100644 --- a/src/g_statusbar/sbar_mugshot.cpp +++ b/src/g_statusbar/sbar_mugshot.cpp @@ -221,7 +221,7 @@ FMugShot::FMugShot() void FMugShot::Reset() { - FaceHealth = -1; + FaceHealthNow = FaceHealthLast = -1; bEvilGrin = false; bNormal = true; bDamageFaceActive = false; @@ -262,7 +262,8 @@ void FMugShot::Tick(player_t *player) { RampageTimer = 0; } - FaceHealth = player->health; + FaceHealthLast = FaceHealthNow; + FaceHealthNow = player->health; } //=========================================================================== @@ -328,7 +329,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags) { FString full_state_name; - if (player->health > 0) + if (FaceHealthNow > 0) { if (bEvilGrin && !(stateflags & DISABLEGRIN)) { @@ -340,10 +341,10 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags) } bEvilGrin = false; - bool ouch = (!st_oldouch && FaceHealth - player->health > ST_MUCHPAIN) || (st_oldouch && player->health - FaceHealth > ST_MUCHPAIN); + bool ouch = (!st_oldouch && FaceHealthLast - FaceHealthNow > ST_MUCHPAIN) || (st_oldouch && FaceHealthNow - FaceHealthLast > ST_MUCHPAIN); if (player->damagecount && // Now go in if pain is disabled but we think ouch will be shown (and ouch is not disabled!) - (!(stateflags & DISABLEPAIN) || (((FaceHealth != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH)))) + (!(stateflags & DISABLEPAIN) || (((FaceHealthLast != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH)))) { int damage_angle = 1; if (player->attacker && player->attacker != player->mo) @@ -364,7 +365,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags) } } bool use_ouch = false; - if (((FaceHealth != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH)) + if (((FaceHealthLast != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH)) { use_ouch = true; full_state_name = "ouch."; @@ -391,7 +392,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags) else { bool use_ouch = false; - if (((FaceHealth != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH)) + if (((FaceHealthLast != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH)) { use_ouch = true; full_state_name = "ouch.";