Store units coordinates

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
BATTLE.BIN - Store units coordinates (Seems to restore the true coordinates after simulation)
---------------------------------------------------------------------------------------
Parameters : r4 = Pointer to Tile of interest coordinates
Returns : Nothing

Transfer Tile coordinates in Unit battle stats coordinates (0x47 0x48 0x49)
Simulation of movement ?
---------------------------------------------------------------------------------------
0019f258: 3c03801a lui r3,0x801a            |
0019f25c: 8c630bbc lw r3,0x0bbc(r3)         |Pointer to Acting Unit battle data
0019f260: 90820000 lbu r2,0x0000(r4)        |Load AI Tile of interest X coordinates
0019f264: 00000000 nop                      |
0019f268: a0620047 sb r2,0x0047(r3)         |Store Tile X in Unit X 
0019f26c: 3c03801a lui r3,0x801a            |
0019f270: 8c630bbc lw r3,0x0bbc(r3)         |Pointer to Acting Unit battle data
0019f274: 90820002 lbu r2,0x0002(r4)        |Tile of interest Y
0019f278: 00000000 nop                      |
0019f27c: a0620048 sb r2,0x0048(r3)         |Store Tile Y in Unit Y
0019f280: 3c05801a lui r5,0x801a            |
0019f284: 8ca50bbc lw r5,0x0bbc(r5)         |Pointer to Acting Unit battle data
0019f288: 90830001 lbu r3,0x0001(r4)        |Tile of interest Elevation
0019f28c: 94a20048 lhu r2,0x0048(r5)        |
0019f290: 00031bc0 sll r3,r3,0x0f           |Shift elevation to become 0x8000
0019f294: 30427fff andi r2,r2,0x7fff        |Destroy unit elevation data
0019f298: 00431025 or r2,r2,r3              |
0019f29c: 03e00008 jr r31                   |
0019f2a0: a4a20048 sh r2,0x0048(r5)         |Store Tile elevation in unit battle data

Return location

Battle.bin
001941b0: Main_AI_action_setup
0019797c: Range_Calculation?
001979ac: Range_Calculation?
00197b10: Range_Calculation?
00199b70: AI_Target_Priority_Super_Routine_(001999c8)
0019b4d4: Check_if_any_units_are_in_range_(0019b30c)
0019baf8: AI_Targeting_Matrix_Analysis_(0019b7b8)
0019bf0c: Math_Skill_Targeting
0019c1f0: Find_Highest_Target_Priority_in_Ability_Range_(0019bf2c)
0019ce5c: AI_Target_Unit_for_Direct_vs_Arc_Attack_(0019cd9c)
0019dbb0: 0019db80_-_0019dca8