SCHG How-to

Fix the OOZ launcher speed up glitch

From Sonic Retro

Revision as of 20:29, 20 December 2015 by Scarred Sun (talk | contribs) (Text replacement - "</asm>" to "</syntaxhighlight>")

(Original guide by MoDule)

The launchers in Sonic 2's OOZ have a bug that when triggered causes Sonic to move around at twice his normal speed. It is described in more detail here. As amusing as this bug can be, it doesn't belong and this guide will show how to fix it.

Fixing the bug

Part 1

This fixes the round launcher object.

Locate the label loc_252F0. It should look like this: <asm>loc_252F0: tst.w (Debug_placement_mode).w bne.w return_253C4 move.w x_pos(a1),d0 sub.w x_pos(a0),d0 addi.w #$10,d0 cmpi.w #$20,d0 bhs.w return_253C4 move.w y_pos(a1),d1 sub.w y_pos(a0),d1 addi.w #$10,d1 cmpi.w #$20,d1 bhs.w return_253C4 cmpa.w #Sidekick,a1 bne.s + cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying beq.w return_253C4 + cmpi.b #6,routine(a1) ; is Sonic dead? </syntaxhighlight> Change the last line to this: <asm> cmpi.b #4,routine(a1) ; is Sonic hurt or dead? </syntaxhighlight> This fixes the commonly known method of triggering the bug during normal gameplay.

Optional change

There is a redundant Debug Mode check in the code at loc_252F0 below the fix in Part 1. <asm> tst.w (Debug_placement_mode).w ;<-- bne.w return_253C4 ;<-- btst #3,status(a1) beq.s +

[...] </syntaxhighlight> This can be removed. Additionally, the check for Sonic's hurt state and Tails's flying state can be move to above the collision check, like so: <asm>loc_252F0: tst.w (Debug_placement_mode).w bne.w return_253C4

cmpa.w #Sidekick,a1 bne.s + cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying beq.w return_253C4 +

cmpi.b #4,routine(a1) ; is Sonic hurt or dead? bhs.w return_253C4 ; if yes, branch

move.w x_pos(a1),d0 sub.w x_pos(a0),d0 addi.w #$10,d0 cmpi.w #$20,d0 bhs.w return_253C4 move.w y_pos(a1),d1 sub.w y_pos(a0),d1 addi.w #$10,d1 cmpi.w #$20,d1 bhs.w return_253C4

[...] </syntaxhighlight>

Part 2

This fixes the breakable block that propels Sonic into the other launcher objects.

Locate the label loc_24F84. Farther down, there should be this: <asm> cmpa.w #Sidekick,a1 bne.s loc_24FC2 cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying beq.w return_25034 </syntaxhighlight> Extend the code as follows: <asm> tst.w (Debug_placement_mode).w bne.w return_25034

cmpa.w #Sidekick,a1 bne.s + cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying beq.w return_25034 + cmpi.b #4,routine(a1) ; is Sonic hurt or dead? bhs.w return_25034 ; if yes, branch </syntaxhighlight> This adds previously missing checks for debug mode and Sonic's hurt state.

Optional change

Just as in Part 1, the modified code can be moved to just below the loc_24F84 label, above the collision check.

The bug explained

This and a few other objects in OOZ are special in that they are not immediately deleted when they go offscreen. That's because these objects need to be able to control Sonic's movement themselves.

When the player interacts with one of these objects a routine counter gets set in the object to prevent it form being deleted when it goes off screen. While the object is in a specific state it calls a routine that adds Sonic's x- and y-velocities to his position, something that Sonic normally does himself, but since Sonic is supposed to fly in a striaght line, the object needs to disable his movement. If Sonic triggers this interaction with more than one of these objects or disabling his movement for some reason doesn't happen, his horizontal and vertical speed are effectively doubled, or more.

The bug occurs when Sonic touches a launcher object while he is in his hurt state. This state is special, because it does not react to changes to Sonic's obj_control, which is used by various objects to control Sonic's movement, in this case to take away Sonic's own ability to move in the air. Because this state is not ignored after the collision check the object's routine counter gets set and Sonic's obj_control get set so to ignore movement. Now when Sonic lands on the ground during his hurt state his obj_control gets reset and his movement is restored, giving him twice his normal speed.

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