GTcreyon / SM63Redux

Code base for Super Mario 63 Redux
https://sm63redux.com
Mozilla Public License 2.0
193 stars 25 forks source link

Fix koopa producing two shells if both stomped and struck #292

Closed Koopa1018 closed 4 months ago

Koopa1018 commented 5 months ago

Description of changes

Possibly fixes a bug where koopas could split into two shells under specific circumstances. (I'm not quite precise enough with timing to repro it myself 😖)

Ticket &70cff suggests that the problem occurs when a stomp and spin both hit the koopa at once. A code review bears this theory out: if both the stomp and strike functions run in the same frame, the spawn-shell-and-delete-self function into_shell is called both times.

To fix this, I modified into_shell to do nothing if the koopa is queued for deletion (which it always will be after the function is called once). I could easily have modified the call sites instead, but this way there's only one new if statement, not two, and no extra thought is required when using into_shell in the future.

Issue(s)

Theoretically closes ticket &70cff, and a longstanding bug noticed by several people on Discord (@nyanpasu64 and possibly Vexxter).