Actions

SCHG How-to

Difference between revisions of "Fix Tails' respawn speeds"

From Sonic Retro

(New bug guide from RHS... why is someone not paying me? LOL)
 
m (Changed spaces in code to tabs, minor fixes)
Line 1: Line 1:
''(Guides by [[redhotsonic]].)''
+
{{GuideBy|redhotsonic}}
  
 
Quote from ''redhotsonic'' - "The problem here is when you and Tails enter the water, your speed, acceleration and deceleration are decreased, to give you the underwater physics. The problem is, if you lose Tails when underwater, when he next respawns (in Sonic 2, he only respawns when you've come out of water), he will still have his underwater speeds. Hence why Tails suddenly cannot keep up. This bug only occurs when you lose Tails underwater, and his underwater speed will remain this way until he enters/exits water again (no matter how many times you lose him and he respawns)."
 
Quote from ''redhotsonic'' - "The problem here is when you and Tails enter the water, your speed, acceleration and deceleration are decreased, to give you the underwater physics. The problem is, if you lose Tails when underwater, when he next respawns (in Sonic 2, he only respawns when you've come out of water), he will still have his underwater speeds. Hence why Tails suddenly cannot keep up. This bug only occurs when you lose Tails underwater, and his underwater speed will remain this way until he enters/exits water again (no matter how many times you lose him and he respawns)."
Line 9: Line 9:
 
<asm>
 
<asm>
 
loc_1BC68:
 
loc_1BC68:
        lea     (Sonic_Stat_Record_Buf).w,a2
+
lea (Sonic_Stat_Record_Buf).w,a2
        move.b 2(a2,d3.w),d2
+
move.b 2(a2,d3.w),d2
        andi.b #$D2,d2
+
andi.b #$D2,d2
        bne.s   return_1BCDE
+
bne.s return_1BCDE
        or.w   d0,d1
+
or.w d0,d1
        bne.s   return_1BCDE
+
bne.s return_1BCDE
 
;      etc...
 
;      etc...
 
</asm>
 
</asm>
Line 20: Line 20:
 
Right after the 2nd "bne.s return_1BCDE" command, insert this:
 
Right after the 2nd "bne.s return_1BCDE" command, insert this:
 
<asm>
 
<asm>
        move.w #$600,(Tails_top_speed).w       ; set Tails' top speed
+
move.w #$600,(Tails_top_speed).w ; set Tails' top speed
        move.w #$C,(Tails_acceleration).w     ; set Tails' acceleration
+
move.w #$C,(Tails_acceleration).w ; set Tails' acceleration
        move.w #$80,(Tails_deceleration).w     ; set Tails' deceleration
+
move.w #$80,(Tails_deceleration).w ; set Tails' deceleration
 
</asm>
 
</asm>
  
 
So, you have something like this:
 
So, you have something like this:
 
<asm>
 
<asm>
loc_1BC68:     ; Fix for Tails' underwater respawn
+
loc_1BC68: ; Fix for Tails' underwater respawn
        lea     (Sonic_Stat_Record_Buf).w,a2
+
lea (Sonic_Stat_Record_Buf).w,a2
        move.b 2(a2,d3.w),d2
+
move.b 2(a2,d3.w),d2
        andi.b #$D2,d2
+
andi.b #$D2,d2
        bne.s   return_1BCDE
+
bne.s return_1BCDE
        or.w   d0,d1
+
or.w d0,d1
        bne.s   return_1BCDE
+
bne.s return_1BCDE
        move.w #$600,(Tails_top_speed).w       ; set Tails' top speed
+
move.w #$600,(Tails_top_speed).w ; set Tails' top speed
        move.w #$C,(Tails_acceleration).w     ; set Tails' acceleration
+
move.w #$C,(Tails_acceleration).w ; set Tails' acceleration
        move.w #$80,(Tails_deceleration).w     ; set Tails' deceleration
+
move.w #$80,(Tails_deceleration).w ; set Tails' deceleration
;       etc...
+
; etc...
 
</asm>
 
</asm>
 
Done! Now Tails' respawn speeds are fixed, and when respawning after being lost underwater, he will move and behave normally!  
 
Done! Now Tails' respawn speeds are fixed, and when respawning after being lost underwater, he will move and behave normally!  
Line 44: Line 44:
 
==Sonic 3K fix==
 
==Sonic 3K fix==
 
The bug is NOT fixed in S3K either, but to fix it, you have to do an extra check, so follow this S3K fix!
 
The bug is NOT fixed in S3K either, but to fix it, you have to do an extra check, so follow this S3K fix!
This can be done in '''SVN disassembly'''.
+
This can be done in the '''SVN disassembly'''.
  
 
Go to "loc_13CD2:" and you'll see this:
 
Go to "loc_13CD2:" and you'll see this:
 
<asm>
 
<asm>
 
loc_13CD2:
 
loc_13CD2:
                lea     (Stat_table).w,a2
+
lea (Stat_table).w,a2
                move.b 2(a2,d3.w),d2
+
move.b 2(a2,d3.w),d2
                andi.b #$80,d2
+
andi.b #$80,d2
                bne.s   loc_13D42
+
bne.s loc_13D42
                or.w   d0,d1
+
or.w d0,d1
                bne.s   loc_13D42
+
bne.s loc_13D42
;               etc...
+
; etc...
 
</asm>
 
</asm>
  
 
Right after the 2nd "bne.s loc_13D42" command, insert this:
 
Right after the 2nd "bne.s loc_13D42" command, insert this:
 
<asm>
 
<asm>
                btst   #6,$2A(a0)             ; test underwater flag
+
btst #6,$2A(a0) ; is Tails underwater?
                bne.s   +
+
bne.s .underwater ; if so, branch
                move.w #$600,($FFFFFEC0).w     ; set Tails' top speed
+
move.w #$600,($FFFFFEC0).w ; set Tails' top speed
                move.w #$C,($FFFFFEC2).w       ; set Tails' acceleration
+
move.w #$C,($FFFFFEC2).w ; set Tails' acceleration
                move.w #$80,($FFFFFEC4).w     ; set Tails' deceleration
+
move.w #$80,($FFFFFEC4).w ; set Tails' deceleration
+
+
.underwater:
 
</asm>
 
</asm>
  
 
So, you have something like this:
 
So, you have something like this:
 
<asm>
 
<asm>
loc_13CD2:             ; Fix for Tails' underwater respawn
+
loc_13CD2: ; Fix for Tails' underwater respawn
                lea     (Stat_table).w,a2
+
lea (Stat_table).w,a2
                move.b 2(a2,d3.w),d2
+
move.b 2(a2,d3.w),d2
                andi.b #$80,d2
+
andi.b #$80,d2
                bne.s   loc_13D42
+
bne.s loc_13D42
                or.w   d0,d1
+
or.w d0,d1
                bne.s   loc_13D42
+
bne.s loc_13D42
                btst   #6,$2A(a0)             ; test underwater flag
+
btst #6,$2A(a0) ; is Tails underwater?
                bne.s   +
+
bne.s .underwater ; if so, branch
                move.w #$600,($FFFFFEC0).w     ; set Tails' top speed
+
move.w #$600,($FFFFFEC0).w ; set Tails' top speed
                move.w #$C,($FFFFFEC2).w       ; set Tails' acceleration
+
move.w #$C,($FFFFFEC2).w ; set Tails' acceleration
                move.w #$80,($FFFFFEC4).w     ; set Tails' deceleration
+
move.w #$80,($FFFFFEC4).w ; set Tails' deceleration
+
+
.underwater:
;               etc...
+
; etc...
 
</asm>
 
</asm>
  
Line 91: Line 91:
 
Tails... oh Tails, what a stupid little fucker... never does anything right, does he? But why??? Why does this bug happen to begin with? RedHotSonic explains this in detail:
 
Tails... oh Tails, what a stupid little fucker... never does anything right, does he? But why??? Why does this bug happen to begin with? RedHotSonic explains this in detail:
  
Again, qouted from RHS - "Now, when you lose Tails, he goes through lots of commands to move him about and to respawn him on certain conditions. BUT, none of these commands reset Tails' speeds. Because of this, when Tails respawns, he has the exact same speeds as when you lost him. So, if you lose him underwater, when he respawns, he will still have underwater speeds. So, all we've done here is added the command to reset his speeds. So...
+
Again, quoted from RHS - "Now, when you lose Tails, he goes through lots of commands to move him about and to respawn him on certain conditions. BUT, none of these commands reset Tails' speeds. Because of this, when Tails respawns, he has the exact same speeds as when you lost him. So, if you lose him underwater, when he respawns, he will still have underwater speeds. So, all we've done here is added the command to reset his speeds. So...
  
 
In Sonic 2, all we've done is set Tails to use his normal speeds no matter what when he respawns. This is fine because he only respawns when you're not in water, so he will always be out of water when he arrives. So we want his normal speed.
 
In Sonic 2, all we've done is set Tails to use his normal speeds no matter what when he respawns. This is fine because he only respawns when you're not in water, so he will always be out of water when he arrives. So we want his normal speed.

Revision as of 09:25, 13 September 2014

(Original guide by redhotsonic)

Quote from redhotsonic - "The problem here is when you and Tails enter the water, your speed, acceleration and deceleration are decreased, to give you the underwater physics. The problem is, if you lose Tails when underwater, when he next respawns (in Sonic 2, he only respawns when you've come out of water), he will still have his underwater speeds. Hence why Tails suddenly cannot keep up. This bug only occurs when you lose Tails underwater, and his underwater speed will remain this way until he enters/exits water again (no matter how many times you lose him and he respawns)."

Sonic 2 fix

This can be done in Xenowhirl's 2007 disassembly or the SVN disassembly.

First, Go to "loc_1BC68:" and you'll see this: <asm> loc_1BC68: lea (Sonic_Stat_Record_Buf).w,a2 move.b 2(a2,d3.w),d2 andi.b #$D2,d2 bne.s return_1BCDE or.w d0,d1 bne.s return_1BCDE

etc...

</asm>

Right after the 2nd "bne.s return_1BCDE" command, insert this: <asm> move.w #$600,(Tails_top_speed).w ; set Tails' top speed move.w #$C,(Tails_acceleration).w ; set Tails' acceleration move.w #$80,(Tails_deceleration).w ; set Tails' deceleration </asm>

So, you have something like this: <asm> loc_1BC68: ; Fix for Tails' underwater respawn lea (Sonic_Stat_Record_Buf).w,a2 move.b 2(a2,d3.w),d2 andi.b #$D2,d2 bne.s return_1BCDE or.w d0,d1 bne.s return_1BCDE move.w #$600,(Tails_top_speed).w ; set Tails' top speed move.w #$C,(Tails_acceleration).w ; set Tails' acceleration move.w #$80,(Tails_deceleration).w ; set Tails' deceleration

etc...

</asm> Done! Now Tails' respawn speeds are fixed, and when respawning after being lost underwater, he will move and behave normally! Now that was easy, but wait... are you hacking Sonic 3K also? Oh.. you are? Well then, there's more!

Sonic 3K fix

The bug is NOT fixed in S3K either, but to fix it, you have to do an extra check, so follow this S3K fix! This can be done in the SVN disassembly.

Go to "loc_13CD2:" and you'll see this: <asm> loc_13CD2: lea (Stat_table).w,a2 move.b 2(a2,d3.w),d2 andi.b #$80,d2 bne.s loc_13D42 or.w d0,d1 bne.s loc_13D42

etc...

</asm>

Right after the 2nd "bne.s loc_13D42" command, insert this: <asm> btst #6,$2A(a0) ; is Tails underwater? bne.s .underwater ; if so, branch move.w #$600,($FFFFFEC0).w ; set Tails' top speed move.w #$C,($FFFFFEC2).w ; set Tails' acceleration move.w #$80,($FFFFFEC4).w ; set Tails' deceleration .underwater: </asm>

So, you have something like this: <asm> loc_13CD2: ; Fix for Tails' underwater respawn lea (Stat_table).w,a2 move.b 2(a2,d3.w),d2 andi.b #$80,d2 bne.s loc_13D42 or.w d0,d1 bne.s loc_13D42 btst #6,$2A(a0) ; is Tails underwater? bne.s .underwater ; if so, branch move.w #$600,($FFFFFEC0).w ; set Tails' top speed move.w #$C,($FFFFFEC2).w ; set Tails' acceleration move.w #$80,($FFFFFEC4).w ; set Tails' deceleration .underwater:

etc...

</asm>

AGAIN! Easy! Piece of cake! Now Tails will behave properly.

The bug explained

Tails... oh Tails, what a stupid little fucker... never does anything right, does he? But why??? Why does this bug happen to begin with? RedHotSonic explains this in detail:

Again, quoted from RHS - "Now, when you lose Tails, he goes through lots of commands to move him about and to respawn him on certain conditions. BUT, none of these commands reset Tails' speeds. Because of this, when Tails respawns, he has the exact same speeds as when you lost him. So, if you lose him underwater, when he respawns, he will still have underwater speeds. So, all we've done here is added the command to reset his speeds. So...

In Sonic 2, all we've done is set Tails to use his normal speeds no matter what when he respawns. This is fine because he only respawns when you're not in water, so he will always be out of water when he arrives. So we want his normal speed.

In Sonic 3 and Knuckles, we have to do a check first to see if Tails is respawning in water or not. If not, do not bother resetting the speeds because he's going to spawn in water. On the other hand, if not in water, it will reset to his normal speeds because he's going to respawn out of water."

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