Effect Related (0x1a15b4)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: ? Effect related (0x1a15b4)           Duplicated here : Ability_animation
#       Parameters:
#           r4 = (p1)
#               First two bytes: Elemental flags
#               Last two bytes: Animation ID
#           r5 = EffectID
#           r6 = (p3) Pointer to struct?

801a15b4: 27bdffd8 addiu r29,r29,-0x0028
801a15b8: afb20020 sw r18,0x0020(r29)
801a15bc: 00809021 addu r18,r4,r0               #   p1
801a15c0: afb00018 sw r16,0x0018(r29)
801a15c4: 00a08021 addu r16,r5,r0               #   EffectID
801a15c8: afb1001c sw r17,0x001c(r29)
801a15cc: 2a020200 slti r2,r16,0x0200           #   Check if EffectID < 0x200
801a15d0: afbf0024 sw r31,0x0024(r29)
801a15d4: 3c01801c lui r1,0x801c
801a15d8: a02024c8 sb r0,0x24c8(r1)             #   *0x801c24c8 = 0
801a15dc: 10400019 beq r2,r0,0x801a1644
801a15e0: 00c08821 addu r17,r6,r0               #   p3
                                                #   if (EffectID < 0x200) {
801a15e4: 34020189 ori r2,r0,0x0189             #       0x189
801a15e8: 16020011 bne r16,r2,0x801a1630        
801a15ec: 00101040 sll r2,r16,0x01              #       EffectID * 2
                                                #       if (EffectID == 0x189) {
801a15f0: 0c06b7eb jal 0x801adfac               #           result_0x1adfac = ? 0x1adfac (p1 >> 16);
801a15f4: 00122402 srl r4,r18,0x10
801a15f8: 00401821 addu r3,r2,r0                #           result_0x1adfac
801a15fc: 34020001 ori r2,r0,0x0001             #           1
801a1600: 14620003 bne r3,r2,0x801a1610
801a1604: 34020002 ori r2,r0,0x0002             #           2
                                                #           if (result_0x1adfac == 1) {
801a1608: 08068595 j 0x801a1654
801a160c: 34020010 ori r2,r0,0x0010             #               RealEffectID = 16
                                                #           } else {
801a1610: 14620003 bne r3,r2,0x801a1620
801a1614: 34020008 ori r2,r0,0x0008             #               8
                                                #               if (result_0x1adfac == 2) {
801a1618: 08068595 j 0x801a1654
801a161c: 34020018 ori r2,r0,0x0018             #                   RealEffectID = 24
                                                #               } else {
801a1620: 1462000e bne r3,r2,0x801a165c         
801a1624: 34020014 ori r2,r0,0x0014             #                   RealEffectID = 20
                                                #                   if (result_0x1adfac != 8) skipSetValue = true;
801a1628: 08068595 j 0x801a1654                 
801a162c: 00000000 nop 
                                                #               }
                                                #           }
                                                #       }
801a1630: 3c01801b lui r1,0x801b
801a1634: 00220821 addu r1,r1,r2
801a1638: 942263f0 lhu r2,0x63f0(r1)            #       RealEffectID = AbilityEffect[EffectID]
801a163c: 08068595 j 0x801a1654
801a1640: 00000000 nop
                                                #   } else {
801a1644: 00101040 sll r2,r16,0x01              #       EffectID * 2
801a1648: 3c01801b lui r1,0x801b
801a164c: 00220821 addu r1,r1,r2
801a1650: 9422637c lhu r2,0x637c(r1)            #       RealEffectID = EventEffect[EffectID]
                                                #   }
801a1654: 3c01801c lui r1,0x801c                #   if (!skipSetValue)
801a1658: a42224d0 sh r2,0x24d0(r1)             #       *0x801c24d0 = RealEffectID
801a165c: 3c02801c lui r2,0x801c
801a1660: 844224d0 lh r2,0x24d0(r2)             #   *0x801c24d0
801a1664: 00000000 nop
801a1668: 04400052 bltz r2,0x801a17b4           
801a166c: 00401821 addu r3,r2,r0                #   *0x801c24d0
                                                #   if (*0x801c24d0 >= 0) {
801a1670: 306201ff andi r2,r3,0x01ff            #       *0x801c24d0 & 0x1ff
801a1674: 3c01801c lui r1,0x801c
801a1678: a42224d0 sh r2,0x24d0(r1)             #       *0x801c24d0 = *0x801c24d0 & 0x1ff
801a167c: 34020001 ori r2,r0,0x0001             #       1
801a1680: 3c01801b lui r1,0x801b                
801a1684: ac2263e8 sw r2,0x63e8(r1)             #       *0x801b63e8 = 1
801a1688: 3242ffff andi r2,r18,0xffff           #       p1 & 0xffff
801a168c: 3c01801c lui r1,0x801c
801a1690: 00220821 addu r1,r1,r2
801a1694: 902484ac lbu r4,-0x7b54(r1)           #       *(0x801b84ac + (p1 & 0xffff))
801a1698: 00000000 nop
801a169c: 10800007 beq r4,r0,0x801a16bc
801a16a0: 00122c02 srl r5,r18,0x10              #       p1 >> 16
                                                #       if (*(0x801b84ac + (p1 & 0xffff)) != 0) {
801a16a4: 0c06b755 jal 0x801add54               #           result_0x1add54 = Effect Related (0x1add54) (*(0x801b84ac + (p1 & 0xffff)),  p1 >> 16, p3);
801a16a8: 02203021 addu r6,r17,r0               #           p3
801a16ac: 3c01801c lui r1,0x801c
801a16b0: a022bf64 sb r2,-0x409c(r1)            #           *0x801bbf64 = result_0x1add54
801a16b4: 080685b1 j 0x801a16c4
801a16b8: 00000000 nop
                                                #       } else {
801a16bc: 3c01801c lui r1,0x801c
801a16c0: a020bf64 sb r0,-0x409c(r1)            #           *0x801bbf64 = 0
                                                #       }
801a16c4: 3c08801c lui r8,0x801c
801a16c8: 2508ad0c addiu r8,r8,-0x52f4          #       destPtr = 0x801bad0c
801a16cc: 02281025 or r2,r17,r8                 #       p3 | destPtr
801a16d0: 30420003 andi r2,r2,0x0003            #       (p3 | destPtr) & 0x03
801a16d4: 3c01801c lui r1,0x801c
801a16d8: a0209253 sb r0,-0x6dad(r1)            #       *0x801b9253 = 0
801a16dc: 3c01801c lui r1,0x801c
801a16e0: a0209252 sb r0,-0x6dae(r1)            #       *0x801b9252 = 0
801a16e4: 3c01801c lui r1,0x801c
801a16e8: a0209251 sb r0,-0x6daf(r1)            #       *0x801b9251 = 0
801a16ec: 3c01801c lui r1,0x801c
801a16f0: a0209250 sb r0,-0x6db0(r1)            #       *0x801b9250 = 0
801a16f4: 10400017 beq r2,r0,0x801a1754
801a16f8: 02203821 addu r7,r17,r0               #       srcPtr = p3
                                                #       if (((p3 | destPtr) & 0x03) != 0) {         #   If both addresses are not word-aligned
801a16fc: 262600c0 addiu r6,r17,0x00c0          #           p3 + 0xc0
                                                #           do {
801a1700: 88e20003 lwl r2,0x0003(r7)
801a1704: 98e20000 lwr r2,0x0000(r7)            #               *srcPtr
801a1708: 88e30007 lwl r3,0x0007(r7)
801a170c: 98e30004 lwr r3,0x0004(r7)            #               *(srcPtr + 4)
801a1710: 88e4000b lwl r4,0x000b(r7)
801a1714: 98e40008 lwr r4,0x0008(r7)            #               *(srcPtr + 8)
801a1718: 88e5000f lwl r5,0x000f(r7)
801a171c: 98e5000c lwr r5,0x000c(r7)            #               *(srcPtr + 12)
801a1720: a9020003 swl r2,0x0003(r8)
801a1724: b9020000 swr r2,0x0000(r8)            #               *destPtr = *srcPtr
801a1728: a9030007 swl r3,0x0007(r8)
801a172c: b9030004 swr r3,0x0004(r8)            #               *(destPtr + 4) = *(srcPtr + 4)
801a1730: a904000b swl r4,0x000b(r8)
801a1734: b9040008 swr r4,0x0008(r8)            #               *(destPtr + 8) = *(srcPtr + 8)
801a1738: a905000f swl r5,0x000f(r8)
801a173c: b905000c swr r5,0x000c(r8)            #               *(destPtr + 12) = *(srcPtr + 12)
801a1740: 24e70010 addiu r7,r7,0x0010           #               srcPtr = srcPtr + 16
801a1744: 14e6ffee bne r7,r6,0x801a1700
801a1748: 25080010 addiu r8,r8,0x0010           #               destPtr = destPtr + 16
                                                #           } while (srcPtr != (p3 + 0xc0))         #   Effectively, runs 12 times   
801a174c: 080685e1 j 0x801a1784
801a1750: 00000000 nop
                                                #       } else {                                    #   If both addresses are word-aligned
801a1754: 262600c0 addiu r6,r17,0x00c0          #           p3 + 0xc0
                                                #           do {
801a1758: 8ce20000 lw r2,0x0000(r7)             #               *srcPtr
801a175c: 8ce30004 lw r3,0x0004(r7)             #               *(srcPtr + 4)
801a1760: 8ce40008 lw r4,0x0008(r7)             #               *(srcPtr + 8)
801a1764: 8ce5000c lw r5,0x000c(r7)             #               *(srcPtr + 12)
801a1768: ad020000 sw r2,0x0000(r8)             #               *destPtr = *srcPtr
801a176c: ad030004 sw r3,0x0004(r8)             #               *(destPtr + 4) = *(srcPtr + 4)
801a1770: ad040008 sw r4,0x0008(r8)             #               *(destPtr + 8) = *(srcPtr + 8)
801a1774: ad05000c sw r5,0x000c(r8)             #               *(destPtr + 12) =  *(srcPtr + 12)
801a1778: 24e70010 addiu r7,r7,0x0010           #               srcPtr = srcPtr + 16
801a177c: 14e6fff6 bne r7,r6,0x801a1758
801a1780: 25080010 addiu r8,r8,0x0010           #               destPtr = destPtr + 16
                                                #           } while (srcPtr != (p3 + 0xc0))
                                                #       }
801a1784: 88e20003 lwl r2,0x0003(r7)
801a1788: 98e20000 lwr r2,0x0000(r7)            #       *srcPtr
801a178c: 88e30007 lwl r3,0x0007(r7)
801a1790: 98e30004 lwr r3,0x0004(r7)            #       *(srcPtr + 4)
801a1794: a9020003 swl r2,0x0003(r8)
801a1798: b9020000 swr r2,0x0000(r8)            #       *destPtr = *srcPtr
801a179c: a9030007 swl r3,0x0007(r8)
801a17a0: b9030004 swr r3,0x0004(r8)            #       *(destPtr + 4) = *(srcPtr + 4)
801a17a4: 3c01801c lui r1,0x801c
801a17a8: ac20c0d4 sw r0,-0x3f2c(r1)            #       *0x801bc0d4 = 0
801a17ac: 080685fe j 0x801a17f8
801a17b0: 00000000 nop
                                                #   } else {
801a17b4: 2602ff76 addiu r2,r16,-0x008a         #       EffectID - 0x8a
801a17b8: 2c420008 sltiu r2,r2,0x0008
801a17bc: 10400004 beq r2,r0,0x801a17d0
801a17c0: 34040012 ori r4,r0,0x0012             #       18
                                                #       if ((EffectID - 0x8a) < 8) {
801a17c4: 00002821 addu r5,r0,r0                #           0
801a17c8: 0c06b755 jal 0x801add54               #           Effect Related (0x1add54) (18, 0, p3);
801a17cc: 02203021 addu r6,r17,r0               #           p3
                                                #       }
801a17d0: 2602fe6a addiu r2,r16,-0x0196         #       EffectID - 0x196
801a17d4: 2c420008 sltiu r2,r2,0x0008
801a17d8: 14400004 bne r2,r0,0x801a17ec
801a17dc: 34040011 ori r4,r0,0x0011             #       17
                                                #       if ((EffectID - 0x196) < 8)
801a17e0: 34020092 ori r2,r0,0x0092             #           0x92
801a17e4: 16020004 bne r16,r2,0x801a17f8        #           OR (EffectID == 0x92))
801a17e8: 00000000 nop                          #       {
                                                #       
801a17ec: 00002821 addu r5,r0,r0                #           0
801a17f0: 0c06b755 jal 0x801add54               #           Effect Related (0x1add54) (17, 0, p3);
801a17f4: 02203021 addu r6,r17,r0               #           p3
                                                #       }
                                                #   }
801a17f8: 8fbf0024 lw r31,0x0024(r29)
801a17fc: 8fb20020 lw r18,0x0020(r29)
801a1800: 8fb1001c lw r17,0x001c(r29)
801a1804: 8fb00018 lw r16,0x0018(r29)
801a1808: 27bd0028 addiu r29,r29,0x0028
801a180c: 03e00008 jr r31
801a1810: 00000000 nop

Return locations

Battle.bin
000739A8: Store_target_coordinates,_attack_display_types
0008A750: 0008a700_-_0008a77c
0008A7d0: 0008a780_-_0008a7fc
0008Dd00: 0008dcc4_-_0008dd0c
0008DD98: Start_New_Effect