Add Spin Dash to Sonic 1/Part 4
From Sonic Retro
Revision as of 09:50, 25 August 2018 by Black Squirrel (talk | contribs) (Text replacement - "\[\[Category:SCHG How-tos.*" to "")
(Original guide by Mercury)
2005 HiveBrain's disassembly
This will fix the issue which causes weird camera movements if the player performs a Spin Dash at the very beginning of a level since the camera will try to follow bad data from the array of Sonic's previous positions. The following code therefore clears the aforementioned array and should be added right after the loc_60D0 label:
clr.w ($FFFFF7A8).w ; reset Sonic's position tracking index
lea ($FFFFCB00).w,a2 ; load the tracking array into a2
moveq #63,d2 ; begin a 64-step loop
@looppoint:
move.w d1,(a2)+ ; fill in X
move.w d0,(a2)+ ; fill in Y
dbf d2,@looppoint ; loop
Another little issue is when using objects like spring right after spindashing. The game does not quite know how to accommodate after you suddenly change direction. It is fairly easy fix, so let's go to Obj41_AniLR, and right below the lable add this line:
clr.w ($FFFFC904).w ; clear screen delay counter
And finally, there's an annoying bug that occurs when rolling into a Caterkiller too fast, which will result Sonic in taking damage despite the head being destroyed already. This happens because the spiked body segments are actually not getting deleted immediately after destroying the head, but rather one frame later. To fix this, go to loc_16C7C: and right below the label add:
clr.b $20(a1) ; immediately remove all touch response values when destroying the head to avoid taking damage
GitHub disassembly
This will fix the issue which causes weird camera movements if the player performs a Spin Dash at the very beginning of a level since the camera will try to follow bad data from the array of Sonic's previous positions. The following code therefore clears the aforementioned array. Open _inc\LevelSizeLoad & BgScrollSpeed.asm (or its JP1 counterpart if you have the JP1 revision enabled), and add theese lines at the beggining or the LevSz_SkipStartPos label:
clr.w (v_trackpos).w ; reset Sonic's position tracking index
lea (v_tracksonic).w,a2 ; load the tracking array into a2
moveq #63,d2 ; begin a 64-step loop
@looppoint:
move.w d1,(a2)+ ; fill in X
move.w d0,(a2)+ ; fill in Y
dbf d2,@looppoint ; loop
Another little issue is when using objects like spring right after spindashing. The game does not quite know how to accommodate after you suddenly change direction. It is fairly easy fix, so let's go to Spring_AniLR, and right below the lable add this line:
clr.w ($FFFFC904).w ; clear screen delay counter
And finally, there's an annoying bug that occurs when rolling into a Caterkiller too fast, which will result Sonic in taking damage despite the head being destroyed already. This happens because the spiked body segments are actually not getting deleted immediately after destroying the head, but rather one frame later. To fix this, go to loc_16C7C: and right below the label add:
clr.b obColType(a1) ; immediately remove all touch response values when destroying the head to avoid taking damage
That's it!
|Add Spin Dash to Sonic 1/Part 4]]