Actions

SCHG How-to

Fix bug in ARZ Boss arrow's platform behavior

From Sonic Retro

Revision as of 11:55, 13 September 2011 by Scarred Sun (talk | contribs)

(Original guide by MoDule)

In Sonic 2 there is a bug in ARZ's Boss. The arrows it shoots that act as platforms can temporarily cause the walking in air glitch if the player is fast enough and walks over the edge of the arrow.

This guide will show how to fix this bug.

Fixing the bug

Locate the label loc_30CCC. It should look something like this: <asm>loc_30CCC: tst.w objoff_30(a0) ; has timer been set? bne.s + ; if yes, branch

move.w #$1B,d1 move.w #1,d2 move.w #2,d3 move.w x_pos(a0),d4 bsr.w JmpTo8_PlatformObject

btst #3,status(a0) ; is Main character standing on the arrow? beq.s return_30D02 ; if not, branch move.w #$1F,objoff_30(a0) ; set timer + subi.w #1,objoff_30(a0) ; decrement timer bne.s return_30D02 ; make arrow fall when timer runs out move.b #6,objoff_2A(a0)

return_30D02: rts </asm> Now move the following block to the top, under the first label: <asm> move.w #$1B,d1 move.w #1,d2 move.w #2,d3 move.w x_pos(a0),d4 bsr.w JmpTo8_PlatformObject </asm> Now Sonic can walk off the arrows properly.

Optional next step

Sonic will use his balancing animation when standing on an arrow. If this is undesirable, this next part will show how to change this behavior.

Locate the label loc_30BC8. It should look something like this: <asm>loc_30BC8: move.l #Obj89_MapUnc_30D68,mappings(a0) move.w #make_art_tile(ArtTile_ArtNem_ARZBoss,0,0),art_tile(a0) ori.b #4,render_flags(a0) move.b #-$70,mainspr_width(a0) [...] </asm> Although that last line seems to already set a width, it doesn't. Adding this underneath <asm> move.b #$10,width_pixels(a0) </asm> seems to work well.

The bug explained

The first part of the bug comes from the arrow object running its platform checks only once. The reason why the check is only run once is because the arrow's platform routine checks if the countdown timer is set first. If it is it skips the code that checks if Sonic is standing on the arrow and initializes the timer. By skipping any further platform checks, Sonic's on-object bit never gets cleared, which causes the walking in air bug.

The second part, where Sonic uses his balancing animation no matter how far he is from the arrow's edge comes from the arrow object not assigning a value to its width_pixels. Now when Sonic's object checks for his distance to the object's edge it will think he's always right at the edge or beyond thus triggering his balancing animation.

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