Effect Related (0x1a4000)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   Parameters:
#       r4          = (effectBlock) Effect block data
#       r5          = (p2) 0x801bc0c8 + offset (Timing data?) (offset initially 0x82a, +0x80 each call)?
#       r6          = (p3) mid effectBlock data (initially 8 offset, +2 each call)
#       r7          = (p4) mid effectBlock data (initially 0x3c offset, +2 each call)
#       *(sp + 16)  = (p5) mid effectBlock data (initially 0x70 offset, +2 each call)

801a4000: 27bdffd0 addiu r29,r29,-0x0030
801a4004: afb40020 sw r20,0x0020(r29)
801a4008: 0080a021 addu r20,r4,r0                   #   effectBlock
801a400c: afb20018 sw r18,0x0018(r29)
801a4010: 00a09021 addu r18,r5,r0                   #   p2
801a4014: afb10014 sw r17,0x0014(r29)
801a4018: 00c08821 addu r17,r6,r0                   #   p3
801a401c: afb3001c sw r19,0x001c(r29)
801a4020: afbf0028 sw r31,0x0028(r29)
801a4024: afb50024 sw r21,0x0024(r29)
801a4028: afb00010 sw r16,0x0010(r29)
801a402c: 8642007e lh r2,0x007e(r18)                #   *(p2 + 0x7e)
801a4030: 86230000 lh r3,0x0000(r17)                #   *p3
801a4034: 8fb50040 lw r21,0x0040(r29)               #   p5
801a4038: 0043102a slt r2,r2,r3
801a403c: 1440004e bne r2,r0,0x801a4178             #   if (*(p2 + 0x7e) < *p3) return;
801a4040: 00e09821 addu r19,r7,r0                   #   p4
801a4044: 86620000 lh r2,0x0000(r19)                #   *p4
801a4048: 00000000 nop
801a404c: 1440001b bne r2,r0,0x801a40bc             #   if (*p4 == 0) {
801a4050: 00000000 nop
                                                    #       do {
801a4054: 96300000 lhu r16,0x0000(r17)              #           *p3 
801a4058: 00000000 nop
801a405c: 26020001 addiu r2,r16,0x0001              #           *p3 + 1
801a4060: 00108400 sll r16,r16,0x10
801a4064: 001083c3 sra r16,r16,0x0f                 #           (*p3 + 1) * 2
801a4068: 02128021 addu r16,r16,r18                 #           p3CalcValue = ((*p3 + 1) * 2) + p2
801a406c: a6220000 sh r2,0x0000(r17)                #           *p3 = *p3 + 1
801a4070: 9604004c lhu r4,0x004c(r16)
801a4074: 0c068f4c jal 0x801a3d30                   #           0x1a3d30 (*(p3CalcValue + 0x4c), effectBlock);
801a4078: 02802821 addu r5,r20,r0
801a407c: 96020002 lhu r2,0x0002(r16)               #           *(p3CalcValue + 2)
801a4080: 96030000 lhu r3,0x0000(r16)               #           *p3CalcValue
801a4084: 00000000 nop
801a4088: 00431023 subu r2,r2,r3                    #           *(p3CalcValue + 2) - *p3CalcValue
801a408c: a6620000 sh r2,0x0000(r19)                #           *p4 = *(p3CalcValue + 2) - *p3CalcValue
801a4090: a6a00000 sh r0,0x0000(r21)                #           *p5 = 0
801a4094: 8642007e lh r2,0x007e(r18)                #           *(p2 + 0x7e)
801a4098: 86230000 lh r3,0x0000(r17)                #           *p3
801a409c: 00000000 nop
801a40a0: 0043102a slt r2,r2,r3
801a40a4: 14400034 bne r2,r0,0x801a4178             #           if (*(p2 + 0x7e) < *p3) return;
801a40a8: 00000000 nop
801a40ac: 86620000 lh r2,0x0000(r19)                #           *p4
801a40b0: 00000000 nop
801a40b4: 1040ffe7 beq r2,r0,0x801a4054             #       } while (*p4 == 0);
801a40b8: 00000000 nop
                                                    #   }
801a40bc: 8642007e lh r2,0x007e(r18)                #   *(p2 + 0x7e)
801a40c0: 86260000 lh r6,0x0000(r17)                #   *p3
801a40c4: 00000000 nop
801a40c8: 0046102a slt r2,r2,r6
801a40cc: 1440002a bne r2,r0,0x801a4178
801a40d0: 02461021 addu r2,r18,r6                   #   p2 + *p3
                                                    #   if (*(p2 + 0x7e) < *p3) return;
801a40d4: 90480031 lbu r8,0x0031(r2)                #   *(p2 + *p3 + 0x31)
801a40d8: 00000000 nop
801a40dc: 11000022 beq r8,r0,0x801a4168             
801a40e0: 00061040 sll r2,r6,0x01                   #   *p3 * 2
                                                    #   if (*(p2 + *p3 + 0x31) != 0) {
801a40e4: 02421021 addu r2,r18,r2                   #       p2 + (*p3 * 2)
801a40e8: 9442004a lhu r2,0x004a(r2)                #       *(p2 + (*p3 * 2) + 0x4a)
801a40ec: 00000000 nop
801a40f0: 30420007 andi r2,r2,0x0007                #       *(p2 + (*p3 * 2) + 0x4a) & 7
801a40f4: 10400013 beq r2,r0,0x801a4144
801a40f8: 2445ffff addiu r5,r2,-0x0001              #       (*(p2 + (*p3 * 2) + 0x4a) & 7) - 1
                                                    #       if (((*(p2 + (*p3 * 2) + 0x4a) & 7)) != 0) {
801a40fc: 86630000 lh r3,0x0000(r19)                #           *p4
801a4100: 34020002 ori r2,r0,0x0002                 #           2
801a4104: 14620004 bne r3,r2,0x801a4118
801a4108: 30a2ffff andi r2,r5,0xffff                #           (*(p2 + (*p3 * 2) + 0x4a) & 7) - 1
                                                    #           if (*p4 == 2) {
801a410c: 02821021 addu r2,r20,r2                   #               effectBlock + (*(p2 + (*p3 * 2) + 0x4a) & 7) - 1
801a4110: 34030003 ori r3,r0,0x0003                 #               3
801a4114: a0430022 sb r3,0x0022(r2)                 #               *(effectBlock + (*(p2 + (*p3 * 2) + 0x4a) & 7) - 1 + 0x22) = 3
                                                    #           }
801a4118: 30a5ffff andi r5,r5,0xffff                #           (*(p2 + (*p3 * 2) + 0x4a) & 7) - 1
801a411c: 00051080 sll r2,r5,0x02                   #           ((*(p2 + (*p3 * 2) + 0x4a) & 7) - 1) * 4
801a4120: 00541021 addu r2,r2,r20                   #           (((*(p2 + (*p3 * 2) + 0x4a) & 7) - 1) * 4) + effectBlock
801a4124: 86840002 lh r4,0x0002(r20)                #           *(effectBlock + 2)      
801a4128: 86a70000 lh r7,0x0000(r21)                #           *p5
801a412c: 8c4200d4 lw r2,0x00d4(r2)                 #           func = *((((*(p2 + (*p3 * 2) + 0x4a) & 7) - 1) * 4) + effectBlock + 0xd4)
801a4130: 00000000 nop
801a4134: 0040f809 jalr r2,r31                      #           func(*(effectBlock + 2), (*(p2 + (*p3 * 2) + 0x4a) & 7) - 1, *(p2 + *p3 + 0x31) - 1, *p5);
801a4138: 2506ffff addiu r6,r8,-0x0001              #           *(p2 + *p3 + 0x31) - 1
801a413c: 08069056 j 0x801a4158
801a4140: 00000000 nop
                                                    #       } else {
801a4144: 2506ffff addiu r6,r8,-0x0001              #           *(p2 + *p3 + 0x31) - 1
801a4148: 86840002 lh r4,0x0002(r20)                #           *(effectBlock + 2)
801a414c: 86a50000 lh r5,0x0000(r21)                #           *p5
801a4150: 0c06982b jal 0x801a60ac                   #           Effect Graphics (*(effectBlock + 2), *p5, *(p2 + *p3 + 0x31) - 1, 0);
801a4154: 00003821 addu r7,r0,r0                    #           0
                                                    #       }
801a4158: 96a20000 lhu r2,0x0000(r21)               #       *p5
801a415c: 00000000 nop
801a4160: 24420001 addiu r2,r2,0x0001               #       *p5 + 1
801a4164: a6a20000 sh r2,0x0000(r21)                #       *p5 = *p5 + 1
                                                    #   }
801a4168: 96620000 lhu r2,0x0000(r19)               #   *p4
801a416c: 00000000 nop
801a4170: 2442ffff addiu r2,r2,-0x0001              #   *p4 - 1
801a4174: a6620000 sh r2,0x0000(r19)                #   *p4 = *p4 - 1
801a4178: 8fbf0028 lw r31,0x0028(r29)
801a417c: 8fb50024 lw r21,0x0024(r29)
801a4180: 8fb40020 lw r20,0x0020(r29)
801a4184: 8fb3001c lw r19,0x001c(r29)
801a4188: 8fb20018 lw r18,0x0018(r29)
801a418c: 8fb10014 lw r17,0x0014(r29)
801a4190: 8fb00010 lw r16,0x0010(r29)
801a4194: 27bd0030 addiu r29,r29,0x0030
801a4198: 03e00008 jr r31
801a419c: 00000000 nop