Skip to content

Commit

Permalink
Adding constant for alternate use of spindash_counter
Browse files Browse the repository at this point in the history
spindash_counter appears to sometimes be used a countdown for restarting
the level upon death. In the event of a game over/time over, this timer
is set to 0, making it useless, to allow the resetting (to Sega screen)
to done manually.
  • Loading branch information
Clownacy committed Jul 12, 2015
1 parent 78e898c commit d97029c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
22 changes: 11 additions & 11 deletions s2.asm
Expand Up @@ -34719,11 +34719,11 @@ CheckGameOver:
cmp.w y_pos(a0),d0
bge.w return_1B31A
move.b #8,routine(a0) ; => Obj01_Gone
move.w #$3C,spindash_counter(a0)
move.w #$3C,restart_countdown(a0)
addq.b #1,(Update_HUD_lives).w ; update lives counter
subq.b #1,(Life_count).w ; subtract 1 from number of lives
bne.s Obj01_ResetLevel ; if it's not a game over, branch
move.w #0,spindash_counter(a0)
move.w #0,restart_countdown(a0)
move.b #ObjID_GameOver,(GameOver_GameText+id).w ; load Obj39 (game over text)
move.b #ObjID_GameOver,(GameOver_OverText+id).w ; load Obj39 (game over text)
move.b #1,(GameOver_OverText+mapping_frame).w
Expand All @@ -34748,7 +34748,7 @@ Obj01_Finished:
Obj01_ResetLevel:
tst.b (Time_Over_flag).w
beq.s Obj01_ResetLevel_Part2
move.w #0,spindash_counter(a0)
move.w #0,restart_countdown(a0)
move.b #ObjID_TimeOver,(TimeOver_TimeText+id).w ; load Obj39
move.b #ObjID_TimeOver,(TimeOver_OverText+id).w ; load Obj39
move.b #2,(TimeOver_TimeText+mapping_frame).w
Expand All @@ -34774,7 +34774,7 @@ Obj01_ResetLevel_Part2:
move.w #0,inertia(a0)
move.b #2,status(a0)
move.w #0,move_lock(a0)
move.w #0,spindash_counter(a0)
move.w #0,restart_countdown(a0)

return_1B31A:
rts
Expand All @@ -34784,9 +34784,9 @@ return_1B31A:
; ---------------------------------------------------------------------------
; loc_1B31C: Obj_01_Sub_8:
Obj01_Gone:
tst.w spindash_counter(a0)
tst.w restart_countdown(a0)
beq.s +
subq.w #1,spindash_counter(a0)
subq.w #1,restart_countdown(a0)
bne.s +
move.w #1,(Level_Inactive_flag).w
+
Expand Down Expand Up @@ -37458,7 +37458,7 @@ Obj02_CheckGameOver_2Pmode:
addq.b #1,(Update_HUD_lives_2P).w
subq.b #1,(Life_count_2P).w
bne.s Obj02_ResetLevel
move.w #0,spindash_counter(a0)
move.w #0,restart_countdown(a0)
move.b #ObjID_GameOver,(GameOver_GameText+id).w ; load Obj39
move.b #ObjID_GameOver,(GameOver_OverText+id).w ; load Obj39
move.b #1,(GameOver_OverText+mapping_frame).w
Expand Down Expand Up @@ -37489,7 +37489,7 @@ Obj02_ResetLevel:
beq.s Obj02_ResetLevel_Part2
tst.b (Time_Over_flag_2P).w
beq.s Obj02_ResetLevel_Part3
move.w #0,spindash_counter(a0)
move.w #0,restart_countdown(a0)
clr.b (Update_HUD_timer).w
clr.b (Update_HUD_timer_2P).w
move.b #8,routine(a0)
Expand All @@ -37500,7 +37500,7 @@ Obj02_ResetLevel:
Obj02_ResetLevel_Part2:
tst.b (Time_Over_flag_2P).w
beq.s Obj02_ResetLevel_Part3
move.w #0,spindash_counter(a0)
move.w #0,restart_countdown(a0)
move.b #ObjID_TimeOver,(TimeOver_TimeText+id).w ; load Obj39
move.b #ObjID_TimeOver,(TimeOver_OverText+id).w ; load Obj39
move.b #2,(TimeOver_TimeText+mapping_frame).w
Expand Down Expand Up @@ -37533,9 +37533,9 @@ return_1CD8E:
; ---------------------------------------------------------------------------
; loc_1CD90:
Obj02_Gone:
tst.w spindash_counter(a0)
tst.w restart_countdown(a0)
beq.s +
subq.w #1,spindash_counter(a0)
subq.w #1,restart_countdown(a0)
bne.s +
move.w #1,(Level_Inactive_flag).w
+
Expand Down
1 change: 1 addition & 0 deletions s2.constants.asm
Expand Up @@ -63,6 +63,7 @@ tilt = $37 ; angle on ground
stick_to_convex = $38 ; 0 for normal, 1 to make Sonic stick to convex surfaces like the rotating discs in Sonic 1 and 3 (unused in Sonic 2 but fully functional)
spindash_flag = $39 ; 0 for normal, 1 for charging a spindash or forced rolling
spindash_counter = $3A ; and $3B
restart_countdown = spindash_counter; and 1+spindash_counter
jumping = $3C
interact = $3D ; RAM address of the last object Sonic stood on, minus $FFFFB000 and divided by $40
top_solid_bit = $3E ; the bit to check for top solidity (either $C or $E)
Expand Down

0 comments on commit d97029c

Please sign in to comment.