mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- fixed handling of the "ouch" face.
This depended on order of execution, taking the health values to compare from variables which were not synchronized properly. Now both the last and current health being used here are being retrieved in the same place so that further changes cannot break this again.
This commit is contained in:
parent
5ca1bb3979
commit
c3e3fda94a
2 changed files with 10 additions and 8 deletions
|
@ -293,7 +293,8 @@ class FMugShot
|
|||
FMugShotState *CurrentState;
|
||||
int RampageTimer;
|
||||
int LastDamageAngle;
|
||||
int FaceHealth;
|
||||
int FaceHealthNow;
|
||||
int FaceHealthLast;
|
||||
bool bEvilGrin;
|
||||
bool bDamageFaceActive;
|
||||
bool bNormal;
|
||||
|
|
|
@ -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.";
|
||||
|
|
Loading…
Reference in a new issue