Page 1 of 1

DMG_NO_ENHANCE

PostPosted: Sat Nov 10, 2018 10:07 am
by Major Cooke
Pull Request

Simple: disables PowerDamage's effect from being called in DamageMobj.

Why? Because trying to self negate it via manual overriding results in some wildly inconsistent results.

Here is some code I'm currently using which negates the damage of all PowerDamage enhancements before the main internal DamageMobj function is actually called. However, this winds up nuking the damage to the point where enhancing it back again results in the damage being even lower. There's no real way to disable this behavior without this flag.

Code: Select allExpand view
// If the player hurts himself, negate self damage by taking the
// enhanced damage and use that to divide the current damage.
// This gives us the amount to nuke the damage by, that way
// the internal function will kick it back up again.
// Sadly, not the most consistent of results I'm afraid...
if (damage > 0 && (
   (source && source == self) ||
   (inflictor && (inflictor == self || inflictor.target == self))))
{
   int newdamage = GetModifiedDamage(mod, damage, false);
   if (newdamage > damage)
   {
      double mul = double(damage) / double(Max(1.0,newdamage));
      damage = int(floor(damage * mul));
   }
}


If I can get this flag, I can replace the above damage calculation with just flags |= DMG_NO_ENHANCE; and be done with it.