From 37970c697e08effa373728e67a2b79df66581a5f Mon Sep 17 00:00:00 2001 From: AlexField442 Date: Sun, 17 Aug 2025 15:02:08 +1000 Subject: [PATCH 01/22] Start deprecating ObjXX labels Per this discussion (https://github.com/sonicretro/s2disasm/issues/78), objects will be moved over to a more descriptive naming scheme. Subroutines they use will also be named after them. --- s2.asm | 765 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 389 insertions(+), 376 deletions(-) diff --git a/s2.asm b/s2.asm index 35aa92a4..50f1678b 100644 --- a/s2.asm +++ b/s2.asm @@ -5174,7 +5174,7 @@ InitPlayers: move.w (Player_mode).w,d0 bne.s InitPlayers_Alone ; branch if this isn't a Sonic and Tails game - move.b #ObjID_Sonic,(MainCharacter+id).w ; load Obj01 Sonic object at $FFFFB000 + move.b #ObjID_Sonic,(MainCharacter+id).w ; load Obj_Sonic at $FFFFB000 move.b #ObjID_SpindashDust,(Sonic_Dust+id).w ; load Obj08 Sonic's spindash dust/splash object at $FFFFD100 cmpi.b #wing_fortress_zone,(Current_Zone).w @@ -5184,7 +5184,7 @@ InitPlayers: cmpi.b #sky_chase_zone,(Current_Zone).w beq.s + ; skip loading Tails if this is SCZ - move.b #ObjID_Tails,(Sidekick+id).w ; load Obj02 Tails object at $FFFFB040 + move.b #ObjID_Tails,(Sidekick+id).w ; load Obj_Tails object at $FFFFB040 move.w (MainCharacter+x_pos).w,(Sidekick+x_pos).w move.w (MainCharacter+y_pos).w,(Sidekick+y_pos).w subi.w #$20,(Sidekick+x_pos).w @@ -5198,13 +5198,13 @@ InitPlayers_Alone: ; either Sonic or Tails but not both subq.w #1,d0 bne.s InitPlayers_TailsAlone ; branch if this is a Tails alone game - move.b #ObjID_Sonic,(MainCharacter+id).w ; load Obj01 Sonic object at $FFFFB000 + move.b #ObjID_Sonic,(MainCharacter+id).w ; load Obj_Sonic at $FFFFB000 move.b #ObjID_SpindashDust,(Sonic_Dust+id).w ; load Obj08 Sonic's spindash dust/splash object at $FFFFD100 rts ; =========================================================================== ; loc_44D0: InitPlayers_TailsAlone: - move.b #ObjID_Tails,(MainCharacter+id).w ; load Obj02 Tails object at $FFFFB000 + move.b #ObjID_Tails,(MainCharacter+id).w ; load Obj_Tails object at $FFFFB000 move.b #ObjID_SpindashDust,(Tails_Dust+id).w ; load Obj08 Tails' spindash dust/splash object at $FFFFD100 addi_.w #4,(MainCharacter+y_pos).w rts @@ -29684,8 +29684,8 @@ RunObjectDisplayOnly: ; This array contains the pointers to all the objects used in the game. ; --------------------------------------------------------------------------- Obj_Index: ; ObjPtrs: ; loc_1600C: -ObjPtr_Sonic: dc.l Obj01 ; Sonic -ObjPtr_Tails: dc.l Obj02 ; Tails +ObjPtr_Sonic: dc.l Obj_Sonic ; Sonic +ObjPtr_Tails: dc.l Obj_Tails ; Tails ObjPtr_PlaneSwitcher: dc.l Obj03 ; Collision plane/layer switcher ObjPtr_WaterSurface: dc.l Obj04 ; Surface of the water ObjPtr_TailsTails: dc.l Obj05 ; Tails' tails @@ -35827,32 +35827,32 @@ loc_19F4C: ; ---------------------------------------------------------------------------- ; Object 01 - Sonic ; ---------------------------------------------------------------------------- -; Sprite_19F50: Object_Sonic: -Obj01: +; Sprite_19F50: Object_Sonic: Obj01: +Obj_Sonic: ; a0=character tst.w (Debug_placement_mode).w ; is debug mode being used? - beq.s Obj01_Normal ; if not, branch + beq.s Sonic_Normal ; if not, branch jmp (DebugMode).l ; --------------------------------------------------------------------------- -; loc_19F5C: -Obj01_Normal: +; loc_19F5C: Obj01_Normal: +Sonic_Normal: moveq #0,d0 move.b routine(a0),d0 - move.w Obj01_Index(pc,d0.w),d1 - jmp Obj01_Index(pc,d1.w) -; =========================================================================== -; off_19F6A: Obj01_States: -Obj01_Index: offsetTable - offsetTableEntry.w Obj01_Init ; 0 - offsetTableEntry.w Obj01_Control ; 2 - offsetTableEntry.w Obj01_Hurt ; 4 - offsetTableEntry.w Obj01_Dead ; 6 - offsetTableEntry.w Obj01_Gone ; 8 - offsetTableEntry.w Obj01_Respawning ; $A -; =========================================================================== -; loc_19F76: Obj_01_Sub_0: Obj01_Main: -Obj01_Init: - addq.b #2,routine(a0) ; => Obj01_Control + move.w Sonic_Index(pc,d0.w),d1 + jmp Sonic_Index(pc,d1.w) +; =========================================================================== +; off_19F6A: Obj01_States: Obj01_Index: +Sonic_Index: offsetTable + offsetTableEntry.w Sonic_Init ; 0 + offsetTableEntry.w Sonic_Control ; 2 + offsetTableEntry.w Sonic_Hurt ; 4 + offsetTableEntry.w Sonic_Dead ; 6 + offsetTableEntry.w Sonic_Gone ; 8 + offsetTableEntry.w Sonic_Respawning ; $A +; =========================================================================== +; loc_19F76: Obj_01_Sub_0: Obj01_Main: Obj01_Init: +Sonic_Init: + addq.b #2,routine(a0) ; => Sonic_Control move.b #$13,y_radius(a0) ; this sets Sonic's collision height (2*pixels) move.b #9,x_radius(a0) move.l #MapUnc_Sonic,mappings(a0) @@ -35863,7 +35863,7 @@ Obj01_Init: move.w #$C,(Sonic_acceleration).w ; set Sonic's acceleration move.w #$80,(Sonic_deceleration).w ; set Sonic's deceleration tst.b (Last_star_pole_hit).w - bne.s Obj01_Init_Continued + bne.s Sonic_Init_Continued ; only happens when not starting at a checkpoint: move.w #make_art_tile(ArtTile_ArtUnc_Sonic,0,0),art_tile(a0) bsr.w Adjust2PArtPointer @@ -35873,8 +35873,8 @@ Obj01_Init: move.w y_pos(a0),(Saved_y_pos).w move.w art_tile(a0),(Saved_art_tile).w move.w top_solid_bit(a0),(Saved_Solid_bits).w - -Obj01_Init_Continued: +; Obj01_Init_Continued: +Sonic_Init_Continued: move.b #0,flips_remaining(a0) move.b #4,flip_speed(a0) move.b #0,(Super_Sonic_flag).w @@ -35895,8 +35895,8 @@ Obj01_Init_Continued: ; --------------------------------------------------------------------------- ; Normal state for Sonic ; --------------------------------------------------------------------------- -; loc_1A030: Obj_01_Sub_2: -Obj01_Control: +; loc_1A030: Obj_01_Sub_2: Obj01_Control: +Sonic_Control: tst.w (Debug_mode_flag).w ; is debug cheat enabled? beq.s + ; if not, branch btst #button_B,(Ctrl_1_Press).w ; is button B pressed? @@ -35914,8 +35914,8 @@ Obj01_Control: moveq #0,d0 move.b status(a0),d0 andi.w #1< Obj01_Control + subq.b #2,routine(a0) ; => Sonic_Control move.w #$78,invulnerable_time(a0) move.b #0,spindash_flag(a0) @@ -37859,7 +37862,7 @@ JmpTo_KillCharacter ; JmpTo ; seems to be unused ; loc_1B1CA: Sonic_HurtInstantRecover: - subq.b #2,routine(a0) ; => Obj01_Control + subq.b #2,routine(a0) ; => Sonic_Control move.b #0,routine_secondary(a0) bsr.w Sonic_RecordPos bsr.w Sonic_Animate @@ -37872,8 +37875,8 @@ Sonic_HurtInstantRecover: ; ...poor Sonic ; --------------------------------------------------------------------------- -; loc_1B1E6: Obj_01_Sub_6: -Obj01_Dead: +; loc_1B1E6: Obj_01_Sub_6: Obj01_Dead: +Sonic_Dead: tst.w (Debug_mode_flag).w beq.s + btst #button_B,(Ctrl_1_Press).w @@ -37899,22 +37902,22 @@ CheckGameOver: addi.w #$100,d0 cmp.w y_pos(a0),d0 bge.w return_1B31A - move.b #8,routine(a0) ; => Obj01_Gone + move.b #8,routine(a0) ; => Sonic_Gone move.w #60,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 + bne.s Sonic_ResetLevel ; if it's not a game over, branch 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 move.w a0,(GameOver_GameText+parent).w clr.b (Time_Over_flag).w -; loc_1B26E: -Obj01_Finished: +; loc_1B26E: Obj01_Finished: +Sonic_Finished: clr.b (Update_HUD_timer).w clr.b (Update_HUD_timer_2P).w - move.b #8,routine(a0) ; => Obj01_Gone + move.b #8,routine(a0) ; => Sonic_Gone move.w #MusID_GameOver,d0 jsr (PlayMusic).l moveq #PLCID_GameOver,d0 @@ -37925,23 +37928,24 @@ Obj01_Finished: ; --------------------------------------------------------------------------- ; Sonic when the level is restarted ; --------------------------------------------------------------------------- -; loc_1B28E: -Obj01_ResetLevel: +; loc_1B28E: Obj01_ResetLevel: +Sonic_ResetLevel: tst.b (Time_Over_flag).w - beq.s Obj01_ResetLevel_Part2 + beq.s Sonic_ResetLevel_Part2 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 move.b #3,(TimeOver_OverText+mapping_frame).w move.w a0,(TimeOver_TimeText+parent).w - bra.s Obj01_Finished + bra.s Sonic_Finished ; --------------------------------------------------------------------------- -Obj01_ResetLevel_Part2: +; Obj01_ResetLevel_Part2: +Sonic_ResetLevel_Part2: tst.w (Two_player_mode).w beq.s return_1B31A move.b #0,(Scroll_lock).w - move.b #$A,routine(a0) ; => Obj01_Respawning + move.b #$A,routine(a0) ; => Sonic_Respawning move.w (Saved_x_pos).w,x_pos(a0) move.w (Saved_y_pos).w,y_pos(a0) move.w (Saved_art_tile).w,art_tile(a0) @@ -37959,12 +37963,13 @@ Obj01_ResetLevel_Part2: return_1B31A: rts + ; =========================================================================== ; --------------------------------------------------------------------------- ; Sonic when he's offscreen and waiting for the level to restart ; --------------------------------------------------------------------------- -; loc_1B31C: Obj_01_Sub_8: -Obj01_Gone: +; loc_1B31C: Obj_01_Sub_8: Obj01_Gone: +Sonic_Gone: tst.w restart_countdown(a0) beq.s + subq.w #1,restart_countdown(a0) @@ -37972,23 +37977,24 @@ Obj01_Gone: move.w #1,(Level_Inactive_flag).w + rts + ; =========================================================================== ; --------------------------------------------------------------------------- ; Sonic when he's waiting for the camera to scroll back to where he respawned ; --------------------------------------------------------------------------- -; loc_1B330: Obj_01_Sub_A: -Obj01_Respawning: +; loc_1B330: Obj_01_Sub_A: Obj01_Respawning: +Sonic_Respawning: tst.w (Camera_X_pos_diff).w bne.s + tst.w (Camera_Y_pos_diff).w bne.s + - move.b #2,routine(a0) ; => Obj01_Control + move.b #2,routine(a0) ; => Sonic_Control + bsr.w Sonic_Animate bsr.w LoadSonicDynPLC jmp (DisplaySprite).l -; =========================================================================== +; =========================================================================== ; --------------------------------------------------------------------------- ; Subroutine to animate Sonic's sprites ; See also: AnimateSprite @@ -38493,8 +38499,8 @@ return_1B89A: ; ---------------------------------------------------------------------------- ; Object 02 - Tails ; ---------------------------------------------------------------------------- -; Sprite_1B8A4: Object_Tails: -Obj02: +; Sprite_1B8A4: Object_Tails: Obj02: +Obj_Tails: ; a0=character cmpi.w #2,(Player_mode).w bne.s + @@ -38504,21 +38510,21 @@ Obj02: + moveq #0,d0 move.b routine(a0),d0 - move.w Obj02_Index(pc,d0.w),d1 - jmp Obj02_Index(pc,d1.w) -; =========================================================================== -; off_1B8CC: Obj02_States: -Obj02_Index: offsetTable - offsetTableEntry.w Obj02_Init ; 0 - offsetTableEntry.w Obj02_Control ; 2 - offsetTableEntry.w Obj02_Hurt ; 4 - offsetTableEntry.w Obj02_Dead ; 6 - offsetTableEntry.w Obj02_Gone ; 8 - offsetTableEntry.w Obj02_Respawning ; $A -; =========================================================================== -; loc_1B8D8: Obj02_Main: -Obj02_Init: - addq.b #2,routine(a0) ; => Obj02_Normal + move.w Tails_Index(pc,d0.w),d1 + jmp Tails_Index(pc,d1.w) +; =========================================================================== +; off_1B8CC: Obj02_States: Obj02_Index: +Tails_Index: offsetTable + offsetTableEntry.w Tails_Init ; 0 + offsetTableEntry.w Tails_Control ; 2 + offsetTableEntry.w Tails_Hurt ; 4 + offsetTableEntry.w Tails_Dead ; 6 + offsetTableEntry.w Tails_Gone ; 8 + offsetTableEntry.w Tails_Respawning ; $A +; =========================================================================== +; loc_1B8D8: Obj02_Main: Obj02_Init: +Tails_Init: + addq.b #2,routine(a0) ; => Tails_Normal move.b #$F,y_radius(a0) ; this sets Tails' collision height (2*pixels) to less than Sonic's height move.b #9,x_radius(a0) move.l #MapUnc_Tails,mappings(a0) @@ -38529,9 +38535,9 @@ Obj02_Init: move.w #$C,(Tails_acceleration).w ; set Tails' acceleration move.w #$80,(Tails_deceleration).w ; set Tails' deceleration cmpi.w #2,(Player_mode).w - bne.s Obj02_Init_2Pmode + bne.s Tails_Init_2Pmode tst.b (Last_star_pole_hit).w - bne.s Obj02_Init_Continued + bne.s Tails_Init_Continued ; only happens when not starting at a checkpoint: move.w #make_art_tile(ArtTile_ArtUnc_Tails,0,0),art_tile(a0) bsr.w Adjust2PArtPointer @@ -38541,18 +38547,18 @@ Obj02_Init: move.w y_pos(a0),(Saved_y_pos).w move.w art_tile(a0),(Saved_art_tile).w move.w top_solid_bit(a0),(Saved_Solid_bits).w - bra.s Obj02_Init_Continued + bra.s Tails_Init_Continued ; =========================================================================== -; loc_1B952: -Obj02_Init_2Pmode: +; loc_1B952: Obj02_Init_2Pmode: +Tails_Init_2Pmode: move.w #make_art_tile(ArtTile_ArtUnc_Tails,0,0),art_tile(a0) bsr.w Adjust2PArtPointer move.w (MainCharacter+top_solid_bit).w,top_solid_bit(a0) tst.w (MainCharacter+art_tile).w - bpl.s Obj02_Init_Continued + bpl.s Tails_Init_Continued ori.w #high_priority,art_tile(a0) -; loc_1B96E: -Obj02_Init_Continued: +; loc_1B96E: Obj02_Init_Continued: +Tails_Init_Continued: move.w x_pos(a0),(Saved_x_pos_2P).w move.w y_pos(a0),(Saved_y_pos_2P).w move.w art_tile(a0),(Saved_art_tile_2P).w @@ -38569,35 +38575,35 @@ Obj02_Init_Continued: ; --------------------------------------------------------------------------- ; Normal state for Tails ; --------------------------------------------------------------------------- -; loc_1B9B4: -Obj02_Control: +; loc_1B9B4: Obj02_Control: +Tails_Control: cmpa.w #MainCharacter,a0 - bne.s Obj02_Control_Joypad2 + bne.s Tails_Control_Joypad2 move.w (Ctrl_1_Logical).w,(Ctrl_2_Logical).w tst.b (Control_Locked).w ; are controls locked? - bne.s Obj02_Control_Part2 ; if yes, branch + bne.s Tails_Control_Part2 ; if yes, branch move.w (Ctrl_1).w,(Ctrl_2_Logical).w ; copy new held buttons, to enable joypad control move.w (Ctrl_1).w,(Ctrl_1_Logical).w - bra.s Obj02_Control_Part2 + bra.s Tails_Control_Part2 ; --------------------------------------------------------------------------- -; loc_1B9D4: -Obj02_Control_Joypad2: +; loc_1B9D4: Obj02_Control_Joypad2: +Tails_Control_Joypad2: tst.b (Control_Locked_P2).w bne.s + move.w (Ctrl_2).w,(Ctrl_2_Logical).w + tst.w (Two_player_mode).w - bne.s Obj02_Control_Part2 + bne.s Tails_Control_Part2 bsr.w TailsCPU_Control -; loc_1B9EA: -Obj02_Control_Part2: +; loc_1B9EA: Obj02_Control_Part2: +Tails_Control_Part2: btst #0,obj_control(a0) ; is Tails flying, or interacting with another object that holds him in place or controls his movement somehow? bne.s + ; if yes, branch to skip Tails' control moveq #0,d0 move.b status(a0),d0 andi.w #1< Obj02_Control + move.b #2,routine(a0) ; => Tails_Control move.w #$78,invulnerable_time(a0) move.b #0,spindash_flag(a0) @@ -40704,12 +40713,12 @@ JmpTo2_KillCharacter ; JmpTo ; --------------------------------------------------------------------------- ; Tails when he dies -; . +; Poor bugger ; --------------------------------------------------------------------------- -; loc_1CC50: -Obj02_Dead: - bsr.w Obj02_CheckGameOver +; loc_1CC50: Obj02_Dead: +Tails_Dead: + bsr.w Tails_CheckGameOver jsr (ObjectMoveAndFall).l bsr.w Tails_RecordPos bsr.w Tails_Animate @@ -40718,8 +40727,8 @@ Obj02_Dead: ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| -; loc_1CC6C: -Obj02_CheckGameOver: +; loc_1CC6C: Obj02_CheckGameOver: +Tails_CheckGameOver: cmpi.w #2,(Player_mode).w ; is it a Tails Alone game? beq.w CheckGameOver ; if yes, branch... goodness, code reuse move.b #1,(Scroll_lock_P2).w @@ -40730,22 +40739,22 @@ Obj02_CheckGameOver: bge.w return_1CD8E move.b #2,routine(a0) tst.w (Two_player_mode).w - bne.s Obj02_CheckGameOver_2Pmode + bne.s Tails_CheckGameOver_2Pmode bra.w TailsCPU_Despawn ; --------------------------------------------------------------------------- -; loc_1CCA2: -Obj02_CheckGameOver_2Pmode: +; loc_1CCA2: Obj02_CheckGameOver_2Pmode: +Tails_CheckGameOver_2Pmode: addq.b #1,(Update_HUD_lives_2P).w subq.b #1,(Life_count_2P).w - bne.s Obj02_ResetLevel + bne.s Tails_ResetLevel 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 move.w a0,(GameOver_GameText+parent).w clr.b (Time_Over_flag_2P).w -; loc_1CCCC: -Obj02_Finished: +; loc_1CCCC: Obj02_Finished: +Tails_Finished: clr.b (Update_HUD_timer).w clr.b (Update_HUD_timer_2P).w move.b #8,routine(a0) @@ -40753,22 +40762,22 @@ Obj02_Finished: jsr (PlayMusic).l moveq #PLCID_GameOver,d0 jmp (LoadPLC).l -; End of function Obj02_CheckGameOver +; End of function Tails_CheckGameOver ; =========================================================================== ; --------------------------------------------------------------------------- ; Tails when the level is restarted ; --------------------------------------------------------------------------- -; loc_1CCEC: -Obj02_ResetLevel: +; loc_1CCEC: Obj02_ResetLevel: +Tails_ResetLevel: tst.b (Time_Over_flag).w if gameRevision=0 - bne.s Obj02_ResetLevel_Part3 + bne.s Tails_ResetLevel_Part3 else - beq.s Obj02_ResetLevel_Part2 + beq.s Tails_ResetLevel_Part2 tst.b (Time_Over_flag_2P).w - beq.s Obj02_ResetLevel_Part3 + beq.s Tails_ResetLevel_Part3 move.w #0,restart_countdown(a0) clr.b (Update_HUD_timer).w clr.b (Update_HUD_timer_2P).w @@ -40777,20 +40786,22 @@ Obj02_ResetLevel: endif ; --------------------------------------------------------------------------- -Obj02_ResetLevel_Part2: +; Obj02_ResetLevel_Part2: +Tails_ResetLevel_Part2: tst.b (Time_Over_flag_2P).w - beq.s Obj02_ResetLevel_Part3 + beq.s Tails_ResetLevel_Part3 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 move.b #3,(TimeOver_OverText+mapping_frame).w move.w a0,(TimeOver_TimeText+parent).w - bra.s Obj02_Finished + bra.s Tails_Finished ; --------------------------------------------------------------------------- -Obj02_ResetLevel_Part3: +; Obj02_ResetLevel_Part3: +Tails_ResetLevel_Part3: move.b #0,(Scroll_lock_P2).w - move.b #$A,routine(a0) ; => Obj02_Respawning + move.b #$A,routine(a0) ; => Tails_Respawning move.w (Saved_x_pos_2P).w,x_pos(a0) move.w (Saved_y_pos_2P).w,y_pos(a0) move.w (Saved_art_tile_2P).w,art_tile(a0) @@ -40807,12 +40818,13 @@ Obj02_ResetLevel_Part3: return_1CD8E: rts + ; =========================================================================== ; --------------------------------------------------------------------------- ; Tails when he's offscreen and waiting for the level to restart ; --------------------------------------------------------------------------- -; loc_1CD90: -Obj02_Gone: +; loc_1CD90: Obj02_Gone: +Tails_Gone: tst.w restart_countdown(a0) beq.s + subq.w #1,restart_countdown(a0) @@ -40820,12 +40832,13 @@ Obj02_Gone: move.w #1,(Level_Inactive_flag).w + rts + ; =========================================================================== ; --------------------------------------------------------------------------- ; Tails when he's waiting for the camera to scroll back to where he respawned ; --------------------------------------------------------------------------- -; loc_1CDA4: -Obj02_Respawning: +; loc_1CDA4: Obj02_Respawning: +Tails_Respawning: tst.w (Camera_X_pos_diff_P2).w bne.s + tst.w (Camera_Y_pos_diff_P2).w @@ -40835,8 +40848,8 @@ Obj02_Respawning: bsr.w Tails_Animate bsr.w LoadTailsDynPLC jmp (DisplaySprite).l -; =========================================================================== +; =========================================================================== ; --------------------------------------------------------------------------- ; Subroutine to animate Tails' sprites ; See also: AnimateSprite and Sonic_Animate From 3f2471ce8e5043d1d56f252ffe0a09bc7ed541a1 Mon Sep 17 00:00:00 2001 From: AlexField442 Date: Sun, 17 Aug 2025 16:33:19 +1000 Subject: [PATCH 02/22] Updated rings and restored historical labels/addresses f_bigring should be renamed in the future, as it appears to be used upon entering a Special Stage... --- s2.asm | 199 ++++++++++++++++++++++++----------------------- s2.constants.asm | 2 +- 2 files changed, 104 insertions(+), 97 deletions(-) diff --git a/s2.asm b/s2.asm index 50f1678b..88fb980b 100644 --- a/s2.asm +++ b/s2.asm @@ -6085,7 +6085,7 @@ ChangeRingFrame: subq.b #1,(Rings_anim_counter).w bpl.s + move.b #7,(Rings_anim_counter).w - addq.b #1,(Rings_anim_frame).w ; animate rings in the level (obj25) + addq.b #1,(Rings_anim_frame).w ; animate rings in the level (Obj_Ring) andi.b #3,(Rings_anim_frame).w + subq.b #1,(Unknown_anim_counter).w @@ -6104,7 +6104,7 @@ ChangeRingFrame: move.w d0,(Ring_spill_anim_accum).w rol.w #7,d0 andi.w #3,d0 - move.b d0,(Ring_spill_anim_frame).w ; animate scattered rings (obj37) + move.b d0,(Ring_spill_anim_frame).w ; animate scattered rings (Obj_LostRings) subq.b #1,(Ring_spill_anim_counter).w + rts @@ -24825,55 +24825,55 @@ Obj29_MapUnc_11ED0: include "mappings/sprite/obj29.asm" ; =========================================================================== -; ---------------------------------------------------------------------------- +; --------------------------------------------------------------------------- ; Object 25 - A ring (usually only placed through placement mode) -; ---------------------------------------------------------------------------- -; Obj_Ring: -Obj25: +; --------------------------------------------------------------------------- +; Sprite_11F44: Obj25: +Obj_Ring: moveq #0,d0 move.b routine(a0),d0 - move.w Obj25_Index(pc,d0.w),d1 - jmp Obj25_Index(pc,d1.w) -; =========================================================================== -; Obj_25_subtbl: -Obj25_Index: offsetTable - offsetTableEntry.w Obj25_Init ; 0 - offsetTableEntry.w Obj25_Animate ; 2 - offsetTableEntry.w Obj25_Collect ; 4 - offsetTableEntry.w Obj25_Sparkle ; 6 - offsetTableEntry.w Obj25_Delete ; 8 -; =========================================================================== -; Obj_25_sub_0: -Obj25_Init: + move.w Ring_Index(pc,d0.w),d1 + jmp Ring_Index(pc,d1.w) +; =========================================================================== +; off_11F52: Obj_25_subtbl: Obj25_Index: +Ring_Index: offsetTable + offsetTableEntry.w Ring_Init ; 0 + offsetTableEntry.w Ring_Animate ; 2 + offsetTableEntry.w Ring_Collect ; 4 + offsetTableEntry.w Ring_Sparkle ; 6 + offsetTableEntry.w Ring_Delete ; 8 +; =========================================================================== +; loc_11F5C: Obj_25_sub_0: Obj25_Init: +Ring_Init: addq.b #2,routine(a0) move.w x_pos(a0),objoff_32(a0) - move.l #Obj25_MapUnc_12382,mappings(a0) + move.l #Ring_MapUnc_12382,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a0) bsr.w Adjust2PArtPointer move.b #1< Obj_25_sub_6 move.b (a2)+,d0 ext.w d0 @@ -34568,7 +34575,7 @@ loc_19398: ext.w d0 add.w y_pos(a0),d0 move.w d0,y_pos(a1) - move.l #Obj25_MapUnc_12382,mappings(a1) + move.l #Ring_MapUnc_12382,mappings(a1) move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a1) bsr.w Adjust2PArtPointer2 move.b #1< Date: Sun, 17 Aug 2025 16:55:42 +1000 Subject: [PATCH 03/22] Noted these two programming oddities Unsure if these are actually bugs, though the lines themselves appear to be redundant as the line above already forces them into their waiting animation. --- s2.asm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/s2.asm b/s2.asm index 88fb980b..6bc05d25 100644 --- a/s2.asm +++ b/s2.asm @@ -13650,6 +13650,9 @@ loc_A53A: move.w d0,y_pos(a1) move.w x_pos(a0),x_pos(a1) move.l #(1<<24)|(0<<16)|(AniIDSonAni_Wait<<8)|(AniIDSonAni_Wait<<0),mapping_frame(a1) + ; Sonic doesn't use the lower bit of 'anim_frame_duration' at + ; all, so this instead sets its duration to 1 and clears an + ; unused value. move.w #$100,anim_frame_duration(a1) rts ; =========================================================================== @@ -78564,6 +78567,9 @@ loc_3AB18: bclr #status.player.in_air,status(a1) bclr #status.player.rolling,status(a1) move.l #(1<<24)|(0<<16)|(AniIDSonAni_Wait<<8)|(AniIDSonAni_Wait<<0),mapping_frame(a1) + ; Sonic doesn't use the lower bit of 'anim_frame_duration' at + ; all, so this instead sets its duration to 1 and clears an + ; unused value. move.w #$100,anim_frame_duration(a1) move.b #$13,y_radius(a1) cmpi.w #2,(Player_mode).w From 1e5e45badd78b24ce55a97e53d675b6a48447fb1 Mon Sep 17 00:00:00 2001 From: AlexField442 Date: Mon, 18 Aug 2025 16:48:41 +1000 Subject: [PATCH 04/22] Do monitors and pathswappers, begin renaming mapping files --- SonLVL INI Files/CNZ/Pinball mode.xml | 16 +- SonLVL INI Files/Common/Monitor.xml | 22 +- SonLVL INI Files/Common/PathSwapper.cs | 2 +- .../WFZ/Cycling palette switcher.xml | 8 +- SonLVL INI Files/obj.ini | 2 +- .../{obj37_c.asm => Giant ring flash.asm} | 0 .../sprite/{obj37_b.asm => Giant ring.asm} | 0 mappings/sprite/{obj26.asm => Monitor.asm} | 0 .../sprite/{obj03.asm => Pathswapper.asm} | 0 mappings/sprite/{obj37_a.asm => Ring.asm} | 0 s2.asm | 495 +++++++++--------- 11 files changed, 277 insertions(+), 268 deletions(-) rename mappings/sprite/{obj37_c.asm => Giant ring flash.asm} (100%) rename mappings/sprite/{obj37_b.asm => Giant ring.asm} (100%) rename mappings/sprite/{obj26.asm => Monitor.asm} (100%) rename mappings/sprite/{obj03.asm => Pathswapper.asm} (100%) rename mappings/sprite/{obj37_a.asm => Ring.asm} (100%) diff --git a/SonLVL INI Files/CNZ/Pinball mode.xml b/SonLVL INI Files/CNZ/Pinball mode.xml index 35a32db4..515c22a3 100644 --- a/SonLVL INI Files/CNZ/Pinball mode.xml +++ b/SonLVL INI Files/CNZ/Pinball mode.xml @@ -3,35 +3,35 @@ - + - + - + - + - + - + - + - + diff --git a/SonLVL INI Files/Common/Monitor.xml b/SonLVL INI Files/Common/Monitor.xml index a426d233..934521b3 100644 --- a/SonLVL INI Files/Common/Monitor.xml +++ b/SonLVL INI Files/Common/Monitor.xml @@ -3,48 +3,48 @@ - + - + - + - + - + - + - + - + - + - + - + diff --git a/SonLVL INI Files/Common/PathSwapper.cs b/SonLVL INI Files/Common/PathSwapper.cs index 55685522..647ccbf1 100644 --- a/SonLVL INI Files/Common/PathSwapper.cs +++ b/SonLVL INI Files/Common/PathSwapper.cs @@ -16,7 +16,7 @@ public override void Init(ObjectData data) { List tmpartfile = new List(); tmpartfile.AddRange(ObjectHelper.OpenArtFile("Common/pathswapper-art.bin", CompressionType.Nemesis)); - string mapfile = "../mappings/sprite/obj03.asm"; + string mapfile = "../mappings/sprite/Pathswapper.asm"; byte[] artfile1 = tmpartfile.ToArray(); img = ObjectHelper.MapASMToBmp(artfile1, mapfile, 0, 0); Point off; diff --git a/SonLVL INI Files/WFZ/Cycling palette switcher.xml b/SonLVL INI Files/WFZ/Cycling palette switcher.xml index d3846163..480455fd 100644 --- a/SonLVL INI Files/WFZ/Cycling palette switcher.xml +++ b/SonLVL INI Files/WFZ/Cycling palette switcher.xml @@ -3,19 +3,19 @@ - + - + - + - + diff --git a/SonLVL INI Files/obj.ini b/SonLVL INI Files/obj.ini index 1b65f5d8..e984aedb 100644 --- a/SonLVL INI Files/obj.ini +++ b/SonLVL INI Files/obj.ini @@ -2,7 +2,7 @@ codefile=Common/RingGroup.cs codetype=S2ObjectDefinitions.Common.RingGroup art=../art/nemesis/Ring.nem -mapasm=../mappings/sprite/obj37_a.asm +mapasm=../mappings/sprite/Ring.asm pal=1 spacing=24 [Sonic] diff --git a/mappings/sprite/obj37_c.asm b/mappings/sprite/Giant ring flash.asm similarity index 100% rename from mappings/sprite/obj37_c.asm rename to mappings/sprite/Giant ring flash.asm diff --git a/mappings/sprite/obj37_b.asm b/mappings/sprite/Giant ring.asm similarity index 100% rename from mappings/sprite/obj37_b.asm rename to mappings/sprite/Giant ring.asm diff --git a/mappings/sprite/obj26.asm b/mappings/sprite/Monitor.asm similarity index 100% rename from mappings/sprite/obj26.asm rename to mappings/sprite/Monitor.asm diff --git a/mappings/sprite/obj03.asm b/mappings/sprite/Pathswapper.asm similarity index 100% rename from mappings/sprite/obj03.asm rename to mappings/sprite/Pathswapper.asm diff --git a/mappings/sprite/obj37_a.asm b/mappings/sprite/Ring.asm similarity index 100% rename from mappings/sprite/obj37_a.asm rename to mappings/sprite/Ring.asm diff --git a/s2.asm b/s2.asm index 6bc05d25..e910a313 100644 --- a/s2.asm +++ b/s2.asm @@ -542,7 +542,6 @@ Vint_Lag: bra.s VintRet ; --------------------------------------------------------------------------- - ; loc_4C4: .isInLevelMode: tst.b (Water_flag).w @@ -567,7 +566,6 @@ Vint_Lag: bra.s .afterSetPalette ; --------------------------------------------------------------------------- - ; loc_526: .useUnderwaterPalette: dma68kToVDP Underwater_palette,$0000,palette_line_size*4,CRAM @@ -13441,7 +13439,7 @@ loc_A2F2: moveq #$E,d0 move.b #ObjID_Tails,id(a1) ; load Tails object move.b #$81,obj_control(a1) - move.b #ObjID_TailsTails,(Tails_Tails_Cutscene+id).w ; load Obj05 (Tails' tails) at $FFFFB080 + move.b #ObjID_TailsTails,(Tails_Tails_Cutscene+id).w ; load Obj_TailsTails at $FFFFB080 move.w a1,(Tails_Tails_Cutscene+parent).w rts ; =========================================================================== @@ -24850,7 +24848,7 @@ Ring_Index: offsetTable Ring_Init: addq.b #2,routine(a0) move.w x_pos(a0),objoff_32(a0) - move.l #Ring_MapUnc_12382,mappings(a0) + move.l #MapUnc_RingObj,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a0) bsr.w Adjust2PArtPointer move.b #1< Obj05_Main move.l #MapUnc_Tails,mappings(a0) move.w #make_art_tile(ArtTile_ArtUnc_Tails_Tails,0,0),art_tile(a0) @@ -41321,9 +41322,8 @@ Obj05_Init: move.b #2,priority(a0) move.b #$18,width_pixels(a0) move.b #1< dc.b 3 ; TailsAni_Roll -> Directional dc.b 3 ; TailsAni_Roll2 -> Directional @@ -41399,41 +41399,51 @@ Obj05AniSelection: ; --------------------------------------------------------------------------- ; Animation script - Tails' tails ; --------------------------------------------------------------------------- -; off_1D2C0: -Obj05AniData: offsetTable - offsetTableEntry.w Obj05Ani_Blank ; 0 - offsetTableEntry.w Obj05Ani_Swish ; 1 - offsetTableEntry.w Obj05Ani_Flick ; 2 - offsetTableEntry.w Obj05Ani_Directional ; 3 - offsetTableEntry.w Obj05Ani_DownLeft ; 4 - offsetTableEntry.w Obj05Ani_Down ; 5 - offsetTableEntry.w Obj05Ani_DownRight ; 6 - offsetTableEntry.w Obj05Ani_Spindash ; 7 - offsetTableEntry.w Obj05Ani_Skidding ; 8 - offsetTableEntry.w Obj05Ani_Pushing ; 9 - offsetTableEntry.w Obj05Ani_Hanging ; $A - -Obj05Ani_Blank: dc.b $20, 0,$FF +; off_1D2C0: Obj05AniData: +TailsTailsAniData: offsetTable + offsetTableEntry.w TailsTailsAni_Blank ; 0 + offsetTableEntry.w TailsTailsAni_Swish ; 1 + offsetTableEntry.w TailsTailsAni_Flick ; 2 + offsetTableEntry.w TailsTailsAni_Directional ; 3 + offsetTableEntry.w TailsTailsAni_DownLeft ; 4 + offsetTableEntry.w TailsTailsAni_Down ; 5 + offsetTableEntry.w TailsTailsAni_DownRight ; 6 + offsetTableEntry.w TailsTailsAni_Spindash ; 7 + offsetTableEntry.w TailsTailsAni_Skidding ; 8 + offsetTableEntry.w TailsTailsAni_Pushing ; 9 + offsetTableEntry.w TailsTailsAni_Hanging ; $A +; Obj05Ani_Blank: +TailsTailsAni_Blank: dc.b $20, 0,$FF rev02even -Obj05Ani_Swish: dc.b 7, 9, $A, $B, $C, $D,$FF +; Obj05Ani_Swish: +TailsTailsAni_Swish: dc.b 7, 9, $A, $B, $C, $D,$FF rev02even -Obj05Ani_Flick: dc.b 3, 9, $A, $B, $C, $D,$FD, 1 +; Obj05Ani_Flick: +TailsTailsAni_Flick: dc.b 3, 9, $A, $B, $C, $D,$FD, 1 rev02even -Obj05Ani_Directional: dc.b $FC,$49,$4A,$4B,$4C,$FF ; Tails is moving right +; Obj05Ani_Directional: +TailsTailsAni_Directional: dc.b $FC,$49,$4A,$4B,$4C,$FF ; Tails is moving right rev02even -Obj05Ani_DownLeft: dc.b 3,$4D,$4E,$4F,$50,$FF ; Tails is moving up-right +; Obj05Ani_DownLeft: +TailsTailsAni_DownLeft: dc.b 3,$4D,$4E,$4F,$50,$FF ; Tails is moving up-right rev02even -Obj05Ani_Down: dc.b 3,$51,$52,$53,$54,$FF ; Tails is moving up +; Obj05Ani_Down: +TailsTailsAni_Down: dc.b 3,$51,$52,$53,$54,$FF ; Tails is moving up rev02even -Obj05Ani_DownRight: dc.b 3,$55,$56,$57,$58,$FF ; Tails is moving up-left +; Obj05Ani_DownRight: +TailsTailsAni_DownRight: dc.b 3,$55,$56,$57,$58,$FF ; Tails is moving up-left rev02even -Obj05Ani_Spindash: dc.b 2,$81,$82,$83,$84,$FF +; Obj05Ani_Spindash: +TailsTailsAni_Spindash: dc.b 2,$81,$82,$83,$84,$FF rev02even -Obj05Ani_Skidding: dc.b 2,$87,$88,$89,$8A,$FF +; Obj05Ani_Skidding: +TailsTailsAni_Skidding: dc.b 2,$87,$88,$89,$8A,$FF rev02even -Obj05Ani_Pushing: dc.b 9,$87,$88,$89,$8A,$FF +; Obj05Ani_Pushing: +TailsTailsAni_Pushing: dc.b 9,$87,$88,$89,$8A,$FF rev02even -Obj05Ani_Hanging: dc.b 9,$81,$82,$83,$84,$FF +; Obj05Ani_Hanging: +TailsTailsAni_Hanging: dc.b 9,$81,$82,$83,$84,$FF even ; =========================================================================== @@ -45154,24 +45164,24 @@ word_1FCB8_End ; ---------------------------------------------------------------------------- ; Object 03 - Collision plane/layer switcher ; ---------------------------------------------------------------------------- -; Sprite_1FCDC: -Obj03: +; Sprite_1FCDC: Obj03: +Obj_PlaneSwitcher: moveq #0,d0 move.b routine(a0),d0 - move.w Obj03_Index(pc,d0.w),d1 - jsr Obj03_Index(pc,d1.w) + move.w PlaneSwitcher_Index(pc,d0.w),d1 + jsr PlaneSwitcher_Index(pc,d1.w) jmp (MarkObjGone3).l ; =========================================================================== -; off_1FCF0: -Obj03_Index: offsetTable - offsetTableEntry.w Obj03_Init ; 0 - offsetTableEntry.w Obj03_MainX ; 2 - offsetTableEntry.w Obj03_MainY ; 4 +; off_1FCF0: Obj03_Index: +PlaneSwitcher_Index: offsetTable + offsetTableEntry.w PlaneSwitcher_Init ; 0 + offsetTableEntry.w PlaneSwitcher_MainX ; 2 + offsetTableEntry.w PlaneSwitcher_MainY ; 4 ; =========================================================================== -; loc_1FCF6: -Obj03_Init: - addq.b #2,routine(a0) ; => Obj03_MainX - move.l #Obj03_MapUnc_1FFB8,mappings(a0) +; loc_1FCF6: Obj03_Init: +PlaneSwitcher_Init: + addq.b #2,routine(a0) ; => PlaneSwitcher_MainX + move.l #MapUnc_PlaneSwitcher,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a0) jsrto JmpTo7_Adjust2PArtPointer ori.b #1< Obj03_MainY + beq.s PlaneSwitcher_Init_CheckX +; Obj03_Init_CheckY: PlaneSwitcher_Init_CheckY: + addq.b #2,routine(a0) ; => PlaneSwitcher_MainY andi.w #7,d0 move.b d0,mapping_frame(a0) andi.w #3,d0 @@ -45198,7 +45208,7 @@ Obj03_Init: bhs.s + move.b #1,objoff_35(a0) + - bra.w Obj03_MainY + bra.w PlaneSwitcher_MainY ; =========================================================================== word_1FD68: dc.w $20 @@ -45206,8 +45216,8 @@ word_1FD68: dc.w $80 ; 2 dc.w $100 ; 3 ; =========================================================================== -; loc_1FD70: -Obj03_Init_CheckX: +; loc_1FD70: Obj03_Init_CheckX: +PlaneSwitcher_Init_CheckX: andi.w #3,d0 move.b d0,mapping_frame(a0) add.w d0,d0 @@ -45220,12 +45230,10 @@ Obj03_Init_CheckX: + lea (Sidekick).w,a1 ; a1=character cmp.w x_pos(a1),d1 - bhs.s + + bhs.s PlaneSwitcher_MainX move.b #1,objoff_35(a0) -+ - -; loc_1FDA4: -Obj03_MainX: +; loc_1FDA4: Obj03_MainX: +PlaneSwitcher_MainX: tst.w (Debug_placement_mode).w bne.w return_1FEAC move.w x_pos(a0),d1 @@ -45235,7 +45243,7 @@ Obj03_MainX: lea (Sidekick).w,a1 ; a1=character + tst.b (a2)+ - bne.s Obj03_MainX_Alt + bne.s PlaneSwitcher_MainX_Alt cmp.w x_pos(a1),d1 bhi.w return_1FEAC move.b #1,-1(a2) @@ -45269,8 +45277,8 @@ Obj03_MainX: ori.w #high_priority,art_tile(a1) bra.s return_1FEAC ; =========================================================================== -; loc_1FE38: -Obj03_MainX_Alt: +; loc_1FE38: Obj03_MainX_Alt: +PlaneSwitcher_MainX_Alt: cmp.w x_pos(a1),d1 bls.w return_1FEAC move.b #0,-1(a2) @@ -45306,8 +45314,8 @@ Obj03_MainX_Alt: return_1FEAC: rts ; =========================================================================== - -Obj03_MainY: +; loc_1FEAE: Obj03_MainY: +PlaneSwitcher_MainY: tst.w (Debug_placement_mode).w bne.w return_1FFB6 move.w y_pos(a0),d1 @@ -45317,7 +45325,7 @@ Obj03_MainY: lea (Sidekick).w,a1 ; a1=character + tst.b (a2)+ - bne.s Obj03_MainY_Alt + bne.s PlaneSwitcher_MainY_Alt cmp.w y_pos(a1),d1 bhi.w return_1FFB6 move.b #1,-1(a2) @@ -45351,8 +45359,8 @@ Obj03_MainY: ori.w #high_priority,art_tile(a1) bra.s return_1FFB6 ; =========================================================================== -; loc_1FF42: -Obj03_MainY_Alt: +; loc_1FF42: Obj03_MainY_Alt: +PlaneSwitcher_MainY_Alt: cmp.w y_pos(a1),d1 bls.w return_1FFB6 move.b #0,-1(a2) @@ -45388,10 +45396,11 @@ Obj03_MainY_Alt: return_1FFB6: rts ; =========================================================================== -; ------------------------------------------------------------------------------- +; --------------------------------------------------------------------------- ; sprite mappings -; ------------------------------------------------------------------------------- -Obj03_MapUnc_1FFB8: include "mappings/sprite/obj03.asm" +; --------------------------------------------------------------------------- +; Obj03_MapUnc_1FFB8: +MapUnc_PlaneSwitcher: include "mappings/sprite/Pathswapper.asm" ; =========================================================================== jmpTos JmpTo7_Adjust2PArtPointer @@ -46320,7 +46329,7 @@ Obj84_Index: offsetTable ; loc_21176: Obj84_Init: addq.b #2,routine(a0) ; => Obj84_MainX - move.l #Obj03_MapUnc_1FFB8,mappings(a0) + move.l #MapUnc_PlaneSwitcher,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Ring,0,0),art_tile(a0) jsrto JmpTo12_Adjust2PArtPointer ori.b #1< Date: Mon, 18 Aug 2025 16:53:31 +1000 Subject: [PATCH 05/22] Added explanation for jmpTos for its first instance --- s2.asm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/s2.asm b/s2.asm index e910a313..f4c90b33 100644 --- a/s2.asm +++ b/s2.asm @@ -1329,11 +1329,12 @@ sndDriverInput: rts ; End of function sndDriverInput +; =========================================================================== +; These 'jmpTo' blocks were generated by the compiler (ProASM) whenever an +; imported function was called that was out-of-bounds; they are missing in +; REV02, likely since they switched over to SNASM during its creation. jmpTos JmpTo_LoadTilesAsYouMove,JmpTo_SegaScr_VInt - - - ; --------------------------------------------------------------------------- ; Subroutine to initialize joypads ; --------------------------------------------------------------------------- From 079769c6fca695522c3d774a95041d0131cdee85 Mon Sep 17 00:00:00 2001 From: AlexField442 Date: Tue, 19 Aug 2025 12:52:25 +1000 Subject: [PATCH 06/22] Update this --- s2.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s2.asm b/s2.asm index f4c90b33..988e4341 100644 --- a/s2.asm +++ b/s2.asm @@ -1330,9 +1330,9 @@ sndDriverInput: ; End of function sndDriverInput ; =========================================================================== -; These 'jmpTo' blocks were generated by the compiler (ProASM) whenever an -; imported function was called that was out-of-bounds; they are missing in -; REV02, likely since they switched over to SNASM during its creation. +; These 'jmpTo' blocks were generated by the compiler (believed to be ProASM +; for the Amiga) whenever an imported function was called that was out-of-bounds; +; they are missing in REV02, since they switched over to a DOS-based setup using SNASM68K. jmpTos JmpTo_LoadTilesAsYouMove,JmpTo_SegaScr_VInt ; --------------------------------------------------------------------------- From 1d5c25223b2d4840eff94321051295e1f68466ce Mon Sep 17 00:00:00 2001 From: AlexField442 Date: Tue, 19 Aug 2025 18:55:30 +1000 Subject: [PATCH 07/22] More objects renamed --- SonLVL INI Files/EHZ/Waterfall.xml | 8 +- .../{obj04_b.asm => ARZ water surface.asm} | 0 ...04_a.asm => CPZ and HPZ water surface.asm} | 0 mappings/sprite/{obj27.asm => Explosion.asm} | 0 .../sprite/{obj8A.asm => Sonic 1 credits.asm} | 0 .../{obj49.asm => Waterfall from EHZ.asm} | 0 s2.asm | 378 +++++++++--------- 7 files changed, 188 insertions(+), 198 deletions(-) rename mappings/sprite/{obj04_b.asm => ARZ water surface.asm} (100%) rename mappings/sprite/{obj04_a.asm => CPZ and HPZ water surface.asm} (100%) rename mappings/sprite/{obj27.asm => Explosion.asm} (100%) rename mappings/sprite/{obj8A.asm => Sonic 1 credits.asm} (100%) rename mappings/sprite/{obj49.asm => Waterfall from EHZ.asm} (100%) diff --git a/SonLVL INI Files/EHZ/Waterfall.xml b/SonLVL INI Files/EHZ/Waterfall.xml index c394fbd4..05ceb9d1 100644 --- a/SonLVL INI Files/EHZ/Waterfall.xml +++ b/SonLVL INI Files/EHZ/Waterfall.xml @@ -3,19 +3,19 @@ - + - + - + - + diff --git a/mappings/sprite/obj04_b.asm b/mappings/sprite/ARZ water surface.asm similarity index 100% rename from mappings/sprite/obj04_b.asm rename to mappings/sprite/ARZ water surface.asm diff --git a/mappings/sprite/obj04_a.asm b/mappings/sprite/CPZ and HPZ water surface.asm similarity index 100% rename from mappings/sprite/obj04_a.asm rename to mappings/sprite/CPZ and HPZ water surface.asm diff --git a/mappings/sprite/obj27.asm b/mappings/sprite/Explosion.asm similarity index 100% rename from mappings/sprite/obj27.asm rename to mappings/sprite/Explosion.asm diff --git a/mappings/sprite/obj8A.asm b/mappings/sprite/Sonic 1 credits.asm similarity index 100% rename from mappings/sprite/obj8A.asm rename to mappings/sprite/Sonic 1 credits.asm diff --git a/mappings/sprite/obj49.asm b/mappings/sprite/Waterfall from EHZ.asm similarity index 100% rename from mappings/sprite/obj49.asm rename to mappings/sprite/Waterfall from EHZ.asm diff --git a/s2.asm b/s2.asm index 988e4341..975b077c 100644 --- a/s2.asm +++ b/s2.asm @@ -24823,12 +24823,9 @@ Obj29_MapUnc_11ED0: include "mappings/sprite/obj29.asm" jmpTos JmpTo_RandomNumber - - - ; =========================================================================== ; --------------------------------------------------------------------------- -; Object 25 - A ring (usually only placed through placement mode) +; Object 25 - A ring (only placed through debug mode) ; --------------------------------------------------------------------------- ; Sprite_11F44: Obj25: Obj_Ring: @@ -25524,7 +25521,7 @@ Monitor_SpawnIcon: Monitor_SpawnSmoke: bsr.w AllocateObject bne.s + - _move.b #ObjID_Explosion,id(a1) ; load obj27 + _move.b #ObjID_Explosion,id(a1) ; load Obj_Explosion addq.b #2,routine(a1) move.w x_pos(a0),x_pos(a1) move.w y_pos(a0),y_pos(a1) @@ -25888,7 +25885,7 @@ process_swap_table: ; process objects: swap_loop_objects: - cmpi.b #ObjID_PinballMode,id(a1) ; is it obj84 (pinball mode switcher)? + cmpi.b #ObjID_PinballMode,id(a1) ; is it Obj_PinballMode? beq.s + ; if yes, branch cmpi.b #ObjID_PlaneSwitcher,id(a1) ; is it Obj_PlaneSwitcher? bne.s ++ ; if not, branch further @@ -29699,7 +29696,7 @@ Obj_Index: ; ObjPtrs: ; loc_1600C: ObjPtr_Sonic: dc.l Obj_Sonic ; Sonic ObjPtr_Tails: dc.l Obj_Tails ; Tails ObjPtr_PlaneSwitcher: dc.l Obj_PlaneSwitcher ; Collision plane/layer switcher -ObjPtr_WaterSurface: dc.l Obj04 ; Surface of the water +ObjPtr_WaterSurface: dc.l Obj_WaterSurface ; Surface of the water ObjPtr_TailsTails: dc.l Obj_TailsTails ; Tails' tails ObjPtr_Spiral: dc.l Obj06 ; Rotating cylinder in MTZ, twisting spiral pathway in EHZ ObjPtr_Oil: dc.l Obj07 ; Oil in OOZ @@ -29740,7 +29737,7 @@ ObjPtr_FallingPillar: dc.l Obj23 ; Pillar that drops its lower part from ARZ ObjPtr_ARZBubbles: dc.l Obj24 ; Bubbles in Aquatic Ruin Zone ObjPtr_Ring: dc.l Obj_Ring ; A ring ObjPtr_Monitor: dc.l Obj_Monitor ; Monitor -ObjPtr_Explosion: dc.l Obj27 ; An explosion, giving off an animal and 100 points +ObjPtr_Explosion: dc.l Obj_Explosion ; An explosion, giving off an animal and 100 points ObjPtr_Animal: dc.l Obj28 ; Animal and the 100 points from a badnik ObjPtr_Points: dc.l Obj29 ; "100 points" text ObjPtr_Stomper: dc.l Obj2A ; Stomper from MCZ @@ -29757,7 +29754,7 @@ ObjPtr_OOZPoppingPform: dc.l Obj33 ; Green platform from OOZ ObjPtr_TitleCard: dc.l Obj34 ; level title card (screen with red, yellow, and blue) ObjPtr_InvStars: dc.l Obj35 ; Invincibility Stars ObjPtr_Spikes: dc.l Obj36 ; Vertical spikes -ObjPtr_LostRings: dc.l Obj_LostRings ; Scattering rings (generated when Sonic is hurt and has rings) +ObjPtr_LostRings: dc.l Obj_LostRings ; Scattering rings (generated when Sonic is hurt and has rings) ObjPtr_Shield: dc.l Obj38 ; Shield ObjPtr_GameOver: ObjPtr_TimeOver: dc.l Obj39 ; Game/Time Over text @@ -29776,7 +29773,7 @@ ObjPtr_OOZSpring: dc.l Obj45 ; Pressure spring from OOZ ObjPtr_OOZBall: dc.l Obj46 ; Ball from OOZ (unused, beta leftover) ObjPtr_Button: dc.l Obj47 ; Button ObjPtr_LauncherBall: dc.l Obj48 ; Round ball thing from OOZ that fires you off in a different direction -ObjPtr_EHZWaterfall: dc.l Obj49 ; Waterfall from EHZ +ObjPtr_EHZWaterfall: dc.l Obj_EHZWaterfall ; Waterfall from EHZ ObjPtr_Octus: dc.l Obj4A ; Octus (octopus badnik) from OOZ ObjPtr_Buzzer: dc.l Obj4B ; Buzzer (Buzz bomber) from EHZ dc.l ObjNull ; Used to be the "BBat" badnik from HPZ @@ -29841,14 +29838,14 @@ ObjPtr_MCZDrawbridge: dc.l Obj81 ; Long invisible vertical barrier ObjPtr_SwingingPform: dc.l Obj82 ; Platform that is usually swinging, from ARZ ObjPtr_ARZRotPforms: dc.l Obj83 ; 3 adjoined platforms from ARZ that rotate in a circle ObjPtr_ForcedSpin: -ObjPtr_PinballMode: dc.l Obj84 ; Pinball mode enable/disable (CNZ) +ObjPtr_PinballMode: dc.l Obj_PinballMode ; Pinball mode enable/disable (CNZ) ObjPtr_LauncherSpring: dc.l Obj85 ; Spring from CNZ that you hold jump on to pull back further ObjPtr_Flipper: dc.l Obj86 ; Flipper from CNZ ObjPtr_SSNumberOfRings: dc.l Obj87 ; Number of rings in Special Stage ObjPtr_SSTailsTails: dc.l Obj88 ; Tails' tails in Special Stage ObjPtr_ARZBoss: dc.l Obj89 ; ARZ boss - dc.l Obj8A ; Sonic Team Presents/Credits (seemingly unused leftover from S1) -ObjPtr_WFZPalSwitcher: dc.l Obj8B ; Cycling palette switcher from Wing Fortress Zone + dc.l Obj_S1CreditsText ; Sonic Team Presents/Credits (seemingly unused leftover from S1) +ObjPtr_WFZPalSwitcher: dc.l Obj_WFZPalSwitcher ; Cycling palette switcher from Wing Fortress Zone ObjPtr_Whisp: dc.l Obj8C ; Whisp (blowfly badnik) from ARZ ObjPtr_GrounderInWall: dc.l Obj8D ; Grounder in wall, from ARZ ObjPtr_GrounderInWall2: dc.l Obj8D ; Obj8E = Obj8D @@ -30594,7 +30591,7 @@ DrawSprite_Loop: ; developers placed an $80 byte large spill buffer after ; 'Sprite_Table', to 'catch' the overflow. Unfortunately, this spill ; buffer is not big enough to catch all overflow: this oversight is - ; responsible for the famous 'Ashua' bug. To fix this, we'll just + ; responsible for the famous 'Ashura' bug. To fix this, we'll just ; undo this optimistaion. Sonic 3 & Knuckles undid this optimistaion ; too, but heavily optimised the rest of 'BuildSprites' to make up ; for it. @@ -45833,40 +45830,40 @@ Obj13_MapUnc_20528: include "mappings/sprite/obj13.asm" ; ---------------------------------------------------------------------------- ; Object 04 - Surface of the water - water surface ; ---------------------------------------------------------------------------- - -Obj04: +; Sprite_208DC: Obj04: +Obj_WaterSurface: moveq #0,d0 move.b routine(a0),d0 - move.w Obj04_Index(pc,d0.w),d1 - jmp Obj04_Index(pc,d1.w) -; =========================================================================== -; off_208EA: -Obj04_Index: offsetTable - offsetTableEntry.w Obj04_Init ; 0 - offsetTableEntry.w Obj04_Action ; 2 - offsetTableEntry.w Obj04_Action2 ; 4 -; =========================================================================== -; loc_208F0: Obj04_Main: -Obj04_Init: - addq.b #2,routine(a0) ; => Obj04_Action - move.l #Obj04_MapUnc_20A0E,mappings(a0) + move.w WaterSurface_Index(pc,d0.w),d1 + jmp WaterSurface_Index(pc,d1.w) +; =========================================================================== +; off_208EA: Obj04_Index: +WaterSurface_Index: offsetTable + offsetTableEntry.w WaterSurface_Init ; 0 + offsetTableEntry.w WaterSurface_Action ; 2 + offsetTableEntry.w WaterSurface_Action2 ; 4 +; =========================================================================== +; loc_208F0: Obj04_Main: Obj04_Init: +WaterSurface_Init: + addq.b #2,routine(a0) ; => WaterSurface_Action + move.l #MapUnc_WaterSurface_CPZHPZ,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_WaterSurface,0,1),art_tile(a0) jsrto JmpTo12_Adjust2PArtPointer move.b #1< Obj27_Init + move.w Explosion_Index(pc,d0.w),d1 + jmp Explosion_Index(pc,d1.w) +; =========================================================================== +; off_21096: Obj27_States: Obj27_Index: +Explosion_Index: offsetTable + offsetTableEntry.w Explosion_InitWithAnimal ; 0 + offsetTableEntry.w Explosion_Init ; 2 + offsetTableEntry.w Explosion_Main ; 4 +; =========================================================================== +; loc_2109C: Obj27_Init: Obj27_InitWithAnimal: +Explosion_InitWithAnimal: + addq.b #2,routine(a0) ; => Explosion_Init jsrto JmpTo2_AllocateObject - bne.s Obj27_Init + bne.s Explosion_Init _move.b #ObjID_Animal,id(a1) ; load obj28 (Animal and 100 points) move.w x_pos(a0),x_pos(a1) move.w y_pos(a0),y_pos(a1) move.w objoff_3E(a0),objoff_3E(a1) ; Set by Touch_KillEnemy - -; loc_210BE: Obj27_Init2: -Obj27_Init: - addq.b #2,routine(a0) ; => Obj27_Main - move.l #Obj27_MapUnc_21120,mappings(a0) +; loc_210BE: Obj27_Init2: Obj27_Init: +Explosion_Init: + addq.b #2,routine(a0) ; => Explosion_Main + move.l #MapUnc_Explosion,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Explosion,0,0),art_tile(a0) jsrto JmpTo12_Adjust2PArtPointer move.b #1< Obj84_MainX +; loc_21176: Obj84_Init: +PinballMode_Init: + addq.b #2,routine(a0) ; => PinballMode_MainX move.l #MapUnc_PlaneSwitcher,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Ring,0,0),art_tile(a0) jsrto JmpTo12_Adjust2PArtPointer @@ -46338,8 +46337,8 @@ Obj84_Init: move.b #5,priority(a0) move.b subtype(a0),d0 btst #2,d0 - beq.s Obj84_Init_CheckX - addq.b #2,routine(a0) ; => Obj84_MainY + beq.s PinballMode_Init_CheckX + addq.b #2,routine(a0) ; => PinballMode_MainY andi.w #7,d0 move.b d0,mapping_frame(a0) andi.w #3,d0 @@ -46356,7 +46355,7 @@ Obj84_Init: bhs.s + move.b #1,objoff_35(a0) + - bra.w Obj84_MainY + bra.w PinballMode_MainY ; =========================================================================== word_211E8: dc.w $20 @@ -46364,8 +46363,8 @@ word_211E8: dc.w $80 ; 2 dc.w $100 ; 3 ; =========================================================================== -; loc_211F0: -Obj84_Init_CheckX: +; loc_211F0: Obj84_Init_CheckX: +PinballMode_Init_CheckX: andi.w #3,d0 move.b d0,mapping_frame(a0) add.w d0,d0 @@ -46378,12 +46377,10 @@ Obj84_Init_CheckX: + lea (Sidekick).w,a1 ; a1=character cmp.w x_pos(a1),d1 - bhs.s Obj84_MainX + bhs.s PinballMode_MainX move.b #1,objoff_35(a0) - -; loc_21224: -Obj84_MainX: - +; loc_21224: Obj84_MainX: +PinballMode_MainX: tst.w (Debug_placement_mode).w bne.s return_21284 move.w x_pos(a0),d1 @@ -46395,7 +46392,7 @@ Obj84_MainX: beq.s return_21284 + tst.b (a2)+ - bne.s Obj84_MainX_Alt + bne.s PinballMode_MainX_Alt cmp.w x_pos(a1),d1 bhi.s return_21284 move.b #1,-1(a2) @@ -46419,8 +46416,8 @@ Obj84_MainX: return_21284: rts ; =========================================================================== -; loc_21286: -Obj84_MainX_Alt: +; loc_21286: Obj84_MainX_Alt: +PinballMode_MainX_Alt: cmp.w x_pos(a1),d1 bls.s return_21284 move.b #0,-1(a2) @@ -46458,9 +46455,8 @@ loc_212C4: rts ; =========================================================================== -; loc_212F6: -Obj84_MainY: - +; loc_212F6: Obj84_MainY: +PinballMode_MainY: tst.w (Debug_placement_mode).w bne.s return_21350 move.w y_pos(a0),d1 @@ -46476,7 +46472,7 @@ Obj84_MainY: endif + tst.b (a2)+ - bne.s Obj84_MainY_Alt + bne.s PinballMode_MainY_Alt cmp.w y_pos(a1),d1 bhi.s return_21350 move.b #1,-1(a2) @@ -46500,8 +46496,8 @@ Obj84_MainY: return_21350: rts ; =========================================================================== -; loc_21352: -Obj84_MainY_Alt: +; loc_21352: Obj84_MainY_Alt: +PinballMode_MainY_Alt: cmp.w y_pos(a1),d1 bls.s return_21350 move.b #0,-1(a2) @@ -46523,25 +46519,22 @@ Obj84_MainY_Alt: + move.b #0,pinball_mode(a1) rts - - - ; =========================================================================== ; --------------------------------------------------------------------------- ; Object 8B - Cycling palette switcher from Wing Fortress Zone ; --------------------------------------------------------------------------- -; Sprite_21392: -Obj8B: +; Sprite_21392: Obj8B: +Obj_WFZPalSwitcher: moveq #0,d0 move.b routine(a0),d0 - move.w Obj8B_Index(pc,d0.w),d1 - jsr Obj8B_Index(pc,d1.w) + move.w WFZPalSwitcher_Index(pc,d0.w),d1 + jsr WFZPalSwitcher_Index(pc,d1.w) jmp (MarkObjGone3).l ; =========================================================================== -; off_213A6: -Obj8B_Index: offsetTable - offsetTableEntry.w Obj8B_Init ; 0 - offsetTableEntry.w Obj8B_Main ; 2 +; off_213A6: Obj8B_Index: +WFZPalSwitcher_Index: offsetTable + offsetTableEntry.w WFZPalSwitcher_Init ; 0 + offsetTableEntry.w WFZPalSwitcher_Main ; 2 ; =========================================================================== word_213AA: dc.w $20 @@ -46549,8 +46542,8 @@ word_213AA: dc.w $80 ; 2 dc.w $100 ; 3 ; =========================================================================== -; loc_213B2: -Obj8B_Init: +; loc_213B2: Obj8B_Init: +WFZPalSwitcher_Init: addq.b #2,routine(a0) move.l #MapUnc_PlaneSwitcher,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_Ring,0,0),art_tile(a0) @@ -46572,10 +46565,10 @@ Obj8B_Init: loc_21402: lea (Sidekick).w,a1 ; a1=character cmp.w x_pos(a1),d1 - bhs.s Obj8B_Main + bhs.s WFZPalSwitcher_Main move.b #1,objoff_35(a0) -; loc_21412: -Obj8B_Main: +; loc_21412: Obj8B_Main: +WFZPalSwitcher_Main: tst.w (Debug_placement_mode).w bne.s return_2146A move.w x_pos(a0),d1 @@ -46636,9 +46629,6 @@ loc_2146C: jmpTos JmpTo10_DisplaySprite,JmpTo18_DeleteObject,JmpTo2_AllocateObject,JmpTo12_Adjust2PArtPointer - - - ; =========================================================================== ; ---------------------------------------------------------------------------- ; Object 06 - Rotating cylinder in MTZ, twisting spiral pathway in EHZ @@ -80684,7 +80674,7 @@ ObjC3_Main: ; =========================================================================== ; off_3C438: ObjC3_SubObjData: - subObjData Obj27_MapUnc_21120,make_art_tile(ArtTile_ArtNem_Explosion,0,0),1<