Difference between revisions of "Fix bug in ARZ Boss arrow's platform behavior"
From Sonic Retro
m (Text replacement - "redhotsonic" to "redhotsonic") |
|||
Line 1: | Line 1: | ||
{{GuideBy|MoDule}} | {{GuideBy|MoDule}} | ||
− | (Additional step by [[redhotsonic]]) | + | (Additional step by [[User:Redhotsonic|redhotsonic]]) |
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. | 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. |
Revision as of 14:12, 10 April 2018
(Original guide by MoDule)
(Additional step by redhotsonic)
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.
Contents
Fixing the bug
Locate the label loc_30CCC. It should look something like this:
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
Now move the following block to the top, under the first label:
move.w #$1B,d1
move.w #1,d2
move.w #2,d3
move.w x_pos(a0),d4
bsr.w JmpTo8_PlatformObject
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:
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)
[...]
Although that last line seems to already set a width, it doesn't. Adding this underneath
move.b #$10,width_pixels(a0)
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.
Additional step
You've fixed the two bugs in the ARZ boss now, but there is still TWO more bugs in existence. It's actually very similar to the balancing bug on the arrows, except his time, on the poles itself. Noticed that when you jump on top of the poles, Sonic does his balancing act all the time (unless you're hogging the side of the screen)? Also, if you jump and land on the pole, you actually fall though and land on the floor (unless again, you're hogging the side of the screen). Well, I'm about to show you how to fix that, and it's very easy.
Locate the label loc_304D4. This is all the information stored for Eggman like his collision property and his hit counter, etc. But locate the width_pixels(a1) line.
loc_304D4:
[...] ;a lot of coding above this, but look further below
move.l #Obj89_MapUnc_30D68,mappings(a1)
ori.b #4,render_flags(a1)
move.w #$3E0,art_tile(a1)
move.b #$10,width_pixels(a1) ; This is the bit we're about to edit
move.b #4,priority(a1)
move.w #$2A50,x_pos(a1)
[...]
At the moment, it is set to 10. Set it to 1E instead, so you have this:
loc_304D4:
[...] ;a lot of coding above this, but look further below
move.l #Obj89_MapUnc_30D68,mappings(a1)
ori.b #4,render_flags(a1)
move.w #$3E0,art_tile(a1)
move.b #$1E,width_pixels(a1) ; Fix's sonic balancing bug on top of polls
move.b #4,priority(a1)
move.w #$2A50,x_pos(a1)
[...]
Now, Sonic won't do his balancing act unless on the very edge of the pole. Same with jumping, he will now land and stay on the pole unless you jumped on the very edge.
Additional bug explained
I'm not totally sure why he does it, but I can take a guess. In MoDule's fix for the arrow balancing bug, adding 10 to the width fixes the arrows, so my only guess is that this command that's already set to 10 are originally for the arrows, but it actually effects the poles. Making it 1E set's the width longer (obviously), so he won't trigger his balancing act until near the edge, which is what we want.
See Also
There is another unrelated flaw in this boss' design. Check it out here.