Get Generic Job Index

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: GET GENERIC JOB INDEX
#       Gets the generic job index of the specified job.  (0 = Base, 1 = Chemist, 2 = Knight, etc.)
#       Parameters:
#           r4 = (jobID) Job ID
#       Returns:
#           r2 = Generic job index

801223b8: 2482ffb6 addiu r2,r4,-0x004a              #   jobOffset = JobID - 0x4A        // 0x4A = Squire
801223bc: 3042ffff andi r2,r2,0xffff                
801223c0: 2c420014 sltiu r2,r2,0x0014
801223c4: 10400003 beq r2,r0,0x801223d4             #   if (jobOffset < 20) {
801223c8: 00000000 nop
801223cc: 080488f6 j 0x801223d8
801223d0: 2482ffb6 addiu r2,r4,-0x004a              #       jobIndex = JobID - 0x4A   
                                                    #   } else {
801223d4: 00001021 addu r2,r0,r0                    #       jobIndex = 0
                                                    #   }
801223d8: 00021400 sll r2,r2,0x10
801223dc: 03e00008 jr r31                           #   return jobIndex;
801223e0: 00021403 sra r2,r2,0x10