ThomasSpeedrunner

Tails Flying Code v2

Apr 25th, 2013
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. ; Actual flight routine itself...
  2. ; ---------------------------------------------------------------------------
  3. ; Subroutine to check if Tails wants to begin flying mid-jump
  4. ; ---------------------------------------------------------------------------
  5. Tails_CheckFlight: ; in this ability routine, a0 = Tails
  6. btst #0,flight_property(a0) ; are we already flying?
  7. beq.s Tails_UpdateFlight ; if yes, update Tails' flight
  8.  
  9. tst.b (Two_player_mode).w ; are we in two player mode?
  10. bne.w + ; if so, skip the following check
  11.  
  12. cmpa.w #MainCharacter,a0 ; is Tails the main character?
  13. bne.w return_1C83D ; if not, return
  14. +
  15. cmpi.b #1,jumping(a0) ; are we jumping?
  16. bne.w return_1C83D ; if not, return
  17.  
  18. move.b (Ctrl_1_Press_Logical).w,d0
  19. andi.b #button_B_mask|button_C_mask,d0 ; is B or C pressed?
  20. beq.w return_1C83D ; if not, branch
  21. ; if all of these conditions are met, do the following:
  22. move.b #AniIDTailsAni_Fly,anim(a0) ; begin flying
  23. move.b #$4B,flight_time(a0) ; set the amount of time Tails can fly for (this is needed later, in Tails_FlyingSwimming)
  24. move.w #$C,y_vel(a0) ; set Tails' y-velocity to something reasonable (again, needed later, in Tails_FlyingSwimming)
  25. bset #1,flight_property(a0) ; tell the game that Tails is flying
  26. 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
  27.  
  28. return_1C83D:
  29. rts
  30.  
  31. ; ---------------------------------------------------------------------------
  32. ; Subroutine doing the extra logic for Tails' flight
  33. ; ---------------------------------------------------------------------------
  34. Tails_FlyingSwimming:
  35. moveq #0,d0
  36. move.b ($FFFFFE05).w,d0
  37. andi.b #7,d0
  38. bne.s ++
  39. subq.b #1,flight_time(a0)
  40. bne.s ++
  41. btst #2,flight_property(a0) ; Did we already tell the game that Tails is tired?
  42. bne.s + ; If so, don't tell it again, since that's completely pointless.
  43. bset #2,flight_property(a0) ; If we haven't yet, tell the game that Tails is tired.
  44. +
  45. moveq #0,d0
  46. move.b ($FFFFFE05).w,d0
  47. andi.b #3,d0
  48. bne.s +
  49. addq.w #1,y_vel(a0)
  50. +
  51. rts
  52.  
  53. ; ...and the altered Tails_ResetOnFloor_Part3 to fix some issues.
  54. Tails_ResetOnFloor_Part3:
  55. bclr #1,status(a0)
  56. bclr #5,status(a0)
  57. bclr #4,status(a0)
  58. move.b #0,jumping(a0)
  59. move.w #0,(Chain_Bonus_counter).w
  60. move.b #0,flip_angle(a0)
  61. move.b #0,flip_turned(a0)
  62. move.b #0,flips_remaining(a0)
  63. btst #0,flight_property(a0) ; Test the not-flying bit...
  64. bne.s + ; ...and if we didn't fly since the last time we hit the floor, skip the flying section
  65. ; Section for Tails' flight:
  66. move.b #0,flight_time(a0) ; Reset our flight time...
  67. bclr #1,flight_property(a0) ; ...clear the flying bit...
  68. bclr #2,flight_property(a0) ; ...clear the tired-while-flying bit...
  69. bset #0,flight_property(a0) ; ...and set the not-flying bit.
  70. + ; Rest of original subroutine:
  71. move.w #0,(Tails_Look_delay_counter).w
  72. cmpi.b #AniIDTailsAni_Hang2,anim(a0)
  73. bne.s return_1CBC4
  74. move.b #AniIDTailsAni_Walk,anim(a0)
  75.  
  76. return_1CBC4:
  77. rts
Advertisement
Add Comment
Please, Sign In to add comment