Post-battle (0x1c4740)

From Final Fantasy Hacktics Wiki
Revision as of 20:27, 12 September 2020 by Glain (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
801c4740: 27bdffd0 addiu r29,r29,-0x0030
801c4744: afb40028 sw r20,0x0028(r29)
801c4748: 0000a021 addu r20,r0,r0                   #   numJoinPrompts = 0
801c474c: afb20020 sw r18,0x0020(r29)
801c4750: 00009021 addu r18,r0,r0                   #   partyUnitIndex = 0
801c4754: afb30024 sw r19,0x0024(r29)
801c4758: 341300ff ori r19,r0,0x00ff                #   0xff
801c475c: afbf002c sw r31,0x002c(r29)
801c4760: afb1001c sw r17,0x001c(r29)
801c4764: afb00018 sw r16,0x0018(r29)
801c4768: 3c01801d lui r1,0x801d
801c476c: ac200b34 sw r0,0x0b34(r1)                 #   *0x801d0b34 = 0
                                                    #   do {
801c4770: 0c0166bc jal 0x80059af0                   #       partyUnit = Get Party Data Pointer (partyUnitIndex);
801c4774: 02402021 addu r4,r18,r0
801c4778: 90420001 lbu r2,0x0001(r2)                #       partyUnit.unitIndex
801c477c: 00000000 nop
801c4780: 10530055 beq r2,r19,0x801c48d8
801c4784: 00008821 addu r17,r0,r0                   #       battleUnitIndex = 0
                                                    #       if (partyUnit.unitIndex != 0xff) {
                                                    #           do {
801c4788: 0c0602bf jal 0x80180afc                   #               battleUnit = Get Unit's Data Pointer (battleUnitIndex);
801c478c: 02202021 addu r4,r17,r0
801c4790: 00408021 addu r16,r2,r0                   #               battleUnit
801c4794: 92020002 lbu r2,0x0002(r16)               #               battleUnit.PartyID
801c4798: 00000000 nop
801c479c: 14520009 bne r2,r18,0x801c47c4            #               if (battleUnit.PartyID == partyUnitIndex) {
801c47a0: 00000000 nop
801c47a4: 92020183 lbu r2,0x0183(r16)               #                   battleUnit.0x183
801c47a8: 00000000 nop
801c47ac: 10530005 beq r2,r19,0x801c47c4            #                   if (battleUnit.0x183 != 0xff) {
801c47b0: 00000000 nop
801c47b4: 92020161 lbu r2,0x0161(r16)               #                       battleUnit.ENTD_ID
801c47b8: 00000000 nop
801c47bc: 14400005 bne r2,r0,0x801c47d4             #                       if (battleUnit.ENTD_ID != 0) break;
801c47c0: 34020015 ori r2,r0,0x0015
                                                    #                   }
                                                    #               }
801c47c4: 26310001 addiu r17,r17,0x0001             #               battleUnitIndex = battleUnitIndex + 1
801c47c8: 2a220015 slti r2,r17,0x0015
801c47cc: 1440ffee bne r2,r0,0x801c4788
801c47d0: 34020015 ori r2,r0,0x0015
                                                    #           } while (battleUnitIndex < 21);
801c47d4: 12220040 beq r17,r2,0x801c48d8            #           if (battleUnitIndex != 21) {
801c47d8: 00000000 nop
801c47dc: 0c0602bf jal 0x80180afc                   #               battleUnit = Get Unit's Data Pointer (battleUnitIndex);
801c47e0: 02202021 addu r4,r17,r0
801c47e4: 90440161 lbu r4,0x0161(r2)                #               battleUnit.ENTD_ID
801c47e8: 0c060324 jal 0x80180c90                   #               battleENTDUnit = Find Unit Data Pointer For ENTD Unit ID (battleUnit.ENTD_ID, &resultCode);
801c47ec: 27a50010 addiu r5,r29,0x0010
801c47f0: 00408021 addu r16,r2,r0                   #               battleENTDUnit
801c47f4: 92030183 lbu r3,0x0183(r16)               #               battleENTDUnit.0x183
801c47f8: 34020080 ori r2,r0,0x0080                 #               0x80
801c47fc: 10620007 beq r3,r2,0x801c481c             #               if ((battleENTDUnit.0x183 == 0x80)
801c4800: 00000000 nop
801c4804: 10730005 beq r3,r19,0x801c481c            #                   or (battleENTDUnit.0x183 == 0xff)
801c4808: 2402fffd addiu r2,r0,-0x0003
801c480c: 8fa30010 lw r3,0x0010(r29)
801c4810: 00000000 nop
801c4814: 14620015 bne r3,r2,0x801c486c             #                   or (resultCode == -3))
801c4818: 00000000 nop                              #               {
801c481c: 92020161 lbu r2,0x0161(r16)               #                   battleENTDUnit.ENTD_ID
801c4820: 00000000 nop
801c4824: 10400003 beq r2,r0,0x801c4834
801c4828: 2c420004 sltiu r2,r2,0x0004
801c482c: 1440002a bne r2,r0,0x801c48d8             #                   if ((battleENTDUnit.ENTD_ID != 0) and (battleENTDUnit.ENTD_ID < 4)) break;
801c4830: 00000000 nop
801c4834: 92020059 lbu r2,0x0059(r16)               #                   battleENTDUnit.CurrentStatuses2
801c4838: 00000000 nop
801c483c: 30420001 andi r2,r2,0x0001                #                   battleENTDUnit.CurrentStatuses2 & STATUS_TREASURE
801c4840: 14400003 bne r2,r0,0x801c4850             #                   if (battleENTDUnit.CurrentStatuses2 & STATUS_TREASURE) {
801c4844: 00000000 nop
801c4848: 0c0717c4 jal 0x801c5f10                   #                       ? 0x1c5f10 (battleUnitIndex);
801c484c: 02202021 addu r4,r17,r0
                                                    #                   }
801c4850: 0c0167f8 jal 0x80059fe0                   #                   Remove Unit from Party (partyUnitIndex);
801c4854: 02402021 addu r4,r18,r0
801c4858: 92040000 lbu r4,0x0000(r16)               #                   battleENTDUnit.BaseClass
801c485c: 0c070e82 jal 0x801c3a08                   #                   ? 0x1c3a08 (battleENTDUnit.BaseClass, 15);
801c4860: 3405000f ori r5,r0,0x000f
801c4864: 08071237 j 0x801c48dc
801c4868: 26520001 addiu r18,r18,0x0001
                                                    #               } else {
801c486c: 92020000 lbu r2,0x0000(r16)               #                  battleENTDUnit.BaseClass 
801c4870: 00000000 nop
801c4874: 10400005 beq r2,r0,0x801c488c
801c4878: 2c420004 sltiu r2,r2,0x0004
801c487c: 10400003 beq r2,r0,0x801c488c
801c4880: 02002021 addu r4,r16,r0
                                                    #                   if (battleENTDUnit.BaseClass != 0) and (battleENTDUnit.BaseClass < 4) {
801c4884: 08071234 j 0x801c48d0
801c4888: 00002821 addu r5,r0,r0                    #                       isGuest = false
                                                    #                   } else {
801c488c: 92020006 lbu r2,0x0006(r16)               #                       battleENTDUnit.ENTDFlags
801c4890: 00000000 nop
801c4894: 30420001 andi r2,r2,0x0001                #                       battleENTDUnit.ENTDFlags & FLAG_SAVE_FORMATION
801c4898: 1440000a bne r2,r0,0x801c48c4             #                       if (battleENTDUnit.ENTDFlags & FLAG_SAVE_FORMATION == 0) {
801c489c: 00000000 nop
801c48a0: 92040002 lbu r4,0x0002(r16)               #                           battleENTDUnit.PartyID  
801c48a4: 00000000 nop
801c48a8: 2c820010 sltiu r2,r4,0x0010
801c48ac: 14400005 bne r2,r0,0x801c48c4             #                           if (battleENTDUnit.PartyID >= 16) {         // Unit is guest
801c48b0: 00000000 nop
801c48b4: 0c0167f8 jal 0x80059fe0                   #                               Remove Unit from Party (battleENTDUnit.PartyID);
801c48b8: 26520001 addiu r18,r18,0x0001
801c48bc: 08071237 j 0x801c48dc
801c48c0: a2130002 sb r19,0x0002(r16)               #                               battleENTDUnit.PartyID = 0xff
                                                    #                               continue;   (partyUnitIndex++)
                                                    #                           }
                                                    #                       }
801c48c4: 92050006 lbu r5,0x0006(r16)               #                       battleENTDUnit.ENTDFlags & FLAG_SAVE_FORMATION
801c48c8: 02002021 addu r4,r16,r0
801c48cc: 30a50001 andi r5,r5,0x0001                #                       isGuest = battleENTDUnit.ENTDFlags & FLAG_SAVE_FORMATION
                                                    #                   }
801c48d0: 0c0166ec jal 0x80059bb0                   #                   Save Unit to Party (battleENTDUnit, isGuest);
801c48d4: 00000000 nop                              #               }
                                                    #           }
                                                    #       }
801c48d8: 26520001 addiu r18,r18,0x0001             #       partyUnitIndex = partyUnitIndex + 1;
801c48dc: 2a420014 slti r2,r18,0x0014
801c48e0: 1440ffa3 bne r2,r0,0x801c4770
801c48e4: 00000000 nop                              #   } while (partyUnitIndex < 20);

801c48e8: 00009021 addu r18,r0,r0                   #   battleUnitIndex = 0
801c48ec: 3c13801d lui r19,0x801d
801c48f0: 26730a00 addiu r19,r19,0x0a00             #   0x801d0a00
                                                    #   for (; battleUnitIndex < 21; battleUnitIndex++) {
801c48f4: 0c0602bf jal 0x80180afc                   #       battleUnit = Get Unit's Data Pointer (battleUnitIndex);
801c48f8: 02402021 addu r4,r18,r0
801c48fc: 90440161 lbu r4,0x0161(r2)                #       battleUnit.ENTD_ID
801c4900: 0c060324 jal 0x80180c90                   #       battleENTDUnit = Find Unit Data Pointer For ENTD Unit ID (battleUnit.ENTD_ID, &resultCode);
801c4904: 27a50010 addiu r5,r29,0x0010
801c4908: 8fa30010 lw r3,0x0010(r29)                #       resultCode
801c490c: 00000000 nop
801c4910: 0460005b bltz r3,0x801c4a80               #       if (resultCode <= 0) continue;
801c4914: 00408021 addu r16,r2,r0                   #       battleENTDUnit
801c4918: 16430059 bne r18,r3,0x801c4a80            #       if (battleUnitIndex != resultCode) continue;
801c491c: 340200ff ori r2,r0,0x00ff                 #       0xff
801c4920: 92030002 lbu r3,0x0002(r16)               #       battleENTDUnit.partyIndex
801c4924: 00000000 nop
801c4928: 14620055 bne r3,r2,0x801c4a80             #       if (battleENTDUnit.partyIndex != 0xff) continue;
801c492c: 00000000 nop
801c4930: 92030161 lbu r3,0x0161(r16)               #       battleENTDUnit.ENTD_ID
801c4934: 00000000 nop
801c4938: 10600051 beq r3,r0,0x801c4a80             #       if (battleENTDUnit.ENTD_ID == 0) continue;
801c493c: 00000000 nop
801c4940: 92040000 lbu r4,0x0000(r16)               #       battleENTDUnit.baseClass
801c4944: 00000000 nop
801c4948: 10800003 beq r4,r0,0x801c4958
801c494c: 2c820004 sltiu r2,r4,0x0004
801c4950: 1440004b bne r2,r0,0x801c4a80             #       if ((battleENTDUnit.baseClass != 0) and (battleENTDUnit.baseClass < 4)) continue;
801c4954: 00000000 nop
801c4958: 2c620004 sltiu r2,r3,0x0004
801c495c: 14400048 bne r2,r0,0x801c4a80             #       if (battleENTDUnit.ENTD_ID < 4) continue;
801c4960: 00000000 nop
801c4964: 92030006 lbu r3,0x0006(r16)               #       battleENTDUnit.Flags_0x06
801c4968: 00000000 nop
801c496c: 30620010 andi r2,r3,0x0010                #       battleENTDUnit.Flags_0x06 & FLAG_JOIN_AFTER_EVENT
801c4970: 14400006 bne r2,r0,0x801c498c             #       if ((battleENTDUnit.Flags_0x06 & FLAG_JOIN_AFTER_EVENT) == 0) {
801c4974: 30620001 andi r2,r3,0x0001                #           
801c4978: 92020059 lbu r2,0x0059(r16)               #           battleENTDUnit.CurrentStatuses2
801c497c: 00000000 nop
801c4980: 30420040 andi r2,r2,0x0040                #           battleENTDUnit.CurrentStatuses2 & STATUS_INVITE
801c4984: 1040003e beq r2,r0,0x801c4a80             #           if ((battleENTDUnit.CurrentStatuses2 & STATUS_INVITE) == 0) continue;
801c4988: 30620001 andi r2,r3,0x0001                #           
                                                    #       }
801c498c: 1040001e beq r2,r0,0x801c4a08              
801c4990: 00008821 addu r17,r0,r0                   #       outerCount = 0
                                                    #       if (battleENTDUnit.Flags_0x06 & FLAG_JOIN_AS_GUEST) {
801c4994: 00803021 addu r6,r4,r0                    #           battleENTDUnit.baseClass
801c4998: 02602821 addu r5,r19,r0                   #           outerPtr = 0x801d0a00
                                                    #           do {
801c499c: 00001821 addu r3,r0,r0                    #               count = 0
801c49a0: 00a02021 addu r4,r5,r0                    #               ptr = outerPtr
                                                    #               do {
801c49a4: 90820000 lbu r2,0x0000(r4)                #                   *ptr
801c49a8: 00000000 nop
801c49ac: 10c20006 beq r6,r2,0x801c49c8             #                   if (battleENTDUnit.baseClass != *ptr) break;
801c49b0: 34020003 ori r2,r0,0x0003                 
801c49b4: 24630001 addiu r3,r3,0x0001               #                   count = count + 1
801c49b8: 28620003 slti r2,r3,0x0003
801c49bc: 1440fff9 bne r2,r0,0x801c49a4
801c49c0: 24840001 addiu r4,r4,0x0001               #                   ptr = ptr + 1
                                                    #               } while (count < 3);
801c49c4: 34020003 ori r2,r0,0x0003
801c49c8: 14620006 bne r3,r2,0x801c49e4             #               if (count != 3) break;
801c49cc: 34020049 ori r2,r0,0x0049
801c49d0: 26310001 addiu r17,r17,0x0001             #               outerCount = outerCount + 1
801c49d4: 2a220049 slti r2,r17,0x0049
801c49d8: 1440fff0 bne r2,r0,0x801c499c
801c49dc: 24a50003 addiu r5,r5,0x0003               #               outerPtr = outerPtr + 3
                                                    #           } while (outerCount < 73);
801c49e0: 34020049 ori r2,r0,0x0049
801c49e4: 00008821 addu r17,r0,r0
801c49e8: 0c071792 jal 0x801c5e48                   #           ? 0x1c5e48 (battleUnitIndex);
801c49ec: 02402021 addu r4,r18,r0
801c49f0: 92050006 lbu r5,0x0006(r16)               #           battleENTDUnit.Flags_0x06           
801c49f4: 02002021 addu r4,r16,r0                   #           battleENTDUnit
801c49f8: 0c0166ec jal 0x80059bb0                   #           Save Unit to Party (battleENTDUnit, battleENTDUnit.Flags_0x06 & FLAG_JOIN_AS_GUEST);
801c49fc: 30a50001 andi r5,r5,0x0001                #           battleENTDUnit.Flags_0x06 & FLAG_JOIN_AS_GUEST
801c4a00: 080712a1 j 0x801c4a84                     #           continue;
801c4a04: 26520001 addiu r18,r18,0x0001
                                                    #       }
801c4a08: 34040021 ori r4,r0,0x0021                 #       0x21
801c4a0c: 306200f6 andi r2,r3,0x00f6                #       battleENTDUnit.Flags_0x06 & 0xf6        // Masks out "Load Formation" and "Join as Guest"
801c4a10: a2020006 sb r2,0x0006(r16)                #       battleENTDUnit.Flags_0x06 = battleENTDUnit.Flags_0x06 & 0xf6
801c4a14: 3c02801d lui r2,0x801d
801c4a18: 8c420b34 lw r2,0x0b34(r2)                 #       *0x801d0b34
801c4a1c: 92030161 lbu r3,0x0161(r16)               #       battleENTDUnit.ENTD_ID
801c4a20: 00021080 sll r2,r2,0x02                   #       *0x801d0b34 * 4
801c4a24: 3c01801d lui r1,0x801d
801c4a28: 00220821 addu r1,r1,r2
801c4a2c: ac2371f8 sw r3,0x71f8(r1)                 #       *(0x801d71f8 + (*0x801d0b34 * 4)) = battleENTDUnit.ENTD_ID
801c4a30: 0c04ed64 jal 0x8013b590                   #       var_0x21 = Get Script Variable (0x21);
801c4a34: 26940001 addiu r20,r20,0x0001             #       numJoinPrompts = numJoinPrompts + 1
801c4a38: 30420007 andi r2,r2,0x0007                #       var_0x21 & 7
801c4a3c: 3c04801d lui r4,0x801d
801c4a40: 8c840b34 lw r4,0x0b34(r4)                 #       *0x801d0b34
801c4a44: 92030000 lbu r3,0x0000(r16)               #       battleENTDUnit.BaseClass
801c4a48: 00042880 sll r5,r4,0x02                   #       *0x801d0b34 * 4
801c4a4c: 2463ff80 addiu r3,r3,-0x0080              #       battleENTDUnit.BaseClass - 0x80
801c4a50: 000318c0 sll r3,r3,0x03                   #       (battleENTDUnit.BaseClass - 0x80) * 8
801c4a54: 00621821 addu r3,r3,r2                    #       ((battleENTDUnit.BaseClass - 0x80) * 8) + (var_0x21 & 7)
801c4a58: 24631800 addiu r3,r3,0x1800               #       ((battleENTDUnit.BaseClass - 0x80) * 8) + (var_0x21 & 7) + 0x1800
801c4a5c: 24840001 addiu r4,r4,0x0001               #       *0x801d0b34 + 1
801c4a60: 3c01801d lui r1,0x801d
801c4a64: 00250821 addu r1,r1,r5
801c4a68: ac2372c0 sw r3,0x72c0(r1)                 #       *(0x801d72c0 + (*0x801d0b34 * 4)) = ((battleENTDUnit.BaseClass - 0x80) * 8) + (var_0x21 & 7) + 0x1800
801c4a6c: 3c01801d lui r1,0x801d
801c4a70: 00250821 addu r1,r1,r5
801c4a74: ac327388 sw r18,0x7388(r1)                #       *(0x801d7388 + (*0x801d0b34 * 4)) = battleUnitIndex
801c4a78: 3c01801d lui r1,0x801d
801c4a7c: ac240b34 sw r4,0x0b34(r1)                 #       *0x801d0b34 = *0x801d0b34 + 1
801c4a80: 26520001 addiu r18,r18,0x0001             #       (battleUnitIndex = battleUnitIndex + 1)
801c4a84: 2a420015 slti r2,r18,0x0015
801c4a88: 1440ff9a bne r2,r0,0x801c48f4             #   } while (battleUnitIndex < 21);
801c4a8c: 02801021 addu r2,r20,r0                   #   return numJoinPrompts;
                                                   
801c4a90: 8fbf002c lw r31,0x002c(r29)
801c4a94: 8fb40028 lw r20,0x0028(r29)
801c4a98: 8fb30024 lw r19,0x0024(r29)
801c4a9c: 8fb20020 lw r18,0x0020(r29)
801c4aa0: 8fb1001c lw r17,0x001c(r29)
801c4aa4: 8fb00018 lw r16,0x0018(r29)
801c4aa8: 27bd0030 addiu r29,r29,0x0030
801c4aac: 03e00008 jr r31
801c4ab0: 00000000 nop