Fix Offroad Glitch (PAL) [vabold] C258267C 00000003 90030004 8003000C 54000314 9003000C 60000000 00000000
Offroad glitch
The Offroad Glitch is a bug that occurs with specific jump pads, which negates the following speed modifiers:
- Wheelie bonus
- Mini-turbo/trick/zipper boost
- KCL flags
- Shock speed
- Crush speed
Technical description
To perform the glitch, land from a variant 3 jump pad without touching a variant 4 jump pad. Mushroom Gorge is the only Nintendo track where this is possible, and can be easily activated by using the Mushroom item on the first ramp to skip the red mushroom, or by driving backwards and backing up into the ramp.
When in this state, offroad becomes indistinguishable from slippery road. Even though KCL speed is negated, KCL rotation is still accounted for, and the rotation for offroad matches the rotation for slippery road in all cases.
Mushroom Gorge uses two exclusive jump pad variants: 3 and 4. Variant 3 is assigned to the ramps, and variant 4 is assigned to the mushrooms. These variants are unique because they unconditionally negate the above speed modifiers, and their intended behavior is to restore them when touching the ground. However, the game developers mistakenly believed that variant 4 would always be activated before landing.
Relevant code
The following code is written in C++, and has been edited to only include relevant parts. Irrelevant code will be marked with // ...
.
// This is run when the game recognizes we're interacting with a jump pad void Kart::KartMove::tryStartJumpPad(int variant) { // After various checks, generically set the flag for jump pads KartState *state = mAccessor->getState(); state->bitfield0 |= FLAG_JUMP_PAD; // ... if (variant >= 3 && variant <= 4) { // ... // Set the flag for negating the speed factors state->mFlags |= JUMP_PAD_FIXED_SPEED; } if (variant == 4) { // Set the flag for mushroom-specific jump pads state->mFlags |= JUMP_PAD_MUSHROOM_TRIGGER; // ... } // ... }
// This is run once every frame generically void Kart::KartMove::tryEndJumpPad() { KartState *state = mAccessor->getState(); // Check to see if the flag for mushroom-specific jump pads is set if (state->mFlags & JUMP_PAD_MUSHROOM_TRIGGER) { // If so, check to see if we just landed on the ground if (state->mFlags & GROUND_START) { // Unset the mushroom-specific jump pad flag state->mFlags &= ~JUMP_PAD_MUSHROOM_TRIGGER; // The game falsely assumes that JUMP_PAD_FIXED_SPEED can only be set if the mushroom trigger is set // As we see above, this is not always the case, leading to the offroad glitch // Unset the fixed speed flag here and only here state->mFlags &= ~JUMP_PAD_FIXED_SPEED; // ... } // ... } // Check to see if we just landed on the ground and that the mushroom-specific jump pad flag is not set if (state->mFlags & GROUND_START !(state->mFlags & JUMP_PAD_MUSHROOM_TRIGGER)) { // ... // Unset the flag for jump pads state->mFlags &= ~JUMP_PAD; } }
The following Gecko code fixes this glitch.
Fix Offroad Glitch (NTSC-U) [vabold] C257BE18 00000003 90030004 8003000C 54000314 9003000C 60000000 00000000
Fix Offroad Glitch (NTSC-J) [vabold] C2581FFC 00000003 90030004 8003000C 54000314 9003000C 60000000 00000000
Fix Offroad Glitch (NTSC-K) [vabold] C25706D4 00000003 90030004 8003000C 54000314 9003000C 60000000 00000000