Find Empty Party Slot and Generate Unit

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

< SCUS.942.21

Find Empty Party Slot and Generate Unit
00059ed4: 27bdff88 addiu r29,r29,0xff88
00059ed8: afb20068 sw r18,0x0068(r29)
00059edc: 00809021 addu r18,r4,r0		r18 = Unit Type
00059ee0: afb3006c sw r19,0x006c(r29)
00059ee4: 00009821 addu r19,r0,r0		Palette = 0
00059ee8: afb00060 sw r16,0x0060(r29)
00059eec: 00008021 addu r16,r0,r0		Counter = 0
00059ef0: afb10064 sw r17,0x0064(r29)
00059ef4: 27b10010 addiu r17,r29,0x0010		r17 = Stack Pointer
00059ef8: afbf0070 sw r31,0x0070(r29)
00059efc: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00059f00: 02002021 addu r4,r16,r0		r4 = Counter
00059f04: ae220000 sw r2,0x0000(r17)		Temp Store Party Data Pointer
00059f08: 26100001 addiu r16,r16,0x0001		Counter ++
00059f0c: 2a020014 slti r2,r16,0x0014		(doesn't need limit of 0x14)
00059f10: 1440fffa bne r2,r0,0x00059efc		Branch if Counter < 0x14
00059f14: 26310004 addiu r17,r17,0x0004		Stack Pointer += 4
00059f18: 00008021 addu r16,r0,r0		Counter = 0
00059f1c: 340500ff ori r5,r0,0x00ff		r5 = FF
00059f20: 27a40010 addiu r4,r29,0x0010		r4 = Stack Pointer
00059f24: 8c830000 lw r3,0x0000(r4)		Load Party Data Pointer
00059f28: 00000000 nop
00059f2c: 90620001 lbu r2,0x0001(r3)		Load Party ID
00059f30: 00000000 nop
00059f34: 1445000a bne r2,r5,0x00059f60		Branch if Unit exists
00059f38: 00000000 nop
00059f3c: a0700001 sb r16,0x0001(r3)		Store Party ID = Counter
00059f40: 8c820000 lw r2,0x0000(r4)		Load Party Data Pointer
00059f44: 00000000 nop
00059f48: a0530003 sb r19,0x0003(r2)		Store Palette = 0
00059f4c: 8c840000 lw r4,0x0000(r4)		Load Party Data Pointer
00059f50: 0c0167ff jal 0x00059ffc		Out of Battle Unit Generation
00059f54: 02402821 addu r5,r18,r0		r5 = Unit Type
00059f58: 080167dd j 0x00059f74
00059f5c: 02001021 addu r2,r16,r0		Party ID = Counter
00059f60: 26100001 addiu r16,r16,0x0001		Counter ++
00059f64: 2a020010 slti r2,r16,0x0010
00059f68: 1440ffee bne r2,r0,0x00059f24		Branch if Counter < 0x10
00059f6c: 24840004 addiu r4,r4,0x0004		Stack Pointer += 4
00059f70: 2402ffff addiu r2,r0,0xffff		Party ID = None
00059f74: 8fbf0070 lw r31,0x0070(r29)
00059f78: 8fb3006c lw r19,0x006c(r29)
00059f7c: 8fb20068 lw r18,0x0068(r29)
00059f80: 8fb10064 lw r17,0x0064(r29)
00059f84: 8fb00060 lw r16,0x0060(r29)
00059f88: 27bd0078 addiu r29,r29,0x0078
00059f8c: 03e00008 jr r31
00059f90: 00000000 nop


Return Locations

00042ad4: ? 0x42ab0 (Starting new game related)
00059e40: Create Monster Egg