Setup Act Menu

From Final Fantasy Hacktics Wiki
Revision as of 14:54, 16 October 2020 by Glain (talk | contribs) (Created page with " # ROUTINE: SETUP ACT MENU # Parameters: # r4 = (unitIndex) Acting unit index (from 0x8014d08a) # r5 = (skillsetList) Act men...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: SETUP ACT MENU
#       Parameters:
#           r4 = (unitIndex)            Acting unit index (from 0x8014d08a)
#           r5 = (skillsetList)         Act menu skillset list (0x80174060)
#           r6 = (isDisabledList)       Array of booleans to determine whether each skillset is disabled
#           r7 = (actionMenuList)       Act menu action menu list (0x8017404c)

801813c0: 27bdffd0 addiu r29,r29,-0x0030
801813c4: afb40020 sw r20,0x0020(r29)
801813c8: 0080a021 addu r20,r4,r0                       #   actingUnit
801813cc: afb00010 sw r16,0x0010(r29)
801813d0: 00a08021 addu r16,r5,r0                       #   skillsetList
801813d4: afb10014 sw r17,0x0014(r29)
801813d8: 00c08821 addu r17,r6,r0                       #   isDisabledList
801813dc: afb20018 sw r18,0x0018(r29)
801813e0: 00e09021 addu r18,r7,r0                       #   actionMenuList
801813e4: afbf0028 sw r31,0x0028(r29)
801813e8: afb50024 sw r21,0x0024(r29)
801813ec: 0c060435 jal 0x801810d4                       #   unit = Get Existent Battle Unit Pointer (actingUnit);
801813f0: afb3001c sw r19,0x001c(r29)
801813f4: 00401821 addu r3,r2,r0                        #   unit
801813f8: 10600058 beq r3,r0,0x8018155c                 #   if (unit == null)
801813fc: 2402ffff addiu r2,r0,-0x0001                  #       return -1;
80181400: 90670012 lbu r7,0x0012(r3)                    #   unit.PrimarySkillset
80181404: 90650013 lbu r5,0x0013(r3)                    #   unit.SecondarySkillset
80181408: 30e400ff andi r4,r7,0x00ff                    #   unit.PrimarySkillset
8018140c: 2c8200b0 sltiu r2,r4,0x00b0                   
80181410: 10400004 beq r2,r0,0x80181424
80181414: 02004021 addu r8,r16,r0                       #   skillsetList
                                                        #   if ((unit.PrimarySkillset >= 0xb0)
80181418: 2ca200b0 sltiu r2,r5,0x00b0                   #       or (unit.SecondarySkillset >= 0xb0))        // If either skillset is a Monster skillset
8018141c: 1440000b bne r2,r0,0x8018144c                 #   {
80181420: 00000000 nop
80181424: a2070000 sb r7,0x0000(r16)                    #       skillsetList[0] = unit.PrimarySkillset;
80181428: a2200000 sb r0,0x0000(r17)                    #       isDisabledList[0] = false;
8018142c: 3c018006 lui r1,0x8006
80181430: 00240821 addu r1,r1,r4
80181434: 90235cb4 lbu r3,0x5cb4(r1)                    #       actionMenus[unit.PrimarySkillset]
80181438: 34020001 ori r2,r0,0x0001
8018143c: a2430000 sb r3,0x0000(r18)                    #       actionMenuList[0] = actionMenus[unit.PrimarySkillset]
80181440: 340300ff ori r3,r0,0x00ff
80181444: 08060557 j 0x8018155c
80181448: a2030001 sb r3,0x0001(r16)                    #       skillsetList[1] = 0xff;     // Sentinel value
                                                        #       return 1;
                                                        #   }
8018144c: 9062005a lbu r2,0x005a(r3)                    #   unit.CurrentStatus3
80181450: 90660092 lbu r6,0x0092(r3)                    #   supportCheckFlags = unit.Support4
80181454: 30420002 andi r2,r2,0x0002                    #   unit.CurrentStatus3 & STATUS_FROG
80181458: 10400002 beq r2,r0,0x80181464                 #   if (unit.CurrentStatus3 & STATUS_FROG) {
8018145c: 00000000 nop
80181460: 00003021 addu r6,r0,r0                        #       supportCheckFlags = 0
                                                        #   }
80181464: 9062005c lbu r2,0x005c(r3)                    #   unit.CurrentStatus5
80181468: 00000000 nop
8018146c: 30420004 andi r2,r2,0x0004                    #   unit.CurrentStatus5 & STATUS_DONT_ACT
80181470: 14400006 bne r2,r0,0x8018148c                 #   if ((unit.CurrentStatus5 & STATUS_DONT_ACT)
80181474: 340200ff ori r2,r0,0x00ff
80181478: 90620182 lbu r2,0x0182(r3)
8018147c: 00000000 nop
80181480: 30420040 andi r2,r2,0x0040
80181484: 10400003 beq r2,r0,0x80181494                 #       or (unit.MountInfo & MOUNTINFO_BEING_RIDDEN))
80181488: 340200ff ori r2,r0,0x00ff                     #   {
8018148c: 08060556 j 0x80181558
80181490: a2020000 sb r2,0x0000(r16)                    #       skillsetList[0] = 0xff;     // Sentinel value
                                                        #       return 0;
                                                        #   }
80181494: 34020001 ori r2,r0,0x0001
80181498: a2020000 sb r2,0x0000(r16)                    #   skillsetList[0] = 0x01;         // Attack
8018149c: 10800006 beq r4,r0,0x801814b8
801814a0: 26100001 addiu r16,r16,0x0001                 #   skillsetIDPtr = &skillsetList[1]
                                                        #   if ((unit.PrimarySkillset != 0)
801814a4: 34020018 ori r2,r0,0x0018
801814a8: 10820003 beq r4,r2,0x801814b8                 #       and (unit.PrimarySkillset != 0x18))
801814ac: 00000000 nop                                  #   {
801814b0: a2070000 sb r7,0x0000(r16)                    #       *skillsetIDPtr = unit.PrimarySkillset
801814b4: 26100001 addiu r16,r16,0x0001                 #       skillsetIDPtr++
                                                        #   }
801814b8: 10a00003 beq r5,r0,0x801814c8
801814bc: 30c20040 andi r2,r6,0x0040                    #   supportCheckFlags & FLAG_DEFEND
                                                        #   if (unit.SecondarySkillset != 0) {
801814c0: a2050000 sb r5,0x0000(r16)                    #       *skillsetIDPtr = unit.SecondarySkillset
801814c4: 26100001 addiu r16,r16,0x0001                 #       skillsetIDPtr++
                                                        #   }
801814c8: 10400003 beq r2,r0,0x801814d8
801814cc: 34020002 ori r2,r0,0x0002
                                                        #   if (supportCheckFlags & FLAG_DEFEND) {
801814d0: a2020000 sb r2,0x0000(r16)                    #       *skillsetIDPtr = 2          // Defend
801814d4: 26100001 addiu r16,r16,0x0001                 #       skillsetIDPtr++
                                                        #   }
801814d8: 30c20020 andi r2,r6,0x0020
801814dc: 10400004 beq r2,r0,0x801814f0
801814e0: 341500ff ori r21,r0,0x00ff
                                                        #   if (supportCheckFlags & FLAG_EQUIP_CHANGE) {
801814e4: 34020003 ori r2,r0,0x0003
801814e8: a2020000 sb r2,0x0000(r16)                    #       *skillsetIDPtr = 3          // Equip Change
801814ec: 26100001 addiu r16,r16,0x0001
                                                        #   }
801814f0: 340200ff ori r2,r0,0x00ff
801814f4: a2020000 sb r2,0x0000(r16)                    #   *skillsetIDPtr = 0xff           // Sentinel value
801814f8: 02208021 addu r16,r17,r0                      #   isDisabledList
801814fc: 01008821 addu r17,r8,r0                       #   skillsetList
80181500: 26130006 addiu r19,r16,0x0006                 
                                                        #   for (int index = 0; index < 6; index++) {
80181504: 92250000 lbu r5,0x0000(r17)                   #       skillsetList[index]
80181508: 00000000 nop
8018150c: 10b50012 beq r5,r21,0x80181558                #       if (skillsetList[index] == 0xff) break;
80181510: 02802021 addu r4,r20,r0                       #       actingUnitIndex
80181514: 3c018006 lui r1,0x8006
80181518: 00250821 addu r1,r1,r5
8018151c: 90265cb4 lbu r6,0x5cb4(r1)                    #       actionMenus[skillsetList[index]]
80181520: 00000000 nop
80181524: 30c6000f andi r6,r6,0x000f                    #       actionMenuID = actionMenus[skillsetList[index]] & 0x0f    // Forces range 0-15; 16 possible action menus
80181528: 0c060561 jal 0x80181584                       #       numAbilities = Skillset Loading? (actingUnitIndex);
8018152c: a2460000 sb r6,0x0000(r18)                    #       actionMenuList[index] = actionMenuID
80181530: 14400003 bne r2,r0,0x80181540                 #       if (numAbilities == 0) {
80181534: 34020001 ori r2,r0,0x0001
80181538: 08060551 j 0x80181544
8018153c: a2020000 sb r2,0x0000(r16)                    #           isDisabledList[index] = true
                                                        #       } else {
80181540: a2000000 sb r0,0x0000(r16)                    #           isDisabledList[index] = false
                                                        #       }
80181544: 26100001 addiu r16,r16,0x0001
80181548: 26520001 addiu r18,r18,0x0001
8018154c: 0213102a slt r2,r16,r19
80181550: 1440ffec bne r2,r0,0x80181504
80181554: 26310001 addiu r17,r17,0x0001
                                                        #   }
80181558: 00001021 addu r2,r0,r0                        #   return 0;
8018155c: 8fbf0028 lw r31,0x0028(r29)
80181560: 8fb50024 lw r21,0x0024(r29)
80181564: 8fb40020 lw r20,0x0020(r29)
80181568: 8fb3001c lw r19,0x001c(r29)
8018156c: 8fb20018 lw r18,0x0018(r29)
80181570: 8fb10014 lw r17,0x0014(r29)
80181574: 8fb00010 lw r16,0x0010(r29)
80181578: 27bd0030 addiu r29,r29,0x0030
8018157c: 03e00008 jr r31
80181580: 00000000 nop