Fix Tails subanimation error
From Sonic Retro
(Original guide by redhotsonic, using Xenowhirl's 2007 disassembly)
Contents
Fix #1: Pushing bug
When Tails is standing next to a solid object, his tails use their pushing subanimation as opposed to a standard idle subanimation. Also, during the few frames before Tails enters his actual pushing animation, his tails look corrupted. Let's fix that
Go to "Obj05_Main:" and find this coding:
<asm>
moveq #0,d0 move.b anim(a2),d0 btst #5,status(a2) beq.s + moveq #4,d0
+ </asm>
When Tails is next to something he's about to push, his pushing tails animation is set. The thing is, just before he pushes, one walking anim appears, which conflicts both tails animations. So, change it to this:
<asm>
moveq #0,d0 move.b anim(a2),d0 btst #5,status(a2) ; is Tails about to push against something? beq.s + ; if not, branch cmpi.b #$63,mapping_frame(a2) ; Is Tails in his pushing animation yet? blt.s + ; If not yet, branch, and do not set tails' tail pushing animation moveq #4,d0
+ </asm>
Now, as soon as he's about to push, it will still do his one walking animation, but his mapping frame wouldn't have reached #$63 yet, so it won't set the tails' pushing subanimation. That means no more conflicts. Then when he does do his pushing animation, the subanimation will set accordingly without conflicting.
Fix #2: Hurt flashing bug
We all know that Tails has another object attached to him half the time; "Tails' Tails". Used for when he's standing, jumping, etc. Sometimes, his tails are drawn within Tails himself, like when he is walking.
Something that has always bugged me in Sonic 2 is that when he gets hurt, he becomes invulnerable for a couple of seconds, and he flashes, but the object "Tails' tails" does not. When this object isn't being used (like when Tails is walking and the tails are drawn within him) his tails do flash.
To me, this looks strange. This happens in both Sonic 2 and Sonic 3 and Knuckles. I'm about to show you how to fix it in Sonic 2. I will have a guide up on the wiki for the Sonic 3 fix soon. In the meantime, simply go to the forum post. [1]
Go to "loc_1D288:" and you should see this: <asm> loc_1D288:
lea (Obj05AniData).l,a1 bsr.w Tails_Animate_Part2 bsr.w LoadTailsTailsDynPLC jsr (DisplaySprite).l rts
</asm>
This is where Tails' Tails object gets animated and displayed. Change all this to: <asm> loc_1D288:
lea (Obj05AniData).l,a1 bsr.w Tails_Animate_Part2 bsr.w LoadTailsTailsDynPLC move.w invulnerable_time(a2),d0 ; Move Tails' invulnerable time to d0 beq.s + ; Is invulnerable_time 0? If so, always display his tails addq.w #1,d0 ; Make d0 the same as old invulnerable_time's d0 lsr.w #3,d0 ; Shift bits to the right 3 times bcs.s + ; If the Carry bit is set, branch and display his tails rts ; Otherwise, do not display Tails' tails
+
jmp (DisplaySprite).l ; Display Tails' tails
</asm>
Done.
Fix #3: Balancing fix
Not really a bug, though some people think his tails disappear. I always thought that the tails were behind his head, but if you do not like that, then go to "Obj05AniSelection:" and change this: <asm>
dc.b 0 ; TailsAni_Balance -> Blank
</asm> I recommend changing the 0 to a $A, but you can change it to whatever you like.
Fix #4: Looking up fix
Again, not really a bug, but his tails flicker when looking up. Fixing this is just as easy. In the same bit of code that we were in for fix 3, change this: <asm> dc.b 2 ; TailsAni_LookUp -> Flick </asm> Change that 2 to a 1 and it should be fine.