Difference between revisions of "Find Positive Priority Target within 3 Range (0019689c)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Uploaded the correct routine)
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
0019689c: 3c03801a lui r3,0x801a
+
'''BATTLE.BIN''' :  - Find_Positive_Priority_Target_within_3_Range_(0019689c)
001968a0: 8c6301f8 lw r3,0x01f8(r3) Acting Unit's AI Decision Pointer
+
------------------------------------------------------------------------------------------
001968a4: 27bdffe8 addiu r29,r29,0xffe8
+
Parameter : r4 = Acting Unit distance to Target - 1 (0x8019f374 - 1)
001968a8: afbf0010 sw r31,0x0010(r29)
+
------------------------------------------------------------------------------------------
 
+
0019689c: 3c03801a lui r3,0x801a             |
001968ac: 90620005 lbu r2,0x0005(r3) Load Main Target ID
+
001968a0: 8c6301f8 lw r3,0x01f8(r3)         |{{f/adr|Acting Unit's AI Decision Pointer}} {{f/std| 8019f3c4 + 0x182c + acting unit offset}}
001968b0: 00000000 nop
+
001968a4: 27bdffe8 addiu r29,r29,-0x0018    |
001968b4: 00021100 sll r2,r2,0x04
+
001968a8: afbf0010 sw r31,0x0010(r29)       |
001968b8: 3c01801a lui r1,0x801a
+
001968ac: 90620005 lbu r2,0x0005(r3)         |{{f/load|Acting Unit Target ID}}
001968bc: 00220821 addu r1,r1,r2
+
001968b0: 00000000 nop                       |
001968c0: 90220bf8 lbu r2,0x0bf8(r1) Load Enemy Flag
+
001968b4: 00021100 sll r2,r2,0x04           |{{f/std|ID * 16}}
001968c4: 00000000 nop
+
001968b8: 3c01801a lui r1,0x801a             |
001968c8: 10400009 beq r2,r0,0x001968f0 Branch if Ally
+
001968bc: 00220821 addu r1,r1,r2             |
001968cc: 00000000 nop
+
001968c0: 90220bf8 lbu r2,0x0bf8(r1)         |{{f/load|Load Target's Enemy Flag}} {{f/std|8019f3c4 + 0x182c + 0x08 + Unit offset}}
 
+
001968c4: 00000000 nop                       |
001968d0: 90620006 lbu r2,0x0006(r3) Load AI Targeting Flags
+
001968c8: 10400009 beq r2,r0,0x001968f0     {{f/Cond|If Unit is an Ally : branch to}} {{f/loc|routine}}
001968d4: 00000000 nop
+
001968cc: 00000000 nop                           |
001968d8: 30420001 andi r2,r2,0x0001
+
                                              '''Else : Acting Unit is an Enemy'''
001968dc: 10400004 beq r2,r0,0x001968f0 Branch if unit has indirect/arcing attack?
+
001968d0: 90620006 lbu r2,0x0006(r3)             |{{f/load|Acting unit AI Decision 0x06}}
 
+
001968d4: 00000000 nop                           |
001968e0: 28820003 slti r2,r4,0x0003
+
001968d8: 30420001 andi r2,r2,0x0001             |
001968e4: 10400002 beq r2,r0,0x001968f0 Branch if Range is greater or equal than 3
+
001968dc: 10400004 beq r2,r0,0x001968f0         {{f/Cond|If Unit didn't use any arcing/direct abilities branch to }} {{f/loc|routine}}
001968e8: 00000000 nop
+
001968ec: 34040003 ori r4,r0,0x0003 Always look for targets at least in 3 range or greater
+
                                                  '''Else Unit can use some arcing abilities '''
 
+
001968e0: 28820003 slti r2,r4,0x0003                 |
001968f0: 0c065a42 jal 0x00196908 Get Positive Priority
+
001968e4: 10400002 beq r2,r0,0x001968f0             {{f/Cond|<nowiki>If Distance to Target > = 3 : branch to </nowiki>}} {{f/loc|routine}}
001968f4: 00000000 nop
+
001968e8: 00000000 nop                                   |
001968f8: 8fbf0010 lw r31,0x0010(r29)
+
                                                    ''' Else : force Distance to at least 3'''
001968fc: 27bd0018 addiu r29,r29,0x0018
+
001968ec: 34040003 ori r4,r0,0x0003                     |
00196900: 03e00008 jr r31
+
001968f0: 0c065a42 jal 0x00196908           |{{f/jal|Get_Positive_Priority_(00196908)|Get_Positive_Priority_(00196908)}}
00196904: 00000000 nop
+
001968f4: 00000000 nop                       |
 +
001968f8: 8fbf0010 lw r31,0x0010(r29)
 +
001968fc: 27bd0018 addiu r29,r29,0x0018
 +
00196900: 03e00008 jr r31
 +
00196904: 00000000 nop
 +
===Return locations===
 +
'''BATTLE.BIN'''
 +
  0019682c: [[Map_movement_decision/data_setting]]
 +
  00198478: [[001982d8_-_001984e8]]

Latest revision as of 13:14, 20 June 2024

BATTLE.BIN :  - Find_Positive_Priority_Target_within_3_Range_(0019689c)
------------------------------------------------------------------------------------------
Parameter : r4 = Acting Unit distance to Target - 1 (0x8019f374 - 1)
------------------------------------------------------------------------------------------
0019689c: 3c03801a lui r3,0x801a             |
001968a0: 8c6301f8 lw r3,0x01f8(r3)          |Acting Unit's AI Decision Pointer  8019f3c4 + 0x182c + acting unit offset
001968a4: 27bdffe8 addiu r29,r29,-0x0018     |
001968a8: afbf0010 sw r31,0x0010(r29)        |
001968ac: 90620005 lbu r2,0x0005(r3)         |Acting Unit Target ID
001968b0: 00000000 nop                       |
001968b4: 00021100 sll r2,r2,0x04            |ID * 16
001968b8: 3c01801a lui r1,0x801a             |
001968bc: 00220821 addu r1,r1,r2             |
001968c0: 90220bf8 lbu r2,0x0bf8(r1)         |Load Target's Enemy Flag 8019f3c4 + 0x182c + 0x08 + Unit offset
001968c4: 00000000 nop                       |
001968c8: 10400009 beq r2,r0,0x001968f0      #If Unit is an Ally : branch to routine
001968cc: 00000000 nop                           |
                                             Else : Acting Unit is an Enemy
001968d0: 90620006 lbu r2,0x0006(r3)             |Acting unit AI Decision 0x06
001968d4: 00000000 nop                           |
001968d8: 30420001 andi r2,r2,0x0001             |
001968dc: 10400004 beq r2,r0,0x001968f0          #If Unit didn't use any arcing/direct abilities branch to  routine

                                                 Else Unit can use some arcing abilities 
001968e0: 28820003 slti r2,r4,0x0003                 |
001968e4: 10400002 beq r2,r0,0x001968f0              #If Distance to Target > = 3 : branch to  routine
001968e8: 00000000 nop                                   |
                                                     Else : force Distance to at least 3
001968ec: 34040003 ori r4,r0,0x0003                      |
001968f0: 0c065a42 jal 0x00196908            |-->Get_Positive_Priority_(00196908)
001968f4: 00000000 nop                       |
001968f8: 8fbf0010 lw r31,0x0010(r29)
001968fc: 27bd0018 addiu r29,r29,0x0018
00196900: 03e00008 jr r31
00196904: 00000000 nop

Return locations

BATTLE.BIN
 0019682c: Map_movement_decision/data_setting
 00198478: 001982d8_-_001984e8