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:
SVN/Hg users, the label is "Obj51_Init:", and the line being searched for is this:
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..."