From a7fb96eec567bf2f4cddbd5773910f079065f3b3 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sat, 16 Jan 2021 16:50:08 +0100 Subject: [PATCH] Add alternate "Full" mode for PowerIronFeet that prevents leaky damage. # Conflicts: # src/playsim/p_spec.cpp --- src/namedef.h | 4 ++++ src/p_spec.cpp | 18 ++++++++++++------ .../zscript/actors/inventory/powerups.zs | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/namedef.h b/src/namedef.h index 4df78a7f9..a66883922 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -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) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 8c96ca4ec..5ca596a30 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -455,8 +455,6 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector) } // Has hit ground. - AActor *ironfeet; - if (sector->damageinterval <= 0) sector->damageinterval = 32; // repair invalid damageinterval values @@ -466,14 +464,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) { diff --git a/wadsrc/static/zscript/actors/inventory/powerups.zs b/wadsrc/static/zscript/actors/inventory/powerups.zs index f3fed4b7b..48e146418 100644 --- a/wadsrc/static/zscript/actors/inventory/powerups.zs +++ b/wadsrc/static/zscript/actors/inventory/powerups.zs @@ -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)