001b0818 - 001b0a8c

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
This routine might set and check direct weapon trajectory 

Parameters : r4 = Attacker ID
             r5 = Target X coord data pointer (From attacker data 0x17a)
             r6 = Target ID

Hypothetically(*) Returns : r2 = Target ID (updated if an unit is on the trajectory)

*deducted from arcing weapon trajectory routines
----------------------------------------------------------------------
001b0818: 27bdffb8 addiu r29,r29,-0x0048
001b081c: afb00028 sw r16,0x0028(r29)
001b0820: 00808021 addu r16,r4,r0
001b0824: afb1002c sw r17,0x002c(r29)
001b0828: 00a08821 addu r17,r5,r0
001b082c: afb40038 sw r20,0x0038(r29)
001b0830: afbf0040 sw r31,0x0040(r29)
001b0834: afb5003c sw r21,0x003c(r29)
001b0838: afb30034 sw r19,0x0034(r29)
001b083c: afb20030 sw r18,0x0030(r29)
001b0840: 3c01801c lui r1,0x801c
001b0844: ac308b60 sw r16,-0x74a0(r1)
001b0848: 0c023727 jal 0x0008dc9c                Find_Unit's_Misc_Data_Pointer_and_Load_Spritesheet_Value
001b084c: 00c0a021 addu r20,r6,r0
001b0850: 3c135555 lui r19,0x5555
001b0854: 36735556 ori r19,r19,0x5556
001b0858: 00021040 sll r2,r2,0x01
001b085c: 00530018 mult r2,r19
001b0860: 000217c3 sra r2,r2,0x1f
001b0864: 00001810 mfhi r3
001b0868: 0062a823 subu r21,r3,r2
001b086c: 2402ffff addiu r2,r0,-0x0001
001b0870: 1282000b beq r20,r2,0x001b08a0
001b0874: 02002021 addu r4,r16,r0
001b0878: 0c023727 jal 0x0008dc9c                Find_Unit's_Misc_Data_Pointer_and_Load_Spritesheet_Value
001b087c: 02802021 addu r4,r20,r0
001b0880: 00021040 sll r2,r2,0x01
001b0884: 00530018 mult r2,r19
001b0888: 000217c3 sra r2,r2,0x1f
001b088c: 00001810 mfhi r3
001b0890: 00629023 subu r18,r3,r2
001b0894: 16400002 bne r18,r0,0x001b08a0
001b0898: 02002021 addu r4,r16,r0
001b089c: 3412000c ori r18,r0,0x000c
001b08a0: 2405ffff addiu r5,r0,-0x0001
001b08a4: 0c06bddc jal 0x001af770                List targeting data of all valid units
001b08a8: 27a60020 addiu r6,r29,0x0020
001b08ac: 3c05801c lui r5,0x801c
001b08b0: 24a5925c addiu r5,r5,-0x6da4
001b08b4: 0c02311a jal 0x0008c468                Set Unit Xmod, Y Mod and Height data from unit ID
001b08b8: 02002021 addu r4,r16,r0
001b08bc: 3c02801c lui r2,0x801c
001b08c0: 9442925e lhu r2,-0x6da2(r2)
001b08c4: 00000000 nop
001b08c8: 00551023 subu r2,r2,r21
001b08cc: 3c01801c lui r1,0x801c
001b08d0: a422925e sh r2,-0x6da2(r1)
001b08d4: 2402ffff addiu r2,r0,-0x0001
001b08d8: 1682001d bne r20,r2,0x001b0950
001b08dc: 00000000 nop
001b08e0: 86240000 lh r4,0x0000(r17)
001b08e4: 86250004 lh r5,0x0004(r17)
001b08e8: 86260002 lh r6,0x0002(r17)
001b08ec: 0c060fed jal 0x00183fb4                Get_Tile_Data_Pointer
001b08f0: 00000000 nop
001b08f4: 86240000 lh r4,0x0000(r17)
001b08f8: 00000000 nop
001b08fc: 000418c0 sll r3,r4,0x03
001b0900: 00641823 subu r3,r3,r4
001b0904: 00031880 sll r3,r3,0x02
001b0908: 2463000e addiu r3,r3,0x000e
001b090c: 3c01801c lui r1,0x801c
001b0910: a4239264 sh r3,-0x6d9c(r1)
001b0914: 86240004 lh r4,0x0004(r17)
001b0918: 00000000 nop
001b091c: 000418c0 sll r3,r4,0x03
001b0920: 00641823 subu r3,r3,r4
001b0924: 00031880 sll r3,r3,0x02
001b0928: 2463000e addiu r3,r3,0x000e
001b092c: 3c01801c lui r1,0x801c
001b0930: a4239268 sh r3,-0x6d98(r1)
001b0934: 90430002 lbu r3,0x0002(r2)
001b0938: 00000000 nop
001b093c: 00031040 sll r2,r3,0x01
001b0940: 00431021 addu r2,r2,r3
001b0944: 00021080 sll r2,r2,0x02
001b0948: 0806c25c j 0x001b0970
001b094c: 00021023 subu r2,r0,r2
001b0950: 3c05801c lui r5,0x801c
001b0954: 24a59264 addiu r5,r5,-0x6d9c
001b0958: 0c02311a jal 0x0008c468                0008c468_-_0008c514
001b095c: 02802021 addu r4,r20,r0
001b0960: 3c02801c lui r2,0x801c
001b0964: 94429266 lhu r2,-0x6d9a(r2)
001b0968: 00000000 nop
001b096c: 00521023 subu r2,r2,r18
001b0970: 3c01801c lui r1,0x801c
001b0974: a4229266 sh r2,-0x6d9a(r1)
001b0978: 3c10801c lui r16,0x801c
001b097c: 2610925c addiu r16,r16,-0x6da4
001b0980: 3c04801c lui r4,0x801c
001b0984: 84849264 lh r4,-0x6d9c(r4)
001b0988: 86020000 lh r2,0x0000(r16)
001b098c: 00000000 nop
001b0990: 00822023 subu r4,r4,r2
001b0994: 00840018 mult r4,r4
001b0998: 3c03801c lui r3,0x801c
001b099c: 84639268 lh r3,-0x6d98(r3)
001b09a0: 3c02801c lui r2,0x801c
001b09a4: 84429260 lh r2,-0x6da0(r2)
001b09a8: 00003012 mflo r6
001b09ac: 00621823 subu r3,r3,r2
001b09b0: 00000000 nop
001b09b4: 00630018 mult r3,r3
001b09b8: 3c05801c lui r5,0x801c
001b09bc: 84a5925e lh r5,-0x6da2(r5)
001b09c0: 3c02801c lui r2,0x801c
001b09c4: 84429266 lh r2,-0x6d9a(r2)
001b09c8: afa40010 sw r4,0x0010(r29)
001b09cc: afa30018 sw r3,0x0018(r29)
001b09d0: 00451023 subu r2,r2,r5
001b09d4: afa20014 sw r2,0x0014(r29)
001b09d8: 00002012 mflo r4
001b09dc: 0c006fce jal 0x0001bf38                0001bf38_-_0001bfb0
001b09e0: 00c42021 addu r4,r6,r4
001b09e4: 8fa40014 lw r4,0x0014(r29)
001b09e8: 0c00763a jal 0x0001d8e8                Get_Angle_Value_via_ArcTan_Table
001b09ec: 00402821 addu r5,r2,r0
001b09f0: 8fa30010 lw r3,0x0010(r29)
001b09f4: 00000000 nop
001b09f8: 00630018 mult r3,r3
001b09fc: 00002012 mflo r4
001b0a00: 8fa30014 lw r3,0x0014(r29)
001b0a04: 00000000 nop
001b0a08: 00630018 mult r3,r3
001b0a0c: 00002812 mflo r5
001b0a10: 8fa30018 lw r3,0x0018(r29)
001b0a14: 00000000 nop
001b0a18: 00630018 mult r3,r3
001b0a1c: 24420400 addiu r2,r2,0x0400
001b0a20: 3c01801c lui r1,0x801c
001b0a24: a4228b70 sh r2,-0x7490(r1)
001b0a28: 00852021 addu r4,r4,r5
001b0a2c: 00001012 mflo r2
001b0a30: 00822021 addu r4,r4,r2
001b0a34: 0c00709a jal 0x0001c268               Get_Square_root_of_r4_dealing_with_4096
001b0a38: 00042300 sll r4,r4,0x0c
001b0a3c: 27a40010 addiu r4,r29,0x0010
001b0a40: 02002821 addu r5,r16,r0
001b0a44: 8fa70020 lw r7,0x0020(r29)
001b0a48: 27a60024 addiu r6,r29,0x0024
001b0a4c: 0c06c137 jal 0x001b04dc                   001b04dc_-_001b06cc - Trajectory related
001b0a50: afa20024 sw r2,0x0024(r29)
001b0a54: 00401821 addu r3,r2,r0
001b0a58: 14600003 bne r3,r0,0x001b0a68
001b0a5c: 02801021 addu r2,r20,r0
001b0a60: 3c02801c lui r2,0x801c
001b0a64: 8c428b64 lw r2,-0x749c(r2)
001b0a68: 8fbf0040 lw r31,0x0040(r29)
001b0a6c: 8fb5003c lw r21,0x003c(r29)
001b0a70: 8fb40038 lw r20,0x0038(r29)
001b0a74: 8fb30034 lw r19,0x0034(r29)
001b0a78: 8fb20030 lw r18,0x0030(r29)
001b0a7c: 8fb1002c lw r17,0x002c(r29)
001b0a80: 8fb00028 lw r16,0x0028(r29)
001b0a84: 27bd0048 addiu r29,r29,0x0048
001b0a88: 03e00008 jr r31
001b0a8c: 00000000 nop

Return locations

Battle.bin
0008e290: 0008e234_-_0008e2c4
0017aefc: Targeting_validation_(weapon_flags)