Add Unit to Party/Store Unit's Party Data

From Final Fantasy Hacktics Wiki
Revision as of 21:45, 8 October 2023 by Nyzer (talk | contribs)
Jump to navigation Jump to search
Add Unit to Party/Store Unit's Party Data
00059bb0: 27bdffd8 addiu r29,r29,0xffd8
00059bb4: afb20020 sw r18,0x0020(r29)
00059bb8: 00809021 addu r18,r4,r0		r18 = Unit's Data Pointer
00059bbc: afbf0024 sw r31,0x0024(r29)
00059bc0: afb1001c sw r17,0x001c(r29)
00059bc4: afb00018 sw r16,0x0018(r29)
00059bc8: 92430006 lbu r3,0x0006(r18)		Load Unit's Gender Byte
00059bcc: 92420000 lbu r2,0x0000(r18)		Load Unit's Sprite Set
00059bd0: 00000000 nop
00059bd4: 2c420080 sltiu r2,r2,0x0080
00059bd8: 10400003 beq r2,r0,0x00059be8		Branch if Unit is Generic
00059bdc: 30630001 andi r3,r3,0x0001		r3 = Save Formation Flag
00059be0: 14a00002 bne r5,r0,0x00059bec		Branch if Preset Value != 0
00059be4: 00000000 nop
00059be8: 00001821 addu r3,r0,r0		r3 = 0 (No Save Formation Flag)
00059bec: 92440002 lbu r4,0x0002(r18)		Load Unit's Party ID
00059bf0: 306200ff andi r2,r3,0x00f f
00059bf4: 14400010 bne r2,r0,0x00059c38		Branch if Unit has Save Formation  Flag (and PV != 0)
00059bf8: 309000ff andi r16,r4,0x00ff		r16 = Unit's Party ID
00059bfc: 2482fff0 addiu r2,r4,0xfff0		r2 = Guest ID
00059c00: 2c420004 sltiu r2,r2,0x0004
00059c04: 1040000d beq r2,r0,0x00059c3c		Branch if Unit isn't a Guest
00059c08: 2e020015 sltiu r2,r16,0x0015		(Guest joining as actual party  member?)
00059c0c: 0c0167f8 jal 0x00059fe0		Remove Unit from Party
00059c10: 00000000 nop
00059c14: 00002021 addu r4,r0,r0		r4 = 0 (Normal Party)
00059c18: 0c016757 jal 0x00059d5c		Find Free Party Slot
00059c1c: 27a50010 addiu r5,r29,0x0010		r5 = Stack Pointer + 0x10
00059c20: 00402021 addu r4,r2,r0		r4 = Free Party Slot
00059c24: 2402ffff addiu r2,r0,0xffff
00059c28: 10820045 beq r4,r2,0x00059d40		Branch if No slots are free
00059c2c: 00808821 addu r17,r4,r0		r17 = Free Party Slot
00059c30: 08016716 j 0x00059c58
00059c34: 00000000 nop
00059c38: 2e020015 sltiu r2,r16,0x0015
00059c3c: 14400003 bne r2,r0,0x00059c4c		Branch if Unit is a Party Member
00059c40: 00002021 addu r4,r0,r0		r4 = 0 (Normal Party)
00059c44: 08016706 j 0x00059c18			(Adding new unit to party)
00059c48: 00602021 addu r4,r3,r0		r4 = Save Formation Flag (Normal if 0, Guest if 1)
00059c4c: 0c016757 jal 0x00059d5c		Find Free Party Slot (just to set  stack value = 0?)
00059c50: 27a50010 addiu r5,r29,0x0010		r5 = Stack Pointer
00059c54: 02008821 addu r17,r16,r0		r17 = Party ID
00059c58: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00059c5c: 02202021 addu r4,r17,r0		r4 = Unit's Party ID
00059c60: 92430000 lbu r3,0x0000(r18)		Load Unit's Sprite Set
00059c64: 00408021 addu r16,r2,r0		r16 = Unit's Party Data Pointer
00059c68: a2110001 sb r17,0x0001(r16)		Store Unit's Party ID
00059c6c: a2030000 sb r3,0x0000(r16)		Store Unit's Sprite Set
00059c70: 92420003 lbu r2,0x0003(r18)		Load Unit's Job ID
00059c74: 00000000 nop
00059c78: a2020002 sb r2,0x0002(r16)		Store Unit's Job ID
00059c7c: 2a220010 slti r2,r17,0x0010
00059c80: 14400007 bne r2,r0,0x00059ca0		Branch if Unit is a Normal Party  Member
00059c84: 00000000 nop
00059c88: 92420004 lbu r2,0x0004(r18)		Load Unit's Palette
00059c8c: 00000000 nop
00059c90: a2020003 sb r2,0x0003(r16)		Store Unit's Palette
00059c94: 92420006 lbu r2,0x0006(r18)		Load Unit's Gender Byte
00059c98: 0801672e j 0x00059cb8
00059c9c: 304200fb andi r2,r2,0x00fb		Disable ??? stats
00059ca0: 93a20010 lbu r2,0x0010(r29)		Load Stack Value (0)
00059ca4: 00000000 nop
00059ca8: a2020003 sb r2,0x0003(r16)		Store Unit's Palette
00059cac: 92420006 lbu r2,0x0006(r18)		Load Unit's Gender Byte
00059cb0: 00000000 nop
00059cb4: 304200fa andi r2,r2,0x00fa		Disable ??? Stats and Save Formation
00059cb8: a2020004 sb r2,0x0004(r16)		Store Unit's Gender Byte
00059cbc: 26440013 addiu r4,r18,0x0013		r4 = Unit's Secondary Skillset Pointer
00059cc0: 26050007 addiu r5,r16,0x0007		r5 = Party Secondary Skillset  Pointer
00059cc4: 34060010 ori r6,r0,0x0010		Limit = 0x10
00059cc8: 96430008 lhu r3,0x0008(r18)		Load Unit's Birthday + Zodiac
00059ccc: 96420008 lhu r2,0x0008(r18)		" (Derp)
00059cd0: 306301ff andi r3,r3,0x01ff		r3 = Birthday
00059cd4: 3042f000 andi r2,r2,0xf000		r2 = Zodiac
00059cd8: 00621825 or r3,r3,r2			...
00059cdc: 00031202 srl r2,r3,0x08		Zodiac / 256
00059ce0: a2030005 sb r3,0x0005(r16)		Store Party Birthda y
00059ce4: 0c017895 jal 0x0005e254		Store X Byte into Y (Secondary/R /S/M/Equips/Exp/Level)
00059ce8: a2020006 sb r2,0x0006(r16)		Store Party Zodiac
00059cec: 26440072 addiu r4,r18,0x0072		r4 = Unit's Raw HP Pointer
00059cf0: 92420023 lbu r2,0x0023(r18)		Load Unit's Original Brave
00059cf4: 26050019 addiu r5,r16,0x0019		r5 = Party Raw HP Pointer
00059cf8: a2020017 sb r2,0x0017(r16)		Store Party Brave
00059cfc: 92420025 lbu r2,0x0025(r18)		Load Unit's Original Faith
00059d00: 3406000f ori r6,r0,0x000f		Limit = 0xF
00059d04: 0c017895 jal 0x0005e254		Store X Byte into Y (Raw Stats)
00059d08: a2020018 sb r2,0x0018(r16)		Store Party Faith
00059d0c: 26440096 addiu r4,r18,0x0096		r4 = Unit's Unlocked Jobs Pointer
00059d10: 26050028 addiu r5,r16,0x0028		r5 = Party Unlocked Jobs Pointer
00059d14: 0c017895 jal 0x0005e254		Store X Byte into Y (Job Data)
00059d18: 340600a6 ori r6,r0,0x00a6		Limit = 0xa6
00059d1c: 9242016c lbu r2,0x016c(r18)		Load Unit's Name ID
00059d20: 00000000 nop
00059d24: a20200ce sb r2,0x00ce(r16)		Store Party Name ID
00059d28: 9643016c lhu r3,0x016c(r18)		Load Unit's Name ID
00059d2c: 00001021 addu r2,r0,r0		r2 = 0
00059d30: a20000d0 sb r0,0x00d0(r16)		Clear the byte for units that are Missing or on Props. (For newly joining units?)
00059d34: a20000d2 sb r0,0x00d2(r16)		Store ? = 0
00059d38: 00031a02 srl r3,r3,0x08
00059d3c: a20300cf sb r3,0x00cf(r16)		Store Party Name ID High bit
00059d40: 8fbf0024 lw r31,0x0024(r29)
00059d44: 8fb20020 lw r18,0x0020(r29)
00059d48: 8fb1001c lw r17,0x001c(r29)
00059d4c: 8fb00018 lw r16,0x0018(r29)
00059d50: 27bd0028 addiu r29,r29,0x0028
00059d54: 03e00008 jr r31
00059d58: 00000000 nop


Return Locations

00059b84: Unit Initialization
001341f8: 00134180
001c48d0: Post battle equipment/??? storing
001c49f8: Post battle equipment/??? storing
001c7014: 001c6988