; ---------------------------------------------------------------------------
; Subroutine handling Super Sonic specific actions
; ---------------------------------------------------------------------------
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
Sonic_Super:
tst.b (Super_Sonic_flag).w ; is Sonic super?
beq.s Sonic_SuperEnd ; if not, finish the routine
subq.b #1,(Super_Sonic_ringdrain_timer).w ; substract one from the timer
bpl.s Sonic_SuperEnd ; if it didn't reached -1, don't take away a ring
move.b #59,(Super_Sonic_ringdrain_timer).w ; reset the timer for another second
ori.b #1,($FFFFFE1D).w ; update the ring counter on next frame
cmpi.w #1,($FFFFFE20).w ; do you have exactly 1 ring (would be 0 on next frame)?
beq.s @resethud ; if yes, the counter needs resetting
cmpi.w #10,($FFFFFE20).w ; do you have exactly 10 rings (would be 9 on next frame)?
beq.s @resethud ; if yes, the counter needs resetting
cmpi.w #100,($FFFFFE20).w ; do you have exactly 100 rings (would be 99 on next frame)?
bne.s @updatehud ; if no, proceed as usual
@resethud: ; hud needs resetting
ori.b #$80,($FFFFFE1D).w ; update clear unused digits on the next frame
@updatehud: ; hud needs to be updated
subq.w #1,($FFFFFE20).w ; substract one ring
bne.s Sonic_SuperEnd ; if Sonic still has any, don't revert
Sonic_Super_RevertToNormal: ; returning to normal form
; palette cycle will go here
clr.b (Super_Sonic_flag).w ; clear the flag, as we no longer are Super Sonic
move.w #1,$32(a0) ; set the invincibility timer to #1, so it'll remove invincibility related stuff and restore the music at the next frame
bsr.w Sonic_SetSpeedValues ; apply new speed values
Sonic_SuperEnd:
rts ; finish the routine
; End of routine Sonic_Super
Advertisement
Advertisement