DMG_NO_ENHANCE

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: DMG_NO_ENHANCE

DMG_NO_ENHANCE

by Major Cooke » Sat Nov 10, 2018 9: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 all

// 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.

Top