Find Job By Skillset

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: FIND JOB BY SKILLSET
#       Finds the job ID with the specified skillset ID.
#       Parameters:
#           r4 = (skillsetID) Skillset ID
#       Returns:
#           r2 = First Job ID with the specified skillset, or -1 if no job found

801223e4: 27bdffe0 addiu r29,r29,-0x0020
801223e8: afb10014 sw r17,0x0014(r29)
801223ec: 00808821 addu r17,r4,r0                   #   skillsetID
801223f0: afb00010 sw r16,0x0010(r29)
801223f4: 00008021 addu r16,r0,r0                   #   jobID = 0
801223f8: afbf0018 sw r31,0x0018(r29)
                                                    #   do {
801223fc: 0c016a29 jal 0x8005a8a4                   #       job = Get Job Data Pointer (jobID);
80122400: 02002021 addu r4,r16,r0
80122404: 90420000 lbu r2,0x0000(r2)                #       job.skillsetID
80122408: 00000000 nop
8012240c: 10510005 beq r2,r17,0x80122424            #       if (job.skillsetID == skillsetID)
80122410: 02001021 addu r2,r16,r0                   #           return jobID;
80122414: 26100001 addiu r16,r16,0x0001             #       jobID = jobID + 1
80122418: 2a0200a0 slti r2,r16,0x00a0
8012241c: 1440fff7 bne r2,r0,0x801223fc             #   } while (jobID < 0xa0);
80122420: 2402ffff addiu r2,r0,-0x0001              #   return -1;
80122424: 8fbf0018 lw r31,0x0018(r29)
80122428: 8fb10014 lw r17,0x0014(r29)
8012242c: 8fb00010 lw r16,0x0010(r29)
80122430: 27bd0020 addiu r29,r29,0x0020
80122434: 03e00008 jr r31
80122438: 00000000 nop