Inflict Unit Status By ENTD Unit ID

From Final Fantasy Hacktics Wiki
Revision as of 22:55, 21 April 2022 by Glain (talk | contribs) (Created page with " # ROUTINE: INFLICT UNIT STATUS BY ENTD UNIT ID # Parameters: # r4 = (ENTDUnitID) ENTD Unit ID # r5 = (statusIndex) Index of status effect, goin...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: INFLICT UNIT STATUS BY ENTD UNIT ID
#       Parameters:
#           r4 = (ENTDUnitID) ENTD Unit ID
#           r5 = (statusIndex) Index of status effect, going from 0 to 39, in order of storage bytes, but reverse order of status flags.  0 = Performing, 39 = Faith
#           r6 = (isInfliction) Inflicts status if true (1), otherwise removes status
#           r7 = (useLessStrictStatusRemoval) Use less strict status removal during status validation (true = 1, false = 0)

80149100: 27bdffd8 addiu r29,r29,-0x0028
80149104: afb00010 sw r16,0x0010(r29)
80149108: 00a08021 addu r16,r5,r0
8014910c: afb20018 sw r18,0x0018(r29)
80149110: 00c09021 addu r18,r6,r0
80149114: afb3001c sw r19,0x001c(r29)
80149118: 00e09821 addu r19,r7,r0
8014911c: afbf0020 sw r31,0x0020(r29)
80149120: 0c04b72b jal 0x8012dcac                   #   battleUnitIndex = Get Battle Unit Index By ENTD Unit ID (ENTDUnitID);
80149124: afb10014 sw r17,0x0014(r29)
80149128: 00408821 addu r17,r2,r0                   #   battleUnitIndex
8014912c: 340207d0 ori r2,r0,0x07d0                 #   2000
80149130: 12220021 beq r17,r2,0x801491b8            #   if (battleUnitIndex == 2000) return;
80149134: 00000000 nop
80149138: 0c0602bf jal 0x80180afc                   #   unit = Get Unit's Data Pointer (battleUnitIndex);
8014913c: 02202021 addu r4,r17,r0
80149140: 00402821 addu r5,r2,r0                    #   unit
80149144: 00001821 addu r3,r0,r0                    #   statusByteIndex = 0
                                                    #   do {
80149148: 00a31021 addu r2,r5,r3                    
8014914c: 24630001 addiu r3,r3,0x0001               #       statusByteIndex = statusByteIndex + 1
80149150: a04001a7 sb r0,0x01a7(r2)                 #       unit.actionStatusInfliction[statusByteIndex] = 0
80149154: a04001ac sb r0,0x01ac(r2)                 #       unit.actionStatusRemoval[statusByteIndex] = 0
80149158: 28620005 slti r2,r3,0x0005
8014915c: 1440fffa bne r2,r0,0x80149148             #   } while (statusByteIndex < 5);
80149160: 00000000 nop
80149164: 06010002 bgez r16,0x80149170
80149168: 02001021 addu r2,r16,r0
8014916c: 26020007 addiu r2,r16,0x0007
80149170: 000220c3 sra r4,r2,0x03                   #   statusByteIndex = statusIndex / 8  // (integer division)
80149174: 000410c0 sll r2,r4,0x03
80149178: 02021023 subu r2,r16,r2                   #   statusIndex % 8  // (modulo)
8014917c: 34030001 ori r3,r0,0x0001                 #   1
80149180: 12400004 beq r18,r0,0x80149194
80149184: 00431804 sllv r3,r3,r2                    #   statusValue = 1 << (statusIndex % 8)
                                                    #   if (isInfliction) {
80149188: 00a41021 addu r2,r5,r4
8014918c: 08052467 j 0x8014919c
80149190: a04301a7 sb r3,0x01a7(r2)                 #       unit.actionStatusInfliction[statusByteIndex] = statusValue
                                                    #   } else {
80149194: 00a41021 addu r2,r5,r4
80149198: a04301ac sb r3,0x01ac(r2)                 #       unit.actionStatusRemoval[statusByteIndex] = statusValue
                                                    #   }
8014919c: 3c028019 lui r2,0x8019
801491a0: 2442e07c addiu r2,r2,-0x1f84              #   0x8018e07c
801491a4: 3c018017 lui r1,0x8017
801491a8: ac223ca8 sw r2,0x3ca8(r1)                 #   routine = 0x8018e07c (Post Ability Hardcoding?)
801491ac: 02202021 addu r4,r17,r0
801491b0: 0c0533ad jal 0x8014ceb4                   #   Call Inner Subroutine (battleUnitIndex, useLessStrictStatusRemoval); (routine = 0x8018e07c Post Ability Hardcoding?)
801491b4: 02602821 addu r5,r19,r0
801491b8: 8fbf0020 lw r31,0x0020(r29)
801491bc: 8fb3001c lw r19,0x001c(r29)
801491c0: 8fb20018 lw r18,0x0018(r29)
801491c4: 8fb10014 lw r17,0x0014(r29)
801491c8: 8fb00010 lw r16,0x0010(r29)
801491cc: 27bd0028 addiu r29,r29,0x0028
801491d0: 03e00008 jr r31
801491d4: 00000000 nop