Get Unit Misc ID By Unit Index

From Final Fantasy Hacktics Wiki
Revision as of 18:16, 7 January 2017 by Glain (talk | contribs) (Created page with " # ROUTINE: GET UNIT MISC ID BY UNIT INDEX # Parameters: # r4 = (p_unitIndex) Unit index (in-battle data) # Returns: # r2 = Unit Misc ID...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: GET UNIT MISC ID BY UNIT INDEX
#       Parameters: 
#           r4 = (p_unitIndex) Unit index (in-battle data)
#       Returns:
#           r2 = Unit Misc ID of specified unit, if unit misc data exists for a unit with the specified index; -1, otherwise

8008ce20: 3c03800a lui r3,0x800a
8008ce24: 8c638a54 lw r3,-0x75ac(r3)            #   miscUnit = *0x80098a54;
8008ce28: 00000000 nop
8008ce2c: 10600010 beq r3,r0,0x8008ce70         #   if (miscUnit == null)
8008ce30: 2402ffff addiu r2,r0,-0x0001          #       return -1;
                                                #   do {
8008ce34: 8c620134 lw r2,0x0134(r3)             
8008ce38: 00000000 nop
8008ce3c: 10400008 beq r2,r0,0x8008ce60         #       if ((miscUnit.battleData != null)
8008ce40: 00000000 nop
8008ce44: 9042018a lbu r2,0x018a(r2)            
8008ce48: 00000000 nop
8008ce4c: 14440004 bne r2,r4,0x8008ce60         #           && (miscUnit.battleData.action.UnitID == p_unitIndex))
8008ce50: 00000000 nop                          #       {
8008ce54: 90620004 lbu r2,0x0004(r3)            #           return miscUnit.UnitMiscID;
8008ce58: 0802339c j 0x8008ce70                      
8008ce5c: 00000000 nop
                                                #       }
8008ce60: 8c630000 lw r3,0x0000(r3)             #       miscUnit = miscUnit.previous;
8008ce64: 00000000 nop
8008ce68: 1460fff2 bne r3,r0,0x8008ce34         #   } while (miscUnit != null);
8008ce6c: 2402ffff addiu r2,r0,-0x0001          #   return -1;        
8008ce70: 03e00008 jr r31
8008ce74: 00000000 nop