# HG changeset patch # User Ritor1 # Date 1380519715 -21600 # Node ID 999bf8c9951460210cfaef3d97b1ddba6710f690 # Parent 07c7f446a92934006ad6949f303cef23e5a2140a# Parent 42a1874a2171689768b10fe047b47a30b58240f6 Слияние diff -r 42a1874a2171 -r 999bf8c99514 UI/UIShops.cpp --- a/UI/UIShops.cpp Mon Sep 30 06:09:29 2013 +0200 +++ b/UI/UIShops.cpp Mon Sep 30 11:41:55 2013 +0600 @@ -689,10 +689,10 @@ signed int v5; // esi@9 int v18; // eax@23 char *pText; // edx@29 - unsigned int v47; // edi@55 - unsigned int v48; // esi@57 - unsigned int v51; // edi@67 - unsigned int v52; // esi@69 + unsigned int product_height_1row; // edi@55 + unsigned int product_width_1row; // esi@57 + unsigned int product_height_2row; // edi@67 + unsigned int product_width_2row; // esi@69 ItemGen *item; // esi@118 int v71; // eax@123 int all_text_height; // edi@125 @@ -750,47 +750,47 @@ { if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) { - v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; - if ( (signed int)v47 < 1 ) - v47 = 0; - v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) - v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; } } - else if ( (signed int)v48 < 18 ) - v48 = 18; - pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); + else if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1); } } for ( uint i = 0; i < 6; ++i ) { if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) { - v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; + if ( (signed int)product_height_2row < 1 ) + product_height_2row = 0; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) - v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; } } else { - if ( (signed int)v52 < 18 ) - v52 = 18; + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; } - pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7); } } if ( HouseUI_CheckIfPlayerCanInteract() ) @@ -835,50 +835,50 @@ { if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; - if ( (signed int)v47 < 1 ) - v47 = 0; - v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) - v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; } } else { - if ( (signed int)v48 < 18 ) - v48 = 18; + if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; } - pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1); } } for ( uint i = 0; i < 6; ++i ) { if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid { - v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; + if ( (signed int)product_height_2row < 1 ) + product_height_2row = 0; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) - v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; } } else { - if ( (signed int)v52 < 18 ) - v52 = 18; + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; } - pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7); } } if ( HouseUI_CheckIfPlayerCanInteract() ) @@ -1062,125 +1062,30 @@ //----- (004B4FCF) -------------------------------------------------------- void MagicShopDialog() { - int result; // eax@6 - signed int v2; // esi@8 - unsigned int v3; // ebx@10 - char *v4; // eax@11 - char *v5; // eax@12 - unsigned int v6; // eax@12 - int v7; // ST08_4@14 - int v8; // eax@14 - unsigned __int8 v9; // dl@14 - char *v10; // ecx@14 - signed int v11; // esi@16 - int v12; // ST08_4@19 - int v13; // eax@19 int all_text_height; // edi@21 - char **v15; // esi@21 - int v16; // eax@22 - int v18; // edx@23 - int v19; // edi@23 - unsigned __int8 v20; // sf@23 GUIButton *control_button; // esi@25 - const char **v22; // eax@25 int v23; // eax@25 - unsigned int v24; // ecx@25 - const char **v25; // edx@25 unsigned __int16 text_color; // ax@25 - signed int pTextHeight; // esi@30 - int v28; // ST08_4@34 - int v29; // eax@34 char *v30; // edx@35 - void *v32; // eax@40 signed int v33; // esi@40 - unsigned int v34; // esi@42 - int v35; // eax@42 - unsigned int v36; // eax@43 - int v37; // eax@45 - int v38; // ecx@50 - int v41; // eax@52 - char *v42; // eax@54 - int v43; // eax@54 - unsigned int v44; // ecx@54 - int v45; // edx@54 - int v46; // eax@54 - unsigned __int16 v47; // ax@54 - int v48; // eax@58 - signed int v49; // esi@62 - Texture *v50; // ecx@64 - unsigned int v51; // edi@64 - unsigned int v52; // esi@66 - int v53; // edx@70 - Texture *v54; // ecx@76 - unsigned int v55; // edi@76 - unsigned int v56; // esi@76 - int v57; // edx@80 - unsigned int v59; // edi@86 - unsigned int v60; // esi@88 - int v61; // edx@92 - unsigned int v63; // edi@98 - unsigned int v64; // esi@100 - int v65; // edx@104 - signed int v66; // ecx@109 - SHORT v67; // di@117 - bool v68; // eax@117 - const char *v69; // ecx@119 - POINT *v70; // esi@124 - int v71; // ecx@125 - int v73; // ecx@125 + unsigned int product_height_1row; // edi@64 + unsigned int product_width_1row; // esi@66 + unsigned int product_height_2row; // edi@76 + unsigned int product_width_2row; // esi@76 int v75; // eax@130 - int v78; // eax@132 - int v80; // edx@133 - int v81; // edi@133 - const char **v83; // eax@135 - int v84; // eax@135 - unsigned int v85; // ecx@135 - int v86; // edx@135 - int v89; // [sp-14h] [bp-10Ch]@35 - int v91; // [sp-10h] [bp-108h]@35 - unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 - void *v93; // [sp-Ch] [bp-104h]@14 - int v94; // [sp-8h] [bp-100h]@11 - char *v95; // [sp-8h] [bp-100h]@12 - __int64 *v96; // [sp-4h] [bp-FCh]@11 - unsigned int v97; // [sp-4h] [bp-FCh]@12 - POINT v98; // [sp+Ch] [bp-ECh]@8 - POINT v99; // [sp+14h] [bp-E4h]@16 - POINT v100; // [sp+1Ch] [bp-DCh]@124 - POINT v101; // [sp+24h] [bp-D4h]@17 - POINT v102; // [sp+2Ch] [bp-CCh]@124 - POINT v103; // [sp+34h] [bp-C4h]@9 - POINT v104; // [sp+3Ch] [bp-BCh]@31 - POINT v105; // [sp+44h] [bp-B4h]@16 - POINT v106; // [sp+4Ch] [bp-ACh]@30 - POINT v107; // [sp+54h] [bp-A4h]@16 - POINT v108; // [sp+5Ch] [bp-9Ch]@30 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v110; // [sp+6Ch] [bp-8Ch]@30 - POINT v111; // [sp+74h] [bp-84h]@8 + POINT mouse; // [sp+6Ch] [bp-8Ch]@30 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@54 - int v146; // [sp+D4h] [bp-24h]@23 - unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1 - unsigned int pWhiteColor; // [sp+DCh] [bp-1Ch]@1 - __int32 v117; // [sp+E0h] [bp-18h]@8 - int v118; // [sp+E4h] [bp-14h]@40 - const char **v119; // [sp+E8h] [bp-10h]@24 - int _this; // [sp+ECh] [bp-Ch]@1 - unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 - int v152; // [sp+F4h] [bp-4h]@23 - int v122; - int v114; + int item_num; // [sp+E0h] [bp-18h]@8 + int v117; // [sp+E4h] [bp-14h]@40 + int pPrice; // [sp+E8h] [bp-10h]@24 + int one_string; // [sp+ECh] [bp-Ch]@1 int pSrtingNum; - int pActiveItemNum; ItemGen *item; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; dialog_window.uFrameZ = 334; - pWhiteColor = TargetColor(255, 255, 255); - pYellowColor = TargetColor(225, 205, 35); if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) { if ( !HouseUI_CheckIfPlayerCanInteract() ) @@ -1192,292 +1097,200 @@ all_text_height = 0; for ( int i = 0; i < 4; ++i ) all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j = 0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) + one_string = (174 - all_text_height) / 4; + v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138; + int pNumString = 0; + for (int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) { - int th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = pTextHeight; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } + control_button = pDialogueWindow->GetControl(i); + control_button->uY = one_string + v23; + control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = TargetColor(225, 205, 35); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + text_color = TargetColor(255, 255, 255); + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3); + ++pNumString; } return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v3 = 0; - v49 = 0; - v122 = 0; - do + for ( uint i = 0; i < 6; ++i ) { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - v50 = ItemsInShopTexture[v49]; - v51 = 152 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; - if ( v122 ) + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + if ( i ) { - if ( v122 == 5 ) + if ( i == 5 ) { - v53 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; } } else { - if ( (signed int)v52 < 18 ) - v52 = 18; + if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; } - pRenderer->DrawTextureTransparent(v52, v51, v50); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); - v49 = v122; + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1); } - ++v49; - v122 = v49; } - while ( v49 < 6 ); - v122 = 0; - do + for ( uint i = 0; i < 6; ++i ) { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) { - v54 = ItemsInShopTexture[v122 + 6]; - v55 = 306 - v54->uTextureHeight; - v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; - if ( v122 ) + product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + if ( i ) { - if ( v122 == 5 ) + if ( i == 5 ) { - v57 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; } } else { - if ( (signed int)v56 < 18 ) - v56 = 18; + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; } - pRenderer->DrawTextureTransparent(v56, v55, v54); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7); } - ++v122; } - while ( v122 < 6 ); if ( HouseUI_CheckIfPlayerCanInteract() ) { - v66 = 0; - v117 = 0; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - else + item_num = 0; + for ( uint i = 0; i < 12; ++i ) { - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) - ++v117; - ++v66; - } - while ( v66 < 12 ); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ++item_num; } - v67 = GetAsyncKeyState(VK_CONTROL); - v68 = pPlayers[uActiveCharacter]->CanSteal(); - Str = (char *)v68; - if ( v67 && v68 ) - { - v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" - } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" else - { - v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" - } - DrawTextAtStatusBar(v69, 0); - if ( !v117 ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy" + if ( !item_num ) { dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } - v70 = pMouse->GetCursorPos(&v102); - result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) { - v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( v67 && Str ) - v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" + item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" else { v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v10 = (char *)pMerchantsBuyPhrases[v75]; + v30 = BuildDialogueString((char *)pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); } - v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3); return; } } return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v3 = 0; - v49 = 0; - v122 = 0; - do + for ( uint i = 0; i < 6; ++i ) { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) { - v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight; - if ( (signed int)v59 < 1 ) - v59 = 0; - v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v61 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + if ( i ) { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) - { - v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight; - if ( (signed int)v63 < 1 ) - v63 = 0; - v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) + if ( i == 5 ) { - v65 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v64 > 457 - v65 ) - v64 = 457 - v65; + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; } } else { - if ( (signed int)v64 < 18 ) - v64 = 18; + if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; } - pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1); } - ++v122; } - while ( v122 < 6 ); + for ( uint i = 0; i < 6; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) + { + product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; + if ( (signed int)product_height_2row < 1 ) + product_height_2row = 0; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; + } + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7); + } + } if ( HouseUI_CheckIfPlayerCanInteract() ) { - v66 = 0; - v117 = 0; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - else + item_num = 0; + for ( uint i = 0; i < 12; ++i ) { - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) - ++v117; - ++v66; - } - while ( v66 < 12 ); + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + ++item_num; } - v67 = GetAsyncKeyState(VK_CONTROL); - v68 = pPlayers[uActiveCharacter]->CanSteal(); - Str = (char *)v68; - if ( v67 && v68 ) - { - v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" - } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" else - { - v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" - } - DrawTextAtStatusBar(v69, 0); - if ( !v117 ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy" + if ( !item_num ) { dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } - v70 = pMouse->GetCursorPos(&v102); - result = v70->x + pSRZBufferLineOffsets[v70->y]; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) { - v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( v67 && Str ) - v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" + item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" else { v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v10 = (char *)pMerchantsBuyPhrases[v75]; + v30 = BuildDialogueString((char *)pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); } - v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3); return; } } return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) { draw_leather(); @@ -1488,55 +1301,46 @@ all_text_height = 0; for ( uint i = 0; i < 3; ++i ) all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - _this = ((174 - all_text_height) / 3); - v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v118 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) + one_string = ((174 - all_text_height) / 3); + v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; + pSrtingNum = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - v122 = 2; - pSrtingNum = 0; - do - { - control_button = pDialogueWindow->GetControl(v118); - control_button->uY = (unsigned int)((char *)_this + v81); - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); - v85 = control_button->uY; - control_button->uHeight = pTextHeight; - v81 = pTextHeight + v85 - 1; - control_button->uW = v81; - text_color = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != v122 ) - text_color = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3); - ++v122; - ++pSrtingNum; - ++v118; - } - while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + control_button = pDialogueWindow->GetControl(i); + control_button->uY = one_string + v23; + control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); + v23 = control_button->uHeight + control_button->uY - 1; + control_button->uW = v23; + text_color = TargetColor(225, 205, 35); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + text_color = TargetColor(255, 255, 255); + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3); + ++pSrtingNum; } return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) { draw_leather(); CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" - if ( !HouseUI_CheckIfPlayerCanInteract() - || (v11 = pMouse->GetCursorPos(&v107)->x - 14, - v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v105), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) - || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; - v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); - v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); + v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3); return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) { draw_leather(); @@ -1544,137 +1348,108 @@ DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" if ( HouseUI_CheckIfPlayerCanInteract() ) { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); - result = (int)pMouse->GetCursorPos(&v111); - if ( *(int *)result > 13 ) + pMouse->GetCursorPos(&mouse); + v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x > 13 && mouse.x < 462 ) { - result = (int)pMouse->GetCursorPos(&v103); - if ( *(int *)result < 462 ) + if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) { - result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); - if ( result ) + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; + if ( item->uAttributes & 1 ) { - item = &pPlayers[uActiveCharacter]->pInventoryItemList[result-1]; - if ( item->uAttributes & 1 ) - { - v5 = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; - dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3); - return; - } - v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); - v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3); + dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101, + TargetColor(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3); return; } + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); + v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3); + return; } } } return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) { draw_leather(); CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" - if ( !HouseUI_CheckIfPlayerCanInteract() - || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14, - v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v106), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) - || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) - // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) ) - || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; - v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); - v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) + || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1], + BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); + v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3); return; } + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) { if ( HouseUI_CheckIfPlayerCanInteract() ) { - v3 = 0; all_text_height = 0; v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100); - if ( (signed int)v119 < v33 / 3 ) - v119 = (const char **)(v33 / 3); - pActiveItemNum = pDialogueWindow->pStartingPosActiveItem; - v122 = 0; - if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v33 / 3 ) + pPrice = v33 / 3; + item_num = 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] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + ++item_num; + } + } + if ( !item_num ) { 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." - v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); - return; - } - do - { - v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); - ++v122; - } - ++pActiveItemNum; - } - while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v122 ) - { - 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." - v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(225, 205, 35), pTmpBuf.data(), 3); return; } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); - v119 = (const char **)((149 - all_text_height) / v122); - if ( (149 - all_text_height) / v122 > 32 ) - v119 = (const char **)32; - v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162; - v118 = 2; - if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + one_string = (149 - all_text_height) / item_num; + if ( one_string > 32 ) + one_string = 32; + v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i) { - v122 = 2; - do + control_button = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] ) { - control_button = pDialogueWindow->GetControl(v122); - v41 = control_button->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] ) - { - control_button->uW = 0; - control_button->uHeight = 0; - control_button->uY = 0; - } - else - { - control_button->uY = (unsigned int)((char *)v119 + v38); - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); - v44 = control_button->uY; - control_button->uHeight = pTextHeight; - v38 = v44 + pTextHeight - 1; - control_button->uW = v38; - text_color = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != v122 ) - text_color = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3); - } - ++v122; + control_button->uW = 0; + control_button->uHeight = 0; + control_button->uY = 0; } - while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + else + { + control_button->uY = one_string + v23; + control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0); + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = TargetColor(225, 205, 35); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + text_color = TargetColor(255, 255, 255); + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3); + } } } return; diff -r 42a1874a2171 -r 999bf8c99514 UI/UITransition.cpp