Get Base Job (Formation Screen)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: GET BASE JOB (FORMATION SCREEN)
#   Gets the base job of a unit based on its formation screen index.  For generics, returns the actual job ID of the base job (Squire, or Monster job)
#       Parameters:
#           r4 = (formationScreenUnitIndex) Index (order) of the unit in the formation screen.  Not the same as the unit index, as it will differ for guests.

8012243c: 00042400 sll r4,r4,0x10
80122440: 00042383 sra r4,r4,0x0e                   #   formationScreenUnitIndex * 4
80122444: 3c01801d lui r1,0x801d
80122448: 00240821 addu r1,r1,r4
8012244c: 8c24d5ec lw r4,-0x2a14(r1)                #   formationUnit = formationUnits [formationScreenUnitIndex]       //  Base pointer: 0x801cd5ec, sizeof pointer = 4
80122450: 00000000 nop
80122454: 90830072 lbu r3,0x0072(r4)                #   baseJob = formationUnit.BaseClass                               //  (Offset 0x72)
80122458: 34020082 ori r2,r0,0x0082                 #   0x82                                                            //  Monster
8012245c: 14620004 bne r3,r2,0x80122470             #   if (baseJob == 0x82) {
80122460: 00000000 nop
80122464: 84830024 lh r3,0x0024(r4)                 #       baseJob = formationUnit.Job                                 //  (Offset 0x24)
80122468: 08048920 j 0x80122480
8012246c: 00000000 nop                              
80122470: 2c620080 sltiu r2,r3,0x0080               #   } else if (baseJob >= 0x80) {                                   //  Generic Male or Generic Female
80122474: 14400002 bne r2,r0,0x80122480
80122478: 00000000 nop
8012247c: 3403004a ori r3,r0,0x004a                 #       baseJob = 0x4a                                              //  Squire
                                                    #   }
80122480: 03e00008 jr r31                           #   return baseJob;
80122484: 00601021 addu r2,r3,r0