From 435f0bb0b06be1bfc07e82190eb234fe9ff4a39a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 23 Jul 2019 12:10:16 +0300 Subject: [PATCH] - 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 --- src/playsim/p_mobj.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index a933873c5..2cfcb543e 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -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;