Sonic Pushing Walking Animation Fixes - RetroKoH/S1Fixed GitHub Wiki

(Original guide by Mercury)
Source: ReadySonic
Commit: 3eb05d6

This guide is going to tackle two annoying bugs related to Sonic's animations.

Pushing While Walking Fix

If Sonic rolls or moves too fast into a wall or solid object and then quickly turns around, he'll often move away from it while using his "push" animation instead of the proper "walk" animation. This is because Sonic's Animation Script will hardset Sonic to the pushing animation whenever the push flag is set. Fixing this is simple. As is done in Sonic 2, we just need to clear Sonic's "pushing" status bit whenever his animation is supposed to reset. Open _incObj/Sonic Animate.asm, and you'll see the area we need to edit right at the top, near the main label. All we do is add the instruction at the very bottom.

	lea	(Ani_Sonic).l,a1
	moveq	#0,d0
	move.b	obAnim(a0),d0
	cmp.b	obPrevAni(a0),d0	; has animation changed?
	beq.s	.do			; if not, branch
; This code is run if Sonic's animation needs to reset
	move.b	d0,obPrevAni(a0)
	move.b	#0,obAniFrame(a0)	; reset animation
	move.b	#0,obTimeFrame(a0)	; reset frame duration
+	bclr	#5,obStatus(a0)		; clear pushing flag

Wrong Sprite When Next To Solids Bugfix

This isn't one bug, but several related ones:

  • If Sonic dies next to a monitor/solid, he'll use the "walk" animation as he falls off the screen.
  • Likewise, if Sonic drowns next to a monitor/solid.
  • Sonic will change to the "walk" animation as he jumps past monitors/solids, causing a silly looking "airwalk".
  • Sonic will fail to spindash if he does so next to a monitor/solid. He'll charge up, but he won't go anywhere.

Remove this line in _incObj\sub SolidObject.asm, at label Solid_Ignore:

	btst	#5,obStatus(a0)	; is Sonic pushing?
	beq.s	Solid_Debug	; if not, branch
-	move.w	#id_Run,obAnim(a1) ; use running animation

Remove this line in _incObj\26 Monitor.asm, at label loc_A25C:

	btst	#5,obStatus(a0)
	beq.s	Mon_Animate		
-	move.w	#id_Run,obAnim(a1)

Finally, remove this line in sonic.asm, at label loc_8AA8:

	btst	#5,obStatus(a0)
	beq.s	locret_8AC2
-	move.w	#id_Run,obAnim(a1)

The lines we removed seem to be there to change Sonic back to his "run" animation from his "push" animation (and the "run" quickly changes to "walk" because his speed is low). Removing them solves the bug, but doesn't seem to introduce any problems so long as you apply the first fix (hence why both fixes are together in this one guide).