Throw Determination Routine

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
0011Acdc: 27bdff10 addiu r29,r29,-0x00f0
0011Ace0: afb100cc sw r17,0x00cc(r29)
0011Ace4: 00808821 addu r17,r4,r0
0011Ace8: afb400d8 sw r20,0x00d8(r29)
0011Acec: 00c0a021 addu r20,r6,r0
0011Acf0: afb500dc sw r21,0x00dc(r29)
0011Acf4: 0000a821 addu r21,r0,r0
0011Acf8: afb000c8 sw r16,0x00c8(r29)
0011Acfc: 00a08021 addu r16,r5,r0
0011Ad00: afbf00e8 sw r31,0x00e8(r29)
0011Ad04: afb700e4 sw r23,0x00e4(r29)
0011Ad08: afb600e0 sw r22,0x00e0(r29)
0011Ad0c: afb300d4 sw r19,0x00d4(r29)
0011Ad10: 0c060435 jal 0x001810d4      //r2 = Address of Unit RAM
0011Ad14: afb200d0 sw r18,0x00d0(r29)
0011Ad18: 0040b021 addu r22,r2,r0
0011Ad1c: 16c00003 bne r22,r0,0x 0011Ad2c
0011Ad20: 320300ff andi r3,r16,0x00ff
0011Ad24: 080607b0 j 0x00181ec0           //If address is zero, GOTO END
0011Ad28: 00001021 addu r2,r0,r0
0011Ad2c: 34020014 ori r2,r0,0x0014
0011Ad30: 14620010 bne r3,r2,0x 0011Ad74   //If r16 isn't 0x14, store r2 = 0xFF and GOTO END
0011Ad34: 340200ff ori r2,r0,0x00ff
0011Ad38: 02202021 addu r4,r17,r0
0011Ad3c: 34050014 ori r5,r0,0x0014
0011Ad40: 27a60020 addiu r6,r29,0x0020
0011Ad44: 27a20078 addiu r2,r29,0x0078
0011Ad48: afa20010 sw r2,0x0010(r29)
0011Ad4c: 27a20090 addiu r2,r29,0x0090
0011Ad50: afa20018 sw r2,0x0018(r29)
0011Ad54: 27a200a8 addiu r2,r29,0x00a8
0011Ad58: 27a70060 addiu r7,r29,0x0060
0011Ad5c: afa00014 sw r0,0x0014(r29)
0011Ad60: 0c0605f0 jal 0x001817c0
0011Ad64: afa2001c sw r2,0x001c(r29)
0011Ad68: 00409021 addu r18,r2,r0
0011Ad6c: 16400004 bne r18,r0,0x 0011Ad80
0011Ad70: 340200ff ori r2,r0,0x00ff
0011Ad74: a2820000 sb r2,0x0000(r20)
0011Ad78: 080607b0 j 0x00181ec0
0011Ad7c: 00001021 addu r2,r0,r0
0011Ad80: 02b2102a slt r2,r21,r18
0011Ad84: 10400018 beq r2,r0,0x 0011Ade8
0011Ad88: 00008821 addu r17,r0,r0
0011Ad8c: 3407fe82 ori r7,r0,-0x017e
0011Ad90: 3c068006 lui r6,0x8006
0011Ad94: 24c61020 addiu r6,r6,0x1020
0011Ad98: 27a50048 addiu r5,r29,0x0048
0011Ad9c: 27a40020 addiu r4,r29,0x0020
0011Ada0: 94830000 lhu r3,0x0000(r4)
0011Ada4: 00000000 nop
0011Ada8: 00671021 addu r2,r3,r7
0011Adac: 3042ffff andi r2,r2,-0x0001
0011Adb0: 2c42000c sltiu r2,r2,0x000c
0011Adb4: 10400008 beq r2,r0,0x 0011Add8
0011Adb8: 24840002 addiu r4,r4,0x0002
0011Adbc: 2462fe82 addiu r2,r3,-0x017e
0011Adc0: 00021400 sll r2,r2,0x10
0011Adc4: 00021403 sra r2,r2,0x10
0011Adc8: 00461021 addu r2,r2,r6
0011Adcc: 90420000 lbu r2,0x0000(r2)
0011Add0: 00000000 nop
0011Add4: a0a20000 sb r2,0x0000(r5)
0011Add8: 26310001 addiu r17,r17,0x0001
0011Addc: 0232102a slt r2,r17,r18
0011Ade0: 1440ffef bne r2,r0,0x 0011Ada0
0011Ade4: 24a50001 addiu r5,r5,0x0001
0011Ade8: 00008821 addu r17,r0,r0
0011Adec: 27b70048 addiu r23,r29,0x0048
0011Adf0: 00009821 addu r19,r0,r0
0011Adf4: 3c028006 lui r2,0x8006
0011Adf8: 24422eb8 addiu r2,r2,0x2eb8
0011Adfc: 02623021 addu r6,r19,r2
0011Ae00: 90c20005 lbu r2,0x0005(r6)     //Load weapon type
0011Ae04: 1a40000e blez r18,0x 0011Ae40
0011Ae08: 00002021 addu r4,r0,r0
0011Ae0c: 304700ff andi r7,r2,0x00ff
0011Ae10: 02e01821 addu r3,r23,r0
0011Ae14: 02432821 addu r5,r18,r3
0011Ae18: 90620000 lbu r2,0x0000(r3)
0011Ae1c: 00000000 nop
0011Ae20: 14e20003 bne r7,r2,0x 0011Ae30  //If weapon type doesn't match that of THROW skill, GOTO NEXT
0011Ae24: 00000000 nop
0011Ae28: 08060790 j 0x00181e40
0011Ae2c: 34040001 ori r4,r0,0x0001
0011Ae30: 24630001 addiu r3,r3,0x0001
0011Ae34: 0065102a slt r2,r3,r5
0011Ae38: 1440fff7 bne r2,r0,0x 0011Ae18
0011Ae3c: 00000000 nop
0011Ae40: 10800019 beq r4,r0,0x 0011Aea8
0011Ae44: 2673000c addiu r19,r19,0x000c
0011Ae48: 90c20003 lbu r2,0x0003(r6)
0011Ae4c: 00000000 nop
0011Ae50: 30420080 andi r2,r2,0x0080        //Check for weapon
0011Ae54: 10400014 beq r2,r0,0x 0011Aea8
0011Ae58: 00000000 nop
0011Ae5c: 90c20004 lbu r2,0x0004(r6)        //Weapon ID
0011Ae60: 00000000 nop
0011Ae64: 000210c0 sll r2,r2,0x03
0011Ae68: 3c018006 lui r1,0x8006
0011Ae6c: 00220821 addu r1,r1,r2
0011Ae70: 90223ab9 lbu r2,0x3ab9(r1)
0011Ae74: 00000000 nop
0011Ae78: 30420002 andi r2,r2,0x0002
0011Ae7c: 1040000a beq r2,r0,0x 0011Aea8     //Throwable Check
0011Ae80: 02c02021 addu r4,r22,r0
0011Ae84: 02208021 addu r16,r17,r0
0011Ae88: 320500ff andi r5,r16,0x00ff
0011Ae8c: 0c05f255 jal 0x0017c954
0011Ae90: 00003021 addu r6,r0,r0
0011Ae94: 14400004 bne r2,r0,0x 0011Aea8
0011Ae98: 00000000 nop
0011Ae9c: a2900000 sb r16,0x0000(r20)
0011Aea0: 26940001 addiu r20,r20,0x0001
0011Aea4: 26b50001 addiu r21,r21,0x0001
0011Aea8: 26310001 addiu r17,r17,0x0001
0011Aeac: 2a220100 slti r2,r17,0x0100
0011Aeb0: 1440ffd0 bne r2,r0,0x 0011Adf4
0011Aeb4: 340200ff ori r2,r0,0x00ff
0011Aeb8: a2820000 sb r2,0x0000(r20)
0011Aebc: 26a20100 addiu r2,r21,0x0100
0011Aec0: 8fbf00e8 lw r31,0x00e8(r29)
0011Aec4: 8fb700e4 lw r23,0x00e4(r29)
0011Aec8: 8fb600e0 lw r22,0x00e0(r29)
0011Aecc: 8fb500dc lw r21,0x00dc(r29)
0011Aed0: 8fb400d8 lw r20,0x00d8(r29)
0011Aed4: 8fb300d4 lw r19,0x00d4(r29)
0011Aed8: 8fb200d0 lw r18,0x00d0(r29)
0011Aedc: 8fb100cc lw r17,0x00cc(r29)
0011Aee0: 8fb000c8 lw r16,0x00c8(r29)
0011Aee4: 27bd00f0 addiu r29,r29,0x00f0
0011Aee8: 03e00008 jr r31
0011Aeec: 00000000 nop