Mercurial > mm7
diff UI/UIHouses.cpp @ 1630:ee4a65ac9d21
TavernDialog cleared
author | Ritor1 |
---|---|
date | Tue, 17 Sep 2013 13:20:58 +0600 |
parents | 2149b14614ad |
children | 08ebd0fee604 ccde94f02b75 |
line wrap: on
line diff
--- a/UI/UIHouses.cpp Mon Sep 16 09:37:30 2013 +0600 +++ b/UI/UIHouses.cpp Tue Sep 17 13:20:58 2013 +0600 @@ -2387,112 +2387,53 @@ //----- (004B8285) -------------------------------------------------------- void TavernDialog() { - int v0; + int pPriceRoom; + int pPriceFood; + int pPriceSkill; int pItemNum; double v2; // st7@1 - signed int v3; // ebx@1 - int v4; // ecx@1 - int v5; // esi@3 - signed int v6; // edi@5 - int v7; // ecx@5 int pNumString; // edi@16 signed int v9; // esi@16 - unsigned int pNumActiveItem; // esi@18 - int v11; // eax@18 - unsigned int v12; // eax@19 - int v13; // eax@21 - int v14; // ecx@26 - int v17; // eax@28 - char *v18; // eax@30 - int v19; // eax@30 - unsigned int v20; // ecx@30 - int v21; // edx@30 - int v22; // eax@30 - unsigned __int16 v23; // ax@30 - int v24; // eax@34 - int v25; // eax@34 - char *v26; // esi@36 - int v27; // edi@46 unsigned int pColorText; // eax@57 - signed int v31; // eax@59 - int v34; // eax@64 - int v35; // ecx@64 - int v36; // esi@64 GUIButton *pButton; // eax@65 - int v39; // edx@69 - int v40; // ecx@69 - int v41; // ecx@69 - int v42; // ecx@70 - unsigned int v43; // edx@70 - int v44; // edx@71 - int v45; // ecx@71 - int v46; // ecx@72 - int v47; // eax@74 - signed int v48; // edi@77 + int pSkillCount; + signed int pOptionsCount; // edi@77 signed int i; // esi@79 - int v50; // eax@80 - _QWORD v52; // qax@81 signed int v53; // edi@81 int v54; // edi@81 - const char **v56; // eax@83 - int v57; // eax@83 - unsigned int v58; // ecx@83 - unsigned __int16 v60; // ax@83 - int v61; // eax@99 - char *v63; // eax@99 - GUIFont *v64; // edx@99 - GUIFont *v65; // edi@100 - unsigned int v66; // [sp-10h] [bp-284h]@75 - unsigned __int16 v67; // [sp-Ch] [bp-280h]@75 - int v68; // [sp-Ch] [bp-280h]@99 - char *v69; // [sp-8h] [bp-27Ch]@75 - int v70; // [sp-8h] [bp-27Ch]@99 - unsigned int v71; // [sp-4h] [bp-278h]@75 - const char *v72; // [sp-4h] [bp-278h]@93 - unsigned int v73; // [sp-4h] [bp-278h]@99 + const char *pText; // [sp-4h] [bp-278h]@93 char pTopic1[100]; // [sp+Ch] [bp-268h]@55 char pTopic4[100]; // [sp+70h] [bp-204h]@59 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 - char *Str[2]; // [sp+244h] [bp-30h]@30 + int v91; // [sp+270h] [bp-4h]@3 + unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 + unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 - int v83; // [sp+254h] [bp-20h]@1 - int all_text_height; // [sp+260h] [bp-14h]@18 - unsigned __int8 v87; // [sp+266h] [bp-Eh]@59 - unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 - int v89; // [sp+268h] [bp-Ch]@1 - unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 - int v91; // [sp+270h] [bp-4h]@3 - GUIFont *pOutString; unsigned __int8 pTopic4Height; int pTextHeight; + int all_text_height; // [sp+260h] [bp-14h]@18 + GUIFont *pOutString; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; dialog_window.uFrameZ = 334; v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - *(float *)&v83 = v2; - *(float *)&v89 = v2 * v2; - v3 = (signed __int64)(*(float *)&v89 * 0.1); - pItemNum = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pItemNum < v3 / 3 ) - pItemNum = v3 / 3; - v5 = 1; - pOutString = (GUIFont *)pItemNum; - if ( pItemNum <= 0 ) - pOutString = (GUIFont *)1; - v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998); - v7 = v6 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v7 < v6 / 3 ) - v7 = v6 / 3; - v83 = v7; - if ( v7 <= 0 ) - { - v7 = 1; - v83 = 1; - } + + pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) + pPriceRoom = ((v2 * v2) / 10) / 3; + if ( pPriceRoom <= 0 ) + pPriceRoom = 1; + + pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) + pPriceFood = ((v2 * v2) * v2 / 100) / 3; + if ( pPriceFood <= 0 ) + pPriceFood = 1; + switch(dialog_menu_id) { @@ -2502,14 +2443,14 @@ return; sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold strcat(pTopic1, pTmpBuf2.data()); pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); strcat(pTopic1, "\n \n"); sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold - (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83); + (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); strcat(pTopic2, pTmpBuf2.data()); pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); strcat(pTopic2, "\n \n"); @@ -2526,47 +2467,35 @@ pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); } - v36 = LOBYTE(pFontArrus->uFontHeight) - 3; if ( pDialogueWindow->pNumPresenceButton ) { - for ( pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pNumActiveItem ) + for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; + pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) { - pButton = pDialogueWindow->GetControl(pNumActiveItem); + pButton = pDialogueWindow->GetControl(pItemNum); if ( pButton->msg_param == 15 ) { - v46 = pTopic1Height; pButton->uHeight = pTopic1Height; pButton->uY = 146; - v41 = v46 + 145; - pButton->uW = v41; + pButton->uW = pTopic1Height + 145; } else if ( pButton->msg_param == 16 ) { - v44 = pTopic2Height; - v45 = pTopic1Height + v36 + 146; pButton->uHeight = pTopic2Height; - pButton->uY = v45; - v41 = v45 + v44 - 1; - pButton->uW = v41; + pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; + pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; } else if ( pButton->msg_param == 96 ) { - v42 = pTopic1Height + pTopic2Height + 2 * v36 + 146; - v43 = pTopic3Height; - pButton->uY = v42; - pButton->uHeight = v43; - v41 = v43 + v42 - 1; - pButton->uW = v41; + pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; + pButton->uHeight = pTopic3Height; + pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; } else if ( pButton->msg_param == 101 ) { - v39 = pTopic1Height + 3 * v36 + pTopic4Height + pTopic2Height + 146; - v40 = pTopic4Height; pButton->uHeight = pTopic4Height; - pButton->uY = v39; - v41 = v39 + v40 - 1; - pButton->uW = v41; + pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; + pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; } } sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); @@ -2586,11 +2515,9 @@ pOutString = pFontCreate; pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; } - auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->GetLeather(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight); + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - v63 = FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0); - window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); + window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); break; } case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: @@ -2598,13 +2525,11 @@ strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); dialog_window.uFrameWidth = game_viewport_width; dialog_window.uFrameZ = 452; - v61 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0); - pTextHeight = v61 + 7; - auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->GetLeather(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7)); + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - v63 = FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0); - window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); + window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, + FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); break; } case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: @@ -2614,43 +2539,42 @@ if ( pArcomageGame->uGameResult ) { if ( pArcomageGame->uGameResult == 1 ) - v72 = pGlobalTXT_LocalizationStrings[640];// You won! + pText = pGlobalTXT_LocalizationStrings[640];// You won! else - v72 = pGlobalTXT_LocalizationStrings[641];// You lost! + pText = pGlobalTXT_LocalizationStrings[641];// You lost! } else { - v72 = pGlobalTXT_LocalizationStrings[639];// A tie! + pText = pGlobalTXT_LocalizationStrings[639];// A tie! } - strcpy(pTmpBuf.data(), v72); - v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v66, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + strcpy(pTmpBuf.data(), pText); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, + TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); break; } case HOUSE_DIALOGUE_TAVERN_REST: { - if ( pParty->uNumGold >= (unsigned int)pOutString ) + if ( pParty->uNumGold >= pPriceRoom ) { - Party::TakeGold((unsigned int)pOutString); - v27 = (int)window_SpeakInHouse->ptr_1C;//107 + Party::TakeGold(pPriceRoom); PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); dialog_menu_id = HOUSE_DIALOGUE_NULL; sub_4BD8B5(); GetHouseGoodbyeSpeech(); pVideoPlayer->Unload(); - window_SpeakInHouse->Release(); - window_SpeakInHouse = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; - pMessageQueue_50CBD0->pMessages[0].param = v27; + pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; ++pMessageQueue_50CBD0->uNumMessages; + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; return; } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); break; } @@ -2658,74 +2582,60 @@ { if ( !HouseUI_CheckIfPlayerCanInteract() ) return; - v0 = 0; + pSkillCount = 0; v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pItemNum = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pItemNum < v9 / 3 ) - pItemNum = v9 / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPriceSkill < v9 / 3 ) + pPriceSkill = v9 / 3; all_text_height = 0; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; + pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) { - do - { - v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v12] - && !pPlayers[uActiveCharacter]->pActiveSkills[v12] ) - { - all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0); - v0++; - } - ++pNumActiveItem; - } - while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ); - if ( v0 ) + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(pItemNum)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(pItemNum)->msg_param - 36] ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v91 = (149 - all_text_height) / v0; - if ( (149 - all_text_height) / v0 > 32 ) - v91 = 32; - v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pItemNum = 2; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - v17 = pButton->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] - || pPlayers[uActiveCharacter]->pActiveSkills[v17] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v91 + v14; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v14 = pTextHeight + pButton->uY - 1; - pButton->uW = v14; - pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3); - } - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; - pItemNum++; - } - while ( pItemNum < pNumActiveItem ); - } - return; + all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(pItemNum)->msg_param - 36], &dialog_window, 0, 0); + pSkillCount++; } } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, + if ( pSkillCount ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v91 = (149 - all_text_height) / pSkillCount; + if ( (149 - all_text_height) / pSkillCount > 32 ) + v91 = 32; + v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; + for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; + pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; pItemNum++ ) + { + pButton = pDialogueWindow->GetControl(pItemNum); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v91 + v54; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v54 = pTextHeight + pButton->uY - 1; + pButton->uW = v54; + pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); + } + } + return; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь pClassNames[pPlayers[uActiveCharacter]->classType]); strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); return; @@ -2733,20 +2643,17 @@ case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: { - *(_QWORD *)Str = pParty->uNumFoodRations; - //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return; } - if ( pParty->uNumGold >= v7 ) + if ( pParty->uNumGold >= pPriceFood ) { - Party::TakeGold(v7); - //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; + Party::TakeGold(pPriceFood); pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); @@ -2754,7 +2661,7 @@ } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); break; } @@ -2762,42 +2669,34 @@ { if ( HouseUI_CheckIfPlayerCanInteract() ) { - v48 = 2; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; - pOutString = 0; - if ( pParty->HasItem(0x28Bu) ) - { - pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; - v48 = 3; - } - for ( i = 0; i < v48; ++i ) - all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - all_text_height = (174 - all_text_height) / v48; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138; - //v37 = -pDialogueWindow->pNumPresenceButton < 0; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + pOptionsCount = 2; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];//Правила + pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];//Условия победы + if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt { - pItemNum = 2; - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = all_text_height + v54; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v54 = pButton->uY + pTextHeight - 1; - pButton->uW = v54; - pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - pItemNum++; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( pItemNum < pNumActiveItem ); + pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];//Играть + pOptionsCount = 3; + } + for ( i = 0; i < pOptionsCount; ++i ) + all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + all_text_height = (174 - all_text_height) / pOptionsCount; + + v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; + pNumString = 0; + for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; + pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) + { + pButton = pDialogueWindow->GetControl(pItemNum); + pButton->uY = all_text_height + v54; + pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v54 = pButton->uY + pTextHeight - 1; + pButton->uW = v54; + pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + ++pNumString; } } break;