Find Unit's Party Data Location

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameters: r4 = ENTD Sprite Set
Returns r2 = Roster Slot ID
        r2 = 0xFFFF if unit is not found
        r3 = Unit's World Stats Address (if they exist)
----------------------------------------------------------------------------------------------
00059f94: 00002821 addu r5,r0,r0		Counter = 0
00059f98: 340600ff ori r6,r0,0x00ff		r6 = FF
00059f9c: 3c038005 lui r3,0x8005
00059fa0: 24637f74 addiu r3,r3,0x7f74		r3 = Party Data Pointer
00059fa4: 90620001 lbu r2,0x0001(r3)		Load Unit's Party ID
00059fa8: 00000000 nop
00059fac: 10460005 beq r2,r6,0x00059fc4		Branch if Unit doesn't exist
00059fb0: 00000000 nop
00059fb4: 90620000 lbu r2,0x0000(r3)		Load Unit's Sprite Set
00059fb8: 00000000 nop
00059fbc: 10440006 beq r2,r4,0x00059fd8		Branch if Sprite Set = ENTD Sprite Set
00059fc0: 00a01021 addu r2,r5,r0		Party ID = Counter
00059fc4: 24a50001 addiu r5,r5,0x0001		Counter ++
00059fc8: 28a20014 slti r2,r5,0x0014
00059fcc: 1440fff5 bne r2,r0,0x00059fa4		Branch if Counter < 20
00059fd0: 24630100 addiu r3,r3,0x0100		Party Data Pointer += 0x100
00059fd4: 2402ffff addiu r2,r0,0xffff		Party ID = FFFF (unit doesn't exist)
00059fd8: 03e00008 jr r31
00059fdc: 00000000 nop


Return Locations

SCUS_942.21
8005b054: Prep for Initializing Unit's Job Data