SHARE
TWEET

Untitled

a guest Jan 24th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; NAME: Space Warp v3 (Airsola™)
  2. ; GAMES: MP3_USA
  3. ; EXECUTION: Direct
  4. ; PARAM: Number|Odds
  5. ; PARAM: Space|Destination
  6. ; PARAM: Space|PreviousSpace
  7. ; PARAM: Space|NextSpace
  8.  
  9. ;====================================================================
  10. ; IMPORTANT: This code is specifically designed to warp a player who
  11. ;            lands on a Space into a Space of the same type.
  12. ;            This is due to limitations on how warps execute.
  13. ;
  14. ;            Destination is where the player will warp to.
  15. ;            PreviousSpace is the space the player will step into if
  16. ;            they go in reverse after the warp.
  17. ;            NextSpace is the next space that the player will step
  18. ;            into if they roll normally.
  19. ;====================================================================
  20.  
  21. ADDIU SP SP -80
  22. SW RA 76(SP)
  23. SW S4 72(SP) ; Current Player's Index
  24. SW S5 68(SP) ; Current Player's Struct
  25.  
  26. ;Odds of hitting check
  27. JAL RNGPercentChance ; Integer at V0
  28. NOP
  29.  
  30. LI A0 Odds
  31. SLT S0 V0 A0
  32. NOP
  33. BNE S0 R0   exit
  34. NOP
  35.  
  36. ;FADE-OUT START------------------------------------------------------
  37. LI A0 4 ; Happening Space Fade-out
  38. JAL InitFadeOut
  39. LI A1 16 ; Fade Out for 16 Frames
  40.  
  41. JAL SleepProcess
  42. LI A0 16 ; Sleep 16 Frames
  43. ;FADE-OUT END--------------------------------------------------------
  44.  
  45. JAL PlaySadVoice ; Plays Current Player Character's Scream
  46. NOP
  47.  
  48. JAL SleepVProcess
  49. NOP
  50.  
  51. ;WARP START----------------------------------------------------------
  52. JAL GetCurrentPlayerIndex ; Player Index located at V0
  53. NOP
  54. MOVE S4 V0 ; Copy Current Player's Index to S4
  55.  
  56. MOVE A0 S4 ; Assigns Current Player Index to A0
  57. LI A1 Destination_chain_index ; Assigns Chain Index to A1
  58. JAL SetPlayerOntoChain
  59. LI A2 Destination_chain_space_index ; Assigns Space Index to A2
  60.  
  61. MOVE A0 S4 ; Assigns Current Player Index to A0
  62. LI A1 PreviousSpace_chain_index ; Assigns Chain Index to A1
  63. JAL SetPrevChainAndSpace
  64. LI A2 PreviousSpace_chain_space_index ; Assigns Space Index to A2
  65.  
  66. MOVE A0 S4 ; Assigns Current Player Index to A0
  67. LI A1 NextSpace_chain_index ; Assigns Chain Index to A1
  68. JAL SetNextChainAndSpace
  69. LI A2 NextSpace_chain_space_index ; Assigns Space Index to A2
  70.  
  71. JAL GetPlayerStruct ; Player Struct at V0
  72. LI A0 -1 ; Current Player
  73. MOVE S5 V0
  74.  
  75. LI A0 Destination_chain_index
  76. JAL GetAbsSpaceIndexFromChainSpaceIndex ; Gets True Space Index at V0
  77. LI A1 Destination_chain_space_index
  78.  
  79. JAL GetSpaceData ; Pointer to Space Data at V0
  80. MOVE A0 V0 ; True Space Index
  81.  
  82. ADDIU V0 V0 8 ; This gets the X pos of the space
  83. LW V1 0(V0)
  84. MOVE T0 V1 ; Copy to T0
  85.  
  86. ADDIU V0 V0 8 ; This gets the Y pos of the space
  87. LW V1 0(V0)
  88. MOVE T1 V1 ; Copy to T1
  89.  
  90. LI T2 0x41200000 ; Float value for 10?
  91. MTC1 T2 F0 ; Move Float to F1?
  92. MTC1 T1 F1 ; Move Space Y Pos float to F1?
  93. ADD.S F0 F0 F1 ; Add the floats for maximum floatiness
  94. MFC1 T1 F0 ; Move total to T1?
  95.  
  96. LW V1 0x24(S5) ; Load Offset 24 into V1
  97. ADDIU V1 V1 0xC ; Add 0xC to get current player's X Coords
  98. SW T0 0(V1)
  99.  
  100. ADDIU V1 V1 8 ; This should load current player's Y Coords
  101. SW T1 0(V1)
  102. ;WARP END------------------------------------------------------------
  103.  
  104. ;SOUND START---------------------------------------------------------
  105. ; Use the Audio Player on PP64 to find other sound indexes to use
  106. ; Then use the following link to know what Sound Index you need
  107. ; https://pastebin.com/H1jxNFqr
  108. JAL PlaySound
  109. LI A0 0x107 ; Warp Block Sound Index
  110.  
  111. JAL SleepProcess
  112. LI A0 15 ; Number of frames the game waits for sound to finish
  113.  
  114. JAL PlaySound
  115. LI A0 0x107 ; Warp Block Sound Index
  116.  
  117. JAL SleepProcess
  118. LI A0 15 ; Number of frames the game waits for sound to finish
  119. ;SOUND END-----------------------------------------------------------
  120.  
  121. ;FADE-IN START-------------------------------------------------------
  122. LI A0 4 ; Happening Space Fade-in
  123. JAL InitFadeIn
  124. LI A1 16 ; 16 Frames of Fade-in
  125.  
  126. JAL SleepProcess
  127. LI A0 31 ; Sleep for 31 Frames
  128. ;FADE-IN END---------------------------------------------------------
  129.  
  130. ;MESSAGE DISPLAY START-----------------------------------------------
  131. SW R0 16(SP) ; A4
  132. SW R0 20(SP) ; A5
  133. SW R0 24(SP) ; A6
  134. LI A0 -1 ; Character image (-1 for none)
  135. ; Visit the following link to get the full list of Character Images
  136. ; https://github.com/PartyPlanner64/PartyPlanner64/wiki/Displaying-Messages
  137. ; If you use a character image, check the bottom of the code
  138. LUI A1 hi(Message)
  139. ADDIU A1 A1 lo(Message) ; This loads "Message" into the Textbox
  140. LI A2 0x0
  141. JAL ShowMessage
  142. LI A3 0x0
  143.  
  144. JAL CloseMessage
  145. NOP
  146. ;MESSAGE DISPLAY END-------------------------------------------------
  147.  
  148. exit:
  149. LW RA 76(SP)
  150. LW S4 72(SP)
  151. LW S5 68(SP)
  152. JR RA
  153. ADDIU SP SP 80
  154.  
  155. ; .ascii is used to output Text. Anything surrounded by " will be
  156. ; displayed in the message (Special characters are not included).
  157. ; For those, you must use .byte and the respective byte value.
  158. ; Bytes that change text color will change the color of everything
  159. ; that is written after it, until another color is used.
  160.  
  161. .align 16
  162. Message:
  163. .ascii "You"
  164. .byte 0x5C ; Apostrophe (')
  165. .ascii "ve been warped to another space"
  166. .byte 0xC2 ; Exclamation Mark (!)
  167. .byte 0xFF,0 ; FF=Pause (THIS ALWAYS GOES AT THE END)
  168.  
  169. ; Here's a list of the most common bytes you'll need
  170. ; .byte 0x01 ; Black Font
  171. ; .byte 0x03 ; Red Font
  172. ; .byte 0x04 ; Purple Font
  173. ; .byte 0x05 ; Green Font
  174. ; .byte 0x06 ; Blue font
  175. ; .byte 0x07 ; Yellow Font
  176. ; .byte 0x08 ; White Font
  177. ; .byte 0x85 ; Period (.)
  178. ; .byte 0xC2 ; Exclamation Mark (!)
  179. ; .byte 0xC3 ; Question Mark (?)
  180. ; .byte 0x82 ; Comma (,)
  181. ; .byte 0x0A ; New Line (Writes Below)
  182. ; .byte 0x5C ; Apostrophe (')
  183. ; .byte 0x29 ; Coin icon
  184. ; .byte 0x3D ; - (minus)
  185. ; .byte 0x3E ; x (multiply)
  186. ; .byte 0xFF,0 ; FF=Pause
  187.  
  188. ; If your message has an image, use this at the start of each line
  189. ; .byte 0x1A,0x1A,0x1A,0x1A ; Padding for picture
  190.  
  191. .align 4
  192. PlaySadVoice:
  193. ADDIU SP SP -32
  194. SW RA 28(SP)
  195.  
  196. JAL GetCurrentPlayerIndex
  197. NOP
  198.  
  199. LUI T1 hi(p1_char)
  200. ADDIU T1 T1 lo(p1_char) ; Load Player 1's Character address
  201. LI T0 0x38 ; Distance between each player's Character address
  202. MULT V0 T0 ;  Multiply Current Player Index by T0
  203. MFLO T0 ; Move the result to T0
  204.  
  205. ADDU T1 T1 T0 ; Add result to get current Player's Character address
  206. LBU T0 0(T1) ; Load address value into T0
  207.  
  208. ADDIU V0 T0 0x287 ; Mario's Sad Voice Index
  209.  
  210. JAL PlaySound
  211. MOVE A0 V0 ; Pass the Voice Index to A0
  212.  
  213. LW RA 28(SP)
  214. JR RA
  215. ADDIU SP SP 32
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top