Effect Related (0x1a20e8)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   Parameters:
#       r4 = Ptr. to effect's code scripts
#       r5 = (p2) ? (Sometimes 0)
#       r6 = (p3) ? (Sometimes 0)

801a20e8: 27bdffd8 addiu r29,r29,-0x0028
801a20ec: afb20018 sw r18,0x0018(r29)
801a20f0: 00809021 addu r18,r4,r0                   #   p1
801a20f4: afb3001c sw r19,0x001c(r29)
801a20f8: 00a09821 addu r19,r5,r0                   #   p2
801a20fc: afb10014 sw r17,0x0014(r29)
801a2100: 00c08821 addu r17,r6,r0                   #   p3
801a2104: afbf0024 sw r31,0x0024(r29)
801a2108: afb40020 sw r20,0x0020(r29)
801a210c: 0c06874a jal 0x801a1d28                   #   result_0x1a1d28 = Effect Related (0x1a1d28) ();
801a2110: afb00010 sw r16,0x0010(r29)
801a2114: 0040a021 addu r20,r2,r0                   #   result_0x1a1d28
801a2118: 00141400 sll r2,r20,0x10
801a211c: 00021c03 sra r3,r2,0x10                   #   result_0x1a1d28
801a2120: 14600003 bne r3,r0,0x801a2130
801a2124: 00002821 addu r5,r0,r0                    #   count = 0
                                                    #   if (result_0x1a1d28 == 0) {
801a2128: 0806887c j 0x801a21f0                     #       return 0;
801a212c: 00001021 addu r2,r0,r0
                                                    #   }
801a2130: 00031140 sll r2,r3,0x05                   #   
801a2134: 00431023 subu r2,r2,r3                    #   
801a2138: 000210c0 sll r2,r2,0x03                   #   Effect ID * F8
801a213c: 3c03801c lui r3,0x801c
801a2140: 2463f02c addiu r3,r3,-0x0fd4              #   0x801bf02c
801a2144: 00438021 addu r16,r2,r3                   #   ptr to temp effect data for phase?
801a2148: a6110004 sh r17,0x0004(r16)               #   *(ptr + 4) = p3
801a214c: ae120008 sw r18,0x0008(r16)               #   store pointer to current effect's data in dedicated table
801a2150: a6130006 sh r19,0x0006(r16)               #   *(ptr + 6) = p2
                                                    #   do {
801a2154: 00051c00 sll r3,r5,0x10                   #       count << 16
801a2158: 24a20001 addiu r2,r5,0x0001               #       count + 1
801a215c: 00402821 addu r5,r2,r0                    #       count = count + 1
801a2160: 00031bc3 sra r3,r3,0x0f                   #       count * 2
801a2164: 00701821 addu r3,r3,r16                   #       count * 1 + ptr
801a2168: 00021400 sll r2,r2,0x10
801a216c: 00021403 sra r2,r2,0x10                   #       count
801a2170: 28420004 slti r2,r2,0x0004
801a2174: a4600014 sh r0,0x0014(r3)                 #       clear 0x14 - 0x22
801a2178: 1440fff6 bne r2,r0,0x801a2154
801a217c: a460000c sh r0,0x000c(r3)                 #       clear 0x08 - 0x12
                                                    #   } while (count < 4);
801a2180: 00002821 addu r5,r0,r0                    #   count = 0
                                                    #   do {
801a2184: 00051400 sll r2,r5,0x10                   #       count << 16
801a2188: 24a30001 addiu r3,r5,0x0001               #       count + 1
801a218c: 00602821 addu r5,r3,r0                    #       count = count + 1
801a2190: 00021403 sra r2,r2,0x10                   #       count
801a2194: 00022080 sll r4,r2,0x02                   #       count * 4
801a2198: 00902021 addu r4,r4,r16                   #       count * 4 + ptr 
801a219c: 02021021 addu r2,r16,r2                   #       ptr + count - 1
801a21a0: 00031c00 sll r3,r3,0x10
801a21a4: 00031c03 sra r3,r3,0x10                   #       count
801a21a8: 28630004 slti r3,r3,0x0004
801a21ac: ac8000d4 sw r0,0x00d4(r4)                 #       clear 0xd4, 0xd8, 0xdc, 0xe0
801a21b0: a0400022 sb r0,0x0022(r2)                 #       clear 0x22, 0x26, 0x2a, 0x2e (bytes)
801a21b4: 1460fff3 bne r3,r0,0x801a2184
801a21b8: ac8000e4 sw r0,0x00e4(r4)                 #       clear 0xe4, 0xe8, 0xec, 0xf0
                                                    #   } while (count < 4);
801a21bc: 02002021 addu r4,r16,r0                   #   ptr. to temp. effect data
801a21c0: 34020001 ori r2,r0,0x0001                 #   1
801a21c4: a602001e sh r2,0x001e(r16)                #   *(ptr + 0x1e) = 1   
801a21c8: 2402ffff addiu r2,r0,-0x0001              #   -1
801a21cc: 00002821 addu r5,r0,r0                    #   0
801a21d0: ae0000d0 sw r0,0x00d0(r16)                #   *(ptr + 0xd0) = 0
801a21d4: a600001c sh r0,0x001c(r16)                #   *(ptr + 0x1c) = 0
801a21d8: 0c068821 jal 0x801a2084                   #   0x1a2084 (eff script ptr, 0);
801a21dc: a6020020 sh r2,0x0020(r16)                #   *(ptr + 0x20) = -1
801a21e0: 0c06882d jal 0x801a20b4                   #   0x1a20b4 (ptr);         // does the same stuff as the above one, some overlap even.
801a21e4: 02002021 addu r4,r16,r0
801a21e8: 00141400 sll r2,r20,0x10
801a21ec: 00021403 sra r2,r2,0x10                   #   result_0x1a1d28
801a21f0: 8fbf0024 lw r31,0x0024(r29)               #   return result_0x1a1d28;
801a21f4: 8fb40020 lw r20,0x0020(r29)
801a21f8: 8fb3001c lw r19,0x001c(r29)
801a21fc: 8fb20018 lw r18,0x0018(r29)
801a2200: 8fb10014 lw r17,0x0014(r29)
801a2204: 8fb00010 lw r16,0x0010(r29)
801a2208: 27bd0028 addiu r29,r29,0x0028
801a220c: 03e00008 jr r31
801a2210: 00000000 nop