Check Set Highest Unit Priority (0019d308)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
BATTLE.BIN :  -  Check against and Set Highest Unit Priority
------------------------------------------------------------------------------------------
Parameter : Nothing
Return : r2 = 0x00 if 001937c returns 0x01 (priority updated ?)
         r2 = -0x01 if 0019d37c returns -0x01 or 0x00
------------------------------------------------------------------------------------------
0019d308: 27bdffe0 addiu r29,r29,-0x0020     |
0019d30c: afbf0018 sw r31,0x0018(r29)        |
0019d310: afb10014 sw r17,0x0014(r29)        |
0019d314: 0c0674df jal 0x0019d37c            |-->AI_End_of_turn,_in_between_turn,_etc. Simulate action and set priority score
0019d318: afb00010 sw r16,0x0010(r29)        |
0019d31c: 3c10801a lui r16,0x801a            |
0019d320: 2610f3c4 addiu r16,r16,-0x0c3c     |0x8019f3c4
0019d324: 00401821 addu r3,r2,r0             |
0019d328: 2402ffff addiu r2,r0,-0x0001       |
0019d32c: 1062000d beq r3,r2,0x0019d364      #If returned Value is -0x0001 Exit  Returns -0x01
0019d330: 00000000 nop                       |
0019d334: 1060000a beq r3,r0,0x0019d360      #If returned Value is 0x00 Exit  Returns -0x01
0019d338: 26110014 addiu r17,r16,0x0014      |AI 0x0014 Current action data
0019d33c: 02202021 addu r4,r17,r0            |Send AI 0x14 pointer
0019d340: 26100034 addiu r16,r16,0x0034      |AI 0x0034  Best Action data (so far)
0019d344: 0c065b88 jal 0x00196e20            |-->Check Unit Target Priority vs the highest Priority
0019d348: 02002821 addu r5,r16,r0            |Send AI 0x34 pointer
0019d34c: 10400004 beq r2,r0,0x0019d360      #If returned Value is 0x00 Exit  Returns 0x00

                                             Else : returned Value is 0x01
0019d350: 02002021 addu r4,r16,r0            |AI 0x0034
0019d354: 02202821 addu r5,r17,r0            |AI 0x0014
0019d358: 0c066ac2 jal 0x0019ab08            |-->Transfer Halfword Values (Save Current Target Priority as the highest) replace AI 0x34 by AI 0x14 data
0019d35c: 34060020 ori r6,r0,0x0020          |
0019d360: 00001021 addu r2,r0,r0             |Returns 0x00
0019d364: 8fbf0018 lw r31,0x0018(r29)
0019d368: 8fb10014 lw r17,0x0014(r29)
0019d36c: 8fb00010 lw r16,0x0010(r29)
0019d370: 27bd0020 addiu r29,r29,0x0020
0019d374: 03e00008 jr r31
0019d378: 00000000 nop

Return locations

BATTLE.BIN
 00196074: Set_or_Remove_Charging_(00195f8c)
 00196f50: Check_if_map_allows_use_and_find_Highest_Target_(00196ef4)
 00196f94: Check_if_map_allows_use_and_find_Highest_Target_(00196ef4)
 0019be60: Math_Skill_Targeting
 0019d144: AI_Target_Unit_for_Direct_vs_Arc_Attack_(0019cd9c)