Tested with: 3.2.5 (64-bit)
If the player is morphed via PowerMorph, and the powerup's effect wears off while they're in an area with insufficient room for them to unmorph, they will remain morphed even if room becomes available later on.
Run the attached file with Hexen, MAP39. From the console, give yourself TestMorph. This will morph you into a pig. On your right, there's a hole. Enter it. Stay there until the powerup runs out (15 seconds is good enough) then come out. You'll stay as you are and won't unmorph.
If you run the same test with morphme CCMD, you will unmorph successfully when you come out (although you need to wait in the hole at least for 40 seconds before coming out).
PowerMorph: player remains morphed forever
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
-
- Posts: 4949
- Joined: Sun Nov 14, 2010 12:59 am
- Major Cooke
- Posts: 8170
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: PowerMorph: player remains morphed forever
Hmmm, this might also include the issue where even if you take the power you're still stuck. Even if the space is clear. This may have already been fixed though...
-
- Posts: 4949
- Joined: Sun Nov 14, 2010 12:59 am
Re: PowerMorph: player remains morphed forever
As the problem originates from PowerMorph's own EndEffect(), it'd have the same result. What happens is this:
To me, the "abort if unmorph failed" part of the code in EndEffect() is unnecessary. For one, it's causing the problem at hand, and two, it gives the impression that the powerup itself is meant to do the retrying. But it can't, since it's going to be destroyed. Shouldn't calling UndoPlayerMorph() be enough? If the unmorph succeeds, it succeeds. If it fails because there is no room, then there is no problem; PlayerThink() will take care of unmorphing the player when there is enough room eventually.
Spoiler: PowerMorph's methodsThe powerup activates and you're morphed with a duration of 0x7FFFFFFF. Upon losing the powerup, if there isn't enough room at the time, unmorphing fails and morphTics gets set to 70. After UndoPlayerMorph() is called, morphTics gets restored to how it was before UndoPlayerMorph() was called. And there you have it - you're stuck being a chicken or pig for the rest of your life, or at least for two years.
To me, the "abort if unmorph failed" part of the code in EndEffect() is unnecessary. For one, it's causing the problem at hand, and two, it gives the impression that the powerup itself is meant to do the retrying. But it can't, since it's going to be destroyed. Shouldn't calling UndoPlayerMorph() be enough? If the unmorph succeeds, it succeeds. If it fails because there is no room, then there is no problem; PlayerThink() will take care of unmorphing the player when there is enough room eventually.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: PowerMorph: player remains morphed forever
Interestingly, that piece of code had been there ever since PowerMorph got added 10 years ago. And I agree with you that someone apparently did not really understand how EndEffect is getting processed and what it should do here (i.e. nothing because UndoPlayerMorph already sets an unmorph delay in the failure case.)
I can clearly see what was intended here but it obviously couldn't possibly work like this.
I can clearly see what was intended here but it obviously couldn't possibly work like this.