- 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);
players[netconsole].mo->player = NULL;
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].camera = NULL;
}

View File

@ -1843,24 +1843,26 @@ void APowerMorph::EndEffect( )
}
// Unmorph if possible
int savedMorphTics = Player->morphTics;
P_UndoPlayerMorph (Player, Player);
// Abort if unmorph failed; in that case,
// set the usual retry timer and return.
if (Player->morphTics)
if (!bNoCallUndoMorph)
{
// Transfer retry timeout
// to the powerup's timer.
EffectTics = Player->morphTics;
// Reload negative morph tics;
// use actual value; it may
// be in use for animation.
Player->morphTics = savedMorphTics;
// Try again some time later
return;
}
int savedMorphTics = Player->morphTics;
P_UndoPlayerMorph (Player, Player);
// Abort if unmorph failed; in that case,
// set the usual retry timer and return.
if (Player != NULL && Player->morphTics)
{
// Transfer retry timeout
// to the powerup's timer.
EffectTics = Player->morphTics;
// Reload negative morph tics;
// use actual value; it may
// be in use for animation.
Player->morphTics = savedMorphTics;
// Try again some time later
return;
}
}
// Unmorph suceeded
Player = NULL;
}

View File

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

View File

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

View File

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