- fixed crash on player unmorph after falling death

Rearranged conditions to avoid accessing player from obsolete morphed pawn
Unmorphing upon death resets player in morphed actor, so player alive state should be tested first
Removed duplicate health check as well

https://forum.zdoom.org/viewtopic.php?t=65429
This commit is contained in:
alexey.lysiuk 2019-07-23 12:10:16 +03:00
parent 7e71532ccc
commit 435f0bb0b0

View file

@ -2780,11 +2780,11 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
P_FallingDamage (mo);
// [RH] only make noise if alive
if (!mo->player->morphTics && mo->health > 0)
if (mo->health > 0 && !mo->player->morphTics)
{
grunted = false;
// Why should this number vary by gravity?
if (mo->health > 0 && mo->Vel.Z < -mo->player->mo->FloatVar(NAME_GruntSpeed))
if (mo->Vel.Z < -mo->player->mo->FloatVar(NAME_GruntSpeed))
{
S_Sound (mo, CHAN_VOICE, "*grunt", 1, ATTN_NORM);
grunted = true;