JOBSTTS.OUT Create Ability List

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
See: BUNIT.OUT Create Ability List
find at some point: the world routine for the same thing
001e03bc: 27bdffc0 addiu r29,r29,0xffc0
001e03c0: afb20020 sw r18,0x0020(r29)
001e03c4: 00809021 addu r18,r4,r0
001e03c8: afb00018 sw r16,0x0018(r29)
001e03cc: 00058400 sll r16,r5,0x10
001e03d0: 00108403 sra r16,r16,0x10
001e03d4: afb60030 sw r22,0x0030(r29)
001e03d8: 8fb60050 lw r22,0x0050(r29)             ?
001e03dc: 02002021 addu r4,r16,r0                 current job
001e03e0: afb1001c sw r17,0x001c(r29)
001e03e4: 00c08821 addu r17,r6,r0                 action/r/s/m/all list index
001e03e8: afb70034 sw r23,0x0034(r29)
001e03ec: 00e0b821 addu r23,r7,r0
001e03f0: afbf0038 sw r31,0x0038(r29)
001e03f4: afb5002c sw r21,0x002c(r29)
001e03f8: afb40028 sw r20,0x0028(r29)
001e03fc: 0c0780e4 jal 0x001e0390                 JOBSTTS.OUT Get generic job index
001e0400: afb30024 sw r19,0x0024(r29)
001e0404: 02002021 addu r4,r16,r0                 current job
001e0408: 0c0780db jal 0x001e036c                 JOBSTTS.OUT get skillset of job ID
001e040c: 0040a821 addu r21,r2,r0                 current job index
001e0410: 00408021 addu r16,r2,r0                 skillset of current job
001e0414: 0c0780c5 jal 0x001e0314                 JOBSTTS.OUT Get first job that matches Skillset ID <-- lol?
001e0418: 02002021 addu r4,r16,r0                 "
001e041c: 2403ffff addiu r3,r0,0xffff
001e0420: 14430008 bne r2,r3,0x001e0444           branch if job was found
001e0424: 0240a021 addu r20,r18,r0
001e0428: 00121400 sll r2,r18,0x10
001e042c: 00021383 sra r2,r2,0x0e                 fallback job ID?
001e0430: 3c018020 lui r1,0x8020
001e0434: 00220821 addu r1,r1,r2
001e0438: 8c22a7f8 lw r2,-0x5808(r1)              jobstts unit data
001e043c: 00000000 nop
001e0440: 94500004 lhu r16,0x0004(r2)             primary skillset
001e0444: 00000000 nop
001e0448: 02002021 addu r4,r16,r0                 primary skillset
001e044c: 0c01698e jal 0x0005a638                 Store Skillset's Abilities
001e0450: 3405000f ori r5,r0,0x000f               store all ability types
001e0454: 16200004 bne r17,r0,0x001e0468          
001e0458: 00409821 addu r19,r2,r0                 r19 = ability list pointer
001e045c: 34030001 ori r3,r0,0x0001               start of action abilities
001e0460: 08078129 j 0x001e04a4
001e0464: 340201a5 ori r2,r0,0x01a5               end of action abilities
001e0468: 34020001 ori r2,r0,0x0001
001e046c: 16220004 bne r17,r2,0x001e0480
001e0470: 34020002 ori r2,r0,0x0002
001e0474: 340301a6 ori r3,r0,0x01a6               start of reactions
001e0478: 08078129 j 0x001e04a4
001e047c: 340201c5 ori r2,r0,0x01c5               end of reactions
001e0480: 16220004 bne r17,r2,0x001e0494
001e0484: 34020003 ori r2,r0,0x0003
001e0488: 340301c6 ori r3,r0,0x01c6               start of support
001e048c: 08078129 j 0x001e04a4
001e0490: 340201e5 ori r2,r0,0x01e5               end of support
001e0494: 16220002 bne r17,r2,0x001e04a0
001e0498: 34030001 ori r3,r0,0x0001               start of all abilities
001e049c: 340301e6 ori r3,r0,0x01e6               start of movement
001e04a0: 340201fd ori r2,r0,0x01fd               end of movement
001e04a4: 00008021 addu r16,r0,r0
001e04a8: 00603021 addu r6,r3,r0                  start of IDs to check
001e04ac: 00402821 addu r5,r2,r0                  end of IDs to check
001e04b0: 02602021 addu r4,r19,r0                 temp ability list
001e04b4: 84830000 lh r3,0x0000(r4)               load ability
001e04b8: 00000000 nop
001e04bc: 0066102a slt r2,r3,r6                   check if within legal limit
001e04c0: 14400003 bne r2,r0,0x001e04d0           do if not
001e04c4: 00a3102a slt r2,r5,r3                   check if within legal limit
001e04c8: 10400002 beq r2,r0,0x001e04d4           skip if so
001e04cc: 00000000 nop
001e04d0: a4800000 sh r0,0x0000(r4)               if not legal, remove ability from list
001e04d4: 26100001 addiu r16,r16,0x0001
001e04d8: 2a020018 slti r2,r16,0x0018
001e04dc: 1440fff5 bne r2,r0,0x001e04b4           loop for all abilities
001e04e0: 24840002 addiu r4,r4,0x0002             pointer ++
001e04e4: 00009021 addu r18,r0,r0
001e04e8: 00008021 addu r16,r0,r0
001e04ec: 00141400 sll r2,r20,0x10
001e04f0: 3c038020 lui r3,0x8020
001e04f4: 2463a7f8 addiu r3,r3,0xa7f8             
001e04f8: 00021383 sra r2,r2,0x0e
001e04fc: 00431021 addu r2,r2,r3
001e0500: 0040a021 addu r20,r2,r0
001e0504: 02e08821 addu r17,r23,r0
001e0508: 8e830000 lw r3,0x0000(r20)              current unit jobstts
001e050c: 00151400 sll r2,r21,0x10                current job index
001e0510: 00021403 sra r2,r2,0x10
001e0514: 00022040 sll r4,r2,0x01
001e0518: 00822021 addu r4,r4,r2
001e051c: 2484000b addiu r4,r4,0x000b
001e0520: 0c0793a6 jal 0x001e4e98                 JOBSTTS.OUT Store Unit's unlocked jobs/abilities
001e0524: 00832021 addu r4,r4,r3                  current unit's current job's abilities
001e0528: 8e820000 lw r2,0x0000(r20)              current unit jobstts
001e052c: 00000000 nop
001e0530: 84440000 lh r4,0x0000(r2)               unit current job
001e0534: 0c077fe8 jal 0x001dffa0                 JOBSTTS.OUT Special Monster check
001e0538: 00000000 nop
001e053c: 14400004 bne r2,r0,0x001e0550
001e0540: 34040001 ori r4,r0,0x0001
001e0544: 0c0793b4 jal 0x001e4ed0                 JOBSTTS.OUT 001e4ed0 - 001e4f78 r4 = 1
001e0548: 34040001 ori r4,r0,0x0001
001e054c: 00402021 addu r4,r2,r0
001e0550: 86620000 lh r2,0x0000(r19)              load ability from ability list
001e0554: 00000000 nop
001e0558: 10400017 beq r2,r0,0x001e05b8           branch if doesn't exist
001e055c: 00401821 addu r3,r2,r0
001e0560: 1480000e bne r4,r0,0x001e059c           skip if not yet?
001e0564: 000210c0 sll r2,r2,0x03
001e0568: 3c018006 lui r1,0x8006
001e056c: 00220821 addu r1,r1,r2
001e0570: 9022ebf3 lbu r2,-0x140d(r1)             ability misc flags & type
001e0574: 00000000 nop
001e0578: 000211c2 srl r2,r2,0x07
001e057c: 14400003 bne r2,r0,0x001e058c           branch if learn with JP
001e0580: 00000000 nop
001e0584: 08078164 j 0x001e0590
001e0588: 34634000 ori r3,r3,0x4000               if not learn with JP, store 4000
001e058c: 34636000 ori r3,r3,0x6000               if learn with JP, store 6000
001e0590: a6230000 sh r3,0x0000(r17)              store 4000/6000
001e0594: 26310002 addiu r17,r17,0x0002
001e0598: 26520001 addiu r18,r18,0x0001
001e059c: 16c00006 bne r22,r0,0x001e05b8          skip storing ability ID if?
001e05a0: 00000000 nop
001e05a4: 10800004 beq r4,r0,0x001e05b8           skip storing ability ID if?
001e05a8: 00000000 nop
001e05ac: a6230000 sh r3,0x0000(r17)              store ability ID
001e05b0: 26310002 addiu r17,r17,0x0002           ptr++
001e05b4: 26520001 addiu r18,r18,0x0001          
001e05b8: 26100001 addiu r16,r16,0x0001          
001e05bc: 2a020018 slti r2,r16,0x0018
001e05c0: 1440ffd9 bne r2,r0,0x001e0528           loop for all abilities
001e05c4: 26730002 addiu r19,r19,0x0002
001e05c8: 00121040 sll r2,r18,0x01
001e05cc: 00571021 addu r2,r2,r23
001e05d0: 2403ffff addiu r3,r0,0xffff
001e05d4: a4430000 sh r3,0x0000(r2)               store end of ability list
001e05d8: 02401021 addu r2,r18,r0                 return number of abilities in ability list
001e05dc: 8fbf0038 lw r31,0x0038(r29)
001e05e0: 8fb70034 lw r23,0x0034(r29)
001e05e4: 8fb60030 lw r22,0x0030(r29)
001e05e8: 8fb5002c lw r21,0x002c(r29)
001e05ec: 8fb40028 lw r20,0x0028(r29)
001e05f0: 8fb30024 lw r19,0x0024(r29)
001e05f4: 8fb20020 lw r18,0x0020(r29)
001e05f8: 8fb1001c lw r17,0x001c(r29)
001e05fc: 8fb00018 lw r16,0x0018(r29)
001e0600: 27bd0040 addiu r29,r29,0x0040
001e0604: 03e00008 jr r31
001e0608: 00000000 nop