Actions

SCHG How-to

Difference between revisions of "Fix Tails subanimation error"

From Sonic Retro

m (Fix #2: Hurt flashing bug)
m (Text replacement - "\[\[Category:SCHG How-tos.*" to "")
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
(Original guide by [[redhotsonic]], using Xenowhirl's 2007 disassembly)
+
{{GuideBy|redhotsonic}}
  
 
==Fix #1: Pushing bug==
 
==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
+
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:
 
Go to "Obj05_Main:" and find this coding:
  
<asm>
+
<syntaxhighlight lang="asm">
        moveq   #0,d0
+
moveq #0,d0
        move.b anim(a2),d0
+
move.b anim(a2),d0
        btst   #5,status(a2)
+
btst #5,status(a2)
        beq.s   +
+
beq.s +
        moveq   #4,d0
+
moveq #4,d0
 
+
 
+
</asm>
+
</syntaxhighlight>
  
 
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:
 
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>
+
<syntaxhighlight lang="asm">
        moveq   #0,d0
+
moveq #0,d0
        move.b anim(a2),d0
+
move.b anim(a2),d0
        btst   #5,status(a2)           ; is Tails about to push against something?
+
btst #5,status(a2) ; is Tails about to push against something?
        beq.s   +                       ; if not, branch
+
beq.s + ; if not, branch
        cmpi.b #$63,mapping_frame(a2) ; Is Tails in his pushing animation yet?
+
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
+
blo.s + ; If not yet, branch, and do not set tails' tail pushing animation
        moveq   #4,d0
+
cmpi.b #$66,mapping_frame(a2) ; ''
 +
bhi.s + ; ''
 +
moveq #4,d0
 
+
 
+
</asm>
+
</syntaxhighlight>
  
 
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.
 
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.
Line 35: Line 37:
 
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.
 
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. [http://forums.sonicretro.org/index.php?showtopic=29775&view=findpost&p=707706]
+
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 {{LinkRetro|topic=29775&view=findpost&p=707706|title=this forum post}}.
  
 
Go to "loc_1D288:" and you should see this:
 
Go to "loc_1D288:" and you should see this:
<asm>
+
<syntaxhighlight lang="asm">
 
loc_1D288:
 
loc_1D288:
        lea     (Obj05AniData).l,a1
+
lea (Obj05AniData).l,a1
        bsr.w   Tails_Animate_Part2
+
bsr.w Tails_Animate_Part2
        bsr.w   LoadTailsTailsDynPLC
+
bsr.w LoadTailsTailsDynPLC
        jsr     (DisplaySprite).l
+
jsr (DisplaySprite).l
        rts
+
rts
</asm>
+
</syntaxhighlight>
  
This is where Tails' Tails object gets animated and displayed. Change all this to:
+
This is where the Tails' Tails object gets animated and displayed. Change all this to:
<asm>
+
<syntaxhighlight lang="asm">
 
loc_1D288:
 
loc_1D288:
        lea     (Obj05AniData).l,a1
+
lea (Obj05AniData).l,a1
        bsr.w   Tails_Animate_Part2
+
bsr.w Tails_Animate_Part2
        bsr.w   LoadTailsTailsDynPLC
+
bsr.w LoadTailsTailsDynPLC
        movea.w parent(a0),a1                   ; Move Tails' register to a1
+
movea.w parent(a0),a1 ; Move Tails' register to a1
        move.w invulnerable_time(a1),d0       ; Move Tails' invulnerable time to d0
+
move.w invulnerable_time(a1),d0 ; Move Tails' invulnerable time to d0
        beq.s   +                              ; Is invulnerable_time 0?  If so, always display his tails
+
beq.s .display ; Is invulnerable_time 0?  If so, always display his tails
        addq.w #1,d0                           ; Make d0 the same as old invulnerable_time's d0
+
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
+
lsr.w #3,d0 ; Shift bits to the right 3 times
        bcs.s   +                              ; If the Carry bit is set, branch and display his tails
+
bcc.s .return ; If the Carry bit is not set, branch and do not display Tails' tails
        rts                                    ; Otherwise, do not display Tails' tails
+
 
+
+
.display:
        jmp     (DisplaySprite).l              ; Display Tails' tails
+
jmp (DisplaySprite).l              ; Display Tails' tails
</asm>
+
 
 +
.return:
 +
rts
 +
</syntaxhighlight>
  
 
Done.
 
Done.
Line 68: Line 73:
 
==Fix #3: Balancing fix==
 
==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:
 
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>
+
<syntaxhighlight lang="asm">
        dc.b   0       ; TailsAni_Balance     -> Blank
+
dc.b 0 ; TailsAni_Balance -> Blank
</asm>
+
</syntaxhighlight>
 
I recommend changing the 0 to a $A, but you can change it to whatever you like.
 
I recommend changing the 0 to a $A, but you can change it to whatever you like.
  
 
==Fix #4: Looking up fix==
 
==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:
 
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>
+
<syntaxhighlight lang="asm">
dc.b   2       ; TailsAni_LookUp       -> Flick
+
dc.b 2 ; TailsAni_LookUp -> Flick
</asm>
+
</syntaxhighlight>
 
Change that 2 to a 1 and it should be fine.
 
Change that 2 to a 1 and it should be fine.
  
 
{{S2Howtos}}
 
{{S2Howtos}}
[[Category:SCHG How-tos|{{PAGENAME}}]]
+
|{{PAGENAME}}]]

Latest revision as of 11:11, 25 August 2018

(Original guide by redhotsonic)

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:

	moveq	#0,d0
	move.b	anim(a2),d0
	btst	#5,status(a2)
	beq.s	+
	moveq	#4,d0
+

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:

	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?
	blo.s	+			; If not yet, branch, and do not set tails' tail pushing animation
	cmpi.b	#$66,mapping_frame(a2)	; ''
	bhi.s	+			; ''
	moveq	#4,d0
+

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
Sonic Retro
this forum post
.

Go to "loc_1D288:" and you should see this:

loc_1D288:
	lea	(Obj05AniData).l,a1
	bsr.w	Tails_Animate_Part2
	bsr.w	LoadTailsTailsDynPLC
	jsr	(DisplaySprite).l
	rts

This is where the Tails' Tails object gets animated and displayed. Change all this to:

loc_1D288:
	lea	(Obj05AniData).l,a1
	bsr.w	Tails_Animate_Part2
	bsr.w	LoadTailsTailsDynPLC
	movea.w	parent(a0),a1			; Move Tails' register to a1
	move.w	invulnerable_time(a1),d0	; Move Tails' invulnerable time to d0
	beq.s	.display			; 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
	bcc.s	.return				; If the Carry bit is not set, branch and do not display Tails' tails

.display:
	jmp	(DisplaySprite).l               ; Display Tails' tails

.return:
	rts

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:

	dc.b	0	; TailsAni_Balance	-> Blank

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:

	dc.b	2	; TailsAni_LookUp	-> Flick

Change that 2 to a 1 and it should be fine.

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

|Fix Tails subanimation error]]