- 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'.

This commit is contained in:
Christoph Oelckers 2017-05-20 20:56:43 +02:00
parent fc8639226d
commit 4388d97db6

View file

@ -489,7 +489,7 @@ class PlayerPawn : Actor native
Pitch = 0.; Pitch = 0.;
} }
} }
CalcHeight (); player.mo.CalcHeight ();
if (player.attacker && player.attacker != self) if (player.attacker && player.attacker != self)
{ // Watch killer { // Watch killer
@ -1243,9 +1243,9 @@ class PlayerPawn : Actor native
CheckEnvironment(); CheckEnvironment();
CheckUse(); CheckUse();
CheckUndoMorph(); CheckUndoMorph();
// Cycle psprites // Cycle psprites.
TickPSprites(); // 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 // Other Counters
if (player.damagecount) player.damagecount--; if (player.damagecount) player.damagecount--;
if (player.bonuscount) player.bonuscount--; if (player.bonuscount) player.bonuscount--;
@ -1254,12 +1254,11 @@ class PlayerPawn : Actor native
{ {
player.hazardcount--; player.hazardcount--;
if (!(level.time % player.hazardinterval) && player.hazardcount > 16*TICRATE) if (!(level.time % player.hazardinterval) && player.hazardcount > 16*TICRATE)
DamageMobj (NULL, NULL, 5, player.hazardtype); player.mo.DamageMobj (NULL, NULL, 5, player.hazardtype);
} }
player.mo.CheckPoison();
CheckPoison(); player.mo.CheckDegeneration();
CheckDegeneration(); player.mo.CheckAirSupply();
CheckAirSupply();
} }
} }