Difference between revisions of "Auxilary targeting validation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 0017afc0: 27bdffa0 addiu r29,r29,0xffa0 0017afc4: afb00038 sw r16,0x0038(r29) 0017afc8: 00808021 addu r16,r4,r0 0017afcc: afb5004c sw r21,0x004...")
 
m (notes + return link)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<font face='Courier New'>
+
This routine might set and check lunging weapon trajectory
 
   
 
   
 +
Parameters : r4 = Attacker ID
 +
              r5 = Target X coord
 +
              r6 = Target Y coord
 +
              r7 = target elevation (set but not used..)  
 +
 +
Hypothetically(*) Returns : r2 = Target ID (updated if an unit is on the trajectory)
 +
 +
*deducted from arcing weapon trajectory routines
 +
--------------------------------------------------------------------------------------
 
  0017afc0: 27bdffa0 addiu r29,r29,0xffa0
 
  0017afc0: 27bdffa0 addiu r29,r29,0xffa0
 
  0017afc4: afb00038 sw r16,0x0038(r29)
 
  0017afc4: afb00038 sw r16,0x0038(r29)
  0017afc8: 00808021 addu r16,r4,r0
+
  0017afc8: 00808021 addu r16,r4,r0 r16 = Attacker ID
 
  0017afcc: afb5004c sw r21,0x004c(r29)
 
  0017afcc: afb5004c sw r21,0x004c(r29)
  0017afd0: 00a0a821 addu r21,r5,r0 Target X
+
  0017afd0: 00a0a821 addu r21,r5,r0 r21 = Target X
 
  0017afd4: afb70054 sw r23,0x0054(r29)
 
  0017afd4: afb70054 sw r23,0x0054(r29)
  0017afd8: 001010c0 sll r2,r16,0x03
+
  0017afd8: 001010c0 sll r2,r16,0x03 ID * 8
  0017afdc: 00501023 subu r2,r2,r16
+
  0017afdc: 00501023 subu r2,r2,r16 ID * 7
  0017afe0: 00021180 sll r2,r2,0x06
+
  0017afe0: 00021180 sll r2,r2,0x06 ID * 448
 
  0017afe4: 3c038019 lui r3,0x8019
 
  0017afe4: 3c038019 lui r3,0x8019
  0017afe8: 246308cc addiu r3,r3,0x08cc r2 = unit data
+
  0017afe8: 246308cc addiu r3,r3,0x08cc
  0017afec: 00431021 addu r2,r2,r3
+
  0017afec: 00431021 addu r2,r2,r3 r2 = Attacker's Data Pointer
 
  0017aff0: afbf005c sw r31,0x005c(r29)
 
  0017aff0: afbf005c sw r31,0x005c(r29)
 
  0017aff4: afbe0058 sw r30,0x0058(r29)
 
  0017aff4: afbe0058 sw r30,0x0058(r29)
Line 20: Line 29:
 
  0017b004: afb20040 sw r18,0x0040(r29)
 
  0017b004: afb20040 sw r18,0x0040(r29)
 
  0017b008: afb1003c sw r17,0x003c(r29)
 
  0017b008: afb1003c sw r17,0x003c(r29)
  0017b00c: 90530047 lbu r19,0x0047(r2) load Y
+
  0017b00c: 90530047 lbu r19,0x0047(r2) Load Attacker's X
  0017b010: 8fb60070 lw r22,0x0070(r29)
+
  0017b010: 8fb60070 lw r22,0x0070(r29) Load Target ID
  0017b014: 90540048 lbu r20,0x0048(r2) load X
+
  0017b014: 90540048 lbu r20,0x0048(r2) Load Attacker's Y
 
  0017b018: 0275182a slt r3,r19,r21
 
  0017b018: 0275182a slt r3,r19,r21
  0017b01c: 10600003 beq r3,r0,0x0017b02c
+
  0017b01c: 10600003 beq r3,r0,0x0017b02c Branch if AX >= TX
  0017b020: 00c0b821 addu r23,r6,r0 Target Y
+
  0017b020: 00c0b821 addu r23,r6,r0 r23 = Target Y
 
  0017b024: 0805ec0c j 0x0017b030
 
  0017b024: 0805ec0c j 0x0017b030
  0017b028: 02b32023 subu r4,r21,r19
+
  0017b028: 02b32023 subu r4,r21,r19 X Difference = TX - AX
  0017b02c: 02752023 subu r4,r19,r21
+
  0017b02c: 02752023 subu r4,r19,r21 X Difference = AX - TX
 
  0017b030: 0297102a slt r2,r20,r23
 
  0017b030: 0297102a slt r2,r20,r23
  0017b034: 14400002 bne r2,r0,0x0017b040
+
  0017b034: 14400002 bne r2,r0,0x0017b040 Branch if AY < TY
  0017b038: 02f41823 subu r3,r23,r20
+
  0017b038: 02f41823 subu r3,r23,r20 Y Difference = TY - AY
  0017b03c: 02971823 subu r3,r20,r23
+
  0017b03c: 02971823 subu r3,r20,r23 Y Difference = AY - TY
  0017b040: 14800007 bne r4,r0,0x0017b060
+
  0017b040: 14800007 bne r4,r0,0x0017b060 Branch if X Difference != 0
  0017b044: 34020001 ori r2,r0,0x0001
+
  0017b044: 34020001 ori r2,r0,0x0001 r2 = 1
  0017b048: 1062000a beq r3,r2,0x0017b074
+
  0017b048: 1062000a beq r3,r2,0x0017b074 Branch if Y Difference = 1
  0017b04c: 34020002 ori r2,r0,0x0002
+
  0017b04c: 34020002 ori r2,r0,0x0002 (Distance = 1)
  0017b050: 1062000d beq r3,r2,0x0017b088
+
  0017b050: 1062000d beq r3,r2,0x0017b088 Branch if Y Difference = 2
  0017b054: 34110002 ori r17,r0,0x0002
+
  0017b054: 34110002 ori r17,r0,0x0002 Distance = 2
 
  0017b058: 0805ecf0 j 0x0017b3c0
 
  0017b058: 0805ecf0 j 0x0017b3c0
  0017b05c: 2402ffff addiu r2,r0,0xffff
+
  0017b05c: 2402ffff addiu r2,r0,0xffff r2 = -1 (Fail)
  0017b060: 146000d7 bne r3,r0,0x0017b3c0
+
  0017b060: 146000d7 bne r3,r0,0x0017b3c0 Branch if Y Difference != 0
  0017b064: 2402ffff addiu r2,r0,0xffff
+
  0017b064: 2402ffff addiu r2,r0,0xffff r2 = -1
 
  0017b068: 34020001 ori r2,r0,0x0001
 
  0017b068: 34020001 ori r2,r0,0x0001
  0017b06c: 14820003 bne r4,r2,0x0017b07c
+
  0017b06c: 14820003 bne r4,r2,0x0017b07c Branch if X Difference != 1
 
  0017b070: 34020002 ori r2,r0,0x0002
 
  0017b070: 34020002 ori r2,r0,0x0002
 
  0017b074: 0805ec22 j 0x0017b088
 
  0017b074: 0805ec22 j 0x0017b088
  0017b078: 34110001 ori r17,r0,0x0001
+
  0017b078: 34110001 ori r17,r0,0x0001 Distance = 1
  0017b07c: 148200d0 bne r4,r2,0x0017b3c0
+
  0017b07c: 148200d0 bne r4,r2,0x0017b3c0 Branch if X Difference != 2
  0017b080: 2402ffff addiu r2,r0,0xffff
+
  0017b080: 2402ffff addiu r2,r0,0xffff r2 = -1
  0017b084: 34110002 ori r17,r0,0x0002
+
  0017b084: 34110002 ori r17,r0,0x0002 Distance = 2
  0017b088: 27a40010 addiu r4,r29,0x0010
+
  0017b088: 27a40010 addiu r4,r29,0x0010 r4 = Stack Pointer + 0x10
  0017b08c: 0c05f056 jal 0x0017c158 calculate height data
+
  0017b08c: 0c05f056 jal 0x0017c158 [[Calculate_Height_Data]]
  0017b090: 02c02821 addu r5,r22,r0
+
  0017b090: 02c02821 addu r5,r22,r0 r5 = Target ID
  0017b094: 93a20013 lbu r2,0x0013(r29)
+
  0017b094: 93a20013 lbu r2,0x0013(r29) Load Target's ID
 
  0017b098: 00000000 nop
 
  0017b098: 00000000 nop
 
  0017b09c: 30420080 andi r2,r2,0x0080
 
  0017b09c: 30420080 andi r2,r2,0x0080
  0017b0a0: 10400002 beq r2,r0,0x0017b0ac
+
  0017b0a0: 10400002 beq r2,r0,0x0017b0ac Branch if Target isn't
  0017b0a4: 02002821 addu r5,r16,r0
+
  0017b0a4: 02002821 addu r5,r16,r0 r5 = Attacker's ID
  0017b0a8: 2416ffff addiu r22,r0,0xffff
+
  0017b0a8: 2416ffff addiu r22,r0,0xffff Target ID = -1
  0017b0ac: 93b20016 lbu r18,0x0016(r29)
+
  0017b0ac: 93b20016 lbu r18,0x0016(r29) Load Target's Final Height
  0017b0b0: 93b00015 lbu r16,0x0015(r29)
+
  0017b0b0: 93b00015 lbu r16,0x0015(r29) Load Target's Modified Height
  0017b0b4: 0c05f056 jal 0x0017c158 calculate height data
+
  0017b0b4: 0c05f056 jal 0x0017c158 [[Calculate_Height_Data]]
  0017b0b8: 27a40010 addiu r4,r29,0x0010
+
  0017b0b8: 27a40010 addiu r4,r29,0x0010 r4 = Stack Pointer
  0017b0bc: 93a20013 lbu r2,0x0013(r29)
+
  0017b0bc: 93a20013 lbu r2,0x0013(r29) Load Attacker's ID
 
  0017b0c0: 00000000 nop
 
  0017b0c0: 00000000 nop
 
  0017b0c4: 30420080 andi r2,r2,0x0080
 
  0017b0c4: 30420080 andi r2,r2,0x0080
  0017b0c8: 144000bd bne r2,r0,0x0017b3c0
+
  0017b0c8: 144000bd bne r2,r0,0x0017b3c0 Branch if Attacker is Dead
  0017b0cc: 2402ffff addiu r2,r0,0xffff
+
  0017b0cc: 2402ffff addiu r2,r0,0xffff r2 = -1
  0017b0d0: 93aa0015 lbu r10,0x0015(r29)
+
  0017b0d0: 93aa0015 lbu r10,0x0015(r29) Load Attacker's Modified Height
 
  0017b0d4: 00000000 nop
 
  0017b0d4: 00000000 nop
  0017b0d8: a3aa0018 sb r10,0x0018(r29)
+
  0017b0d8: a3aa0018 sb r10,0x0018(r29) Store Attacker's Modified Height
  0017b0dc: 93aa0016 lbu r10,0x0016(r29)
+
  0017b0dc: 93aa0016 lbu r10,0x0016(r29) Load Attacker's Final Height
 
  0017b0e0: 34020001 ori r2,r0,0x0001
 
  0017b0e0: 34020001 ori r2,r0,0x0001
  0017b0e4: 16220011 bne r17,r2,0x0017b12c
+
  0017b0e4: 16220011 bne r17,r2,0x0017b12c Branch if Distance != 1
  0017b0e8: a3aa0020 sb r10,0x0020(r29)
+
  0017b0e8: a3aa0020 sb r10,0x0020(r29) Store Attacker's Final Height
  0017b0ec: 2402ffff addiu r2,r0,0xffff
+
  0017b0ec: 2402ffff addiu r2,r0,0xffff r2 = -1
  0017b0f0: 12c200b3 beq r22,r2,0x0017b3c0
+
  0017b0f0: 12c200b3 beq r22,r2,0x0017b3c0 Branch if Target is illegal
 
  0017b0f4: 00000000 nop
 
  0017b0f4: 00000000 nop
  0017b0f8: 93aa0020 lbu r10,0x0020(r29)
+
  0017b0f8: 93aa0020 lbu r10,0x0020(r29) Load Attacker's Final Height
 
  0017b0fc: 00000000 nop
 
  0017b0fc: 00000000 nop
  0017b100: 25430002 addiu r3,r10,0x0002
+
  0017b100: 25430002 addiu r3,r10,0x0002 r3 = A Final Height + 2
 
  0017b104: 0203182a slt r3,r16,r3
 
  0017b104: 0203182a slt r3,r16,r3
  0017b108: 106000ad beq r3,r0,0x0017b3c0
+
  0017b108: 106000ad beq r3,r0,0x0017b3c0 Branch if T Modified Height >= A Final Height + 2
  0017b10c: 26430002 addiu r3,r18,0x0002
+
  0017b10c: 26430002 addiu r3,r18,0x0002 r3 = T Final Height + 2
  0017b110: 93aa0018 lbu r10,0x0018(r29)
+
  0017b110: 93aa0018 lbu r10,0x0018(r29) Load Attacker's Modified Height
 
  0017b114: 00000000 nop
 
  0017b114: 00000000 nop
 
  0017b118: 006a182a slt r3,r3,r10
 
  0017b118: 006a182a slt r3,r3,r10
  0017b11c: 146000a8 bne r3,r0,0x0017b3c0
+
  0017b11c: 146000a8 bne r3,r0,0x0017b3c0 Branch if T Final Height + 2 < A Modified Height
 
  0017b120: 00000000 nop
 
  0017b120: 00000000 nop
 
  0017b124: 0805ecf0 j 0x0017b3c0
 
  0017b124: 0805ecf0 j 0x0017b3c0
  0017b128: 02c01021 addu r2,r22,r0
+
  0017b128: 02c01021 addu r2,r22,r0 r2 = Target ID
 
  0017b12c: 02751021 addu r2,r19,r21
 
  0017b12c: 02751021 addu r2,r19,r21
 
  0017b130: 00021fc2 srl r3,r2,0x1f
 
  0017b130: 00021fc2 srl r3,r2,0x1f
Line 133: Line 142:
 
  0017b1c8: 00003021 addu r6,r0,r0
 
  0017b1c8: 00003021 addu r6,r0,r0
 
  0017b1cc: 3c088019 lui r8,0x8019
 
  0017b1cc: 3c088019 lui r8,0x8019
  0017b1d0: 2508f8cc addiu r8,r8,0xf8cc tile data
+
  0017b1d0: 2508f8cc addiu r8,r8,0xf8cc
 
  0017b1d4: 0120f021 addu r30,r9,r0
 
  0017b1d4: 0120f021 addu r30,r9,r0
 
  0017b1d8: 8fa40028 lw r4,0x0028(r29)
 
  0017b1d8: 8fa40028 lw r4,0x0028(r29)
Line 153: Line 162:
 
  0017b218: 00031840 sll r3,r3,0x01
 
  0017b218: 00031840 sll r3,r3,0x01
 
  0017b21c: 3042001f andi r2,r2,0x001f
 
  0017b21c: 3042001f andi r2,r2,0x001f
  0017b220: 0c05f722 jal 0x0017dc88 get ID if unit is targetable
+
  0017b220: 0c05f722 jal 0x0017dc88 Get ID of Unit if Tile is Targetable
 
  0017b224: 0062a021 addu r20,r3,r2
 
  0017b224: 0062a021 addu r20,r3,r2
 
  0017b228: 00409821 addu r19,r2,r0
 
  0017b228: 00409821 addu r19,r2,r0
 
  0017b22c: 8fa40028 lw r4,0x0028(r29)
 
  0017b22c: 8fa40028 lw r4,0x0028(r29)
 
  0017b230: 8fa50030 lw r5,0x0030(r29)
 
  0017b230: 8fa50030 lw r5,0x0030(r29)
  0017b234: 0c05f722 jal 0x0017dc88 get ID if unit is targetable
+
  0017b234: 0c05f722 jal 0x0017dc88 Get ID of Unit if Tile is Targetable
 
  0017b238: 34060001 ori r6,r0,0x0001
 
  0017b238: 34060001 ori r6,r0,0x0001
 
  0017b23c: 92030006 lbu r3,0x0006(r16)
 
  0017b23c: 92030006 lbu r3,0x0006(r16)
Line 185: Line 194:
 
  0017b298: 10620013 beq r3,r2,0x0017b2e8
 
  0017b298: 10620013 beq r3,r2,0x0017b2e8
 
  0017b29c: 27a40010 addiu r4,r29,0x0010
 
  0017b29c: 27a40010 addiu r4,r29,0x0010
  0017b2a0: 0c05f056 jal 0x0017c158 calculate height data
+
  0017b2a0: 0c05f056 jal 0x0017c158 Calculate Height Data
 
  0017b2a4: 02602821 addu r5,r19,r0
 
  0017b2a4: 02602821 addu r5,r19,r0
 
  0017b2a8: 93a20013 lbu r2,0x0013(r29)
 
  0017b2a8: 93a20013 lbu r2,0x0013(r29)
Line 207: Line 216:
 
  0017b2f0: 12020011 beq r16,r2,0x0017b338
 
  0017b2f0: 12020011 beq r16,r2,0x0017b338
 
  0017b2f4: 27a40010 addiu r4,r29,0x0010
 
  0017b2f4: 27a40010 addiu r4,r29,0x0010
  0017b2f8: 0c05f056 jal 0x0017c158 calculate height data
+
  0017b2f8: 0c05f056 jal 0x0017c158 [[Calculate_Height_Data]]
 
  0017b2fc: 02a02821 addu r5,r21,r0
 
  0017b2fc: 02a02821 addu r5,r21,r0
 
  0017b300: 93a20013 lbu r2,0x0013(r29)
 
  0017b300: 93a20013 lbu r2,0x0013(r29)
Line 235: Line 244:
 
  0017b360: 8fa40028 lw r4,0x0028(r29)
 
  0017b360: 8fa40028 lw r4,0x0028(r29)
 
  0017b364: 8fa50030 lw r5,0x0030(r29)
 
  0017b364: 8fa50030 lw r5,0x0030(r29)
  0017b368: 0c05f722 jal 0x0017dc88 get ID if unit is targetable
+
  0017b368: 0c05f722 jal 0x0017dc88 Get ID of Unit if Tile is Targetable
 
  0017b36c: 02003021 addu r6,r16,r0
 
  0017b36c: 02003021 addu r6,r16,r0
 
  0017b370: 0040b021 addu r22,r2,r0
 
  0017b370: 0040b021 addu r22,r2,r0
 
  0017b374: 27a40010 addiu r4,r29,0x0010
 
  0017b374: 27a40010 addiu r4,r29,0x0010
  0017b378: 0c05f056 jal 0x0017c158 calculate height data
+
  0017b378: 0c05f056 jal 0x0017c158 [[Calculate_Height_Data]]
 
  0017b37c: 02c02821 addu r5,r22,r0
 
  0017b37c: 02c02821 addu r5,r22,r0
 
  0017b380: 93a20013 lbu r2,0x0013(r29)
 
  0017b380: 93a20013 lbu r2,0x0013(r29)
Line 270: Line 279:
 
  0017b3ec: 03e00008 jr r31
 
  0017b3ec: 03e00008 jr r31
 
  0017b3f0: 00000000 nop
 
  0017b3f0: 00000000 nop
</font>
+
=== Return locations ===
 +
'''Battle.bin'''
 +
0017af20: [[Targeting_validation_(weapon_flags)]]

Latest revision as of 21:30, 31 January 2022

This routine might set and check lunging weapon trajectory 

Parameters : r4 = Attacker ID
             r5 = Target X coord
             r6 = Target Y coord
             r7 = target elevation (set but not used..)				  

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

*deducted from arcing weapon trajectory routines
--------------------------------------------------------------------------------------
0017afc0: 27bdffa0 addiu r29,r29,0xffa0
0017afc4: afb00038 sw r16,0x0038(r29)
0017afc8: 00808021 addu r16,r4,r0		r16 = Attacker ID
0017afcc: afb5004c sw r21,0x004c(r29)
0017afd0: 00a0a821 addu r21,r5,r0		r21 = Target X
0017afd4: afb70054 sw r23,0x0054(r29)
0017afd8: 001010c0 sll r2,r16,0x03		ID * 8
0017afdc: 00501023 subu r2,r2,r16		ID * 7
0017afe0: 00021180 sll r2,r2,0x06		ID * 448
0017afe4: 3c038019 lui r3,0x8019
0017afe8: 246308cc addiu r3,r3,0x08cc
0017afec: 00431021 addu r2,r2,r3		r2 = Attacker's Data Pointer
0017aff0: afbf005c sw r31,0x005c(r29)
0017aff4: afbe0058 sw r30,0x0058(r29)
0017aff8: afb60050 sw r22,0x0050(r29)
0017affc: afb40048 sw r20,0x0048(r29)
0017b000: afb30044 sw r19,0x0044(r29)
0017b004: afb20040 sw r18,0x0040(r29)
0017b008: afb1003c sw r17,0x003c(r29)
0017b00c: 90530047 lbu r19,0x0047(r2)		Load Attacker's X
0017b010: 8fb60070 lw r22,0x0070(r29)		Load Target ID
0017b014: 90540048 lbu r20,0x0048(r2)		Load Attacker's Y
0017b018: 0275182a slt r3,r19,r21
0017b01c: 10600003 beq r3,r0,0x0017b02c		Branch if AX >= TX
0017b020: 00c0b821 addu r23,r6,r0		r23 = Target Y
0017b024: 0805ec0c j 0x0017b030
0017b028: 02b32023 subu r4,r21,r19		X Difference = TX - AX
0017b02c: 02752023 subu r4,r19,r21		X Difference = AX - TX
0017b030: 0297102a slt r2,r20,r23
0017b034: 14400002 bne r2,r0,0x0017b040		Branch if AY < TY
0017b038: 02f41823 subu r3,r23,r20		Y Difference = TY - AY
0017b03c: 02971823 subu r3,r20,r23		Y Difference = AY - TY
0017b040: 14800007 bne r4,r0,0x0017b060		Branch if X Difference != 0
0017b044: 34020001 ori r2,r0,0x0001		r2 = 1
0017b048: 1062000a beq r3,r2,0x0017b074		Branch if Y Difference = 1
0017b04c: 34020002 ori r2,r0,0x0002		(Distance = 1)
0017b050: 1062000d beq r3,r2,0x0017b088		Branch if Y Difference = 2
0017b054: 34110002 ori r17,r0,0x0002		Distance = 2
0017b058: 0805ecf0 j 0x0017b3c0
0017b05c: 2402ffff addiu r2,r0,0xffff		r2 = -1 (Fail)
0017b060: 146000d7 bne r3,r0,0x0017b3c0		Branch if Y Difference != 0
0017b064: 2402ffff addiu r2,r0,0xffff		r2 = -1
0017b068: 34020001 ori r2,r0,0x0001
0017b06c: 14820003 bne r4,r2,0x0017b07c		Branch if X Difference != 1
0017b070: 34020002 ori r2,r0,0x0002
0017b074: 0805ec22 j 0x0017b088
0017b078: 34110001 ori r17,r0,0x0001		Distance = 1
0017b07c: 148200d0 bne r4,r2,0x0017b3c0		Branch if X Difference != 2
0017b080: 2402ffff addiu r2,r0,0xffff		r2 = -1
0017b084: 34110002 ori r17,r0,0x0002		Distance = 2
0017b088: 27a40010 addiu r4,r29,0x0010		r4 = Stack Pointer + 0x10
0017b08c: 0c05f056 jal 0x0017c158		Calculate_Height_Data
0017b090: 02c02821 addu r5,r22,r0		r5 = Target ID
0017b094: 93a20013 lbu r2,0x0013(r29)		Load Target's ID
0017b098: 00000000 nop
0017b09c: 30420080 andi r2,r2,0x0080
0017b0a0: 10400002 beq r2,r0,0x0017b0ac		Branch if Target isn't
0017b0a4: 02002821 addu r5,r16,r0		r5 = Attacker's ID
0017b0a8: 2416ffff addiu r22,r0,0xffff		Target ID = -1
0017b0ac: 93b20016 lbu r18,0x0016(r29)		Load Target's Final Height
0017b0b0: 93b00015 lbu r16,0x0015(r29)		Load Target's Modified Height
0017b0b4: 0c05f056 jal 0x0017c158		Calculate_Height_Data
0017b0b8: 27a40010 addiu r4,r29,0x0010		r4 = Stack Pointer
0017b0bc: 93a20013 lbu r2,0x0013(r29)		Load Attacker's ID
0017b0c0: 00000000 nop
0017b0c4: 30420080 andi r2,r2,0x0080
0017b0c8: 144000bd bne r2,r0,0x0017b3c0		Branch if Attacker is Dead
0017b0cc: 2402ffff addiu r2,r0,0xffff		r2 = -1
0017b0d0: 93aa0015 lbu r10,0x0015(r29)		Load Attacker's Modified Height
0017b0d4: 00000000 nop
0017b0d8: a3aa0018 sb r10,0x0018(r29)		Store Attacker's Modified Height
0017b0dc: 93aa0016 lbu r10,0x0016(r29)		Load Attacker's Final Height
0017b0e0: 34020001 ori r2,r0,0x0001
0017b0e4: 16220011 bne r17,r2,0x0017b12c	Branch if Distance != 1
0017b0e8: a3aa0020 sb r10,0x0020(r29)		Store Attacker's Final Height
0017b0ec: 2402ffff addiu r2,r0,0xffff		r2 = -1
0017b0f0: 12c200b3 beq r22,r2,0x0017b3c0	Branch if Target is illegal
0017b0f4: 00000000 nop
0017b0f8: 93aa0020 lbu r10,0x0020(r29)		Load Attacker's Final Height
0017b0fc: 00000000 nop
0017b100: 25430002 addiu r3,r10,0x0002		r3 = A Final Height + 2
0017b104: 0203182a slt r3,r16,r3
0017b108: 106000ad beq r3,r0,0x0017b3c0		Branch if T Modified Height >= A Final Height + 2
0017b10c: 26430002 addiu r3,r18,0x0002		r3 = T Final Height + 2
0017b110: 93aa0018 lbu r10,0x0018(r29)		Load Attacker's Modified Height
0017b114: 00000000 nop
0017b118: 006a182a slt r3,r3,r10
0017b11c: 146000a8 bne r3,r0,0x0017b3c0		Branch if T Final Height + 2 < A Modified Height
0017b120: 00000000 nop
0017b124: 0805ecf0 j 0x0017b3c0
0017b128: 02c01021 addu r2,r22,r0		r2 = Target ID
0017b12c: 02751021 addu r2,r19,r21
0017b130: 00021fc2 srl r3,r2,0x1f
0017b134: 00431021 addu r2,r2,r3
0017b138: 00021043 sra r2,r2,0x01
0017b13c: afa20028 sw r2,0x0028(r29)
0017b140: 02971021 addu r2,r20,r23
0017b144: 00021fc2 srl r3,r2,0x1f
0017b148: 00431021 addu r2,r2,r3
0017b14c: 00021043 sra r2,r2,0x01
0017b150: afa20030 sw r2,0x0030(r29)
0017b154: 34020002 ori r2,r0,0x0002
0017b158: 1622007c bne r17,r2,0x0017b34c
0017b15c: 2402ffff addiu r2,r0,0xffff
0017b160: 12c2007a beq r22,r2,0x0017b34c
0017b164: 320300ff andi r3,r16,0x00ff
0017b168: 93aa0020 lbu r10,0x0020(r29)
0017b16c: 00000000 nop
0017b170: 25460002 addiu r6,r10,0x0002
0017b174: 0066102a slt r2,r3,r6
0017b178: 10400074 beq r2,r0,0x0017b34c
0017b17c: 00000000 nop
0017b180: 93a40018 lbu r4,0x0018(r29)
0017b184: 324500ff andi r5,r18,0x00ff
0017b188: 00a4102b sltu r2,r5,r4
0017b18c: 1440006f bne r2,r0,0x0017b34c
0017b190: 2484fffa addiu r4,r4,0xfffa
0017b194: 0083102a slt r2,r4,r3
0017b198: 10400002 beq r2,r0,0x0017b1a4
0017b19c: 00c04821 addu r9,r6,r0
0017b1a0: 00602021 addu r4,r3,r0
0017b1a4: 00a9102a slt r2,r5,r9
0017b1a8: 10400002 beq r2,r0,0x0017b1b4
0017b1ac: 0080b821 addu r23,r4,r0
0017b1b0: 00a04821 addu r9,r5,r0
0017b1b4: 3c02800e lui r2,0x800e
0017b1b8: 90424e9c lbu r2,0x4e9c(r2)
0017b1bc: 8faa0030 lw r10,0x0030(r29)
0017b1c0: 00000000 nop
0017b1c4: 01420018 mult r10,r2
0017b1c8: 00003021 addu r6,r0,r0
0017b1cc: 3c088019 lui r8,0x8019
0017b1d0: 2508f8cc addiu r8,r8,0xf8cc
0017b1d4: 0120f021 addu r30,r9,r0
0017b1d8: 8fa40028 lw r4,0x0028(r29)
0017b1dc: 8fa50030 lw r5,0x0030(r29)
0017b1e0: 00001812 mflo r3
0017b1e4: 00641821 addu r3,r3,r4
0017b1e8: 000380c0 sll r16,r3,0x03
0017b1ec: 02088021 addu r16,r16,r8
0017b1f0: 24630100 addiu r3,r3,0x0100
0017b1f4: 000318c0 sll r3,r3,0x03
0017b1f8: 00689021 addu r18,r3,r8
0017b1fc: 92070002 lbu r7,0x0002(r16)
0017b200: 92020003 lbu r2,0x0003(r16)
0017b204: 92430002 lbu r3,0x0002(r18)
0017b208: 00073840 sll r7,r7,0x01
0017b20c: 3042001f andi r2,r2,0x001f
0017b210: 00e28821 addu r17,r7,r2
0017b214: 92420003 lbu r2,0x0003(r18)
0017b218: 00031840 sll r3,r3,0x01
0017b21c: 3042001f andi r2,r2,0x001f
0017b220: 0c05f722 jal 0x0017dc88		Get ID of Unit if Tile is Targetable
0017b224: 0062a021 addu r20,r3,r2
0017b228: 00409821 addu r19,r2,r0
0017b22c: 8fa40028 lw r4,0x0028(r29)
0017b230: 8fa50030 lw r5,0x0030(r29)
0017b234: 0c05f722 jal 0x0017dc88		Get ID of Unit if Tile is Targetable
0017b238: 34060001 ori r6,r0,0x0001
0017b23c: 92030006 lbu r3,0x0006(r16)
0017b240: 00000000 nop
0017b244: 30630001 andi r3,r3,0x0001
0017b248: 10600002 beq r3,r0,0x0017b254
0017b24c: 0040a821 addu r21,r2,r0
0017b250: 341100ff ori r17,r0,0x00ff
0017b254: 92420006 lbu r2,0x0006(r18)
0017b258: 00000000 nop
0017b25c: 30420001 andi r2,r2,0x0001
0017b260: 10400002 beq r2,r0,0x0017b26c
0017b264: 322300ff andi r3,r17,0x00ff
0017b268: 341400ff ori r20,r0,0x00ff
0017b26c: 328200ff andi r2,r20,0x00ff
0017b270: 0043102b sltu r2,r2,r3
0017b274: 10400006 beq r2,r0,0x0017b290
0017b278: 02801821 addu r3,r20,r0
0017b27c: 0220a021 addu r20,r17,r0
0017b280: 00608821 addu r17,r3,r0
0017b284: 02a01021 addu r2,r21,r0
0017b288: 0260a821 addu r21,r19,r0
0017b28c: 00409821 addu r19,r2,r0
0017b290: 322300ff andi r3,r17,0x00ff
0017b294: 340200ff ori r2,r0,0x00ff
0017b298: 10620013 beq r3,r2,0x0017b2e8
0017b29c: 27a40010 addiu r4,r29,0x0010
0017b2a0: 0c05f056 jal 0x0017c158		Calculate Height Data
0017b2a4: 02602821 addu r5,r19,r0
0017b2a8: 93a20013 lbu r2,0x0013(r29)
0017b2ac: 00000000 nop
0017b2b0: 30420080 andi r2,r2,0x0080
0017b2b4: 14400002 bne r2,r0,0x0017b2c0
0017b2b8: 32e200ff andi r2,r23,0x00ff
0017b2bc: 93b10016 lbu r17,0x0016(r29)
0017b2c0: 00000000 nop
0017b2c4: 322300ff andi r3,r17,0x00ff
0017b2c8: 0043102b sltu r2,r2,r3
0017b2cc: 10400002 beq r2,r0,0x0017b2d8
0017b2d0: 33c200ff andi r2,r30,0x00ff
0017b2d4: 0220b821 addu r23,r17,r0
0017b2d8: 0043102b sltu r2,r2,r3
0017b2dc: 10400003 beq r2,r0,0x0017b2ec
0017b2e0: 329000ff andi r16,r20,0x00ff
0017b2e4: 341700ff ori r23,r0,0x00ff
0017b2e8: 329000ff andi r16,r20,0x00ff
0017b2ec: 340200ff ori r2,r0,0x00ff
0017b2f0: 12020011 beq r16,r2,0x0017b338
0017b2f4: 27a40010 addiu r4,r29,0x0010
0017b2f8: 0c05f056 jal 0x0017c158		Calculate_Height_Data
0017b2fc: 02a02821 addu r5,r21,r0
0017b300: 93a20013 lbu r2,0x0013(r29)
0017b304: 00000000 nop
0017b308: 30420080 andi r2,r2,0x0080
0017b30c: 1440000b bne r2,r0,0x0017b33c
0017b310: 33c300ff andi r3,r30,0x00ff
0017b314: 93a30016 lbu r3,0x0016(r29)
0017b318: 32e200ff andi r2,r23,0x00ff
0017b31c: 0050102b sltu r2,r2,r16
0017b320: 14400005 bne r2,r0,0x0017b338
0017b324: 33c200ff andi r2,r30,0x00ff
0017b328: 0062102b sltu r2,r3,r2
0017b32c: 14400003 bne r2,r0,0x0017b33c
0017b330: 33c300ff andi r3,r30,0x00ff
0017b334: 341700ff ori r23,r0,0x00ff
0017b338: 33c300ff andi r3,r30,0x00ff
0017b33c: 32e200ff andi r2,r23,0x00ff
0017b340: 0043102b sltu r2,r2,r3
0017b344: 1440001e bne r2,r0,0x0017b3c0
0017b348: 02c01021 addu r2,r22,r0
0017b34c: 93a20020 lbu r2,0x0020(r29)
0017b350: 93aa0018 lbu r10,0x0018(r29)
0017b354: 00008021 addu r16,r0,r0
0017b358: 01421021 addu r2,r10,r2
0017b35c: 00028842 srl r17,r2,0x01
0017b360: 8fa40028 lw r4,0x0028(r29)
0017b364: 8fa50030 lw r5,0x0030(r29)
0017b368: 0c05f722 jal 0x0017dc88		Get ID of Unit if Tile is Targetable
0017b36c: 02003021 addu r6,r16,r0
0017b370: 0040b021 addu r22,r2,r0
0017b374: 27a40010 addiu r4,r29,0x0010
0017b378: 0c05f056 jal 0x0017c158		Calculate_Height_Data
0017b37c: 02c02821 addu r5,r22,r0
0017b380: 93a20013 lbu r2,0x0013(r29)
0017b384: 00000000 nop
0017b388: 30420080 andi r2,r2,0x0080
0017b38c: 14400009 bne r2,r0,0x0017b3b4
0017b390: 26100001 addiu r16,r16,0x0001
0017b394: 93a20015 lbu r2,0x0015(r29)
0017b398: 93b20016 lbu r18,0x0016(r29)
0017b39c: 0051102b sltu r2,r2,r17
0017b3a0: 10400005 beq r2,r0,0x0017b3b8
0017b3a4: 2a020002 slti r2,r16,0x0002
0017b3a8: 0232102b sltu r2,r17,r18
0017b3ac: 14400004 bne r2,r0,0x0017b3c0
0017b3b0: 02c01021 addu r2,r22,r0
0017b3b4: 2a020002 slti r2,r16,0x0002
0017b3b8: 1440ffe9 bne r2,r0,0x0017b360
0017b3bc: 2402ffff addiu r2,r0,0xffff
0017b3c0: 8fbf005c lw r31,0x005c(r29)
0017b3c4: 8fbe0058 lw r30,0x0058(r29)
0017b3c8: 8fb70054 lw r23,0x0054(r29)
0017b3cc: 8fb60050 lw r22,0x0050(r29)
0017b3d0: 8fb5004c lw r21,0x004c(r29)
0017b3d4: 8fb40048 lw r20,0x0048(r29)
0017b3d8: 8fb30044 lw r19,0x0044(r29)
0017b3dc: 8fb20040 lw r18,0x0040(r29)
0017b3e0: 8fb1003c lw r17,0x003c(r29)
0017b3e4: 8fb00038 lw r16,0x0038(r29)
0017b3e8: 27bd0060 addiu r29,r29,0x0060
0017b3ec: 03e00008 jr r31
0017b3f0: 00000000 nop

Return locations

Battle.bin
0017af20: Targeting_validation_(weapon_flags)