Get Unit Tile data pointer from Unit ID

From Final Fantasy Hacktics Wiki
Revision as of 22:19, 28 January 2022 by Orkney (talk | contribs) (return link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Parameters : r4 = Unit ID

Returns : r2 = Unit Tile data pointer
--------------------------------------------------------
0008dfac: 27bdffe8 addiu r29,r29,-0x0018    
0008dfb0: afbf0010 sw r31,0x0010(r29)       
0008dfb4: 0c01e9c9 jal 0x0007a724           |-->Get_unit_misc_data_that_matches_r4_ID Return r2 = Unit X misc data pointer / If not found = 0x00
0008dfb8: 3084ffff andi r4,r4,0xffff        |r4 = unit ID
0008dfbc: 9044007c lbu r4,0x007c(r2)        |r4 = Unit X coordinates
0008dfc0: 9045007d lbu r5,0x007d(r2)        |r5 = Unit Y coordinates
0008dfc4: 9046007e lbu r6,0x007e(r2)        |r6 = Unit elevation
0008dfc8: 0c060fed jal 0x00183fb4           |-->Get_Tile_Data_Pointer r2 = Pointer to Tile Data for specified coordinates (0x00 if not valid)
0008dfcc: 00000000 nop                      
0008dfd0: 8fbf0010 lw r31,0x0010(r29)       
0008dfd4: 27bd0018 addiu r29,r29,0x0018     
0008dfd8: 03e00008 jr r31                   
0008dfdc: 00000000 nop                      

Return location

Battle.bin
 001af410: Maths_For_Arcing_Trajectory