diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index c82c146d2..4a7783ae4 100644 --- a/src/g_inventory/a_pickups.cpp +++ b/src/g_inventory/a_pickups.cpp @@ -699,6 +699,15 @@ void AInventory::AbsorbDamage (int damage, FName damageType, int &newdamage) { } +DEFINE_ACTION_FUNCTION(AInventory, AbsorbDamage) +{ + PARAM_SELF_PROLOGUE(AInventory); + PARAM_INT(damage); + PARAM_NAME(type); + PARAM_POINTER(newdmg, int); + self->AbsorbDamage(damage, type, *newdmg); + return 0; +} //=========================================================================== // // AInventory :: ModifyDamage diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index d3dbe0232..a73e3d8b3 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1385,7 +1385,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); damage = newdam; if (damage <= 0) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 4985454ae..5d86e78ff 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3621,7 +3621,7 @@ int AActor::AbsorbDamage(int damage, FName dmgtype) { IFVIRTUALPTR(item, AInventory, AbsorbDamage) { - VMValue params[4] = { (item, damage, dmgtype.GetIndex(), &damage }; + VMValue params[4] = { item, damage, dmgtype.GetIndex(), &damage }; GlobalVMStack.Call(func, params, 4, nullptr, 0, nullptr); } else item->AbsorbDamage(damage, dmgtype, damage); diff --git a/wadsrc/static/zscript/inventory/inventory.txt b/wadsrc/static/zscript/inventory/inventory.txt index d3f6bfef5..7db3ba212 100644 --- a/wadsrc/static/zscript/inventory/inventory.txt +++ b/wadsrc/static/zscript/inventory/inventory.txt @@ -39,6 +39,7 @@ class Inventory : Actor native virtual native void AttachToOwner(Actor user); virtual native void DetachFromOwner(); virtual native bool DrawPowerup(int x, int y); + virtual native void AbsorbDamage (int damage, Name damageType, out int newdamage); //=========================================================================== //