Set Highest Target Priority (00196e20)
Jump to navigation
Jump to search
BATTLE.BIN : - Set_Highest_Target_Priority_(00196e20) ------------------------------------------------------------------------------------------ Parameter : r4 = AI 0x0014 r5 = AI 0x0034 Return : r2 = 0x01 if Higher score or Safer Tile if same score r2 = 0x00 if not ------------------------------------------------------------------------------------------ 00196e20: 27bdffe0 addiu r29,r29,-0x0020 | 00196e24: afb00010 sw r16,0x0010(r29) | 00196e28: 00808021 addu r16,r4,r0 |r16 = Pointer to AI 0x0014 00196e2c: afb10014 sw r17,0x0014(r29) | 00196e30: 00a08821 addu r17,r5,r0 |r17 = Pointer to AI 0x0034 00196e34: 2604001c addiu r4,r16,0x001c |Pointer to AI 0x0030 00196e38: 2625001c addiu r5,r17,0x001c |Pointer to AI 0x0050 00196e3c: afbf001c sw r31,0x001c(r29) | 00196e40: 0c065b6c jal 0x00196db0 |-->Compare Target Priority and Hit Rate (00196db0) 00196e44: afb20018 sw r18,0x0018(r29) | 00196e48: 3c12801a lui r18,0x801a | 00196e4c: 2652f3c4 addiu r18,r18,-0x0c3c |0x80193fc4 00196e50: 00402021 addu r4,r2,r0 | 00196e54: 34020002 ori r2,r0,0x0002 | 00196e58: 14820003 bne r4,r2,0x00196e68 #If returned value is 0x02 Higher priority score, higher Hit%, higher AI 0x30 00196e5c: 34030001 ori r3,r0,0x0001 | 00196e60: 08065bb6 j 0x00196ed8 |Exit Return 0x01 00196e64: 34020001 ori r2,r0,0x0001 | 00196e68: 1483001b bne r4,r3,0x00196ed8 #if returned value is 0x00 Exit Return 0x00 lower in everything 00196e6c: 00001021 addu r2,r0,r0 | Else : returned value is 0x01 (Strict equality) 00196e70: 92030005 lbu r3,0x0005(r16) |Considered Action Elevation 00196e74: 92040006 lbu r4,0x0006(r16) |Considered Action Y 00196e78: 92250004 lbu r5,0x0004(r17) |Previous Action X 00196e7c: 000310c0 sll r2,r3,0x03 | 00196e80: 00431021 addu r2,r2,r3 | 00196e84: 00021140 sll r2,r2,0x05 |Elevation * 0x120 00196e88: 00521021 addu r2,r2,r18 | 00196e8c: 24420174 addiu r2,r2,0x0174 |Pointer to AI 0x174 + Elevation offset AI 0x174 is proximity score matrix 00196e90: 00042100 sll r4,r4,0x04 | 00196e94: 00822021 addu r4,r4,r2 |+ Y offset 00196e98: 92020004 lbu r2,0x0004(r16) |Considered Action X 00196e9c: 92230005 lbu r3,0x0005(r17) |Previous action Elevation 00196ea0: 00822021 addu r4,r4,r2 |+ X offset 00196ea4: 000310c0 sll r2,r3,0x03 | 00196ea8: 00431021 addu r2,r2,r3 | 00196eac: 00021140 sll r2,r2,0x05 | 00196eb0: 00521021 addu r2,r2,r18 | 00196eb4: 24420174 addiu r2,r2,0x0174 | 00196eb8: 92230006 lbu r3,0x0006(r17) | 00196ebc: 90840000 lbu r4,0x0000(r4) |Considered Action's Tile proximity score AI 0x174 00196ec0: 00031900 sll r3,r3,0x04 | 00196ec4: 00621821 addu r3,r3,r2 | 00196ec8: 00651821 addu r3,r3,r5 | 00196ecc: 90620000 lbu r2,0x0000(r3) |Previous Action's Tile proximity score AI 0x174 00196ed0: 00000000 nop | 00196ed4: 0082102a slt r2,r4,r2 |Returns 0x01 if Current proximity score < Previous one Safer destination ? 00196ed8: 8fbf001c lw r31,0x001c(r29) 00196edc: 8fb20018 lw r18,0x0018(r29) 00196ee0: 8fb10014 lw r17,0x0014(r29) 00196ee4: 8fb00010 lw r16,0x0010(r29) 00196ee8: 27bd0020 addiu r29,r29,0x0020 00196eec: 03e00008 jr r31 00196ef0: 00000000 nop
Return locations
BATTLE.BIN 00197008: Compare_Set_Highest_Unit_Target_Priority_(00196fc4) 00197020: Compare_Set_Highest_Unit_Target_Priority_(00196fc4) 0019d34c: Check_Set_Highest_Unit_Priority_(0019d308)