Calculate Unlocked Jobs

From Final Fantasy Hacktics Wiki
Revision as of 22:20, 25 September 2021 by Pride (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Calculate Unlocked Jobs #bard, dancer and monster restrictions are coded in another place too.
0005dc14: 27bdffe8 addiu r29,r29,0xffe8
0005dc18: 03a01821 addu r3,r29,r0		Counter = Stack Pointer
0005dc1c: 27a6000a addiu r6,r29,0x000a		Limit = Stack Pointer + 10
0005dc20: 90820000 lbu r2,0x0000(r4)		Load Unit's Job Levels
0005dc24: 00000000 nop
0005dc28: a0620000 sb r2,0x0000(r3)		Store Unit's Job Levels
0005dc2c: 24630001 addiu r3,r3,0x0001		Counter ++
0005dc30: 0066102a slt r2,r3,r6
0005dc34: 1440fffa bne r2,r0,0x0005dc20		Branch if Counter < Limit
0005dc38: 24840001 addiu r4,r4,0x0001		Job Pointer ++
0005dc3c: 30a20040 andi r2,r5,0x0040
0005dc40: 10400006 beq r2,r0,0x0005dc5c		Branch if Unit is not Female
0005dc44: 30a20080 andi r2,r5,0x0080
0005dc48: 93a20008 lbu r2,0x0008(r29)		Load Unit's Calc/Bard Job Levels
0005dc4c: 00000000 nop
0005dc50: 3442000f ori r2,r2,0x000f		Bard Level doesn't exist
0005dc54: a3a20008 sb r2,0x0008(r29)		Store new Job Levels
0005dc58: 30a20080 andi r2,r5,0x0080
0005dc5c: 10400006 beq r2,r0,0x0005dc78		Branch if Unit is not Male
0005dc60: 30a20020 andi r2,r5,0x0020
0005dc64: 93a20009 lbu r2,0x0009(r29)		Load Unit's Dancer/Mime Job Levels
0005dc68: 00000000 nop
0005dc6c: 344200f0 ori r2,r2,0x00f0		Dancer Level doesn't exist
0005dc70: a3a20009 sb r2,0x0009(r29)		Store new Job Levels
0005dc74: 30a20020 andi r2,r5,0x0020
0005dc78: 14400030 bne r2,r0,0x0005dd3c		Branch if Unit is a monster
0005dc7c: 00001021 addu r2,r0,r0		r2 = 0
0005dc80: 3c0a0080 lui r10,0x0080		Current Unlock Check = 0x800000
0005dc84: 3c0b0080 lui r11,0x0080		Jobs Unlocked = 0x800000 (start w/ squire)
0005dc88: 00007021 addu r14,r0,r0		Counter = 0
0005dc8c: 3c0d8006 lui r13,0x8006
0005dc90: 25ad60c4 addiu r13,r13,0x60c4
0005dc94: 000a17c2 srl r2,r10,0x1f
0005dc98: 01421021 addu r2,r10,r2
0005dc9c: 00025043 sra r10,r2,0x01		Current Unlock Check / 2
0005dca0: 00004821 addu r9,r0,r0		r9 = 0
0005dca4: 03a03821 addu r7,r29,r0		r7 = Stack Pointer
0005dca8: 01a04021 addu r8,r13,r0		r8 = Job Unlock Requirements Pointer
0005dcac: 27ac000a addiu r12,r29,0x000a		r12 = Stack Pointer + 10
0005dcb0: 91040000 lbu r4,0x0000(r8)		Load Job Unlock Requirements
0005dcb4: 90e60000 lbu r6,0x0000(r7)		Load Job Levels
0005dcb8: 308300f0 andi r3,r4,0x00f0		r3 = high nybble job requirement
0005dcbc: 30c200f0 andi r2,r6,0x00f0		r2 = high nybble job level
0005dcc0: 0043102b sltu r2,r2,r3
0005dcc4: 1440 0005 bne r2,r0,0x0005dcdc		Branch if Level < requirement
0005dcc8: 3083000f andi r3,r4,0x000f		r3 = low nybble job requirement
0005dccc: 30c2000f andi r2,r6,0x000f		r2 = low nybble job level
0005dcd0: 0043102b sltu r2,r2,r3
0005dcd4: 10400003 beq r2,r0,0x0005dce4		Branch if Level >= requirement
0005dcd8: 00000000 nop
0005dcdc: 0801773d j 0x 0005dcf4
0005dce0: 34090001 ori r9,r0,0x0001		r9 = 1 (Job can't be unlocked)
0005dce4: 24e70001 addiu r7,r7,0x0001		Stack Pointer ++
0005dce8: 00ec102a slt r2,r7,r12
0005dcec: 1440fff0 bne r2,r0,0x0005dcb0		Branch if Stack Pointer < SP + 10
0005dcf0: 25080001 addiu r8,r8,0x0001		Job Unlock Requirements Pointer ++
0005dcf4: 15200002 bne r9,r0,0x 0005dd00		Branch if Job can't be unlocked
0005dcf8: 25ad000a addiu r13,r13,0x000a		Job Unlock Requirements Pointer += 10
0005dcfc: 016a5825 or r11,r11,r10		Unlock Job for the unit
0005dd00: 25ce0001 addiu r14,r14,0x0001		Counter ++
0005dd04: 29c20013 slti r2,r14,0x0013
0005dd08: 1440ffe3 bne r2,r0,0x0005dc98		Branch if Counter < 19
0005dd0c: 000a17c2 srl r2,r10,0x1f
0005dd10: 30a20080 andi r2,r5,0x0080
0005dd14: 10400003 beq r2,r0,0x0005dd24		Branch if Unit is Female
0005dd18: 3c0200ff lui r2,0x00ff
0005dd1c: 3442ffd0 ori r2,r2,0xffd0		
0005dd20: 01625824 and r11,r11,r2		Disable Dancer
0005dd24: 30a20040 andi r2,r5,0x0040
0005dd28: 10400003 beq r2,r0,0x0005dd38		Branch if Unit is Male
0005dd2c: 3c0200ff lui r2,0x00ff
0005dd30: 3442ffb0 ori r2,r2,0xffb0
0005dd34: 01625824 and r11,r11,r2		Disable Bard
0005dd38: 01601021 addu r2,r11,r0		r2 = Unlocked Jobs
0005dd3c: 27bd0018 addiu r29,r29,0x0018
0005dd40: 03e00008 jr r31
0005dd44: 00000000 nop


Return Locations

SCUS_942.21
0005a930: Initialize Unit's Job Data
0005b414: Calculate ENTD Unit Jobs
0005dea4: Proposition JP Gain
BATTLE.BIN
0017ebe8: 0017ea80
BUNIT.OUT
001c6d38:
001c7290:
JOBSTTS.OUT
001e0068
WORLD.BIN
00120fa8
0012254c