Added source, inflictor and damage flags to AbsorbDamage.

This commit is contained in:
Major Cooke 2020-02-06 12:18:46 -06:00 committed by Christoph Oelckers
parent d22a4c835c
commit 39a9a48ad6
6 changed files with 11 additions and 11 deletions

View file

@ -675,7 +675,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

View file

@ -1301,7 +1301,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.
{
@ -1371,7 +1371,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)
{

View file

@ -3231,14 +3231,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;

View file

@ -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))
{

View file

@ -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) {}
//===========================================================================
//

View file

@ -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')
{