Difference between revisions of "Compare Target Priority and Hit Rate (00196db0)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
  Compare Target Priority and Hit Rate
+
  '''BATTLE.BIN''' :  - Compare Target Priority and Hit Rate (00196db0)
 
+
------------------------------------------------------------------------------------------
  00196db0: 90860000 lbu r6,0x0000(r4) Highest ? (0x30 in AI Data) (Can kill this unit flag?)
+
Parameter : r4 = Pointer to AI 0x0030 (or Any other Action simulation result + 0x01c)
  00196db4: 90a30000 lbu r3,0x0000(r5) Always zero, but set in a half word along with Hit Rate
+
            r5 = Pointer to AI 0x0050
  00196db8: 00000000 nop
+
Return : r2 = 0x02 if Higher Score (AI 0x32), Higher Average Hit% (AI 0x31) or Higher AI 0x30
  00196dbc: 0066102b sltu r2,r3,r6
+
          r2 = 0x00 if Lower results
  00196dc0: 14400015 bne r2,r0,0x00196e18
+
          r2 = 0x01 if Equality
  00196dc4: 34020002 ori r2,r0,0x0002
+
------------------------------------------------------------------------------------------
  00196dc8: 00c3102b sltu r2,r6,r3
+
  00196db0: 90860000 lbu r6,0x0000(r4)         |{{f/load|Highest ? (0x30 in AI Data) (Can kill this unit flag?)}} {{f/std|Only seen as 0x00}}
  00196dcc: 14400012 bne r2,r0,0x00196e18
+
  00196db4: 90a30000 lbu r3,0x0000(r5)         |{{f/load|Always zero, but set in a half word along with Hit Rate}}
  00196dd0: 00001021 addu r2,r0,r0
+
  00196db8: 00000000 nop                       |
  00196dd4: 84860002 lh r6,0x0002(r4) Highest Target Priority
+
  00196dbc: 0066102b sltu r2,r3,r6             |
  00196dd8: 84a30002 lh r3,0x0002(r5) Load Unit Target Priority
+
  00196dc0: 14400015 bne r2,r0,0x00196e18     {{f/Cond|if AI 0x50 < AI 0x30}} {{f/loc|Exit}} {{f/Returns|Returns 0x02}}
  00196ddc: 00000000 nop
+
  00196dc4: 34020002 ori r2,r0,0x0002         |
  00196de0: 0066102a slt r2,r3,r6
+
  00196dc8: 00c3102b sltu r2,r6,r3             |
  00196de4: 1440000c bne r2,r0,0x00196e18 Exit and return 2 if Current Priority is lower than the highest Priority
+
  00196dcc: 14400012 bne r2,r0,0x00196e18     {{f/Cond|if AI 0x30 < AI 0x50}} {{f/loc|Exit}} {{f/Returns|Returns 0x00}}
  00196de8: 34020002 ori r2,r0,0x0002
+
  00196dd0: 00001021 addu r2,r0,r0             |
  00196dec: 00c3102a slt r2,r6,r3
+
  00196dd4: 84860002 lh r6,0x0002(r4)         |{{f/load|Considered Action Priority score}} {{f/std|Signed}}
  00196df0: 14400009 bne r2,r0,0x00196e18 Exit and return 0 if Current Priority is higher than the highest Priority
+
  00196dd8: 84a30002 lh r3,0x0002(r5)         |{{f/load|Best Action priority score so far ?}} {{f/std|Signed}}
  00196df4: 00001021 addu r2,r0,r0
+
  00196ddc: 00000000 nop                       |
  00196df8: 90840001 lbu r4,0x0001(r4) Highest Hit%
+
  00196de0: 0066102a slt r2,r3,r6             |
  00196dfc: 90a50001 lbu r5,0x0001(r5) Load Hit%
+
  00196de4: 1440000c bne r2,r0,0x00196e18     {{f/Cond|If Previous score is < Considered score}} {{f/loc|Exit}} {{f/Returns|Returns 0x02}}
  00196e00: 00000000 nop
+
  00196de8: 34020002 ori r2,r0,0x0002         |
  00196e04: 00a4102b sltu r2,r5,r4
+
  00196dec: 00c3102a slt r2,r6,r3             |
  00196e08: 14400003 bne r2,r0,0x00196e18 Exit and return 2 if Current Hit% is lower than highest Hit%
+
  00196df0: 14400009 bne r2,r0,0x00196e18     {{f/Cond|If Considered score < Previous score}} {{f/loc|Exit}} {{f/Returns|Returns 0x00}}
  00196e0c: 34020002 ori r2,r0,0x0002
+
  00196df4: 00001021 addu r2,r0,r0             |
  00196e10: 0085102b sltu r2,r4,r5
+
  00196df8: 90840001 lbu r4,0x0001(r4)         |{{f/load|Average Hit%}}
  00196e14: 38420001 xori r2,r2,0x0001 Return 0 if Current Hit% is higher than Highest Hit%; else return 1
+
  00196dfc: 90a50001 lbu r5,0x0001(r5)         |{{f/load|Average Hit%}}
  00196e18: 03e00008 jr r31
+
  00196e00: 00000000 nop                       |
 +
  00196e04: 00a4102b sltu r2,r5,r4             |
 +
  00196e08: 14400003 bne r2,r0,0x00196e18     {{f/Cond|If same score but Previous Hit% < Considered Hit%}} {{f/loc|Exit}} {{f/Returns|Returns 0x02}}
 +
  00196e0c: 34020002 ori r2,r0,0x0002         |
 +
  00196e10: 0085102b sltu r2,r4,r5             |{{f/std|0x1 if Current Hit% < Previous Hit%}}
 +
  00196e14: 38420001 xori r2,r2,0x0001         |{{f/Returns|Returns 0x1 if Same Hit% or 0 if Previous Hit% is higher}}
 +
  00196e18: 03e00008 jr r31                   |
 
  00196e1c: 00000000 nop
 
  00196e1c: 00000000 nop
 +
===Return locations===
 +
'''BATTLE.BIN'''
 +
  0019617c: [[Set_or_Remove_Charging_(00195f8c)]]
 +
  00196e48: [[Set_Highest_Target_Priority_(00196e20)]]
 +
  00196ff4: [[Compare_Set_Highest_Unit_Target_Priority_(00196fc4)]]

Revision as of 20:07, 1 June 2024

BATTLE.BIN :  - Compare Target Priority and Hit Rate (00196db0)
------------------------------------------------------------------------------------------
Parameter : r4 = Pointer to AI 0x0030 (or Any other Action simulation result + 0x01c)
            r5 = Pointer to AI 0x0050
Return : r2 = 0x02 if Higher Score (AI 0x32), Higher Average Hit% (AI 0x31) or Higher AI 0x30
         r2 = 0x00 if Lower results
         r2 = 0x01 if Equality
------------------------------------------------------------------------------------------
00196db0: 90860000 lbu r6,0x0000(r4)         |Highest ? (0x30 in AI Data) (Can kill this unit flag?) Only seen as 0x00
00196db4: 90a30000 lbu r3,0x0000(r5)         |Always zero, but set in a half word along with Hit Rate
00196db8: 00000000 nop                       |
00196dbc: 0066102b sltu r2,r3,r6             |
00196dc0: 14400015 bne r2,r0,0x00196e18      #if AI 0x50 < AI 0x30 Exit Returns 0x02
00196dc4: 34020002 ori r2,r0,0x0002          |
00196dc8: 00c3102b sltu r2,r6,r3             |
00196dcc: 14400012 bne r2,r0,0x00196e18      #if AI 0x30 < AI 0x50 Exit Returns 0x00
00196dd0: 00001021 addu r2,r0,r0             |
00196dd4: 84860002 lh r6,0x0002(r4)          |Considered Action Priority score Signed
00196dd8: 84a30002 lh r3,0x0002(r5)          |Best Action priority score so far ? Signed
00196ddc: 00000000 nop                       |
00196de0: 0066102a slt r2,r3,r6              |
00196de4: 1440000c bne r2,r0,0x00196e18      #If Previous score is < Considered score Exit Returns 0x02
00196de8: 34020002 ori r2,r0,0x0002          |
00196dec: 00c3102a slt r2,r6,r3              |
00196df0: 14400009 bne r2,r0,0x00196e18      #If Considered score < Previous score Exit Returns 0x00
00196df4: 00001021 addu r2,r0,r0             |
00196df8: 90840001 lbu r4,0x0001(r4)         |Average Hit%
00196dfc: 90a50001 lbu r5,0x0001(r5)         |Average Hit%
00196e00: 00000000 nop                       |
00196e04: 00a4102b sltu r2,r5,r4             |
00196e08: 14400003 bne r2,r0,0x00196e18      #If same score but Previous Hit% < Considered Hit% Exit Returns 0x02
00196e0c: 34020002 ori r2,r0,0x0002          |
00196e10: 0085102b sltu r2,r4,r5             |0x1 if Current Hit% < Previous Hit%
00196e14: 38420001 xori r2,r2,0x0001         |Returns 0x1 if Same Hit% or 0 if Previous Hit% is higher
00196e18: 03e00008 jr r31                    |
00196e1c: 00000000 nop

Return locations

BATTLE.BIN
 0019617c: Set_or_Remove_Charging_(00195f8c)
 00196e48: Set_Highest_Target_Priority_(00196e20)
 00196ff4: Compare_Set_Highest_Unit_Target_Priority_(00196fc4)