Find Free Party Slot

From Final Fantasy Hacktics Wiki
Revision as of 00:33, 29 February 2012 by Choto (talk | contribs) (→‎Return Locations)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Find Free Party Slot
00059d5c: 27bdff90 addiu r29,r29,0xff90
00059d60: afb20068 sw r18,0x0068(r29)
00059d64: 00809021 addu r18,r4,r0		r18 = Save Formation Flag
00059d68: afb00060 sw r16,0x0060(r29)
00059d6c: 00008021 addu r16,r0,r0		Counter = 0
00059d70: afb10064 sw r17,0x0064(r29)
00059d74: 27b10010 addiu r17,r29,0x0010		r17 = Stack Pointer + 0x10
00059d78: afbf006c sw r31,0x006c(r29)
00059d7c: a0a00000 sb r0,0x0000(r5)		Store Stack Value = 0
00059d80: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00059d84: 02002021 addu r4,r16,r0		r4 = Counter
00059d88: ae220000 sw r2,0x0000(r17)		Store Party Data Pointer
00059d8c: 26100001 addiu r16,r16,0x0001		Counter ++
00059d90: 2a020014 slti r2,r16,0x0014
00059d94: 1440fffa bne r2,r0,0x00059d80		Branch if Counter  < 0x14
00059d98: 26310004 addiu r17,r17,0x0004		Stack Pointer +=  4
00059d9c: 12400003 beq r18,r0,0x00059dac	Branch if Unit doesn't have Save  Formation Flag
00059da0: 34020010 ori r2,r0,0x0010		Party Counter = 0x10 (Guests)
00059da4: 0801676d j 0x00059db4
00059da8: 34050014 ori r5,r0,0x0014		Limit = 0x14
00059dac: 00001021 addu r2,r0,r0		Party Counter = 0
00059db0: 34050010 ori r5,r0,0x0010		Limit = 0x10
00059db4: 00408021 addu r16,r2,r0		r16 = Party Counter
00059db8: 0205102a slt r2,r16,r5
00059dbc: 1040000e beq r2,r0,0x00059df8		Branch if Party Counter >= Limit
00059dc0: 00101080 sll r2,r16,0x02		Party Counter * 4
00059dc4: 340400ff ori r4,r0,0x00ff		r4 = FF
00059dc8: 27a30010 addiu r3,r29,0x0010		r3 = Stack Pointer + 0x10
00059dcc: 00431821 addu r3,r2,r3
00059dd0: 8c620000 lw r2,0x0000(r3)		Load Unit's Party Data Pointer
00059dd4: 00000000 nop
00059dd8: 90420001 lbu r2,0x0001(r2)		Load Unit's Party ID
00059ddc: 00000000 no p
00059de0: 10440006 beq r2,r4,0x00059dfc		Branch if unit doesn't exist 
00059de4: 02001021 addu r2,r16,r0		Free Party ID = Party Counter
00059de8: 26100001 addiu r16,r16,0x0001		Party Counter ++
00059dec: 0205102a slt r2,r16,r5
00059df0: 1440fff7 bne r2,r0,0x00059dd0		Branch if Party Counter < Limit
00059df4: 24630004 addiu r3,r3,0x0004		Stack Pointer += 4
00059df8: 2402ffff addiu r2,r0,0xffff		Free Party ID = None
00059dfc: 8fbf006c lw r31,0x006c(r29)
00059e00: 8fb20068 lw r18,0x0068(r29)
00059e04: 8fb10064 lw r17,0x0064(r29)
00059e08: 8fb00060 lw r16,0x0060(r29)
00059e0c: 27bd0070 addiu r29,r29,0x0070
00059e10: 03e00008 jr r31
00059e14: 00000000 nop


Return Locations

00059c18: Add Unit to Party/Store Unit's Party Data
00059c4c: ^^^
001c6078: Routine at 1c6000