; NAME: Lucky Space (1.1)
; GAMES: MP3_USA
; EXECUTION: Direct
; PARAM: Boolean|Timeable

ADDIU SP SP -120
SW RA 116(SP)
SW S0 112(SP)
SW S1 108(SP) 
SW S2 104(SP)
SW S3 100(SP)
SW S4 96(SP) 
SW S5 92(SP) 
SW S6 88(SP)
SW S7 84(SP)
SW FP 80(SP)


; Set Timeable to TRUE so that the wheel can be timed
; Set Timeable to FALSE so that the result is random

JAL PlayMusic
LI A0 112 ; Game Guy Fanfare

JAL PlaySound
LI A0 0x248 ; Crowd Cheering

SW R0 16(SP) ; Parameter 3
SW R0 20(SP) ; Parameter 4
SW R0 24(SP) ; Parameter 5
LI A0 -1 ; Character image (None)
LUI A1 hi(LuckySpace_Message)
ADDIU A1 A1 lo(LuckySpace_Message)
LI A2 0 ; Parameter 1
JAL ShowMessage
LI A3 0 ; Parameter 2

JAL SleepProcess
LI A0 60

JAL 0x800EC9DC
NOP
JAL 0x800EC6C8
NOP
JAL 0x800EC6EC
NOP ; These 3 close the message

JAL GetBoardAudioIndex
NOP

JAL PlayMusic
MOVE A0 V0 ; Play regular music again

JAL GetPlayerStruct
LI A0 -1 
MOVE S4 V0

JAL GetPlayerPlacement ; 0-3 at V0
LBU A0 29(S4) ; Player Index

SLL V0 V0 4 ; Shift bit by 4 

LUI S2 hi(1stPlace_Array)
ADDIU S2 S2 lo(1stPlace_Array)
ADDU S2 S2 V0 ; Add to get correct Array

LUI T3 hi(RouletteOutcomes_Array)
ADDIU T3 T3 lo(RouletteOutcomes_Array)
LI T0 0xFF ; No Chest Index
SB T0 0(T3)
SB T0 1(T3)
SB T0 2(T3)
SB T0 3(T3) ; Make all addresses -1
SB T0 4(T3) 

JAL GetRandomByte
NOP

LI T0 5
DIVU V0 T0 ; Divide by 5
MFHI S6 ; 0-4, where the Roulette highlight will begin
SB S6 72(SP) ; Store this value in case they select Random

LI S0 4 ; Loop Counter
outcomeloop:
BLTZ S0 setuproulette ; exit once all roulette slots are filled
NOP

JAL GetRandomByte ; 0-255 at V0
NOP

LI T0 8 ; 8 Outcomes total
DIVU V0 T0
MFHI V0 ; 0-8 
ADDU T2 S2 V0 ; Add to get correct Array spot
LBU S1 0(T2) ; Index of option to put on Roulette

LI T1 7 ; Item Bag
BNE S1 T1 loadroulettearray ; If it's not an Item Bag, Ignore
NOP
; It is an Item Bag, check item slots
JAL PlayerHasEmptyItemSlot ; -1 if no available slots
LBU A0 29(S4) ; Player Index

BLTZ V0 outcomeloop ; If it's -1, loop back
NOP
; It's not -1, so they have open slots

loadroulettearray:
LUI T3 hi(RouletteOutcomes_Array)
ADDIU T3 T3 lo(RouletteOutcomes_Array)
MOVE S3 T3 ; Copy to S3
LI S7 4 ; Loop Counter
outcomeloop2:
ADDU T5 T3 S7 ; Add loop counter to get Array spot
LB T4 0(T5) ; Current Outcome Index

BLTZ T4 writeonroulette ; If -1, there's nothing here, store it on roulette
NOP
; There's an outcome written here
BEQ T4 S1 outcomeloop ; If it's the same outcome, reroll
NOP
; It's not the same, check next slot
J outcomeloop2
ADDIU S7 S7 -1 ; Subtract from loop counter

writeonroulette:
SB S1 0(T5) ; Write outcome on Array
J outcomeloop
ADDIU S0 S0 -1 ; Subtract 1 from loop counter


setuproulette:
LUI T0 hi(Outcomes_Strings)
ADDIU T0 T0 lo(Outcomes_Strings)
LBU T2 0(S3) ; Load 1st Outcome Index
SLL T1 T2 5 ; Multiply by 20 for alignment
LBU T2 1(S3) ; Load 2nd Outcome Index
SLL T3 T2 5 ; Multiply by 20 for alignment
LBU T2 2(S3) ; Load 3rd Outcome Index
SLL T5 T2 5 ; Multiply by 20 for alignment
ADDU T5 T5 T0
LBU T2 3(S3) ; Load 4th Outcome Index
SLL T7 T2 5 ; Multiply by 20 for alignment
ADDU T7 T7 T0 
LBU T2 4(S3) ; Load 5th Outcome Index
SLL T9 T2 5 ; Multiply by 20 for alignment
ADDU T9 T9 T0 

LUI A0 hi(A_Pointer_With_Enough_Space) 
ADDIU A0 A0 lo(A_Pointer_With_Enough_Space) ; String destination
LUI A1 hi(Roulette_Prompt) 
ADDIU A1 A1 lo(Roulette_Prompt) ; String destination
ADDU A2 T0 T1 ; 1st Outcome String pointer
ADDU A3 T0 T3 ; 2nd Outcome String pointer
SW T5 16(SP) ; 3rd Outcome String pointer
SW T7 20(SP) ; 4th Outcome String pointer
SW T9 24(SP) ; 5th Outcome String pointer
JAL sprintf
SW R0 28(SP) ; Terminator 

LUI A2 hi(Arg1_Pointer)
ADDIU A2 A2 lo(Arg1_Pointer)
LUI A3 hi(Arg2_Pointer)
ADDIU A3 A3 lo(Arg2_Pointer)
LUI T0 hi(Arg3_Pointer)
ADDIU T0 T0 lo(Arg3_Pointer)
SW T0 16(SP) ; A4
LUI T0 hi(Arg4_Pointer)
ADDIU T0 T0 lo(Arg4_Pointer)
SW T0 20(SP) ; A5
LUI T0 hi(Arg5_Pointer)
ADDIU T0 T0 lo(Arg5_Pointer)
SW T0 24(SP)

LUI T6 hi(Arg1_Pointer)
ADDIU T6 T6 lo(Arg1_Pointer)
SLL T8 S6 4 ; Shift by 4 
ADDU T6 T6 T8 ; Add to get correct Array

LI T1 0x21 ; A button
SB T1 0(T6) ; Insert Roulette Highlight

displayroulette:
LI A0 -1 ; Character image (None)
LUI A1 hi(A_Pointer_With_Enough_Space)
ADDIU A1 A1 lo(A_Pointer_With_Enough_Space)
JAL ShowMessage 
NOP
SW A0 76(SP) ; Window ID


LI S0 0 ; Indicator of whether to move the arrow or not 
refreshloop:
BEQZ S0 checkinput ; If 0 don't update, just check controller input
NOP
; It's 1, move the arrow

LUI S1 hi(Arg1_Pointer)
ADDIU S1 S1 lo(Arg1_Pointer)
SLL T8 S6 4 ; Shift by 4 
ADDU T6 S1 T8 ; Add to get correct Array

LI T1 0x24 ; Nothing
SB T1 0(T6) ; Delete Roulette Highlight

ADDIU S6 S6 1 ; Add 1 to Roulette Highlight Index
LI T0 5 
BEQL S6 T0 updateroulettehighlight
MOVE S6 R0 ; Make it 0 if it's 5
; Do not change the Highlight Index

updateroulettehighlight:
SLL T8 S6 4 ; Shift by 4 
ADDU T6 S1 T8 ; Add to get correct Array

LI T1 0x21 ; A Button
SB T1 0(T6) ; Insert Roulette Highlight

LW A0 76(SP) ; Window ID
LUI A1 hi(A_Pointer_With_Enough_Space)
ADDIU A1 A1 lo(A_Pointer_With_Enough_Space)
LI A2 -1
JAL 0x8005B43C
LI A3 -1

JAL PlaySound 
LI A0 0x104 ; Scrolling through Minigame Roulette Sound Index

checkinput:
JAL PlayerIsCPU ; 1 if CPU
LBU A0 29(S4) ; Player Index

BEQZ V0 checkinputbutactually ; It's a human player, ignore
NOP
; It's  CPU
JAL GetRandomByte
NOP

SLTI T5 V0 4 ; ON IF 0-3
BNEZ T5 exitloop ; If 1, the CPU pressed A
NOP
; They didn't press A
J checkinputsleepframe ; Skip Player controller check
NOP

checkinputbutactually:
JAL DetectABInput
LBU A0 29(S4) ; Player Index

BNEZ V0 exitloop ; If 1, they pressed A
NOP 

checkinputsleepframe:
JAL SleepVProcess ; Sleep 1 Frame
NOP 
ADDIU S0 S0 1 ; Add 1 to loop counter
LI T0 2 ; check to make sure it's not 2
BEQL S0 T0 refreshloop
MOVE S0 R0 ; Make it 0 if it's 2
J refreshloop
NOP

exitloop:
LI T0 Timeable ; 1 if Timeable, 0 if Random

BNEZ T0 exitloop2 ; If it's Timeable, continue
NOP
; They selected Random, change the result
LUI S1 hi(Arg1_Pointer)
ADDIU S1 S1 lo(Arg1_Pointer)
SLL T8 S6 4 ; Shift by 4 
ADDU T6 S1 T8 ; Add to get correct Array

LI T1 0x24 ; Nothing
SB T1 0(T6) ; Delete Roulette Highlight


LB S6 72(SP) ; Load the randomized result


SLL T8 S6 4 ; Shift by 4 
ADDU T6 S1 T8 ; Add to get correct Array

LI T1 0x21 ; A Button
SB T1 0(T6) ; Insert Roulette Highlight

LW A0 76(SP) ; Window ID
LUI A1 hi(A_Pointer_With_Enough_Space)
ADDIU A1 A1 lo(A_Pointer_With_Enough_Space)
LI A2 -1
JAL 0x8005B43C
LI A3 -1

JAL PlaySound 
LI A0 0x104 ; Scrolling through Minigame Roulette Sound Index

exitloop2:
JAL PlaySound 
LI A0 0x4FD ; Scrolling through Minigame Roulette Sound Index

JAL SleepProcess
LI A0 45 ; Frames

LBU A0 76(SP) ; Window ID
JAL 0x800EC9DC
NOP
JAL 0x800EC6C8
NOP
JAL 0x800EC6EC
NOP

LUI T0 hi(RouletteOutcomes_Array)
ADDIU T0 T0 lo(RouletteOutcomes_Array)
ADDU T0 T0 S6 ; Add Index of Roulette Option
LBU T1 0(T0) ; Load Index Value

BEQZ T1 giveitem ; Outcome 0 is Get a Mushroom
LI S5 0 ; Mushroom index

LI T0 1
BEQ T0 T1 giveitem ; Outcome 1 is Get a Skeleton Key
LI S5 1 ; Skeleton Key index

LI T0 2
BEQ T0 T1 giveitem ; Outcome 2 is Get a Poison Mushroom
LI S5 2 ; Poison Mushroom index

LI T0 3
BEQ T0 T1 giveitem ; Outcome 3 is Get a Warp Block
LI S5 5 ; Warp Block index

LI T0 4
BEQ T0 T1 giveitem ; Outcome 4 is Get a Dueling Glove
LI S5 8 ; Dueling Glove index

LI T0 5
BEQ T0 T1 giveitem ; Outcome 5 is Get a Lucky Lamp
LI S5 9 ; Lucky Lamp index

LI T0 6
BEQ T0 T1 giveitem ; Outcome 6 is Get a Golden Mushroom
LI S5 10 ; Golden Mushroom index

LI T0 7
BEQ T0 T1 giveitembag ; Outcome 7 is Get an Item Bag
NOP

LI T0 8
BEQ T0 T1 givecoins ; Outcome 8 is Get 2 Coins
LI S5 2 ; Coins

LI T0 9
BEQ T0 T1 givecoins ; Outcome 9 is Get 5 Coins
LI S5 5 ; Coins

LI T0 10
BEQ T0 T1 givecoins ; Outcome 10 is Get 7 Coins
LI S5 7 ; Coins

LI T0 11
BEQ T0 T1 givecoins ; Outcome 11 is Get 10 Coins
LI S5 10 ; Coins

LI T0 12
BEQ T0 T1 givecoins ; Outcome 12 is Get 12 Coins
LI S5 12 ; Coins
; There is no outcome 13, it should never go through here

giveitem:
JAL PlayerHasEmptyItemSlot ; -1 if no space
LBU A0 29(S4) ; Player Index

BLTZ V0 fullonitems ; If they're full on items, prepare prompt to discard item
NOP
;They have space for the item

ADDIU T4 S4 24 ; Item Slot #1
ADDU T4 T4 V0 ; Add to get Empty Item Slot
SB S5 0(T4) ; Store Item

JAL PlaySound
LI A0 25 ; Got Item Sound Index

LBU A0 29(S4) ; Player Index
JAL SetBoardPlayerAnimationWithSound
LI A1 0 ; Happy

J exit
NOP

fullonitems:
LBU T1 24(S4) ; Item 1 Value
LBU T2 25(S4) ; Item 2 Value
LBU T3 26(S4) ; Item 3 Value

LUI T0 hi(Item_Strings)
ADDIU T0 T0 lo(Item_Strings)

SLL T1 T1 0x0005 ; Multiply by 20 for alignment
SLL T2 T2 0x0005 ; Multiply by 20 for alignment
SLL T3 T3 0x0005 ; Multiply by 20 for alignment
ADDU T3 T0 T3
SLL T4, S5, 0x0005 ; Multiply by 20 for alignment
ADDU T4 T0 T4

LUI A0 hi(A_Pointer_With_Enough_Space)
ADDIU A0 A0 lo(A_Pointer_With_Enough_Space)
LUI A1 hi(DeleteItem_Prompt)
ADDIU A1 A1 lo(DeleteItem_Prompt)
ADDU A2 T0 T1 ; Add Item Index to Item string pointer
ADDU A3 T0 T2 ; Add Item Index to Item string pointer
SW T3 16(SP)
SW T4 20(SP)
JAL sprintf
SW R0 24(SP)

promptdisplay:
SW R0 16(SP) ; A4
SW R0 20(SP) ; A5
SW R0 24(SP) ; A6
LI A0 -1 ; Character image (None)
LUI A1 hi(A_Pointer_With_Enough_Space)
ADDIU A1 A1 lo(A_Pointer_With_Enough_Space)
LI A2 0
JAL ShowMessage 
LI A3 0

JAL GetRandomByte ; 0-255 at V0
NOP
LI T0 4
DIVU V0 T0 ; MOD 4

LI A0 2
JAL GetBasicPromptSelection
MFHI A1 ; 0 - 3 passed
MOVE S0 V0 ; S0 now has the chosen option index

JAL 0x800EC9DC
NOP
JAL CloseMessage
NOP
JAL 0x800EC6EC
NOP

; Change the player's destination based on the choice.
BEQL S0 R0 replaceitem
SB S5 24(S4) ; Replace Item 1
LI A0 1
BEQL S0 A0 replaceitem
SB S5 25(S4) ; Replace Item 2
LI A0 2
BEQ S0 A0 replaceitem
SB S5 26(S4) ; Replace Item 3
LI A0 3
BEQ S0 A0 exit
NOP

view_map:
JAL ViewBoardMap
NOP
J fullonitems
NOP

replaceitem:
JAL PlaySound
LI A0 25 ; Got Item Sound Index

LBU A0 29(S4) ; Player Index
JAL SetBoardPlayerAnimationWithSound
LI A1 0 ; Happy

J exit
NOP


givecoins:
LBU A0 29(S4) ; Player Index
JAL AdjustPlayerCoinsGradual
MOVE A1 S5 ; Coins

LBU A0 29(S4) ; Player Index
JAL ShowPlayerCoinChange
MOVE A1 S5 ; Coins

LBU A0 29(S4) ; Player Index
JAL SetBoardPlayerAnimationWithSound
LI A1 0 ; Happy

J exit
NOP

giveitembag:
JAL PlayerHasEmptyItemSlot ; -1 if no space
LBU A0 29(S4) ; Player Index
MOVE S1 V0 
BLTZ V0 itembagcelebrate ; exit when the player can't hold any more items
NOP

JAL GetRandomByte
NOP

LI T0 17 ; Number of items
DIVU V0 T0 ; Divide by 17
MFHI V0 ; 0-16 

ADDIU T1 S4 24 ; Item Slot #1
ADDU T1 T1 S1 ; Add to get Empty Item Slot
SB V0 0(T1) ; Store Item

JAL PlaySound
LI A0 25 ; Got Item Sound Index

JAL SleepProcess
LI A0 20

J giveitembag
NOP

itembagcelebrate:
LBU A0 29(S4) ; Player Index
JAL SetBoardPlayerAnimationWithSound
LI A1 0 ; Happy

J exit
NOP



exit:
LW S0 112(SP)
LW S1 108(SP) 
LW S2 104(SP)
LW S3 100(SP)
LW S4 96(SP) 
LW S5 92(SP) 
LW S6 88(SP)
LW S7 84(SP)
LW FP 80(SP)
LW RA 116(SP)
JR RA
ADDIU SP SP 120



.align 16
Arg1_Pointer:
.byte 0x24

.align 16
Arg2_Pointer:
.byte 0x24

.align 16
Arg3_Pointer:
.byte 0x24

.align 16
Arg4_Pointer:
.byte 0x24

.align 16
Arg5_Pointer:
.byte 0x24

.align 16
RouletteOutcomes_Array:
.byte 0xFF,0xFF,0xFF,0xFF,0xFF

.align 16
1stPlace_Array:
.byte 0,1,2,3,4,5,8,9

.align 16
2ndPlace_Array:
.byte 0,1,2,3,4,5,9,10

.align 16
3rdPlace_Array:
.byte 1,3,4,5,6,7,10,11

.align 16
4thPlace_Array:
.byte 1,3,4,5,6,7,11,12

.align 16
LuckySpace_Message:
.ascii "\x06L \x05U \x03C \x07K \x04Y  \x06S \x05P \x03A \x07C \x04E\x00"

.align 16
Roulette_Prompt:
.ascii "\x0B\x1A\x1A\x0EPress \x21 to stop the wheel\x0A\x0A"
.ascii "\x1A\x1A\x11\x0E" "%s" "\x0E   \x0E\x0A"
.ascii "\x1A\x1A\x12\x0E" "%s" "\x0E   \x0E\x0A"
.ascii "\x1A\x1A\x13\x0E" "%s" "\x0E   \x0E\x0A"
.ascii "\x1A\x1A\x14\x0E" "%s" "\x0E   \x0E\x0A"
.ascii "\x1A\x1A\x15\x0E" "%s" "\x0E   \x0E\x0A\x00"

.align 16
DeleteItem_Prompt:
.byte 0x0B ; Start the message
.ascii "You can"
.byte 0x5C ; Apostrophe (')
.ascii "t carry any more items"
.byte 0xC2 ; Exclamation Mark (!)
.byte 0x0A ; Newline
.ascii "Choose one you"
.byte 0x5C ; Apostrophe (')
.ascii "re willing to throw away"
.byte 0x85 ; .
.byte 0x0A ; Newline
.byte 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A ; Little more for option indent
.byte 0x0C ; Start option
.ascii "%s"
.byte 0x0D ; End option
.byte 0x0A ; Newline
.byte 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A 
.byte 0x0C ; Start option
.ascii "%s"
.byte 0x0D ; End option
.byte 0x0A ; Newline
.byte 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A 
.byte 0x0C ; Start option
.ascii "%s"
.byte 0x0D ; End option
.byte 0x0A ; Newline
.byte 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A 
.byte 0x0C ; Start option
.ascii "%s"
.byte 0x0D ; End option
.byte 0x0A ; Newline
.byte 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A 
.byte 0x0C ; Start option
.ascii "View Map"
.byte 0x0D ; End option
.byte 0


.align 16
A_Pointer_With_Enough_Space:
.fill 0x1024

.align 0x20
Outcomes_Strings:
.asciiz "Get a Mushroom" ; 00
.align 0x20
.asciiz "Get a Skeleton Key" ; 01
.align 0x20
.asciiz "Get a Poison Mushroom" ; 02
.align 0x20
.asciiz "Get a Warp Block" ; 03
.align 0x20
.asciiz "Get a Dueling Glove" ; 04
.align 0x20
.asciiz "Get a Lucky Lamp" ; 05
.align 0x20
.asciiz "Get a Golden Mushroom" ; 06
.align 0x20
.asciiz "Get an Item Bag" ; 07
.align 0x20
.asciiz "Get 2 Coins" ; 08
.align 0x20
.asciiz "Get 5 Coins" ; 9
.align 0x20
.asciiz "Get 7 Coins" ; 10
.align 0x20
.asciiz "Get 10 Coins" ; 11
.align 0x20
.asciiz "Get 12 Coins" ; 12

.align 0x20
Item_Strings:
.asciiz "Mushroom" ; 00
.align 0x20
.asciiz "Skeleton Key" ; 01
.align 0x20
.asciiz "Poison Mushroom" ; 02
.align 0x20
.asciiz "Reverse Mushroom" ; 03
.align 0x20
.asciiz "Cellular Shopper" ; 04
.align 0x20
.asciiz "Warp Block" ; 05
.align 0x20
.asciiz "Plunder Chest" ; 06
.align 0x20
.asciiz "Bowser Phone" ; 07
.align 0x20
.asciiz "Dueling Glove" ; 08
.align 0x20
.asciiz "Lucky Lamp" ; 09
.align 0x20
.asciiz "Golden Mushroom" ; 10
.align 0x20
.asciiz "Boo Bell" ; 11
.align 0x20
.asciiz "Boo Repellant" ; 12
.align 0x20
.asciiz "Bowser Suit" ; 13
.align 0x20
.asciiz "Magic Lamp" ; 14
.align 0x20
.asciiz "Koopa Kard"
.align 0x20
.asciiz "Barter Box"
.align 0x20
.asciiz "Lucky Charm"
.align 0x20
.asciiz "Wacky Watch"
.align 0x20
.asciiz "Item Bag"

.align 16
DetectABInput:
ADDIU SP SP -20
SW RA 16(SP)

LUI T1 hi(p1_controller)
ADDIU T1 T1 lo(p1_controller) ; Load P1's Controller
LI T0 0x38 ; This is the distance between each player's Controller
MULT A0 T0 ;  Multiply Current Player Index by S3
MFLO T0 ; Move the result to S3

ADDU T1 T1 T0 ; Add result to get Current Player's Controller Addr
LBU T0 0(T1) ; Load address value into A1

LUI T1 hi(0x800C9520)
ADDIU T1 T1 lo(0x800C9520) ; Load P1's Button Press Address
LI A2 0x2 ; This is the distance between each player's Button Address
MULT A2 T0 ;  Multiply Controller value by 2
MFLO T0 ; Move the result to S3

ADDU T1 T1 T0 ; Add result to get Current Player's Y Axis
LBU T0 0(T1) ; Load address value into A1

LI T1 0x80
BEQ T0 T1 APress
NOP

NoPress:
LI V0 0
J DetectABInputexit
NOP

APress:
LI V0 1
J DetectABInputexit
NOP

DetectABInputexit:
LW RA 16(SP)
JR RA
ADDIU SP SP 20

; A0 = Player's Index
; A1 = 0 = Happy / 1 = Sad Index
.align 16
SetBoardPlayerAnimationWithSound:
ADDIU SP SP -80
SW RA 76(SP)
SW A0 72(SP)
SW A1 68(SP)

JAL GetPlayerStruct ; Struct Pointer at V0
NOP

LBU T0 3(V0) ; Character Index

BNEZ A1 sad
NOP

happy:
JAL PlaySound
ADDIU A0 T0 0x275 ; Mario's Happy Voice Index + Current Character Index

LW A0 72(SP) ; Player Index
LI A1 5 ; Happy Animation
JAL SetBoardPlayerAnimation
LI A2 0 ; Don't loop

JAL SleepProcess
LI A0 30 ; Frames

J SetBoardAnimationWithSound_exit
NOP

sad:
JAL PlaySound
ADDIU A0 T0 0x287 ; Mario's Sad Voice Index + Current Character Index

LW A0 72(SP) ; Player Index
LI A1 3 ; Despair Animation
JAL SetBoardPlayerAnimation
LI A2 0 ; Don't loop

JAL SleepProcess
LI A0 60 ; Frames

SetBoardAnimationWithSound_exit:
LW A0 72(SP) ; Player Index
LI A1 -1 ; Despair Animation
JAL SetBoardPlayerAnimation
LI A2 2 ; Loop

LW A1 68(SP)
LW A0 72(SP)
LW RA 76(SP)
JR RA
ADDIU SP SP 80