Difference between revisions of "Invert Target Priority (0019630c)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Dokurider moved page 0019630c - 00196388 to Invert Target Priority (0019630c): Renaming and adding new documentation)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  0019630c: 34020064 ori r2,r0,0x0064
+
'''BATTLE.BIN''' :  - Invert Target Priority (0019630c)
  00196310: 3c03801a lui r3,0x801a
+
Update some data at 0x8019f3c4 + 0x154 0x1c 0x1d and 0x1e (reverted priority)
  00196314: 906301f1 lbu r3,0x01f1(r3)
+
------------------------------------------------------------------------------------------
  00196318: 3c05801a lui r5,0x801a
+
Parameter : Nothing
  0019631c: 24a5f3c4 addiu r5,r5,0xf3c4
+
Return : Nothing
  00196320: 3c01801a lui r1,0x801a
+
------------------------------------------------------------------------------------------
  00196324: a020f534 sb r0,-0x0acc(r1) Clear 0x0170
+
  0019630c: 34020064 ori r2,r0,0x0064         |
  00196328: 3c01801a lui r1,0x801a
+
  00196310: 3c03801a lui r3,0x801a             |
  0019632c: a022f535 sb r2,-0x0acb(r1) Save 0x64 to 0x171 (accuracy?)
+
  00196314: 906301f1 lbu r3,0x01f1(r3)         |{{f/load|Load AI 0xe2d}} {{f/std|8019f3c4 + 0x2ed}}
  00196330: 00031880 sll r3,r3,0x02 0x1f1 is 0 or 1, so either 0 or 4 (0xcc4 or 0xcc8)
+
  00196318: 3c05801a lui r5,0x801a             |
  00196334: 24630cc4 addiu r3,r3,0x0cc4
+
  0019631c: 24a5f3c4 addiu r5,r5,0xf3c4       |{{f/adr|Pointer to 0x8019f3c4}}
  00196338: 00651821 addu r3,r3,r5
+
  00196320: 3c01801a lui r1,0x801a             |
  0019633c: 90640001 lbu r4,0x0001(r3) Load Unit ID?
+
  00196324: a020f534 sb r0,-0x0acc(r1)         |{{f/store|Clear AI 0x0170}} {{f/std|8019f3c4 + 0x154 + 0x1c}}
  00196340: 00000000 nop
+
  00196328: 3c01801a lui r1,0x801a             |
  00196344: 000410c0 sll r2,r4,0x03
+
  0019632c: a022f535 sb r2,-0x0acb(r1)         |{{f/store|Save 0x64 to AI 0x171 (accuracy?)}} {{f/std|8019f3c4 + 0x154 +0x1d}}
  00196348: 00441021 addu r2,r2,r4
+
  00196330: 00031880 sll r3,r3,0x02           |{{f/std|Word offset based on 0xe2d}}
  0019634c: 00021180 sll r2,r2,0x06 r4 * 240
+
  00196334: 24630cc4 addiu r3,r3,0x0cc4       |
  00196350: 00451021 addu r2,r2,r5
+
  00196338: 00651821 addu r3,r3,r5             |{{f/adr|Pointer to 0x8019f3c4 + 0xcc4 + Offset based on 0xe2d}}
  00196354: 244205f4 addiu r2,r2,0x05f4 Get AI Matrix Pointer
+
  0019633c: 90640001 lbu r4,0x0001(r3)         |{{f/load|Considered Tile Elevation}}
  00196358: 90640002 lbu r4,0x0002(r3) Load ?
+
  00196340: 00000000 nop                       |
  0019635c: 90630000 lbu r3,0x0000(r3) Load ?
+
  00196344: 000410c0 sll r2,r4,0x03           |
  00196360: 00042140 sll r4,r4,0x05 r4 * 20
+
  00196348: 00441021 addu r2,r2,r4             |
  00196364: 00822021 addu r4,r4,r2
+
  0019634c: 00021180 sll r2,r2,0x06           |{{f/std|Tile elevation offset (0x240)}}
  00196368: 00031840 sll r3,r3,0x01 r3 * 2
+
  00196350: 00451021 addu r2,r2,r5             |
  0019636c: 00641821 addu r3,r3,r4 r3 = Current Unit Priority Pointer?
+
  00196354: 244205f4 addiu r2,r2,0x05f4       |{{f/adr|Pointer to 0x8019f3c4 + 0x05f4 (Tile's Priority Table)}} {{f/std|+elevation offset}}
  00196370: 94620000 lhu r2,0x0000(r3) Load Priority?
+
  00196358: 90640002 lbu r4,0x0002(r3)         |{{f/load|Considered Tile Y}}
  00196374: 00000000 nop
+
  0019635c: 90630000 lbu r3,0x0000(r3)         |{{f/load|Considered Tile X}}
  00196378: 00021023 subu r2,r0,r2
+
  00196360: 00042140 sll r4,r4,0x05           |{{f/std|Y offset (0x20)}}
  0019637c: 3c01801a lui r1,0x801a
+
  00196364: 00822021 addu r4,r4,r2             |{{f/std|Add to pointer}}
  00196380: a422f536 sh r2,-0x0aca(r1) Invert Target Priority?
+
  00196368: 00031840 sll r3,r3,0x01           |{{f/std|X offset (halfword)}}
 +
  0019636c: 00641821 addu r3,r3,r4             |{{f/adr|Pointer to This Tile priority score}} {{f/std|8019f3c4 + 0x5f4 + Tile offset}}
 +
  00196370: 94620000 lhu r2,0x0000(r3)         |{{f/load|Load considered Tile priority}}
 +
  00196374: 00000000 nop                       |
 +
  00196378: 00021023 subu r2,r0,r2             |{{f/std|Revert priority}}
 +
  0019637c: 3c01801a lui r1,0x801a             |
 +
  00196380: a422f536 sh r2,-0x0aca(r1)         |{{f/store|Store inverted priority 8019f3c4 + 0x154 + 0x1e}}
 
  00196384: 03e00008 jr r31
 
  00196384: 03e00008 jr r31
 
  00196388: 00000000 nop
 
  00196388: 00000000 nop
 +
===Return locations===
 +
'''BATTLE.BIN'''
 +
  00196208: [[Non-Specific AI AutoBattle (Enemies)]]    0xe2d = 0x00
 +
  00198200: [[Fight_for_Life_-_Auto_Battle_(00197ff4)]]  0xe2d = 0x02
 +
  00198618: [[Protect_Allies_-_Auto_Battle_(001984ec)]]  0xe2d = 0x02
 +
  00198f0c: [[AI_Critical_or_Run_Like_Rabbit]]          0xe2d = 0x01

Latest revision as of 18:55, 21 April 2024

BATTLE.BIN :  - Invert Target Priority (0019630c)
Update some data at 0x8019f3c4 + 0x154 0x1c 0x1d and 0x1e (reverted priority)
------------------------------------------------------------------------------------------
Parameter : Nothing
Return : Nothing
------------------------------------------------------------------------------------------
0019630c: 34020064 ori r2,r0,0x0064          |
00196310: 3c03801a lui r3,0x801a             |
00196314: 906301f1 lbu r3,0x01f1(r3)         |Load AI 0xe2d 8019f3c4 + 0x2ed
00196318: 3c05801a lui r5,0x801a             |
0019631c: 24a5f3c4 addiu r5,r5,0xf3c4        |Pointer to 0x8019f3c4
00196320: 3c01801a lui r1,0x801a             |
00196324: a020f534 sb r0,-0x0acc(r1)         |Clear AI 0x0170 8019f3c4 + 0x154 + 0x1c
00196328: 3c01801a lui r1,0x801a             |
0019632c: a022f535 sb r2,-0x0acb(r1)         |Save 0x64 to AI 0x171 (accuracy?) 8019f3c4 + 0x154 +0x1d
00196330: 00031880 sll r3,r3,0x02            |Word offset based on 0xe2d
00196334: 24630cc4 addiu r3,r3,0x0cc4        |
00196338: 00651821 addu r3,r3,r5             |Pointer to 0x8019f3c4 + 0xcc4 + Offset based on 0xe2d
0019633c: 90640001 lbu r4,0x0001(r3)         |Considered Tile Elevation
00196340: 00000000 nop                       |
00196344: 000410c0 sll r2,r4,0x03            |
00196348: 00441021 addu r2,r2,r4             |
0019634c: 00021180 sll r2,r2,0x06            |Tile elevation offset (0x240)
00196350: 00451021 addu r2,r2,r5             |
00196354: 244205f4 addiu r2,r2,0x05f4        |Pointer to 0x8019f3c4 + 0x05f4 (Tile's Priority Table) +elevation offset
00196358: 90640002 lbu r4,0x0002(r3)         |Considered Tile Y
0019635c: 90630000 lbu r3,0x0000(r3)         |Considered Tile X
00196360: 00042140 sll r4,r4,0x05            |Y offset (0x20)
00196364: 00822021 addu r4,r4,r2             |Add to pointer
00196368: 00031840 sll r3,r3,0x01            |X offset (halfword)
0019636c: 00641821 addu r3,r3,r4             |Pointer to This Tile priority score 8019f3c4 + 0x5f4 + Tile offset
00196370: 94620000 lhu r2,0x0000(r3)         |Load considered Tile priority
00196374: 00000000 nop                       |
00196378: 00021023 subu r2,r0,r2             |Revert priority
0019637c: 3c01801a lui r1,0x801a             |
00196380: a422f536 sh r2,-0x0aca(r1)         |Store inverted priority 8019f3c4 + 0x154 + 0x1e
00196384: 03e00008 jr r31
00196388: 00000000 nop

Return locations

BATTLE.BIN
 00196208: Non-Specific AI AutoBattle (Enemies)     0xe2d = 0x00
 00198200: Fight_for_Life_-_Auto_Battle_(00197ff4)  0xe2d = 0x02
 00198618: Protect_Allies_-_Auto_Battle_(001984ec)  0xe2d = 0x02
 00198f0c: AI_Critical_or_Run_Like_Rabbit           0xe2d = 0x01