Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ohhhhhhh where the hell do I begin with this... Okay, so, if you complete PGZ2 while playing without Tails or Knuckles as a sidekick and while you have a Fire Shield, then the game will crash during the cutscene right when the first 'pulse' of the Phantom Ruby happens. This is caused by the shield being loaded into player 2's object slot. The cutscene tries to update both players, mistaking the shield for the sidekick character. This causes it to overwrite the shield's state with player state, causing the shield player pointer to be replaced with a pointer to a player object function. This would cause the shield object's update function to crash the game. The original code was able to tell that the second player slot had a shield in it by comparing its classID to that of the first player, but this decompilation got this incorrect and instead merely checked that the slot wasn't empty. It also redundantly checked if the pointer to the slot was `NULL`, which is impossible. Correcting this fixes the crash. Good riddance, too: that bug's been driving me crazy for over a month! I thought I'd fixed it in this PR... Rubberduckycooly/RSDKv5-Decompilation#111 ...but it turns out that I'd just fixed a completely unrelated bug that, at the time, was crashing my MinGW builds. Because the conditions to trigger this bug were so specific (have a Fire Shield, and don't have Tails or Knuckles as a companion), I never figured out how to consistently recreate this crash until now. Aaaaaaaaaaaaaaaaaaaaa.
- Loading branch information