ThomasSpeedrunner

Tails Flying Code v3

Apr 28th, 2013
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. ; ---------------------------------------------------------------------------
  2. ; Subroutine to check if Tails wants to begin flying mid-jump
  3. ; ---------------------------------------------------------------------------
  4. Tails_CheckFlight:
  5. btst #1,flight_property(a0) ; are we flying?
  6. bne.s Tails_FlyingSwimming ; if yes, branch to the subroutine handling Tails' flight logic
  7. btst #2,flight_property(a0) ; are we tired while flying?
  8. bne.s Tails_FlyingSwimming ; if yes, branch to the subroutine handling Tails' flight logic
  9.  
  10. tst.b (Two_player_mode).w ; are we in two player mode?
  11. bne.w + ; if so, skip the following check
  12.  
  13. cmpa.w #MainCharacter,a0 ; is Tails the main character?
  14. bne.w return_1C83D ; if not, return
  15. +
  16. cmpi.b #1,jumping(a0) ; are we jumping?
  17. bne.w return_1C83D ; if not, return
  18.  
  19. move.b (Ctrl_1_Press_Logical).w,d0
  20. andi.b #button_B_mask|button_C_mask,d0 ; is B or C pressed?
  21. beq.w return_1C83D ; if not, return
  22. ; if all of these conditions are met, do the following:
  23. move.b #AniIDTailsAni_Fly,anim(a0) ; begin flying
  24. move.b #$4B,flight_time(a0) ; set the amount of time Tails can fly for (this is needed later, in Tails_FlyingSwimming)
  25. move.w #$C,y_vel(a0) ; set Tails' y-velocity to something reasonable (again, needed later, in Tails_FlyingSwimming)
  26. bset #1,flight_property(a0) ; tell the game that Tails is flying (part 1)
  27. bclr #0,flight_property(a0) ; tell the game that Tails is flying (part 2)
  28.  
  29. return_1C83D:
  30. rts
  31.  
  32. ; ---------------------------------------------------------------------------
  33. ; Subroutine doing the extra logic for Tails' flight
  34. ; ---------------------------------------------------------------------------
  35. Tails_FlyingSwimming:
  36. jsr (ObjectMove).l
  37. addi.w #5,y_vel(a0)
  38.  
  39. moveq #0,d0
  40. move.b ($FFFFFE05).w,d0
  41. andi.b #9,d0
  42. bne.s +
  43. subq.b #1,flight_time(a0)
  44. bne.s +
  45. btst #2,flight_property(a0) ; Did we already tell the game that Tails is tired?
  46. bne.s + ; If so, don't keep telling it, since that's completely pointless and just wastes CPU cycles.
  47. bset #2,flight_property(a0) ; If we haven't yet, tell the game that Tails is tired.
  48. +
  49. rts
Advertisement
Add Comment
Please, Sign In to add comment