Actions

SCHG How-to

Fix the Walk-Jump Bug in Sonic 1

From Sonic Retro

Revision as of 23:17, 14 September 2008 by Aquaslash (talk | contribs)

(Original guide by Aquaslash)

In the original Sonic the Hedgehog there exists an odd bug where Sonic does not use his Spin Attack while jumping next to certain objects. He'll walk in place instead of rolling into a ball. In addition to looking way weird, this can also hamper the game play a great deal. It's most noticeable in Final Zone, where it can cost players a few hits. Today, we're going to fix that annoying glitch (because if I have to play ONE more hack with it, I'm losing it).


The first thing we want to look for is the modes for controlling Sonic, which is where this fix will be called from. We'll want to call this in the air at all times so look for "Obj01_MdJump". Once there, find the line "bsr.w Sonic_JumpHeight". This is an optimal place for our fix since it'll be called after Sonic's jump height is looked at. You'll want to paste this line after it:

<asm>bsr.w FixMZBug</asm>

Thus, the completed section should look like this (give or take your own modifications):

<asm> bsr.w Sonic_JumpHeight bsr.w FixMZBug bsr.w Sonic_ChgJumpDir bsr.w Sonic_LevelBound jsr ObjectFall btst #6,$22(a0) beq.s loc_12E5C subi.w #$28,$12(a0)</asm>

We'll also want to do this at the second check of the jump modes: "Obj01_MdJump2" Once there, paste the same fix line in the same spot. It should look similar to this:

<asm>Obj01_MdJump2: ; XREF: Obj01_Modes bsr.w Sonic_JumpHeight bsr.w FixMZBug bsr.w Sonic_ChgJumpDir bsr.w Sonic_LevelBound jsr ObjectFall btst #6,$22(a0) beq.s loc_12EA6 subi.w #$28,$12(a0)</asm>

Now for the fix. Find "Sonic_SlopeResist". We're going to place our fix BEFORE it. Make some space after the routine above it and add the following:

<asm>

---------------------------------------------------------------------------
Subroutine to fix that godawful jumping bug
---------------------------------------------------------------------------
||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

FixMZBug:

     		tst.b   $3C(a0)		; Are we jumping?
     		beq  	@rts		; If not, rts
     		tst.w	$12(a0)		; Just to make sure, is speed negative, aka are we going up?
    		blt 	@jumping	; If yes, branch
     

@rts:

     		rts
     

@jumping:

     		cmp.b  	#$01,$1C(a0)	; Are we using the walking animation?
     		blt     @fix_bug	; If yes, fix that.
     		rts
     

@fix_bug:

     		move.b  #$2,$1C(a0)	; Set animation to rolling.
     		rts
End of function FixMZBug
===========================================================================

</asm>

As explained by the comments, this checks is Sonic's moving upwards while using the walking animation. If he is, the proper rolling animation is put in it's place, problems are solved, and the Final Zone boss dies in record time!

That's it! It's one of those simple, but necessary fixes. Put it in your Sonic 1 hack. NOW. Else I'll hunt you down and force you to do it >:(.

(Special thanks go to Puto for helping out with this.)