Handle Formation Screen Triangle Menu

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: HANDLE FORMATION SCREEN TRIANGLE MENU
#       No parameters.

800ecf20: 27bdfec8 addiu r29,r29,-0x0138
800ecf24: afbf0130 sw r31,0x0130(r29)
800ecf28: afb5012c sw r21,0x012c(r29)
800ecf2c: afb40128 sw r20,0x0128(r29)
800ecf30: afb30124 sw r19,0x0124(r29)
800ecf34: afb20120 sw r18,0x0120(r29)
800ecf38: afb1011c sw r17,0x011c(r29)
800ecf3c: 0c040024 jal 0x80100090                       #   threadParam1 = Get First Thread Parameter (WORLD.BIN) ();
800ecf40: afb00118 sw r16,0x0118(r29)
800ecf44: 00408821 addu r17,r2,r0                       #   threadParam1
800ecf48: 27b00018 addiu r16,r29,0x0018                 #   sp + 0x18
800ecf4c: 86230038 lh r3,0x0038(r17)                    #   threadParam1.0x38
800ecf50: 2402ffff addiu r2,r0,-0x0001                  #   -1
800ecf54: 14620002 bne r3,r2,0x800ecf60
800ecf58: afa30110 sw r3,0x0110(r29)                    #   sp.0x110 = threadParam1.0x38
                                                        #   if (threadParam1.0x38 == -1) {
800ecf5c: afa00110 sw r0,0x0110(r29)                    #       sp.0x110 = 0
                                                        #   }
800ecf60: 27a40010 addiu r4,r29,0x0010
800ecf64: 02202821 addu r5,r17,r0
800ecf68: 0c03b042 jal 0x800ec108                       #   0xec108 (sp + 0x10, threadParam1, sp + 0x18);
800ecf6c: 02003021 addu r6,r16,r0
800ecf70: 27a40094 addiu r4,r29,0x0094
800ecf74: 02002821 addu r5,r16,r0
800ecf78: 0c03fd14 jal 0x800ff450                       #   0xff450 (sp + 0x94, sp + 0x18, 0x7c);
800ecf7c: 3406007c ori r6,r0,0x007c
800ecf80: 27a60010 addiu r6,r29,0x0010
800ecf84: 34070001 ori r7,r0,0x0001
800ecf88: 00009021 addu r18,r0,r0                       #   count = 0
800ecf8c: 0200a821 addu r21,r16,r0                      #   sp + 0x18
800ecf90: 86240004 lh r4,0x0004(r17)
800ecf94: 86250006 lh r5,0x0006(r17)
800ecf98: 0c03fe6b jal 0x800ff9ac                       #   result_0xff9ac = 0xff9ac (threadParam1.0x04, threadParam1.0x06, sp + 0x10, 1);
800ecf9c: 34140002 ori r20,r0,0x0002                    #   2
800ecfa0: 34040008 ori r4,r0,0x0008
800ecfa4: 34050009 ori r5,r0,0x0009
800ecfa8: 3c108015 lui r16,0x8015
800ecfac: 2610328c addiu r16,r16,0x328c                 #   0x8015328c
800ecfb0: 86230004 lh r3,0x0004(r17)                    #   threadParam1.0x04
800ecfb4: 00409821 addu r19,r2,r0                       #   result_0xff9ac
800ecfb8: 0c03f6e2 jal 0x800fdb88                       #   0xfdb88 (8, 9);
800ecfbc: ae030000 sw r3,0x0000(r16)                    #   *0x8015328c = threadParam1.0x04
800ecfc0: 02602821 addu r5,r19,r0
800ecfc4: 8624001c lh r4,0x001c(r17)
800ecfc8: 3c018015 lui r1,0x8015
800ecfcc: ac203270 sw r0,0x3270(r1)                     #   *0x80153270 = 0
800ecfd0: 0c03f9dd jal 0x800fe774                       #   Display Menu Text Entry (WORLD.BIN) (threadParam1.0x1c, result_0xff9ac, 0x80153284);
800ecfd4: 2606fff8 addiu r6,r16,-0x0008
800ecfd8: 27a40010 addiu r4,r29,0x0010
800ecfdc: 0c00923f jal 0x800248fc                       #   ? 0x248fc (sp + 0x10, r19);
800ecfe0: 02602821 addu r5,r19,r0
                                                        #   while (true) {
800ecfe4: 0c03ffd4 jal 0x800fff50                       #       Switch To Next Thread (WORLD.BIN) ();
800ecfe8: 00000000 nop
800ecfec: 16400004 bne r18,r0,0x800ed000
800ecff0: 32420001 andi r2,r18,0x0001
                                                        #       if (count == 0) {
800ecff4: 0c038ca6 jal 0x800e3298                       #           0xe3298 (r19);                              // Menu sometimes doesn't show up if removed
800ecff8: 02602021 addu r4,r19,r0
800ecffc: 32420001 andi r2,r18,0x0001
                                                        #       }
800ed000: 00021940 sll r3,r2,0x05                       #       (count % 2) * 32
800ed004: 00621823 subu r3,r3,r2                        #       (count % 2) * 31
800ed008: 00031880 sll r3,r3,0x02                       #       (count % 2) * 124
800ed00c: 02a38021 addu r16,r21,r3                      #       sp + 0x18 + ((count % 2) * 124)
800ed010: 97a20110 lhu r2,0x0110(r29)                   #       sp.0x110
800ed014: 02002021 addu r4,r16,r0
800ed018: 0c03b121 jal 0x800ec484                       #       0xec484 (sp + 0x18 + ((count % 2) * 124));      // Menu colors wrong if removed
800ed01c: a6220038 sh r2,0x0038(r17)                    #       threadParam1.0x38 = sp.0x110
800ed020: 02202021 addu r4,r17,r0
800ed024: 02002821 addu r5,r16,r0
800ed028: 8fa70110 lw r7,0x0110(r29)
800ed02c: 0c03b16e jal 0x800ec5b8                       #       0xec5b8 (threadParam1, sp + 0x18 + ((count % 2) * 124), count, sp + 0x110);    // Cursor doesn't appear if removed
800ed030: 02403021 addu r6,r18,r0
800ed034: 8fa30090 lw r3,0x0090(r29)                    #       sp.0x90
800ed038: 00000000 nop
800ed03c: 14600005 bne r3,r0,0x800ed054                 #       if (((sp.0x90 == 0)
800ed040: 00000000 nop
800ed044: 8fa2010c lw r2,0x010c(r29)
800ed048: 00000000 nop
800ed04c: 10540007 beq r2,r20,0x800ed06c                #               && (sp.0x10c == 2))
800ed050: 00000000 nop
800ed054: 14740007 bne r3,r20,0x800ed074                #           || ((sp.0x90 == 2)
800ed058: 00000000 nop
800ed05c: 8fa2010c lw r2,0x010c(r29)
800ed060: 00000000 nop
800ed064: 14400003 bne r2,r0,0x800ed074                 #               && (sp.0x10c == 0)))   
800ed068: 00000000 nop                                  #       {
800ed06c: afa00090 sw r0,0x0090(r29)                    #           sp.0x90 = 0
800ed070: afa0010c sw r0,0x010c(r29)                    #           sp.0x10c = 0
                                                        #       }
800ed074: 3c048019 lui r4,0x8019
800ed078: 24845c34 addiu r4,r4,0x5c34
800ed07c: 0c03afe3 jal 0x800ebf8c                       #       result_0xebf8c = 0xebf8c (0x80195c34);      // Selecting menu options doesn't work if removed (but the sound effect plays).  Can't cancel out of menu either.
800ed080: 00000000 nop
800ed084: 1440000d bne r2,r0,0x800ed0bc                 #       if (result_0xebf8c != 0) break;
800ed088: 02202021 addu r4,r17,r0
800ed08c: 8fa50110 lw r5,0x0110(r29)
800ed090: 0c03aec2 jal 0x800ebb08                       #       Handle Menu Action (WORLD.BIN) (threadParam1, sp.0x110);        // Circle button doesn't do anything if removed (not even a sound effect).
800ed094: 26520001 addiu r18,r18,0x0001                 #       count = count + 1
800ed098: 02202021 addu r4,r17,r0
800ed09c: 0c03af73 jal 0x800ebdcc                       #       Menu Scroll Related (0xebdcc) (threadParam1, sp.0x110);
800ed0a0: 27a50110 addiu r5,r29,0x0110
800ed0a4: 0c03af9f jal 0x800ebe7c                       #       0xebe7c (threadParam1);                     // X button doesn't do anything if removed (not even a sound effect).
800ed0a8: 02202021 addu r4,r17,r0
800ed0ac: 0c03b2d6 jal 0x800ecb58                       #       0xecb58 (sp + 0x18 + ((count % 2) * 124);   // Menu doesn't display if removed (but still works).
800ed0b0: 02002021 addu r4,r16,r0
800ed0b4: 0803b3f9 j 0x800ecfe4                         #   }
800ed0b8: 00000000 nop
800ed0bc: 0c03ffd4 jal 0x800fff50                       #   Switch To Next Thread (WORLD.BIN) ();
800ed0c0: 00000000 nop
800ed0c4: 0c040031 jal 0x801000c4                       #   threadParam2 = Get Second Thread Parameter (WORLD.BIN) ();
800ed0c8: 00000000 nop
800ed0cc: 14400003 bne r2,r0,0x800ed0dc                 #   if (threadParam2 == 0) {
800ed0d0: 00000000 nop
800ed0d4: 0c03ff8a jal 0x800ffe28                       #       Stop Current Thread (WORLD.BIN) ();
800ed0d8: 00000000 nop                                  #   }
800ed0dc: 8fbf0130 lw r31,0x0130(r29)
800ed0e0: 8fb5012c lw r21,0x012c(r29)
800ed0e4: 8fb40128 lw r20,0x0128(r29)
800ed0e8: 8fb30124 lw r19,0x0124(r29)
800ed0ec: 8fb20120 lw r18,0x0120(r29)
800ed0f0: 8fb1011c lw r17,0x011c(r29)
800ed0f4: 8fb00118 lw r16,0x0118(r29)
800ed0f8: 27bd0138 addiu r29,r29,0x0138
800ed0fc: 03e00008 jr r31
800ed100: 00000000 nop