- Fixed: When PlayerIsGone() destroys a morphed player, it needs to destroy the unmorphed player too.

- Fixed: Destroying a morphed player would try to unmorph the player twice.

SVN r3611 (trunk)
This commit is contained in:
Randy Heit 2012-05-01 03:43:14 +00:00
parent 0835230454
commit 1656744827
5 changed files with 30 additions and 16 deletions

View file

@ -612,6 +612,11 @@ void PlayerIsGone (int netnode, int netconsole)
P_DisconnectEffect (players[netconsole].mo); P_DisconnectEffect (players[netconsole].mo);
players[netconsole].mo->player = NULL; players[netconsole].mo->player = NULL;
players[netconsole].mo->Destroy (); players[netconsole].mo->Destroy ();
if (!(players[netconsole].mo->ObjectFlags & OF_EuthanizeMe))
{ // We just destroyed a morphed player, so now the original player
// has taken their place. Destroy that one too.
players[netconsole].mo->Destroy();
}
players[netconsole].mo = NULL; players[netconsole].mo = NULL;
players[netconsole].camera = NULL; players[netconsole].camera = NULL;
} }

View file

@ -1843,12 +1843,14 @@ void APowerMorph::EndEffect( )
} }
// Unmorph if possible // Unmorph if possible
if (!bNoCallUndoMorph)
{
int savedMorphTics = Player->morphTics; int savedMorphTics = Player->morphTics;
P_UndoPlayerMorph (Player, Player); P_UndoPlayerMorph (Player, Player);
// Abort if unmorph failed; in that case, // Abort if unmorph failed; in that case,
// set the usual retry timer and return. // set the usual retry timer and return.
if (Player->morphTics) if (Player != NULL && Player->morphTics)
{ {
// Transfer retry timeout // Transfer retry timeout
// to the powerup's timer. // to the powerup's timer.
@ -1860,7 +1862,7 @@ void APowerMorph::EndEffect( )
// Try again some time later // Try again some time later
return; return;
} }
}
// Unmorph suceeded // Unmorph suceeded
Player = NULL; Player = NULL;
} }

View file

@ -247,6 +247,7 @@ class APowerMorph : public APowerup
DECLARE_CLASS( APowerMorph, APowerup ) DECLARE_CLASS( APowerMorph, APowerup )
public: public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void SetNoCallUndoMorph() { bNoCallUndoMorph = true; }
FNameNoInit PlayerClass, MorphFlash, UnMorphFlash; FNameNoInit PlayerClass, MorphFlash, UnMorphFlash;
int MorphStyle; int MorphStyle;
@ -256,6 +257,7 @@ protected:
void EndEffect (); void EndEffect ();
// Variables // Variables
player_t *Player; player_t *Player;
bool bNoCallUndoMorph; // Because P_UndoPlayerMorph() can call EndEffect recursively
}; };
#endif //__A_ARTIFACTS_H__ #endif //__A_ARTIFACTS_H__

View file

@ -202,6 +202,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
next = item->Inventory; next = item->Inventory;
if (item->IsKindOf(RUNTIME_CLASS(APowerMorph))) if (item->IsKindOf(RUNTIME_CLASS(APowerMorph)))
{ {
static_cast<APowerMorph *>(item)->SetNoCallUndoMorph();
item->Destroy(); item->Destroy();
} }
} }

View file

@ -558,6 +558,10 @@ bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough, int ammouse)
void AWeapon::PostMorphWeapon () void AWeapon::PostMorphWeapon ()
{ {
if (Owner == NULL)
{
return;
}
Owner->player->PendingWeapon = WP_NOCHANGE; Owner->player->PendingWeapon = WP_NOCHANGE;
Owner->player->ReadyWeapon = this; Owner->player->ReadyWeapon = this;
Owner->player->psprites[ps_weapon].sy = WEAPONBOTTOM; Owner->player->psprites[ps_weapon].sy = WEAPONBOTTOM;