mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +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)
|
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
|
// APowerMorph :: Serialize
|
||||||
|
@ -1897,7 +1904,7 @@ void APowerMorph::Serialize(FSerializer &arc)
|
||||||
("morphstyle", MorphStyle)
|
("morphstyle", MorphStyle)
|
||||||
("morphflash", MorphFlash)
|
("morphflash", MorphFlash)
|
||||||
("unmorphflash", UnMorphFlash)
|
("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
|
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)
|
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
|
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
|
// Abort if owner already destroyed
|
||||||
if (Owner == NULL)
|
if (Owner == NULL)
|
||||||
{
|
{
|
||||||
assert(Player == NULL);
|
assert(MorphedPlayer == NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abort if owner already unmorphed
|
// Abort if owner already unmorphed
|
||||||
if (Player == NULL)
|
if (MorphedPlayer == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abort if owner is dead; their Die() method will
|
// Abort if owner is dead; their Die() method will
|
||||||
// take care of any required unmorphing on death.
|
// take care of any required unmorphing on death.
|
||||||
if (Player->health <= 0)
|
if (MorphedPlayer->health <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1959,26 +1966,26 @@ void APowerMorph::EndEffect( )
|
||||||
// Unmorph if possible
|
// Unmorph if possible
|
||||||
if (!bInUndoMorph)
|
if (!bInUndoMorph)
|
||||||
{
|
{
|
||||||
int savedMorphTics = Player->morphTics;
|
int savedMorphTics = MorphedPlayer->morphTics;
|
||||||
P_UndoPlayerMorph (Player, Player, 0, !!(Player->MorphStyle & MORPH_UNDOALWAYS));
|
P_UndoPlayerMorph (MorphedPlayer, MorphedPlayer, 0, !!(MorphedPlayer->MorphStyle & MORPH_UNDOALWAYS));
|
||||||
|
|
||||||
// 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 != NULL && Player->morphTics)
|
if (MorphedPlayer != NULL && MorphedPlayer->morphTics)
|
||||||
{
|
{
|
||||||
// Transfer retry timeout
|
// Transfer retry timeout
|
||||||
// to the powerup's timer.
|
// to the powerup's timer.
|
||||||
EffectTics = Player->morphTics;
|
EffectTics = MorphedPlayer->morphTics;
|
||||||
// Reload negative morph tics;
|
// Reload negative morph tics;
|
||||||
// use actual value; it may
|
// use actual value; it may
|
||||||
// be in use for animation.
|
// be in use for animation.
|
||||||
Player->morphTics = savedMorphTics;
|
MorphedPlayer->morphTics = savedMorphTics;
|
||||||
// Try again some time later
|
// Try again some time later
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Unmorph suceeded
|
// Unmorph suceeded
|
||||||
Player = NULL;
|
MorphedPlayer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Infinite Ammo Powerup -----------------------------------------------------
|
// Infinite Ammo Powerup -----------------------------------------------------
|
||||||
|
|
|
@ -286,7 +286,7 @@ public:
|
||||||
PClassPlayerPawn *PlayerClass;
|
PClassPlayerPawn *PlayerClass;
|
||||||
PClassActor *MorphFlash, *UnMorphFlash;
|
PClassActor *MorphFlash, *UnMorphFlash;
|
||||||
int MorphStyle;
|
int MorphStyle;
|
||||||
player_t *Player;
|
player_t *MorphedPlayer;
|
||||||
bool bInUndoMorph; // Because P_UndoPlayerMorph() can call EndEffect recursively
|
bool bInUndoMorph; // Because P_UndoPlayerMorph() can call EndEffect recursively
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -618,6 +618,13 @@ void InitAllPowerupEffects(AInventory *item)
|
||||||
|
|
||||||
IMPLEMENT_CLASS(AMorphProjectile, false, false, false, false)
|
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)
|
int AMorphProjectile::DoSpecialDamage (AActor *target, int damage, FName damagetype)
|
||||||
{
|
{
|
||||||
if (target->player)
|
if (target->player)
|
||||||
|
@ -652,6 +659,11 @@ IMPLEMENT_POINTERS_START(AMorphedMonster)
|
||||||
IMPLEMENT_POINTER(UnmorphedMe)
|
IMPLEMENT_POINTER(UnmorphedMe)
|
||||||
IMPLEMENT_POINTERS_END
|
IMPLEMENT_POINTERS_END
|
||||||
|
|
||||||
|
DEFINE_FIELD(AMorphedMonster, UnmorphedMe)
|
||||||
|
DEFINE_FIELD(AMorphedMonster, UnmorphTime)
|
||||||
|
DEFINE_FIELD(AMorphedMonster, MorphStyle)
|
||||||
|
DEFINE_FIELD(AMorphedMonster, MorphExitFlash)
|
||||||
|
|
||||||
void AMorphedMonster::Serialize(FSerializer &arc)
|
void AMorphedMonster::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
|
|
|
@ -487,6 +487,12 @@ class PowerDoubleFiringSpeed : Powerup native {}
|
||||||
|
|
||||||
class PowerMorph : 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
|
Default
|
||||||
{
|
{
|
||||||
Powerup.Duration -40;
|
Powerup.Duration -40;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
class MorphProjectile : Actor native
|
class MorphProjectile : Actor native
|
||||||
{
|
{
|
||||||
|
|
||||||
|
native Class<PlayerPawn> PlayerClass;
|
||||||
|
native Class<Actor> MonsterClass, MorphFlash, UnMorphFlash;
|
||||||
|
native int Duration, MorphStyle;
|
||||||
|
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
Damage 1;
|
Damage 1;
|
||||||
|
@ -11,6 +16,10 @@ class MorphProjectile : Actor native
|
||||||
|
|
||||||
class MorphedMonster : Actor native
|
class MorphedMonster : Actor native
|
||||||
{
|
{
|
||||||
|
native Actor UnmorphedMe;
|
||||||
|
native int UnmorphTime, MorphStyle;
|
||||||
|
native Class<Actor> MorphExitFlash;
|
||||||
|
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
Monster;
|
Monster;
|
||||||
|
|
Loading…
Reference in a new issue