Mercurial > mm7
changeset 2252:cd80d91b780f
Слияние
author | Ritor1 |
---|---|
date | Wed, 26 Feb 2014 20:10:50 +0600 |
parents | 47bcb700b74b (current diff) 3cc3a29f073b (diff) |
children | 2e02c384c62b |
files | |
diffstat | 5 files changed, 100 insertions(+), 126 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.cpp Wed Feb 26 20:10:43 2014 +0600 +++ b/Items.cpp Wed Feb 26 20:10:50 2014 +0600 @@ -3028,3 +3028,44 @@ return result; } + +//----- (004BDAAF) -------------------------------------------------------- +bool ItemGen::MerchandiseTest(int _2da_idx) +{ + bool test; + + if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)this->uItemID < 740 || (signed int)this->uItemID > 771) + && ((signed int)this->uItemID >= 600 || (signed int)this->uItemID >= 529 && (signed int)this->uItemID <= 599) || this->IsStolen()) + return false; + switch( p2DEvents[_2da_idx - 1].uType ) + { + case BuildingType_WeaponShop: + { + test = this->GetItemEquipType() <= EQUIP_BOW; + break; + } + case BuildingType_ArmorShop: + { + test = this->GetItemEquipType() >= EQUIP_ARMOUR && this->GetItemEquipType() <= EQUIP_BOOTS; + break; + } + case BuildingType_MagicShop: + { + test = this->GetPlayerSkillType() == PLAYER_SKILL_MISC || this->GetItemEquipType() == EQIUP_ANY; + break; + } + case BuildingType_AlchemistShop: + { + test = this->GetItemEquipType() == EQUIP_REAGENT || this->GetItemEquipType() == EQUIP_POTION + || (this->GetItemEquipType() > EQUIP_POTION && !(this->GetItemEquipType() != EQUIP_MESSAGE_SCROLL + || (signed int)this->uItemID < 740) && this->uItemID != 771); + break; + } + default: + { + test = false; + break; + } + } + return test; +} \ No newline at end of file
--- a/Items.h Wed Feb 26 20:10:43 2014 +0600 +++ b/Items.h Wed Feb 26 20:10:50 2014 +0600 @@ -251,7 +251,7 @@ unsigned __int8 GetDamageDice(); unsigned __int8 GetDamageRoll(); unsigned __int8 GetDamageMod(); - + bool MerchandiseTest(int _2da_idx); int uItemID; //0 int uEnchantmentType; //4 int m_enchantmentStrength; //8
--- a/UI/UIShops.cpp Wed Feb 26 20:10:43 2014 +0600 +++ b/UI/UIShops.cpp Wed Feb 26 20:10:50 2014 +0600 @@ -1540,7 +1540,7 @@ || pMouse->GetCursorPos(&cursor)->x >= 462 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) return; - if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) { dword_F8B1E4 = 1; pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); @@ -1566,7 +1566,7 @@ item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; if ( !(item->uAttributes & ITEM_IDENTIFIED) ) { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) + if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) { if ( pParty->uNumGold >= uPriceItemService ) { @@ -1606,7 +1606,7 @@ uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); if ( item->uAttributes & ITEM_BROKEN ) { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) + if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) { if ( pParty->uNumGold >= uPriceItemService ) { @@ -1650,61 +1650,48 @@ if ( pMapStats->GetMapInfo(pCurrentMapName) ) a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; party_reputation = pParty->GetPartyReputation(); - if (pPlayers[uActiveCharacter]->CanSteal()) + if (pPlayers[uActiveCharacter]->CanSteal() && GetAsyncKeyState(VK_CONTROL)) { - if ( GetAsyncKeyState(VK_CONTROL) ) - { uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); if ( !uNumSeconds ) { sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); return; } - } } - if ( pParty->uNumGold < uPriceItemService ) + else if (pParty->uNumGold < uPriceItemService) { - if ( uNumSeconds != 2 ) - { - if ( uNumSeconds != 1 ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - return; - } - } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" + return; } v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); if ( v39 ) { bought_item->SetIdentified(); memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); - if ( pPlayers[uActiveCharacter]->CanSteal() ) + if (uNumSeconds != 0) { - if ( GetAsyncKeyState(VK_CONTROL) ) - { - if ( uNumSeconds == 1 || uNumSeconds == 2 ) - { - pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - } + pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); } - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); + else + { + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + } viewparams->bRedrawGameUI = 1; bought_item->Reset(); pRenderer->ClearZBuffer(0, 479); pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); return; } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" + else + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" + return; + } break; } default:// if click video screen in shop
--- a/mm7_4.cpp Wed Feb 26 20:10:43 2014 +0600 +++ b/mm7_4.cpp Wed Feb 26 20:10:50 2014 +0600 @@ -1674,60 +1674,45 @@ } //----- (004B1447) -------------------------------------------------------- -void sub_4B1447_party_fine(int a1, int a2, int a3) +void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd) { signed int v3; // esi@1 - char v4; // sf@8 - int v5; // eax@8 - unsigned __int64 v6; // qax@12 DDM_DLV_Header *v7; // eax@14 - v3 = 0; - if ( a2 ) + if ( stealingResult == 0 || stealingResult == 1) { - if ( a2 == 1 ) + if ( pParty->uFine < 4000000 ) + { + if ( fineToAdd + pParty->uFine < 0 ) + pParty->uFine = 0; + else if ( fineToAdd + pParty->uFine > 4000000 ) + pParty->uFine = 4000000; + else + pParty->uFine += fineToAdd; + } + if ( pParty->uFine ) + { + for ( uint i = 1; i <= 4; ++i ) + { + if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) ) + _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); + } + } + if (stealingResult == 1) v3 = 2; - if ( a2 == 2 ) - v3 = 2; - goto LABEL_13; + else + v3 = 1; } else - v3 = 1; - if ( pParty->uFine < 4000000 ) - { - v4 = a3 + pParty->uFine < 0; - v5 = a3 + pParty->uFine; - pParty->uFine += a3; - if ( v4 ) - { - v5 = 0; - pParty->uFine = 0; - } - if ( v5 > 4000000 ) - pParty->uFine = 4000000; - } - - pParty->PartyTimes._shop_ban_times[a1] = pParty->uTimePlayed + 368640; - -LABEL_13: - pParty->InTheShopFlags[a1] = 1; - if ( v3 ) - { - v7 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v7 = &pIndoor->dlv; - v7->uReputation += v3; - if ( v7->uReputation > 10000 ) - v7->uReputation = 10000; - } - for ( uint i = 1; i <= 4; ++i ) - { - if ( pParty->uFine ) - { - if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) ) - _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); - } - } + v3 = 2; + pParty->PartyTimes._shop_ban_times[shopId] = pParty->uTimePlayed + 368640; + pParty->InTheShopFlags[shopId] = 1; + v7 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v7 = &pIndoor->dlv; + v7->uReputation += v3; + if ( v7->uReputation > 10000 ) + v7->uReputation = 10000; } @@ -2104,12 +2089,12 @@ sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],// ^Pr[%s] ^Pr[%s] ^I[%lu] ^L[;;] pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);// } - if ( masteryLevelBeingTaught == 3 ) + else if ( masteryLevelBeingTaught == 3 ) { sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);// } - if ( masteryLevelBeingTaught == 4 ) + else if ( masteryLevelBeingTaught == 4 ) sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);// return pTmpBuf2.data(); @@ -2139,6 +2124,8 @@ //----- (004B3FE5) -------------------------------------------------------- +//Originally called _4B254D_SkillMasteryTeacher to have contract_approved assigned, to be able to set some button name. +//But it the name gets immediately overwritten void _4B3FE5_training_dialogue(int a4) { const char *v2; // edi@1 @@ -2345,43 +2332,3 @@ dword_7241C8 = 0; } -//----- (004BDAAF) -------------------------------------------------------- -bool MerchandiseTest(ItemGen *item, int _2da_idx) -{ - bool test; - - if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) - && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->IsStolen()) - return false; - switch( p2DEvents[_2da_idx - 1].uType ) - { - case BuildingType_WeaponShop: - { - test = item->GetItemEquipType() <= EQUIP_BOW; - break; - } - case BuildingType_ArmorShop: - { - test = item->GetItemEquipType() >= EQUIP_ARMOUR && item->GetItemEquipType() <= EQUIP_BOOTS; - break; - } - case BuildingType_MagicShop: - { - test = item->GetPlayerSkillType() == PLAYER_SKILL_MISC || item->GetItemEquipType() == EQIUP_ANY; - break; - } - case BuildingType_AlchemistShop: - { - test = item->GetItemEquipType() == EQUIP_REAGENT || item->GetItemEquipType() == EQUIP_POTION - || (item->GetItemEquipType() > EQUIP_POTION && !(item->GetItemEquipType() != EQUIP_MESSAGE_SCROLL - || (signed int)item->uItemID < 740) && item->uItemID != 771); - break; - } - default: - { - test = false; - break; - } - } - return test; -}
--- a/mm7_unsorted_subs.h Wed Feb 26 20:10:43 2014 +0600 +++ b/mm7_unsorted_subs.h Wed Feb 26 20:10:50 2014 +0600 @@ -175,7 +175,6 @@ void UI_CreateEndConversationButton(); void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); int HouseDialogPressCloseBtn(); -bool MerchandiseTest(ItemGen *item, int _2da_idx); void UIShop_Buy_Identify_Repair(); bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); void ODM_LoadAndInitialize(const char *pLevelFilename, struct ODMRenderParams *thisa); @@ -219,7 +218,7 @@ int GetSoundStrengthByDistanceFromParty(int x, int y, int z); void PlayLevelMusic(); unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb -void sub_4B1447_party_fine(int a1, int a2, int a3); +void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd); void sub_4B1523_showSpellbookInfo(int spellItemId); void ShowPopupShopItem(); void RestAndHeal(__int64 uNumMinutes); // idb