mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- 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:
parent
0835230454
commit
1656744827
5 changed files with 30 additions and 16 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1843,24 +1843,26 @@ void APowerMorph::EndEffect( )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmorph if possible
|
// Unmorph if possible
|
||||||
int savedMorphTics = Player->morphTics;
|
if (!bNoCallUndoMorph)
|
||||||
P_UndoPlayerMorph (Player, Player);
|
|
||||||
|
|
||||||
// Abort if unmorph failed; in that case,
|
|
||||||
// set the usual retry timer and return.
|
|
||||||
if (Player->morphTics)
|
|
||||||
{
|
{
|
||||||
// Transfer retry timeout
|
int savedMorphTics = Player->morphTics;
|
||||||
// to the powerup's timer.
|
P_UndoPlayerMorph (Player, Player);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 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
|
// Unmorph suceeded
|
||||||
Player = NULL;
|
Player = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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__
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue