Calculate Highest Party Level

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Calculate Highest Party Level
0005cbd0: 27bdffe0 addiu r29,r29,0xffe0
0005cbd4: afb10014 sw r17,0x0014(r29)
0005cbd8: 00008821 addu r17,r0,r0		High Level = 0
0005cbdc: afb00010 sw r16,0x0010(r29)
0005cbe0: 00008021 addu r16,r0,r0		Party ID = 0
0005cbe4: afb20018 sw r18,0x0018(r29)
0005cbe8: 341200ff ori r18,r0,0x00ff		r18 = FF
0005cbec: afbf001c sw r31,0x001c(r29)
0005cbf0: 0c0166bc jal 0x00059af0		Get Party Data Pointer
0005cbf4: 02002021 addu r4,r16,r0		r4 = Party ID
0005cbf8: 00401821 addu r3,r2,r0		r3 = Party Data Pointer
0005cbfc: 90620001 lbu r2,0x0001(r3)		Load Party ID
0005cc00: 00000000 nop
0005cc04: 10520007 beq r2,r18,0x0005cc24	Branch if Unit doesn't exist
0005cc08: 26100001 addiu r16,r16,0x0001		Party ID ++
0005cc0c: 90620016 lbu r2,0x0016(r3)		Load Party Level
0005cc10: 00000000 nop
0005cc14: 0222102b sltu r2,r17,r2
0005cc18: 10400003 beq r2,r0,0x0005cc28		Branch if High Level >= Level
0005cc1c: 2a020014 slti r2,r16,0x0014
0005cc20: 90710016 lbu r17,0x0016(r3)		High Level = Level
0005cc24: 2a020014 slti r2,r16,0x0014
0005cc28: 1440fff1 bne r2,r0,0x0005cbf0		Branch if Party ID < 0x14
0005cc2c: 2e220064 sltiu r2,r17,0x0064
0005cc30: 14400002 bne r2,r0,0x0005cc3c		Branch if High Level < 100
0005cc34: 00000000 nop
0005cc38: 34110063 ori r17,r0,0x0063		High Level = 99
0005cc3c: 3c018006 lui r1,0x8006
0005cc40: a0316308 sb r17,0x6308(r1)		Store Highest Party Level
0005cc44: 02201021 addu r2,r17,r0		r2 = High Level
0005cc48: 8fbf001c lw r31,0x001c(r29)
0005cc4c: 8fb20018 lw r18,0x0018(r29)
0005cc50: 8fb10014 lw r17,0x0014(r29)
0005cc54: 8fb00010 lw r16,0x0010(r29)
0005cc58: 27bd0020 addiu r29,r29,0x0020
0005cc5c: 03e00008 jr r31
0005cc60: 00000000 nop


Return Locations

0017f8f4: 0017f8a0