Find War Trophies and Bonus Money

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: FIND WAR TROPHIES AND BONUS MONEY              Duplicated here : Store_some_ENTD_Data(War_Trophy,_gil),_party_level_calculation
#       Parameters:
#           r4 = (storePtr) Pointer to store into

80180e00: 00004021 addu r8,r0,r0                    #   warTrophyCount = 0
80180e04: 00004821 addu r9,r0,r0                    #   bonusMoney = 0
80180e08: 340a0063 ori r10,r0,0x0063                #   lowestUnitLevel = 99
80180e0c: 00002821 addu r5,r0,r0                    #   unitIndex = 0
80180e10: 340b00ff ori r11,r0,0x00ff                #   0xff
80180e14: 3c068019 lui r6,0x8019
80180e18: 24c608cc addiu r6,r6,0x08cc               #   unit = 0x801908cc
80180e1c: 00803821 addu r7,r4,r0                    #   storePtr
                                                    #   do {
80180e20: 90c20183 lbu r2,0x0183(r6)                #       unit.flags_0x183
80180e24: 00000000 nop
80180e28: 104b001b beq r2,r11,0x80180e98            #       if ((unit.flags_0x183 != 0xff)
80180e2c: 00000000 nop
80180e30: 10400019 beq r2,r0,0x80180e98             #           and (unit.flags_0x183 != 0))
80180e34: 00000000 nop                              #       {
80180e38: 90c30163 lbu r3,0x0163(r6)                #           unit.warTrophy
80180e3c: 00000000 nop
80180e40: 10600004 beq r3,r0,0x80180e54             #           if (unit.warTrophy != 0) {
80180e44: 00000000 nop
80180e48: a0e30000 sb r3,0x0000(r7)                 #               *storePtr = unit.warTrophy
80180e4c: 24e70001 addiu r7,r7,0x0001               #               storePtr = storePtr + 1
80180e50: 25080001 addiu r8,r8,0x0001               #               warTrophyCount = warTrophyCount + 1
                                                    #           }
80180e54: 90c20164 lbu r2,0x0164(r6)                #           unit.bonusMoneyMod
80180e58: 00000000 nop
80180e5c: 00021840 sll r3,r2,0x01                   #           unit.bonusMoneyMod * 2
80180e60: 00621821 addu r3,r3,r2                    #           unit.bonusMoneyMod * 3
80180e64: 000318c0 sll r3,r3,0x03                   #           unit.bonusMoneyMod * 24
80180e68: 00621821 addu r3,r3,r2                    #           unit.bonusMoneyMod * 25
80180e6c: 00031880 sll r3,r3,0x02                   #           unit.bonusMoneyMod * 100
80180e70: 90c20002 lbu r2,0x0002(r6)                #           unit.partyIndex
80180e74: 00000000 nop
80180e78: 104b0007 beq r2,r11,0x80180e98            
80180e7c: 01234821 addu r9,r9,r3                    #           bonusMoney = bonusMoney + unit.bonusMoneyMod * 100
                                                    #           if (unit.partyIndex != 0xff) {
80180e80: 90c30022 lbu r3,0x0022(r6)                #               unit.Level
80180e84: 00000000 nop
80180e88: 006a102b sltu r2,r3,r10
80180e8c: 10400002 beq r2,r0,0x80180e98             #               if (unit.Level < lowestUnitLevel) {
80180e90: 00000000 nop
80180e94: 00605021 addu r10,r3,r0                   #                   lowestUnitLevel = unit.Level
                                                    #               }
                                                    #           }
                                                    #       }
80180e98: 24a50001 addiu r5,r5,0x0001               #       unitIndex = unitIndex + 1
80180e9c: 28a20015 slti r2,r5,0x0015
80180ea0: 1440ffdf bne r2,r0,0x80180e20
80180ea4: 24c601c0 addiu r6,r6,0x01c0               #       unit = unit + sizeof(Unit)      // Go to next unit
                                                    #   } while (unitIndex < 21);
80180ea8: 01002821 addu r5,r8,r0                    #   warTrophyIndex = warTrophyCount
80180eac: 28a20015 slti r2,r5,0x0015
80180eb0: 10400007 beq r2,r0,0x80180ed0
80180eb4: a0880015 sb r8,0x0015(r4)                 #   *(storePtr + 0x15) = warTrophyCount
                                                    #   if (warTrophyIndex < 21) { 
80180eb8: 00a41821 addu r3,r5,r4                    #       warTrophyPtr = storePtr + warTrophyCount
                                                    #       do {
80180ebc: a0600000 sb r0,0x0000(r3)                 #           *warTrophyPtr = 0
80180ec0: 24a50001 addiu r5,r5,0x0001               #           warTrophyIndex = warTrophyIndex + 1
80180ec4: 28a20015 slti r2,r5,0x0015
80180ec8: 1440fffc bne r2,r0,0x80180ebc
80180ecc: 24630001 addiu r3,r3,0x0001               #           warTrophyPtr = warTrophyPtr + 1
                                                    #       } while (warTrophyIndex < 21)
                                                    #   }
80180ed0: 3c028019 lui r2,0x8019
80180ed4: 94423844 lhu r2,0x3844(r2)                #   *0x80193844
80180ed8: ac890018 sw r9,0x0018(r4)                 #   *(storePtr + 0x18) = bonusMoney
80180edc: 00021840 sll r3,r2,0x01                   #   *0x80193844 * 2
80180ee0: 00621821 addu r3,r3,r2                    #   *0x80193844 * 3
80180ee4: 000318c0 sll r3,r3,0x03                   #   *0x80193844 * 24
80180ee8: 00621821 addu r3,r3,r2                    #   *0x80193844 * 25
80180eec: 3c028019 lui r2,0x8019
80180ef0: 90423898 lbu r2,0x3898(r2)                #   *0x80193898
80180ef4: 00031880 sll r3,r3,0x02                   #   *0x80193844 * 100
80180ef8: 14400007 bne r2,r0,0x80180f18
80180efc: ac83001c sw r3,0x001c(r4)                 #   *(storePtr + 0x1c) = *0x80193844 * 100
                                                    #   if (*0x80193898 != 0) {
                                                    #       *(storePtr + 0x20) = 0; return;
                                                    #   }
80180f00: 3c038019 lui r3,0x8019
80180f04: 90633920 lbu r3,0x3920(r3)                #   *0x80193920
80180f08: 314500ff andi r5,r10,0x00ff               #   lowestUnitLevel
80180f0c: 00a3102b sltu r2,r5,r3
80180f10: 14400003 bne r2,r0,0x80180f20
80180f14: 00651823 subu r3,r3,r5                    #   value = *0x80193920 - lowestUnitLevel
                                                    #   if (lowestUnitLevel >= *0x80193920) {
80180f18: 080603ce j 0x80180f38
80180f1c: ac800020 sw r0,0x0020(r4)                 #       *(storePtr + 0x20) = 0
                                                    #   } else {
80180f20: 00031040 sll r2,r3,0x01                   #       value * 2  
80180f24: 00431021 addu r2,r2,r3                    #       value * 3
80180f28: 000210c0 sll r2,r2,0x03                   #       value * 24
80180f2c: 00431021 addu r2,r2,r3                    #       value * 25
80180f30: 00021080 sll r2,r2,0x02                   #       value * 100
80180f34: ac820020 sw r2,0x0020(r4)                 #       *(storePtr + 0x20) = value * 100
                                                    #   }
80180f38: 03e00008 jr r31
80180f3c: 00000000 nop

Return location

Battle.bin
801c71a0: Handle_War_Trophies_and_Bonus_Money