From 116a935b71cb6d74a3802c56d3188da39ba592f6 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Thu, 6 Feb 2020 12:18:46 -0600 Subject: [PATCH] Added source, inflictor and damage flags to AbsorbDamage. --- src/actor.h | 2 +- src/p_interaction.cpp | 4 ++-- src/p_mobj.cpp | 6 +++--- wadsrc/static/zscript/actors/inventory/armor.zs | 4 ++-- wadsrc/static/zscript/actors/inventory/inventory.zs | 2 +- wadsrc/static/zscript/actors/inventory/powerups.zs | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/actor.h b/src/actor.h index e62861423..f3c5b7165 100644 --- a/src/actor.h +++ b/src/actor.h @@ -673,7 +673,7 @@ public: // Adjusts the angle for deflection/reflection of incoming missiles // Returns true if the missile should be allowed to explode anyway bool AdjustReflectionAngle (AActor *thing, DAngle &angle); - int AbsorbDamage(int damage, FName dmgtype); + int AbsorbDamage(int damage, FName dmgtype, AActor *inflictor, AActor *source, int flags); void AlterWeaponSprite(visstyle_t *vis); // Returns true if this actor is within melee range of its target diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 5eeb0880c..d8eee0451 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1291,7 +1291,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da int newdam = damage; if (damage > 0) { - newdam = player->mo->AbsorbDamage(damage, mod); + newdam = player->mo->AbsorbDamage(damage, mod, inflictor, source, flags); } if (!telefragDamage || (player->mo->flags7 & MF7_LAXTELEFRAGDMG)) //rawdamage is never modified. { @@ -1361,7 +1361,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da if (!(flags & (DMG_NO_ARMOR|DMG_FORCED)) && target->Inventory != NULL && damage > 0) { int newdam = damage; - newdam = target->AbsorbDamage(damage, mod); + newdam = target->AbsorbDamage(damage, mod, inflictor, source, flags); damage = newdam; if (damage <= 0) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 849cf5281..6a9cf6026 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3250,14 +3250,14 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle) return false; } -int AActor::AbsorbDamage(int damage, FName dmgtype) +int AActor::AbsorbDamage(int damage, FName dmgtype, AActor *inflictor, AActor *source, int flags) { for (AActor *item = Inventory; item != nullptr; item = item->Inventory) { IFVIRTUALPTRNAME(item, NAME_Inventory, AbsorbDamage) { - VMValue params[4] = { item, damage, dmgtype.GetIndex(), &damage }; - VMCall(func, params, 4, nullptr, 0); + VMValue params[7] = { item, damage, dmgtype.GetIndex(), &damage, inflictor, source, flags }; + VMCall(func, params, 7, nullptr, 0); } } return damage; diff --git a/wadsrc/static/zscript/actors/inventory/armor.zs b/wadsrc/static/zscript/actors/inventory/armor.zs index 0887197b1..bc764fc2c 100644 --- a/wadsrc/static/zscript/actors/inventory/armor.zs +++ b/wadsrc/static/zscript/actors/inventory/armor.zs @@ -141,7 +141,7 @@ class BasicArmor : Armor // //=========================================================================== - override void AbsorbDamage (int damage, Name damageType, out int newdamage) + override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags) { int saved; @@ -552,7 +552,7 @@ class HexenArmor : Armor // //=========================================================================== - override void AbsorbDamage (int damage, Name damageType, out int newdamage) + override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags) { if (!DamageTypeDefinition.IgnoreArmor(damageType)) { diff --git a/wadsrc/static/zscript/actors/inventory/inventory.zs b/wadsrc/static/zscript/actors/inventory/inventory.zs index d60de63ac..4cfc67866 100644 --- a/wadsrc/static/zscript/actors/inventory/inventory.zs +++ b/wadsrc/static/zscript/actors/inventory/inventory.zs @@ -1099,7 +1099,7 @@ class Inventory : Actor // //=========================================================================== - virtual void AbsorbDamage (int damage, Name damageType, out int newdamage) {} + virtual void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor = null, Actor source = null, int flags = 0) {} //=========================================================================== // diff --git a/wadsrc/static/zscript/actors/inventory/powerups.zs b/wadsrc/static/zscript/actors/inventory/powerups.zs index 307bfd411..ede8f7aa7 100644 --- a/wadsrc/static/zscript/actors/inventory/powerups.zs +++ b/wadsrc/static/zscript/actors/inventory/powerups.zs @@ -761,7 +761,7 @@ class PowerIronFeet : Powerup Powerup.Color "00 ff 00", 0.125; } - override void AbsorbDamage (int damage, Name damageType, out int newdamage) + override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags) { if (damageType == 'Drowning') { @@ -795,7 +795,7 @@ class PowerMask : PowerIronFeet Inventory.Icon "I_MASK"; } - override void AbsorbDamage (int damage, Name damageType, out int newdamage) + override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags) { if (damageType == 'Fire' || damageType == 'Drowning') {