Skip to content

Commit

Permalink
Add alternate "Full" mode for PowerIronFeet that prevents leaky damage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa Kirisame authored and coelckers committed Jan 16, 2021
1 parent 24cf27e commit 44b4359
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/common/engine/namedef.h
Expand Up @@ -27,6 +27,10 @@ xx(Spray)
xx(Ghost)
xx(Reflective)

// Iron Feet types
//xx(Normal) // defined below
xx(Full)

// Invisibility types
xx(Additive)
xx(Cumulative)
Expand Down
17 changes: 12 additions & 5 deletions src/playsim/p_spec.cpp
Expand Up @@ -428,7 +428,6 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
}

// Has hit ground.
AActor *ironfeet;

auto Level = sector->Level;

Expand All @@ -442,14 +441,22 @@ 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.
for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory)
// [MK] account for subclasses that may have "Full" protection (i.e.: prevent leaky damage)
int ironfeet = 0;
for (auto i = player->mo->Inventory; i != NULL; i = i->Inventory)
{
if (ironfeet->IsKindOf(NAME_PowerIronFeet))
break;
if (i->IsKindOf(NAME_PowerIronFeet))
{
FName mode = i->NameVar(NAME_Mode);
if ( ironfeet < 2 && mode == NAME_Full )
ironfeet = 2;
else if ( ironfeet < 1 && mode == NAME_Normal )
ironfeet = 1;
}
}

if (sector->Flags & SECF_ENDGODMODE) player->cheats &= ~CF_GODMODE;
if ((ironfeet == NULL || pr_playerinspecialsector() < sector->leakydamage))
if ((ironfeet == 0 || (ironfeet < 2 && pr_playerinspecialsector() < sector->leakydamage)))
{
if (sector->Flags & SECF_HAZARD)
{
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/actors/inventory/powerups.zs
Expand Up @@ -763,6 +763,7 @@ class PowerIronFeet : Powerup
{
Powerup.Duration -60;
Powerup.Color "00 ff 00", 0.125;
Powerup.Mode "Normal";
}

override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags)
Expand Down

4 comments on commit 44b4359

@Blue-Shadow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking, is it intentional that the Full mode protects even against 100% leaky damaging floors, like the end-of-level and instant-death floors?

@madame-rachelle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not do that, in my opinion. Those are placed in a map with a purpose - to defeat that purpose could potentially break the map.

@Blue-Shadow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. With the Full mode, you can't leave maps like E1M8 of Doom, for example. You have to wait until the powerup has worn off.

Although, there are other types of damaging floors that are not "special" like those, but are still 100% leaky: the lava floors from Heretic. Whether the Full mode should protect against those or not I don't know.

@coelckers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That entire system suffers from an initial implementation where the only goal was to just replicate the original games' behavior. It'd surely be nice to change into something more flexible but then you run the risk of compatibility issues with existing mods.

Please sign in to comment.