Difference between revisions of "Fix bug in ARZ Boss arrow's platform behavior"
From Sonic Retro
Scarred Sun (talk | contribs) |
Redhotsonic (talk | contribs) m |
||
Line 1: | Line 1: | ||
{{GuideBy|MoDule}} | {{GuideBy|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. | 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. | ||
Line 54: | Line 56: | ||
seems to work well. | seems to work well. | ||
− | ==The bug explained== | + | ===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 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. | 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 one more bug 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)? 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. | ||
+ | |||
+ | <asm>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) | ||
+ | [...] | ||
+ | </asm> | ||
+ | |||
+ | At the moment, it is set to 10. Set it to 1E instead, so you have this: | ||
+ | |||
+ | <asm>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) | ||
+ | [...] | ||
+ | </asm> | ||
+ | |||
+ | ===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 it, so my only guess is that it's set to 10 originally here 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. | ||
{{S2Howtos}} | {{S2Howtos}} | ||
[[Category:SCHG How-tos|{{PAGENAME}}]] | [[Category:SCHG How-tos|{{PAGENAME}}]] |
Revision as of 08:30, 15 September 2011
(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: <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.
Additional step
You've fixed the two bugs in the ARZ boss now, but there is still one more bug 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)? 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.
<asm>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) [...] </asm>
At the moment, it is set to 10. Set it to 1E instead, so you have this:
<asm>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) [...] </asm>
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 it, so my only guess is that it's set to 10 originally here 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.