Actions

SCHG How-to

Fix the Walk-Jump Bug in Sonic 1

From Sonic Retro

(Original guide by Cinossu)

In Sonic the Hedgehog there's a lovely bug where Sonic jumps into the air in his walking animation. It occurs in several places (to the right of the second purple rock with a yellow spring on top of it in Green Hill Zone Act 2 being a good place to see it), but they all have one thing in common; they are near an object that calls the SolidObject routine.

Instead of changing how jumps are shown within Sonic's object code, you can fix this within the SolidObject routine itself (and if you look in Sonic 2, a variant of this is used as well).

The first thing you'll want to find is loc_FB92. It starts off looking like this:

<asm>loc_FB92: btst #5,$22(a0) beq.s loc_FBAC move.w #1,$1C(a1) ; use walking animation

loc_FBA0: bclr #5,$22(a0) ...</asm>

If you look at the comment left, it sets the walking animation for use right here. Your first assumption may be to remove this call altogether, but you don't want to do that as some little animation bugs can still occur this way. The way to fix it is to add a conditional branch over it, checking to see if Sonic's animation should be set to rolling. You should change the code to look something like this:

<asm>loc_FB92: btst #5,$22(a0) beq.s loc_FBAC cmp.b #2,$1C(a1) ; check if in jumping/rolling animation beq.s loc_FBA0 move.w #1,$1C(a1) ; use walking animation

loc_FBA0: bclr #5,$22(a0) ...</asm>

And that's it! A much simpler method of getting rid of this bug, and one that doesn't alter the original player object as well.