Actions

SCHG How-to

Fix bugs relating to Super Sonic

From Sonic Retro

Revision as of 16:47, 15 May 2011 by MoDule (talk | contribs) (Created page with "{{GuideBy|MoDule}} Super Sonic from ''Sonic 2'' comes with quite a few bugs, some minor, while others [[Sonic_the_Hedgehog_2_%2816-bit%29_bug_lā€¦")
(diff) ā† Older revision | Latest revision (diff) | Newer revision ā†’ (diff)

(Original guide by MoDule)

Super Sonic from Sonic 2 comes with quite a few bugs, some minor, while others can render the game unbeatable. This guide will show how to fix some of them.

Stuck at the end of a level

At the end of a level, after reverting back to normal, if Sonic jumps he will trigger his transformation again and get stuck in the air. A full description of the bug can be found here.

Fixing the bug

Locate the Sonic_CheckGoSuper routine and add the following two lines at the beginning: <asm> tst.b (Update_HUD_timer).w ; has Sonic reached the end of the act? beq.s return_1ABA4 ; if yes, branch </asm> The code should now look something like this: <asm>; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

loc_1AB38
test_set_SS:

Sonic_CheckGoSuper: tst.b (Update_HUD_timer).w ; has Sonic reached the end of the act? beq.s return_1ABA4 ; if yes, branch

tst.b (Super_Sonic_flag).w ; is Sonic already Super? bne.s return_1ABA4 ; if yes, branch cmpi.b #7,(Emerald_count).w ; does Sonic have exactly 7 emeralds? bne.s return_1ABA4 ; if not, branch cmpi.w #50,(Ring_count).w ; does Sonic have at least 50 rings? blo.s return_1ABA4 ; if not, branch </asm> All this does is skip Sonic's transformation check if the level timer has stopped, which happens at the end of a level.

The bug explained

the main offender is this line in the above routine. <asm> move.b #$81,obj_control(a0) ; lock Sonic in place </asm> What this does is stop Sonic's movement completely for the duration of his transformation sequence. This isn't usually a problem, because his movement is restored once the transformation is done. The other part of the problem comes from here: <asm>; loc_1ABA6: Sonic_Super: tst.b (Super_Sonic_flag).w ; Ignore all this code if not Super Sonic beq.w return_1AC3C tst.b (Update_HUD_timer).w ; has level ended? beq.s Sonic_RevertToNormal ; <-- if yes, branch

;[...]

Sonic_RevertToNormal: move.b #2,(Super_Sonic_palette).w ; <-- remove rotating palette

;[...] </asm> and here: <asm>; sub_213E: PalCycle_SuperSonic: move.b (Super_Sonic_palette).w,d0 beq.s ++ ; rts ; return, if Sonic isn't super bmi.w PalCycle_SuperSonic_normal ; branch, if fade-in is done subq.b #1,d0 bne.s PalCycle_SuperSonic_revert ; <-- branch for values greater than 1

;[...]

move.b #-1,(Super_Sonic_palette).w ; mark fade-in as done move.b #0,(MainCharacter+obj_control).w ; <-- restore Sonic's movement

;[...]

loc_2188

PalCycle_SuperSonic_revert: ; runs the fade in transition backwards </asm> What's happening is that first Sonic jumps and starts the transformation sequence. This stops his movement. Then, since the timer has stopped, his palette cycle is set to fade out, but since it hasn't finished fading in, Sonic's movement is never restored. Thus he just hangs there forever.