Mercurial > mm7
changeset 636:96d8aa4d8c95
Merge
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 16:55:10 +0200 |
parents | 71ecba604995 (current diff) efa8ceae21d4 (diff) |
children | d7b14091e434 48ab06ab9766 |
files | |
diffstat | 2 files changed, 559 insertions(+), 688 deletions(-) [+] |
line wrap: on
line diff
--- a/UIHouses.cpp Mon Mar 11 16:54:56 2013 +0200 +++ b/UIHouses.cpp Mon Mar 11 16:55:10 2013 +0200 @@ -1446,10 +1446,10 @@ //----- (004B910F) -------------------------------------------------------- void __cdecl WeaponShopDialog() { - //Player *v0; // ebx@1 + int v0; // ebx@1 int pNumActiveItem; // eax@6 signed int v2; // esi@8 - unsigned int v3; // ebx@10 + //unsigned int v3; // ebx@10 ItemGen *v4; // eax@11 char *v5; // ecx@12 unsigned __int8 v6; // dl@13 @@ -1477,7 +1477,7 @@ int v28; // ST08_4@36 int v29; // eax@36 GUIWindow *v30; // edi@41 - void *v31; // eax@41 + //void *v31; // eax@41 signed int v32; // esi@41 unsigned int v33; // esi@43 int v34; // eax@43 @@ -1517,7 +1517,7 @@ GUIWindow *v68; // ecx@98 int v69; // edx@98 int v70; // edi@98 - //GUIButton *pButton; // esi@100 + int v71; const char **v72; // eax@100 int pTextHeight; // eax@100 unsigned int v74; // ecx@100 @@ -1559,7 +1559,6 @@ unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 int pNumString; - //v0 = pPlayers[uActiveCharacter]; pPlayer = pPlayers[uActiveCharacter]; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; @@ -1614,7 +1613,6 @@ case DIALOG_SHOP_BUY_STANDART: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v3 = 0; v48 = 0; pItemNum = 0; v109 = 0; @@ -1680,14 +1678,14 @@ { v64 = pPlayer->_490EEE(v63, 1, v61, 2); v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); } else { v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); } } } @@ -1708,13 +1706,13 @@ return; if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5), pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) ) + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; v13 = pPlayer->_490EEE(v79, 1, (int)window_SpeakInHouse->ptr_1C, 3); v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); break; } case DIALOG_SHOP_IDENTIFY: @@ -1726,19 +1724,22 @@ return; if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) ) + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; if (!v4->Identified()) { v10 = pPlayer->_490EEE(v4, 1, (int)window_SpeakInHouse->ptr_1C, 4); v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); } - v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + else + { + v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + } break; } case DIALOG_SHOP_REPAIR: @@ -1750,7 +1751,7 @@ return; if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) ) return; v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; @@ -1803,7 +1804,6 @@ case DIALOG_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v3 = 0; v109 = 0; pItemNum = 0; do @@ -1865,14 +1865,14 @@ { v64 = pPlayer->_490EEE(v63, 1, v61, 2); v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); } else { v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); } } } @@ -1886,92 +1886,81 @@ } case DIALOG_SHOP_SKILLS: { - pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( pNumActiveItem ) + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + v0 = 0; + all_text_height = 0; + //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); + v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; + if ( pItemNum < v32 / 3 ) + pItemNum = v32 / 3; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); + return; + } + do { - v3 = 0; - v31 = window_SpeakInHouse->ptr_1C; - v106.y = 0; - //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); - v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); - pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; - if ( pItemNum < v32 / 3 ) - pItemNum = v32 / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v34 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; - v109 = 0; - if ( pNumActiveItem >= v34 ) + v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); + v0++; } + ++pNumActiveItem; + } + while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + if ( !v0 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); + return; + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); + v103 = (149 - all_text_height) / v0; + if ( (149 - all_text_height) / v0 > 32 ) + v103 = 32; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162; + if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pItemNum = 2; do { - v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) + pButton = pDialogueWindow->GetControl(pItemNum); + v40 = pButton->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) { - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); - v106.y += pTextHeight; - v109 = (const char **)((char *)v109 + 1); + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; } - ++pNumActiveItem; - } - while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v109 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); + else + { + pButton->uY = v103 + v37; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v37 = pButton->uY + pTextHeight - 1; + pButton->uW = v37; + v46 = pColor2; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + v46 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v46, pSkillNames[v40], 3); + } + pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + pItemNum++; } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); - pItemNum = (149 - v106.y) / (signed int)v109; - if ( (149 - v106.y) / (signed int)v109 > 32 ) - pItemNum = 32; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v37 = (149 - (signed int)v109 * pItemNum - v106.y) / 2 - pItemNum / 2 + 162; - v106.y = (LONG)pNumActiveItem; - v103 = v37; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - v109 = (const char **)2; - do - { - pButton = pDialogueWindow->GetControl(v106.y); - v40 = pButton->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = pItemNum + v103; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); - v43 = pButton->uY; - v44 = v109; - pButton->uHeight = pTextHeight; - v45 = v43 + pTextHeight - 1; - pButton->uW = v45; - v103 = v45; - v46 = pColor2; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 ) - v46 = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, v43, v46, pSkillNames[v40], 3); - } - v47 = pDialogueWindow->pStartingPosActiveItem; - ++v106.y; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + v47; - v109 = (const char **)((char *)v109 + 1); - } - while ( v106.y < pNumActiveItem ); - } + while ( pItemNum < pNumActiveItem ); } break; } @@ -1991,11 +1980,11 @@ //----- (004B9CC6) -------------------------------------------------------- void __cdecl AlchemistDialog() { - Player *v0; // ebx@1 - POINT *result; // eax@7 - GUIWindow *v2; // edi@9 - unsigned int v3; // ebx@9 - void *v4; // eax@9 + int v0; + int pNumActiveItem; // eax@7 + //GUIWindow *v2; // edi@9 + //unsigned int v3; // ebx@9 + //void *v4; // eax@9 signed int v5; // esi@9 unsigned int v6; // esi@11 int v7; // eax@11 @@ -2063,15 +2052,15 @@ int v69; // ecx@118 ItemGen *v70; // esi@118 int v71; // eax@123 - int v72; // edi@125 + int all_text_height; // edi@125 char **v73; // esi@125 int v74; // eax@126 - GUIWindow *v75; // ecx@127 + int pItemNum; int v76; // edx@127 int v77; // edi@127 - GUIButton *v78; // esi@129 + GUIButton *pButton; // esi@129 const char **v79; // eax@129 - int v80; // eax@129 + int pTextHeight; // eax@129 unsigned int v81; // ecx@129 Player *v82; // edx@129 unsigned __int16 v83; // ax@129 @@ -2095,600 +2084,483 @@ POINT v101; // [sp+44h] [bp-94h]@39 POINT v102; // [sp+4Ch] [bp-8Ch]@49 POINT a2; // [sp+54h] [bp-84h]@39 - GUIWindow v104; // [sp+5Ch] [bp-7Ch]@1 + GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 int v105; // [sp+B0h] [bp-28h]@19 - int v106; // [sp+B4h] [bp-24h]@1 - char *Str; // [sp+B8h] [bp-20h]@23 - int v108; // [sp+BCh] [bp-1Ch]@1 + int pColor2; // [sp+B4h] [bp-24h]@1 + int Str; // [sp+B8h] [bp-20h]@23 + int pColorWhite; // [sp+BCh] [bp-1Ch]@1 __int32 v109; // [sp+C0h] [bp-18h]@39 - Player *_this; // [sp+C4h] [bp-14h]@1 - const char **v111; // [sp+C8h] [bp-10h]@9 + Player *pPlayer; // [sp+C4h] [bp-14h]@1 + int pNumString; // [sp+C8h] [bp-10h]@9 unsigned int v112; // [sp+CCh] [bp-Ch]@9 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 int v114; // [sp+D4h] [bp-4h]@11 - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v104, window_SpeakInHouse, sizeof(v104)); - v104.uFrameX = 483; - v104.uFrameWidth = 148; - v104.uFrameZ = 334; - v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + pPlayer = pPlayers[uActiveCharacter]; + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); switch(dialog_menu_id) { - case 1: - { - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v72 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v73 = pShopOptions; - do - { - v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); - ++v73; - v72 += v74; - } - while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); - v75 = pDialogueWindow; - Str = (char *)((174 - v72) / 4); - result = (POINT *)pDialogueWindow->pStartingPosActiveItem; - v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); - v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - v112 = pDialogueWindow->pStartingPosActiveItem; - if ( v28 ^ __OFSUB__((int)result, v76) ) - { - _this = (Player *)2; - v111 = (const char **)pShopOptions; - do - { - v78 = v75->GetControl(v112); - v79 = v111; - v78->uY = (unsigned int)&Str[v77]; - v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); - v81 = v78->uY; - v82 = _this; - v78->uHeight = v80; - v77 = v81 + v80 - 1; - v78->uW = v77; - v83 = v106; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) - v83 = v108; - v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); - v75 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v111; - ++v112; - result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)v112 < (signed int)result ); - } - } - return; - } - case 3: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( !result - || (v43 = pMouse->GetCursorPos(&v99)->x - 14, - v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), - result = pMouse->GetCursorPos(&v102), - result->x <= 13) - || (result = pMouse->GetCursorPos(&v100), result->x >= 462) - || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) - return; - v93 = 0; - v91 = 3; - v89 = window_SpeakInHouse->ptr_1C; - v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v44 = (int)window_SpeakInHouse->ptr_1C; - v113 = uActiveCharacter - 1; - v45 = _this->_490EEE(v87, 4, v44, 3); - v39 = v113; - v38 = (char *)pMerchantsSellPhrases[v45]; - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - - v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - return; - } - case 4: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( !result - || (v36 = pMouse->GetCursorPos(&a2)->x - 14, - v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), - result = pMouse->GetCursorPos(&v101), - result->x <= 13) - || (result = pMouse->GetCursorPos(&v97), result->x >= 462) - || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) - return; - v93 = 0; - v91 = 4; - v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if (!v37->Identified()) + case DIALOG_SHOP_MAIN: + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + all_text_height = 0; + for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + Str = (174 - all_text_height) / 4; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; + v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + v28 = -pDialogueWindow->pNumPresenceButton < 0; + if ( v28 ^ pNumActiveItem > v76 ) + { + pItemNum = 2; + pNumString = 0; + do + { + pButton = pDialogueWindow->GetControl(pItemNum); + pButton->uY = Str + v77; + pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v77 = pButton->uY + pTextHeight - 1; + pButton->uW = v77; + v83 = pColor2; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + v83 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v83, (const char *)pShopOptions[pNumString], 3); + pPlayer = (Player *)((char *)pPlayer + 1); + ++pItemNum; + ++pNumString; + pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + } + while ( pItemNum < pNumActiveItem ); + } + } + return; + } + case DIALOG_SHOP_BUY_STANDART: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v114 = 0; + do + { + // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); { - v89 = window_SpeakInHouse->ptr_1C; - v87 = v37; - v41 = (int)window_SpeakInHouse->ptr_1C; - v113 = uActiveCharacter - 1; - v42 = _this->_490EEE(v37, 4, v41, 4); - v39 = v113; - v38 = (char *)pMerchantsIdentifyPhrases[v42]; + v46 = ItemsInShopTexture[v114]; + v47 = 152 - v46->uTextureHeight; + if ( (signed int)v47 < 1 ) + v47 = 0; + v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v49 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v48 > 457 - v49 ) + v48 = 457 - v49; + } + } + else if ( (signed int)v48 < 18 ) + v48 = 18; + pRenderer->DrawTextureTransparent(v48, v47, v46); + sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); } - else - { - v89 = window_SpeakInHouse->ptr_1C; - v38 = "%24"; - v87 = v37; - v39 = uActiveCharacter - 1; - } - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - return; - } - case 94: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - v22 = 0; - v23 = pShopOptions; + ++v114; + } + while ( v114 < 6 ); + v114 = 0; + do + { + // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); + { + v50 = ItemsInShopTexture[v114 + 6]; + v51 = 308 - v50->uTextureHeight; + if ( (signed int)v51 < 1 ) + v51 = 0; + v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v53 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v52 > 457 - v53 ) + v52 = 457 - v53; + } + } + else + { + if ( (signed int)v52 < 18 ) + v52 = 18; + } + pRenderer->DrawTextureTransparent(v52, v51, v50); + sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); + } + ++v114; + } + while ( v114 < 6 ); + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v62 = 0; + v109 = 0; do { - v24 = pFontArrus->CalcTextHeight(*v23, &v104, 0, 0); - ++v23; - v22 += v24; + // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); + ++v109; + ++v62; + } + while ( v62 < 12 ); + v63 = GetAsyncKeyState(17); + v64 = pPlayer->CanSteal(); + Str = v64; + if ( v63 && v64 ) + { + v65 = pGlobalTXT_LocalizationStrings[185]; + } + else if ( dialog_menu_id == 2 ) + { + v65 = pGlobalTXT_LocalizationStrings[195]; + } + else + { + v65 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v65, 0); + if ( !v109 ) + { + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + v66 = pMouse->GetCursorPos(&v98); + pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; + if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) + { + v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; + // v69 = 9 * (v67 + 12 * v68); + v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67]; + if ( dialog_menu_id != 2 ) + v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + if ( !v63 || !Str ) + { + v71 = pPlayer->_490EEE(v70, 4, (int)window_SpeakInHouse->ptr_1C, 2); + v38 = (char *)pMerchantsBuyPhrases[v71]; + } + else + { + v38 = pGlobalTXT_LocalizationStrings[181]; + } + v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); + return ; + } + } + return; + } + case DIALOG_SHOP_SELL: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), + pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) + return; + v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v45 = pPlayer->_490EEE(v87, 4, (int)window_SpeakInHouse->ptr_1C, 3); + v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); + pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3); + return; + } + case DIALOG_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), + pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) + return; + v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + if (!v37->Identified()) + { + v42 = pPlayer->_490EEE(v37, 4, (int)window_SpeakInHouse->ptr_1C, 4); + v38 = (char *)pMerchantsIdentifyPhrases[v42]; + } + else + { + v38 = "%24"; + } + v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); + return; + } + case DIALOG_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; + all_text_height = 0; + for ( int i = 0; i < 2; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + Str = (174 - all_text_height) / 2; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; + v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; + v28 = -pDialogueWindow->pNumPresenceButton < 0; + if ( v28 ^ pNumActiveItem > v26 ) + { + pItemNum = 2; + pNumString = 0; + do + { + pButton = pDialogueWindow->GetControl(pItemNum); + pButton->uY = Str + v27; + pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v27 = pButton->uY + pTextHeight - 1; + pButton->uW = v27; + v35 = pColor2; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + v35 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v35, (const char *)pShopOptions[pNumString], 3); + ++pItemNum; + ++pNumString; + pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; } - while ( (signed int)v23 < (signed int)&pShopOptions[2] ); - Str = (char *)((174 - v22) / 2); - v25 = pDialogueWindow; - result = (POINT *)pDialogueWindow->pStartingPosActiveItem; - v26 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); - v27 = (2 * (87 - (174 - v22) / 2) - v22) / 2 - (174 - v22) / 2 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - v112 = pDialogueWindow->pStartingPosActiveItem; - if ( v28 ^ __OFSUB__((int)result, v26) ) + while ( pItemNum < pNumActiveItem ); + } + return; + } + case DIALOG_SHOP_BUY_SPECIAL: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v114 = 0; + do + { + //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) + { + v54 = ItemsInShopTexture[v114]; + v55 = 152 - v54->uTextureHeight; + if ( (signed int)v55 < 1 ) + v55 = 0; + v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v57 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v56 > 457 - v57 ) + v56 = 457 - v57; + } + } + else + { + if ( (signed int)v56 < 18 ) + v56 = 18; + } + pRenderer->DrawTextureTransparent(v56, v55, v54); + sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); + } + ++v114; + } + while ( v114 < 6 ); + v114 = 0; + do + { + // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid + { + v58 = ItemsInShopTexture[v114 + 6]; + v59 = 308 - v58->uTextureHeight; + if ( (signed int)v59 < 1 ) + v59 = 0; + v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v61 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v60 > 457 - v61 ) + v60 = 457 - v61; + } + } + else + { + if ( (signed int)v60 < 18 ) + v60 = 18; + } + pRenderer->DrawTextureTransparent(v60, v59, v58); + sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); + } + ++v114; + } + while ( v114 < 6 ); + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v62 = 0; + v109 = 0; + do + { + //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) + ++v109; + ++v62; + } + while ( v62 < 12 ); + v63 = GetAsyncKeyState(17); + v64 = pPlayer->CanSteal(); + Str = v64; + if ( v63 && v64 ) + { + v65 = pGlobalTXT_LocalizationStrings[185]; + } + else { - _this = (Player *)2; - v111 = (const char **)pShopOptions; + v65 = pGlobalTXT_LocalizationStrings[195]; + if ( dialog_menu_id != 2 ) + v65 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v65, 0); + if ( !v109 ) + { + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + v66 = pMouse->GetCursorPos(&v98); + pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; + if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) + { + v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; + v109 = v67; + v68 = (int)window_SpeakInHouse->ptr_1C; + // v69 = 9 * (v67 + 12 * v68); + v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; + if ( dialog_menu_id != 2 ) + v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + if ( !v63 || !Str ) + { + v71 = pPlayer->_490EEE(v70, 4, v68, 2); + v38 = (char *)pMerchantsBuyPhrases[v71]; + } + else + { + v38 = pGlobalTXT_LocalizationStrings[181]; + } + v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); + return; + } + } + return; + } + case DIALOG_SHOP_SKILLS: + { + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + all_text_height = 0; + //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); + v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100; + if ( pItemNum < v5 / 3 ) + pItemNum = v5 / 3; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v114 = 0; + if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColor2, pTmpBuf, 3); + return; + } + do + { + v8 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] ) + { + all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0); + ++v114; + } + ++pNumActiveItem; + } + while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + if ( !v114 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColor2, pTmpBuf, 3); + return; + } + if ( v114 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); + v18 = (149 - all_text_height) / v114; + if ( (149 - all_text_height) / v114 > 32 ) + v18 = 32; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162; + if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pItemNum = 2; do { - v29 = v25->GetControl(v112); - v30 = v111; - v29->uY = (unsigned int)&Str[v27]; - v31 = pFontArrus->CalcTextHeight(*v30, &v104, 0, 0); - v32 = v29->uY; - v33 = _this; - v29->uHeight = v31; - v34 = v31 + v32 - 1; - v29->uW = v34; - v27 = v34; - v35 = v106; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v33 ) - v35 = v108; - v104.DrawTitleText(pFontArrus, 0, v32, v35, *v111, 3u); - v25 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v111; - ++v112; - result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); + pButton = pDialogueWindow->GetControl(pItemNum); + v13 = pButton->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v18 + v105; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v105 = pButton->uY + pTextHeight - 1; + pButton->uW = v105; + v19 = pColor2; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + v19 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v19, pSkillNames[v13], 3); + } + pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + pItemNum++; } - while ( (signed int)v112 < (signed int)result ); + while ( pItemNum < pNumActiveItem ); } return; - } - case 2: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v114 = 0; - do - { - // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); - { - v46 = ItemsInShopTexture[v114]; - v47 = 152 - v46->uTextureHeight; - if ( (signed int)v47 < 1 ) - v47 = 0; - v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v49 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v48 > 457 - v49 ) - v48 = 457 - v49; - } - } - else if ( (signed int)v48 < 18 ) - v48 = 18; - pRenderer->DrawTextureTransparent(v48, v47, v46); - sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); - { - v50 = ItemsInShopTexture[v114 + 6]; - v51 = 308 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v53 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; - } - } - else - { - if ( (signed int)v52 < 18 ) - v52 = 18; - } - pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v62 = 0; - v109 = 0; - do - { - // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); - ++v109; - ++v62; - } - while ( v62 < 12 ); - v63 = GetAsyncKeyState(17); - v64 = _this->CanSteal(); - Str = (char *)v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else if ( dialog_menu_id == 2 ) - { - v65 = pGlobalTXT_LocalizationStrings[195]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v66 = pMouse->GetCursorPos(&v98); - result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v109 = v67; - v68 = (int)window_SpeakInHouse->ptr_1C; - // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dialog_menu_id != 2 ) - v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; - if ( !v63 || !Str ) - { - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v113 = uActiveCharacter - 1; - v71 = _this->_490EEE(v70, 4, v68, 2); - v39 = v113; - v38 = (char *)pMerchantsBuyPhrases[v71]; - } - else - { - v38 = pGlobalTXT_LocalizationStrings[181]; - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v39 = uActiveCharacter - 1; - } - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - return ; - } - } - return; - } - case 95: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v114 = 0; - do - { - //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) - { - v54 = ItemsInShopTexture[v114]; - v55 = 152 - v54->uTextureHeight; - if ( (signed int)v55 < 1 ) - v55 = 0; - v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v57 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; - } - } - else - { - if ( (signed int)v56 < 18 ) - v56 = 18; - } - pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid - { - v58 = ItemsInShopTexture[v114 + 6]; - v59 = 308 - v58->uTextureHeight; - if ( (signed int)v59 < 1 ) - v59 = 0; - v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v61 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else - { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v62 = 0; - v109 = 0; - do - { - //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) - ++v109; - ++v62; - } - while ( v62 < 12 ); - v63 = GetAsyncKeyState(17); - v64 = _this->CanSteal(); - Str = (char *)v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != 2 ) - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v66 = pMouse->GetCursorPos(&v98); - result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v109 = v67; - v68 = (int)window_SpeakInHouse->ptr_1C; - // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dialog_menu_id != 2 ) - v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; - if ( !v63 || !Str ) - { - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v113 = uActiveCharacter - 1; - v71 = _this->_490EEE(v70, 4, v68, 2); - v39 = v113; - v38 = (char *)pMerchantsBuyPhrases[v71]; - } - else - { - v38 = pGlobalTXT_LocalizationStrings[181]; - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v39 = uActiveCharacter - 1; - } - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - return; - } - } - return; - } - case 96: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - v2 = pDialogueWindow; - v3 = 0; - v4 = window_SpeakInHouse->ptr_1C; - v112 = 0; - //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); - v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); - v111 = (const char **)(v5 * (100 - _this->GetMerchant()) / 100); - if ( (signed int)v111 < v5 / 3 ) - v111 = (const char **)(v5 / 3); - v6 = v2->pStartingPosActiveItem; - v7 = v6 + v2->pNumPresenceButton; - v114 = 0; - if ( (signed int)v6 < v7 ) - { - do - { - v8 = v2->GetControl(v6)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v8] && !_this->pActiveSkills[v8] ) - { - v9 = pFontArrus->CalcTextHeight(pSkillNames[v8], &v104, 0, 0); - v112 += v9; - ++v114; - } - ++v6; - } - while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); - if ( v114 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); - v104.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v111 = (const char **)((signed int)(149 - v112) / v114); - if ( (signed int)(149 - v112) / v114 > 32 ) - v111 = (const char **)32; - result = (POINT *)v2->pStartingPosActiveItem; - v10 = (signed int)(149 - v114 * (int)v111 - v112) / 2 - (signed int)v111 / 2 + 162; - v112 = (unsigned int)result; - v105 = v10; - if ( (signed int)result < (signed int)((char *)result + v2->pNumPresenceButton) ) - { - v114 = 2; - do - { - v11 = v2->GetControl(v112); - v12 = v11; - v13 = v11->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v13] || _this->pActiveSkills[v13] ) - { - v12->uW = 0; - v12->uHeight = 0; - v12->uY = 0; - } - else - { - v14 = pSkillNames[v13]; - v12->uY = (unsigned int)((char *)v111 + v105); - Str = v14; - v15 = pFontArrus->CalcTextHeight(v14, &v104, 0, 0); - v16 = v12->uY; - v17 = v114; - v12->uHeight = v15; - v18 = v16 + v15 - 1; - v12->uW = v18; - v105 = v18; - v19 = v106; - if ( pDialogueWindow->pCurrentPosActiveItem != v17 ) - v19 = v108; - v104.DrawTitleText(pFontArrus, 0, v16, v19, Str, 3u); - } - v20 = v2->pStartingPosActiveItem; - ++v112; - result = (POINT *)(v2->pNumPresenceButton + v20); - ++v114; - } - while ( (signed int)v112 < (signed int)result ); - } - return; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v21 = pTmpBuf; - v92 = 3; - v90 = pTmpBuf; - v88 = v106; - v86 = 0; - v85 = 0; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - return; - } - default: - { - return;// (POINT *)dialog_menu_id - 96; - } + } + } + default: + { + return;// (POINT *)dialog_menu_id - 96; + } } }