Get unit data pointer

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Alternate documentation here: Get Existent Battle Unit Pointer
001810d4: 2c820015 sltiu r2,r4,0x0015		ID < 21
001810d8: 1040000c beq r2,r0,0x0018110c		Skip if unit invalid
001810dc: 00002821 addu r5,r0,r0		return invalid r5
001810e0: 000410c0 sll r2,r4,0x03		ID*8
001810e4: 00441023 subu r2,r2,r4		ID*7
001810e8: 00021180 sll r2,r2,0x06		ID*0x1c0
001810ec: 3c038019 lui r3,0x8019
001810f0: 246308cc addiu r3,r3,0x08cc		unit data pointer
001810f4: 00432821 addu r5,r2,r3		r5 = current unit data pointer
001810f8: 90a30001 lbu r3,0x0001(r5)		r3 = unit ID
001810fc: 340200ff ori r2,r0,0x00ff
00181100: 14620002 bne r3,r2,0x0018110c		branch if unit ID != ff
00181104: 00000000 nop
00181108: 00002821 addu r5,r0,r0		clear r5 if unit ID doesn't exist.
0018110c: 03e00008 jr r31
00181110: 00a01021 addu r2,r5,r0		return current unit data pointer in r2

Return Locations

001813ec: - Player Skill Set