Zalera Special Status Flag Enabling when Drawing units

From Final Fantasy Hacktics Wiki
(Redirected from 00148488 - 00148538)
Jump to navigation Jump to search

# This code is only run during the Draw event instruction if this is the event ID for the Zalera event. THIS IS INSANE. WHY.
 
00148488: 27bdffd8 addiu r29,r29,0xffd8
0014848c: afb10014 sw r17,0x0014(r29)
00148490: 00808821 addu r17,r4,r0            # r17 = Battle Unit Index
00148494: afb3001c sw r19,0x001c(r29)
00148498: 00a09821 addu r19,r5,r0            # r19 = Preset Value (1)
0014849c: afbf0024 sw r31,0x0024(r29)
001484a0: afb40020 sw r20,0x0020(r29)
001484a4: afb20018 sw r18,0x0018(r29)
001484a8: 0c0602bf jal 0x00180afc            # Get Unit's Data Pointer
001484ac: afb00010 sw r16,0x0010(r29)
001484b0: 00409021 addu r18,r2,r0            # r18 = Unit's Data Pointer
001484b4: 3c028007 lui r2,0x8007
001484b8: 24428e80 addiu r2,r2,0x8e80        # r2 = 0x80068e80 - address for the routine "Special Status Flag Enabling"
001484bc: 00008021 addu r16,r0,r0            # r16 = Status flag counter
001484c0: 34140080 ori r20,r0,0x0080         # r20 = 0x80
001484c4: 3c018017 lui r1,0x8017
001484c8: ac223ca8 sw r2,0x3ca8(r1)          # set "Special Status Flag Enabling" as the return address for "Call Inner Subroutine"
001484cc: 06010002 bgez r16,0x001484d8       # Branch if r16 is greater than or equal to 0
001484d0: 02001021 addu r2,r16,r0            # r2 = r16
001484d4: 26020007 addiu r2,r16,0x0007       # r2 = r16 + 7 if r16 was less than 0
001484d8: 000210c3 sra r2,r2,0x03
001484dc: 000218c0 sll r3,r2,0x03
001484e0: 02031823 subu r3,r16,r3
001484e4: 02421021 addu r2,r18,r2
001484e8: 90420058 lbu r2,0x0058(r2)         # Load Current Status byte
001484ec: 00741807 srav r3,r20,r3            # r3 = isolate intended bitflag
001484f0: 00431024 and r2,r2,r3              # r2 = check for intended status
001484f4: 10400004 beq r2,r0,0x00148508      # Branch if unit does not have intended status
001484f8: 26040001 addiu r4,r16,0x0001       # r4 = r16 + 1
001484fc: 02602821 addu r5,r19,r0            # r5 = Preset Value (1): Enable status
00148500: 0c0533ad jal 0x0014ceb4            # Call Inner Subroutine: Special Status Flag Enabling
00148504: 02203021 addu r6,r17,r0            # r6 = Battle Unit Index
00148508: 26100001 addiu r16,r16,0x0001      # Status flag counter ++
0014850c: 2a020028 slti r2,r16,0x0028        # r2 = 0x01 if there are still statuses left to check
00148510: 1440ffee bne r2,r0,0x001484cc      # Loop back if there are still statuses left to check
00148514: 00000000 nop
00148518: 8fbf0024 lw r31,0x0024(r29)
0014851c: 8fb40020 lw r20,0x0020(r29)
00148520: 8fb3001c lw r19,0x001c(r29)
00148524: 8fb20018 lw r18,0x0018(r29)
00148528: 8fb10014 lw r17,0x0014(r29)
0014852c: 8fb00010 lw r16,0x0010(r29)
00148530: 27bd0028 addiu r29,r29,0x0028
00148534: 03e00008 jr r31
00148538: 00000000 nop