The fix I have for that Super Sonic problem is this: find Sonic_RevertToNormal and modify the code so that this:
becomes this:
This restores normal movement from an unfinished transformation (Super_Sonic_palette >= 0 means the transformation hasn't finished). It changes the code to also fade out from super palette only if it is needed: it fades from current palette index instead of flashing to full super palette before fading. This works because Palette_frame is less than $28 if Super_Sonic_palette >= 0. The next_anim line can be (and was) removed without any ill effects; all it does is reset the animation (except for the running animation, which is not reset).
"next_anim" is a misnomer, by the way; "prev_anim" or "last_anim" are better names: if you look at Sonic_Animate, you will see that if anim(a0) != next_anim(a0), then next_anim(a0) is set to anim(a0) and the animation is reset. This clearly is not the behavior you expect from the name.
Syntax Highlighted Code: ASM
Sonic_RevertToNormal:
move.b #2,(Super_Sonic_palette).w ; Remove rotating palette
move.w #$28,(Palette_frame).w
move.b #0,(Super_Sonic_flag).w
move.b #1,next_anim(a0) ; Change animation back to normal ?
becomes this:
Syntax Highlighted Code: ASM
Sonic_RevertToNormal:
tst.b (Super_Sonic_palette).w ; Are we interrupting a transformation to Super Sonic?
bmi.s + ; branch if not
move.b #0,obj_control(a0) ; restore Sonic's movement if yes
bra.s ++ ; Do not change current palette index, which will be less than $28
+
move.w #$28,(Palette_frame).w ; Fade out from Super Sonic palette
+
move.b #2,(Super_Sonic_palette).w ; Remove rotating palette
move.b #0,(Super_Sonic_flag).w
This restores normal movement from an unfinished transformation (Super_Sonic_palette >= 0 means the transformation hasn't finished). It changes the code to also fade out from super palette only if it is needed: it fades from current palette index instead of flashing to full super palette before fading. This works because Palette_frame is less than $28 if Super_Sonic_palette >= 0. The next_anim line can be (and was) removed without any ill effects; all it does is reset the animation (except for the running animation, which is not reset).
"next_anim" is a misnomer, by the way; "prev_anim" or "last_anim" are better names: if you look at Sonic_Animate, you will see that if anim(a0) != next_anim(a0), then next_anim(a0) is set to anim(a0) and the animation is reset. This clearly is not the behavior you expect from the name.


31
