Mercurial > mm7
diff Party.cpp @ 1828:35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
author | Grumpy7 |
---|---|
date | Fri, 11 Oct 2013 07:04:19 +0200 |
parents | 0c75c3e7e436 |
children | e4e27261d84e |
line wrap: on
line diff
--- a/Party.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Party.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -819,7 +819,6 @@ signed __int64 v2; // qax@1 unsigned __int64 v4; // qax@1 unsigned int v5; // ebx@1 - Player *v6; // ebx@1 pParty->pHirelings[0].bHasUsedTheAbility = 0; pParty->pHirelings[1].bHasUsedTheAbility = 0; @@ -934,86 +933,54 @@ } } //----- (00420C05) -------------------------------------------------------- -void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) +void Party::PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) { - unsigned int v2; // edi@1 int hirelingSalaries; // ebp@1 unsigned int goldToGain; // esi@1 - int v5; // ecx@6 - NPCData *v6; // eax@6 - signed int v7; // edx@8 - signed int v8; // ebx@10 - char *v9; // edi@11 - signed int v10; // ecx@17 - int v11; // eax@21 NPCData *v12; // ecx@21 unsigned int v13; // ecx@23 signed int hirelingCount; // [sp+Ch] [bp-4h]@6 - v2 = 0; hirelingSalaries = 0; goldToGain = uNumGold; - if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) + + if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) + pTmpBuf2[0] = 0; + else if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) { - if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) - { - sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! - } - else - { - if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) - pTmpBuf2[0] = 0; - } - } + sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! + } else { hirelingCount = 0; - v5 = 0; - v6 = pParty->pHirelings; - do + for (int i = 0; i < 2; i++) { - if ( v6->pName ) + if (this->pHirelings[i].pName) { - v7 = hirelingCount++; - pTmpBuf[v7] = v5; + hirelingCount++; + pTmpBuf[hirelingCount] = i; } - ++v6; - ++v5; } - while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); - v8 = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) + for (uint i = 0; i < pNPCStats->uNumNewNPCs; i++) { - v9 = (char *)pNPCStats->pNewNPCData; - do + if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 + && (!this->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[0].pName)) + && (!this->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[1].pName)) ) { - if ( v9[8] & 0x80 - && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) - && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) - { - v10 = hirelingCount++; - pTmpBuf[v10] = v8 + 2; - } - ++v8; - v9 += 76; + hirelingCount++; + pTmpBuf[hirelingCount] = i + 2; } - while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); - v2 = 0; } - if ( hirelingCount > 0 ) + for (int i = 0; i < hirelingCount; i++) { - do - { - v11 = (unsigned __int8)pTmpBuf[v2]; - v12 = &pNPCStats->pNPCData[v11 + 499]; - if ( (unsigned __int8)pTmpBuf[v2] < 2 ) - v12 = &pParty->pHirelings[v11]; - v13 = v12->uProfession; - if ( v13 ) - hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); - ++v2; - } - while ( (signed int)v2 < hirelingCount ); + uchar thisBufId = (uchar)pTmpBuf[i]; + if (thisBufId < 2) + v12 = &this->pHirelings[thisBufId]; + else + v12 = &pNPCStats->pNPCData[thisBufId + 499]; + v13 = v12->uProfession; + if ( v13 ) + hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); } if ( CheckHiredNPCSpeciality(Factor) ) goldToGain += (signed int)(10 * goldToGain) / 100; @@ -1032,14 +999,13 @@ { sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold! } - v2 = 0; } - pParty->uNumGold += goldToGain - hirelingSalaries; - pUIAnim_Gold->uAnimTime = v2; + this->uNumGold += goldToGain - hirelingSalaries; + pUIAnim_Gold->uAnimTime = 0; pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; if ( pTmpBuf2[0] ) ShowStatusBarString(pTmpBuf2.data(), 2u); - pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); + pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); } //----- (00421B2C) -------------------------------------------------------- bool sub_421B2C_PlaceInInventory_or_DropPickedItem()