Actions

SCHG How-to

Difference between revisions of "Disable floor collision while dying"

From Sonic Retro

m (Added header and footer.)
m (Text replacement - "\[\[Category:SCHG How-tos.*" to "")
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
''(Guide written by [[Esrael]])''
+
''(Guide written by [[User:Esrael|Esrael]], Alternate fix by [[User:Flamewing|flamewing]])''
  
This is something that you are most likely to notice in [[Chemical Plant Zone]] while fighting the Act 2 boss. When your character dies, he will still detect any floor that is still above him, and if the detection returns a collision, the character will stop, and just drop like a rock, instead of move upwards like he normally does. This is not necessarily a bug, though it can be "fixed". Perform this fix if you don't want your character to detect floor tiles while dying.
+
This is something that you are most likely to notice in [[Chemical Plant Zone]] while fighting the Act 2 boss. When your character dies, he will still detect any floor that is still above him, and if the detection returns a collision, the character will stop, and just drop like a rock, instead of move upwards like he normally does. This is not necessarily a bug, though it can be "fixed". Perform this fix if you don't want your character to detect floor tiles while dying. There are two methods to fixing this, given to us by two of our well respected Tech Members. Both methods work, but ''flamewing'''s method is probably preferred, as it is less likely to cause other bugs with other objects.
 +
 
 +
==Esrael Method (v. 1)==
  
 
Find "loc_1E596" (Xenowhirl) or "Floor_ChkTile" (SVN)
 
Find "loc_1E596" (Xenowhirl) or "Floor_ChkTile" (SVN)
<asm>
+
<syntaxhighlight lang="asm">
 
; loc_1E596:  
 
; loc_1E596:  
 
Floor_ChkTile:  
 
Floor_ChkTile:  
Line 15: Line 17:
 
; (Sonic 1 calculated it every time instead of using a table)  
 
; (Sonic 1 calculated it every time instead of using a table)  
 
word_1E5D0:
 
word_1E5D0:
</asm>
+
</syntaxhighlight>
  
 
and insert the following code:
 
and insert the following code:
<asm>
+
<syntaxhighlight lang="asm">
 
; loc_1E596:  
 
; loc_1E596:  
 
Floor_ChkTile:  
 
Floor_ChkTile:  
Line 33: Line 35:
 
; (Sonic 1 calculated it every time instead of using a table)  
 
; (Sonic 1 calculated it every time instead of using a table)  
 
word_1E5D0:
 
word_1E5D0:
</asm>
+
</syntaxhighlight>
  
 
Your character will no longer detect floor tiles above him when dying.
 
Your character will no longer detect floor tiles above him when dying.
 +
 +
===Fixing a bug with this change===
 +
Now, everything seems well and good... but now I want you to "19, 65, 09, 17" your way over to Death Egg Zone for a minute. go to the Metal Sonic boss fight. You will notice that your robot adversary falls through the floor. WHY? Well, it's simple. Silver Sonic can't detect the floor with our fix, due to the fact that his initial animation shares the same id as Sonic/Tails while dying. To fix this, add the following lines to the code:
 +
 +
<syntaxhighlight lang="asm">
 +
; loc_1E596:
 +
Floor_ChkTile:
 +
        move.w  d2,d0
 +
        ....
 +
        movea.l d1,a1
 +
;--------------------------------------
 +
        cmpi.b  #$06, $0024(A0) 
 +
        bne.s  Player_Not_Death 
 +
        cmpi.b  #$01, (A0)          ; Is Sonic 
 +
        beq.s  Player_Death      ;
 +
        cmpi.b  #$02, (A0)          ;  Is Miles
 +
        bne.s  Player_Not_Death ; 
 +
Player_Death:                        ;
 +
        move.l  #$FFFF0000, A1                                                                 
 +
Player_Not_Death:
 +
;---------------------------------------
 +
        rts
 +
; ===========================================================================
 +
; precalculated values for Floor_ChkTile
 +
; (Sonic 1 calculated it every time instead of using a table)
 +
word_1E5D0:
 +
</syntaxhighlight>
 +
 +
Silver Sonic should behave like he is supposed to again... That's good! Oh, wait... now we gotta fight him. Shit.
 +
 +
==flamewing's method (v. 2)==
 +
 +
For Sonic, find this block of code:
 +
<syntaxhighlight lang="asm">
 +
Sonic_Boundary_Bottom: ;;
 +
        bra.w  JmpTo_KillCharacter
 +
; ===========================================================================
 +
; loc_1A9BA:
 +
</syntaxhighlight>
 +
 +
and change it to this:
 +
<syntaxhighlight lang="asm">
 +
Sonic_Boundary_Bottom: ;;
 +
        addq.l    #4,sp
 +
        bra.w  JmpTo_KillCharacter
 +
; ===========================================================================
 +
; loc_1A9BA:
 +
</syntaxhighlight>
 +
 +
For Tails, the relevant code block is this:
 +
<syntaxhighlight lang="asm">
 +
Tails_Boundary_Bottom: ;;
 +
        bra.w  JmpTo2_KillCharacter
 +
; ===========================================================================
 +
; loc_1C5A0:
 +
</syntaxhighlight>
 +
 +
Do the same change as was done for Sonic.
 +
 +
These changes will cause Sonic (and Tails) to skip some subroutines for the current control mode; this includes some that move Sonic (or Tails) and either make Sonic/Tails follow the ground or collide with the level. This will only happen during one frame; starting the next frame will work as normal since a different subroutine will be used. Being crushed by objects, drowning and being killed by badniks don't need to be changed because they all happen after the physics updates, and will only make effect on the next frame.
  
 
{{S2Howtos}}
 
{{S2Howtos}}
[[Category:SCHG How-tos|Disable floor collision while dying]]
+
|Disable floor collision while dying]]

Latest revision as of 11:11, 25 August 2018

(Guide written by Esrael, Alternate fix by flamewing)

This is something that you are most likely to notice in Chemical Plant Zone while fighting the Act 2 boss. When your character dies, he will still detect any floor that is still above him, and if the detection returns a collision, the character will stop, and just drop like a rock, instead of move upwards like he normally does. This is not necessarily a bug, though it can be "fixed". Perform this fix if you don't want your character to detect floor tiles while dying. There are two methods to fixing this, given to us by two of our well respected Tech Members. Both methods work, but flamewing's method is probably preferred, as it is less likely to cause other bugs with other objects.

Esrael Method (v. 1)

Find "loc_1E596" (Xenowhirl) or "Floor_ChkTile" (SVN)

; loc_1E596: 
Floor_ChkTile: 
        move.w  d2,d0 
        .... 
        movea.l d1,a1 
        rts 
; =========================================================================== 
; precalculated values for Floor_ChkTile 
; (Sonic 1 calculated it every time instead of using a table) 
word_1E5D0:

and insert the following code:

; loc_1E596: 
Floor_ChkTile: 
        move.w  d2,d0 
        .... 
        movea.l d1,a1 
        cmpi.b  #$06, $0024(A0)   
        bne.s   Player_Not_Death   
        move.l  #$FFFF0000, A1                                                                    
Player_Not_Death: 
        rts 
; =========================================================================== 
; precalculated values for Floor_ChkTile 
; (Sonic 1 calculated it every time instead of using a table) 
word_1E5D0:

Your character will no longer detect floor tiles above him when dying.

Fixing a bug with this change

Now, everything seems well and good... but now I want you to "19, 65, 09, 17" your way over to Death Egg Zone for a minute. go to the Metal Sonic boss fight. You will notice that your robot adversary falls through the floor. WHY? Well, it's simple. Silver Sonic can't detect the floor with our fix, due to the fact that his initial animation shares the same id as Sonic/Tails while dying. To fix this, add the following lines to the code:

; loc_1E596:
Floor_ChkTile:
        move.w  d2,d0
        ....
        movea.l d1,a1
;--------------------------------------
        cmpi.b  #$06, $0024(A0)  
        bne.s   Player_Not_Death  
        cmpi.b  #$01, (A0)          ; Is Sonic  
        beq.s   Player_Death       ; 
        cmpi.b  #$02, (A0)          ;  Is Miles
        bne.s   Player_Not_Death ;  
Player_Death:                         ; 
        move.l  #$FFFF0000, A1                                                                   
Player_Not_Death:
;---------------------------------------
        rts
; ===========================================================================
; precalculated values for Floor_ChkTile
; (Sonic 1 calculated it every time instead of using a table)
word_1E5D0:

Silver Sonic should behave like he is supposed to again... That's good! Oh, wait... now we gotta fight him. Shit.

flamewing's method (v. 2)

For Sonic, find this block of code:

Sonic_Boundary_Bottom: ;;
        bra.w   JmpTo_KillCharacter
; ===========================================================================
; loc_1A9BA:

and change it to this:

Sonic_Boundary_Bottom: ;;
        addq.l    #4,sp
        bra.w   JmpTo_KillCharacter
; ===========================================================================
; loc_1A9BA:

For Tails, the relevant code block is this:

Tails_Boundary_Bottom: ;;
        bra.w   JmpTo2_KillCharacter
; ===========================================================================
; loc_1C5A0:

Do the same change as was done for Sonic.

These changes will cause Sonic (and Tails) to skip some subroutines for the current control mode; this includes some that move Sonic (or Tails) and either make Sonic/Tails follow the ground or collide with the level. This will only happen during one frame; starting the next frame will work as normal since a different subroutine will be used. Being crushed by objects, drowning and being killed by badniks don't need to be changed because they all happen after the physics updates, and will only make effect on the next frame.

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

|Disable floor collision while dying]]