Skip to content

Commit

Permalink
Fix Pinball bugs
Browse files Browse the repository at this point in the history
This fixes two bugs:

- If you get multiple different shields in the crane game, then the
character may have a bugged 'null' shield upon returning to the
level. This is caused by the IDs of the obtained shields being OR'd
together, producing an invalid ID.

- In Mania Mode, the crane game should offer 1UPs, but an incorrect
`RSDK::Rand` parameter was preventing it from doing so.

Both of these fixes have been verified against the assembly code of
the latest Steam EXE.
  • Loading branch information
Clownacy committed Dec 21, 2022
1 parent 8987379 commit 7a0b36f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SonicMania/Objects/Pinball/PBL_Crane.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ void PBL_Crane_HandlePrizes(void)
case PBL_CRANE_PRIZE_SHIELD_BUBBLE:
case PBL_CRANE_PRIZE_SHIELD_FIRE:
case PBL_CRANE_PRIZE_SHIELD_ELECTRIC:
globals->restartPowerups &= ~0x40;
globals->restartPowerups |= self->displayAnimator.frameID - 6;
globals->restartPowerups &= ~0x3F;
globals->restartPowerups |= self->displayAnimator.frameID - PBL_CRANE_PRIZE_SHIELD_BLUE + SHIELD_BLUE; // Converts the frame ID to a shield ID

PBL_Crane->prizeID = PBL_CRANE_PRIZEID_ITEM;
break;
Expand Down Expand Up @@ -287,15 +287,15 @@ void PBL_Crane_State_CreatePrizes(void)
prize->displayAnimator.frameID = i;
}
else {
prize->displayAnimator.frameID = RSDK.Rand(PBL_CRANE_PRIZE_RINGS, PBL_CRANE_PRIZE_1UP);
prize->displayAnimator.frameID = RSDK.Rand(PBL_CRANE_PRIZE_RINGS, PBL_CRANE_PRIZE_TABLE_RESTORE + 1);
}
}
else {
if (i == 5) {
prize->displayAnimator.frameID = PBL_CRANE_PRIZE_EGGMAN;
}
else {
prize->displayAnimator.frameID = RSDK.Rand(PBL_CRANE_PRIZE_RINGS, PBL_CRANE_PRIZE_1UP);
prize->displayAnimator.frameID = RSDK.Rand(PBL_CRANE_PRIZE_RINGS, PBL_CRANE_PRIZE_1UP + 1);
}
}

Expand Down

0 comments on commit 7a0b36f

Please sign in to comment.