# HG changeset patch # User Gloval # Date 1362688593 -14400 # Node ID cfca6297e4ae98d7a58a62cb9340ceda0de67e6a # Parent 975a231bb4ec597d2e0ffd5f5526705c9f5bf608 ArmorShop fixes diff -r 975a231bb4ec -r cfca6297e4ae Events.cpp --- a/Events.cpp Thu Mar 07 15:26:44 2013 +0600 +++ b/Events.cpp Fri Mar 08 00:36:33 2013 +0400 @@ -1352,7 +1352,7 @@ if ( uGameState == 2 ) { pAudioPlayer->StopChannels(-1, -1); - dword_F8B19C = 0; + dialog_menu_id = 0; while ( sub_4BD8B5() ) ; pVideoPlayer->Unload(); @@ -1364,7 +1364,7 @@ viewparams->bRedrawGameUI = 1; pDialogueNPCCount = 0; pDialogueWindow->Release(); - dword_F8B19C = 0; + dialog_menu_id = 0; pDialogueWindow = 0; pIcons_LOD->_40F9C5(); } diff -r 975a231bb4ec -r cfca6297e4ae Player.cpp --- a/Player.cpp Thu Mar 07 15:26:44 2013 +0600 +++ b/Player.cpp Fri Mar 08 00:36:33 2013 +0400 @@ -1804,7 +1804,7 @@ Player *v27; // [sp+14h] [bp-4h]@1 v27 = this; - LOBYTE(v5) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); + v5 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); v26 = v5; result = 4; v7 = pItem->uItemID; @@ -1929,7 +1929,7 @@ } //----- (004910A8) -------------------------------------------------------- -int Player::GetMediatation() +int Player::GetMeditation() { char v1; // al@1 int v2; // ecx@1 @@ -2067,9 +2067,9 @@ signed int v9; // [sp-4h] [bp-10h]@6 v1 = this; - LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); + v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); v3 = v1->pActiveSkills[22]; - v4 = v2 & 0x3F; + v4 = v2 & 0x003F; v5 = v1->pActiveSkills[22] & 0x3F; if ( (signed int)SkillToMastery(v2) >= 4 ) return 10000; @@ -5997,7 +5997,7 @@ if ( a2 == CHARACTER_ATTRIBUTE_MANA ) { v60 = pBaseManaPerLevelByClass[v2->classType]; - v61 = v2->GetMediatation(); + v61 = v2->GetMeditation(); return v60 * v61; } if ( a2 != 9 ) diff -r 975a231bb4ec -r cfca6297e4ae Player.h --- a/Player.h Thu Mar 07 15:26:44 2013 +0600 +++ b/Player.h Fri Mar 08 00:36:33 2013 +0400 @@ -524,7 +524,7 @@ bool DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime); int _490EEE(ItemGen *pItem, int a3, int a4, int a5); int GetBodybuilding(); - int GetMediatation(); + int GetMeditation(); int CanIdentify(ItemGen *pItem); int CanRepair(ItemGen *); int GetMerchant(); diff -r 975a231bb4ec -r cfca6297e4ae mm7_1.cpp --- a/mm7_1.cpp Thu Mar 07 15:26:44 2013 +0600 +++ b/mm7_1.cpp Fri Mar 08 00:36:33 2013 +0400 @@ -4479,7 +4479,7 @@ } if ( pCurrentScreen == SCREEN_HOUSE ) { - if ( dword_F8B19C != 2 + if ( dialog_menu_id != 2 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) || v16 == -65536 ) //goto _return; @@ -4980,7 +4980,7 @@ //goto LABEL_28; uActiveCharacter = uPlayerID; return; - if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) + if ( dialog_menu_id == 2 || dialog_menu_id == 6 ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; v5 = 14; diff -r 975a231bb4ec -r cfca6297e4ae mm7_2.cpp --- a/mm7_2.cpp Thu Mar 07 15:26:44 2013 +0600 +++ b/mm7_2.cpp Fri Mar 08 00:36:33 2013 +0400 @@ -150,7 +150,7 @@ v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); - switch(dword_F8B19C) + switch(dialog_menu_id) { case 1: { @@ -319,7 +319,7 @@ *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); - switch(dword_F8B19C) + switch(dialog_menu_id) { case 1: { @@ -570,7 +570,7 @@ v7 = 1; v83 = 1; } - switch(dword_F8B19C) + switch(dialog_menu_id) { case 102: { @@ -650,7 +650,7 @@ Party::TakeGold((unsigned int)pOutString); v27 = (int)window_SpeakInHouse->ptr_1C; HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - dword_F8B19C = 0; + dialog_menu_id = 0; while ( sub_4BD8B5() ) ; sub_4B1D27(); @@ -1098,7 +1098,7 @@ v101.uFrameZ = 334; v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch(dword_F8B19C) + switch(dialog_menu_id) { case 94: { @@ -1309,7 +1309,7 @@ else { v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v58 = pGlobalTXT_LocalizationStrings[196]; } DrawTextAtStatusBar(v58, 0); @@ -1324,7 +1324,7 @@ v61 = (int)window_SpeakInHouse->ptr_1C; // v62 = 9 * (v60 + 12 * v61); v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { @@ -1422,7 +1422,7 @@ else { v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v58 = pGlobalTXT_LocalizationStrings[196]; } DrawTextAtStatusBar(v58, 0); @@ -1437,7 +1437,7 @@ v61 = (int)window_SpeakInHouse->ptr_1C; // v62 = 9 * (v60 + 12 * v61); v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { @@ -1649,10 +1649,10 @@ } default: { - if( dword_F8B19C > 5 ) - result = (char *)(dword_F8B19C - 96); + if( dialog_menu_id > 5 ) + result = (char *)(dialog_menu_id - 96); else - result = (char *)(dword_F8B19C - 4); + result = (char *)(dialog_menu_id - 4); break; } } @@ -1787,7 +1787,7 @@ v104.uFrameZ = 334; v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch(dword_F8B19C) + switch(dialog_menu_id) { case 1: { @@ -2056,7 +2056,7 @@ { v65 = pGlobalTXT_LocalizationStrings[185]; } - else if ( dword_F8B19C == 2 ) + else if ( dialog_menu_id == 2 ) { v65 = pGlobalTXT_LocalizationStrings[195]; } @@ -2079,7 +2079,7 @@ v68 = (int)window_SpeakInHouse->ptr_1C; // v69 = 9 * (v67 + 12 * v68); v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { @@ -2203,7 +2203,7 @@ else { v65 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v65 = pGlobalTXT_LocalizationStrings[196]; } DrawTextAtStatusBar(v65, 0); @@ -2221,7 +2221,7 @@ v68 = (int)window_SpeakInHouse->ptr_1C; // v69 = 9 * (v67 + 12 * v68); v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { @@ -2353,7 +2353,7 @@ } default: { - return (POINT *)dword_F8B19C - 96; + return (POINT *)dialog_menu_id - 96; } } } @@ -2361,766 +2361,690 @@ //----- (004BA928) -------------------------------------------------------- void __cdecl ArmorShopDialog() - { - Player *v0; // ebx@1 - signed int v1; // esi@8 - unsigned int v2; // eax@10 - ItemGen *v3; // eax@11 - unsigned __int8 v4; // dl@12 - char *v5; // ecx@12 - char *v6; // eax@13 - int v7; // ST08_4@15 - int v8; // eax@15 - signed int v9; // esi@17 - unsigned int v10; // eax@19 - char *v11; // edi@19 - int v12; // ST08_4@20 - int v13; // eax@20 - unsigned __int8 v14; // dl@20 - char *v15; // ecx@20 - char **v16; // edi@22 - int v17; // ebx@22 - char **v18; // esi@22 - int v19; // eax@23 - GUIWindow *v20; // ecx@24 - int v21; // eax@24 - int v22; // edx@24 - int v23; // ebx@24 - unsigned __int8 v24; // sf@24 - GUIButton *v25; // eax@26 - GUIButton *v26; // esi@26 - int v27; // eax@26 - unsigned int v28; // ecx@26 - int v29; // edx@26 - unsigned __int16 v30; // ax@26 - signed int v31; // esi@31 - unsigned int v32; // eax@33 - int v33; // eax@34 - int v34; // ST08_4@35 - int v35; // eax@35 - char *v36; // edx@36 - GUIWindow *v37; // edi@42 - signed int v38; // esi@42 - unsigned int v39; // esi@44 - int v40; // eax@44 - unsigned int v41; // eax@45 - int v42; // eax@47 - int v43; // ecx@52 - GUIButton *v44; // eax@54 - GUIButton *v45; // esi@54 - int v46; // eax@54 - char *v47; // eax@56 - int v48; // eax@56 - unsigned int v49; // ecx@56 - int v50; // edx@56 - int v51; // eax@56 - unsigned __int16 v52; // ax@56 - int v53; // eax@60 - int v54; // eax@60 - signed int v55; // ebx@65 - Texture *v56; // eax@67 - unsigned int v57; // edi@68 - Texture *v58; // ST1C_4@68 - int v59; // eax@68 - int v60; // edi@69 - signed int v61; // ebx@73 - Texture *v62; // eax@75 - int v63; // edi@76 - Texture *v64; // ST1C_4@76 - unsigned int v65; // ST18_4@76 - int v66; // eax@76 - int v67; // edi@77 - signed int v68; // ecx@81 - SHORT v69; // bx@89 - bool v70; // eax@89 - const char *v71; // ecx@91 - void *v72; // eax@95 - POINT *v73; // esi@97 - int v74; // ecx@97 - int v75; // eax@98 - int v76; // ecx@98 - ItemGen *v77; // ecx@99 - unsigned __int8 v78; // bl@104 - char **v79; // edi@105 - int v80; // ebx@105 - char **v81; // esi@105 - int v82; // eax@106 - GUIWindow *v83; // ecx@107 - int v84; // eax@107 - int v85; // edx@107 - int v86; // ebx@107 - GUIButton *v87; // eax@109 - GUIButton *v88; // esi@109 - int v89; // eax@109 - unsigned int v90; // ecx@109 - int v91; // edx@109 - unsigned __int16 v92; // ax@109 - signed int v93; // edx@114 - POINT *v94; // edi@120 - __int32 v95; // ecx@120 - void *v96; // ST14_4@122 - unsigned __int8 v97; // bl@122 - ItemGen *v98; // ST10_4@122 - int v99; // eax@122 - char *v100; // eax@122 - const char *v101; // ST18_4@122 - unsigned __int16 v102; // ST14_2@122 - int v103; // eax@122 - signed int v104; // edi@123 - Texture *v105; // eax@125 - int v106; // ebx@126 - Texture *v107; // ST1C_4@126 - unsigned int v108; // ST18_4@126 - int v109; // eax@126 - int v110; // ebx@127 - GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 - unsigned int v112; // [sp-14h] [bp-118h]@13 - int v113; // [sp-14h] [bp-118h]@36 - ItemGen *v114; // [sp-10h] [bp-114h]@12 - unsigned int v115; // [sp-10h] [bp-114h]@13 - ItemGen *v116; // [sp-10h] [bp-114h]@20 - int v117; // [sp-10h] [bp-114h]@36 - void *v118; // [sp-Ch] [bp-110h]@12 - unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 - void *v120; // [sp-Ch] [bp-110h]@20 - char *v121; // [sp-8h] [bp-10Ch]@13 - int v122; // [sp-8h] [bp-10Ch]@20 - unsigned int v123; // [sp-4h] [bp-108h]@13 - __int64 *v124; // [sp-4h] [bp-108h]@20 - int v125; // [sp-4h] [bp-108h]@68 - int v126; // [sp-4h] [bp-108h]@76 - int v127; // [sp-4h] [bp-108h]@126 - POINT v128; // [sp+Ch] [bp-F8h]@8 - POINT v129; // [sp+14h] [bp-F0h]@18 - char v130; // [sp+1Ch] [bp-E8h]@120 - POINT a2; // [sp+24h] [bp-E0h]@8 - POINT v132; // [sp+2Ch] [bp-D8h]@120 - POINT v133; // [sp+34h] [bp-D0h]@17 - POINT v134; // [sp+3Ch] [bp-C8h]@97 - POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 - POINT v137; // [sp+54h] [bp-B0h]@17 - POINT v138; // [sp+5Ch] [bp-A8h]@32 - POINT v139; // [sp+64h] [bp-A0h]@17 - POINT v140; // [sp+6Ch] [bp-98h]@31 - POINT v141; // [sp+74h] [bp-90h]@8 - POINT v142; // [sp+7Ch] [bp-88h]@31 - POINT v143; // [sp+84h] [bp-80h]@9 - GUIWindow v144; // [sp+8Ch] [bp-78h]@1 - char *Str; // [sp+E0h] [bp-24h]@56 - int v146; // [sp+E4h] [bp-20h]@24 - int v147; // [sp+E8h] [bp-1Ch]@1 - int v148; // [sp+ECh] [bp-18h]@1 - __int32 v149; // [sp+F0h] [bp-14h]@8 - Player* _this; // [sp+F4h] [bp-10h]@1 - unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 - int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 - int th; - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v144, window_SpeakInHouse, sizeof(v144)); - v144.uFrameX = 483; - v144.uFrameWidth = 148; - v144.uFrameZ = 334; - v148 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v147 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch (dword_F8B19C) - { - case 1: //prepare shop text - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v16 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v17 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - for(int i=0;i<4;++i) - { - v19 = pFontArrus->CalcTextHeight(pShopOptions[i], &v144, 0, 0); - v17 += v19; - } - v20 = pDialogueWindow; - v146 = (174 - v17) / 4; - v21 = pDialogueWindow->pStartingPosActiveItem; - v22 = v21 + pDialogueWindow->pNumPresenceButton; - v23 = (174 - 4 * (174 - v17) / 4 - v17) / 2 - (174 - v17) / 4 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - v152 = pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v21, v22) ) - { - th = 2; - do - { - v25 = v20->GetControl(v152); - v26 = v25; - v25->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); - v28 = v26->uY; - v29 = th; - v26->uHeight = v27; - v23 = v28 + v27 - 1; - v26->uW = v23; - v30 = v147; - if ( pDialogueWindow->pCurrentPosActiveItem != v29 ) - v30 = v148; - v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); - v20 = pDialogueWindow; - ++th; - ++v16; - ++v152; - } - while ( v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - } - } - break; - case 2: //buy standart - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v55 = 0; - v153 = 0; - for(int i=0; i<8; ++i) - { - // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); - { - v56 = ItemsInShopTexture[v55]; - if ( i >= 4 ) - { - v60 = 90 - ((signed int)v56->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; - } - else - { - v57 = 98 - v56->uTextureHeight; - v58 = ItemsInShopTexture[i]; - v152 = 86 - ((signed int)v56->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v152, v57, v58); - v59 = v153 + v152 + 640 * v57; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); - } - v153 += 105; - - } - - v11 = 0; - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - - v149 = 0; - for(int i=0; i<6; ++i) - { - // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); - ++v149; - - } - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - //Str = (char *)v70; - if ( v69 == 0 || v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" - } - DrawTextAtStatusBar(v71, 0); - if ( v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - v75 = (int)window_SpeakInHouse->ptr_1C; - v77 = &pParty->StandartItemsInShops[(int)v75][v74-1]; - if ( v69 ==0 || v70 == 0) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, v77, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &v144, 0, 0)) / 2 + 138; - v144.DrawTitleText(pFontArrus, 0, v115, v148, v36, 3); - return; - } - v72 = window_SpeakInHouse->ptr_1C; - v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); - return; - } - break; - case 3: - { - 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() - || (v9 = pMouse->GetCursorPos(&v139)->x - 14, - v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), - pMouse->GetCursorPos(&v137)->x <= 13) - || pMouse->GetCursorPos(&v129)->x >= 462 - || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) - return; - v124 = 0; - v122 = 3; - v120 = window_SpeakInHouse->ptr_1C; - v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; - v12 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v13 = v0->_490EEE(v116, 2, v12, 3); - v14 = uPlayerID; - v15 = (char *)pMerchantsSellPhrases[v13]; - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); - v123 = 3; - v121 = v36; - v119 = v148; - v117 = (int)v11; - v113 = (int)v11; - v111 = &v144; - v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; - v112 = (unsigned int)v11; - v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); - return; - } - break; - case 4: - { - 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() ) - { - v1 = pMouse->GetCursorPos(&a2)->x - 14; - v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&v141)->x > 13 ) - { - if ( pMouse->GetCursorPos(&v143)->x < 462 ) - { - v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); - if ( v2 ) - { - v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; - if (v3->Identified()) - { - v118 = window_SpeakInHouse->ptr_1C; - v4 = uActiveCharacter - 1; - v5 = "%24"; - v114 = v3; - } - else - { - v118 = window_SpeakInHouse->ptr_1C; - v114 = v3; - v7 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v8 = v0->_490EEE(v3, 2, v7, 4); - v4 = uPlayerID; - v5 = (char *)pMerchantsIdentifyPhrases[v8]; - } - v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); - v123 = 3; - v121 = v6; - v119 = v148; - v115 = (174 - pFontArrus->CalcTextHeight(v6, &v144, 0, 0)) / 2 + 138; - v112 = 0; - v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); - return; - } - } - } - } - } - break; - case 5: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() - || (v31 = pMouse->GetCursorPos(&v135)->x - 14, - v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), - pMouse->GetCursorPos(&v140)->x <= 13) - || pMouse->GetCursorPos(&v138)->x >= 462 - || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) - || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) - return; - v124 = 0; - v122 = 5; - v120 = window_SpeakInHouse->ptr_1C; - v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; - v34 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); - v14 = uPlayerID; - v15 = (char *)pMerchantsRepairPhrases[v35]; - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); - v123 = 3; - v121 = v36; - v119 = v148; - v117 = (int)v11; - v113 = (int)v11; - v111 = &v144; - v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; - v112 = (unsigned int)v11; - v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); - return; - } - break; - case 6: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v149 = 0; - v93 = 0; - do - { - // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) - ++v149; - ++v93; - } - while ( v93 < 8 ); - if ( v149 ) - { - v94 = pMouse->GetCursorPos(&v132); - v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; - v95 = v149; - if ( v149 && v149 != -65536 ) - { - --v149; - v96 = window_SpeakInHouse->ptr_1C; - v97 = uActiveCharacter - 1; - // v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; - v99 = _this->_490EEE( - &pParty->SpecialItemsInShops[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], - 2, - (int)window_SpeakInHouse->ptr_1C, - 2); - v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], v97, v98, (char *)v96, 2, 0); - v101 = v100; - v102 = v148; - v103 = pFontArrus->CalcTextHeight(v100, &v144, 0, 0); - v144.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, v102, v101, 3u); - } - v104 = 0; - v153 = 0; - do - { - //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID) - { - v105 = ItemsInShopTexture[v104]; - if ( v104 >= 4 ) - { - v110 = 90 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); - v127 = v104 + 1; - v109 = v153 + v110 + 80220; - } - else - { - v106 = 98 - v105->uTextureHeight; - v107 = ItemsInShopTexture[v104]; - v108 = 98 - v105->uTextureHeight; - v152 = 86 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); - v127 = v104 + 1; - v109 = v152 + v153 + 640 * v106; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); - } - v153 += 105; - ++v104; - } - while ( v104 < 8 ); - return; - } - v72 = window_SpeakInHouse->ptr_1C; - v144.DrawCurrentTime(pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); - return; - } - break; - case 94: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - v79 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; - v80 = 0; - v81 = pShopOptions; - do - { - v82 = pFontArrus->CalcTextHeight(*v81, &v144, 0, 0); - ++v81; - v80 += v82; - } - while ( (signed int)v81 < (signed int)&pShopOptions[3] ); - v83 = pDialogueWindow; - v152 = (174 - v80) / 3; - v84 = pDialogueWindow->pStartingPosActiveItem; - v85 = v84 + pDialogueWindow->pNumPresenceButton; - v86 = (3 * (58 - v152) - v80) / 2 - v152 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v84, v85) ) - { - v153 = 2; - do - { - v87 = v83->GetControl((unsigned int)_this); - v88 = v87; - v87->uY = v152 + v86; - v89 = pFontArrus->CalcTextHeight(*v79, &v144, 0, 0); - v90 = v88->uY; - v91 = v153; - v88->uHeight = v89; - v86 = v90 + v89 - 1; - v88->uW = v86; - v92 = v147; - if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) - v92 = v148; - v144.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); - v83 = pDialogueWindow; - ++v153; - ++v79; - _this = (Player *)((char *)_this + 1); - } - while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; - } - break; - case 95: //buy spesial - { - - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - - v11 = 0; - v61 = 0; - v153 = 0; - do - { - // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) - { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) - { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v126 = v61 + 1; - v66 = v153 + v67 + 80220; - } - else - { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v126 = v61 + 1; - v66 = v152 + v153 + 640 * v63; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v126); - v11 = 0; - } - v153 += 105; - ++v61; - } - while ( v61 < 8 ); - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v68 = 0; - v149 = (__int32)v11; - - do - { - // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) - ++v149; - ++v68; - } - while ( v68 < 6 ); - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - Str = (char *)v70; - if ( v69 == (short)v11 || (char *)v70 == v11 ) - { - v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185]; - } - DrawTextAtStatusBar(v71, 0); - if ( (char *)v149 != v11 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - v75 = (int)window_SpeakInHouse->ptr_1C; - v76 = 9 * (v74 - 1 + 12 * v75); - if ( dword_F8B19C == 2 ) - v77 = (ItemGen *)&pParty->StandartItemsInShops[(int)75][v74-1]; - else - v77 = &pParty->SpecialItemsInShops[(int)v75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; - if ( v69 == (short)v11 || Str == v11 ) - { - v124 = (__int64 *)v11; - v122 = 2; - v120 = window_SpeakInHouse->ptr_1C; - v116 = v77; - v78 = uActiveCharacter - 1; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; - v14 = v78; - } - else - { - v124 = (__int64 *)v11; - v122 = 2; - v120 = window_SpeakInHouse->ptr_1C; - v116 = v77; - v15 = pGlobalTXT_LocalizationStrings[181]; - v14 = uActiveCharacter - 1; - } - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); - v123 = 3; - v121 = v36; - v119 = v148; - v117 = (int)v11; - v113 = (int)v11; - v111 = &v144; - v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; - v112 = (unsigned int)v11; - v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); - return; - } - v72 = window_SpeakInHouse->ptr_1C; - v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); - return; - } - - break; - case 96: - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v152 = 0; - v37 = pDialogueWindow; - //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); - if ( (signed int)_this < v38 / 3 ) - _this = (Player *)(v38 / 3); - v39 = v37->pStartingPosActiveItem; - v40 = v37->pNumPresenceButton; - v153 = 0; - if ( (signed int)v39 < (signed int)(v39 + v40) ) - { - do - { - v41 = v37->GetControl(v39)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) - { - v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &v144, 0, 0); - v152 += v42; - ++v153; - } - ++v39; - } - while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); - if ( v153 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); - v144.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - _this = (Player *)((149 - v152) / v153); - if ( (149 - v152) / v153 > 32 ) - _this = (Player *)32; - v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; - v152 = v37->pStartingPosActiveItem; - v146 = v43; - if ( v152 < v152 + v37->pNumPresenceButton ) - { - v153 = 2; - do - { - v44 = v37->GetControl(v152); - v45 = v44; - v46 = v44->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) - { - v45->uW = 0; - v45->uHeight = 0; - v45->uY = 0; - } - else - { - v47 = pSkillNames[v46]; - v45->uY = (unsigned int)((char *)_this + v146); - Str = v47; - v48 = pFontArrus->CalcTextHeight(v47, &v144, 0, 0); - v49 = v45->uY; - v50 = v153; - v45->uHeight = v48; - v51 = v49 + v48 - 1; - v45->uW = v51; - v146 = v51; - v52 = v147; - if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) - v52 = v148; - v144.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); - } - v53 = v37->pStartingPosActiveItem; - ++v152; - v54 = v37->pNumPresenceButton + v53; - ++v153; - } - while ( v152 < v54 ); - } - return; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v11 = 0; - v36 = pTmpBuf; - v123 = 3; - v121 = pTmpBuf; - v119 = v147; - v117 = 0; - v113 = 0; - v111 = &v144; - v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; - v112 = (unsigned int)v11; - v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); - return; - break; - - } - - } + { + Player *v0; // ebx@1 + signed int v1; // esi@8 + unsigned int v2; // eax@10 + ItemGen *v3; // eax@11 + unsigned __int8 v4; // dl@12 + char *v5; // ecx@12 + char *v6; // eax@13 + int v7; // ST08_4@15 + int v8; // eax@15 + signed int v9; // esi@17 + unsigned int v10; // eax@19 + char *v11; // edi@19 + int v12; // ST08_4@20 + int v13; // eax@20 + unsigned __int8 v14; // dl@20 + char *v15; // ecx@20 + char **v16; // edi@22 + int all_text_height; // ebx@22 + char **v18; // esi@22 + int v19; // eax@23 + GUIWindow *v20; // ecx@24 + int v21; // eax@24 + int v22; // edx@24 + int v23; // ebx@24 + unsigned __int8 v24; // sf@24 + GUIButton *control_button; // eax@26 + GUIButton *v26; // esi@26 + int v27; // eax@26 + unsigned int v28; // ecx@26 + int v29; // edx@26 + + signed int v31; // esi@31 + unsigned int v32; // eax@33 + int v33; // eax@34 + int v34; // ST08_4@35 + int v35; // eax@35 + char *v36; // edx@36 + GUIWindow *v37; // edi@42 + signed int v38; // esi@42 + unsigned int v39; // esi@44 + int v40; // eax@44 + unsigned int v41; // eax@45 + int v42; // eax@47 + int v43; // ecx@52 + GUIButton *v44; // eax@54 + GUIButton *v45; // esi@54 + int v46; // eax@54 + char *v47; // eax@56 + int v48; // eax@56 + unsigned int v49; // ecx@56 + int v50; // edx@56 + int v51; // eax@56 + unsigned __int16 v52; // ax@56 + int v53; // eax@60 + int textureH; // eax@60 + signed int textureW; // ebx@65 + Texture *v56; // eax@67 + unsigned int v57; // edi@68 + Texture *v58; // ST1C_4@68 + int v59; // eax@68 + int v60; // edi@69 + signed int v61; // ebx@73 + Texture *v62; // eax@75 + int v63; // edi@76 + Texture *v64; // ST1C_4@76 + unsigned int v65; // ST18_4@76 + int v66; // eax@76 + int v67; // edi@77 + signed int v68; // ecx@81 + SHORT v69; // bx@89 + bool v70; // eax@89 + const char *v71; // ecx@91 + void *v72; // eax@95 + POINT *v73; // esi@97 + int v74; // ecx@97 + int v75; // eax@98 + int v76; // ecx@98 + ItemGen *selected_item; // ecx@99 + unsigned __int8 v78; // bl@104 + char **v79; // edi@105 + int v80; // ebx@105 + char **v81; // esi@105 + int v82; // eax@106 + GUIWindow *v83; // ecx@107 + int v84; // eax@107 + int v85; // edx@107 + int v86; // ebx@107 + GUIButton *v87; // eax@109 + GUIButton *v88; // esi@109 + int v89; // eax@109 + unsigned int v90; // ecx@109 + int v91; // edx@109 + unsigned __int16 v92; // ax@109 + signed int v93; // edx@114 + POINT *v94; // edi@120 + __int32 v95; // ecx@120 + void *v96; // ST14_4@122 + unsigned __int8 v97; // bl@122 + ItemGen *v98; // ST10_4@122 + int v99; // eax@122 + char *v100; // eax@122 + const char *v101; // ST18_4@122 + unsigned __int16 v102; // ST14_2@122 + int v103; // eax@122 + signed int v104; // edi@123 + Texture *v105; // eax@125 + int v106; // ebx@126 + Texture *v107; // ST1C_4@126 + unsigned int v108; // ST18_4@126 + int v109; // eax@126 + int v110; // ebx@127 + GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 + unsigned int v112; // [sp-14h] [bp-118h]@13 + int v113; // [sp-14h] [bp-118h]@36 + ItemGen *v114; // [sp-10h] [bp-114h]@12 + unsigned int v115; // [sp-10h] [bp-114h]@13 + ItemGen *v116; // [sp-10h] [bp-114h]@20 + int v117; // [sp-10h] [bp-114h]@36 + void *v118; // [sp-Ch] [bp-110h]@12 + unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 + void *v120; // [sp-Ch] [bp-110h]@20 + char *v121; // [sp-8h] [bp-10Ch]@13 + int v122; // [sp-8h] [bp-10Ch]@20 + unsigned int v123; // [sp-4h] [bp-108h]@13 + __int64 *v124; // [sp-4h] [bp-108h]@20 + int v125; // [sp-4h] [bp-108h]@68 + int v126; // [sp-4h] [bp-108h]@76 + int v127; // [sp-4h] [bp-108h]@126 + POINT v128; // [sp+Ch] [bp-F8h]@8 + POINT v129; // [sp+14h] [bp-F0h]@18 + char v130; // [sp+1Ch] [bp-E8h]@120 + POINT a2; // [sp+24h] [bp-E0h]@8 + POINT v132; // [sp+2Ch] [bp-D8h]@120 + POINT v133; // [sp+34h] [bp-D0h]@17 + POINT v134; // [sp+3Ch] [bp-C8h]@97 + POINT v135; // [sp+44h] [bp-C0h]@31 + POINT v136; // [sp+4Ch] [bp-B8h]@97 + POINT v137; // [sp+54h] [bp-B0h]@17 + POINT v138; // [sp+5Ch] [bp-A8h]@32 + POINT v139; // [sp+64h] [bp-A0h]@17 + POINT v140; // [sp+6Ch] [bp-98h]@31 + POINT v141; // [sp+74h] [bp-90h]@8 + POINT v142; // [sp+7Ch] [bp-88h]@31 + POINT v143; // [sp+84h] [bp-80h]@9 + GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 + char *Str; // [sp+E0h] [bp-24h]@56 + int v146; // [sp+E4h] [bp-20h]@24 + int hilight_color; // [sp+E8h] [bp-1Ch]@1 + int m_text_color; // [sp+ECh] [bp-18h]@1 + __int32 v149; // [sp+F0h] [bp-14h]@8 + Player* _this; // [sp+F4h] [bp-10h]@1 + unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 + int v152; // [sp+FCh] [bp-8h]@24 + int v153; // [sp+100h] [bp-4h]@44 + int th; + short text_color; + + v0 = pPlayers[uActiveCharacter]; + _this = pPlayers[uActiveCharacter]; + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch (dialog_menu_id) + { + case 1: //main shop text + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + + 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 ) + { + th = 2; + for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) + { + control_button = pDialogueWindow->GetControl(v152); + control_button->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); + control_button->uHeight = v27; + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != th ) + text_color = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); + ++th; + ++j; + } + } + } + break; + case 2: //buy standart + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + textureW = 0; + v153 = 0; + for(int i=0; i<8; ++i) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); + { + textureW = ItemsInShopTexture[i]->uTextureWidth; + textureH = ItemsInShopTexture[i]->uTextureHeight; + if ( i >= 4 ) //low row + { + v60 = 90 - (textureW/2); + pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); + v59 = v60 + v153 + 80220; + } + else + { + v57 = 98 - textureH; + v152 = 86 - (textureW/2); + pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); + v59 = v153 + v152 + 640 * v57; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); + } + v153 += 105; + + } + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + + v149 = 0; + for(int i=0; i<8; ++i) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); + ++v149; + + } + + v69 = GetAsyncKeyState(17); + v70 = _this->CanSteal(); + //Str = (char *)v70; + if ( v69 == 0 || v70 == 0 ) + { + v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + } + else + { + v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" + } + DrawTextAtStatusBar(v71, 0); + if ( v149 != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + v149 = v74 - 1; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; + if ( v69 ==0 || v70 == 0) + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + } + else + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + } + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case 3: //sell + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + + if((v9 = pMouse->GetCursorPos(&v139)->x - 14, + v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), + pMouse->GetCursorPos(&v137)->x <= 13) + || pMouse->GetCursorPos(&v129)->x >= 462 + || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) + return; + + v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; + + v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); + + v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; + v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); + + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + break; + case 4: //identify + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v1 = pMouse->GetCursorPos(&a2)->x - 14; + v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&v141)->x > 13 ) + { + if ( pMouse->GetCursorPos(&v143)->x < 462 ) + { + v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); + if ( v2 ) + { + v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; + if (v3->Identified()) + { + v118 = window_SpeakInHouse->ptr_1C; + v4 = uActiveCharacter - 1; + v5 = "%24"; + v114 = v3; + } + else + { + v118 = window_SpeakInHouse->ptr_1C; + v114 = v3; + v7 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v8 = v0->_490EEE(v3, 2, v7, 4); + v4 = uPlayerID; + v5 = (char *)pMerchantsIdentifyPhrases[v8]; + } + v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3); + return; + } + } + } + } + } + break; + case 5: //repair + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + + if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, + v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), + pMouse->GetCursorPos(&v140)->x <= 13) + || pMouse->GetCursorPos(&v138)->x >= 462 + || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) + || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) + return; + + + v120 = window_SpeakInHouse->ptr_1C; + v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; + v34 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); + v14 = uPlayerID; + v15 = (char *)pMerchantsRepairPhrases[v35]; + v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + break; + case 6: //buy standart + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v149 = 0; + for(int i=0;i<6;++i) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + ++v149; + + + if ( v149 ) + { + v94 = pMouse->GetCursorPos(&v132); + v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; + v95 = v149; + if ( v149 && v149 != -65536 ) + { + --v149; + + v97 = uActiveCharacter - 1; + + v99 = _this->_490EEE( + &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); + v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); + v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3); + } + v104 = 0; + v153 = 0; + do + { + //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) + { + v105 = ItemsInShopTexture[v104]; + if ( v104 >= 4 ) + { + v110 = 90 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); + v127 = v104 + 1; + v109 = v153 + v110 + 80220; + } + else + { + v106 = 98 - v105->uTextureHeight; + v107 = ItemsInShopTexture[v104]; + v108 = 98 - v105->uTextureHeight; + v152 = 86 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); + v127 = v104 + 1; + v109 = v152 + v153 + 640 * v106; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); + } + v153 += 105; + ++v104; + } + while ( v104 < 8 ); + return; + } + dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case 94: //character inventory + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + v79 = pShopOptions; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" + + all_text_height = 0; + for(int i=0;i<3;++i) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v83 = pDialogueWindow; + v152 = (174 - all_text_height) / 3; + v84 = pDialogueWindow->pStartingPosActiveItem; + v85 = v84 + pDialogueWindow->pNumPresenceButton; + v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; + v24 = -pDialogueWindow->pNumPresenceButton < 0; + _this = (Player *)pDialogueWindow->pStartingPosActiveItem; + if ( v24 ^ __OFSUB__(v84, v85) ) + { + v153 = 2; + do + { + v87 = v83->GetControl((unsigned int)_this); + v88 = v87; + v87->uY = v152 + v86; + v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); + v90 = v88->uY; + v91 = v153; + v88->uHeight = v89; + v86 = v90 + v89 - 1; + v88->uW = v86; + v92 = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) + v92 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); + v83 = pDialogueWindow; + ++v153; + ++v79; + _this = (Player *)((char *)_this + 1); + } + while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + return; + } + break; + case 95: //buy spesial + { + + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + + v11 = 0; + v61 = 0; + v153 = 0; + do + { + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) + { + v62 = ItemsInShopTexture[v61]; + if ( v61 >= 4 ) + { + v67 = 90 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); + v66 = v153 + v67 + 80220; + } + else + { + v63 = 98 - v62->uTextureHeight; + v64 = ItemsInShopTexture[v61]; + v65 = 98 - v62->uTextureHeight; + v152 = 86 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); + v66 = v152 + v153 + 640 * v63; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); + } + v153 += 105; + ++v61; + } + while ( v61 < 8 ); + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v68 = 0; + v149 = 0; + + do + { + // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) + ++v149; + ++v68; + } + while ( v68 < 6 ); + + v69 = GetAsyncKeyState(17); + v70 = _this->CanSteal(); + Str = (char *)v70; + if ( v69 == 0 || (char *)v70 == 0 ) + { + v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + } + else + { + v71 = pGlobalTXT_LocalizationStrings[185]; + } + DrawTextAtStatusBar(v71, 0); + if ( (char *)v149 != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + v149 = v74 - 1; + + if ( dialog_menu_id == 2 ) + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; + else + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; + if ( v69 == 0 || Str == 0 ) + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + } + else + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + } + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + + break; + case 96: //skills + { + + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v152 = 0; + v37 = pDialogueWindow; + //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); + if ( (signed int)_this < v38 / 3 ) + _this = (Player *)(v38 / 3); + v39 = v37->pStartingPosActiveItem; + v40 = v37->pNumPresenceButton; + v153 = 0; + if ( (signed int)v39 < (signed int)(v39 + v40) ) + { + do + { + v41 = v37->GetControl(v39)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) + { + v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); + v152 += v42; + ++v153; + } + ++v39; + } + while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); + if ( v153 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + _this = (Player *)((149 - v152) / v153); + if ( (149 - v152) / v153 > 32 ) + _this = (Player *)32; + v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; + v152 = v37->pStartingPosActiveItem; + v146 = v43; + if ( v152 < v152 + v37->pNumPresenceButton ) + { + v153 = 2; + do + { + v44 = v37->GetControl(v152); + v45 = v44; + v46 = v44->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) + { + v45->uW = 0; + v45->uHeight = 0; + v45->uY = 0; + } + else + { + v47 = pSkillNames[v46]; + v45->uY = (unsigned int)((char *)_this + v146); + Str = v47; + v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0); + v49 = v45->uY; + v50 = v153; + v45->uHeight = v48; + v51 = v49 + v48 - 1; + v45->uW = v51; + v146 = v51; + v52 = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) + v52 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); + } + v53 = v37->pStartingPosActiveItem; + ++v152; + textureH = v37->pNumPresenceButton + v53; + ++v153; + } + while ( v152 < textureH ); + } + return; + } + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3); + return; + } + break; + + } + + } //----- (004BB756) -------------------------------------------------------- signed int __fastcall sub_4BB756(signed int a1) @@ -3364,7 +3288,7 @@ pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) { @@ -3952,7 +3876,7 @@ return; pRenderer->ClearZBuffer(0, 479); //v3 = dword_F8B198; - if ( dword_F8B19C != 1 ) + if ( dialog_menu_id != 1 ) { v8 = window_SpeakInHouse; } @@ -4010,7 +3934,7 @@ } } //LABEL_11: - dword_F8B19C = uMessageParam; + dialog_menu_id = uMessageParam; if ( in_current_building_type < BildingType_19 ) { v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); @@ -4024,7 +3948,7 @@ { if ( in_current_building_type == BildingType_Bank ) { - if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; } @@ -4296,10 +4220,10 @@ sub_4B3A72(in_current_building_type); break; case 102: - dword_F8B19C = 102; + dialog_menu_id = 102; break; case 103: - dword_F8B19C = 103; + dialog_menu_id = 103; break; case 104: /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -4310,7 +4234,7 @@ ++pMessageQueue_50CBD0->uNumMessages; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1); - dword_F8B19C = 104; + dialog_menu_id = 104; break; } return; @@ -4319,13 +4243,13 @@ { if ( uMessageParam == 3 ) { - dword_F8B19C = 3; + dialog_menu_id = 3; } else { if ( uMessageParam == 4 ) { - dword_F8B19C = 4; + dialog_menu_id = 4; } else { @@ -4386,7 +4310,7 @@ } return; } - dword_F8B19C = 5; + dialog_menu_id = 5; } } sub_421B2C_PlaceInInventory_or_DropPickedItem(); @@ -4517,16 +4441,16 @@ ptr_F8B1E8 = 0; if ( pDialogueNPCCount ) { - v0 = dword_F8B19C; - if ( dword_F8B19C != 2 - && dword_F8B19C != 3 - && dword_F8B19C != 97 - && dword_F8B19C != 5 - && dword_F8B19C != 4 + v0 = dialog_menu_id; + if ( dialog_menu_id != 2 + && dialog_menu_id != 3 + && dialog_menu_id != 97 + && dialog_menu_id != 5 + && dialog_menu_id != 4 && ShopTexture ) { ShopTexture->Release(); - v0 = dword_F8B19C; + v0 = dialog_menu_id; ShopTexture = 0; } if ( v0 && v0 != 1 ) @@ -4543,7 +4467,7 @@ if ( v0 == 3 || v0 == 5 || v0 == 4 ) { UI_CreateEndConversationButton(); - dword_F8B19C = 94; + dialog_menu_id = 94; sub_4B3AD4(in_current_building_type); } else @@ -4552,26 +4476,26 @@ { pVideoPlayer->_4BF5B2(); //LABEL_28: - dword_F8B19C = 1; + dialog_menu_id = 1; sub_4B3B42(in_current_building_type); return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - dword_F8B19C = 101; + dialog_menu_id = 101; sub_4B3A72(in_current_building_type); } return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - dword_F8B19C = 1; + dialog_menu_id = 1; sub_4B3B42(in_current_building_type); return 1; } pDialogueNPCCount = 0; pDialogueWindow->Release(); - dword_F8B19C = 0; + dialog_menu_id = 0; pDialogueWindow = 0; pIcons_LOD->_40F9C5(); v1 = uNumDialogueNPCPortraits; @@ -4708,13 +4632,13 @@ pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); return; } - if ( dword_F8B19C > 18 ) - { - if ( dword_F8B19C < 36 ) + if ( dialog_menu_id > 18 ) + { + if ( dialog_menu_id < 36 ) return; - if ( dword_F8B19C <= 72 ) - { - v42 = dword_F8B19C - 36; + if ( dialog_menu_id <= 72 ) + { + v42 = dialog_menu_id - 36; //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); v44 = v43 * (100 - v0->GetMerchant()) / 100; @@ -4748,9 +4672,9 @@ } return; } - if ( dword_F8B19C != 94 ) - { - if ( dword_F8B19C != 95 ) + if ( dialog_menu_id != 94 ) + { + if ( dialog_menu_id != 95 ) return; goto LABEL_49; } @@ -4759,7 +4683,7 @@ sub_421EA6_OnInventoryLeftClick(); return; } - if ( dword_F8B19C == 18 ) + if ( dialog_menu_id == 18 ) { v17 = pMouse->GetCursorPos(&v63); v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; @@ -4808,7 +4732,7 @@ ShowStatusBarString(v9, v54); return; } - if ( dword_F8B19C == 2 ) + if ( dialog_menu_id == 2 ) { LABEL_49: v28 = pMouse->GetCursorPos(&v59); @@ -4817,7 +4741,7 @@ return; v30 = window_SpeakInHouse->ptr_1C; // v31 = 9 * (v29 - 1 + 12 * (int)v30); - if ( dword_F8B19C == 2 ) + if ( dialog_menu_id == 2 ) { v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; @@ -4916,7 +4840,7 @@ ShowStatusBarString(v9, v54); return; } - if ( dword_F8B19C == 3 ) + if ( dialog_menu_id == 3 ) { v14 = pMouse->GetCursorPos(&v71)->x - 14; v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); @@ -4949,7 +4873,7 @@ pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); return; } - if ( dword_F8B19C == 4 ) + if ( dialog_menu_id == 4 ) { v10 = pMouse->GetCursorPos(&v62)->x - 14; v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5); @@ -5003,7 +4927,7 @@ } else { - if ( dword_F8B19C == 5 ) + if ( dialog_menu_id == 5 ) { v1 = pMouse->GetCursorPos(&a2)->x - 14; v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); diff -r 975a231bb4ec -r cfca6297e4ae mm7_4.cpp --- a/mm7_4.cpp Thu Mar 07 15:26:44 2013 +0600 +++ b/mm7_4.cpp Fri Mar 08 00:36:33 2013 +0400 @@ -4806,8 +4806,8 @@ // AE3370: using guessed type int dword_AE3370; //----- (00495430) -------------------------------------------------------- -char *__fastcall GetReputationString(signed int a1) -{ +char * GetReputationString( signed int a1 ) + { if (a1 >= 25) return pGlobalTXT_LocalizationStrings[379]; // Hated else if (a1 >= 6) @@ -9070,11 +9070,11 @@ return; if ( in_current_building_type <= BildingType_AlchemistShop ) { - if ( dword_F8B19C != 2 ) - { - if ( dword_F8B19C <= 2 ) + if ( dialog_menu_id != 2 ) + { + if ( dialog_menu_id <= 2 ) return; - if ( dword_F8B19C <= 5 || dword_F8B19C == 94 ) + if ( dialog_menu_id <= 5 || dialog_menu_id == 94 ) { v8 = pMouse->GetCursorPos(&v15)->x - 14; v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); @@ -9087,7 +9087,7 @@ GameUI_DrawItemInfo(v7); return; } - if ( dword_F8B19C != 95 ) + if ( dialog_menu_id != 95 ) return; } v4 = pMouse->GetCursorPos(&v11); @@ -9097,12 +9097,12 @@ return; v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; goto LABEL_15; } - if ( in_current_building_type <= BildingType_16 && dword_F8B19C == BildingType_18 ) + if ( in_current_building_type <= BildingType_16 && dialog_menu_id == BildingType_18 ) { v1 = pMouse->GetCursorPos(&a2); v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; @@ -9393,7 +9393,7 @@ case 13: ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); - sub_4B40E6(); + NPCHireableDialogPrepare(); dialogue_show_profession_details = false; goto _return; case 19: @@ -9619,7 +9619,7 @@ pParty->field_709 = 0; sub_44A56A(); PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); - dword_F8B19C = 1; + dialog_menu_id = 1; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -10616,7 +10616,7 @@ pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; } // F8B19C: using guessed type int dword_F8B19C; @@ -10642,14 +10642,14 @@ v2 = pGlobalTXT_LocalizationStrings[535]; pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; } // F8B19C: using guessed type int dword_F8B19C; // F8B1A8: using guessed type int dword_F8B1A8; //----- (004B40E6) -------------------------------------------------------- -void __cdecl sub_4B40E6() -{ +void NPCHireableDialogPrepare() + { signed int v0; // ebx@1 NPCData *v1; // edi@1 @@ -10657,50 +10657,21 @@ v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x1D7u, - 0x1BDu, - 0xA9u, - 0x23u, - 1, - 0, - 0x71u, - 0, - 0, - pGlobalTXT_LocalizationStrings[34], + pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, + pGlobalTXT_LocalizationStrings[34], //"Cancel" (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) { - pDialogueWindow->CreateButton( - 0x1E0u, - 0xA0u, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x4Du, - 0, - pGlobalTXT_LocalizationStrings[407], - 0); + pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, + pGlobalTXT_LocalizationStrings[407], 0);//"More Information" v0 = 1; } - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v0 + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x4Cu, - 0, - pGlobalTXT_LocalizationStrings[406], - 0); + pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, + pGlobalTXT_LocalizationStrings[406], 0); //"Hire" pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; } @@ -10737,7 +10708,7 @@ else { v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; - if ( dword_F8B19C == -1 ) + if ( dialog_menu_id == -1 ) { pDialogueWindow->Release(); } @@ -10820,7 +10791,7 @@ pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } - dword_F8B19C = 1; + dialog_menu_id = 1; } } @@ -10962,12 +10933,12 @@ result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C != 17 ) - { - result = dword_F8B19C - 96; - if ( dword_F8B19C == 96 ) + if ( dialog_menu_id != 1 ) + { + if ( dialog_menu_id != 17 ) + { + result = dialog_menu_id - 96; + if ( dialog_menu_id == 96 ) { result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) @@ -11247,8 +11218,8 @@ //----- (004B4FCF) -------------------------------------------------------- -int __cdecl MagicShopDialog() -{ +void MagicShopDialog() + { Player *v0; // ebx@1 int result; // eax@6 signed int v2; // esi@8 @@ -11263,19 +11234,19 @@ signed int v11; // esi@16 int v12; // ST08_4@19 int v13; // eax@19 - int v14; // edi@21 + int all_text_height; // edi@21 char **v15; // esi@21 int v16; // eax@22 GUIWindow *v17; // ecx@23 int v18; // edx@23 int v19; // edi@23 unsigned __int8 v20; // sf@23 - GUIButton *v21; // esi@25 + 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 v26; // ax@25 + unsigned __int16 text_color; // ax@25 signed int v27; // esi@30 int v28; // ST08_4@34 int v29; // eax@34 @@ -11361,29 +11332,31 @@ POINT a2; // [sp+64h] [bp-94h]@8 POINT v110; // [sp+6Ch] [bp-8Ch]@30 POINT v111; // [sp+74h] [bp-84h]@8 - GUIWindow v112; // [sp+7Ch] [bp-7Ch]@1 + GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 char *Str; // [sp+D0h] [bp-28h]@54 - int v114; // [sp+D4h] [bp-24h]@23 - unsigned int color2; // [sp+D8h] [bp-20h]@1 - unsigned int white; // [sp+DCh] [bp-1Ch]@1 + int v146; // [sp+D4h] [bp-24h]@23 + unsigned int hilight_color; // [sp+D8h] [bp-20h]@1 + unsigned int m_text_color; // [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 Player *_this; // [sp+ECh] [bp-Ch]@1 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 - int v122; // [sp+F4h] [bp-4h]@23 + int v152; // [sp+F4h] [bp-4h]@23 + int v122; + int v114; v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; - memcpy(&v112, window_SpeakInHouse, sizeof(v112)); - v112.uFrameX = 483; - v112.uFrameWidth = 148; - v112.uFrameZ = 334; - white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - if ( dword_F8B19C > 5 ) - { - if ( dword_F8B19C == 94 ) + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + if ( dialog_menu_id > 5 ) + { + if ( dialog_menu_id == 94 ) { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -11394,7 +11367,7 @@ v77 = pShopOptions; do { - v78 = pFontArrus->CalcTextHeight(*v77, &v112, 0, 0); + v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0); ++v77; v76 += v78; } @@ -11415,16 +11388,16 @@ v82 = v79->GetControl(v118); v83 = v119; v82->uY = (unsigned int)((char *)_this + v81); - v84 = pFontArrus->CalcTextHeight(*v83, &v112, 0, 0); + v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0); v85 = v82->uY; v86 = v122; v82->uHeight = v84; v81 = v84 + v85 - 1; v82->uW = v81; - v87 = color2; + v87 = hilight_color; if ( pDialogueWindow->pCurrentPosActiveItem != v86 ) - v87 = white; - v112.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u); + v87 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u); v79 = pDialogueWindow; ++v122; ++v119; @@ -11433,12 +11406,12 @@ } while ( v118 < result ); } - return result; - } - if ( dword_F8B19C != 95 ) - { - result = dword_F8B19C - 96; - if ( dword_F8B19C == 96 ) + return; + } + if ( dialog_menu_id != 95 ) + { + result = dialog_menu_id - 96; + if ( dialog_menu_id == 96 ) { result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) @@ -11462,7 +11435,7 @@ v36 = v31->GetControl(v34)->uControlParam - 36; if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] ) { - v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &v112, 0, 0); + v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); v118 += v37; ++v122; } @@ -11479,14 +11452,14 @@ v30 = pTmpBuf; v97 = 3; v95 = pTmpBuf; - v92 = color2; + v92 = hilight_color; v91 = 0; v89 = 0; - v88 = &v112; + v88 = &dialog_window; goto LABEL_61; } sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" - v112.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); v119 = (const char **)((149 - v118) / v122); if ( (149 - v118) / v122 > 32 ) v119 = (const char **)32; @@ -11513,17 +11486,17 @@ v42 = pSkillNames[v41]; v40->uY = (unsigned int)((char *)v119 + v114); Str = v42; - v43 = pFontArrus->CalcTextHeight(v42, &v112, 0, 0); + v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0); v44 = v40->uY; v45 = v122; v40->uHeight = v43; v46 = v44 + v43 - 1; v40->uW = v46; v114 = v46; - v47 = color2; + v47 = hilight_color; if ( pDialogueWindow->pCurrentPosActiveItem != v45 ) - v47 = white; - v112.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u); + v47 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u); } v48 = v31->pStartingPosActiveItem; ++v118; @@ -11534,12 +11507,12 @@ } } } - return result; + return; } } else { - if ( dword_F8B19C == 5 ) + if ( dialog_menu_id == 5 ) { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -11553,7 +11526,7 @@ || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) - return result; + return; v96 = 0; v94 = 5; v93 = window_SpeakInHouse->ptr_1C; @@ -11565,9 +11538,9 @@ v10 = (char *)pMerchantsRepairPhrases[v29]; goto LABEL_35; } - if ( dword_F8B19C == 1 ) - { - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( dialog_menu_id == 1 ) + { + /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" @@ -11578,7 +11551,7 @@ v15 = pShopOptions; do { - v16 = pFontArrus->CalcTextHeight(*v15, &v112, 0, 0); + v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0); ++v15; v14 += v16; } @@ -11599,7 +11572,7 @@ v21 = v17->GetControl(v122); v22 = (const char **)_this; v21->uY = v114 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &v112, 0, 0); + v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0); v24 = v21->uY; v25 = v119; v21->uHeight = v23; @@ -11607,8 +11580,8 @@ v21->uW = v19; v26 = color2; if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = white; - v112.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); + v26 = m_text_color; + dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); v17 = pDialogueWindow; v119 = (const char **)((char *)v119 + 1); _this = (Player *)((char *)_this + 4); @@ -11617,15 +11590,50 @@ } while ( v122 < result ); } - } - return result; - } - if ( dword_F8B19C != 2 ) - { - if ( dword_F8B19C != 3 ) - { - result = dword_F8B19C - 4; - if ( dword_F8B19C == 4 ) + }*/ + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + + 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 ) + { + int th = 2; + for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) + { + control_button = pDialogueWindow->GetControl(v152); + control_button->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); + control_button->uHeight = v27; + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != th ) + text_color = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); + ++th; + ++j; + } + } + + + return; + } + if ( dialog_menu_id != 2 ) + { + if ( dialog_menu_id != 3 ) + { + result = dialog_menu_id - 4; + if ( dialog_menu_id == 4 ) { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -11653,9 +11661,11 @@ v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); v97 = 3; v95 = v5; - v92 = white; - v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101; - return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + v92 = m_text_color; + v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; + + dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + return; } v93 = window_SpeakInHouse->ptr_1C; v90 = (ItemGen *)v4; @@ -11670,7 +11680,7 @@ } } } - return result; + return; } draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -11683,7 +11693,7 @@ *(int *)result <= 13) || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) - return result; + return; v96 = 0; v94 = 3; v93 = window_SpeakInHouse->ptr_1C; @@ -11697,20 +11707,21 @@ v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); v97 = 3; v95 = v30; - v92 = white; + v92 = m_text_color; v91 = v3; v89 = v3; - v88 = &v112; + v88 = &dialog_window; LABEL_61: v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; - return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + return; } } pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); v3 = 0; v49 = 0; v122 = 0; - if ( dword_F8B19C == 2 ) + if ( dialog_menu_id == 2 ) { do { @@ -11845,7 +11856,7 @@ { v66 = 0; v117 = 0; - if ( dword_F8B19C == 2 ) + if ( dialog_menu_id == 2 ) { do { @@ -11876,14 +11887,14 @@ else { v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" } DrawTextAtStatusBar(v69, 0); if ( !v117 ) { - v112.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return 0; + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; } v70 = pMouse->GetCursorPos(&v102); result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; @@ -11894,7 +11905,7 @@ v72 = (int)window_SpeakInHouse->ptr_1C; // v73 = 9 * (v71 + 12 * v72); v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; v74 =&pParty->SpecialItemsInShops[v72][v71]; if ( v67 && Str ) @@ -11920,7 +11931,7 @@ goto LABEL_35; } } - return result; + return; } //----- (004BC49B) -------------------------------------------------------- @@ -12303,16 +12314,16 @@ strcpy(v47, ""); strcpy(v48, ""); strcpy(v49, ""); - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C != 18 ) //buy skill + if ( dialog_menu_id != 1 ) + { + if ( dialog_menu_id != 18 ) //buy skill { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill - if ( v58->pActiveSkills[dword_F8B19C-36] ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C - 16]); //"You already know the %s skill" + if ( v58->pActiveSkills[dialog_menu_id-36] ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" ShowStatusBarString(pTmpBuf, 2u); pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } @@ -12326,7 +12337,7 @@ else { Party::TakeGold(v63); - v58->pActiveSkills[dword_F8B19C-36] = 1; + v58->pActiveSkills[dialog_menu_id-36] = 1; } } } @@ -12389,7 +12400,7 @@ GetAsyncKeyState(17); statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" DrawTextAtStatusBar(statusbar_string, 0); if ( !v8 ) @@ -12630,14 +12641,14 @@ //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); HIDWORD(v60) = v2; - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C != 10 ) - { - if ( dword_F8B19C != 11 ) - { - - if ( dword_F8B19C == 96 ) + if ( dialog_menu_id != 1 ) + { + if ( dialog_menu_id != 10 ) + { + if ( dialog_menu_id != 11 ) + { + + if ( dialog_menu_id == 96 ) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -12984,7 +12995,7 @@ v4 = v3 / 3; v32 = v3 / 3; } - if ( dword_F8B19C != 1 ) + if ( dialog_menu_id != 1 ) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -12999,7 +13010,7 @@ if (false //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) - || (v6 = (int)(&v1->uIntelligence + dword_F8B19C), *(short *)v6) ) + || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } @@ -13224,7 +13235,7 @@ s1 = v4 * (100 - v1->GetMerchant()) / 100; if ( (signed int)s1 < v4 / 3 ) s1 = v4 / 3; - if ( dword_F8B19C == 1 ) + if ( dialog_menu_id == 1 ) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -13366,7 +13377,7 @@ } else { - if ( dword_F8B19C > 104 && dword_F8B19C <= 108 ) + if ( dialog_menu_id > 104 && dialog_menu_id <= 108 ) { if ( pParty->uNumGold < s1 ) { @@ -13381,7 +13392,7 @@ } Party::TakeGold(s1); v47[1] = (const char *)7; - v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dword_F8B19C)]; + v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)]; if ( v5[pParty->uDaysPlayed % 7 + 1] ) { if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) @@ -13462,7 +13473,7 @@ } else { - dword_F8B19C = 1; + dialog_menu_id = 1; pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } } diff -r 975a231bb4ec -r cfca6297e4ae mm7_data.cpp --- a/mm7_data.cpp Thu Mar 07 15:26:44 2013 +0600 +++ b/mm7_data.cpp Fri Mar 08 00:36:33 2013 +0400 @@ -2362,7 +2362,7 @@ struct Texture *ShopTexture; // idb struct Texture *ItemsInShopTexture[12]; int in_current_building_type; // 0xF8B198 -int dword_F8B19C; // weak +int dialog_menu_id; // weak __int16 word_F8B1A0; // weak const char *dword_F8B1A4; // idb int contract_approved; // weak diff -r 975a231bb4ec -r cfca6297e4ae mm7_data.h --- a/mm7_data.h Thu Mar 07 15:26:44 2013 +0600 +++ b/mm7_data.h Fri Mar 08 00:36:33 2013 +0400 @@ -1687,7 +1687,7 @@ extern struct Texture *ShopTexture; // idb extern struct Texture *ItemsInShopTexture[12]; extern int in_current_building_type; // weak -extern int dword_F8B19C; // weak +extern int dialog_menu_id; // weak extern __int16 word_F8B1A0; // weak extern const char *dword_F8B1A4; // idb extern int contract_approved; // weak @@ -2253,7 +2253,7 @@ void __cdecl _494035_timed_effects__water_walking_damage__etc(); unsigned int __fastcall sub_494820(unsigned int a1); char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2); -char *__fastcall GetReputationString(signed int a1); +char * GetReputationString(signed int a1); char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, struct ItemGen *a3, char *a4, int a5, __int64 *a6); void __cdecl PlayerCreationUI_Draw(); void __cdecl PlayerCreationUI_Initialize(); @@ -2314,13 +2314,13 @@ void __cdecl sub_4B3E1E(); void DrawJoinGuildWindow(int pEventCode); void __fastcall sub_4B3FE5(int a4); -void __cdecl sub_4B40E6(); +void NPCHireableDialogPrepare(); void _4B4224_UpdateNPCTopics(int _this); char __fastcall DrawTextAtStatusBar(const char *Str, int a5); int __fastcall sub_4B46F8(int a1); int __cdecl TrainingDialog(); char *__cdecl JailDialog(); -int __cdecl MagicShopDialog(); +void MagicShopDialog(); void GuildDialog(); int __cdecl sub_4B6478(); bool __fastcall sub_4B68EA(int a1);