Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when breaking random item box with no sidekick or stocks in Encore Mode #283

Open
MegAmi24 opened this issue Jul 15, 2024 · 1 comment
Labels
bug Something isn't working crash

Comments

@MegAmi24
Copy link
Member

Steps to reproduce:

  1. Boot up game, start a new game in Encore Mode
  2. When you get to GHZ, die as one of the characters, don't get any new stocks before or afterwards
  3. Break a random item box
randomcrash.mp4
@MegAmi24 MegAmi24 added bug Something isn't working crash labels Jul 15, 2024
@MegAmi24
Copy link
Member Author

MegAmi24 commented Jul 15, 2024

Looked in VS Debugger, there are two things causing this:

  1. 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.

    playerIDs[0] = HUD_CharacterIndexFromID(player1->characterID);
    playerIDs[1] = HUD_CharacterIndexFromID(player2->characterID);
    if (playerIDs[1] == 0xFF) {
    RSDK.PlaySfx(Player->sfxSwapFail, false, 255);
    }

  2. 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 Game freezes when collecting question mark powerup in SPZ Encore Mode #264.

    int32 p = 0;
    for (; p < 5;) {
    bool32 inc = true;
    if (playerIDs[p] == 0xFF)
    break;
    newPlayerIDs[p] = RSDK.Rand(0, 5);
    if ((1 << newPlayerIDs[p]) & globals->characterFlags) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash
Projects
None yet
Development

No branches or pull requests

1 participant