Actions

SCHG How-to

Difference between revisions of "Modify Transformation Behavior in Sonic 2"

From Sonic Retro

(Added a fix by RHS to the guide)
m (Text replacement - "\[\[Category:SCHG How-tos.*" to "")
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
(Original guide by [[Vladikcomper]])
+
(Original guide by [[User:Vladikcomper|vladikcomper]])
(Addition by [[redhotsonic]])
+
(Addition by [[User:Redhotsonic|redhotsonic]])
  
 
One stark contrast between Sonic 2 and Sonic 3 is the transformation behavior of one Sonic the Hedgehog. Sonic 2 introduced Super Sonic, and used the simple method of jumping to transform. This made it quick and easy to transform, but it doesn't allow for an option of when to transform. If you had 50+ rings and didn't want to transform, you'd have to avoid jumping, or lose your rings. Many would argue that Sonic 3 really got it right (While I wouldn't be one of those people... I don't think either game really perfected it, but anyway...), as Sonic 3 allows for free will transformation by requiring a double jump to transform. The only real downside to this method is that if you have a desire/need to use your double jump abilities, and you have 50+ rings, you can't use them... you would transform instead.
 
One stark contrast between Sonic 2 and Sonic 3 is the transformation behavior of one Sonic the Hedgehog. Sonic 2 introduced Super Sonic, and used the simple method of jumping to transform. This made it quick and easy to transform, but it doesn't allow for an option of when to transform. If you had 50+ rings and didn't want to transform, you'd have to avoid jumping, or lose your rings. Many would argue that Sonic 3 really got it right (While I wouldn't be one of those people... I don't think either game really perfected it, but anyway...), as Sonic 3 allows for free will transformation by requiring a double jump to transform. The only real downside to this method is that if you have a desire/need to use your double jump abilities, and you have 50+ rings, you can't use them... you would transform instead.
Line 11: Line 11:
  
 
The first thing you do is locate the label Sonic_JumpHeight. You should see something like this:
 
The first thing you do is locate the label Sonic_JumpHeight. You should see something like this:
<asm>
+
<syntaxhighlight lang="asm">
 
; loc_1AAF0:
 
; loc_1AAF0:
 
Sonic_JumpHeight:
 
Sonic_JumpHeight:
Line 32: Line 32:
 
         beq.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         beq.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
 
Replace this:
 
Replace this:
<asm>
+
<syntaxhighlight lang="asm">
 
         tst.b  y_vel(a0)              ; is Sonic exactly at the height of his jump?
 
         tst.b  y_vel(a0)              ; is Sonic exactly at the height of his jump?
 
         beq.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         beq.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
  
 
with this:
 
with this:
<asm>
+
<syntaxhighlight lang="asm">
 
         move.b  (Ctrl_1_Press_Logical).w,d0
 
         move.b  (Ctrl_1_Press_Logical).w,d0
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
 
That's it! Now you can make Sonic transform at will just like in Sonic 3.
 
That's it! Now you can make Sonic transform at will just like in Sonic 3.
Line 57: Line 57:
  
 
Go to Sonic_JumpHeight and replace this:
 
Go to Sonic_JumpHeight and replace this:
<asm>
+
<syntaxhighlight lang="asm">
 
         tst.b  y_vel(a0)              ; is Sonic exactly at the height of his jump?
 
         tst.b  y_vel(a0)              ; is Sonic exactly at the height of his jump?
 
         beq.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         beq.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
 
with this:
 
with this:
<asm>
+
<syntaxhighlight lang="asm">
 
         move.b  (Ctrl_1_Press_Logical).w,d0
 
         move.b  (Ctrl_1_Press_Logical).w,d0
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
 
Go to '''Sonic_CheckGoSuper''' and replace:
 
Go to '''Sonic_CheckGoSuper''' and replace:
<asm>
+
<syntaxhighlight lang="asm">
 
         tst.b (Super_Sonic_flag).w ; is Sonic already Super?
 
         tst.b (Super_Sonic_flag).w ; is Sonic already Super?
 
beq.s return_1ABA4 ; if yes, branch
 
beq.s return_1ABA4 ; if yes, branch
</asm>
+
</syntaxhighlight>
  
 
with this:
 
with this:
<asm>
+
<syntaxhighlight lang="asm">
 
         tst.b (Super_Sonic_flag).w ; is Sonic already Super?
 
         tst.b (Super_Sonic_flag).w ; is Sonic already Super?
 
bne.w Sonic_RevertToNormal ; if yes, branch (This allows for reverting manually)
 
bne.w Sonic_RevertToNormal ; if yes, branch (This allows for reverting manually)
</asm>
+
</syntaxhighlight>
  
 
That's it. Now you can cancel out Super Sonic at any time without having to wait for your rings to run out.
 
That's it. Now you can cancel out Super Sonic at any time without having to wait for your rings to run out.
Line 89: Line 89:
 
You can also use just one button to make Sonic transform and cancel out by replacing this in each step:
 
You can also use just one button to make Sonic transform and cancel out by replacing this in each step:
  
<asm>
+
<syntaxhighlight lang="asm">
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
</asm>
+
</syntaxhighlight>
  
 
With one of these:
 
With one of these:
<asm>
+
<syntaxhighlight lang="asm">
 
         andi.b  #button_A_mask,d0
 
         andi.b  #button_A_mask,d0
 
         andi.b  #button_B_mask,d0
 
         andi.b  #button_B_mask,d0
 
         andi.b  #button_C_mask,d0
 
         andi.b  #button_C_mask,d0
</asm>
+
</syntaxhighlight>
  
 
==Fixing bugs==
 
==Fixing bugs==
Now, everything should be all well and good. But there are few bugs:
+
Now, everything should be all well and good. But there are few bugs:<br>
1) Sonic's transformation palette bug.
+
1) Sonic's transformation palette bug.<br>
2) Sonic freezing in air after revert to normal bug.
+
2) Sonic freezing in air after revert to normal bug.<br>
3) A bug involving the [[Wing Fortress Zone]] cutscene.
+
3) A bug involving the [[Wing Fortress Zone]] cutscene.<br>
 
They are much easier to fix, so let's fix them.
 
They are much easier to fix, so let's fix them.
  
Line 114: Line 114:
  
 
In the beginning of Sonic_RevertToNormal add:
 
In the beginning of Sonic_RevertToNormal add:
<asm>
+
<syntaxhighlight lang="asm">
 
move.b #0,(MainCharacter+obj_control).w ; restore Sonic's movement
 
move.b #0,(MainCharacter+obj_control).w ; restore Sonic's movement
</asm>
+
</syntaxhighlight>
  
 
Everything should run smoothly now! Now about the last one...
 
Everything should run smoothly now! Now about the last one...
Line 125: Line 125:
  
 
With your new super code you made, at "Sonic_JumpHeight:" change this:
 
With your new super code you made, at "Sonic_JumpHeight:" change this:
<asm>
+
<syntaxhighlight lang="asm">
 
         move.b  (Ctrl_1_Press_Logical).w,d0
 
         move.b  (Ctrl_1_Press_Logical).w,d0
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
 
To this:
 
To this:
<asm>
+
<syntaxhighlight lang="asm">
 
         tst.b  (Control_Locked).w      ; Are Controls locked?
 
         tst.b  (Control_Locked).w      ; Are Controls locked?
 
         bne.s  return_1AB36            ; If so, branch, and do not bother with Super code
 
         bne.s  return_1AB36            ; If so, branch, and do not bother with Super code
Line 140: Line 140:
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         bne.s  Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
 
         rts
 
         rts
</asm>
+
</syntaxhighlight>
  
 
Now, whenever controls are locked, Sonic will NOT go super, thus circumventing the issue.
 
Now, whenever controls are locked, Sonic will NOT go super, thus circumventing the issue.
  
 
{{S2Howtos}}
 
{{S2Howtos}}
[[Category:SCHG How-tos|{{PAGENAME}}]]
+
|{{PAGENAME}}]]

Latest revision as of 10:50, 25 August 2018

(Original guide by vladikcomper) (Addition by redhotsonic)

One stark contrast between Sonic 2 and Sonic 3 is the transformation behavior of one Sonic the Hedgehog. Sonic 2 introduced Super Sonic, and used the simple method of jumping to transform. This made it quick and easy to transform, but it doesn't allow for an option of when to transform. If you had 50+ rings and didn't want to transform, you'd have to avoid jumping, or lose your rings. Many would argue that Sonic 3 really got it right (While I wouldn't be one of those people... I don't think either game really perfected it, but anyway...), as Sonic 3 allows for free will transformation by requiring a double jump to transform. The only real downside to this method is that if you have a desire/need to use your double jump abilities, and you have 50+ rings, you can't use them... you would transform instead.

Now, Sonic 2 doesn't have double jump abilities, so we don't need to worry about that. So, why not make transformation a double jump ability?

Applying the change

Part 1

The first thing you do is locate the label Sonic_JumpHeight. You should see something like this:

; loc_1AAF0:
Sonic_JumpHeight:
        tst.b   jumping(a0)     ; is Sonic jumping?
        beq.s   Sonic_UpVelCap  ; if not, branch

        move.w  #-$400,d1
        btst    #6,status(a0)   ; is Sonic underwater?
        beq.s   +               ; if not, branch
        move.w  #-$200,d1
+
        cmp.w   y_vel(a0),d1    ; is Sonic going up faster than d1?
        ble.s   +               ; if not, branch
        move.b  (Ctrl_1_Held_Logical).w,d0
        andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
        bne.s   +               ; if yes, branch
        move.w  d1,y_vel(a0)    ; immediately reduce Sonic's upward speed to d1
+
        tst.b   y_vel(a0)               ; is Sonic exactly at the height of his jump?
        beq.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts

Replace this:

        tst.b   y_vel(a0)               ; is Sonic exactly at the height of his jump?
        beq.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts


with this:

        move.b  (Ctrl_1_Press_Logical).w,d0
        andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
        bne.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts

That's it! Now you can make Sonic transform at will just like in Sonic 3.

Part 2

Now, as previously mentioned, I stated that I didn't think that either game did transformations correctly. Why is that? Well, at those times when you are low on rings, what if you want to cancel out of your Super Sonic form? There is also a fix for that.

Go to Sonic_JumpHeight and replace this:

        tst.b   y_vel(a0)               ; is Sonic exactly at the height of his jump?
        beq.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts

with this:

        move.b  (Ctrl_1_Press_Logical).w,d0
        andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
        bne.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts

Go to Sonic_CheckGoSuper and replace:

        tst.b	(Super_Sonic_flag).w	; is Sonic already Super?
	beq.s	return_1ABA4		; if yes, branch

with this:

        tst.b	(Super_Sonic_flag).w	; is Sonic already Super?
	bne.w	Sonic_RevertToNormal	; if yes, branch (This allows for reverting manually)

That's it. Now you can cancel out Super Sonic at any time without having to wait for your rings to run out.

Extra Option

You can also use just one button to make Sonic transform and cancel out by replacing this in each step:

        andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?

With one of these:

        andi.b  #button_A_mask,d0
        andi.b  #button_B_mask,d0
        andi.b  #button_C_mask,d0

Fixing bugs

Now, everything should be all well and good. But there are few bugs:
1) Sonic's transformation palette bug.
2) Sonic freezing in air after revert to normal bug.
3) A bug involving the Wing Fortress Zone cutscene.
They are much easier to fix, so let's fix them.

Transformation palette bug

Fixing this bug has already been documented in the guide, but it doesn't hurt to mention it here, as you are more likely to run into this bug after implementing this design change. For reference, follow this guide!

Freezing in air after reverting bug

It happens when Sonic has to revert from transformation instantly. The controls are looked when the transformation starts until a certain moment (controlled by PalCycle_SuperSonic routine), and the routine that reverts Sonic to normal doesn't bother to unlock the controls.

In the beginning of Sonic_RevertToNormal add:

	move.b	#0,(MainCharacter+obj_control).w	; restore Sonic's movement

Everything should run smoothly now! Now about the last one...

WFZ cutscene glitch

There is actually one major problem with the code. If you have more than 50 rings at the end of Wing Fortress Zone, Sonic will transform and revert multiple times when he jumps for the Tornado and fall to his death. There is a very simple fix for this. You CANNOT control Sonic at this point; his controls are locked. So, why not do this?

With your new super code you made, at "Sonic_JumpHeight:" change this:

        move.b  (Ctrl_1_Press_Logical).w,d0
        andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
        bne.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts

To this:

        tst.b   (Control_Locked).w      ; Are Controls locked?
        bne.s   return_1AB36            ; If so, branch, and do not bother with Super code
        move.b  (Ctrl_1_Press_Logical).w,d0
        andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
        bne.s   Sonic_CheckGoSuper      ; if yes, test for turning into Super Sonic
        rts

Now, whenever controls are locked, Sonic will NOT go super, thus circumventing the issue.

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

|Modify Transformation Behavior in Sonic 2]]