mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- scriptified PowerIronFeet and PowerMask.
This commit is contained in:
parent
65b7e344f7
commit
616f954153
6 changed files with 56 additions and 92 deletions
|
@ -229,6 +229,8 @@ void ABasicArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
|
|||
// This code is taken and adapted from APowerProtection::ModifyDamage().
|
||||
// The differences include not using a default value, and of course the way
|
||||
// the damage factor info is obtained.
|
||||
|
||||
// ApplyDamageFactors(ArmorType, damageType, damage, damage);
|
||||
DmgFactors *df = PClass::FindActor(ArmorType)->DamageFactors;
|
||||
if (df != NULL)
|
||||
{
|
||||
|
|
|
@ -829,77 +829,6 @@ bool APowerInvisibility::HandlePickup (AInventory *item)
|
|||
return Super::HandlePickup (item);
|
||||
}
|
||||
|
||||
// Ironfeet Powerup ----------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerIronFeet, false, false)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerIronFeet :: AbsorbDamage
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerIronFeet::AbsorbDamage (int damage, FName damageType, int &newdamage)
|
||||
{
|
||||
if (damageType == NAME_Drowning)
|
||||
{
|
||||
newdamage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerIronFeet :: DoEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerIronFeet::DoEffect ()
|
||||
{
|
||||
if (Owner->player != NULL)
|
||||
{
|
||||
Owner->player->mo->ResetAirSupply ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Strife Environment Suit Powerup -------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerMask, false, false)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerMask :: AbsorbDamage
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerMask::AbsorbDamage (int damage, FName damageType, int &newdamage)
|
||||
{
|
||||
if (damageType == NAME_Fire)
|
||||
{
|
||||
newdamage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Super::AbsorbDamage (damage, damageType, newdamage);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerMask :: DoEffect
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerMask::DoEffect ()
|
||||
{
|
||||
Super::DoEffect ();
|
||||
if (!(level.time & 0x3f))
|
||||
{
|
||||
S_Sound (Owner, CHAN_AUTO, "misc/mask", 1, ATTN_STATIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Speed Powerup -------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(APowerSpeed, false, false)
|
||||
|
|
|
@ -89,22 +89,6 @@ protected:
|
|||
virtual int AlterWeaponSprite (visstyle_t *vis) override;
|
||||
};
|
||||
|
||||
class APowerIronFeet : public APowerup
|
||||
{
|
||||
DECLARE_CLASS (APowerIronFeet, APowerup)
|
||||
public:
|
||||
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage) override;
|
||||
virtual void DoEffect () override;
|
||||
};
|
||||
|
||||
class APowerMask : public APowerIronFeet
|
||||
{
|
||||
DECLARE_CLASS (APowerMask, APowerIronFeet)
|
||||
public:
|
||||
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage) override;
|
||||
virtual void DoEffect () override;
|
||||
};
|
||||
|
||||
class APowerSpeed : public APowerup
|
||||
{
|
||||
DECLARE_CLASS (APowerSpeed, APowerup)
|
||||
|
|
|
@ -394,9 +394,10 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
|
|||
// Allow subclasses. Better would be to implement it as armor and let that reduce
|
||||
// the damage as part of the normal damage procedure. Unfortunately, I don't have
|
||||
// different damage types yet, so that's not happening for now.
|
||||
auto pitype = PClass::FindActor(NAME_PowerIronFeet);
|
||||
for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory)
|
||||
{
|
||||
if (ironfeet->IsKindOf (RUNTIME_CLASS(APowerIronFeet)))
|
||||
if (ironfeet->IsKindOf(pitype))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -578,9 +579,10 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType)
|
|||
|
||||
if (Terrains[floorType].AllowProtection)
|
||||
{
|
||||
auto pitype = PClass::FindActor(NAME_PowerIronFeet);
|
||||
for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory)
|
||||
{
|
||||
if (ironfeet->IsKindOf (RUNTIME_CLASS(APowerIronFeet)))
|
||||
if (ironfeet->IsKindOf (pitype))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -495,7 +495,7 @@ void FSerializer::Close()
|
|||
{
|
||||
// we must explicitly delete all thinkers in the array which did not get linked into the thinker lists.
|
||||
// Otherwise these objects may survive a level deletion and point to incorrect data.
|
||||
for (auto &obj : r->mDObjects)
|
||||
for (auto obj : r->mDObjects)
|
||||
{
|
||||
auto think = dyn_cast<DThinker>(obj);
|
||||
if (think != nullptr)
|
||||
|
|
|
@ -84,16 +84,45 @@ class PowerShadow : PowerInvisibility
|
|||
}
|
||||
}
|
||||
|
||||
class PowerIronFeet : Powerup native
|
||||
//===========================================================================
|
||||
//
|
||||
// IronFeet
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerIronFeet : Powerup
|
||||
{
|
||||
Default
|
||||
{
|
||||
Powerup.Duration -60;
|
||||
Powerup.Color "00 ff 00", 0.125;
|
||||
}
|
||||
|
||||
override void AbsorbDamage (int damage, Name damageType, out int newdamage)
|
||||
{
|
||||
if (damageType == 'Drowning')
|
||||
{
|
||||
newdamage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
override void DoEffect ()
|
||||
{
|
||||
if (Owner.player != NULL)
|
||||
{
|
||||
Owner.player.mo.ResetAirSupply ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PowerMask : PowerIronFeet native
|
||||
//===========================================================================
|
||||
//
|
||||
// Mask
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class PowerMask : PowerIronFeet
|
||||
{
|
||||
Default
|
||||
{
|
||||
|
@ -102,6 +131,24 @@ class PowerMask : PowerIronFeet native
|
|||
+INVENTORY.HUBPOWER
|
||||
Inventory.Icon "I_MASK";
|
||||
}
|
||||
|
||||
override void AbsorbDamage (int damage, Name damageType, out int newdamage)
|
||||
{
|
||||
if (damageType == 'Fire' || damageType == 'Drowning')
|
||||
{
|
||||
newdamage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
override void DoEffect ()
|
||||
{
|
||||
Super.DoEffect ();
|
||||
if (!(level.time & 0x3f))
|
||||
{
|
||||
Owner.A_PlaySound ("misc/mask", CHAN_AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
Loading…
Reference in a new issue