Invert Target Priority (0019630c)

From Final Fantasy Hacktics Wiki
(Redirected from 0019630c - 00196388)
Jump to navigation Jump to search
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