ThomasSpeedrunner icon

Tails Flying Code v2

ThomasSpeedrunner | PRO | 04/25/13 08:39:22 PM UTC | 0 ⭐ | 433 👁️ | Never ⏰ | []
text |

3.03 KB

|

None

|

0 👍

/

0 👎

; Actual flight routine itself...
; ---------------------------------------------------------------------------
; Subroutine to check if Tails wants to begin flying mid-jump
; ---------------------------------------------------------------------------
Tails_CheckFlight:	; in this ability routine, a0 = Tails
	btst	#0,flight_property(a0)		; are we already flying?
	beq.s	Tails_UpdateFlight		; if yes, update Tails' flight
 	tst.b	(Two_player_mode).w		; are we in two player mode?
	bne.w	+				; if so, skip the following check
 	cmpa.w	#MainCharacter,a0		; is Tails the main character?
	bne.w	return_1C83D			; if not, return
+
	cmpi.b	#1,jumping(a0)			; are we jumping?
	bne.w	return_1C83D			; if not, return
 	move.b	(Ctrl_1_Press_Logical).w,d0
	andi.b	#button_B_mask|button_C_mask,d0	; is B or C pressed?
	beq.w	return_1C83D			; if not, branch
; if all of these conditions are met, do the following:
	move.b	#AniIDTailsAni_Fly,anim(a0)	; begin flying
	move.b	#$4B,flight_time(a0)		; set the amount of time Tails can fly for (this is needed later, in Tails_FlyingSwimming)
	move.w	#$C,y_vel(a0)			; set Tails' y-velocity to something reasonable (again, needed later, in Tails_FlyingSwimming)
	bset	#1,flight_property(a0)		; tell the game that Tails is flying
	bclr	#0,flight_property(a0)		; tell the game that Tails is not not-flying, if that makes any sense to you people, which I highly doubt it did :U
 return_1C83D:
	rts
 ; ---------------------------------------------------------------------------
; Subroutine doing the extra logic for Tails' flight
; ---------------------------------------------------------------------------
Tails_FlyingSwimming:
	moveq	#0,d0
	move.b	($FFFFFE05).w,d0
	andi.b	#7,d0
	bne.s	++
	subq.b	#1,flight_time(a0)
	bne.s	++
	btst	#2,flight_property(a0)		; Did we already tell the game that Tails is tired?
        bne.s	+				; If so, don't tell it again, since that's completely pointless.
	bset	#2,flight_property(a0)		; If we haven't yet, tell the game that Tails is tired.
+
	moveq	#0,d0
	move.b	($FFFFFE05).w,d0
	andi.b	#3,d0
	bne.s	+
	addq.w	#1,y_vel(a0)
+
	rts
 ; ...and the altered Tails_ResetOnFloor_Part3 to fix some issues.
Tails_ResetOnFloor_Part3:
	bclr	#1,status(a0)
	bclr	#5,status(a0)
	bclr	#4,status(a0)
	move.b	#0,jumping(a0)
	move.w	#0,(Chain_Bonus_counter).w
	move.b	#0,flip_angle(a0)
	move.b	#0,flip_turned(a0)
	move.b	#0,flips_remaining(a0)
	btst	#0,flight_property(a0)			; Test the not-flying bit...
	bne.s	+					; ...and if we didn't fly since the last time we hit the floor, skip the flying section
	; Section for Tails' flight:
	move.b	#0,flight_time(a0)			; Reset our flight time...
	bclr	#1,flight_property(a0)			; ...clear the flying bit...
	bclr	#2,flight_property(a0)			; ...clear the tired-while-flying bit...
	bset	#0,flight_property(a0)			; ...and set the not-flying bit.
+	; Rest of original subroutine:
	move.w	#0,(Tails_Look_delay_counter).w
	cmpi.b	#AniIDTailsAni_Hang2,anim(a0)
	bne.s	return_1CBC4
	move.b	#AniIDTailsAni_Walk,anim(a0)
 return_1CBC4:
	rts

Comments