Skip to content

Fix Eggmobile spawning Bowsers after hitting Fang with pinch phase laser

Monster Iestyn requested to merge fix-shoop-da-koop into next

Fixes #288 (closed)

Explanation as to how it happens:

  1. When A_Boss1Laser is called with var2 = 2 (for Eggmobile's pinch phase, it calls itself three times.
  2. First of these three A_Boss1Laser calls, P_RailThinker is run (multiple times) to do movement and collision (including P_CheckPosition).
  3. The laser collides with Fang during P_CheckPosition, Fang is hurt, goes to painstate.
  4. Fang's painstate is S_FANG_PAIN1, but it has a duration of 0, so in the same tic it then goes to S_FANG_PAIN2.
  5. S_FANG_PAIN2 calls the action A_Boss5CheckOnGround with a var1 of S_FANG_PATHINGSTART1. By some amazing coincidence, S_FANG_PATHINGSTART1 happens to be the same value as MT_KOOPA.
  6. This var1 value modifies the global variable also named var1 (and likewise for var2 but this isn't a problem here).
  7. The new value of the global variable var1 carries over to the end of the first A_Boss1Laser call, and into the second A_Boss1Laser call. var2 is changed but var1 is left be assuming it was still MT_LASER (obviously it isn't).
  8. Eggmobile now fires MT_KOOPA instead of MT_LASER!
Edited by Monster Iestyn

Merge request reports