Actions

SCHG How-to

Fix multiple CNZ boss bugs

From Sonic Retro

(Original guide by redhotsonic) (SVN fix by ThomasSpeedrunner)

One might not notice, but there are a handful of bugs that occur with the Casino Night Zone boss... 4 of them to be exact, and all four of them occur on the first hit:

   * After the hit, it never plays the boss hit sound.
   * Eggman's hurt face is delayed.
   * The boss flashes a hell of a lot longer.
   * Because of the 3rd bug, you cannot land a second hit for a while.

WOW! Who woulda thought? Oh well, guess we got a LOT of work to do, right? WRONG! You'd never guess... but it only takes the removal of 1 line of code to correct all of this!

Go to "loc_31904:". You should see this near the middle of the coding:

        move.b  #$80,objoff_14(a0)

SVN/Hg users, the label is "Obj51_Init:", and the line being searched for is this:

	move.b	#$80,mainspr_height(a0)

Now, delete it, and we are done! Easy, huh? ;)

"But, how can that one line cause all of those glitches?" - You asked...

redhotsonic explains: "objoff_14 is part of the countdown timer. Normally, this timer is at 0. When you hit Eggman, the countdown timer is set to $30, then starts counting down. Whilst it's counting down, Eggman will flash. You cannot hit him whilst flashing (that's NOT a bug). At "loc_31CDC", it tests objoff_14 for 0. If not equal, it will branch away. NORMALLY, when you hit Eggman, as soon as you hit him, it will set objoff_14 to $30, play the sound and display Eggman's hurt face, and then countdown from $30. But because at "loc_31904" where Eggman is being created, it has set this timer to $80. So on the first hit, it's got a lot to countdown (until it reaches 0). Because of this, he flashes for AGES. And because of this, you cannot hit him a second time for a while. Because it's $80, it cannot branch to the playsound and set objoff_14 to $30. Eventually, it's counted down to 0, then he's fine the rest of the time.

At "loc_31C92", it compares the objoff_14 at $2F. If so, branch to display Eggman's hurt face. On the first hit, because it's counting down from $80, it takes ages to $2F, and that's why Eggman has a delay on showing his hurt face on the first hit.

Because we've deleted the command, objoff_14 is already set at 0. So, it is ready for action. So now, on the first hit, he will now play the sound and set the timer to $30, he will display his hurt face immediately (because it's only a byte away), and because it's counting down from $30, he will not flash as long, and you can get back to hitting him quicker. All 4 bugs, fixed!

Why the hell they set objoff_14 to $80 when being created in the first place, I have no idea..."

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 Spin Dash Code and Add Spin Dash Speeds | 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
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 | Add beta spindash to Sonic 2 | 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
Port Sonic 1 Sound Driver | Port Sonic 2 Clone Driver | Port Sonic 3 Sound Driver | Expand the Music Index to Start at $00 (Sonic 2 Clone Driver Version)
Extending the Game
Extend the Level Index Past $10 | Extend the Level Select | Extend Water Tables | Add Extra Characters | Free Up 2 Universal SSTs