[Added] DMG_NO_ENHANCE

Moderator: GZDoom Developers

DMG_NO_ENHANCE

Postby Major Cooke » Sat Nov 10, 2018 10:07 am

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.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: MSN [Bot], Yandex [Bot] and 1 guest