mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- exported all member fields from the morph items.
- renamed APowerMorph::Player to avoid accidental confusion with AActor::player, which in scripting is the same due to case insensitvity. - renamed save key for above variable.
This commit is contained in:
parent
7527141ad4
commit
8a7671ad8b
5 changed files with 46 additions and 12 deletions
|
@ -1884,6 +1884,13 @@ void APowerDoubleFiringSpeed::EndEffect( )
|
|||
|
||||
IMPLEMENT_CLASS(APowerMorph, false, false, false, false)
|
||||
|
||||
DEFINE_FIELD(APowerMorph, PlayerClass)
|
||||
DEFINE_FIELD(APowerMorph, MorphFlash)
|
||||
DEFINE_FIELD(APowerMorph, UnMorphFlash)
|
||||
DEFINE_FIELD(APowerMorph, MorphStyle)
|
||||
DEFINE_FIELD(APowerMorph, MorphedPlayer)
|
||||
DEFINE_FIELD(APowerMorph, bInUndoMorph)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerMorph :: Serialize
|
||||
|
@ -1897,7 +1904,7 @@ void APowerMorph::Serialize(FSerializer &arc)
|
|||
("morphstyle", MorphStyle)
|
||||
("morphflash", MorphFlash)
|
||||
("unmorphflash", UnMorphFlash)
|
||||
("player", Player);
|
||||
("morphedplayer", MorphedPlayer);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1917,7 +1924,7 @@ void APowerMorph::InitEffect( )
|
|||
{
|
||||
Owner = realplayer->mo; // Replace the new owner in our owner; safe because we are not attached to anything yet
|
||||
ItemFlags |= IF_CREATECOPYMOVED; // Let the caller know the "real" owner has changed (to the morphed actor)
|
||||
Player = realplayer; // Store the player identity (morphing clears the unmorphed actor's "player" field)
|
||||
MorphedPlayer = realplayer; // Store the player identity (morphing clears the unmorphed actor's "player" field)
|
||||
}
|
||||
else // morph failed - give the caller an opportunity to fail the pickup completely
|
||||
{
|
||||
|
@ -1939,19 +1946,19 @@ void APowerMorph::EndEffect( )
|
|||
// Abort if owner already destroyed
|
||||
if (Owner == NULL)
|
||||
{
|
||||
assert(Player == NULL);
|
||||
assert(MorphedPlayer == NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if owner already unmorphed
|
||||
if (Player == NULL)
|
||||
if (MorphedPlayer == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if owner is dead; their Die() method will
|
||||
// take care of any required unmorphing on death.
|
||||
if (Player->health <= 0)
|
||||
if (MorphedPlayer->health <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1959,26 +1966,26 @@ void APowerMorph::EndEffect( )
|
|||
// Unmorph if possible
|
||||
if (!bInUndoMorph)
|
||||
{
|
||||
int savedMorphTics = Player->morphTics;
|
||||
P_UndoPlayerMorph (Player, Player, 0, !!(Player->MorphStyle & MORPH_UNDOALWAYS));
|
||||
int savedMorphTics = MorphedPlayer->morphTics;
|
||||
P_UndoPlayerMorph (MorphedPlayer, MorphedPlayer, 0, !!(MorphedPlayer->MorphStyle & MORPH_UNDOALWAYS));
|
||||
|
||||
// Abort if unmorph failed; in that case,
|
||||
// set the usual retry timer and return.
|
||||
if (Player != NULL && Player->morphTics)
|
||||
if (MorphedPlayer != NULL && MorphedPlayer->morphTics)
|
||||
{
|
||||
// Transfer retry timeout
|
||||
// to the powerup's timer.
|
||||
EffectTics = Player->morphTics;
|
||||
EffectTics = MorphedPlayer->morphTics;
|
||||
// Reload negative morph tics;
|
||||
// use actual value; it may
|
||||
// be in use for animation.
|
||||
Player->morphTics = savedMorphTics;
|
||||
MorphedPlayer->morphTics = savedMorphTics;
|
||||
// Try again some time later
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Unmorph suceeded
|
||||
Player = NULL;
|
||||
MorphedPlayer = NULL;
|
||||
}
|
||||
|
||||
// Infinite Ammo Powerup -----------------------------------------------------
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
PClassPlayerPawn *PlayerClass;
|
||||
PClassActor *MorphFlash, *UnMorphFlash;
|
||||
int MorphStyle;
|
||||
player_t *Player;
|
||||
player_t *MorphedPlayer;
|
||||
bool bInUndoMorph; // Because P_UndoPlayerMorph() can call EndEffect recursively
|
||||
|
||||
protected:
|
||||
|
|
|
@ -618,6 +618,13 @@ void InitAllPowerupEffects(AInventory *item)
|
|||
|
||||
IMPLEMENT_CLASS(AMorphProjectile, false, false, false, false)
|
||||
|
||||
DEFINE_FIELD(AMorphProjectile, PlayerClass)
|
||||
DEFINE_FIELD(AMorphProjectile, MonsterClass)
|
||||
DEFINE_FIELD(AMorphProjectile, MorphFlash)
|
||||
DEFINE_FIELD(AMorphProjectile, UnMorphFlash)
|
||||
DEFINE_FIELD(AMorphProjectile, Duration)
|
||||
DEFINE_FIELD(AMorphProjectile, MorphStyle)
|
||||
|
||||
int AMorphProjectile::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
||||
{
|
||||
if (target->player)
|
||||
|
@ -652,6 +659,11 @@ IMPLEMENT_POINTERS_START(AMorphedMonster)
|
|||
IMPLEMENT_POINTER(UnmorphedMe)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
||||
DEFINE_FIELD(AMorphedMonster, UnmorphedMe)
|
||||
DEFINE_FIELD(AMorphedMonster, UnmorphTime)
|
||||
DEFINE_FIELD(AMorphedMonster, MorphStyle)
|
||||
DEFINE_FIELD(AMorphedMonster, MorphExitFlash)
|
||||
|
||||
void AMorphedMonster::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
|
|
|
@ -487,6 +487,12 @@ class PowerDoubleFiringSpeed : Powerup native {}
|
|||
|
||||
class PowerMorph : Powerup native
|
||||
{
|
||||
native Class<PlayerPawn> PlayerClass;
|
||||
native Class<Actor> MorphFlash, UnMorphFlash;
|
||||
native int MorphStyle;
|
||||
native PlayerInfo MorphedPlayer;
|
||||
native bool bInUndoMorph;
|
||||
|
||||
Default
|
||||
{
|
||||
Powerup.Duration -40;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
class MorphProjectile : Actor native
|
||||
{
|
||||
|
||||
native Class<PlayerPawn> PlayerClass;
|
||||
native Class<Actor> MonsterClass, MorphFlash, UnMorphFlash;
|
||||
native int Duration, MorphStyle;
|
||||
|
||||
Default
|
||||
{
|
||||
Damage 1;
|
||||
|
@ -11,6 +16,10 @@ class MorphProjectile : Actor native
|
|||
|
||||
class MorphedMonster : Actor native
|
||||
{
|
||||
native Actor UnmorphedMe;
|
||||
native int UnmorphTime, MorphStyle;
|
||||
native Class<Actor> MorphExitFlash;
|
||||
|
||||
Default
|
||||
{
|
||||
Monster;
|
||||
|
|
Loading…
Reference in a new issue