ZDoom / gzdoom

GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
http://zdoom.org
GNU General Public License v3.0
2.33k stars 526 forks source link

[Bug] ObtainInventory() called before PreMorph() instead of after #2600

Closed MajorCooke closed 1 week ago

MajorCooke commented 2 weeks ago

PreMorph was designed to handle things before any inventory changes occur, so I can record certain items before the engine transfers them over. It's basically meant to allow last minute manipulations to anything before this.

I have a system set up to restore armor after a player unmorphs (this is not the same as the KeepArmor flag!), which records the armor in PreMorph() and saves it. When the player unmorphs, PostMorph() is set up to restore the armor the player had.

I am intentionally not using the KeepArmor flag because that transfers the armor for the morphed player to use when that's not desired.

This issue occurred within the Morph Rework PR.