Inflict Status Event Command

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: InflictStatus Event Command

80148e88: 27bdffd0 addiu r29,r29,-0x0030
80148e8c: 34040043 ori r4,r0,0x0043                 #   0x43
80148e90: afbf0028 sw r31,0x0028(r29)
80148e94: afb50024 sw r21,0x0024(r29)
80148e98: afb40020 sw r20,0x0020(r29)
80148e9c: afb3001c sw r19,0x001c(r29)
80148ea0: afb20018 sw r18,0x0018(r29)
80148ea4: afb10014 sw r17,0x0014(r29)
80148ea8: 0c052752 jal 0x80149d48                   #   Set Thread Task ID (0x43);
80148eac: afb00010 sw r16,0x0010(r29)
80148eb0: 0c0532f0 jal 0x8014cbc0                   #   paramPtr = Get First Thread Parameter ();
80148eb4: 00000000 nop
80148eb8: 00408021 addu r16,r2,r0                   #   paramPtr
80148ebc: 0c05181e jal 0x80146078                   #   paramUnitID = Load Halfword (paramPtr);
80148ec0: 02002021 addu r4,r16,r0
80148ec4: 26040003 addiu r4,r16,0x0003              #   paramPtr + 3
80148ec8: 00021400 sll r2,r2,0x10
80148ecc: 92120002 lbu r18,0x0002(r16)              #   paramStatusID = *(paramPtr + 2)
80148ed0: 0c05181e jal 0x80146078                   #   paramWaitCycles = Load Halfword (paramPtr + 3);
80148ed4: 00028c03 sra r17,r2,0x10                  #   paramUnitID
80148ed8: 02202021 addu r4,r17,r0                   
80148edc: 00021400 sll r2,r2,0x10
80148ee0: 0c04b72b jal 0x8012dcac                   #   battleUnitIndex = Get Battle Unit Index By ENTD Unit ID (paramUnitID);
80148ee4: 0002ac03 sra r21,r2,0x10                  #   paramWaitCycles
80148ee8: 02202021 addu r4,r17,r0
80148eec: 0c04cc56 jal 0x80133158                   #   unitMiscID = Get misc ID (paramUnitID);
80148ef0: 0040a021 addu r20,r2,r0                   #   battleUnitIndex
80148ef4: 00409821 addu r19,r2,r0                   #   unitMiscID
80148ef8: 340207d0 ori r2,r0,0x07d0                 #   2000
80148efc: 16620003 bne r19,r2,0x80148f0c            #   if (unitMiscID == 2000) {
80148f00: 00000000 nop
80148f04: 0c053256 jal 0x8014c958                   #       Stop Current Thread ();
80148f08: 00000000 nop                              #   }
80148f0c: 3224ffff andi r4,r17,0xffff
80148f10: 0c052336 jal 0x80148cd8                   #   Process Unit Staged Status Data (paramUnitID, 0);
80148f14: 00002821 addu r5,r0,r0
80148f18: 0c0602bf jal 0x80180afc                   #   unit = Get Unit's Data Pointer (battleUnitIndex);
80148f1c: 02802021 addu r4,r20,r0
80148f20: 00408021 addu r16,r2,r0                   #   unit
80148f24: 92020058 lbu r2,0x0058(r16)               #   unit.currentStatus[0]       // 1st set
80148f28: 00000000 nop
80148f2c: 30420020 andi r2,r2,0x0020                #   unit.currentStatus[0] & STATUS_DEAD
80148f30: 10400003 beq r2,r0,0x80148f40             #   if (unit.currentStatus[0] & STATUS_DEAD) {
80148f34: 00000000 nop
80148f38: 080523d6 j 0x80148f58
80148f3c: 00001821 addu r3,r0,r0                    #       unitState = 0
                                                    #   } else {
80148f40: 9202005a lbu r2,0x005a(r16)               #       unit.currentStatus[2]   // 3rd set
80148f44: 00000000 nop
80148f48: 30420001 andi r2,r2,0x0001                #       unit.currentStatus[2] & STATUS_CRITICAL
80148f4c: 10400002 beq r2,r0,0x80148f58             
80148f50: 34030002 ori r3,r0,0x0002                 #       unitState = 2
                                                    #       if (unit.currentStatus[2] & STATUS_CRITICAL)     
80148f54: 34030001 ori r3,r0,0x0001                 #           unitState = 1
                                                    #   }
80148f58: 34040002 ori r4,r0,0x0002                 #   2
80148f5c: 16440016 bne r18,r4,0x80148fb8
80148f60: 34020001 ori r2,r0,0x0001                 #   1
                                                    #   if (paramStatusID == 2) {
80148f64: 02202021 addu r4,r17,r0                   
80148f68: 3405001f ori r5,r0,0x001f
80148f6c: 34060001 ori r6,r0,0x0001
80148f70: 0c052440 jal 0x80149100                   #       Inflict Unit Status By ENTD Unit ID (paramUnitID, 31, true, true);      // Inflict Poison 
80148f74: 34070001 ori r7,r0,0x0001
80148f78: 3c028017 lui r2,0x8017
80148f7c: 8c423c78 lw r2,0x3c78(r2)                 #       *0x80173c78
80148f80: 34030003 ori r3,r0,0x0003                 #       3
80148f84: 00541021 addu r2,r2,r20                   #       *0x80173c78 + battleUnitIndex
80148f88: a04303b1 sb r3,0x03b1(r2)                 #       *(*0x80173c78 + battleUnitIndex + 0x3b1) = 3
80148f8c: 3c028009 lui r2,0x8009
80148f90: 2442bde4 addiu r2,r2,-0x421c              #       0x8008bde4    
80148f94: 3c018017 lui r1,0x8017
80148f98: ac223ca8 sw r2,0x3ca8(r1)                 #       routine = 0x8008bde4 (Update Status/Sprite/Animation Display By Unit Misc ID (Wrapper Function))
80148f9c: 0c0533ad jal 0x8014ceb4                   #       Call Inner Subroutine (unitMiscID);
80148fa0: 02602021 addu r4,r19,r0
80148fa4: 02602021 addu r4,r19,r0
80148fa8: 0c04b683 jal 0x8012da0c                   #       Set Specific Unit Animation Value When Battle Init (unitMiscID, 24);    // Set Critical Animation value
80148fac: 34050016 ori r5,r0,0x0016
80148fb0: 08052430 j 0x801490c0
80148fb4: 00000000 nop                              #   }
80148fb8: 1642001a bne r18,r2,0x80149024            #   else if (paramStatusID == 1) {
80148fbc: 34050005 ori r5,r0,0x0005
80148fc0: 02202021 addu r4,r17,r0
80148fc4: 00003021 addu r6,r0,r0
80148fc8: 0c052440 jal 0x80149100                   #       Inflict Unit Status By ENTD Unit ID (paramUnitID, 5, false, true);      // Remove Dead 
80148fcc: 34070001 ori r7,r0,0x0001
80148fd0: 02202021 addu r4,r17,r0
80148fd4: 34050010 ori r5,r0,0x0010
80148fd8: 00003021 addu r6,r0,r0
80148fdc: 0c052440 jal 0x80149100                   #       Inflict Unit Status By ENTD Unit ID (paramUnitID, 16, false, true);     // Remove Critical 
80148fe0: 34070001 ori r7,r0,0x0001
80148fe4: 02202021 addu r4,r17,r0
80148fe8: 34050006 ori r5,r0,0x0006
80148fec: 34060001 ori r6,r0,0x0001
80148ff0: 0c052440 jal 0x80149100                   #       Inflict Unit Status By ENTD Unit ID (paramUnitID, 6, true, true);       // Inflict Crystal
80148ff4: 34070001 ori r7,r0,0x0001
80148ff8: 3c028017 lui r2,0x8017
80148ffc: 8c423c78 lw r2,0x3c78(r2)                 #       *0x80173c78
80149000: 34030002 ori r3,r0,0x0002                 #       2
80149004: 00541021 addu r2,r2,r20                   #       *0x80173c78 + battleUnitIndex
80149008: a04303b1 sb r3,0x03b1(r2)                 #       *(*0x80173c78 + battleUnitIndex + 0x3b1) = 2
8014900c: 3c028009 lui r2,0x8009
80149010: 2442bde4 addiu r2,r2,-0x421c              #       0x8008bde4
80149014: 3c018017 lui r1,0x8017
80149018: ac223ca8 sw r2,0x3ca8(r1)                 #       routine = 0x8008bde4 (Update Status/Sprite/Animation Display By Unit Misc ID (Wrapper Function))
8014901c: 0805242e j 0x801490b8                     #       Call Inner Subroutine (unitMiscID);
80149020: 02602021 addu r4,r19,r0
                                                    #   }
80149024: 16400026 bne r18,r0,0x801490c0            #   else if (paramStatusID == 0) {
80149028: 00000000 nop
8014902c: 1460001c bne r3,r0,0x801490a0             #       if (unitState == 0) {      // Unit has Dead status
80149030: 34050005 ori r5,r0,0x0005
80149034: 02202021 addu r4,r17,r0
80149038: 00003021 addu r6,r0,r0
8014903c: 34070001 ori r7,r0,0x0001
80149040: 3c028017 lui r2,0x8017
80149044: 8c423c78 lw r2,0x3c78(r2)                 #           *0x80173c78
80149048: 34030001 ori r3,r0,0x0001                 #           1
8014904c: 00541021 addu r2,r2,r20                   #           *0x80173c78 + battleUnitIndex
80149050: 0c052440 jal 0x80149100                   #           Inflict Unit Status By ENTD Unit ID (paramUnitID, 5, false, true);      // Remove Dead
80149054: a04303b1 sb r3,0x03b1(r2)                 #           *(0x80173c78 + battleUnitIndex + 0x3b1) = 1
80149058: 02202021 addu r4,r17,r0
8014905c: 34050010 ori r5,r0,0x0010
80149060: 34060001 ori r6,r0,0x0001
80149064: 34070001 ori r7,r0,0x0001
80149068: 34020001 ori r2,r0,0x0001                 #           1
8014906c: 0c052440 jal 0x80149100                   #           Inflict Unit Status By ENTD Unit ID (paramUnitID, 16, true, true);      // Inflict Critical
80149070: a6020028 sh r2,0x0028(r16)                #           unit.HP = 1
80149074: 3c028009 lui r2,0x8009
80149078: 2442bde4 addiu r2,r2,-0x421c              #           0x8008bde4
8014907c: 3c018017 lui r1,0x8017
80149080: ac223ca8 sw r2,0x3ca8(r1)                 #           routine = 0x8008bde4 (Update Status/Sprite/Animation Display By Unit Misc ID (Wrapper Function))
80149084: 0c0533ad jal 0x8014ceb4                   #           Call Inner Subroutine (unitMiscID);
80149088: 02602021 addu r4,r19,r0
8014908c: 34020041 ori r2,r0,0x0041                 #           65
80149090: 3c018016 lui r1,0x8016
80149094: ac225fb4 sw r2,0x5fb4(r1)                 #           *0x80165fb4 = 65
80149098: 08052430 j 0x801490c0
8014909c: 00000000 nop                              #       } else if (unitState == 2) {
801490a0: 14640007 bne r3,r4,0x801490c0
801490a4: 02602021 addu r4,r19,r0
801490a8: 3c028009 lui r2,0x8009
801490ac: 2442be04 addiu r2,r2,-0x41fc              #           0x8008be04
801490b0: 3c018017 lui r1,0x8017
801490b4: ac223ca8 sw r2,0x3ca8(r1)                 #           routine = 0x8008be04 (Set Animation Based On Unit Mounted State From Unit Misc ID)
801490b8: 0c0533ad jal 0x8014ceb4                   #           Call Inner Subroutine (unitMiscID);
801490bc: 00000000 nop
                                                    #       }
                                                    #   }
801490c0: 12a00003 beq r21,r0,0x801490d0            #   if (paramWaitCycles != 0) {
801490c4: 00000000 nop
801490c8: 0c053216 jal 0x8014c858                   #       Wait (paramWaitCycles);
801490cc: 02a02021 addu r4,r21,r0
                                                    #   }
801490d0: 0c053256 jal 0x8014c958                   #   Stop Current Thread ();
801490d4: 00000000 nop
801490d8: 8fbf0028 lw r31,0x0028(r29)
801490dc: 8fb50024 lw r21,0x0024(r29)
801490e0: 8fb40020 lw r20,0x0020(r29)
801490e4: 8fb3001c lw r19,0x001c(r29)
801490e8: 8fb20018 lw r18,0x0018(r29)
801490ec: 8fb10014 lw r17,0x0014(r29)
801490f0: 8fb00010 lw r16,0x0010(r29)
801490f4: 27bd0030 addiu r29,r29,0x0030
801490f8: 03e00008 jr r31
801490fc: 00000000 nop