Difference between revisions of "Post-battle Unit Changes"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " # ROUTINE: Post-battle Unit Changes # Calls Post-battle (0x1c4740) and then handles the unit join prompts. 801c6988: 27bdffa8 addiu r29,r29,-0x0058 801c698c:...")
 
 
Line 446: Line 446:
 
  801c700c: 90450006 lbu r5,0x0006(r2)                    #          unit.Flags
 
  801c700c: 90450006 lbu r5,0x0006(r2)                    #          unit.Flags
 
  801c7010: 00402021 addu r4,r2,r0
 
  801c7010: 00402021 addu r4,r2,r0
  801c7014: 0c0166ec jal 0x80059bb0                      #          [[Save Unit To Party]] (unit, unit.Flags & UNIT_FLAGS_JOIN_AS_GUEST);
+
  801c7014: 0c0166ec jal 0x80059bb0                      #          [[Save Unit to Party]] (unit, unit.Flags & UNIT_FLAGS_JOIN_AS_GUEST);
 
  801c7018: 30a50001 andi r5,r5,0x0001
 
  801c7018: 30a50001 andi r5,r5,0x0001
 
  801c701c: 0c053216 jal 0x8014c858                      #          [[Wait]] (20);
 
  801c701c: 0c053216 jal 0x8014c858                      #          [[Wait]] (20);

Latest revision as of 07:07, 18 September 2022

#   ROUTINE: Post-battle Unit Changes
#       Calls Post-battle (0x1c4740) and then handles the unit join prompts.

801c6988: 27bdffa8 addiu r29,r29,-0x0058
801c698c: afbf0054 sw r31,0x0054(r29)
801c6990: afbe0050 sw r30,0x0050(r29)
801c6994: afb7004c sw r23,0x004c(r29)
801c6998: afb60048 sw r22,0x0048(r29)
801c699c: afb50044 sw r21,0x0044(r29)
801c69a0: afb40040 sw r20,0x0040(r29)
801c69a4: afb3003c sw r19,0x003c(r29)
801c69a8: afb20038 sw r18,0x0038(r29)
801c69ac: afb10034 sw r17,0x0034(r29)
801c69b0: 0c0711d0 jal 0x801c4740                       #   numJoinPrompts = Post-battle (0x1c4740) ();
801c69b4: afb00030 sw r16,0x0030(r29)
801c69b8: 14400004 bne r2,r0,0x801c69cc                 #   if (numJoinPromps == 0) {
801c69bc: 34020001 ori r2,r0,0x0001
801c69c0: 0c053256 jal 0x8014c958                       #       Stop Current Thread ();
801c69c4: 00000000 nop
801c69c8: 34020001 ori r2,r0,0x0001
                                                        #   }
801c69cc: 3c018016 lui r1,0x8016
801c69d0: ac225fc4 sw r2,0x5fc4(r1)                     #   *0x80165fc4 = 1
801c69d4: 0c053250 jal 0x8014c940                       #   Mark Thread As Stopped (1);
801c69d8: 34040001 ori r4,r0,0x0001
801c69dc: 3c04801e lui r4,0x801e
801c69e0: 24848304 addiu r4,r4,-0x7cfc
801c69e4: 3c058016 lui r5,0x8016
801c69e8: 8ca55f98 lw r5,0x5f98(r5)
801c69ec: 34060400 ori r6,r0,0x0400
801c69f0: 0c052fd5 jal 0x8014bf54                       #   Copy Bytes (0x14bf54) (0x801d8304, threads[1], sizeof(thread));       // memcpy() to thread 1
801c69f4: 24a50400 addiu r5,r5,0x0400
801c69f8: 3c04801d lui r4,0x801d
801c69fc: 2484bef0 addiu r4,r4,-0x4110                  #   0x801cbef0
801c6a00: 3c088017 lui r8,0x8017
801c6a04: 8d083cb8 lw r8,0x3cb8(r8)                     #   oldMenuData = *0x80173cb8
801c6a08: 3c02801d lui r2,0x801d
801c6a0c: 8c42be74 lw r2,-0x418c(r2)                    #   *0x801cbe74
801c6a10: 3c03801d lui r3,0x801d
801c6a14: 8c63be78 lw r3,-0x4188(r3)                    #   *0x801cbe78
801c6a18: 00441021 addu r2,r2,r4                        #   *0x801cbe74 + 0x801cbef0
801c6a1c: 3c018017 lui r1,0x8017
801c6a20: ac223f90 sw r2,0x3f90(r1)                     #   *0x80173f90 = *0x801cbe74 + 0x801cbef0
801c6a24: 3c02801d lui r2,0x801d
801c6a28: 8c42be7c lw r2,-0x4184(r2)                    #   *0x801cbe7c
801c6a2c: 00641821 addu r3,r3,r4                        #   *0x801cbe78 + 0x801cbef0
801c6a30: 3c018017 lui r1,0x8017
801c6a34: ac233f94 sw r3,0x3f94(r1)                     #   *0x80173f94 = *0x801cbe78 + 0x801cbef0
801c6a38: 3c03801d lui r3,0x801d
801c6a3c: 8c63be80 lw r3,-0x4180(r3)                    #   *0x801cbe80
801c6a40: 3c12801d lui r18,0x801d
801c6a44: 265200e0 addiu r18,r18,0x00e0                 #   0x801d00e0
801c6a48: 3c018017 lui r1,0x8017
801c6a4c: ac323cb8 sw r18,0x3cb8(r1)                    #   *0x80173cb8 = 0x801d00e0
801c6a50: afa80018 sw r8,0x0018(r29)                    #   oldMenuData
801c6a54: 00441021 addu r2,r2,r4                        #   *0x801cbe7c + 0x801cbef0
801c6a58: 00641821 addu r3,r3,r4                        #   *0x801cbe80 + 0x801cbef0
801c6a5c: 3c018017 lui r1,0x8017
801c6a60: ac223f98 sw r2,0x3f98(r1)                     #   *0x80173f98 = *0x801cbe7c + 0x801cbef0
801c6a64: 3c018017 lui r1,0x8017
801c6a68: ac233fa4 sw r3,0x3fa4(r1)                     #   *0x80173fa4 = *0x801cbe80 + 0x801cbef0
801c6a6c: 0c072c87 jal 0x801cb21c                       #   0x1cb21c ();
801c6a70: 0000b821 addu r23,r0,r0                       #   count = 0
801c6a74: 3c10801d lui r16,0x801d
801c6a78: 26107388 addiu r16,r16,0x7388                 #   unitIndexPtr = 0x801c7388
801c6a7c: 8e040000 lw r4,0x0000(r16)                       
801c6a80: 0c0602bf jal 0x80180afc                       #   Get Unit's Data Pointer (*unitIndexPtr);      // Throws result away??
801c6a84: 00000000 nop
801c6a88: 96020000 lhu r2,0x0000(r16)                   #   unitIndex = *unitIndexPtr
801c6a8c: 3c11801d lui r17,0x801d
801c6a90: 2631b364 addiu r17,r17,-0x4c9c                #   0x801cbe64
801c6a94: 3c01801d lui r1,0x801d
801c6a98: a422b36e sh r2,-0x4c92(r1)                    #   *0x801cb36e = unitIndex
801c6a9c: 0c070a22 jal 0x801c2888                       #   0x1c2888 ();
801c6aa0: a6220000 sh r2,0x0000(r17)                    #   *0x801cbe64 = unitIndex
801c6aa4: 96020000 lhu r2,0x0000(r16)                   #   unitIndex
801c6aa8: 3c03801d lui r3,0x801d
801c6aac: 8c630b34 lw r3,0x0b34(r3)                     #   *0x801d0b34
801c6ab0: 3c01801d lui r1,0x801d
801c6ab4: a422b326 sh r2,-0x4cda(r1)                    #   *0x801cbe26 = unitIndex
801c6ab8: 1860016e blez r3,0x801c7074                   #   if (*0x801d0b34 > 0) { 
801c6abc: 00000000 nop
801c6ac0: 3c1e801d lui r30,0x801d
801c6ac4: 27de00a4 addiu r30,r30,0x00a4                 #       0x801d00a4
801c6ac8: 0220b021 addu r22,r17,r0                      #       0x801cbe64
801c6acc: 34140001 ori r20,r0,0x0001                    #       1
801c6ad0: 26530004 addiu r19,r18,0x0004                 #       0x801d00e4
801c6ad4: 0200a821 addu r21,r16,r0                      #       unitIndexPtr = 0x801c7388
                                                        #       do {
801c6ad8: 0c0710ec jal 0x801c43b0                       #           0x1c43b0 (0);       // Sets several values to input value
801c6adc: 00002021 addu r4,r0,r0
801c6ae0: 3c04801d lui r4,0x801d
801c6ae4: 2484b31c addiu r4,r4,-0x4ce4
801c6ae8: 3c05801d lui r5,0x801d
801c6aec: 24a5b364 addiu r5,r5,-0x4c9c
801c6af0: 3c06801d lui r6,0x801d
801c6af4: 24c6b384 addiu r6,r6,-0x4c7c
801c6af8: 2402ff00 addiu r2,r0,-0x0100
801c6afc: 3c01801d lui r1,0x801d
801c6b00: ac22007c sw r2,0x007c(r1)                     #           *0x801d007c = -0x100
801c6b04: 3c01801d lui r1,0x801d
801c6b08: ac220090 sw r2,0x0090(r1)                     #           *0x801d0090 = -0x100
801c6b0c: 0c04cfde jal 0x80133f78                       #           0x133f78 (0x801cb31c, 0x801cb364, 0x801cb384);
801c6b10: afc20000 sw r2,0x0000(r30)                    #           *0x801d00a4 = -0x100
801c6b14: 16e00020 bne r23,r0,0x801c6b98                #           if (count == 0) {
801c6b18: 00008021 addu r16,r0,r0
801c6b1c: 3c05801c lui r5,0x801c
801c6b20: 24a5f79c addiu r5,r5,-0x0864
801c6b24: 0c053228 jal 0x8014c8a0                       #               Initialize Thread (8, 0x801bf79c);
801c6b28: 34040008 ori r4,r0,0x0008
801c6b2c: 34040008 ori r4,r0,0x0008
801c6b30: 3c05801d lui r5,0x801d
801c6b34: 24a5007c addiu r5,r5,0x007c
801c6b38: 00003021 addu r6,r0,r0
801c6b3c: 0c05328e jal 0x8014ca38                       #               Store Thread Function Parameters (8, 0x801d007c, 0, 0);
801c6b40: 00003821 addu r7,r0,r0
801c6b44: 3c05801c lui r5,0x801c
801c6b48: 24a51884 addiu r5,r5,0x1884
801c6b4c: 0c053228 jal 0x8014c8a0                       #               Initialize Thread (12, 0x801c1884);
801c6b50: 3404000c ori r4,r0,0x000c
801c6b54: 3404000c ori r4,r0,0x000c
801c6b58: 3c05801d lui r5,0x801d
801c6b5c: 24a50090 addiu r5,r5,0x0090
801c6b60: 00003021 addu r6,r0,r0
801c6b64: 0c05328e jal 0x8014ca38                       #               Store Thread Function Parameters (12, 0x801d0090, 0, 0);
801c6b68: 00003821 addu r7,r0,r0
801c6b6c: 3c05801c lui r5,0x801c
801c6b70: 24a50a24 addiu r5,r5,0x0a24
801c6b74: 0c053228 jal 0x8014c8a0                       #               Initialize Thread (9, 0x801c0a24);
801c6b78: 34040009 ori r4,r0,0x0009
801c6b7c: 34040009 ori r4,r0,0x0009
801c6b80: 03c02821 addu r5,r30,r0
801c6b84: 00003021 addu r6,r0,r0
801c6b88: 0c05328e jal 0x8014ca38                       #               Store Thread Function Parameters (9, 0x801d00a4, 0, 0);
801c6b8c: 00003821 addu r7,r0,r0
801c6b90: 08071b0a j 0x801c6c28
801c6b94: 00008021 addu r16,r0,r0
                                                        #           } else {
                                                        #               loopValue = 0
                                                        #               do {
801c6b98: 3c01801d lui r1,0x801d
801c6b9c: ac30007c sw r16,0x007c(r1)                    #                   *0x801d007c = loopValue
801c6ba0: 3c01801d lui r1,0x801d
801c6ba4: ac300090 sw r16,0x0090(r1)                    #                   *0x801d0090 = loopValue
801c6ba8: 3c01801d lui r1,0x801d
801c6bac: ac3000a4 sw r16,0x00a4(r1)                    #                   *0x801d00a4 = loopValue
801c6bb0: 0c0532a0 jal 0x8014ca80                       #                   Switch To Next Thread ();
801c6bb4: 26100020 addiu r16,r16,0x0020                 #                   loopValue = loopValue + 0x20
801c6bb8: 2a020101 slti r2,r16,0x0101
801c6bbc: 1440fff6 bne r2,r0,0x801c6b98
801c6bc0: 00000000 nop
                                                        #               } while (loopValue < 0x101);
801c6bc4: 8ea40000 lw r4,0x0000(r21)
801c6bc8: 0c0602bf jal 0x80180afc                       #               unit = Get Unit's Data Pointer (*unitIndexPtr);
801c6bcc: 00008021 addu r16,r0,r0                       #               loopValue = 0
801c6bd0: 96a20000 lhu r2,0x0000(r21)                   #               unitIndex = *unitIndexPtr
801c6bd4: 00000000 nop
801c6bd8: a6c2000a sh r2,0x000a(r22)                    #               *0x801cbe6e = unitIndex
801c6bdc: 0c070a22 jal 0x801c2888                       #               0x1c2888 ();
801c6be0: a6c20000 sh r2,0x0000(r22)                    #               *0x801cbe64 = unitIndex
801c6be4: 3c04801d lui r4,0x801d
801c6be8: 2484b31c addiu r4,r4,-0x4ce4
801c6bec: 3c06801d lui r6,0x801d
801c6bf0: 24c6b384 addiu r6,r6,-0x4c7c
801c6bf4: 0c04cfde jal 0x80133f78                       #               0x133f78 (0x801cb31c, 0x801cbe64, 0x801cbe84);
801c6bf8: 02c02821 addu r5,r22,r0
801c6bfc: 96a20000 lhu r2,0x0000(r21)                   #               unitIndex = *unitIndexPtr
801c6c00: 3c01801d lui r1,0x801d
801c6c04: ac340088 sw r20,0x0088(r1)                    #               *0x801d0088 = 1
801c6c08: 3c01801d lui r1,0x801d
801c6c0c: ac34009c sw r20,0x009c(r1)                    #               *0x801d009c = 1
801c6c10: 3c01801d lui r1,0x801d
801c6c14: ac3400b0 sw r20,0x00b0(r1)                    #               *0x801d00b0 = 1
801c6c18: 3c01801d lui r1,0x801d
801c6c1c: a422b326 sh r2,-0x4cda(r1)                    #               *0x801cb326 = unitIndex
801c6c20: 0c0532a0 jal 0x8014ca80                       #               Switch To Next Thread ();
801c6c24: 00000000 nop                                  #           }
801c6c28: 2602ff00 addiu r2,r16,-0x0100                 #           loopValue - 0x100
                                                        #           do {
801c6c2c: 3c01801d lui r1,0x801d
801c6c30: ac22007c sw r2,0x007c(r1)                     #               *0x801d007c = loopValue - 0x100;
801c6c34: 3c01801d lui r1,0x801d
801c6c38: ac220090 sw r2,0x0090(r1)                     #               *0x801d0090 = loopValue - 0x100;
801c6c3c: 3c01801d lui r1,0x801d
801c6c40: ac2200a4 sw r2,0x00a4(r1)                     #               *0x801d00a4 = loopValue - 0x100;
801c6c44: 0c0532a0 jal 0x8014ca80
801c6c48: 26100020 addiu r16,r16,0x0020                 #               loopValue = loopValue + 0x20
801c6c4c: 2a020101 slti r2,r16,0x0101
801c6c50: 1440fff6 bne r2,r0,0x801c6c2c
801c6c54: 2602ff00 addiu r2,r16,-0x0100                 #               loopValue - 0x100
                                                        #           } while (loopValue < 0x101);
801c6c58: 02a08821 addu r17,r21,r0                      #           innerUnitIndexPtr = unitIndexPtr
                                                        #           do {
801c6c5c: 0c0710ec jal 0x801c43b0                       #               0x1c43b0 (0);
801c6c60: 00002021 addu r4,r0,r0
                                                        #               while (true) {
801c6c64: 0c0532a0 jal 0x8014ca80                       #                   Switch To Next Thread ();
801c6c68: 00000000 nop
801c6c6c: 0c05295e jal 0x8014a578                       #                   result_0x14a578 = 0x14a578 (0);   // Text data related?      
801c6c70: 00002021 addu r4,r0,r0
801c6c74: 3c01801d lui r1,0x801d
801c6c78: ac22208c sw r2,0x208c(r1)                     #                   *0x801d208c = result_0x14a578
801c6c7c: 8c430000 lw r3,0x0000(r2)                     #                   *result_0x14a578
801c6c80: 00000000 nop
801c6c84: 30620020 andi r2,r3,0x0020                    
801c6c88: 1440000e bne r2,r0,0x801c6cc4                 #                   if ((*result_0x14a578 & 0x20) != 0) break;
801c6c8c: 30620100 andi r2,r3,0x0100
801c6c90: 1040fff4 beq r2,r0,0x801c6c64                 #                   if ((*result_0x14a578 & 0x100) != 0) continue;
801c6c94: 00000000 nop
801c6c98: 0c0526fb jal 0x80149bec                       #                   threadID = Get Next Available Thread ID (16);
801c6c9c: 34040010 ori r4,r0,0x0010
801c6ca0: 00408021 addu r16,r2,r0                       #                   threadID
801c6ca4: 3c05801d lui r5,0x801d
801c6ca8: 24a5b15c addiu r5,r5,-0x4ea4
801c6cac: 0c053228 jal 0x8014c8a0                       #                   Initialize Thread (threadID, 0x801cb15c);
801c6cb0: 02002021 addu r4,r16,r0
801c6cb4: 0c053274 jal 0x8014c9d0                       #                   Wait For Thread (threadID);
801c6cb8: 02002021 addu r4,r16,r0
801c6cbc: 08071b19 j 0x801c6c64
801c6cc0: 00000000 nop
                                                        #               }
801c6cc4: 0c0710ec jal 0x801c43b0                       #               0x1c43b0 (1);
801c6cc8: 34040001 ori r4,r0,0x0001
801c6ccc: 8e220000 lw r2,0x0000(r17)                    #               innerUnit = *innerUnitIndexPtr
801c6cd0: 3c018016 lui r1,0x8016
801c6cd4: ac225ef4 sw r2,0x5ef4(r1)                     #               *0x80165ef4 = innerUnit
801c6cd8: 0c04ca09 jal 0x80132824                       #               textEntry = Prep for Loading Text (0x5006);     // Finds a text entry.
801c6cdc: 34045006 ori r4,r0,0x5006
801c6ce0: 27a40010 addiu r4,r29,0x0010
801c6ce4: 27a50012 addiu r5,r29,0x0012
801c6ce8: 0c04c063 jal 0x8013018c                       #               0x13018c (sp + 0x10, sp + 0x12, textEntry);
801c6cec: 00403021 addu r6,r2,r0
801c6cf0: 87a30010 lh r3,0x0010(r29)                    #               value = sp + 0x10
801c6cf4: 00000000 nop
801c6cf8: 00601021 addu r2,r3,r0                        #               value
801c6cfc: 04610002 bgez r3,0x801c6d08
801c6d00: 00602021 addu r4,r3,r0                        #               value
                                                        #               if (value < 0) {
801c6d04: 24620003 addiu r2,r3,0x0003                   #                   value = value + 3
                                                        #               }
801c6d08: 00021083 sra r2,r2,0x02
801c6d0c: 00021080 sll r2,r2,0x02
801c6d10: 00621023 subu r2,r3,r2                        #               value % 4
801c6d14: 24420018 addiu r2,r2,0x0018                   #               (value % 4) + 24
801c6d18: 00821021 addu r2,r4,r2                        #               value + (value % 4) + 24
801c6d1c: 00401821 addu r3,r2,r0                        #               storeValue = value + (value % 4) + 24
801c6d20: 00021400 sll r2,r2,0x10
801c6d24: 00022403 sra r4,r2,0x10                       #               value2 = value + (value % 4) + 24
801c6d28: 000217c2 srl r2,r2,0x1f
801c6d2c: 00821021 addu r2,r4,r2
801c6d30: 00021043 sra r2,r2,0x01                       #               value2                   
801c6d34: a6630010 sh r3,0x0010(r19)                    #               *0x801d00f4 = storeValue
801c6d38: a6630008 sh r3,0x0008(r19)                    #               *0x801d00ec = storeValue
801c6d3c: a6630000 sh r3,0x0000(r19)                    #               *0x801d00e4 = storeValue
801c6d40: 00021840 sll r3,r2,0x01                       
801c6d44: 00832023 subu r4,r4,r3                        #               value2 % 2
801c6d48: 24840100 addiu r4,r4,0x0100                   #               (value2 % 2) + 0x100
801c6d4c: 00822023 subu r4,r4,r2                        #               ((value2 % 2) + 0x100) - value2
801c6d50: a6640004 sh r4,0x0004(r19)                    #               *0x801d00e8 = ((value2 % 2) + 0x100) - value2
801c6d54: 8e240000 lw r4,0x0000(r17)                    #               innerUnitIndex = *innerUnitIndexPtr               
801c6d58: 0c071800 jal 0x801c6000                       #               freePartySlotStatus = Get Free Party Slot Status (innerUnitIndex);
801c6d5c: 00000000 nop
801c6d60: 34030002 ori r3,r0,0x0002
801c6d64: 14430005 bne r2,r3,0x801c6d7c
801c6d68: 340200ff ori r2,r0,0x00ff
                                                        #               if (freePartySlotStatus == 2) {     // Unit is joining as Guest
801c6d6c: 3c01801d lui r1,0x801d
801c6d70: a42071ec sh r0,0x71ec(r1)                     #                   *0x801d71ec = 0
801c6d74: 08071b7f j 0x801c6dfc
801c6d78: 00000000 nop                                  #               } else {
801c6d7c: 3c05801c lui r5,0x801c
801c6d80: 24a520d0 addiu r5,r5,0x20d0
801c6d84: 3c01801d lui r1,0x801d
801c6d88: a42271f0 sh r2,0x71f0(r1)                     #                   *0x801d71f0 = 0xff
801c6d8c: 0c053228 jal 0x8014c8a0                       #                   Initialize Thread (7, 0x801c20d0);
801c6d90: 34040007 ori r4,r0,0x0007
801c6d94: 34040007 ori r4,r0,0x0007
801c6d98: 2665fffc addiu r5,r19,-0x0004
801c6d9c: 00003021 addu r6,r0,r0
801c6da0: 0c05328e jal 0x8014ca38                       #                   Store Thread Function Parameters (7, 0x801d00e8, 0, 0);
801c6da4: 00003821 addu r7,r0,r0
801c6da8: 3c02801d lui r2,0x801d
801c6dac: 8442b392 lh r2,-0x4c6e(r2)                    #                   *0x801cb392
801c6db0: 00000000 nop
801c6db4: 10400008 beq r2,r0,0x801c6dd8                 #                   if (*0x801cb392 != 0) {
801c6db8: 00000000 nop
801c6dbc: 3c058014 lui r5,0x8014
801c6dc0: 24a58ed8 addiu r5,r5,-0x7128
801c6dc4: 0c053228 jal 0x8014c8a0                       #                       Initialize Thread (5, 0x80138ed8);      // Display Simple Selection Menu
801c6dc8: 34040005 ori r4,r0,0x0005
801c6dcc: 34040005 ori r4,r0,0x0005
801c6dd0: 08071b7c j 0x801c6df0
801c6dd4: 266501dc addiu r5,r19,0x01dc                  #                       funcParam1 = 0x801d02c0                     // (Menu data)
                                                        #                   } else {
801c6dd8: 3c058014 lui r5,0x8014
801c6ddc: 24a58ed8 addiu r5,r5,-0x7128
801c6de0: 0c053228 jal 0x8014c8a0                       #                       Initialize Thread (5, 0x80138ed8);      // Display Simple Selection Menu
801c6de4: 34040005 ori r4,r0,0x0005
801c6de8: 34040005 ori r4,r0,0x0005
801c6dec: 26650038 addiu r5,r19,0x0038                  #                       funcParam1 = 0x801d011c                     // (Menu data)
                                                        #                   }
801c6df0: 00003021 addu r6,r0,r0
801c6df4: 0c05328e jal 0x8014ca38                       #                   Store Thread Function Parameters (5, funcParam1, 0, 0);
801c6df8: 00003821 addu r7,r0,r0
                                                        #               }
801c6dfc: 0c0713d0 jal 0x801c4f40                       #               0x1c4f40 ();
801c6e00: 00000000 nop
801c6e04: 3c03801d lui r3,0x801d
801c6e08: 846371f0 lh r3,0x71f0(r3)                     #               *0x801d71f0
801c6e0c: 2402ffff addiu r2,r0,-0x0001
801c6e10: 14620005 bne r3,r2,0x801c6e28                 #               if (*0x801d71f0 == -1) {
801c6e14: 00000000 nop
801c6e18: 0c0710ec jal 0x801c43b0                       #                   0x1c43b0 (0);
801c6e1c: 00002021 addu r4,r0,r0
801c6e20: 08071b17 j 0x801c6c5c                         #                   continue;
801c6e24: 00000000 nop                                  #               }
801c6e28: 3c02801d lui r2,0x801d
801c6e2c: 844271f0 lh r2,0x71f0(r2)                     #               *0x801d71f0
801c6e30: 00000000 nop
801c6e34: 1440007d bne r2,r0,0x801c702c                 #               if (*0x801d71f0 != 0) { GOTO skipSection }
801c6e38: 00000000 nop
801c6e3c: 8e240000 lw r4,0x0000(r17)                    #               innerUnitIndex = *innerUnitIndexPtr
801c6e40: 0c071800 jal 0x801c6000                       #               freePartySlotStatus = Get Free Party Slot Status (innerUnitIndex);
801c6e44: 00000000 nop
801c6e48: 14400046 bne r2,r0,0x801c6f64                 #               if (freePartySlotStatus != 0) break;
801c6e4c: 00000000 nop
801c6e50: 3c018016 lui r1,0x8016
801c6e54: ac20603c sw r0,0x603c(r1)                     #               *0x8016603c = 0
                                                        #               do {
801c6e58: 0c0532a0 jal 0x8014ca80                       #                   Switch To Next Thread ();
801c6e5c: 00000000 nop
801c6e60: 3c028016 lui r2,0x8016
801c6e64: 8c42603c lw r2,0x603c(r2)                     #                   *0x8016603c
801c6e68: 00000000 nop
801c6e6c: 24420010 addiu r2,r2,0x0010                   #                   *0x8016603c + 0x10
801c6e70: 3c018016 lui r1,0x8016
801c6e74: ac22603c sw r2,0x603c(r1)                     #                   *0x8016603c = *0x8016603c + 0x10
801c6e78: 28420100 slti r2,r2,0x0100
801c6e7c: 1440fff6 bne r2,r0,0x801c6e58
801c6e80: 341200ff ori r18,r0,0x00ff
                                                        #               } while (*0x8016603c < 0x100);
801c6e84: 3c018016 lui r1,0x8016
801c6e88: ac32603c sw r18,0x603c(r1)                    #               *0x8016603c = 0xff
801c6e8c: 3c018016 lui r1,0x8016
801c6e90: ac205fc4 sw r0,0x5fc4(r1)                     #               *0x80165fc4 = 0
801c6e94: 0c071828 jal 0x801c60a0                       #               result_0x1c60a0 = 0x1c60a0 ();
801c6e98: 00000000 nop
801c6e9c: 8e240000 lw r4,0x0000(r17)                    #               innerUnitIndex = *innerUnitIndexPtr
801c6ea0: 3c01801d lui r1,0x801d
801c6ea4: a42271f4 sh r2,0x71f4(r1)                     #               *0x801d71f4 = result_0x1c60a0
801c6ea8: 3c018016 lui r1,0x8016
801c6eac: ac345fc4 sw r20,0x5fc4(r1)                    #               *0x80165fc4 = 1
801c6eb0: 0c0602bf jal 0x80180afc                       #               unit = Get Unit's Data Pointer (innerUnitIndex);        // Thrown away??
801c6eb4: 00000000 nop
801c6eb8: 96220000 lhu r2,0x0000(r17)                   #               innerUnitIndex = *innerUnitIndexPtr
801c6ebc: 00000000 nop
801c6ec0: a6c2000a sh r2,0x000a(r22)                    #               *0x801cbe6e = innerUnitIndex
801c6ec4: 0c070a22 jal 0x801c2888                       #               0x1c2888 ();
801c6ec8: a6c20000 sh r2,0x0000(r22)                    #               *0x801cbe64 = innerUnitIndex
801c6ecc: 96230000 lhu r3,0x0000(r17)                   #               innerUnitIndex = *innerUnitIndexPtr
801c6ed0: 3c02801d lui r2,0x801d
801c6ed4: 844271f4 lh r2,0x71f4(r2)                     #               *0x801c71f4
801c6ed8: 3c10801d lui r16,0x801d
801c6edc: 2610b326 addiu r16,r16,-0x4cda                #               0x801cb326
801c6ee0: 3c01801d lui r1,0x801d
801c6ee4: ac340088 sw r20,0x0088(r1)                    #               *0x801d0088 = 1
801c6ee8: 3c01801d lui r1,0x801d
801c6eec: ac34009c sw r20,0x009c(r1)                    #               *0x801d009c = 1
801c6ef0: 3c01801d lui r1,0x801d
801c6ef4: ac3400b0 sw r20,0x00b0(r1)                    #               *0x801d00b0 = 1
801c6ef8: 14400003 bne r2,r0,0x801c6f08
801c6efc: a6030000 sh r3,0x0000(r16)                    #               *0x801cb326 = innerUnitIndex
                                                        #               if (*0x801c71f4 == 0) {
801c6f00: 0c0710ec jal 0x801c43b0                       #                   0x1c43b0 (1);
801c6f04: 34040001 ori r4,r0,0x0001
                                                        #               }
801c6f08: 2604fff6 addiu r4,r16,-0x000a
801c6f0c: 3c06801d lui r6,0x801d
801c6f10: 24c6b384 addiu r6,r6,-0x4c7c
801c6f14: 0c04cfde jal 0x80133f78                       #               0x133f78 (0x801cb31c, 0x801cbe64, 0x801cb384);    // multiple memcpy() calls
801c6f18: 02c02821 addu r5,r22,r0
801c6f1c: 3c018016 lui r1,0x8016
801c6f20: ac32603c sw r18,0x603c(r1)                    #               *0x8016603c = 0xff
                                                        #               do {
801c6f24: 0c0532a0 jal 0x8014ca80                       #                   Switch To Next Thread ();
801c6f28: 00000000 nop
801c6f2c: 3c028016 lui r2,0x8016
801c6f30: 8c42603c lw r2,0x603c(r2)                     #                   *0x8016603c
801c6f34: 00000000 nop
801c6f38: 2442fff0 addiu r2,r2,-0x0010                  #                   *0x8016603c - 0x10
801c6f3c: 3c018016 lui r1,0x8016
801c6f40: ac22603c sw r2,0x603c(r1)                     #                   *0x8016603c = *0x8016603c - 0x10
801c6f44: 1c40fff7 bgtz r2,0x801c6f24
801c6f48: 00000000 nop
                                                        #               } while (*0x8016603c > 0);
801c6f4c: 3c02801d lui r2,0x801d
801c6f50: 844271f4 lh r2,0x71f4(r2)                     #               *0x801d71f4
801c6f54: 3c018016 lui r1,0x8016
801c6f58: ac20603c sw r0,0x603c(r1)                     #               *0x8016603c = 0
801c6f5c: 1440ff3f bne r2,r0,0x801c6c5c
801c6f60: 00000000 nop
                                                        #           } while (*0x801d71f4 != 0);
801c6f64: 8e240000 lw r4,0x0000(r17)                    
801c6f68: 0c071792 jal 0x801c5e48                       #           result = Post battle equipment storing (*innerUnitIndexPtr);
801c6f6c: 00000000 nop
801c6f70: 1040000d beq r2,r0,0x801c6fa8                 #           if (result != 0) {
801c6f74: 00000000 nop
801c6f78: 3c058014 lui r5,0x8014
801c6f7c: 24a5b280 addiu r5,r5,-0x4d80
801c6f80: 0c053228 jal 0x8014c8a0                       #               Initialize Thread (5, 0x8013b280);
801c6f84: 34040005 ori r4,r0,0x0005
801c6f88: 34040005 ori r4,r0,0x0005
801c6f8c: 3c05801d lui r5,0x801d
801c6f90: 24a50284 addiu r5,r5,0x0284
801c6f94: 00003021 addu r6,r0,r0
801c6f98: 0c05328e jal 0x8014ca38                       #               Store Thread Function Parameters (5, 0x801d0284, 0, 0);
801c6f9c: 00003821 addu r7,r0,r0
801c6fa0: 0c053274 jal 0x8014c9d0                       #               Wait For Thread (5);
801c6fa4: 34040005 ori r4,r0,0x0005
                                                        #           }
801c6fa8: 0c053216 jal 0x8014c858                       #           Wait (20);
801c6fac: 34040014 ori r4,r0,0x0014
801c6fb0: 3c05801d lui r5,0x801d
801c6fb4: 24a59fac addiu r5,r5,-0x6054
801c6fb8: 0c053228 jal 0x8014c8a0                       #           Initialize Thread (5, 0x801c9fac);
801c6fbc: 34040005 ori r4,r0,0x0005
801c6fc0: 34040005 ori r4,r0,0x0005
801c6fc4: 3405000a ori r5,r0,0x000a
801c6fc8: 00003021 addu r6,r0,r0
801c6fcc: 0c05328e jal 0x8014ca38                       #           Store Thread Function Parameters (5, 10, 0, 0);
801c6fd0: 00003821 addu r7,r0,r0
801c6fd4: 0c070ee9 jal 0x801c3ba4                       #           0x1c3ba4 (0x3c);
801c6fd8: 3404003c ori r4,r0,0x003c
801c6fdc: 34040005 ori r4,r0,0x0005
801c6fe0: 00002821 addu r5,r0,r0
801c6fe4: 00003021 addu r6,r0,r0
801c6fe8: 0c05328e jal 0x8014ca38                       #           Store Thread Function Parameters (5, 0, 0, 2);
801c6fec: 34070002 ori r7,r0,0x0002
801c6ff0: 0c053274 jal 0x8014c9d0                       #           Wait For Thread (5);
801c6ff4: 34040005 ori r4,r0,0x0005
801c6ff8: 0c0710ec jal 0x801c43b0                       #           0x14c3b0 (0);
801c6ffc: 00002021 addu r4,r0,r0
801c7000: 8e240000 lw r4,0x0000(r17)
801c7004: 0c0602bf jal 0x80180afc                       #           unit = Get Unit's Data Pointer (*innerUnitIndexPtr);
801c7008: 26b50004 addiu r21,r21,0x0004                 #           unitIndexPtr = unitIndexPtr + 4
801c700c: 90450006 lbu r5,0x0006(r2)                    #           unit.Flags
801c7010: 00402021 addu r4,r2,r0
801c7014: 0c0166ec jal 0x80059bb0                       #           Save Unit to Party (unit, unit.Flags & UNIT_FLAGS_JOIN_AS_GUEST);
801c7018: 30a50001 andi r5,r5,0x0001
801c701c: 0c053216 jal 0x8014c858                       #           Wait (20);
801c7020: 34040014 ori r4,r0,0x0014
801c7024: 08071c17 j 0x801c705c                         #           skip = true
801c7028: 00000000 nop
                                                        #           if (!skip) {
                                                        #               skipSection:
801c702c: 1454ff0a bne r2,r20,0x801c6c58                #               if (*0x801d71f0 != 1) { innerUnitIndexPtr = unitIndexPtr; continue; }
801c7030: 00000000 nop
801c7034: 0c0710ec jal 0x801c43b0                       #               0x1c43b0 (0);
801c7038: 00002021 addu r4,r0,r0
801c703c: 0c053216 jal 0x8014c858                       #               Wait (10);
801c7040: 3404000a ori r4,r0,0x000a
801c7044: 8e240000 lw r4,0x0000(r17)                    
801c7048: 0c0602bf jal 0x80180afc                       #               unit = Get Unit's Data Pointer (*innerUnitIndexPtr);
801c704c: 26b50004 addiu r21,r21,0x0004                 #               unitIndexPtr = unitIndexPtr + 4
801c7050: 90440000 lbu r4,0x0000(r2)                    
801c7054: 0c070e82 jal 0x801c3a08                       #               0x1c3a08 (unit.BaseClass, 12);
801c7058: 3405000c ori r5,r0,0x000c
                                                        #           }
801c705c: 3c02801d lui r2,0x801d
801c7060: 8c420b34 lw r2,0x0b34(r2)                     #           *0x801d0b34
801c7064: 26f70001 addiu r23,r23,0x0001                 #           count = count + 1
801c7068: 02e2102a slt r2,r23,r2
801c706c: 1440fe9a bne r2,r0,0x801c6ad8
801c7070: 00000000 nop
                                                        #       } while (count < *0x801d0b34);
                                                        #   }
801c7074: 00008021 addu r16,r0,r0                       #   loopValue = 0
                                                        #   do {
801c7078: 3c01801d lui r1,0x801d
801c707c: ac30007c sw r16,0x007c(r1)                    #       *0x801d007c = loopValue
801c7080: 3c01801d lui r1,0x801d
801c7084: ac300090 sw r16,0x0090(r1)                    #       *0x801d0090 = loopValue
801c7088: 3c01801d lui r1,0x801d
801c708c: ac3000a4 sw r16,0x00a4(r1)                    #       *0x801d00a4 = loopValue
801c7090: 0c0532a0 jal 0x8014ca80                       #       Switch To Next Thread ();
801c7094: 26100020 addiu r16,r16,0x0020                 #       loopValue = loopValue + 0x20
801c7098: 2a020101 slti r2,r16,0x0101
801c709c: 1440fff6 bne r2,r0,0x801c7078                 #   } while (loopValue < 0x101);
801c70a0: 34040008 ori r4,r0,0x0008
801c70a4: 00002821 addu r5,r0,r0
801c70a8: 00003021 addu r6,r0,r0
801c70ac: 0c05328e jal 0x8014ca38                       #   Store Thread Function Parameters (8, 0, 0, 1);
801c70b0: 34070001 ori r7,r0,0x0001
801c70b4: 3404000c ori r4,r0,0x000c
801c70b8: 00002821 addu r5,r0,r0
801c70bc: 00003021 addu r6,r0,r0
801c70c0: 0c05328e jal 0x8014ca38                       #   Store Thread Function Parameters (12, 0, 0, 1);
801c70c4: 34070001 ori r7,r0,0x0001
801c70c8: 34040009 ori r4,r0,0x0009
801c70cc: 00002821 addu r5,r0,r0
801c70d0: 00003021 addu r6,r0,r0
801c70d4: 0c05328e jal 0x8014ca38                       #   Store Thread Function Parameters (9, 0, 0, 1);
801c70d8: 34070001 ori r7,r0,0x0001
801c70dc: 0c053274 jal 0x8014c9d0                       #   Wait For Thread (8);
801c70e0: 34040008 ori r4,r0,0x0008
801c70e4: 0c053274 jal 0x8014c9d0                       #   Wait For Thread (12);
801c70e8: 3404000c ori r4,r0,0x000c
801c70ec: 0c053274 jal 0x8014c9d0                       #   Wait For Thread (9);
801c70f0: 34040009 ori r4,r0,0x0009
801c70f4: 3c05801e lui r5,0x801e
801c70f8: 24a58304 addiu r5,r5,-0x7cfc
801c70fc: 3c048016 lui r4,0x8016
801c7100: 8c845f98 lw r4,0x5f98(r4)
801c7104: 34060400 ori r6,r0,0x0400
801c7108: 3c018016 lui r1,0x8016
801c710c: ac205fc4 sw r0,0x5fc4(r1)                     #   *0x80165fc4 = 0
801c7110: 0c052fd5 jal 0x8014bf54                       #   Copy Bytes (0x14bf54) (threads[1], 0x801d8304, sizeof(thread));       // memcpy() from thread 1
801c7114: 24840400 addiu r4,r4,0x0400
801c7118: 8fa80018 lw r8,0x0018(r29)                    #   oldMenuData
801c711c: 3c018017 lui r1,0x8017
801c7120: ac283cb8 sw r8,0x3cb8(r1)                     #   *0x80173cb8 = oldMenuData
801c7124: 0c053249 jal 0x8014c924                       #   Mark Thread As Running (1);
801c7128: 34040001 ori r4,r0,0x0001
801c712c: 0c0532a0 jal 0x8014ca80                       #   Switch To Next Thread ();
801c7130: 00000000 nop
801c7134: 0c053256 jal 0x8014c958                       #   Stop Current Thread ();
801c7138: 00000000 nop
801c713c: 8fbf0054 lw r31,0x0054(r29)
801c7140: 8fbe0050 lw r30,0x0050(r29)
801c7144: 8fb7004c lw r23,0x004c(r29)
801c7148: 8fb60048 lw r22,0x0048(r29)
801c714c: 8fb50044 lw r21,0x0044(r29)
801c7150: 8fb40040 lw r20,0x0040(r29)
801c7154: 8fb3003c lw r19,0x003c(r29)
801c7158: 8fb20038 lw r18,0x0038(r29)
801c715c: 8fb10034 lw r17,0x0034(r29)
801c7160: 8fb00030 lw r16,0x0030(r29)
801c7164: 27bd0058 addiu r29,r29,0x0058
801c7168: 03e00008 jr r31
801c716c: 00000000 nop