Calculate ENTD Unit Jobs

From Final Fantasy Hacktics Wiki
Revision as of 13:56, 29 February 2012 by Choto (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Calculate ENTD Unit Jobs

0005b2b4: 27bdffe0 addiu r29,r29,0xffe0
0005b2b8: afb00010 sw r16,0x0010(r29)
0005b2bc: 00808021 addu r16,r4,r0		r16 = Unit's Data Pointer
0005b2c0: afb10014 sw r17,0x0014(r29)
0005b2c4: 00a08821 addu r17,r5,r0		r17 = ENTD Pointer
0005b2c8: 260400d2 addiu r4,r16,0x00d2		r4 = Unit's Job Level Pointer
0005b2cc: afbf0018 sw r31,0x0018(r29)
0005b2d0: 0c017991 jal 0x 0005e644		Data Nullifying (Job Levels)
0005b2d4: 3405000a ori r5,r0,0x000a		Limit = 10
0005b2d8: 1620000b bne r17,r0,0x 0005b308	Branch if ENTD Pointer exists
0005b2dc: 00002821 addu r5,r0,r0		r5 = 0
0005b2e0: 0c016d77 jal 0x 0005b5dc		Transfer Job's Data to Unit's Data
0005b2e4: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005b2e8: 26040096 addiu r4,r16,0x0096		r4 = Pointer to Unit's Unlocked Jobs
0005b2ec: 00002821 addu r5,r0,r0		r5 = 0
0005b2f0: 34020020 ori r2,r0,0x0020		r2 = 0x20
0005b2f4: a2000013 sb r0,0x0013(r16)		Store Unit's Secondary Skillset = 0
0005b2f8: 0c0177b6 jal 0x 0005ded8		Store 3-Byte Data (Unlocked Jobs = 0)
0005b2fc: a2020006 sb r2,0x0006(r16)		Store Unit's Gender = Monster
0005b300: 08016d3a j 0x 0005b4e8
0005b304: 00000000 nop
0005b308: 922a0001 lbu r10,0x0001(r17)		Load ENTD's Gender Byte
0005b30c: 00000000 nop
0005b310: 31420020 andi r2,r10,0x0020
0005b314: 14400042 bne r2,r0,0x 0005b420		Branch if Unit is a Monster
0005b318: 00000000 nop
0005b31c: 92260008 lbu r6,0x0008(r17)		Load ENTD's Job Unlocked
0005b320: 00000000 nop
0005b324: 30c700ff andi r7,r6,0x00ff
0005b328: 2ce20014 sltiu r2,r7,0x0014
0005b32c: 1040003c beq r2,r0,0x 0005b420		Branch if Job Unlocked is Invalid
0005b330: 00000000 nop
0005b334: 92220009 lbu r2,0x0009(r17)		Load ENTD's Job Level
0005b338: 00000000 nop
0005b33c: 3043000f andi r3,r2,0x000f
0005b340: 30c20001 andi r2,r6,0x0001
0005b344: 14400002 bne r2,r0,0x 0005b350		Branch if Job Unlocked is odd (low nybble job)
0005b348: 00602021 addu r4,r3,r0		r4 = Job Level
0005b34c: 00032100 sll r4,r3,0x04		Job Level * 16
0005b350: 00071042 srl r2,r7,0x01		Job Unlocked / 2 (Job Byte)
0005b354: 02021021 addu r2,r16,r2
0005b358: a04400d2 sb r4,0x00d2(r2)		Store Job Unlocked
0005b35c: 00003021 addu r6,r0,r0		Counter = 0
0005b360: 00e04821 addu r9,r7,r0		r9 = Job Unlocked
0005b364: 3c038006 lui r3,0x8006
0005b368: 246360ba addiu r3,r3,0x60ba		r3 = Job Unlock Requirements
0005b36c: 00091080 sll r2,r9,0x02		Job Unlocked * 4
0005b370: 00491021 addu r2,r2,r9		Job Unlocked * 5
0005b374: 00021040 sll r2,r2,0x01		Job Unlocked * 10
0005b378: 00434021 addu r8,r2,r3
0005b37c: 11200004 beq r9,r0,0x 0005b390		Branch if Job Unlocked = Base
0005b380: 02063821 addu r7,r16,r6		r7 = Unit's Data Pointer + Counter
0005b384: 91040000 lbu r4,0x0000(r8)		Load Required Job Levels
0005b388: 08016ce8 j 0x 0005b3a0
0005b38c: 00000000 nop
0005b390: 10c00002 beq r6,r0,0x 0005b39c		Branch if Counter = 0
0005b394: 34040001 ori r4,r0,0x0001		Job Levels = 0x01
0005b398: 34040011 ori r4,r0,0x0011		Job Levels = 0x11
0005b39c: 02063821 addu r7,r16,r6		r7 = Unit's Data Pointer + Counter
0005b3a0: 90e200d2 lbu r2,0x00d2(r7)		Load Unit's Job Levels
0005b3a4: 00000000 nop
0005b3a8: 00821825 or r3,r4,r2			Enable Job Levels
0005b3ac: 3062000f andi r2,r3,0x000f
0005b3b0: 14400002 bne r2,r0,0x 0005b3bc		Branch if Low Nybble Job Level != 0
0005b3b4: 00602021 addu r4,r3,r0		r4 = Required Job Level
0005b3b8: 34640001 ori r4,r3,0x0001		Low Nybble Job Level = 1
0005b3bc: 308200f0 andi r2,r4,0x00f0
0005b3c0: 14400002 bne r2,r0,0x 0005b3cc		Branch if High Nybble Job Level != 0
0005b3c4: 25080001 addiu r8,r8,0x0001		Pointer ++
0005b3c8: 34840010 ori r4,r4,0x0010		High Nybble Job Level = 1
0005b3cc: 24c60001 addiu r6,r6,0x0001		Counter ++
0005b3d0: 28c2000a slti r2,r6,0x000a
0005b3d4: 1440ffe9 bne r2,r0,0x 0005b37c		Branch if Counter < 10
0005b3d8: a0e400d2 sb r4,0x00d2(r7)		Store Unit's new Job Levels
0005b3dc: 31420040 andi r2,r10,0x0040
0005b3e0: 10400006 beq r2,r0,0x 0005b3fc		Branch if Unit isn't a Female
0005b3e4: 31420080 andi r2,r10,0x0080
0005b3e8: 920200da lbu r2,0x00da(r16)		Load Unit's Bard Job Level
0005b3ec: 00000000 nop
0005b3f0: 304200f0 andi r2,r2,0x00f0		Bard Level = 0
0005b3f4: a20200da sb r2,0x00da(r16)		Store Unit's new Bard Level
0005b3f8: 31420080 andi r2,r10,0x0080
0005b3fc: 1040 0005 beq r2,r0,0x 0005b414		Branch if Unit isn't a Male
0005b400: 260400d2 addiu r4,r16,0x00d2		r4 = Unit's Job Level Pointer
0005b404: 920200db lbu r2,0x00db(r16)		Load Unit's Dancer Level
0005b408: 00000000 nop
0005b40c: 3042000f andi r2,r2,0x000f		Dancer Level = 0
0005b410: a20200db sb r2,0x00db(r16)		Store Unit's new Dancer Level
0005b414: 0c017705 jal 0x 0005dc14		Calculate Unlocked Jobs
0005b418: 01402821 addu r5,r10,r0		r5 = Unit's Gender Byte
0005b41c: 00402821 addu r5,r2,r0		r5 = Unlocked Jobs
0005b420: 0c0177b6 jal 0x 0005ded8		Store 3-Byte Data (Unlocked Jobs)
0005b424: 26040096 addiu r4,r16,0x0096		r4 = Unit's Unlocked Jobs Pointer
0005b428: 9222000a lbu r2,0x000a(r17)		Load ENTD Job ID
0005b42c: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005b430: 0c016d77 jal 0x 0005b5dc		Transfer Job's Data to Unit's Data
0005b434: a2020003 sb r2,0x0003(r16)		Store Unit's Job ID
0005b438: 9226001d lbu r6,0x001d(r17)		Load ENTD Primary Skillset
0005b43c: 340200ff ori r2,r0,0x00ff		r2 = FF
0005b440: 30c300ff andi r3,r6,0x00ff
0005b444: 1062 0005 beq r3,r2,0x 0005b45c		Branch if Primary Skillset = FF (Job's)
0005b448: 00000000 nop
0005b44c: 10600003 beq r3,r0,0x 0005b45c		Branch if Primary Skillset = 0
0005b450: 340200ff ori r2,r0,0x00ff		r2 = FF
0005b454: a2060012 sb r6,0x0012(r16)		Store Unit's Primary Skillset
0005b458: a2020189 sb r2,0x0189(r16)		Store ? = FF
0005b45c: 9226000b lbu r6,0x000b(r17)		Load ENTD Secondary ID
0005b460: 340200fe ori r2,r0,0x00fe		r2 = FE
0005b464: 30c300ff andi r3,r6,0x00ff		r3 = Secondary ID
0005b468: 1462001e bne r3,r2,0x 0005b4e4		Branch if Secondary ID != Random
0005b46c: 00000000 nop
0005b470: 92020006 lbu r2,0x0006(r16)		Load Unit's Gender Byte
0005b474: 00000000 nop
0005b478: 30420020 andi r2,r2,0x0020
0005b47c: 10400003 beq r2,r0,0x 0005b48c		Branch if Unit isn't a Monster
0005b480: 00000000 nop
0005b484: 08016d3a j 0x 0005b4e8
0005b488: a2000013 sb r0,0x0013(r16)		Store Unit's Secondary ID = 0
0005b48c: 0c016d40 jal 0x 0005b500		Sprite Set and Random Secondary Job Calculation
0005b490: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005b494: 00402021 addu r4,r2,r0		r4 = Chosen Job ID
0005b498: 308300ff andi r3,r4,0x00ff
0005b49c: 10600009 beq r3,r0,0x 0005b4c4		Branch if a Job wasn't chosen
0005b4a0: 00031040 sll r2,r3,0x01		ID * 2
0005b4a4: 00431021 addu r2,r2,r3		ID * 3
0005b4a8: 3c038006 lui r3,0x8006
0005b4ac: 8c636194 lw r3,0x6194(r3)		Load Job Data Pointer
0005b4b0: 00021100 sll r2,r2,0x04		ID * 48
0005b4b4: 00431021 addu r2,r2,r3
0005b4b8: 90430000 lbu r3,0x0000(r2)		Load Job's Skillset
0005b4bc: 08016d32 j 0x 0005b4c8
0005b4c0: 00000000 nop
0005b4c4: 308300ff andi r3,r4,0x00ff
0005b4c8: 92020012 lbu r2,0x0012(r16)		Load Unit's Primary Skillset ID
0005b4cc: 00000000 nop
0005b4d0: 14620002 bne r3,r2,0x 0005b4dc		Branch if Skillset != Chosen Skillset
0005b4d4: 00000000 nop
0005b4d8: 00001821 addu r3,r0,r0		Skillset = 0
0005b4dc: 08016d3a j 0x 0005b4e8
0005b4e0: a2030013 sb r3,0x0013(r16)		Store Chosen Secondary Skillset
0005b4e4: a2060013 sb r6,0x0013(r16)		Store Secondary Skillset = ENTD Secondary Skillset
0005b4e8: 8fbf0018 lw r31,0x0018(r29)
0005b4ec: 8fb10014 lw r17,0x0014(r29)
0005b4f0: 8fb00010 lw r16,0x0010(r29)
0005b4f4: 27bd0020 addiu r29,r29,0x0020
0005b4f8: 03e00008 jr r31
0005b4fc: 00000000 nop


Return Locations

0005aa40:  Unit Battle Initialization