Actions

SCHG How-to

Modify Transformation Behavior in Sonic 2

From Sonic Retro

Revision as of 02:41, 26 June 2012 by KingofHarts (talk | contribs) (minor edits)

(Original guide by Vladikcomper & Machenstein)

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: <asm>

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

</asm>

Replace this: <asm>

       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

</asm>


with this: <asm>

       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

</asm>

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: <asm>

       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

</asm>

with this: <asm>

       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

</asm>

Go to Sonic_CheckGoSuper and replace: <asm>

       tst.b	(Super_Sonic_flag).w	; is Sonic already Super?

beq.s return_1ABA4 ; if yes, branch </asm>

with this: <asm>

       tst.b	(Super_Sonic_flag).w	; is Sonic already Super?

bne.w Sonic_RevertToNormal ; if yes, branch (This allows for reverting manually) </asm>

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:

<asm>

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

</asm>

With one of these: <asm>

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

</asm>

Fixing bugs

Now, everything should be all well and good. But there are few bugs that original game has: 1) Sonic's transformation palette bug 2) Sonic freezing in air after revert to normal bug 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: <asm> move.b #0,(MainCharacter+obj_control).w ; restore Sonic's movement </asm>

Everything should be all well and good now!

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