Closed MegAmi24 closed 2 weeks ago
Looked in VS Debugger, there are two things causing this:
The game is supposed to play the swap fail sfx when there is no P2, but for some reason the check for it always returns false. My guess is there's an error in HUD_CharacterIndexFromID
. https://github.com/RSDKModding/Sonic-Mania-Decompilation/blob/75b3784141d89668eaabce5173862993cecb8d53/SonicMania/Objects/Global/ItemBox.c#L591-L596
There's an infinite loop in the randomizing code, with the if ((1 << newPlayerIDs[p]) & globals->characterFlags)
check always returning false and p
never incrementing. This was also reported in #264. https://github.com/RSDKModding/Sonic-Mania-Decompilation/blob/75b3784141d89668eaabce5173862993cecb8d53/SonicMania/Objects/Global/ItemBox.c#L607-L614
Fixed by https://github.com/RSDKModding/RSDKv5-Decompilation/commit/a80e2ba8600b210f79208bf5d3bd357627f5d63d
Explanation:
memset(0)
on the entity.sizeof(ObjectDefaultObject) == 0x58
, which is valid in pre-plus but was changed starting with Plus to account for the largest possible size for an entity sizeof(EntityBase) == 0x458
.In Encore mode, when you die, the game will swap your current character with the sidekick, and then reset the dead character's entity.
The random item box tries to check for the characterID
of the sidekick, but since it has been reset, we actually expect 0.
The part of memory that was storing the characterID
never got erased because of the smaller DefaultObject size, so it returned the old value, causing a softlock.
Steps to reproduce:
https://github.com/user-attachments/assets/913ff3c8-417e-4afc-836f-df4b3d5c61f9