Level Up Section

From Final Fantasy Hacktics Wiki
Revision as of 03:11, 25 September 2021 by Pride (talk | contribs)
Jump to navigation Jump to search
Level Up Section
0005da10: 27bdffc8 addiu r29,r29,0xffc8
0005da14: afb3001c sw r19,0x001c(r29)
0005da18: 00809821 addu r19,r4,r0		r19 = Unit's Data Pointer
0005da1c: afb60028 sw r22,0x0028(r29)
0005da20: 00a0b021 addu r22,r5,r0		r22 = Level Down Flag
0005da24: afb50024 sw r21,0x0024(r29)
0005da28: 26750072 addiu r21,r19,0x0072		r21 = Unit's Raw Stat Pointer
0005da2c: afb20018 sw r18,0x0018(r29)
0005da30: 02a09021 addu r18,r21,r0		r18 = Unit's Raw Stat Pointer
0005da34: afb40020 sw r20,0x0020(r29)
0005da38: 26740081 addiu r20,r19,0x0081		r20 = Unit's Raw Growth Pointer
0005da3c: afbf0030 sw r31,0x0030(r29)
0005da40: afb7002c sw r23,0x002c(r29)
0005da44: afb10014 sw r17,0x0014(r29)
0005da48: afb00010 sw r16,0x0010(r29)
0005da4c: 92770022 lbu r23,0x0022(r19)		Load Unit's Level
0005da50: 92440001 lbu r4,0x0001(r18)		Load Second byte of Raw Stat
0005da54: 92910000 lbu r17,0x0000(r20)		Load Stat Growth
0005da58: 92430000 lbu r3,0x0000(r18)		Load first byte of Raw Stat
0005da5c: 92420002 lbu r2,0x0002(r18)		Load third byte of Raw Stat
0005da60: 00042200 sll r4,r4,0x08		Raw Stat 2 * 100h
0005da64: 00641821 addu r3,r3,r4		Raw Stat 2 * 100h + Raw Stat 1
0005da68: 00021400 sll r2,r2,0x10		Raw Stat 3 * 10000h
0005da6c: 00628021 addu r16,r3,r2		r16 = Full Raw Stat (or lw, sll 0x08, srl 0x08)
0005da70: 16200002 bne r17,r0,0x 0005da7c	Branch if Stat Growth != 0
0005da74: 02201021 addu r2,r17,r0		r2 = Stat Growth
0005da78: 34020001 ori r2,r0,0x0001		r2 = 1 (Min 1 growth)
0005da7c: 0c0088c3 jal 0x0002230c		Random Number Generator
0005da80: 00578821 addu r17,r2,r23		r17 = Stat Growth + Level
0005da84: 12c0 0005 beq r22,r0,0x 0005da9c	Branch if not Leveling Down
0005da88: 00000000 nop
0005da8c: 0211001b divu r16,r17
0005da90: 00001012 mflo r2			r2 = Raw Stat / (Stat Growth + Level)
0005da94: 080176ab j 0x 0005daac
0005da98: 02028023 subu r16,r16,r2		Raw Stat -= Raw Stat / (Stat Growth + Level)
0005da9c: 0211001b divu r16,r17
0005daa0: 00001012 mflo r2			r2 = Raw Stat / (Stat Growth + Level)
0005daa4: 00000000 nop
0005daa8: 02028021 addu r16,r16,r2		Raw Stat += Raw Stat / (Stat Growth + Level)
0005daac: 3c0200ff lui r2,0x00ff
0005dab0: 3442ffff ori r2,r2,0xffff		r2 = ffffff
0005dab4: 0050102b sltu r2,r2,r16
0005dab8: 10400003 beq r2,r0,0x 0005dac8		Branch if ffffff < Raw Stat
0005dabc: 26940002 addiu r20,r20,0x0002		Unit's Growth Pointer += 2
0005dac0: 3c1000ff lui r16,0x00ff
0005dac4: 3610ffff ori r16,r16,0xffff		Raw Stat = ffffff
0005dac8: 00101202 srl r2,r16,0x08		Raw Stat / 100
0005dacc: a2420001 sb r2,0x0001(r18)		Store Raw Stat 2
0005dad0: 00101402 srl r2,r16,0x10		Raw Stat / 10000
0005dad4: a2500000 sb r16,0x0000(r18)		Store Raw Stat 1
0005dad8: a2420002 sb r2,0x0002(r18)		Store Raw Stat 3
0005dadc: 26520003 addiu r18,r18,0x0003		Unit's Raw Stat Pointer += 3
0005dae0: 26a2000f addiu r2,r21,0x000f		Unit's Raw Stat Pointer += f
0005dae4: 0242102a slt r2,r18,r2
0005dae8: 1440ffd9 bne r2,r0,0x 0005da50		Branch if Current Pointer < Max
0005daec: 00000000 nop
0005daf0: 0c017578 jal 0x 0005d5e0		Status Setting/Checking Prep (Not Initializing, Statuses set?)
0005daf4: 02602021 addu r4,r19,r0		r4 = Unit's Data Pointer
0005daf8: 96630028 lhu r3,0x0028(r19)		Load Unit's HP
0005dafc: 9662002a lhu r2,0x002a(r19)		Load Unit's Max HP
0005db00: 00000000 nop
0005db04: 0043102b sltu r2,r2,r3
0005db08: 10400004 beq r2,r0,0x 0005db1c		Branch if Max HP >= Current HP
0005db0c: 00000000 nop
0005db10: 9662002a lhu r2,0x002a(r19)		Load Unit's Max HP
0005db14: 00000000 nop
0005db18: a6620028 sh r2,0x0028(r19)		Store Current HP = Max HP
0005db1c: 9663002c lhu r3,0x002c(r19)		Load Unit's MP
0005db20: 9662002e lhu r2,0x002e(r19)		Load Unit's Max MP
0005db24: 00000000 nop
0005db28: 0043102b sltu r2,r2,r3
0005db2c: 10400004 beq r2,r0,0x 0005db40		Branch if Max MP >= Current MP
0005db30: 00000000 nop
0005db34: 9662002e lhu r2,0x002e(r19)		Load Unit's Max MP
0005db38: 00000000 nop
0005db3c: a662002c sh r2,0x002c(r19)		Store Current MP = Max MP
0005db40: 8fbf0030 lw r31,0x0030(r29)
0005db44: 8fb7002c lw r23,0x002c(r29)
0005db48: 8fb60028 lw r22,0x0028(r29)
0005db4c: 8fb50024 lw r21,0x0024(r29)
0005db50: 8fb40020 lw r20,0x0020(r29)
0005db54: 8fb3001c lw r19,0x001c(r29)
0005db58: 8fb20018 lw r18,0x0018(r29)
0005db5c: 8fb10014 lw r17,0x0014(r29)
0005db60: 8fb00010 lw r16,0x0010(r29)
0005db64: 27bd0038 addiu r29,r29,0x0038
0005db68: 03e00008 jr r31
0005db6c: 00000000 nop


Return Locations

SCUS_942.21
0005d8bc: Check if Unit Leveled UP
BATTLE.BIN
0018c904: 0018c85c