Actions

SCHG How-to

Difference between revisions of "Edit the Level Order in Sonic 2 with ASM"

From Sonic Retro

(Adding in some extra notes related to SCZ, WFZ, and DEZ.)
m (Text replacement - "\[\[Category:SCHG How-tos.*" to "")
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Editing level order for S2 in ASM (Guide by Malevolence)
+
{{GuideBy|Malevolence|Metal_Man88}}
  
Well, since a few people have been asking me lately how to edit the level order in ASM, I figure I might as well created a document which may be able to help some of you out there.
+
Well, since a few people have been asking me lately how to edit the level order in ASM, I figure I might as well create a document which may be able to help some of you out there.
  
First of all, open your asm files and search for Main game level order. For this part, you'll have to know what each zone's ID is, here's a chart:
+
First of all, open '''s2.asm''' and search for ''Main game level order''. For this part, you'll have to know what each zone's ID is, here's a chart:
  
<z80>$0-Emerald Hill Zone
+
<pre>$0-Emerald Hill Zone
 
$1-Unused
 
$1-Unused
$2-Unused ([[Wood Zone]] in Beta)
+
$2-Unused (Wood Zone in Beta)
 
$3-Unused
 
$3-Unused
 
$4-Metropolis Zone acts 1 and 2
 
$4-Metropolis Zone acts 1 and 2
Line 22: Line 22:
 
$F-Aquatic Ruin Zone
 
$F-Aquatic Ruin Zone
 
$10-Sky Chase Zone
 
$10-Sky Chase Zone
And $FFFF is the ending</z80>
+
And $FFFF is the ending</pre>
  
 
Okay, so, now go to the main game level order. The zones go in the order above, and there are two acts for every zone. Each act tells which act and zone to go to next. For the first one you have dc.w 1. Think of it as 001. Since this is in Emerald Hill Zone's (act 1) spot, it's telling it where to go after Emerald Hill Zone act 1. 0 is the zone to go to (Emerald Hill Zone) and 01 is the act (act 2). Here is a list of the order with comments of where to go to:
 
Okay, so, now go to the main game level order. The zones go in the order above, and there are two acts for every zone. Each act tells which act and zone to go to next. For the first one you have dc.w 1. Think of it as 001. Since this is in Emerald Hill Zone's (act 1) spot, it's telling it where to go after Emerald Hill Zone act 1. 0 is the zone to go to (Emerald Hill Zone) and 01 is the act (act 2). Here is a list of the order with comments of where to go to:
  
<z80> dc.w 1 ; Emerald Hill Zone act 1 to Emerald Hill Zone (0) act 2 (01)  
+
<syntaxhighlight lang="asm"> dc.w 1 ; Emerald Hill Zone act 1 to Emerald Hill Zone (0) act 2 (01)  
 
dc.w  $D00 ; 1 ; Emerald Hill Zone act 2 to Chemical Plant Zone (D) act 1 (00)
 
dc.w  $D00 ; 1 ; Emerald Hill Zone act 2 to Chemical Plant Zone (D) act 1 (00)
 
dc.w 0 ; 2 ; Unused level to Emerald Hill Zone (0) act 1 (00) (it doesn't matter where it goes, you aren't playing this in the game unless you change it yourself)
 
dc.w 0 ; 2 ; Unused level to Emerald Hill Zone (0) act 1 (00) (it doesn't matter where it goes, you aren't playing this in the game unless you change it yourself)
Line 59: Line 59:
 
dc.w  $C00 ; 31 ; Aquatic Ruin Zone act 2 to Casino Night Zone (C) act 1 (00)
 
dc.w  $C00 ; 31 ; Aquatic Ruin Zone act 2 to Casino Night Zone (C) act 1 (00)
 
dc.w  $600 ; 32 ; Sky Chase Zone act 1 to Wing Fortress Zone (6) act 1 (00)
 
dc.w  $600 ; 32 ; Sky Chase Zone act 1 to Wing Fortress Zone (6) act 1 (00)
dc.w 0 ; 33  ; Sky Chase Zone act 2 (unused) to Emerald Hill Zone (0) act 1 (00)</z80>
+
dc.w 0 ; 33  ; Sky Chase Zone act 2 (unused) to Emerald Hill Zone (0) act 1 (00)</syntaxhighlight>
 
It's as simple as that, for all zones except for SCZ, WFZ, and DEZ, which will be noted later. Otherwise... if you wanted to change something, let's say CPZ act 2 to WFZ act 1, you go to where CPZ act 2 is ($D-CPZ, $D in decimal=13, 13x2=26 (because there are two acts) and then go down one more because it's the second act, so 27) then change $F00 (ARZ normally) to $600, and it'll go to WFZ.  
 
It's as simple as that, for all zones except for SCZ, WFZ, and DEZ, which will be noted later. Otherwise... if you wanted to change something, let's say CPZ act 2 to WFZ act 1, you go to where CPZ act 2 is ($D-CPZ, $D in decimal=13, 13x2=26 (because there are two acts) and then go down one more because it's the second act, so 27) then change $F00 (ARZ normally) to $600, and it'll go to WFZ.  
  
If you are trying to change where SCZ, WFZ, or DEZ head to, you must do more than simply edit this list. Thankfully, the places to edit are in fairly intuitive places. Search your asm file for "loc_3A88E:" (without quotes); you'll see a move.w #$600,(Current_ZoneAndAct).w . Change the $600 to whatever zone you wish it to go to. For WFZ, the procedure is mostly the same, only you go to "loc_3AC40:" (again, without quotes) and change the move.w #$E00,(Current_ZoneAndAct).w thing's $#E00 to whatever act you want it to go to.
+
If you are trying to change where SCZ, WFZ, or DEZ head to, you must do more than simply edit this list. Thankfully, the places to edit are in fairly intuitive places. Search your asm file for '''loc_3A88E:'''; you'll see a move.w #$600,(Current_ZoneAndAct).w . Change the $600 to whatever zone you wish it to go to. For WFZ, the procedure is mostly the same, only you go to '''loc_3AC40:''' and change the move.w #$E00,(Current_ZoneAndAct).w thing's $#E00 to whatever act you want it to go to.
  
 
If you wish to change where Death Egg goes to, you must do a little bit more work, because it actually calls the ending and more from an object. Find "loc_3D9F2:" and notice the line which has the comment "=> EndingSequence" next to it. This "move.b #$20,(Game_Mode).w" will cause problems for you if left in as-is; but it can be easily fixed. Simply change the $20 to $C, which will cause it to re-assert the 'Zone play mode', since the game isn't going to end yet. Next, you'll need to add in a line; which changes the zone. Specifically, "move.w #$600,(Current_ZoneAndAct).w", where #$600 leads to whatever act you want. ($600 leads to Wing Fortress zone.) Because this is more complex, I have an example of the finished product.
 
If you wish to change where Death Egg goes to, you must do a little bit more work, because it actually calls the ending and more from an object. Find "loc_3D9F2:" and notice the line which has the comment "=> EndingSequence" next to it. This "move.b #$20,(Game_Mode).w" will cause problems for you if left in as-is; but it can be easily fixed. Simply change the $20 to $C, which will cause it to re-assert the 'Zone play mode', since the game isn't going to end yet. Next, you'll need to add in a line; which changes the zone. Specifically, "move.w #$600,(Current_ZoneAndAct).w", where #$600 leads to whatever act you want. ($600 leads to Wing Fortress zone.) Because this is more complex, I have an example of the finished product.
  
<z80> move.b #$C,(Game_Mode).w ; => EndingSequence is averted
+
<syntaxhighlight lang="asm"> move.b #$C,(Game_Mode).w ; => EndingSequence is averted
 
bsr.w loc_3AC46
 
bsr.w loc_3AC46
 
move.w #$600,(Current_ZoneAndAct).w ; Moves to Wing Fortress Zone
 
move.w #$600,(Current_ZoneAndAct).w ; Moves to Wing Fortress Zone
bra.w JmpTo65_DeleteObject</z80>
+
bra.w JmpTo65_DeleteObject</syntaxhighlight>
  
 
If all goes well, you should be able to redirect even this zone to wherever you want.
 
If all goes well, you should be able to redirect even this zone to wherever you want.
Line 76: Line 76:
  
  
[[Category:SCHG How-tos|Edit the Level Order in Sonic 2 with ASM]]
+
{{S2Howtos}}
 +
|Edit the Level Order in Sonic 2 with ASM]]

Latest revision as of 10:50, 25 August 2018

(Original guide by Malevolence and Metal_Man88)

Well, since a few people have been asking me lately how to edit the level order in ASM, I figure I might as well create a document which may be able to help some of you out there.

First of all, open s2.asm and search for Main game level order. For this part, you'll have to know what each zone's ID is, here's a chart:

$0-Emerald Hill Zone
$1-Unused
$2-Unused (Wood Zone in Beta)
$3-Unused
$4-Metropolis Zone acts 1 and 2
$5-Metropolis Zone acts 3 and 4 (4 is unused)
$6-Wing Fortress Zone
$7-Hill Top Zone
$8-Unused (Hidden Palace in Beta)
$9-Unused
$A-Oil Ocean Zone
$B-Mystic Cave Zone
$C-Casino Night Zone
$D-Chemical Plant Zone
$E-Death Egg Zone 
$F-Aquatic Ruin Zone
$10-Sky Chase Zone
And $FFFF is the ending

Okay, so, now go to the main game level order. The zones go in the order above, and there are two acts for every zone. Each act tells which act and zone to go to next. For the first one you have dc.w 1. Think of it as 001. Since this is in Emerald Hill Zone's (act 1) spot, it's telling it where to go after Emerald Hill Zone act 1. 0 is the zone to go to (Emerald Hill Zone) and 01 is the act (act 2). Here is a list of the order with comments of where to go to:

	dc.w	 1		; Emerald Hill Zone act 1 to Emerald Hill Zone (0) act 2 (01) 
	dc.w  $D00	; 1	; Emerald Hill Zone act 2 to Chemical Plant Zone (D) act 1 (00)
	dc.w	 0	; 2	; Unused level to Emerald Hill Zone (0) act 1 (00) (it doesn't matter where it goes, you aren't playing this in the game unless you change it yourself)
	dc.w	 0	; 3	; Unused level to Emerald Hill Zone (0) act 1 (00) 
	dc.w  $201	; 4	; Unused level (was Wood Zone act 1) to Unused level (Wood Zone) (2) act 2 (01)
	dc.w  $400	; 5	; Unused level (was Wood zone act 2) to Metropolis Zone (4) act 1 (00) 
	dc.w	 0	; 6	; Unused level to Emerald Hill Zone (0) act 1 (00)
	dc.w	 0	; 7	; Unused level to Emerald Hill Zone (0) act 1 (00)
	dc.w  $401	; 8	; Metropolis Zone act 1 to Metropolis Zone (4) act 2 (01)
	dc.w  $500	; 9	; Metropolis Zone act 2 to Metropolis Zone (now 5, act 3 uses a different ID because there are two acts per zone ID) act 3 (00, uses a new zone ID, so it's the first act)
	dc.w $1000	; 10	; Metropolis Zone act 3 to SCZ (10) act 1 (00)
	dc.w	 0	; 11	; Metropolis Zone act 4 (unused) to Emerald Hill Zone (0) act 1 (00)
	dc.w  $E00	; 12	; Wing Fortress Zone act 1 to Death Egg Zone (E) act 1 (00)
	dc.w	 0	; 13	; Wing Fortress Zone act 2 (unused) to Emerald Hill Zone (0) act 1 (00)
	dc.w  $701	; 14	; Hill Top Zone act 1 to Hill Top Zone (7) act 2 (01)
	dc.w  $B00	; 15	; Hill Top Zone act 2 to Mystic Cave Zone (B) act 1 (00)
	dc.w  $801	; 16	; Unused level (was Hidden Palace Zone act 1) to Unused level (Hidden Palace Zone) (2) act 2 (01)
	dc.w  $A00	; 17	; Unused level (was Hidden Palace Zone act 2) to Oil Ocean Zone (A) act 1 (00) 
	dc.w	 0	; 18	; Unused level to Emerald Hill Zone (0) act 1 (00)
	dc.w	 0	; 19	; Unused level to Emerald Hill Zone (0) act 1 (00)
	dc.w  $A01	; 20	; Oil Ocean Zone act 1 to Oil Ocean Zone (A) act 2 (01)
	dc.w  $400	; 21	; Oil Ocean Zone act 2 to Metropolis Zone (4) act 1 (00)
	dc.w  $B01	; 22	; Mystic Cave Zone act 1 to Mystic Cave Zone (B) act 2 (01)
	dc.w  $A00	; 23	; Mystic Cave Zone act 2 to Oil Ocean Zone (A) act 1 (00)
	dc.w  $C01	; 24	; Casino Night Zone act 1 to Casino Night Zone (C) act 2 (01)
	dc.w  $700	; 25	; Casino Night Zone act 2 to Hill Top Zone (7) act 1 (00)
	dc.w  $D01	; 26	; Chemical Plant Zone act 1 to Chemical Plant Zone (D) act 2 (01)
	dc.w  $F00	; 27	; Chemical Plant Zone act 2 to Aquatic Ruin Zone (F) act 1 (00)
	dc.w $FFFF	; 28	; Death Egg Zone act 1 to the ending (FFFF)
	dc.w	 0	; 29	; Death Egg Zone act 2 (unused) to Emerald Hill Zone (0) act 1 (00)
	dc.w  $F01	; 30	; Aquatic Ruin Zone act 1 to Aquatic Ruin Zone (F) act 2 (01)
	dc.w  $C00	; 31	; Aquatic Ruin Zone act 2 to Casino Night Zone (C) act 1 (00)
	dc.w  $600	; 32	; Sky Chase Zone act 1 to Wing Fortress Zone (6) act 1 (00)
	dc.w	 0	; 33  	; Sky Chase Zone act 2 (unused) to Emerald Hill Zone (0) act 1 (00)

It's as simple as that, for all zones except for SCZ, WFZ, and DEZ, which will be noted later. Otherwise... if you wanted to change something, let's say CPZ act 2 to WFZ act 1, you go to where CPZ act 2 is ($D-CPZ, $D in decimal=13, 13x2=26 (because there are two acts) and then go down one more because it's the second act, so 27) then change $F00 (ARZ normally) to $600, and it'll go to WFZ.

If you are trying to change where SCZ, WFZ, or DEZ head to, you must do more than simply edit this list. Thankfully, the places to edit are in fairly intuitive places. Search your asm file for loc_3A88E:; you'll see a move.w #$600,(Current_ZoneAndAct).w . Change the $600 to whatever zone you wish it to go to. For WFZ, the procedure is mostly the same, only you go to loc_3AC40: and change the move.w #$E00,(Current_ZoneAndAct).w thing's $#E00 to whatever act you want it to go to.

If you wish to change where Death Egg goes to, you must do a little bit more work, because it actually calls the ending and more from an object. Find "loc_3D9F2:" and notice the line which has the comment "=> EndingSequence" next to it. This "move.b #$20,(Game_Mode).w" will cause problems for you if left in as-is; but it can be easily fixed. Simply change the $20 to $C, which will cause it to re-assert the 'Zone play mode', since the game isn't going to end yet. Next, you'll need to add in a line; which changes the zone. Specifically, "move.w #$600,(Current_ZoneAndAct).w", where #$600 leads to whatever act you want. ($600 leads to Wing Fortress zone.) Because this is more complex, I have an example of the finished product.

	move.b	#$C,(Game_Mode).w ; => EndingSequence is averted
	bsr.w	loc_3AC46
	move.w	#$600,(Current_ZoneAndAct).w	; Moves to Wing Fortress Zone
	bra.w	JmpTo65_DeleteObject

If all goes well, you should be able to redirect even this zone to wherever you want.

If you have any questions or comments, feel free to contact me.


SCHG How-To Guide: Sonic the Hedgehog 2 (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix Super Sonic Bugs | Use Correct Height When Roll Jumping | Fix Jump Height Bug When Exiting Water | Fix Screen Boundary Spin Dash Bug | Correct Drowning Bugs | Fix Camera Y Position for Tails | Fix Tails Subanimation Error | Fix Tails' Respawn Speeds | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix Rexon Crash | Fix Monitor Collision Bug | Fix EHZ Deformation Bug | Correct CPZ Boss Attack Behavior | Fix Bug in ARZ Boss Arrow's Platform Behavior | Fix ARZ Boss Walking on Air Glitch | Fix ARZ Boss Sprite Behavior | Fix Multiple CNZ Boss Bugs | Fix HTZ Background Scrolling Mountains | Fix OOZ Launcher Speed Up Glitch | Fix DEZ Giant Mech Collision Glitch | Fix Boss Deconstruction Behavior | Fix Speed Bugs | Fix 14 Continues Cheat | Fix Debug Mode Crash | Fix 99+ Lives | Fix Sonic 2's Sega Screen
Design Choices
Remove the Air Speed Cap | Disable Floor Collision While Dying | Modify Super Sonic Transformation Methods & Behavior | Enable/Disable Tails in Certain Levels | Collide with Water After Being Hurt | Retain Rings When Returning at a Star Post | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Insert LZ Water Ripple Effect | Restore Lost CPZ Boss Feature | Prevent SCZ Tornado Spin Dash Death | Improve ObjectMove Subroutines | Port S3K Rings Manager | Port S3K Object Manager | Port S3K Priority Manager | Edit Level Order with ASM‎ | Alter Ring Requirements in Special Stages | Make Special Stage Characters Use Normal DPLCs | Speed Up Ring Loss Process | Change spike behaviour in Sonic 2
Adding Features
Create Insta-kill and High Jump Monitors | Create Clone and Special Stage Monitors | Port Knuckles
Sound Features
Expand Music Index to Start at $00 | Port Sonic 1 Sound Driver | Port Sonic 2 Clone Driver | Port Sonic 3 Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Expand the Music Index to Start at $00 (Sonic 2 Clone Driver Version) | Play Different Songs Per Act
Extending the Game
Extend the Level Index Past $10 | Extend the Level Select | Extend Water Tables | Add Extra Characters | Free Up 2 Universal SSTs

|Edit the Level Order in Sonic 2 with ASM]]