SluggishShroom

Untitled

Feb 16th, 2020
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; NAME: Bowser Star Bank (Landing)
  2. ; GAMES: MP3_USA
  3. ; EXECUTION: Direct
  4. ; PARAM: Space|CurrentSpace
  5.  
  6. ;====================================================================
  7. ; IMPORTANT: This code is specifically designed to take a passing
  8. ; player's star and add it to the bank
  9. ;===================================================================
  10.  
  11. ADDIU SP SP -96
  12. SW RA 76(SP)
  13. SW S1 72(SP) ; Current Player's Star Address
  14. SW S0 64(SP) ; Message to load
  15. SW S4 60(SP) ; Current Player's Indeed
  16. SW S3 56(SP) ; Flag to exit if full
  17. SW S2 52(SP) ; Star Debt
  18. SW S5 88(SP) ; Hold1
  19. SW S6 80(SP) ; Hold2
  20.  
  21. JAL RNGPercentChance
  22. LI A0 100
  23.  
  24. BNE V0 R0 hit
  25. NOP
  26. J exit
  27. NOP
  28. hit:
  29.  
  30. .align 0x10
  31.  
  32. LI S3 0 ; Exit = False
  33.  
  34. LI A0 -1 ; Current Player
  35. LI A1 -1 ; Animation Index (Idle)
  36. JAL SetBoardPlayerAnimation
  37. LI A2 2 ; Loop Animation
  38.  
  39. JAL GetCurrentPlayerIndex ; Current Player's Index at V0
  40. NOP
  41. MOVE S4 V0 ; Copy Current Player Index to S4
  42.  
  43. LUI S1 hi(p1_stars)
  44. ADDIU S1 S1 lo(p1_stars) ; Load Player 1's Star Address
  45. LI T0 0x38 ; This is the distance between each player's Star Address
  46. MULT S4 T0 ; Multiply Current Player Index by T0
  47. MFLO T0 ; Move the result to T0
  48. ADDU S1 S1 T0 ; Add result to get current Player's Star Address
  49. LBU T1 0(S1) ; Load address value into T1
  50.  
  51. ;CHECK PLAYER'S STAR COUNT===========================================
  52. LI T2 0 ; Make sure someone with 0 stars is ignored
  53. BEQ T2 T1 TooManyStars
  54. NOP
  55. ;CHECK PLAYER'S STAR COUNT===========================================
  56.  
  57. LUI S2 hi(0x800CD0A0) ; This part is to load star debt
  58. ADDIU S2 S2 lo(0x800CD0A0) ; Load Address of Board-Specific RAM
  59. LBU S5 0(S2) ; Load the Bank Value into S5
  60.  
  61. SLT t2, t1, s5 ;if player stars < bank, t2 = 1
  62. BEQZ t2, BankIsGreaterOrEqual
  63. NOP
  64. ADD T1 R0 S6
  65. BankIsGreaterOrEqual:
  66. ADD S2 R0 S6
  67.  
  68. LUI A0 hi(coin_string_loc)
  69. ADDIU A0 A0 lo(coin_string_loc)
  70. LUI A1 hi(percent_d)
  71. ADDIU A1 A1 lo(percent_d)
  72. JAL sprintf
  73. MOVE A2 S5 ; Copy Bank Total Value into A2
  74. ADD A3 R0 R0
  75.  
  76.  
  77.  
  78. LUI S0 hi(GotStar_Message)
  79. ADDIU S0 S0 lo(GotStar_Message)
  80. J MessageSetup
  81. NOP
  82.  
  83. TooManyStars:
  84. LUI S0 hi(TooManyStars_Message)
  85. ADDIU S0 S0 lo(TooManyStars_Message)
  86. LI S3 1 ; Exit = TRUE
  87.  
  88.  
  89. ;GOT STAR MESSAGE DISPLAY START--------------------------------------
  90. MessageSetup:
  91. SW R0 16(SP) ; A4
  92. SW R0 20(SP) ; A5
  93. SW R0 24(SP) ; A6
  94. LI A0 -1 ; Character image (-1 for none)
  95. MOVE A1 S0 ; Pass message pointer to A1
  96. LUI A2 hi(coin_string_loc)
  97. ADDIU A2 A2 lo(coin_string_loc)
  98. JAL ShowMessage
  99. LI A3 0x0
  100.  
  101. JAL 0x800EC9DC
  102. NOP
  103. JAL 0x800EC6C8
  104. NOP
  105. JAL 0x800EC6EC
  106. NOP
  107.  
  108. BNE S3 R0 exit
  109. NOP
  110. ;GOT STAR MESSAGE DISPLAY END----------------------------------------
  111.  
  112. ;GIVE STAR START-----------------------------------------------------
  113. LB T2 0(S1) ; Load Player's Star count into S2
  114. ADDU T2 T2 S6 ; Minus their Star count
  115.  
  116. SB T2 0(S1) ; Insert new Star count into the address
  117. ;GIVE STAR END-------------------------------------------------------
  118.  
  119. ;SOUND START---------------------------------------------------------
  120. LI A0 CurrentSpace_chain_index
  121. JAL GetAbsSpaceIndexFromChainSpaceIndex ; Current Space Index at V0
  122. LI A1 CurrentSpace_chain_space_index
  123.  
  124. LI A0 -1 ; Current Player's Index
  125. LI A1 1 ; Frames it takes to turn
  126. JAL 0x800ED20C ; RotatePlayerModel
  127. MOVE A2 V0 ; Space Index to face towards
  128.  
  129. LI A0 -1 ; Current Player
  130. LI A1 3 ; Animation Index (Star Get Dance)
  131. JAL SetBoardPlayerAnimation
  132. LI A2 0 ; Loop Animation
  133.  
  134. JAL PlayMusic
  135. LI A0 113 ; Sad Jingle
  136.  
  137. .align 4
  138.  
  139. JAL GetPlayerStruct
  140. LI A0 -1
  141.  
  142. LBU T0 3(V0)
  143. JAL PlaySound
  144. ADDIU A0 T0 0x287 ; Mario's Despair Index
  145.  
  146. JAL SleepProcess
  147. LI A0 110 ; Number of frames the game waits for sound to finish
  148.  
  149. JAL GetBoardAudioIndex ; Original Board Audio Index at V0
  150. NOP
  151. JAL PlayMusic
  152. MOVE A0 V0
  153. ;SOUND END-----------------------------------------------------------
  154.  
  155. SB S5 0(S2)
  156.  
  157.  
  158. exit:
  159. LW RA 76(SP)
  160. LW S1 72(SP) ; Current Player's Star Address
  161. LW S0 64(SP) ; Message to load
  162. LW S4 60(SP) ; Current Player's Indeed
  163. LW S3 56(SP) ; Flag to exit if full
  164. LW S2 52(SP) ; Star Debt
  165. LW S5 88(SP) ; Hold1
  166. LW S6 80(SP) ; Hold2
  167. JR RA
  168. ADDIU SP SP 96
  169.  
  170. ; .ascii is used to output Text. Anything surrounded by " will be
  171. ; displayed in the message (Special characters are not included).
  172. ; For those, you must use .byte and the respective byte value.
  173. ; Bytes that change text color will change the color of everything
  174. ; that is written after it, until another color is used.
  175.  
  176. percent_d:
  177. .asciiz "%d" ; 0x25640000
  178.  
  179. coin_string_loc:
  180. .fill 8
  181.  
  182.  
  183. .align 16
  184. GotStar_Message:
  185. .ascii "The debt of "
  186. .byte 0x03 ; Red Font
  187. .byte 0x11 ; Coin Amount String
  188. .byte 0x07 ; Yellow Font
  189. .ascii " Stars "
  190. .byte 0x08 ; White Font
  191. .ascii "is now due"
  192. .byte 0xC2 ; Exclamation Mark (!)
  193. .byte 0xFF,0 ; FF=Pause
  194. .byte 0xFF,0 ; FF=Pause
  195.  
  196. .align 16
  197. TooManyStars_Message:
  198. .ascii "You have no Stars"
  199. .byte 0x0A ; New Line (Writes Below)
  200. .ascii "so you can"
  201. .byte 0x5C ; Apostrophe (')
  202. .ascii "t lose any more"
  203. .byte 0x85 ; Period (.)
  204. .byte 0xFF,0 ; FF=Pause
  205.  
  206. PlaySadVoice:
  207. ADDIU SP SP -32
  208. SW RA 28(SP)
  209.  
  210. JAL GetCurrentPlayerIndex
  211. NOP
  212.  
  213. LUI T1 hi(p1_char)
  214. ADDIU T1 T1 lo(p1_char) ; Load Player 1's Character address
  215. LI T0 0x38 ; Distance between each player's Character address
  216. MULT V0 T0 ; Multiply Current Player Index by T0
  217. MFLO T0 ; Move the result to T0
  218.  
  219. ADDU T1 T1 T0 ; Add result to get current Player's Character address
  220. LBU T0 0(T1) ; Load address value into T0
  221.  
  222. ADDIU V0 T0 0x287 ; Mario's Star Get Voice Index
  223.  
  224. JAL PlaySound
  225. MOVE A0 V0 ; Pass the Voice Index to A0
  226.  
  227. LW RA 28(SP)
  228. JR RA
  229. ADDIU SP SP 32
  230.  
  231. ; Here's a list of the most common bytes you'll need
  232. ; .byte 0x01 ; Black Font
  233. ; .byte 0x03 ; Red Font
  234. ; .byte 0x04 ; Purple Font
  235. ; .byte 0x05 ; Green Font
  236. ; .byte 0x06 ; Blue font
  237. ; .byte 0x07 ; Yellow Font
  238. ; .byte 0x08 ; White Font
  239. ; .byte 0x85 ; Period (.)
  240. ; .byte 0xC2 ; Exclamation Mark (!)
  241. ; .byte 0xC3 ; Question Mark (?)
  242. ; .byte 0x82 ; Comma (,)
  243. ; .byte 0x0A ; New Line (Writes Below)
  244. ; .byte 0x5C ; Apostrophe (')
  245. ; .byte 0x29 ; Coin icon
  246. ; .byte 0x3D ; - (minus)
  247. ; .byte 0x3E ; x (multiply)
  248. ; .byte 0xFF,0 ; FF=Pause
  249.  
  250. ; If your message has an image, use this at the start of each line
  251. ; .byte 0x1A,0x1A,0x1A,0x1A ; Padding for picture
RAW Paste Data