Obtain Gil
Jump to navigation
Jump to search
# ROUTINE: OBTAIN GIL # Adds gil to the player's war funds. Caps at 99999999. # Parameters: # r4 = (gilAmount) Amount of gil to add # Returns: # r2 = New gil total 801207bc: 27bdffe8 addiu r29,r29,-0x0018 801207c0: afb00010 sw r16,0x0010(r29) 801207c4: 00808021 addu r16,r4,r0 # gilAmount 801207c8: afbf0014 sw r31,0x0014(r29) 801207cc: 0c03bc6a jal 0x800ef1a8 # warFunds = Get Script Variable (WORLD.BIN) (0x2c); 801207d0: 3404002c ori r4,r0,0x002c 801207d4: 00508021 addu r16,r2,r16 # newFunds = warFunds + gilAmount 801207d8: 06010002 bgez r16,0x801207e4 801207dc: 3c0205f5 lui r2,0x05f5 # if (newFunds < 0) { 801207e0: 00008021 addu r16,r0,r0 # newFunds = 0 # } 801207e4: 3442e0ff ori r2,r2,0xe0ff 801207e8: 0050102a slt r2,r2,r16 801207ec: 10400003 beq r2,r0,0x801207fc 801207f0: 3404002c ori r4,r0,0x002c # if (newFunds > 99999999) { 801207f4: 3c1005f5 lui r16,0x05f5 801207f8: 3610e0ff ori r16,r16,0xe0ff # newFunds = 99999999 # } 801207fc: 0c03bc97 jal 0x800ef25c # Set Script Variable (WORLD.BIN) (0x2c, newFunds); 80120800: 02002821 addu r5,r16,r0 80120804: 02001021 addu r2,r16,r0 # return newFunds; 80120808: 8fbf0014 lw r31,0x0014(r29) 8012080c: 8fb00010 lw r16,0x0010(r29) 80120810: 27bd0018 addiu r29,r29,0x0018 80120814: 03e00008 jr r31 80120818: 00000000 nop