Landing on solid objects causes erroneous air control and friction

From DoomWiki.org

In Heretic, once a player has landed on top of a solid thing, some anomalous properties will be given to their movement while in the air. This makes it possible to move forwards, backwards, and strafe while in the air, even without Wings of Wrath, and furthermore when the Wings of Wrath are being used, allows unusually fast movement when flying over ice.

Technical[edit]

The bug occurs because Heretic uses a flag, MF2_ONMOBJ, which is intended to track whether the player is standing on top of a solid thing. However, while the flag is set as it should be, no code exists to check when the player leaves their perch for the flag to be unset. Therefore, a couple places in the code incorrectly behave as if the player is on the ground after that point:

  • P_MovePlayer, where the flag causes controls to respond as if the player were on the ground, allowing controlled movement while falling.
  • P_XYMovement, where the flag causes the check for whether the player is flying to fail, and therefore uses the friction speed boost values for ice or normal ground as applicable, rather than the value for flight. Since the initial slowdown from walking on ice, which is in P_Thrust, does not look at MF2_ONMOBJ when checking if the player is flying, it still registers flight correctly. Thus, the effect is a speedup rather than simply experiencing ice friction in the air.