From 4388d97db6f2440037f23b0fac547ddd411f81c2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 20 May 2017 20:56:43 +0200 Subject: [PATCH] - PlayerPawn.PlayerThink needs to consider the possibility of the player getting unmorphed and must call any function after a potential unmorph through 'player.mo' instead of 'self'. --- wadsrc/static/zscript/shared/player.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/wadsrc/static/zscript/shared/player.txt b/wadsrc/static/zscript/shared/player.txt index 1223b6bf8..98b504985 100644 --- a/wadsrc/static/zscript/shared/player.txt +++ b/wadsrc/static/zscript/shared/player.txt @@ -489,7 +489,7 @@ class PlayerPawn : Actor native Pitch = 0.; } } - CalcHeight (); + player.mo.CalcHeight (); if (player.attacker && player.attacker != self) { // Watch killer @@ -1243,9 +1243,9 @@ class PlayerPawn : Actor native CheckEnvironment(); CheckUse(); CheckUndoMorph(); - // Cycle psprites - TickPSprites(); - + // Cycle psprites. + // Note that after this point the PlayerPawn may have changed due to getting unmorphed so 'self' is no longer safe to use. + player.mo.TickPSprites(); // Other Counters if (player.damagecount) player.damagecount--; if (player.bonuscount) player.bonuscount--; @@ -1254,12 +1254,11 @@ class PlayerPawn : Actor native { player.hazardcount--; if (!(level.time % player.hazardinterval) && player.hazardcount > 16*TICRATE) - DamageMobj (NULL, NULL, 5, player.hazardtype); + player.mo.DamageMobj (NULL, NULL, 5, player.hazardtype); } - - CheckPoison(); - CheckDegeneration(); - CheckAirSupply(); + player.mo.CheckPoison(); + player.mo.CheckDegeneration(); + player.mo.CheckAirSupply(); } }