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

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

Latest revision as of 07:16, 25 June 2024

BATTLE.BIN :  - Compare Target Priority and Hit Rate (00196db0)
Compare 2 AI action data : first AI 0x30 (?) then priority score (if equality), then Hit% 
------------------------------------------------------------------------------------------
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)                     r4 = AI 0x30 r5 =  AI 0x1818
 00196e48: Set_Highest_Target_Priority_(00196e20)                r4 = AI 0x30 r5 = AI 0x50
 00196ff4: Compare_Set_Highest_Unit_Target_Priority_(00196fc4)   r4 = AI 0x50 r5 = AI 0x170