Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ---------------------------------------------------------------------------
- ; Subroutine to check if Tails wants to fly
- ; ---------------------------------------------------------------------------
- ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
- Tails_CheckFlight:
- cmpi.b #1,jumping(a0) ; Is Tails jumping?
- bne.w Tails_NoFly ; If not, don't bother with checking for flying.
- moveq #0,d0 ; Quickly clear d0.
- move.b (Ctrl_1_Press_Logical).w,d0 ; Read the first controller port.
- andi.b #$30,d0 ; Is B or C pressed?
- beq.w Tails_NoFly ; If not, return.
- addq.l #4,sp ; Cause the 68k to force-skip any routines called after this one in Tails_MdJump.
- bclr #2,status(a0) ; Clear the "rolling" status bit.
- bclr #4,status(a0) ; Clear the "rolljumping" status bit.
- move.b #$F,y_radius(a0) ; this sets Tails' collision height (2*pixels) to less than Sonic's height
- move.b #9,x_radius(a0)
- move.b #0,jumping(a0) ; Clear Tails' jumping flag.
- move.b #$20,anim(a0) ; Tell Tails to use his flying animation.
- move.b #1,double_jump_flag(a0) ; Tell the game that Tails is flying.
- btst #6,status(a0) ; Hold it! Is Tails underwater?
- beq.w Tails_StartFlying_NotUnderWater ; If not, branch.
- move.b #3,double_jump_flag(a0) ; If he is, well, TELL THE GAME THAT, DAMNIT.
- Tails_StartFlying_NotUnderWater:
- move.b #60,double_jump_meaning(a0) ; Set Tails' total flight time.
- Tails_NoFly:
- rts
- ; End of subroutine Tails_CheckFlight
- ; ---------------------------------------------------------------------------
- ; Subroutine to do flight logic for Tails
- ; ---------------------------------------------------------------------------
- ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
- Tails_DoFlightLogic:
- tst.b double_jump_flag(a0) ; Is Tails flying?
- beq.w Tails_FlightLogic_Done ; Nope? Well then, skip over this whole thing.
- move.b ($FFFFFE05).w,d0 ; Get the current frame number...I think.
- andi.b #9,d0 ; Are we on a frame that's a multiple of 10?
- bne.w + ; No? BRANCH.
- tst.b double_jump_meaning(a0) ; Is Tails already tired?
- beq.w + ; If he is, branch.
- subq.b #1,double_jump_meaning(a0) ; Subtract 1 from Tails' total flight time if we are.
- bne.w + ; If he still has flight time remaining, branch.
- move.b #2,double_jump_flag(a0) ; So Tails is tired? Well, tell the game that.
- btst #6,status(a0) ; Is Tails underwater?
- beq.w + ; If not, branch.
- move.b #4,double_jump_flag(a0) ; If he is, remind the game that he is.
- +
- jsr (ObjectMove).l
- moveq #0,d0 ; Quickly clear d0.
- move.w #$10,d0 ; Prepare to add 16 to Tails' vertical velocity.
- btst #6,status(a0) ; Is Tails underwater?
- beq.w + ; If not, branch.
- subi.w #6,d0 ; If he is, remind the game that 3/8 of flight/swimming gravity does not apply when Tails is underwater.
- +
- cmpi.b #1,(Reverse_Gravity_Flag).w ; Is reverse gravity activated?
- bne.w + ; If not, branch.
- neg.w d0 ; If yes, negate d0.
- +
- add.w d0,y_vel(a0)
- moveq #0,d0 ; Quickly clear d0.
- move.b (Ctrl_1_Held_Logical).w,d0 ; Read the first controller port.
- andi.b #$30,d0 ; Is B or C pressed?
- beq.w Tails_FlightLogic_PrepareAnim ; If not, branch.
- tst.b double_jump_meaning(a0) ; Is Tails already tired?
- beq.w Tails_FlightLogic_PrepareAnim ; If he is, branch.
- cmpi.w #-$100,y_vel(a0) ; Is Tails' vertical velocity faster than -$100?
- blt.w Tails_FlightLogic_PrepareAnim ; If it is, branch.
- subi.w #$1F,y_vel(a0) ; Else, accelerate Tails upwards.
- Tails_FlightLogic_PrepareAnim:
- move.b #$20,(Next_Flight_Anim).w ; Plan to use "flying" animation.
- btst #6,status(a0) ; Is Tails underwater?
- beq.w Tails_FlightLogic_CorrectAni_CheckTired ; If not, branch.
- move.b #$21,(Next_Flight_Anim).w ; Plan to use "swimming" animation.
- Tails_FlightLogic_CorrectAni_CheckTired:
- tst.b double_jump_meaning(a0) ; Is Tails tired?
- bne.w Tails_FlightLogic_CompareAnims ; If not, branch.
- move.b #$22,(Next_Flight_Anim).w ; Plan to use "tired while flying" animation.
- btst #6,status(a0) ; Is Tails underwater?
- beq.w Tails_FlightLogic_CompareAnims ; If not, branch.
- move.b #$23,(Next_Flight_Anim).w ; Plan to use "tired while swimming" animation.
- Tails_FlightLogic_CompareAnims:
- moveq #0,d0 ; Quickly clear d0.
- moveq #0,d1 ; Quickly clear d1.
- move.b (Next_Flight_Anim).w,d0
- move.b anim(a0),d1
- cmp.b d0,d1 ; Are the two anims identical?
- beq.w Tails_FlightLogic_PlayFlyingSound ; If they are, branch.
- move.b (Next_Flight_Anim).w,anim(a0) ; Otherwise, set Tails' animation to the flight animation.
- Tails_FlightLogic_PlayFlyingSound:
- move.b ($FFFFFE05).w,d0 ; Get the current frame number...I think.
- andi.b #9,d0 ; Are we on a frame that's a multiple of 10?
- bne.w Tails_FlightLogic_Done ; No? BRANCH.
- move.w #$F1,d0 ; Prepare to play "flying" SFX.
- tst.b double_jump_meaning(a0) ; Is Tails tired?
- bne.w + ; If not, branch.
- move.w #$F2,d0 ; Prepare to play "tired while flying" SFX.
- +
- jsr (PlaySound).l
- Tails_FlightLogic_Done:
- rts
- ; End of subroutine Tails_DoFlightLogic
Advertisement
Add Comment
Please, Sign In to add comment