changeset 623:bd9f43d4fc3d

Height text in Armor shop dialog
author Ritor1
date Sat, 09 Mar 2013 00:33:04 +0600
parents d92de5102da8
children 7e13a40b2718
files GUIWindow.h MM7.vcxproj.filters mm7_2.cpp mm7_data.h
diffstat 4 files changed, 134 insertions(+), 131 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Fri Mar 08 22:41:24 2013 +0600
+++ b/GUIWindow.h	Sat Mar 09 00:33:04 2013 +0600
@@ -325,7 +325,17 @@
   UIMSG_ToggleTint = 0x1A8,
   UIMSG_1A9 = 0x1A9,
 };
-
+enum DIALOG_MENU
+{
+  DIALOG_SHOP_MAIN = 1,
+  DIALOG_SHOP_BUY_STANDART = 2,
+  DIALOG_SHOP_SELL = 3,
+  DIALOG_SHOP_IDENTIFY = 4,
+  DIALOG_SHOP_REPAIR = 5,
+  DIALOG_SHOP_DISPLAY_EQUIPMENT = 94,
+  DIALOG_SHOP_BUY_SPECIAL = 95,
+  DIALOG_SHOP_SKILLS = 96,
+};
 enum CURRENT_SCREEN
 {
   SCREEN_GAME = 0x0,
--- a/MM7.vcxproj.filters	Fri Mar 08 22:41:24 2013 +0600
+++ b/MM7.vcxproj.filters	Sat Mar 09 00:33:04 2013 +0600
@@ -200,6 +200,8 @@
     <ClInclude Include="resource.h" />
     <ClInclude Include="stru346.h" />
     <ClInclude Include="texts.h" />
+    <ClInclude Include="SpriteObject.h" />
+    <ClInclude Include="stru179.h" />
   </ItemGroup>
   <ItemGroup>
     <Filter Include="lib">
@@ -319,6 +321,7 @@
     <ClCompile Include="mm7text_ru.cpp" />
     <ClCompile Include="NPC.cpp" />
     <ClCompile Include="SpriteObject.cpp" />
+    <ClCompile Include="UIHouses.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Might and Magic Trilogy.rc" />
--- a/mm7_2.cpp	Fri Mar 08 22:41:24 2013 +0600
+++ b/mm7_2.cpp	Sat Mar 09 00:33:04 2013 +0600
@@ -976,9 +976,9 @@
 
 
 //----- (004B910F) --------------------------------------------------------
-char *__cdecl WeaponShopDialog()
-{
-  Player *v0; // ebx@1
+void __cdecl WeaponShopDialog()
+{
+  //Player *v0; // ebx@1
   char *result; // eax@6
   signed int v2; // esi@8
   unsigned int v3; // ebx@10
@@ -1043,7 +1043,7 @@
   int v62; // ecx@90
   ItemGen *v63; // esi@90
   int v64; // eax@95
-  int v65; // esi@96
+  int all_text_height; // esi@96
   char **v66; // edi@96
   int v67; // eax@97
   GUIWindow *v68; // ecx@98
@@ -1079,71 +1079,65 @@
   POINT a2; // [sp+64h] [bp-94h]@8
   POINT v99; // [sp+6Ch] [bp-8Ch]@32
   POINT v100; // [sp+74h] [bp-84h]@8
-  GUIWindow v101; // [sp+7Ch] [bp-7Ch]@1
+  GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
   char *Str; // [sp+D0h] [bp-28h]@55
   __int32 v103; // [sp+D4h] [bp-24h]@25
-  int v104; // [sp+D8h] [bp-20h]@1
-  int v105; // [sp+DCh] [bp-1Ch]@1
+  int pColor2; // [sp+D8h] [bp-20h]@1
+  int pColorWhite; // [sp+DCh] [bp-1Ch]@1
   POINT v106; // [sp+E0h] [bp-18h]@8
-  Player *_this; // [sp+E8h] [bp-10h]@1
+  Player *pPlayer; // [sp+E8h] [bp-10h]@1
   int v108; // [sp+ECh] [bp-Ch]@26
   const char **v109; // [sp+F0h] [bp-8h]@26
   unsigned __int8 v110; // [sp+F7h] [bp-1h]@16
 
-  v0 = pPlayers[uActiveCharacter];
-  _this = pPlayers[uActiveCharacter];
-  memcpy(&v101, window_SpeakInHouse, sizeof(v101));
-  v101.uFrameX = 483;
-  v101.uFrameWidth = 148;
-  v101.uFrameZ = 334;
-  v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
+  //v0 = pPlayers[uActiveCharacter];
+  pPlayer = pPlayers[uActiveCharacter];
+  memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
+  dialog_window.uFrameX = 483;
+  dialog_window.uFrameWidth = 148;
+  dialog_window.uFrameZ = 334;
+  pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
   switch(dialog_menu_id)
   {
-	case 94:
-		{
+	case DIALOG_SHOP_DISPLAY_EQUIPMENT:
+	{
 		draw_leather();
 		CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
-		pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
-		pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
-		pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];
-		v65 = 0;
-		v66 = pShopOptions;
-		do
-		{
-			v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0);
-			++v66;
-			v65 += v67;
-		}
-		while ( (signed int)v66 < (signed int)&pShopOptions[3] );
+		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);
 		v68 = pDialogueWindow;
-		v109 = (const char **)((174 - v65) / 3);
+		v109 = (const char **)((174 - all_text_height) / 3);
 		result = (char *)pDialogueWindow->pStartingPosActiveItem;
 		v69 = (int)&result[pDialogueWindow->pNumPresenceButton];
-		v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138;
+		v70 = (3 * (58 - (signed int)v109) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
 		v20 = -pDialogueWindow->pNumPresenceButton < 0;
 		v106.y = pDialogueWindow->pStartingPosActiveItem;
 		if ( v20 ^ __OFSUB__((int)result, (int)v69) )
 		{
-			_this = (Player *)2;
+			pPlayer = (Player *)2;
 			v108 = (int)pShopOptions;
 			do
 			{
 				v71 = v68->GetControl(v106.y);
 				v72 = (const char **)v108;
 				v71->uY = (unsigned int)((char *)v109 + v70);
-				v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0);
+				v73 = pFontArrus->CalcTextHeight(*v72, &dialog_window, 0, 0);
 				v74 = v71->uY;
-				v75 = _this;
+				v75 = pPlayer;
 				v71->uHeight = v73;
 				v70 = v73 + v74 - 1;
 				v71->uW = v70;
-				v76 = v104;
+				v76 = pColor2;
 				if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 )
-				v76 = v105;
-				v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u);
+				v76 = pColorWhite;
+				dialog_window.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u);
 				v68 = pDialogueWindow;
-				_this = (Player *)((char *)_this + 1);
+				pPlayer = (Player *)((char *)pPlayer + 1);
 				v108 += 4;
 				++v106.y;
 				result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem);
@@ -1152,7 +1146,7 @@
 		}
 		break;	
 		}
-	case 96:
+	case DIALOG_SHOP_SKILLS:
 		{
         result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
         if ( result )
@@ -1163,7 +1157,7 @@
           v106.y = 0;
           //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0);
           v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0);
-          v108 = v32 * (100 - _this->GetMerchant()) / 100;
+          v108 = v32 * (100 - pPlayer->GetMerchant()) / 100;
           if ( v108 < v32 / 3 )
             v108 = v32 / 3;
           v33 = v30->pStartingPosActiveItem;
@@ -1171,25 +1165,25 @@
           v109 = 0;
           if ( (signed int)v33 >= v34 )
 		  {
-		    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);
+		    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
             strcat(pTmpBuf, "\n \n");
             strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
             v7 = pTmpBuf;
             v86 = 3;
             v84 = pTmpBuf;
-            v82 = v104;
+            v82 = pColor2;
             v80 = 0;
             v78 = 0;
-            v77 = &v101;
+            v77 = &dialog_window;
             v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-            return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+            dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
           }
           do
           {
             v35 = v30->GetControl(v33)->uControlParam - 36;
-            if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v35] && !_this->pActiveSkills[v35] )
-            {
-              v36 = pFontArrus->CalcTextHeight(pSkillNames[v35], &v101, 0, 0);
+            if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
+            {
+              v36 = pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
               v106.y += v36;
               v109 = (const char **)((char *)v109 + 1);
             }
@@ -1199,21 +1193,21 @@
           if ( !v109 )
           {
 //LABEL_105:
-            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);
+            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
             strcat(pTmpBuf, "\n \n");
             strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
             v7 = pTmpBuf;
             v86 = 3;
             v84 = pTmpBuf;
-            v82 = v104;
+            v82 = pColor2;
             v80 = 0;
             v78 = 0;
-            v77 = &v101;
+            v77 = &dialog_window;
             v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-            return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+            dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
           }
           sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108);
-          v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+          dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
           v108 = (149 - v106.y) / (signed int)v109;
           if ( (149 - v106.y) / (signed int)v109 > 32 )
             v108 = 32;
@@ -1229,7 +1223,7 @@
               v38 = v30->GetControl(v106.y);
               v39 = v38;
               v40 = v38->uControlParam - 36;
-              if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v40] || _this->pActiveSkills[v40] )
+              if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
               {
                 v39->uW = 0;
                 v39->uHeight = 0;
@@ -1240,17 +1234,17 @@
                 v41 = pSkillNames[v40];
                 v39->uY = v108 + v103;
                 Str = v41;
-                v42 = pFontArrus->CalcTextHeight(v41, &v101, 0, 0);
+                v42 = pFontArrus->CalcTextHeight(v41, &dialog_window, 0, 0);
                 v43 = v39->uY;
                 v44 = v109;
                 v39->uHeight = v42;
                 v45 = v43 + v42 - 1;
                 v39->uW = v45;
                 v103 = v45;
-                v46 = v104;
+                v46 = pColor2;
                 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 )
-                  v46 = v105;
-                v101.DrawTitleText(pFontArrus, 0, v43, v46, Str, 3u);
+                  v46 = pColorWhite;
+                dialog_window.DrawTitleText(pFontArrus, 0, v43, v46, Str, 3u);
               }
               v47 = v30->pStartingPosActiveItem;
               ++v106.y;
@@ -1262,7 +1256,7 @@
         }
 		break;
 		}
-	case 95:
+	case DIALOG_SHOP_BUY_SPECIAL:
 		{
 		pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
 		v3 = 0;
@@ -1300,7 +1294,7 @@
 			}
 			while ( v55 < 6 );
 			v56 = GetAsyncKeyState(17);
-			v57 = _this->CanSteal();
+			v57 = pPlayer->CanSteal();
 			Str = (char *)v57;
 			if ( v56 && v57 )
 			{
@@ -1333,18 +1327,18 @@
 				  v81 = window_SpeakInHouse->ptr_1C;
 				  v79 = v63;
 				  v110 = uActiveCharacter - 1;
-				  v64 = _this->_490EEE(v63, 1, v61, 2);
+				  v64 = pPlayer->_490EEE(v63, 1, v61, 2);
 				  v6 = v110;
 				  v5 = (char *)pMerchantsBuyPhrases[v64];
 				  v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
 				  v86 = 3;
 				  v84 = v7;
-				  v82 = v105;
+				  v82 = pColorWhite;
 				  v80 = v3;
 				  v78 = v3;
-				  v77 = &v101;
+				  v77 = &dialog_window;
 	  			  v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-				  return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+				  dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
 				}
 				v5 = pGlobalTXT_LocalizationStrings[181];
 				v85 = 0;
@@ -1355,23 +1349,23 @@
 				v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
 				v86 = 3;
 				v84 = v7;
-				v82 = v105;
+				v82 = pColorWhite;
 				v80 = v3;
 				v78 = v3;
-				v77 = &v101;
+				v77 = &dialog_window;
 				v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-				return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+				dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
 			  }
 			}
 			else
 			{
-			  v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C]  - pParty->uTimePlayed);
+			  dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C]  - pParty->uTimePlayed);
 			  result =0; //added
 			}
 		}
 		break;
 		}
-	case 2:
+	case DIALOG_SHOP_BUY_STANDART:
 		{
 		pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
 		v3 = 0;
@@ -1413,7 +1407,7 @@
 			}
 			while ( v55 < 6 );
 			v56 = GetAsyncKeyState(17);
-			v57 = _this->CanSteal();
+			v57 = pPlayer->CanSteal();
 			Str = (char *)v57;
 			if ( v56 && v57 )
 			{
@@ -1446,18 +1440,18 @@
 						v81 = window_SpeakInHouse->ptr_1C;
 						v79 = v63;
 						v110 = uActiveCharacter - 1;
-						v64 = _this->_490EEE(v63, 1, v61, 2);
+						v64 = pPlayer->_490EEE(v63, 1, v61, 2);
 						v6 = v110;
 						v5 = (char *)pMerchantsBuyPhrases[v64];
 						v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
 						v86 = 3;
 						v84 = v7;
-						v82 = v105;
+						v82 = pColorWhite;
 						v80 = v3;
 						v78 = v3;
-						v77 = &v101;
+						v77 = &dialog_window;
 	  					v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-						return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+						dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
 					}
 					v5 = pGlobalTXT_LocalizationStrings[181];
 					v85 = 0;
@@ -1468,23 +1462,23 @@
 					v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
 					v86 = 3;
 					v84 = v7;
-					v82 = v105;
+					v82 = pColorWhite;
 					v80 = v3;
 					v78 = v3;
-					v77 = &v101;
+					v77 = &dialog_window;
 					v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-					return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+					dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
 				}
 			}
 			else
 			{
-				v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C]  - pParty->uTimePlayed);
+				dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C]  - pParty->uTimePlayed);
 				result =0; //added
 			}
 		}
 		break;
 		}
-	case 3:
+	case DIALOG_SHOP_SELL:
 		{
         draw_leather();
         CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
@@ -1500,35 +1494,35 @@
             result = (char *)pMouse->GetCursorPos(&v90);
             if ( *(int *)result < 462 )
             {
-              result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x);
+              result = (char *)pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x);
               v3 = 0;
               if ( result )
               {
                 v85 = 0;
                 v83 = 3;
                 v81 = window_SpeakInHouse->ptr_1C;
-                v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
+                v79 = (ItemGen *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
                 v12 = (int)window_SpeakInHouse->ptr_1C;
                 v110 = uActiveCharacter - 1;
-                v13 = _this->_490EEE(v79, 1, v12, 3);
+                v13 = pPlayer->_490EEE(v79, 1, v12, 3);
                 v6 = v110;
                 v5 = (char *)pMerchantsSellPhrases[v13];
                 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
                 v86 = 3;
                 v84 = v7;
-                v82 = v105;
+                v82 = pColorWhite;
                 v80 = v3;
                 v78 = v3;
-                v77 = &v101;
+                v77 = &dialog_window;
 				v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-                return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+                dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
               }
             }
           }
         }
 		break;
 		}
-	case 4:
+	case DIALOG_SHOP_IDENTIFY:
 		{
 		draw_leather();
 		CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
@@ -1544,31 +1538,31 @@
 				result = (char *)pMouse->GetCursorPos(&v92);
 				if ( *(int *)result < 462 )
 				{
-					result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x);
+					result = (char *)pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x);
 					v3 = 0;
 					if ( result )
 					{
 						v85 = 0;
 						v83 = 4;
-						v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
+						v4 = (ItemGen *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
 						if (!v4->Identified())
 						{
 							v81 = window_SpeakInHouse->ptr_1C;
 							v79 = v4;
 							v9 = (int)window_SpeakInHouse->ptr_1C;
 							v110 = uActiveCharacter - 1;
-							v10 = _this->_490EEE(v4, 1, v9, 4);
+							v10 = pPlayer->_490EEE(v4, 1, v9, 4);
 							v6 = v110;
 							v5 = (char *)pMerchantsIdentifyPhrases[v10];
 							v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
 							v86 = 3;
 							v84 = v7;
-							v82 = v105;
+							v82 = pColorWhite;
 							v80 = v3;
 							v78 = v3;
-							v77 = &v101;
+							v77 = &dialog_window;
 							v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-							return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+							dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
 						}
 						v81 = window_SpeakInHouse->ptr_1C;
 						v5 = "%24";
@@ -1579,20 +1573,20 @@
 						v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
 						v86 = 3;
 						v84 = v7;
-						v82 = v105;
+						v82 = pColorWhite;
 						v80 = v3;
 						v78 = v3;
-						v77 = &v101;
+						v77 = &dialog_window;
 				//LABEL_15:
 						v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
-						return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
+						dialog_window.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
 					}
 				}
 			}
 		}
 		break;
 		}
-	case 1:
+	case DIALOG_SHOP_MAIN:
 		{
 		result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
 		if ( result )
@@ -1600,49 +1594,52 @@
 			pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
 			pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
 			pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
-			v14 = 0;
+			//v14 = 0;
 			pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
-			v15 = pShopOptions;
+            all_text_height = 0;
+			/*v15 = pShopOptions;
 			do
 			{
-				v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0);
+				v16 = pFontArrus->CalcTextHeight(*v15, &dialog_window, 0, 0);
 				++v15;
 				v14 += v16;
 			}
-			while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
+			while ( (signed int)v15 < (signed int)&unk_F8B1C8 );*/
+            for(int i  =0; i < 4; ++i)
+              all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
 			v17 = pDialogueWindow;
-			v103 = (174 - v14) / 4;
+			v103 = (174 - all_text_height) / 4;
 			result = (char *)pDialogueWindow->pStartingPosActiveItem;
 			v18 = (int)&result[pDialogueWindow->pNumPresenceButton];
-			v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
+			v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
 			v20 = -pDialogueWindow->pNumPresenceButton < 0;
-			_this = (Player *)pDialogueWindow->pStartingPosActiveItem;
+			pPlayer = (Player *)pDialogueWindow->pStartingPosActiveItem;
 			if ( v20 ^ __OFSUB__((int)result, v18) )
 			{
 				v108 = 2;
 				v109 = (const char **)pShopOptions;
 				do
 				{
-					v21 = v17->GetControl((unsigned int)_this);
+					v21 = v17->GetControl((unsigned int)pPlayer);
 					v22 = v109;
 					v21->uY = v103 + v19;
-					v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0);
+					v23 = pFontArrus->CalcTextHeight(*v22, &dialog_window, 0, 0);
 					v24 = v21->uY;
 					v25 = v108;
 					v21->uHeight = v23;
 					v19 = v24 + v23 - 1;
 					v21->uW = v19;
-					v26 = v104;
+					v26 = pColor2;
 					if ( pDialogueWindow->pCurrentPosActiveItem != v25 )
-						v26 = v105;
-					v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u);
+						v26 = pColorWhite;
+					dialog_window.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u);
 					v17 = pDialogueWindow;
 					++v108;
 					++v109;
-					_this = (Player *)((char *)_this + 1);
+					pPlayer = (Player *)((char *)pPlayer + 1);
 					result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem);
 				}
-				while ( (signed int)_this < (signed int)result );
+				while ( (signed int)pPlayer < (signed int)result );
 			}
 		}
 		break;
@@ -1656,7 +1653,6 @@
 		break;
 		}
   }
-  return result;
 }
 
 
@@ -2528,8 +2524,8 @@
     m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
     hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
     switch (dialog_menu_id)
-        {
-    case 1:  //main shop text
+    {
+    case DIALOG_SHOP_MAIN:
         {
         if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
             return;
@@ -2566,7 +2562,7 @@
             }
         }
         break;
-    case 2: //buy standart
+    case DIALOG_SHOP_BUY_STANDART:
         {
         pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
         textureW = 0;
@@ -2646,7 +2642,7 @@
         return;
         }
         break;
-    case 3:  //sell
+    case DIALOG_SHOP_SELL:
         {
         draw_leather();
         CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
@@ -2673,7 +2669,7 @@
         return;
         }
         break;
-    case 4: //identify
+    case DIALOG_SHOP_IDENTIFY:
         {
         draw_leather();
         CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
@@ -2717,7 +2713,7 @@
             }
         }
         break;
-    case 5:  //repair
+    case DIALOG_SHOP_REPAIR:
         {
         draw_leather();
         CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
@@ -2813,7 +2809,7 @@
         return;
         }
         break;
-    case 94: //character inventory
+    case DIALOG_SHOP_DISPLAY_EQUIPMENT:
         {
         draw_leather();
         CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
@@ -2860,11 +2856,9 @@
         return;
         }
         break;
-    case 95:  //buy spesial
-        {
-
+    case DIALOG_SHOP_BUY_SPECIAL:
+        {
         pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
-
         v11 = 0;
         v61 = 0;
         v153 = 0;
@@ -2951,11 +2945,9 @@
                 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
                 return;
         }
-
         break;
-    case 96:  //skills
-        {
-
+    case DIALOG_SHOP_SKILLS:
+        {
         if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
             return;
         v152 = 0;
@@ -3041,9 +3033,7 @@
         return;
         }
         break;
-
-        }
-
+      }
     }
 
 //----- (004BB756) --------------------------------------------------------
--- a/mm7_data.h	Fri Mar 08 22:41:24 2013 +0600
+++ b/mm7_data.h	Sat Mar 09 00:33:04 2013 +0600
@@ -2330,7 +2330,7 @@
 void __cdecl BankDialog();
 void __cdecl TavernDialog();
 
-char *__cdecl WeaponShopDialog();
+void __cdecl WeaponShopDialog();
 POINT *__cdecl AlchemistDialog();
 void __cdecl ArmorShopDialog();
 signed int __fastcall sub_4BB756(signed int a1);