Load Job Level

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameters : r5 = Unit current Job ID (Unit 0x03)
             r6 = previous routine stack pointer (store job ID if generic)

Returns : r2 = Unit's current job's Lv
-----------------------------------------------------------------------------
0017ea28: 24a2ffb5 addiu r2,r5,-0x004b      |r2 = Unit's current Job ID - 0x4b
0017ea2c: 2c420013 sltiu r2,r2,0x0013       |r2 = 0x01 if job ID < Chocobo (Job is generic)
0017ea30: 10400003 beq r2,r0,0x0017ea40     #If Job is a generic job
0017ea34: 24a2ffb6 addiu r2,r5,-0x004a          |r2 = Job ID - 0x4a (Squire)
0017ea38: 0805fa91 j 0x0017ea44                 >>jump storing Job ID 
0017ea3c: acc20000 sw r2,0x0000(r6)             |Store Job ID in previous routine stack pointer
                                            #Else : Job is not generic
0017ea40: acc00000 sw r0,0x0000(r6)             |Nullify Job ID on stack
0017ea44: 8cc30000 lw r3,0x0000(r6)         |r3 = Job ID if generic (else 0x00)
0017ea48: 00000000 nop                      |
0017ea4c: 000317c2 srl r2,r3,0x1f           |highest bit of Job ID (should be 0)
0017ea50: 00621021 addu r2,r3,r2            |Job ID + 0
0017ea54: 00021043 sra r2,r2,0x01           |r2 = Job ID / 2 (job offset in unit data)
0017ea58: 00821021 addu r2,r4,r2            |r2 = Unit pointer + Job offset
0017ea5c: 30630001 andi r3,r3,0x0001        |r3 = 0x01 if Job ID is uneven
0017ea60: 904200d2 lbu r2,0x00d2(r2)        |r2 = Unit's Job Lv byte (2 jobs per bytes)
0017ea64: 14600003 bne r3,r0,0x0017ea74     #If Job ID is an even number
0017ea68: 00000000 nop                          |
0017ea6c: 0805fa9e j 0x0017ea78                 >>jump with higher nibble
0017ea70: 00021103 sra r2,r2,0x04               |r2 = High nybble
                                            #Else : Job is uneven
0017ea74: 3042000f andi r2,r2,0x000f            |r2 = Low nybble
0017ea78: 03e00008 jr r31
0017ea7c: 00000000 nop

Returns locations

Battle.bin
0017e930: Gained_JP_Up_Section
0017e9e4: Gained_JP_Up_Section
0018dfd4: Prep_gained_exp/jp/level/job_level
0018e024: Main_Reaction_subroutine_-_ENTD/ID_stuff
0018e050: Main_Reaction_subroutine_-_ENTD/ID_stuff