Offroad glitch: Difference between revisions

From MKWii TAS Wiki
Jump to navigation Jump to search
Vabold (talk | contribs)
Create initial page
 
m Kierio04 moved page Offroad Glitch to Offroad glitch: Misspelled title: Title not in sentence case
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The '''Offroad Glitch''' is a bug with specific jump pads which negates the following speed modifiers.
The '''Offroad Glitch''' is a bug that occurs with specific jump pads, which negates the following speed modifiers :
* Wheelie bonus
* Wheelie bonus
* Mini-turbo/trick/zipper boost
* Mini-turbo/trick/zipper boost
Line 14: Line 14:


== Relevant code ==
== Relevant code ==
The following code is written in C++, and has been edited to only include relevant parts. Irrelevant code will be marked with <code>// ...</code>.
The following code is written in C++, and has been edited to only include relevant parts. Irrelevant code will be marked with <code>// ...</code>.<syntaxhighlight lang="cpp" line="1">
<pre>
// This is run when the game recognizes we're interacting with a jump pad
// This is run when the game recognizes we're interacting with a jump pad
void Kart::KartMove::tryStartJumpPad(int variant) {
void Kart::KartMove::tryStartJumpPad(int variant) {
Line 34: Line 33:
     // ...
     // ...
}
}
</pre>
</syntaxhighlight><syntaxhighlight lang="c++" line="1">
<pre>
// This is run once every frame generically
// This is run once every frame generically
void Kart::KartMove::tryEndJumpPad() {
void Kart::KartMove::tryEndJumpPad() {
Line 61: Line 59:
     }
     }
}
}
</pre>
</syntaxhighlight>The following Gecko code fixes this glitch.
 
<tabber>
The following Gecko code fixes this glitch.
|-|PAL=
<pre>
<pre>
Fix Offroad Glitch (PAL) [vabold]
Fix Offroad Glitch (PAL) [vabold]
Line 70: Line 68:
54000314 9003000C
54000314 9003000C
60000000 00000000
60000000 00000000
 
</pre>
|-|NTSC-U=
<pre>
Fix Offroad Glitch (NTSC-U) [vabold]
Fix Offroad Glitch (NTSC-U) [vabold]
C257BE18 00000003
C257BE18 00000003
Line 76: Line 76:
54000314 9003000C
54000314 9003000C
60000000 00000000
60000000 00000000
 
</pre>
|-|NTSC-J=
<pre>
Fix Offroad Glitch (NTSC-J) [vabold]
Fix Offroad Glitch (NTSC-J) [vabold]
C2581FFC 00000003
C2581FFC 00000003
Line 82: Line 84:
54000314 9003000C
54000314 9003000C
60000000 00000000
60000000 00000000
 
</pre>
|-|NTSC-K=
<pre>
Fix Offroad Glitch (NTSC-K) [vabold]
Fix Offroad Glitch (NTSC-K) [vabold]
C25706D4 00000003
C25706D4 00000003
Line 89: Line 93:
60000000 00000000
60000000 00000000
</pre>
</pre>
</tabber>
[[Category:Glitches]]

Latest revision as of 03:03, 9 October 2025

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 (PAL) [vabold]
C258267C 00000003
90030004 8003000C
54000314 9003000C
60000000 00000000

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