Difference between revisions of "Fix ARZ boss sprite behavior"
From Sonic Retro
m (Replaced spaces with tabs, unnamed temp label with named temp label) |
Scarred Sun (talk | contribs) m (Text replacement - "</asm>" to "</syntaxhighlight>") |
||
Line 11: | Line 11: | ||
loc_3077A: | loc_3077A: | ||
− | </ | + | </syntaxhighlight> |
Under the "move.b #$31,3(a1)", insert this line: | Under the "move.b #$31,3(a1)", insert this line: | ||
<asm> | <asm> | ||
move.b #1,objoff_36(a0) ; move 1 to checker | move.b #1,objoff_36(a0) ; move 1 to checker | ||
− | </ | + | </syntaxhighlight> |
So you have something like this: | So you have something like this: | ||
Line 26: | Line 26: | ||
loc_3077A: | loc_3077A: | ||
− | </ | + | </syntaxhighlight> |
Next, go to "loc_3075C:" and you'll see this: | Next, go to "loc_3075C:" and you'll see this: | ||
Line 36: | Line 36: | ||
cmpi.b #4,(Sidekick+routine).w | cmpi.b #4,(Sidekick+routine).w | ||
bne.s loc_3077A | bne.s loc_3077A | ||
− | </ | + | </syntaxhighlight> |
After the "bsr.w loc_3078E" command, insert these two lines: | After the "bsr.w loc_3078E" command, insert these two lines: | ||
Line 42: | Line 42: | ||
tst.b objoff_36(a0) ; Is checker 0? | tst.b objoff_36(a0) ; Is checker 0? | ||
bne.s loc_3077A ; If not, branch and do not check for Sonic/Tails hurt state | bne.s loc_3077A ; If not, branch and do not check for Sonic/Tails hurt state | ||
− | </ | + | </syntaxhighlight> |
So you have something like this: | So you have something like this: | ||
Line 54: | Line 54: | ||
cmpi.b #4,(Sidekick+routine).w | cmpi.b #4,(Sidekick+routine).w | ||
bne.s loc_3077A | bne.s loc_3077A | ||
− | </ | + | </syntaxhighlight> |
Next, go to "return_3078C:" and you'll see this: | Next, go to "return_3078C:" and you'll see this: | ||
Line 60: | Line 60: | ||
return_3078C: | return_3078C: | ||
rts | rts | ||
− | </ | + | </syntaxhighlight> |
Change it to this: | Change it to this: | ||
Line 70: | Line 70: | ||
.laughing: | .laughing: | ||
rts | rts | ||
− | </ | + | </syntaxhighlight> |
'''Done!''' | '''Done!''' | ||
Revision as of 21:28, 20 December 2015
(Original guide by redhotsonic)
With this boss, as soon as you're hurt, Eggman won't laugh instantly. Instead, he waits for you to hit the ground, then he laughs. Same goes for Tails. with all the other bosses, Eggman laughs instantly. So let's fix this.
The Fix
Go to "loc_30770:" (part of the ARZ boss code) and you'll see this: <asm> loc_30770: lea ($FFFFF740).w,a1 move.b #$31,3(a1)
loc_3077A: </syntaxhighlight>
Under the "move.b #$31,3(a1)", insert this line: <asm> move.b #1,objoff_36(a0) ; move 1 to checker </syntaxhighlight>
So you have something like this: <asm> loc_30770: lea ($FFFFF740).w,a1 move.b #$31,3(a1) move.b #1,objoff_36(a0) ; move 1 to checker
loc_3077A: </syntaxhighlight>
Next, go to "loc_3075C:" and you'll see this: <asm> loc_3075C: bsr.w loc_3078E cmpi.b #4,(MainCharacter+routine).w beq.s loc_30770 cmpi.b #4,(Sidekick+routine).w bne.s loc_3077A </syntaxhighlight>
After the "bsr.w loc_3078E" command, insert these two lines: <asm> tst.b objoff_36(a0) ; Is checker 0? bne.s loc_3077A ; If not, branch and do not check for Sonic/Tails hurt state </syntaxhighlight>
So you have something like this: <asm> loc_3075C: bsr.w loc_3078E tst.b objoff_36(a0) ; Is checker 0? bne.s loc_3077A ; If not, branch and do not check for Sonic/Tails hurt state cmpi.b #4,(MainCharacter+routine).w beq.s loc_30770 cmpi.b #4,(Sidekick+routine).w bne.s loc_3077A </syntaxhighlight>
Next, go to "return_3078C:" and you'll see this: <asm> return_3078C: rts </syntaxhighlight>
Change it to this: <asm> return_3078C: cmpi.b #$17,($FFFFF743).w ; Has Eggman stopped laughing? bne.s .laughing ; If not, branch clr.b objoff_36(a0) ; If so, clear checker, so Eggman can check to see if Sonic/Tails are hurt again .laughing: rts </syntaxhighlight> Done!
Explanation
Quoted from RHS: "Most of you have probably noticed that Eggman didn't laugh instantly. BUT, did any of you notice that when hurt, Eggman's animation is actually frozen? Yup, that's right. Normally, his mustache is moving (due to wind I guess), but as soon as you're hurt, his mustache isn't moving anymore. He's frozen and until you hit the ground, he will remain that way. When you've hit the ground, he will then laugh, then carry on with his normal animations.
It's important to know, for this boss, the animations are working another way rather than they normally do. instead of "anim" being set, $FFFFF743 (or $FFFFF740+3) is being set. This RAM adress counts down every frame, to make Eggman animate. Every odd number displays one part of his anim, and every even number displays another part of his anim. His mustache for instance. Every odd number displays 1 part and every even displays another, making his mustache move.
Anyway, the reason for Eggman's animation freezing is because when Sonic/Tails gets hurt, their routine is set to 4 (hurt routine). Eggman checks this, and if hurt, move $31 to his animation. But at this moment in time, the RAM address CANNOT countdown. It tries to, but it can't. The reason why, is because as Sonic and Tails are hurt, until they land on the floor, their routine will stay at 4. Because Eggman is continuously seeing them at routine 4, it constantly writes $31 to $FFFFF743. That's why the RAM cannot countdown. And because it's constantly at $31, it's only able to display one part of his animation, and that's why Eggman's anim is frozen.
As soon as Sonic/Tails lands, their routine is set back to normal. Eggman now stops writing $31 to $FFFFF743, letting the RAM address able to countdown, now displaying his laugh animation.
So, what have we done to fix this? We've added a new check using objoff_36(a0) (not used in ARZ boss so it's free to use). As soon as Sonic/Tails gets hurt, it now moves #1 to objoff_36(a0). We've added a check before the Sonic/Tails hurt check. If objoff_36(a0) is now equals 1, to branch away from the hurt check, leaving $FFFFF743 free to countdown. Eggman now displays his laugh instantly.
After Eggman's laugh, $FFFFF743 is set back to $17 and counts down again (Eggman's normal animation). We've done one more check to see if $FFFFF743 equals $17 and if so, to clear objoff_36(a0). Now that objoff_36(a0) is now 0 again, Eggman can now check to see when Sonic/Tails gets hurt again, and laugh when so.
Everything is fine once again!"