mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- scriptified a few more of the simpler powerups.
This commit is contained in:
parent
3b524cbed4
commit
267b1842b4
5 changed files with 142 additions and 199 deletions
|
@ -3050,7 +3050,7 @@ void AM_Drawer ()
|
|||
return;
|
||||
|
||||
bool allmap = (level.flags2 & LEVEL2_ALLMAP) != 0;
|
||||
bool allthings = allmap && players[consoleplayer].mo->FindInventory(RUNTIME_CLASS(APowerScanner), true) != NULL;
|
||||
bool allthings = allmap && players[consoleplayer].mo->FindInventory(PClass::FindActor(NAME_PowerScanner), true) != nullptr;
|
||||
|
||||
if (am_portaloverlay)
|
||||
{
|
||||
|
|
|
@ -1481,10 +1481,6 @@ void APowerBuddha::EndEffect ()
|
|||
Owner->player->cheats &= ~CF_BUDDHA;
|
||||
}
|
||||
|
||||
// Scanner powerup ----------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerScanner, false, false)
|
||||
|
||||
// Time freezer powerup -----------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS( APowerTimeFreezer, false, false)
|
||||
|
@ -1747,144 +1743,6 @@ void APowerProtection::ModifyDamage(int damage, FName damageType, int &newdamage
|
|||
}
|
||||
}
|
||||
|
||||
// Drain rune -------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerDrain, false, false)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// ARuneDrain :: InitEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerDrain::InitEffect( )
|
||||
{
|
||||
Super::InitEffect();
|
||||
|
||||
if (Owner== NULL || Owner->player == NULL)
|
||||
return;
|
||||
|
||||
// Give the player the power to drain life from opponents when he damages them.
|
||||
Owner->player->cheats |= CF_DRAIN;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// ARuneDrain :: EndEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerDrain::EndEffect( )
|
||||
{
|
||||
Super::EndEffect();
|
||||
|
||||
// Nothing to do if there's no owner.
|
||||
if (Owner != NULL && Owner->player != NULL)
|
||||
{
|
||||
// Take away the drain power.
|
||||
Owner->player->cheats &= ~CF_DRAIN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Regeneration rune -------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerRegeneration, false, false)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerRegeneration :: DoEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerRegeneration::DoEffect()
|
||||
{
|
||||
Super::DoEffect();
|
||||
if (Owner != NULL && Owner->health > 0 && (level.time & 31) == 0)
|
||||
{
|
||||
if (P_GiveBody(Owner, int(Strength)))
|
||||
{
|
||||
S_Sound(Owner, CHAN_ITEM, "*regenerate", 1, ATTN_NORM );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// High jump rune -------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerHighJump, false, false)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// ARuneHighJump :: InitEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerHighJump::InitEffect( )
|
||||
{
|
||||
Super::InitEffect();
|
||||
|
||||
if (Owner== NULL || Owner->player == NULL)
|
||||
return;
|
||||
|
||||
// Give the player the power to jump much higher.
|
||||
Owner->player->cheats |= CF_HIGHJUMP;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// ARuneHighJump :: EndEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerHighJump::EndEffect( )
|
||||
{
|
||||
Super::EndEffect();
|
||||
// Nothing to do if there's no owner.
|
||||
if (Owner != NULL && Owner->player != NULL)
|
||||
{
|
||||
// Take away the high jump power.
|
||||
Owner->player->cheats &= ~CF_HIGHJUMP;
|
||||
}
|
||||
}
|
||||
|
||||
// Double firing speed rune ---------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerDoubleFiringSpeed, false, false)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerDoubleFiringSpeed :: InitEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerDoubleFiringSpeed::InitEffect( )
|
||||
{
|
||||
Super::InitEffect();
|
||||
|
||||
if (Owner== NULL || Owner->player == NULL)
|
||||
return;
|
||||
|
||||
// Give the player the power to shoot twice as fast.
|
||||
Owner->player->cheats |= CF_DOUBLEFIRINGSPEED;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerDoubleFiringSpeed :: EndEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerDoubleFiringSpeed::EndEffect( )
|
||||
{
|
||||
Super::EndEffect();
|
||||
// Nothing to do if there's no owner.
|
||||
if (Owner != NULL && Owner->player != NULL)
|
||||
{
|
||||
// Take away the shooting twice as fast power.
|
||||
Owner->player->cheats &= ~CF_DOUBLEFIRINGSPEED;
|
||||
}
|
||||
}
|
||||
|
||||
// Morph powerup ------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerMorph, false, true)
|
||||
|
|
|
@ -165,11 +165,6 @@ class APowerMinotaur : public APowerup
|
|||
DECLARE_CLASS (APowerMinotaur, APowerup)
|
||||
};
|
||||
|
||||
class APowerScanner : public APowerup
|
||||
{
|
||||
DECLARE_CLASS (APowerScanner, APowerup)
|
||||
};
|
||||
|
||||
class APowerTargeter : public APowerup
|
||||
{
|
||||
DECLARE_CLASS (APowerTargeter, APowerup)
|
||||
|
@ -226,37 +221,6 @@ protected:
|
|||
virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive) override;
|
||||
};
|
||||
|
||||
class APowerDrain : public APowerup
|
||||
{
|
||||
DECLARE_CLASS( APowerDrain, APowerup )
|
||||
protected:
|
||||
virtual void InitEffect() override;
|
||||
virtual void EndEffect() override;
|
||||
};
|
||||
|
||||
class APowerRegeneration : public APowerup
|
||||
{
|
||||
DECLARE_CLASS( APowerRegeneration, APowerup )
|
||||
protected:
|
||||
virtual void DoEffect() override;
|
||||
};
|
||||
|
||||
class APowerHighJump : public APowerup
|
||||
{
|
||||
DECLARE_CLASS( APowerHighJump, APowerup )
|
||||
protected:
|
||||
virtual void InitEffect() override;
|
||||
virtual void EndEffect() override;
|
||||
};
|
||||
|
||||
class APowerDoubleFiringSpeed : public APowerup
|
||||
{
|
||||
DECLARE_CLASS( APowerDoubleFiringSpeed, APowerup )
|
||||
protected:
|
||||
virtual void InitEffect() override;
|
||||
virtual void EndEffect() override;
|
||||
};
|
||||
|
||||
class APowerMorph : public APowerup
|
||||
{
|
||||
DECLARE_CLASS( APowerMorph, APowerup )
|
||||
|
|
|
@ -354,6 +354,7 @@ xx(MapSpot)
|
|||
xx(PatrolPoint)
|
||||
xx(PatrolSpecial)
|
||||
xx(Communicator)
|
||||
xx(PowerScanner)
|
||||
|
||||
// Textmap properties
|
||||
//xx(X)
|
||||
|
|
|
@ -213,7 +213,13 @@ class PowerBuddha : Powerup native
|
|||
}
|
||||
}
|
||||
|
||||
class PowerScanner : Powerup native
|
||||
//===========================================================================
|
||||
//
|
||||
// Scanner (this is active just by being present)
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerScanner : Powerup
|
||||
{
|
||||
Default
|
||||
{
|
||||
|
@ -246,44 +252,138 @@ class PowerProtection : Powerup native
|
|||
}
|
||||
}
|
||||
|
||||
class PowerDrain : Powerup native
|
||||
//===========================================================================
|
||||
//
|
||||
// Drain
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerDrain : Powerup
|
||||
{
|
||||
Default
|
||||
{
|
||||
Powerup.Duration -60;
|
||||
}
|
||||
|
||||
override void InitEffect()
|
||||
{
|
||||
Super.InitEffect();
|
||||
|
||||
if (Owner!= null && Owner.player != null)
|
||||
{
|
||||
// Give the player the power to drain life from opponents when he damages them.
|
||||
Owner.player.cheats |= CF_DRAIN;
|
||||
}
|
||||
}
|
||||
|
||||
override void EndEffect()
|
||||
{
|
||||
Super.EndEffect();
|
||||
|
||||
// Nothing to do if there's no owner.
|
||||
if (Owner!= null && Owner.player != null)
|
||||
{
|
||||
// Take away the drain power.
|
||||
Owner.player.cheats &= ~CF_DRAIN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PowerRegeneration : Powerup native
|
||||
//===========================================================================
|
||||
//
|
||||
// Regeneration
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerRegeneration : Powerup
|
||||
{
|
||||
Default
|
||||
{
|
||||
Powerup.Duration -120;
|
||||
Powerup.Strength 5;
|
||||
}
|
||||
}
|
||||
|
||||
class PowerHighJump : Powerup native {}
|
||||
|
||||
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
|
||||
|
||||
override void DoEffect()
|
||||
{
|
||||
Powerup.Duration -40;
|
||||
Super.DoEffect();
|
||||
if (Owner != null && Owner.health > 0 && (level.time & 31) == 0)
|
||||
{
|
||||
if (Owner.GiveBody(int(Strength)))
|
||||
{
|
||||
Owner.A_PlaySound("*regenerate", CHAN_ITEM);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// PowerInfiniteAmmo
|
||||
// HighJump
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerHighJump : Powerup
|
||||
{
|
||||
override void InitEffect()
|
||||
{
|
||||
Super.InitEffect();
|
||||
|
||||
if (Owner!= null && Owner.player != null)
|
||||
{
|
||||
// Give the player the power to jump much higher.
|
||||
Owner.player.cheats |= CF_HIGHJUMP;
|
||||
}
|
||||
}
|
||||
|
||||
override void EndEffect()
|
||||
{
|
||||
Super.EndEffect();
|
||||
|
||||
// Nothing to do if there's no owner.
|
||||
if (Owner!= null && Owner.player != null)
|
||||
{
|
||||
// Take away the high jump power.
|
||||
Owner.player.cheats &= ~CF_HIGHJUMP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// DoubleFiringSpeed
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerDoubleFiringSpeed : Powerup
|
||||
{
|
||||
override void InitEffect()
|
||||
{
|
||||
Super.InitEffect();
|
||||
|
||||
if (Owner!= null && Owner.player != null)
|
||||
{
|
||||
// Give the player the power to shoot twice as fast.
|
||||
Owner.player.cheats |= CF_DOUBLEFIRINGSPEED;
|
||||
}
|
||||
}
|
||||
|
||||
override void EndEffect()
|
||||
{
|
||||
Super.EndEffect();
|
||||
|
||||
// Nothing to do if there's no owner.
|
||||
if (Owner!= null && Owner.player != null)
|
||||
{
|
||||
// Take away the shooting twice as fast power.
|
||||
Owner.player.cheats &= ~CF_DOUBLEFIRINGSPEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// InfiniteAmmo
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
@ -318,3 +418,23 @@ class PowerInfiniteAmmo : Powerup
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// PowerMorph
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue