Skip to content

Rocket sneaker and sink hnext fix

Ashnal requested to merge bird/Kart-Public:rocket-sneaker-hnext-fix into next

Fixes desyncs caused by rocket sneaker or sink forced removal via K_StripItems

This includes situations such as, running into a mine with a rocket sneaker, being shrunk with a rocket sneaker, or picking up an eggbox while holding a rocketsneaker.

Fixes Rocket Sneaker detach animation. Previously, the left shoe would always fly directly backwards, and the right shoe would always fly directly forwards. Now they both eject forwards, and outwards at an angle away from the kart. Fixes an issue where if the sneakers had MF2_DONTDRAW and were ejected, they'd be invisible during ejection. Fixes the shoes vanishing when removed by K_StripItems, now they play their detach animation.

This fixes many (but not all) syncbombs, and the infamous shrinkfail.

My theory as to why syncbombs occur without this code is as follows: Normally, when K_DropHnextList is called, for all items except rocket sneakers and kitchen sinks, the player->mo->hnext item linked list is iterated through, dropped, and then player->mo->hnext is set to NULL. With rocket sneakers and kitchen sinks, this is not the case. Instead, the code proceeds, and sets the relevant kartstuff vars in K_StripItems. This causes these to just disappear. I wasn't able to completely track down how hnext is used right after, but based on observation, I think the pointer was being used when it didn't have a valid object, causing undefined behavior. Undefined behavior perfectly explains why the game would sometimes desync, and other times be fine, as different computers could process the undefined behavior in different ways, producing desync.

Merge request reports