Page 1 of 1

DamageMobj: The Big Stinker Refactor

Posted: Wed Dec 12, 2018 9:54 pm
by Major Cooke
Pull Request

Finally. The complete and total separation of all state management in that god-forsaken piece of code is done.

DamageMobj now returns -1 for all cancelled damage, which means no state changes happen. 0 for normalcy, where pain flags can still apply.

Bonus: Modders have TriggerPainChance(Name mod, bool forcedPain) at their disposal now.

Graf: I have not deprecated ALLOW/CAUSEPAIN flags yet. With the code sorted out at last, and the flags still work, I think I found a nice balance where they won't be intrusive anymore without the need to remove their functionality.

If you still wish to see them removed, I can do that, but please consider a second look before deciding. It was the big elephant in the room, now it's the size of a cricket.

Anything else you want changed?

Re: DamageMobj: The Big Stinker Refactor

Posted: Thu Dec 13, 2018 12:30 am
by Graf Zahl
This already looks a lot better than before.

One thing I'd like to change: Since the fallback in P_DamageMobj and the content of the scripted thunk are nearly identical it might be advisable to move this to a subfunction to reduce redundancy.

Re: DamageMobj: The Big Stinker Refactor

Posted: Thu Dec 13, 2018 1:31 am
by Major Cooke
Done! And thanks!

Re: DamageMobj: The Big Stinker Refactor

Posted: Fri Dec 14, 2018 1:02 pm
by Graf Zahl
I think it's ok, but I prefer to delay the merge until after the next release. This is nothing critical so I don't want to risk problems from this code not having been sufficiently tested.

Re: DamageMobj: The Big Stinker Refactor

Posted: Mon Dec 17, 2018 9:54 am
by Major Cooke
Understandable, but just wanted to add that I've tested this on D4D and AEons of Death, both of which thoroughly use them.

Re: DamageMobj: The Big Stinker Refactor

Posted: Wed Dec 26, 2018 4:56 am
by Graf Zahl
Merged. I decided to get this in before the release.

Re: DamageMobj: The Big Stinker Refactor

Posted: Wed Dec 26, 2018 11:27 am
by Major Cooke
Oh, nice! Thanks! This should be handy especially since now everyone has TriggerPainChance to play with. :D