Process Inflict Status Event Commands

From Final Fantasy Hacktics Wiki
Revision as of 18:24, 19 April 2022 by Glain (talk | contribs)
Jump to navigation Jump to search
#   ROUTINE: PROCESS INFLICT STATUS EVENT COMMANDS
#       Runs all InflictStatus event commands in the current event in sequence that affect units with Float or Jump.

8012d8e4: 27bdffe0 addiu r29,r29,-0x0020
8012d8e8: afb10014 sw r17,0x0014(r29)
8012d8ec: 00008821 addu r17,r0,r0                   #   byteOffsetStart = 0
8012d8f0: afb20018 sw r18,0x0018(r29)
8012d8f4: 341207d0 ori r18,r0,0x07d0                #   2000
8012d8f8: afbf001c sw r31,0x001c(r29)
8012d8fc: afb00010 sw r16,0x0010(r29)
                                                    #   // Loop condition always true; must hit break command to exit loop.
                                                    #   while (true) {
8012d900: 02202021 addu r4,r17,r0
8012d904: 0c0527af jal 0x80149ebc                   #       inflictStatusOffset = Find Event Instruction Byte Offset (byteOffsetStart, 0x92);     // InflictStatus
8012d908: 34050092 ori r5,r0,0x0092
8012d90c: 00408821 addu r17,r2,r0                   #       inflictStatusOffset
8012d910: 12200037 beq r17,r0,0x8012d9f0            #       if (inflictStatusOffset == 0) break;
8012d914: 00000000 nop
8012d918: 3c028017 lui r2,0x8017
8012d91c: 8c423ca4 lw r2,0x3ca4(r2)                 #       eventBasePtr = *0x80173ca4
8012d920: 00000000 nop
8012d924: 00512021 addu r4,r2,r17                   #       inflictStatusPtr = eventBasePtr + inflictStatusOffset
8012d928: 90830000 lbu r3,0x0000(r4)                #       eventCommandID = *inflictStatusPtr
8012d92c: 34020092 ori r2,r0,0x0092                 #       if (eventCommandID == 0x92)
8012d930: 1462002a bne r3,r2,0x8012d9dc             #       {           
8012d934: 00000000 nop
8012d938: 0c05181e jal 0x80146078                   #           unitID = Load Halfword (inflictStatusPtr + 1);
8012d93c: 24840001 addiu r4,r4,0x0001
8012d940: 00021400 sll r2,r2,0x10
8012d944: 0c04cc56 jal 0x80133158                   #           unitMiscID = Get misc ID (unitID);
8012d948: 00022403 sra r4,r2,0x10
8012d94c: 10520023 beq r2,r18,0x8012d9dc            #           if (unitMiscID == 2000)
8012d950: 00000000 nop                              #           {
8012d954: 0c023374 jal 0x8008cdd0                   #               battleUnitIndex = Get Battle Unit Index By Unit Misc ID (unitMiscID);
8012d958: 00402021 addu r4,r2,r0
8012d95c: 1052001f beq r2,r18,0x8012d9dc            #               if (battleUnitIndex == 2000)
8012d960: 00000000 nop                              #               {
8012d964: 0c0602bf jal 0x80180afc                   #                   battleUnit = Get Unit's Data Pointer (battleUnitIndex);
8012d968: 00402021 addu r4,r2,r0
8012d96c: 00401821 addu r3,r2,r0                    #                   battleUnit
8012d970: 9062005a lbu r2,0x005a(r3)                #                   battleUnit.currentStatus[2]     // 3rd set
8012d974: 00000000 nop
8012d978: 30420040 andi r2,r2,0x0040                #                   battleUnit.currentStatus[2] & STATUS_FLOAT
8012d97c: 14400006 bne r2,r0,0x8012d998             #                   if ((battleUnit.currentStatus[2] & STATUS_FLOAT) 
8012d980: 00000000 nop
8012d984: 90620058 lbu r2,0x0058(r3)
8012d988: 00000000 nop
8012d98c: 30420004 andi r2,r2,0x0004
8012d990: 10400012 beq r2,r0,0x8012d9dc             #                       OR (battleUnit.currentStatus[0] & STATUS_JUMP))
8012d994: 00000000 nop                              #                   {
8012d998: 0c0526fb jal 0x80149bec                   #                       threadID = Get Next Available Thread ID (16);
8012d99c: 34040010 ori r4,r0,0x0010
8012d9a0: 00408021 addu r16,r2,r0                   #                       threadID
8012d9a4: 3c058015 lui r5,0x8015
8012d9a8: 24a58e88 addiu r5,r5,-0x7178              #                       functionPtr = 0x80148e88 (InflictStatus Event Command)
8012d9ac: 0c053228 jal 0x8014c8a0                   #                       Initialize Thread (threadID, functionPtr);
8012d9b0: 02002021 addu r4,r16,r0
8012d9b4: 3c058017 lui r5,0x8017
8012d9b8: 8ca53ca4 lw r5,0x3ca4(r5)                 #                       eventBasePtr = *0x80173ca4
8012d9bc: 02002021 addu r4,r16,r0                   
8012d9c0: 00003021 addu r6,r0,r0
8012d9c4: 00003821 addu r7,r0,r0
8012d9c8: 02252821 addu r5,r17,r5                   #                       eventBasePtr + inflictStatusOffset
8012d9cc: 0c05328e jal 0x8014ca38                   #                       Store Thread Function Parameters (threadID, eventBasePtr + inflictStatusOffset + 1, 0, 0);
8012d9d0: 24a50001 addiu r5,r5,0x0001
8012d9d4: 0c053274 jal 0x8014c9d0                   #                       Wait For Thread (threadID);
8012d9d8: 02002021 addu r4,r16,r0
                                                    #                   }
                                                    #               }
                                                    #           }
                                                    #       }
8012d9dc: 3c038015 lui r3,0x8015
8012d9e0: 9063d202 lbu r3,-0x2dfe(r3)               #       event.commandLengths[0x92]      // (*0x8014d202)
8012d9e4: 26220001 addiu r2,r17,0x0001              #       byteOffsetStart + 1
8012d9e8: 0804b640 j 0x8012d900
8012d9ec: 00438821 addu r17,r2,r3                   #       byteOffsetStart = byteOffsetStart + 1 + event.commandLengths[0x92]
                                                    #   }
8012d9f0: 8fbf001c lw r31,0x001c(r29)
8012d9f4: 8fb20018 lw r18,0x0018(r29)
8012d9f8: 8fb10014 lw r17,0x0014(r29)
8012d9fc: 8fb00010 lw r16,0x0010(r29)
8012da00: 27bd0020 addiu r29,r29,0x0020
8012da04: 03e00008 jr r31
8012da08: 00000000 nop