Actions

SCHG How-to

Difference between revisions of "Fix ARZ Boss Walking on Air Glitch"

From Sonic Retro

m (Text replacement - "<asm>" to "<syntaxhighlight lang="asm">")
m (Text replacement - "\[\[Category:SCHG How-tos.*" to "")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
(Original guide by [[MoDule]])
+
(Original guide by [[User:MoDule|MoDule]])
  
 
==The Bug==
 
==The Bug==
Line 88: Line 88:
  
 
{{S2Howtos}}
 
{{S2Howtos}}
[[Category:SCHG How-tos|{{PAGENAME}}]]
+
|{{PAGENAME}}]]

Latest revision as of 11:11, 25 August 2018

(Original guide by MoDule)

The Bug

When fighting the ARZ boss with both Sonic & Tails, it's possible to activate the classic "walking on air" glitch. It's hard to trigger accidentally, but if you defeat the boss with one character, while the other character is standing on one of the two pillars at either side of the screen, that character will suffer from the glitch.

The Fix

Locate the label loc_30B4A. The code should look like this:

loc_30B4A:
        move.b  #1,(Screen_Shaking_Flag).w
        addi.w  #1,y_pos(a0)
        cmpi.w  #$510,y_pos(a0)
        blt.s   BranchTo2_JmpTo37_DisplaySprite
        move.b  #0,(Screen_Shaking_Flag).w
        bra.w   JmpTo55_DeleteObject

Now add to it so it looks just like this:

loc_30B4A:
        move.b  status(a0),d0
        andi.b  #standing_mask|pushing_mask,d0  ; is someone touching the pillar?
        beq.s   Pillar_Lower                    ; if not, branch
        move.b  d0,d1
        andi.b  #p1_standing|p1_pushing,d1      ; is it the main character?
        beq.s   +                               ; if not, branch
	andi.b	#~(p1_standing|p1_pushing),status(a0)
        andi.b  #$D7,(MainCharacter+status).w
        ori.b   #2,(MainCharacter+status).w     ; prevent Sonic from walking in the air
+
        andi.b  #p2_standing|p2_pushing,d0      ; is it the sidekick?
        beq.s   Pillar_Lower                    ; if not, branch
	andi.b	#~(p2_standing|p2_pushing),status(a0)
        andi.b  #$D7,(Sidekick+status).w
        ori.b   #2,(Sidekick+status).w          ; prevent Tails from walking in the air

Pillar_Lower:

        move.b  #1,(Screen_Shaking_Flag).w
        addi.w  #1,y_pos(a0)
        cmpi.w  #$510,y_pos(a0)
        blt.s   BranchTo2_JmpTo37_DisplaySprite
        move.b  #0,(Screen_Shaking_Flag).w
        bra.w   JmpTo55_DeleteObject

Everything up to the label Pillar_Lower is new and what it does is check if any character is interacting with the pillar and clears their interaction bits if necessary.

A Little More

Alternatively, if you want the pillars to stay solid even while they are being lowered into the ground, change the code to this:

loc_30B4A:
        move.w  #$23,d1
        move.w  #$44,d2
        move.w  #$45,d3
        move.w  x_pos(a0),d4
        move.w  y_pos(a0),-(sp)
        addi.w  #4,y_pos(a0)
        bsr.w   JmpTo26_SolidObject
        move.w  (sp)+,y_pos(a0)

        move.b  #1,(Screen_Shaking_Flag).w
        addi.w  #1,y_pos(a0)
        cmpi.w  #$510,y_pos(a0)
        blt.s   BranchTo2_JmpTo37_DisplaySprite

        move.b  status(a0),d0
        andi.b  #standing_mask|pushing_mask,d0  ; is someone touching the pillar?
        beq.s   Pillar_Lower                    ; if not, branch
        move.b  d0,d1
        andi.b  #p1_standing|p1_pushing,d1      ; is it the main character?
        beq.s   +                               ; if not, branch
	andi.b	#~(p1_standing|p1_pushing),status(a0)
        andi.b  #$D7,(MainCharacter+status).w
        ori.b   #2,(MainCharacter+status).w     ; prevent Sonic from walking in the air
+
        andi.b  #p2_standing|p2_pushing,d0      ; is it the sidekick?
        beq.s   Pillar_Lower                    ; if not, branch
	andi.b	#~(p2_standing|p2_pushing),status(a0)
        andi.b  #$D7,(Sidekick+status).w
        ori.b   #2,(Sidekick+status).w          ; prevent Tails from walking in the air

Pillar_Lower:
        move.b  #0,(Screen_Shaking_Flag).w
        bra.w   JmpTo55_DeleteObject

Explanation

For an object to have solidity, which for instance allows the player objects to stand on top of it, it has to call one of the SolidObject routines. These routines handle player positioning and flags in such a way so as to make the object appear solid. When a character stands on an object, its on-object status bit is set. When this bit is set, the character no longer follows the level's terrain, but instead walks in a straight line along the object's surface, ignoring gravity. Walking off the edge of an object will cause the SolidObject routine to clear the on-object flag and make the character subject to gravity again. Should an object stop calling SolidObject while a player is standing on it, that player's on-object bit won't be reset and this causes the walking on air glitch. In the case of the ARZ boss's pillars, SolidObject is called in every state except the "moving down" state which is triggered when the boss is defeated. This causes the pillars to eventually vanish without making sure the player's on-object bits are cleared.

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

|Fix ARZ Boss Walking on Air Glitch]]