Mercurial > mm7
diff UI/UIHouses.cpp @ 1629:2149b14614ad
Слияние
author | Ritor1 |
---|---|
date | Mon, 16 Sep 2013 09:37:30 +0600 |
parents | 7ce831a2a393 2d374de0a364 |
children | ee4a65ac9d21 |
line wrap: on
line diff
--- a/UI/UIHouses.cpp Mon Sep 16 09:37:08 2013 +0600 +++ b/UI/UIHouses.cpp Mon Sep 16 09:37:30 2013 +0600 @@ -91,19 +91,19 @@ { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA - { 11, 11, 12, 12}, // HOUSE_STABLES_58 - { 13, 13, 13, 13}, // HOUSE_STABLES_59 - { 14, 14, 15, 15}, // HOUSE_STABLES_60 + { 11, 11, 12, 12}, // HOUSE_STABLES_BRACADA_DESERT + { 13, 13, 13, 13}, // HOUSE_STABLES_TATALIA + { 14, 14, 15, 15}, // HOUSE_STABLES_AVLEE {255, 255, 255, 255}, // HOUSE_STABLES_61 {255, 255, 255, 255}, // HOUSE_STABLES_62 - {255, 255, 255, 255}, // HOUSE_BOATS_63 - { 16, 17, 18, 19}, // HOUSE_BOATS_64 - { 18, 20, 21, 21}, // HOUSE_BOATS_65 - { 22, 23, 24, 25}, // HOUSE_BOATS_66 - { 22, 22, 23, 23}, // HOUSE_BOATS_67 + {255, 255, 255, 255}, // HOUSE_BOATS_EMERALD_ISLE + { 16, 17, 18, 19}, // HOUSE_BOATS_ERATHIA + { 18, 20, 21, 21}, // HOUSE_BOATS_TULAREAN_FOREST + { 22, 23, 24, 25}, // HOUSE_BOATS_BRACADA_DESERT + { 22, 22, 23, 23}, // HOUSE_BOATS_EVENMORN_ISLAND {255, 255, 255, 255}, // HOUSE_BOATS_68 - { 27, 28, 29, 30}, // HOUSE_BOATS_69 - { 31, 32, 33, 33}, // HOUSE_BOATS_70 + { 27, 28, 29, 30}, // HOUSE_BOATS_TATALIA + { 31, 32, 33, 33}, // HOUSE_BOATS_AVLEE { 24, 24, 24, 24}, // HOUSE_BOATS_71 {255, 255, 255, 255}, // HOUSE_BOATS_72 {255, 255, 255, 255} // HOUSE_BOATS_73 @@ -1920,14 +1920,11 @@ int schedule_id; // esi@39 GUIButton *pButton; // ebx@39 signed int v25; // eax@41 - unsigned int v30; // ecx@62 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 GUIWindow travel_window; // [sp+208h] [bp-88h]@1 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 - //unsigned int v60; // [sp+274h] [bp-1Ch]@36 int index; // [sp+27Ch] [bp-14h]@36 - //char *a1; // [sp+284h] [bp-Ch]@37 unsigned int pPrice; // [sp+288h] [bp-8h]@1 int travel_time; // [sp+28Ch] [bp-4h]@48 enum PlayerSpeech pSpeech; @@ -1962,8 +1959,8 @@ if (schedule_id != 255) { - if (schedule_id >= 25) - Log::Warning(L"Transport UI: scedule overflow"); + //if (schedule_id >= 25) + //Log::Warning(L"Transport UI: schedule overflow"); if ( pCurrentButton >= 6 ) v25 = true; else @@ -1971,9 +1968,9 @@ } if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit - || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) ) + || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//: { -//get color for current string( )------------ + //get color for current string( )---------- if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155)); else @@ -2007,9 +2004,8 @@ strcat(pTopicArray[index], "\n \n"); pButton->uY = pRealTextHeight; pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); - v30 = pButton->uY; pButton->uHeight = pTextHeight; - pButton->uW = v30 + pTextHeight - 1; + pButton->uW = pButton->uY + pTextHeight - 1; pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; } } @@ -2151,7 +2147,6 @@ int v17; // ebx@28 GUIButton *pButton; // eax@30 int pTextHeight; // eax@30 - unsigned int v23; // ecx@30 unsigned __int16 pTextColor; // ax@30 GUIWindow window; // [sp+60h] [bp-BCh]@21 GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 @@ -2192,14 +2187,13 @@ pButton = pDialogueWindow->GetControl(i); pButton->uY = v29 + v17; pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); - v23 = pButton->uY; pButton->uHeight = pTextHeight; - v17 = v23 + pTextHeight - 1; + v17 = pButton->uY + pTextHeight - 1; pButton->uW = v17; pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); - townHall_window.DrawTitleText(pFontArrus, 0, v23, pTextColor, pShopOptions[j], 3); + townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); ++v31; ++j; } @@ -2408,8 +2402,6 @@ unsigned int v12; // eax@19 int v13; // eax@21 int v14; // ecx@26 - //GUIButton *v15; // eax@28 - //GUIButton *v16; // esi@28 int v17; // eax@28 char *v18; // eax@30 int v19; // eax@30 @@ -2423,11 +2415,9 @@ int v27; // edi@46 unsigned int pColorText; // eax@57 signed int v31; // eax@59 - //GUIWindow *v33; // edi@64 int v34; // eax@64 int v35; // ecx@64 int v36; // esi@64 - char v37; // sf@64 GUIButton *pButton; // eax@65 int v39; // edx@69 int v40; // ecx@69 @@ -2441,15 +2431,12 @@ signed int v48; // edi@77 signed int i; // esi@79 int v50; // eax@80 - //GUIWindow *v51; // ecx@81 _QWORD v52; // qax@81 signed int v53; // edi@81 int v54; // edi@81 - //GUIButton *v55; // esi@83 const char **v56; // eax@83 int v57; // eax@83 unsigned int v58; // ecx@83 - //Player *v59; // edx@83 unsigned __int16 v60; // ax@83 int v61; // eax@99 char *v63; // eax@99 @@ -2467,14 +2454,10 @@ 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 v78; // [sp+19Ch] [bp-D8h]@99 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 char *Str[2]; // [sp+244h] [bp-30h]@30 - unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 int v83; // [sp+254h] [bp-20h]@1 - int pColorYellow; // [sp+258h] [bp-1Ch]@1 - Player *pPlayer; // [sp+25Ch] [bp-18h]@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 @@ -2485,18 +2468,15 @@ unsigned __int8 pTopic4Height; int pTextHeight; - pPlayer = pPlayers[uActiveCharacter]; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; dialog_window.uFrameZ = 334; - pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); - pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu); 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 - pPlayer->GetMerchant()) / 100; + pItemNum = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( pItemNum < v3 / 3 ) pItemNum = v3 / 3; v5 = 1; @@ -2504,7 +2484,7 @@ if ( pItemNum <= 0 ) pOutString = (GUIFont *)1; v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998); - v7 = v6 * (100 - pPlayer->GetMerchant()) / 100; + v7 = v6 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( v7 < v6 / 3 ) v7 = v6 / 3; v83 = v7; @@ -2521,36 +2501,36 @@ if ( !HouseUI_CheckIfPlayerCanInteract() ) return; - sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite); + 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 strcat(pTopic1, pTmpBuf2.data()); pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); strcat(pTopic1, "\n \n"); - sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite); + 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); strcat(pTopic2, pTmpBuf2.data()); pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); strcat(pTopic2, "\n \n"); - sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite); + sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0); strcat(pTopic3, "\n \n"); pTopic4[0] = 0; if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 ) { - sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite); + sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); } - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v36 = LOBYTE(pFontArrus->uFontHeight) - 3; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - if ( !(v37 ^ (pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton)) ) + if ( pDialogueWindow->pNumPresenceButton ) { - do + for ( pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pNumActiveItem ) { pButton = pDialogueWindow->GetControl(pNumActiveItem); if ( pButton->msg_param == 15 ) @@ -2588,14 +2568,9 @@ v41 = v39 + v40 - 1; pButton->uW = v41; } - pNumActiveItem++; - if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) - { - sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); - dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); - } } - while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ); + sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); + dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); } break; } @@ -2649,7 +2624,7 @@ } strcpy(pTmpBuf.data(), v72); v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf.data(), 3); + dialog_window.DrawTitleText(pFontArrus, 0, v66, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); break; } case HOUSE_DIALOGUE_TAVERN_REST: @@ -2685,7 +2660,7 @@ return; v0 = 0; v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100; + pItemNum = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; if ( pItemNum < v9 / 3 ) pItemNum = v9 / 3; pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; @@ -2695,7 +2670,8 @@ do { v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] ) + 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++; @@ -2719,7 +2695,8 @@ { pButton = pDialogueWindow->GetControl(pItemNum); v17 = pButton->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] ) + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] + || pPlayers[uActiveCharacter]->pActiveSkills[v17] ) { pButton->uW = 0; pButton->uHeight = 0; @@ -2732,9 +2709,9 @@ pButton->uHeight = pTextHeight; v14 = pTextHeight + pButton->uY - 1; pButton->uW = v14; - pColorText = pColorYellow; + pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3); } pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; @@ -2745,11 +2722,12 @@ return; } } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, + pClassNames[pPlayers[uActiveCharacter]->classType]); strcat(pTmpBuf.data(), "\n \n"); strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf.data(), 3); + dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); return; } @@ -2798,7 +2776,7 @@ 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; + //v37 = -pDialogueWindow->pNumPresenceButton < 0; if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) { pItemNum = 2; @@ -2811,9 +2789,9 @@ pButton->uHeight = pTextHeight; v54 = pButton->uY + pTextHeight - 1; pButton->uW = v54; - pColorText = pColorYellow; + pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); pItemNum++; ++pNumString; @@ -2833,407 +2811,282 @@ //----- (004B705E) -------------------------------------------------------- void TempleDialog() +{ + int pPrice; // edi@1 + int pTextHeight; // eax@11 + unsigned __int16 pTextColor; // ax@21 + DDM_DLV_Header *v26; // edi@29 + unsigned int v30; // edx@36 + int v35; // edi@50 + GUIButton *pButton; // edi@64 + int v47; // edi@71 + GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1 + unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64 + int v64; // [sp+1B8h] [bp-Ch]@6 + unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6 + int all_text_height; // [sp+1C0h] [bp-4h]@6 + + memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); + tample_window.uFrameX = 483; + tample_window.uFrameWidth = 148; + tample_window.uFrameZ = 334; + pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) + { + index = 1; + pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); + pButton->uHeight = 0; + pButton->uY = 0; + if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) { - //GUIWindow *v0; // ebx@1 - //Player *v1; // esi@1 - int v2; // edi@1 - int result; // eax@4 - GUIWindow *v4; // edi@6 - void *v5; // eax@6 - int v6; // eax@6 - unsigned int v7; // eax@8 - int v8; // ecx@8 - unsigned int v9; // eax@9 - int v10; // eax@11 - int v11; // eax@12 - GUIWindow *v12; // ecx@16 - int v13; // edx@16 - GUIButton *v14; // eax@19 - GUIButton *v15; // edi@19 - int v16; // eax@19 - const char *v17; // eax@21 - int v18; // eax@21 - unsigned int v19; // ecx@21 - int v20; // eax@21 - unsigned __int16 v21; // ax@21 - unsigned __int16 v22; // ST14_2@27 - int v23; // eax@27 - double v24; // st7@28 - unsigned int v25; // ebx@28 - DDM_DLV_Header *v26; // edi@29 - int v27; // eax@31 - int v28; // eax@32 - unsigned int v30; // edx@36 - unsigned int v31; // edx@38 - unsigned int v32; // edx@40 - unsigned int v33; // edx@42 - unsigned int v34; // edx@44 - int v35; // edi@50 - signed int v36; // eax@50 - unsigned __int8 v37; // al@54 - int v38; // ecx@54 - GUIWindow *v39; // eax@56 - unsigned __int8 v40; // al@61 - GUIButton *v41; // edi@64 - int v42; // esi@66 - GUIWindow *v43; // ecx@66 - int v44; // edi@66 - int v45; // eax@68 - signed int v46; // edi@69 - int v47; // edi@71 - GUIButton *v48; // eax@73 - const char *v49; // edx@73 - GUIButton *v50; // esi@73 - int v51; // eax@73 - unsigned int v52; // ecx@73 - unsigned __int16 v53; // ax@73 - char a1[300]; // [sp+10h] [bp-1B4h]@64 - GUIWindow v57; // [sp+13Ch] [bp-88h]@1 - __int64 v58; // [sp+190h] [bp-34h]@1 - __int64 v59; // [sp+198h] [bp-2Ch]@1 - __int64 v60; // [sp+1A0h] [bp-24h]@1 - GUIWindow *v61; // [sp+1ACh] [bp-18h]@6 - unsigned int v62; // [sp+1B0h] [bp-14h]@8 - unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 - int v64; // [sp+1B8h] [bp-Ch]@6 - unsigned int v65; // [sp+1BCh] [bp-8h]@6 - DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 - - //v0 = window_SpeakInHouse; - memcpy(&v57, window_SpeakInHouse, sizeof(v57)); - v57.uFrameX = 483; - v57.uFrameWidth = 148; - v57.uFrameZ = 334; - HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu); - HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu); - //v1 = pPlayers[uActiveCharacter]; - //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); - v2 = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); - HIDWORD(v60) = v2; - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) + sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"" "" + pShopOptions[0] = pTmpBuf.data(); + index = 0; + } + pShopOptions[1] = pGlobalTXT_LocalizationStrings[68];//"" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[160];//" " + all_text_height = 0; + if ( index < pDialogueWindow->pNumPresenceButton ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) + uint i = index; + for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j ) + { + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); + i++; + } + } + v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); + if ( v64 > 32 ) + v64 = 32; + all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; + if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + uint i = index; + for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; + (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) - { - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - v4 = pDialogueWindow; - v61 = pDialogueWindow; - v5 = window_SpeakInHouse->ptr_1C; - v66 = 0; - //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); - v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); - v6 = pPlayers[uActiveCharacter]->GetMerchant(); - v64 = (signed int)(v65 * (100 - v6)) / 100; - if ( v64 < (signed int)v65 / 3 ) - v64 = (signed int)v65 / 3; - v7 = v4->pStartingPosActiveItem; - v8 = v7 + v4->pNumPresenceButton; - v65 = 0; - v62 = v7; - if ( (signed int)v7 >= v8 ) - goto LABEL_78; - do - { - v9 = v4->GetControl(v62)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v9] && !pPlayers[uActiveCharacter]->pActiveSkills[v9] ) - { - v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v10); - ++v65; - } - v11 = v4->pStartingPosActiveItem; - ++v62; - } - while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); - if ( v65 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); - v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); - v64 = (149 - (signed int)v66) / (signed int)v65; - if ( v64 > 32 ) - v64 = 32; - v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; - v12 = v61; - result = v61->pStartingPosActiveItem; - v13 = result + v61->pNumPresenceButton; - v62 = v61->pStartingPosActiveItem; - if ( result < v13 ) - { - v66 = (DDM_DLV_Header *)2; - while ( 1 ) - { - v14 = v12->GetControl(v62); - v15 = v14; - v16 = v14->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v16] || pPlayers[uActiveCharacter]->pActiveSkills[v16] ) - { - v15->uW = 0; - v15->uHeight = 0; - v15->uY = 0; - } - else - { - v17 = pSkillNames[v16]; - v15->uY = v64 + v65; - HIDWORD(v60) = (uint32)v17; - v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); - v19 = v15->uY; - v15->uHeight = v18; - v20 = v19 + v18 - 1; - v15->uW = v20; - v65 = v20; - v21 = WORD2(v59); - if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) - v21 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); - } - result = (int)v61; - ++v62; - v66 = (DDM_DLV_Header *)((char *)v66 + 1); - if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) - break; - v12 = v61; - } - } - } - else - { -LABEL_78: - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - v22 = WORD2(v59); - v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v57, 0, 0); - v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u); - } - } - } - return; - } - // DONATION - //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - v25 = 0; - if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) - { - Party::TakeGold((signed __int64)v24); - v26 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v26 = &pIndoor->dlv; - v27 = v26->uReputation; - v66 = v26; - if ( v27 > -5 ) - { - v28 = v27 - 1; - v26->uReputation = v28; - if ( v28 < -5 ) - v26->uReputation = -5; - } - if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) - { - if ( v26->uReputation <= -5 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -10 ) - { - v31 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v31) = v31 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -15 ) - { - v32 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v32) = v32 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -20 ) - { - v33 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v33) = v33 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -25 ) - { - v34 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v34) = v34 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0); - } - } - ++byte_F8B1EF[uActiveCharacter]; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return; - } - if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) - return; - v25 = 0; - if ( pParty->uNumGold < v2 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return; - } - Party::TakeGold(v2); - v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]); - v59 = pPlayers[uActiveCharacter]->pConditions[14]; - v58 = pPlayers[uActiveCharacter]->pConditions[15]; - v60 = pPlayers[uActiveCharacter]->pConditions[16]; - v61 = (GUIWindow *)HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]); - memset(pPlayers[uActiveCharacter], 0, 0xA0u); - pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); - pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); - v36 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) - { - if ( (unsigned int)v61 | v35 ) - { - v37 = LOBYTE(pPlayers[uActiveCharacter]->uPrevFace); - v38 = pPlayers[uActiveCharacter]->uPrevVoiceID; - pPlayers[uActiveCharacter]->uCurrentFace = v37; - pPlayers[uActiveCharacter]->uVoiceID = v38; - ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); - } - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return; - } - v39 = v61; - if ( (unsigned int)v61 | v35 ) - { - LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35; - } - else - { - if ( !v60 && !v58 && !v59 ) - { - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return; - } - pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; - pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; - pPlayers[uActiveCharacter]->SetCondition(0x11u, 1); - pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; - v40 = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; - pPlayers[uActiveCharacter]->uCurrentFace = v40; - ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); - LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed); - v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); - } - HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39; + pButton = pDialogueWindow->GetControl(pCurrentItem); + pButton->uY = v64 + all_text_height; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + all_text_height = pButton->uW; + pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); + tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3); + i++; + index++; + } + } + return; + } + //------------------------------------------------- + if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) + { + if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) + return; + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//" " + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + Party::TakeGold(pPrice); + v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]); + memset(pPlayers[uActiveCharacter], 0, 0xA0u); + pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); + pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); + if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) ) + { + if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 ) + { + pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace; + pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID; + ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace); + } + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 ) + { + LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35; + } + else + { + if ( !pPlayers[uActiveCharacter]->pConditions[16] + && !pPlayers[uActiveCharacter]->pConditions[15] && !pPlayers[uActiveCharacter]->pConditions[14] ) + { pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return; // void func - } - v63 = 1; - v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); - strcpy(a1, ""); - v41->uHeight = 0; - v41->uY = 0; - if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; + pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; + pPlayers[uActiveCharacter]->SetCondition(0x11u, 1); + pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; + pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; + ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23); + LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed); + //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); + } + //HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39; + pPlayers[uActiveCharacter]->pConditions[17] =pParty->uTimePlayed; + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + //--------------------------------------------------- + if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) + { + pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + if ( pParty->uNumGold >= (unsigned int)pPrice ) + { + Party::TakeGold((unsigned int)pPrice); + v26 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v26 = &pIndoor->dlv; + if ( v26->uReputation > -5 ) + { + v26->uReputation = v26->uReputation - 1; + if ( v26->uReputation - 1 < -5 ) + v26->uReputation = -5; + } + if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) + { + if ( v26->uReputation <= -5 ) { - sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); - v63 = 0; + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); } - strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); - strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]); - v42 = v63; - v43 = pDialogueWindow; - v44 = v63; - v66 = 0; - if ( v63 < pDialogueWindow->pNumPresenceButton ) + if ( v26->uReputation <= -10 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -15 ) { - v61 = (GUIWindow *)&a1[100 * v63]; - do - { - v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v45); - v43 = pDialogueWindow; - v61 = (GUIWindow *)((char *)v61 + 100); - ++v44; - } - while ( v44 < pDialogueWindow->pNumPresenceButton ); + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -20 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -25 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0); } - v46 = v43->pNumPresenceButton - v42; - v64 = (174 - (signed int)v66) / v46; - if ( v64 > 32 ) - v64 = 32; - v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138; - v65 = v42 + v43->pStartingPosActiveItem; - if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton ) + } + ++byte_F8B1EF[uActiveCharacter]; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//" " + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + //------------------------------------------------ + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + all_text_height = 0; + pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; + if ( v64 < (signed int)pCurrentItem / 3 ) + v64 = (signed int)pCurrentItem / 3; + pCurrentItem = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) { - v61 = (GUIWindow *)(v42 + 2); - v66 = (DDM_DLV_Header *)&a1[100 * v42]; - do + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0); + ++pCurrentItem; + } + } + if ( pCurrentItem ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); + tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; + if ( v64 > 32 ) + v64 = 32; + all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; + if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pCurrentItem = 2; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) { - v48 = v43->GetControl(v65); - v49 = (const char *)v66; - v50 = v48; - v48->uY = v64 + v47; - v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0); - v52 = v50->uY; - v50->uHeight = v51; - v47 = v52 + v51 - 1; - v50->uW = v47; - v53 = WORD2(v59); - if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 ) - v53 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u); - v43 = pDialogueWindow; - v66 = (DDM_DLV_Header *)((char *)v66 + 100); - v61 = (GUIWindow *)((char *)v61 + 1); - ++v65; + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v64 + all_text_height; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + all_text_height = pButton->uW; + pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); + tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); } - while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + pCurrentItem++; + } } - return; + } + else + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//" %s %s -" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//" ." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); + tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + } } + } + return; +} //----- (004B4710) -------------------------------------------------------- void TrainingDialog() { - //Player *v0; // ebx@1 - int color2; // eax@1 - //unsigned int v2; // ecx@1 - //int v3; // eax@1 - //signed int v4; // edx@1 unsigned __int64 v5; // edi@3 - //unsigned int v6; // esi@3 - //void *v7; // ecx@3 int v8; // edx@4 double v9; // st7@6 signed int v10; // esi@6 - int v11; // ecx@6 - //int result; // eax@9 - GUIWindow *v13; // edi@14 + int pPrice; // ecx@6 signed int v14; // esi@14 unsigned int v15; // esi@16 int v16; // eax@16 unsigned int v17; // eax@17 - int v18; // eax@19 int v19; // ecx@24 GUIButton *v20; // eax@26 GUIButton *v21; // esi@26 @@ -3243,222 +3096,130 @@ unsigned int v25; // ecx@28 int v26; // eax@28 unsigned __int16 v27; // ax@28 - //int v28; // eax@32 unsigned __int16 v29; // ST14_2@34 int v30; // eax@34 - //const char *v31; // ST18_4@36 - //unsigned __int16 v32; // ST14_2@36 int v33; // eax@36 - int v34; // eax@37 - unsigned int v35; // edi@38 unsigned int v36; // eax@38 - //int v37; // ecx@41 - //char *v38; // eax@41 - //int *v39; // eax@45 - unsigned int v40; // eax@46 - //void *v41; // ecx@46 unsigned int v42; // eax@46 - GUIWindow *v43; // ecx@59 - int v44; // edx@59 - char **v45; // esi@60 - //int v46; // eax@62 - int v47; // eax@68 - //int v48; // edx@69 + int index; + int all_text_height; // eax@68 int v49; // ebx@69 - //unsigned __int8 v50; // sf@69 - char **v51; // edi@70 - GUIButton *v52; // eax@71 - GUIButton *v53; // esi@71 - int v54; // eax@71 - unsigned int v55; // ecx@71 - int v56; // eax@71 - unsigned __int16 v57; // ax@71 - unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 - //const char *v59; // [sp-Ch] [bp-90h]@63 - char *v60; // [sp-8h] [bp-8Ch]@38 - //char *v61; // [sp-8h] [bp-8Ch]@63 - unsigned int v62; // [sp-4h] [bp-88h]@38 - int v63; // [sp-4h] [bp-88h]@52 - //char *v64; // [sp-4h] [bp-88h]@63 - GUIWindow v65; // [sp+Ch] [bp-78h]@1 - //__int64 v66; // [sp+60h] [bp-24h]@3 - unsigned int white; // [sp+68h] [bp-1Ch]@1 + GUIButton *pButton; // eax@71 + int pTextHeight; // eax@71 + unsigned __int16 pTextColor; // ax@71 + GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 int v68; // [sp+6Ch] [bp-18h]@3 int v69; // [sp+70h] [bp-14h]@6 - //unsigned int i; // [sp+74h] [bp-10h]@1 - //int v71; // [sp+78h] [bp-Ch]@1 - int v72; // [sp+7Ch] [bp-8h]@16 int v73; // [sp+80h] [bp-4h]@14 - //v0 = pPlayers[uActiveCharacter]; - memcpy(&v65, window_SpeakInHouse, sizeof(v65)); - v65.uFrameX = 483; - v65.uFrameWidth = 148; - v65.uFrameZ = 334; - white = TargetColor(255, 255, 255); - color2 = TargetColor(0xE1u, 0xCDu, 0x23u); - //v71 = color2; - //v2 = v0->uLevel; - //v3 = 0; - //v4 = 0; - //for ( i = v2; v4 < (signed int)v2; ++v4 ) - // v3 += v4 + 1; - //v5 = 1000 * v3; + memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); + training_dialog_window.uFrameX = 483; + training_dialog_window.uFrameWidth = 148; + training_dialog_window.uFrameZ = 334; v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 - //v6 = HIDWORD(v0->uExperience); - //v7 = window_SpeakInHouse->ptr_1C; v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; - //v66 = 1000 * v3; if (pPlayers[uActiveCharacter]->uExperience >= v5) { v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; if ( v8 == 4 ) v8 = 3; v9 = (double)pPlayers[uActiveCharacter]->uLevel; - //i = 0; v69 = v8; - //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); - v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v11 < v10 / 3 ) - v11 = v10 / 3; - //i = v11; + pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v10 / 3 ) + pPrice = v10 / 3; } - +//------------------------------------------------------- + all_text_height = 0; if (HouseUI_CheckIfPlayerCanInteract()) { - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + if (HouseUI_CheckIfPlayerCanInteract()) { - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + index = 0; + pShopOptions[0] = pTmpBuf.data(); + pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" + if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) { - if (HouseUI_CheckIfPlayerCanInteract()) + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - //i = 0; - int _v0 = 0; - v13 = pDialogueWindow; - //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v73 < v14 / 3 ) - v73 = v14 / 3; - v15 = v13->pStartingPosActiveItem; - v16 = v13->pNumPresenceButton; - v72 = 0; - if ( (signed int)v15 >= (signed int)(v15 + v16) ) - goto LABEL_76; - do - { - v17 = v13->GetControl(v15)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) - { - v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); - _v0 += v18; - ++v72; - } - ++v15; - } - while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem ); - if ( v72 ) + if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" - v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); - v73 = (signed int)(149 - _v0) / v72; - if ( v73 > 32 ) - v73 = 32; - //result = v13->pStartingPosActiveItem; - v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162; - int _v1 = v13->pStartingPosActiveItem; - v68 = v19; - if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton ) + if (pPlayers[uActiveCharacter]->uLevel >= v68) + sprintfex(pShopOptions[index], "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you." + else { - v72 = 2; - do - { - v20 = v13->GetControl(_v1); - v21 = v20; - v22 = v20->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) - { - v21->uW = 0; - v21->uHeight = 0; - v21->uY = 0; - } - else - { - v23 = pSkillNames[v22]; - v21->uY = v73 + v68; - //HIDWORD(v66) = (int)v23; - v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0); - v25 = v21->uY; - v21->uHeight = v24; - v26 = v25 + v24 - 1; - v21->uW = v26; - v68 = v26; - v27 = color2; - if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) - v27 = white; - v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u); - } - ++_v1; - ++v72; - } - while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton ); + if (pPlayers[uActiveCharacter]->uExperience < v5) + sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d" + else + sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" } } - else - { -LABEL_76: - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v29 = color2; - v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0); - v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3u); - } + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); + ++index; } } - return; + v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; + if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) + { + int pCurrentItem = 2; + index = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = (174 - all_text_height) / 2 + v49; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pTextHeight + pButton->uY - 1; + v49 = pButton->uW; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) + pTextColor = TargetColor(255, 255, 255); + training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); + ++pCurrentItem; + ++index; + } + } } + } +//------------------------------------------------------------------ + if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + { if ( !HouseUI_CheckIfPlayerCanInteract() ) { - //v31 = pNPCTopics[122].pText; - //v32 = color2; - v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); - v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3); + v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); + training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); pDialogueWindow->pNumPresenceButton = 0; return; } - v34 = pPlayers[uActiveCharacter]->uLevel; - if ( v34 < v68 ) + //v34 = pPlayers[uActiveCharacter]->uLevel; + if ( pPlayers[uActiveCharacter]->uLevel < v68 ) { if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) { - if ( pParty->uNumGold >= v11) + if ( pParty->uNumGold >= pPrice) { - Party::TakeGold(v11); + Party::TakeGold(pPrice); PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); ++pPlayers[uActiveCharacter]->uLevel; pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); - uint max_level_in_party = player_levels[0]; for (uint _it = 1; _it < 4; ++_it) { if (player_levels[_it] > max_level_in_party) max_level_in_party = player_levels[_it]; } - ++player_levels[uActiveCharacter - 1]; if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level // feature is broken thou, since this array is always zeroed in EnterHouse { - v40 = _494820_training_time(pParty->uCurrentHour); - //v41 = window_SpeakInHouse->ptr_1C; - v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; + v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) v42 += 720; @@ -3474,115 +3235,112 @@ return; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - v63 = 4; -LABEL_55: - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63); -//LABEL_56: - /*result = pMessageQueue_50CBD0->uNumMessages; - if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; - *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - } - return result;*/ + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); return; } - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// // "You need %d more experience to train to level %d" - v35 = 0; - v62 = 3; - v60 = pTmpBuf.data(); - v58 = color2; - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 88; + v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; } else { sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// // ""With your skills, you should be working here as a teacher."" // ""Sorry, but we are unable to train you."" - v35 = 0; - v62 = 3; - v60 = pTmpBuf.data(); - v58 = color2; - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 101; + v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; } - v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); - v63 = 3; - goto LABEL_55; + training_dialog_window.DrawTitleText(pFontArrus, 0, v36, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; } - + } +//------------------------------------------------------------- + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { if (HouseUI_CheckIfPlayerCanInteract()) { - v43 = pDialogueWindow; - v72 = 0; - pShopOptions[0] = pTmpBuf.data(); - pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v44 = pDialogueWindow->pNumPresenceButton; - v73 = pDialogueWindow->pStartingPosActiveItem; - if ( v73 < v73 + v44 ) + v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( v73 < v14 / 3 ) + v73 = v14 / 3; + v15 = pDialogueWindow->pStartingPosActiveItem; + v16 = pDialogueWindow->pNumPresenceButton; + index = 0; + if ( (signed int)v15 >= (signed int)(v15 + v16) ) + goto LABEL_76; + do + { + v17 = pDialogueWindow->GetControl(v15)->msg_param - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v17], &training_dialog_window, 0, 0); + ++index; + } + ++v15; + } + while ( (signed int)v15 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + if ( index ) { - v45 = pShopOptions.data(); - do + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" + training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v73 = (signed int)(149 - all_text_height) / index; + if ( v73 > 32 ) + v73 = 32; + v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; + int _v1 = pDialogueWindow->pStartingPosActiveItem; + v68 = v19; + if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) { - if ( v43->GetControl(v73)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + index = 2; + do { - //v46 = pPlayers[uActiveCharacter]->uLevel; - if (pPlayers[uActiveCharacter]->uLevel >= v68) - sprintfex(*v45, "%s\n \n%s", - pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you." + v20 = pDialogueWindow->GetControl(_v1); + v21 = v20; + v22 = v20->msg_param - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) + { + v21->uW = 0; + v21->uHeight = 0; + v21->uY = 0; + } else { - if (pPlayers[uActiveCharacter]->uExperience < v5) - sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d" - (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); - else - sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold" - pPlayers[uActiveCharacter]->uLevel + 1, v11); + v23 = pSkillNames[v22]; + v21->uY = v73 + v68; + //HIDWORD(v66) = (int)v23; + v24 = pFontArrus->CalcTextHeight(v23, &training_dialog_window, 0, 0); + v25 = v21->uY; + v21->uHeight = v24; + v26 = v25 + v24 - 1; + v21->uW = v26; + v68 = v26; + v27 = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != index ) + v27 = TargetColor(255, 255, 255); + training_dialog_window.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3); } + ++_v1; + ++index; } - v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); - v43 = pDialogueWindow; - v72 += v47; - ++v45; - ++v73; + while ( (signed int)_v1 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ); } - while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); } - - v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; - v73 = v43->pStartingPosActiveItem; - if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton) + else { - int _v3 = 2; - v51 = pShopOptions.data(); - do - { - v52 = v43->GetControl(v73); - v53 = v52; - v52->uY = (174 - v72) / 2 + v49; - v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0); - v55 = v53->uY; - v53->uHeight = v54; - v56 = v54 + v55 - 1; - v53->uW = v56; - v49 = v56; - v57 = color2; - if ( pDialogueWindow->pCurrentPosActiveItem != _v3 ) - v57 = white; - v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); - v43 = pDialogueWindow; - ++_v3; - ++v51; - ++v73; - } - while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton); +LABEL_76: + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + v29 = TargetColor(0xE1u, 0xCDu, 0x23u); + v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); + training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3); } } } + return; } //----- (004B6478) -------------------------------------------------------- @@ -3810,8 +3568,6 @@ int v38; // eax@52 signed int v39; // ecx@54 int v40; // edi@57 - GUIButton *v41; // eax@60 - GUIButton *v42; // esi@60 const char *v43; // ebx@60 int v44; // eax@60 unsigned int v45; // ecx@60 @@ -4024,15 +3780,15 @@ v40 = (174 - (signed int)pNPC * v39 - v34) / 2 - (signed int)pNPC / 2 + 138; for ( i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - v41 = pDialogueWindow->GetControl(i); - v42 = v41; - v43 = v41->pButtonName; - v41->uY = (unsigned int)((char *)pNPC + v40); - v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); - v45 = v42->uY; - v42->uHeight = v44; + pButton = pDialogueWindow->GetControl(i); + //v42 = v41; + v43 = pButton->pButtonName; + pButton->uY = (unsigned int)((char *)pNPC + v40); + v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &v52, 0, 0); + v45 = pButton->uY; + pButton->uHeight = v44; v40 = v45 + v44 - 1; - v42->uW = v40; + pButton->uW = v40; v46 = TargetColor(0xE1u, 0xCDu, 0x23u); if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) v46 = TargetColor(0xFFu, 0xFFu, 0xFFu); @@ -4060,19 +3816,12 @@ //----- (004B4F4F) -------------------------------------------------------- void JailDialog() { - const char *v0; // esi@1 - const char *v1; // ST10_4@1 - unsigned __int16 v2; // ST0C_2@1 - int v3; // eax@1 - GUIWindow v5; // [sp+8h] [bp-54h]@1 + GUIWindow jail_dialogue_window; // [sp+8h] [bp-54h]@1 - memcpy(&v5, window_SpeakInHouse, sizeof(v5)); - v0 = pGlobalTXT_LocalizationStrings[672]; - v1 = pGlobalTXT_LocalizationStrings[672]; - v5.uFrameX = 483; - v5.uFrameWidth = 148; - v5.uFrameZ = 334; - v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0); - v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u); + memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); + jail_dialogue_window.uFrameX = 483; + jail_dialogue_window.uFrameWidth = 148; + jail_dialogue_window.uFrameZ = 334; + jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, + TargetColor(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3); } \ No newline at end of file