diff mm7_2.cpp @ 615:8a0ec99a5177

Слияние
author Ritor1
date Fri, 08 Mar 2013 18:00:43 +0600
parents 5bf285f56fa8 cfca6297e4ae
children 574cc56e05e9
line wrap: on
line diff
--- a/mm7_2.cpp	Fri Mar 08 17:59:54 2013 +0600
+++ b/mm7_2.cpp	Fri Mar 08 18:00:43 2013 +0600
@@ -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);