Actions

SCHG How-to

Difference between revisions of "Add Spin Dash to Sonic 1/Part 4"

From Sonic Retro

m
Line 1: Line 1:
{{GuideBy|Mercury}}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:<pre> clr.w ($FFFFF7A8).w ; reset Sonic's position tracking index
+
{{GuideBy|Mercury}}
 +
 
 +
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:
 +
<asm> clr.w ($FFFFF7A8).w ; reset Sonic's position tracking index
 
lea ($FFFFCB00).w,a2 ; load the tracking array into a2
 
lea ($FFFFCB00).w,a2 ; load the tracking array into a2
 
moveq #63,d2 ; begin a 64-step loop
 
moveq #63,d2 ; begin a 64-step loop
Line 5: Line 8:
 
move.w d1,(a2)+ ; fill in X
 
move.w d1,(a2)+ ; fill in X
 
move.w d0,(a2)+ ; fill in Y
 
move.w d0,(a2)+ ; fill in Y
dbf d2,@looppoint ; loop</pre>[[Category:SCHG How-tos|Add Spin Dash to Sonic 1/Part 4]]
+
dbf d2,@looppoint ; loop</asm>
 +
 
 +
[[Category:SCHG How-tos|Add Spin Dash to Sonic 1/Part 4]]

Revision as of 10:25, 13 September 2011

(Original guide by Mercury)

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: <asm> 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</asm>