So today I come here with a short guide to fix a "bug" that is present all 3 of the original trillogy that I am sure most people could care less about, but it bothers me.
The "bug" is that, when jumping and landing, even without any horizontal movement, the character will display a single frame of the walking animation.
This glich remains in all popular hacks as well.
those I tested were:
Pana Der HejHog
Sonic 2 Heroes
Sonic 2 Retro Remix
The S Factor
Sonic Extended Edition
Sonic 1 Megamix
This is rather simple to fix, and I would like to see it corrected in future hacks. So I now present you with a short guide, written to explain this "bug" and correct it. Keep in mind this guide was written as if you were to never have made changes to Sonic's animations, so this does not cover the guide that adds spindash to Sonic 1.
Interestingly enough, the standing frame is not in an animation of it's own, but is in the waiting animation. When jumping, then landing, the Sonic_ResetOnFloor routine calls for animation 0, which is the walking animation. This is what causes this bug.
The fix? It is as simple as making a few changes to the Sonic_ResetOnFloor routine.
As always, anything I write a guide for will be written based off my work with Sonic 2, and as such, behaves differently when compared to Sonic 1 (in fact, this guide might not work at all for it. If that is the case let me know, and I will try to look into it, but I am lazy currently). I normally work with the 2007 version of Sonic 2, but I will also try to cover the newer HG versions of Sonic 1 and 2 (Not Sonic 3, because I am lazy). However, there is a huge difference in the Sonic_ResetOnFloor routine from Sonic 1 to Sonic 2, which I will be covering as well.
So, let us get down to work!
we will need to visit the routine I mentioned before:
Once there we will have to do some moddification to this routine. But first, I will cover Sonic 1, and how to make this routine behave like it does in S2.
As you can see, in Sonic 1, this routine contains far less code than it's Sonic 2 equivalent. Seeing as how this is not the original focus of this guide, I have decided to post an already finished modification of this routine. I have also gone through the effort to comment this routine as well as possible, to help explain exactly what it does
Sonic_ResetOnFloor: ; XREF: PlatformObject; et al ; handles the part when sonic lands from a jump, resets his radius size and clears spinning status btst #2,status(a0) ; is sonic's status set to spinning? beq.s Sonic_ResetOnFloor_Part2 ; if the check comes up equal, let part2 handle the rest bclr #2,ObStatus(a0) ; clear spinning status move.b #$13,obHeight(a0) ; this increases Sonic's collision height to standing move.b #9,obWidth(a0) ; fix Sonic's x radius to match normal subq.w #5,obY(a0) ; move Sonic up 5 pixels so the increased height doesn't push him into the ground move.b #id_Walk,obAnim(a0) ; use running/walking animation ; loc_1B0DA: Sonic_ResetOnFloor_Part2: bclr #1,ObStatus(a0) ; clear inair status bclr #5,ObStatus(a0) ; clear pushing status bclr #4,ObStatus(a0) ; clear rolljumping status move.b #0,$3C(a0) ; move 0 into $3C/ clear the jumping flag move.w #0,(v_itembonus).w ; clear the chain hit counter, to avoid Sonic getting an insane score for no reason move.b #0,$27(a0) ; flip_angle, this clears the angle Sonic is facing move.b #0,$29(a0) ; flip_turned, supposedly resets the direction Sonic is flipped in, however seemingly does nothing as he will face the direction he landed in move.b #0,$2C(a0) ; flips remaining, this clears the number of flip revolutions remaining move.w #0,($FFFFF66C).w ; Sonic_Look_delay_counter, resets the look delay for the camera. Might be useless unless you ported over the lookingup/ducking delays from S2 move.b #id_Walk,obAnim(a0) ; use running/walking animation Sonic_ResetOnFloor_END: rts
As you can see, we still have work to do, as this still only calls for the walk animation.
We will need to check for certain conditions for this however, because if left/right is being pressed, we do not want Sonic to slide around on the floor in Standing animation.
How do we do this? first we will need to check for Sonic's inertia:
tst.w inertia(a0) ; is Sonic moving? ; Sonic 2007 and HG
tst.w obInertia(a0) ; is Sonic moving? ; S1 HG
we will need to place this above the line that loads Sonic's walking animation
then we will need to branch if it is not equal (or higher than 0, in a sense). So place this under the line
we just added:
bne.w Sonic_ResetonFloor_Part2Sub1 ; if yes, branch ; S2 2007/HG version
bne.w Sonic_ResetonFloorSub1 ; if yes, branch ; S1 HG version
Now we will add a line to load the waiting animation, which contains the standing frame, we will need to
also add a branch and create the tiny subroutine I just told you to branch to:
; S2 2007 and HG version move.b #$5,anim(a0) ; use standing/waiting animation bra.s Sonic_ResetOnFloor_Part2 + move.b #0,anim(a0) ; use running/walking/standing animation
; Sonic 1 HG version move.b #id_Wait,obAnim(a0) ; use "standing" animation bra.s Sonic_ResetOnFloor_Part2 Sonic_ResetOnFloorSub1: move.b #id_Walk,obAnim(a0) ; use running/walking animation
We will then make the same moddification to Sonic_ResetOnFloor_Part2 (and for Sonic_ResetOnFloor_Part3 for
those hacking S2), just copy the last few lines you added, and place them before the call for the walking
animation for each following part of the code. And change the lines branched to accordingly.
If you followed these steps, then you are ready to build and test the game.
Seems to work well, except for one tiny issue. When you stand at the very bottom of a slope, and jump... Sonic slides backwards in his standing frame! Ok, this is a simple fix.
Go to this routine:
Before the line that reads:
add.w d0,inertia(a0) ; change Sonic's $14
add this line:
move.b #0,anim(a0) ; S2 2002/HG
move.b #id_Walk,obAnim(a0) ; use running/walking animation
And that should fix that issue. Which also concludes this guide.