diff mm7_4.cpp @ 615:8a0ec99a5177

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