Get Unit misc data pointer of ridden unit by r4

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameters : r4 = Unit misc data pointer
Return r2 = Ridden unit data pointer (if r4 is riding)
       r2 = r4 if not riding
       r2 = 0x00 if riding but data pointer was not found
-------------------------------------------------------------
0007d0a0: 27bdffe8 addiu r29,r29,-0x0018    |
0007d0a4: afbf0010 sw r31,0x0010(r29)       |
0007d0a8: 90830130 lbu r3,0x0130(r4)        |r3 = unit misc. Mount/ridder byte
0007d0ac: 34020001 ori r2,r0,0x0001         |r2 = 0x01
0007d0b0: 14620004 bne r3,r2,0x0007d0c4     #If Unit is ridding /Else branch to END (r2 = r4 misc data pointer)
0007d0b4: 00801021 addu r2,r4,r0            |r2 = Unit's Misc Data Pointer
0007d0b8: 90840131 lbu r4,0x0131(r4)             |r4 = Ridden unit ID
0007d0bc: 0c01e9b9 jal 0x0007a6e4                |-->Find Current Misc Unit Data Pointer (external ID)?  return r2 = unit misc data pointer (0x00 if not found/invalid)
0007d0c0: 00000000 nop                           |
0007d0c4: 8fbf0010 lw r31,0x0010(r29)       END
0007d0c8: 27bd0018 addiu r29,r29,0x0018          
0007d0cc: 03e00008 jr r31                        
0007d0d0: 00000000 nop

Return location

0007d2fc: 0007d2dc_-_0007d34c
0007d368: 0007d350_-_0007d3f0
0007d40c: 0007d3f4_-_0007d474
0007d490: 0007d478_-_0007d518
0007d534: Get_Final_Height_data_from_unit_misc_data