Skip to content

Commit

Permalink
Added source, inflictor and damage flags to AbsorbDamage.
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorCooke authored and coelckers committed Feb 9, 2020
1 parent d22a4c8 commit 39a9a48
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/playsim/actor.h
Expand Up @@ -675,7 +675,7 @@ class AActor : public DThinker
// 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
Expand Down
4 changes: 2 additions & 2 deletions src/playsim/p_interaction.cpp
Expand Up @@ -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.
{
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/playsim/p_mobj.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/inventory/armor.zs
Expand Up @@ -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;

Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/inventory/inventory.zs
Expand Up @@ -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) {}

//===========================================================================
//
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/inventory/powerups.zs
Expand Up @@ -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')
{
Expand Down Expand Up @@ -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')
{
Expand Down

0 comments on commit 39a9a48

Please sign in to comment.