From cd1d96b83a47558e3410655da86ac20ee347081d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 16 Jan 2017 10:23:26 +0100 Subject: [PATCH] - fixed compilation. --- src/g_inventory/a_pickups.cpp | 9 +++++++++ src/p_interaction.cpp | 2 +- src/p_mobj.cpp | 2 +- wadsrc/static/zscript/inventory/inventory.txt | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index c82c146d23..4a7783ae4e 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 d3dbe0232a..a73e3d8b30 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 4985454ae2..5d86e78ff6 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 d3f6bfef51..7db3ba2127 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); //=========================================================================== //