Check if any units are in range (0019b30c)

From Final Fantasy Hacktics Wiki
Revision as of 10:54, 24 November 2022 by Dokurider (talk | contribs) (Corrected a comment (The Tri Attack routine is actually the Height/Depth Check))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Check if any units are in range
0019b30c: 3c02801a lui r2,0x801a
0019b310: 90420d7b lbu r2,0x0d7b(r2)
0019b314: 27bdffe8 addiu r29,r29,0xffe8
0019b318: afb00010 sw r16,0x0010(r29)
0019b31c: 3c10801a lui r16,0x801a
0019b320: 2610f3c4 addiu r16,r16,0xf3c4
0019b324: 10400008 beq r2,r0,0x0019b348				Branch if No Action Taken
0019b328: afbf0014 sw r31,0x0014(r29)
0019b32c: 3c02801a lui r2,0x801a
0019b330: 8c42f398 lw r2,-0x0c68(r2)
0019b334: 00000000 nop
0019b338: 10400030 beq r2,r0,0x0019b3fc
0019b33c: 00000000 nop
0019b340: 08066d1e j 0x0019b478						
0019b344: 00000000 nop
0019b348: 3c04fdff lui r4,0xfdff
0019b34c: 3484ffff ori r4,r4,0xffff
0019b350: 3c02801a lui r2,0x801a
0019b354: 8c420078 lw r2,0x0078(r2)
0019b358: 3c03801a lui r3,0x801a
0019b35c: 906301f1 lbu r3,0x01f1(r3)
0019b360: 00441024 and r2,r2,r4
0019b364: 00031880 sll r3,r3,0x02
0019b368: 00701821 addu r3,r3,r16
0019b36c: 3c01801a lui r1,0x801a
0019b370: ac220078 sw r2,0x0078(r1)						Remove Physical Follow Target Spell?
0019b374: 8c620cc4 lw r2,0x0cc4(r3)
0019b378: 3c01801a lui r1,0x801a
0019b37c: ac22f3dc sw r2,-0x0c24(r1)
0019b380: 0c066ec8 jal 0x0019bb20						Check Map for Crystal/Treasure
0019b384: 00000000 nop
0019b388: 3c02801a lui r2,0x801a
0019b38c: 8c42f3d0 lw r2,-0x0c30(r2)
0019b390: 00000000 nop
0019b394: 30421000 andi r2,r2,0x1000
0019b398: 10400021 beq r2,r0,0x0019b420					Branch if Follow Target
0019b39c: 34020005 ori r2,r0,0x0005
0019b3a0: 3c02801a lui r2,0x801a
0019b3a4: 8442f3c6 lh r2,-0x0c3a(r2)					Load Ability ID
0019b3a8: 00000000 nop
0019b3ac: 000218c0 sll r3,r2,0x03
0019b3b0: 00621823 subu r3,r3,r2
0019b3b4: 00031840 sll r3,r3,0x01
0019b3b8: 3c018006 lui r1,0x8006
0019b3bc: 00230821 addu r1,r1,r3
0019b3c0: 9022fbf3 lbu r2,-0x040d(r1)					Load Ability Data 2
0019b3c4: 00000000 nop
0019b3c8: 30420001 andi r2,r2,0x0001
0019b3cc: 14400014 bne r2,r0,0x0019b420					Branch if Ability can Target Self
0019b3d0: 34020005 ori r2,r0,0x0005
0019b3d4: 3c03801a lui r3,0x801a
0019b3d8: 906301f2 lbu r3,0x01f2(r3)
0019b3dc: 34020001 ori r2,r0,0x0001
0019b3e0: 3c01801a lui r1,0x801a
0019b3e4: a022f3d8 sb r2,-0x0c28(r1)
0019b3e8: 34020006 ori r2,r0,0x0006
0019b3ec: 3c01801a lui r1,0x801a
0019b3f0: a022f3ea sb r2,-0x0c16(r1)
0019b3f4: 3c01801a lui r1,0x801a
0019b3f8: a023f3eb sb r3,-0x0c15(r1)
0019b3fc: 0c065bbd jal 0x00196ef4						Check if Highest Target Priority
0019b400: 00000000 nop
0019b404: 2403ffff addiu r3,r0,0xffff
0019b408: 14430005 bne r2,r3,0x0019b420					Branch if ability isn't the highest target priority
0019b40c: 34020005 ori r2,r0,0x0005
0019b410: 3c01801a lui r1,0x801a
0019b414: ac20f398 sw r0,-0x0c68(r1)
0019b418: 08066d38 j 0x0019b4e0							Exit and choose Ability
0019b41c: 2402ffff addiu r2,r0,0xffff
0019b420: a2020026 sb r2,0x0026(r16)					5 = Not the highest Priority (not preferred?)
0019b424: 3c01801a lui r1,0x801a
0019b428: ac20f398 sw r0,-0x0c68(r1)
0019b42c: 8e030e30 lw r3,0x0e30(r16)
0019b430: 34020001 ori r2,r0,0x0001
0019b434: a2020014 sb r2,0x0014(r16)
0019b438: ae030c74 sw r3,0x0c74(r16)
0019b43c: 92030026 lbu r3,0x0026(r16)
0019b440: 34020006 ori r2,r0,0x0006
0019b444: 14620002 bne r3,r2,0x0019b450				Branch if Ability Follows Target?
0019b448: 34040001 ori r4,r0,0x0001
0019b44c: 34040003 ori r4,r0,0x0003
0019b450: 0c06723b jal 0x0019c8ec					Check if Linear Attack hits anything
0019b454: 00002821 addu r5,r0,r0
0019b458: 26040bdc addiu r4,r16,0x0bdc
0019b45c: 26050b4c addiu r5,r16,0x0b4c
0019b460: 0c066ac2 jal 0x0019ab08					Transfer Halfword Values
0019b464: 34060048 ori r6,r0,0x0048
0019b468: 0c066d3d jal 0x0019b4f4					Height/Depth Check
0019b46c: 26040e30 addiu r4,r16,0x0e30
0019b470: 1040000a beq r2,r0,0x0019b49c				Branch if ability can't be used
0019b474: 00000000 nop
0019b478: 0c067367 jal 0x0019cd9c					Check if any units are in range?
0019b47c: 00000000 nop
0019b480: 2403ffff addiu r3,r0,0xffff
0019b484: 14430005 bne r2,r3,0x0019b49c				Branch if no units are in range/RNG said no
0019b488: 34020001 ori r2,r0,0x0001
0019b48c: 3c01801a lui r1,0x801a
0019b490: ac22f398 sw r2,-0x0c68(r1)
0019b494: 08066d38 j 0x0019b4e0						Exit and Chose Ability
0019b498: 2402ffff addiu r2,r0,0xffff
0019b49c: 3c02801a lui r2,0x801a
0019b4a0: 8c42f398 lw r2,-0x0c68(r2)
0019b4a4: 00000000 nop
0019b4a8: 14400008 bne r2,r0,0x0019b4cc				<Find Highest Target Priority> if True
0019b4ac: 24420001 addiu r2,r2,0x0001
0019b4b0: 8e030018 lw r3,0x0018(r16)
0019b4b4: a2000014 sb r0,0x0014(r16)
0019b4b8: ae030c74 sw r3,0x0c74(r16)
0019b4bc: 3c01801a lui r1,0x801a
0019b4c0: ac22f398 sw r2,-0x0c68(r1)
0019b4c4: 08066d0f j 0x0019b43c						Jump back to 0x0026 check
0019b4c8: 00000000 nop
<Find Highest Target Priority>
0019b4cc: 0c067c96 jal 0x0019f258					Store units coordinates
0019b4d0: 26040e30 addiu r4,r16,0x0e30
0019b4d4: 0c065bf1 jal 0x00196fc4					Compare and Set Highest Unit Target Priority
0019b4d8: 00000000 nop
<Exit>
0019b4dc: 00001021 addu r2,r0,r0
0019b4e0: 8fbf0014 lw r31,0x0014(r29)
0019b4e4: 8fb00010 lw r16,0x0010(r29)
0019b4e8: 27bd0018 addiu r29,r29,0x0018
0019b4ec: 03e00008 jr r31
0019b4f0: 00000000 nop