changeset 1639:b60ddd777d50

Merge
author Nomad
date Tue, 17 Sep 2013 15:40:36 +0200
parents ccde94f02b75 (current diff) ff3d7af671ec (diff)
children afc1c3514dd5
files GUIWindow.cpp UI/UIHouses.cpp mm7_data.h
diffstat 3 files changed, 229 insertions(+), 343 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Tue Sep 17 15:40:09 2013 +0200
+++ b/GUIWindow.cpp	Tue Sep 17 15:40:36 2013 +0200
@@ -993,9 +993,9 @@
     }
     return;
   }
-  if ( v4 || !dword_591080 )
+  if ( v4 || !dword_591080 )//на изумрудном острове заходит на корабле пока не выполнены квесты
   {
-    SimpleHouseAndBoatsDialog();
+    SimpleHouseDialog();
   }
   else
   {
--- a/UI/UIHouses.cpp	Tue Sep 17 15:40:09 2013 +0200
+++ b/UI/UIHouses.cpp	Tue Sep 17 15:40:36 2013 +0200
@@ -2987,20 +2987,20 @@
   signed int v10; // esi@6
   int pPrice; // ecx@6
   signed int v14; // esi@14
-  unsigned int v15; // esi@16
+  //unsigned int v15; // esi@16
   int v16; // eax@16
-  unsigned int v17; // eax@17
+  //unsigned int v17; // eax@17
   int v19; // ecx@24
-  GUIButton *v20; // eax@26
-  GUIButton *v21; // esi@26
-  int v22; // eax@26
-  const char *v23; // eax@28
-  int v24; // eax@28
-  unsigned int v25; // ecx@28
-  int v26; // eax@28
-  unsigned __int16 v27; // ax@28
-  unsigned __int16 v29; // ST14_2@34
-  int v30; // eax@34
+  //GUIButton *v20; // eax@26
+  //GUIButton *v21; // esi@26
+  //int v22; // eax@26
+  //const char *v23; // eax@28
+  //int v24; // eax@28
+  //unsigned int v25; // ecx@28
+  //int v26; // eax@28
+  //unsigned __int16 v27; // ax@28
+  //unsigned __int16 v29; // ST14_2@34
+  //int v30; // eax@34
   int v33; // eax@36
   unsigned int v36; // eax@38
   unsigned int v42; // eax@46
@@ -3011,7 +3011,7 @@
   int pTextHeight; // eax@71
   unsigned __int16 pTextColor; // ax@71
   GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1
-  int v68; // [sp+6Ch] [bp-18h]@3
+  //int v68; // [sp+6Ch] [bp-18h]@3
   int v69; // [sp+70h] [bp-14h]@6
   int v73; // [sp+80h] [bp-4h]@14
 
@@ -3020,7 +3020,7 @@
   training_dialog_window.uFrameWidth = 148;
   training_dialog_window.uFrameZ = 334;
   v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2;  // E n = n(n + 1) / 2
-  v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
+  //v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
   if (pPlayers[uActiveCharacter]->uExperience >= v5)
   {
     v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
@@ -3051,7 +3051,7 @@
           {
             if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
             {
-              if (pPlayers[uActiveCharacter]->uLevel >= v68)
+              if (pPlayers[uActiveCharacter]->uLevel >= pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE])
                 sprintfex(pShopOptions[index], "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher."    "Sorry, but we are unable to train you."
               else
               {
@@ -3068,7 +3068,7 @@
         v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
         if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton)
         {
-          int pCurrentItem = 2;
+          //int pCurrentItem = 2;
           index = 0;
           for ( int i = pDialogueWindow->pStartingPosActiveItem;
                 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
@@ -3080,10 +3080,10 @@
             pButton->uW = pTextHeight + pButton->uY - 1;
             v49 = pButton->uW;
             pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
-            if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem )
+            if ( pDialogueWindow->pCurrentPosActiveItem != i )
               pTextColor = TargetColor(255, 255, 255);
             training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3);
-            ++pCurrentItem;
+            //++pCurrentItem;
             ++index;
           }
         }
@@ -3100,7 +3100,7 @@
         return;
       }
       //v34 = pPlayers[uActiveCharacter]->uLevel;
-      if ( pPlayers[uActiveCharacter]->uLevel < v68 )
+      if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] )
       {
         if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
         {
@@ -3165,81 +3165,61 @@
     if (HouseUI_CheckIfPlayerCanInteract())
     {
       v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
-      v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
-      if ( v73 < v14 / 3 )
-        v73 = v14 / 3;
-      v15 = pDialogueWindow->pStartingPosActiveItem;
-      v16 = pDialogueWindow->pNumPresenceButton;
+      pPrice = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
+      if ( pPrice < v14 / 3 )
+        pPrice = v14 / 3;
       index = 0;
-      if ( (signed int)v15 >= (signed int)(v15 + v16) )
-        goto LABEL_76;
-      do
+      for ( int i = pDialogueWindow->pStartingPosActiveItem;
+          (signed int)i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
       {
-        v17 = pDialogueWindow->GetControl(v15)->msg_param - 36;
-        if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] )
+        if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
+             && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
         {
-          all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v17], &training_dialog_window, 0, 0);
+          all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &training_dialog_window, 0, 0);
           ++index;
         }
-        ++v15;
       }
-      while ( (signed int)v15 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
       if ( index )
       {
-        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu"
         training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
         v73 = (signed int)(149 - all_text_height) / index;
         if ( v73 > 32 )
           v73 = 32;
         v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162;
-        int _v1 = pDialogueWindow->pStartingPosActiveItem;
-        v68 = v19;
-        if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+        for ( int i = pDialogueWindow->pStartingPosActiveItem;
+             (signed int)i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
         {
-          index = 2;
-          do
+          pButton = pDialogueWindow->GetControl(i);
+          if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
+              || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
           {
-            v20 = pDialogueWindow->GetControl(_v1);
-            v21 = v20;
-            v22 = v20->msg_param - 36;
-            if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] )
-            {
-              v21->uW = 0;
-              v21->uHeight = 0;
-              v21->uY = 0;
-            }
-            else
-            {
-              v23 = pSkillNames[v22];
-              v21->uY = v73 + v68;
-              //HIDWORD(v66) = (int)v23;
-              v24 = pFontArrus->CalcTextHeight(v23, &training_dialog_window, 0, 0);
-              v25 = v21->uY;
-              v21->uHeight = v24;
-              v26 = v25 + v24 - 1;
-              v21->uW = v26;
-              v68 = v26;
-              v27 = TargetColor(0xE1u, 0xCDu, 0x23u);
-              if ( pDialogueWindow->pCurrentPosActiveItem != index )
-                v27 = TargetColor(255, 255, 255);
-              training_dialog_window.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3);
-            }
-            ++_v1;
-            ++index;
+            pButton->uW = 0;
+            pButton->uHeight = 0;
+            pButton->uY = 0;
           }
-          while ( (signed int)_v1 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
+          else
+          {
+            pButton->uY = v73 + v19;
+            pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &training_dialog_window, 0, 0);
+            pButton->uHeight = pTextHeight;
+            pButton->uW = pButton->uY + pTextHeight - 1;
+            v19 = pButton->uY + pTextHeight - 1;
+            pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
+            if ( pDialogueWindow->pCurrentPosActiveItem != i )
+              pTextColor = TargetColor(255, 255, 255);
+            training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
+          }
         }
       }
       else
       {
-LABEL_76:
         sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
                                               // "Seek knowledge elsewhere %s the %s"
         strcat(pTmpBuf.data(), "\n \n");
         strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
-        v29 = TargetColor(0xE1u, 0xCDu, 0x23u);
-        v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0);
-        training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3);
+        pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0);
+        training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3);
       }
     }
   }
@@ -3248,214 +3228,146 @@
 
 //----- (004B6478) --------------------------------------------------------
 void sub_4B6478()
-    {
-  GUIWindow *v0; // ebx@1
-  Player *v1; // edi@1
+{
   unsigned int v2; // eax@1
   signed int v3; // esi@1
-  int v4; // ebx@1
+  int pPrice; // ebx@1
   unsigned int v5; // esi@5
   int v6; // edi@6
   int result; // eax@13
-  GUIWindow *v8; // ebx@17
-  int v9; // eax@17
-  int v10; // ecx@17
-  unsigned int v11; // ecx@18
   int v12; // eax@20
   int v13; // eax@21
-  GUIButton *v14; // esi@27
-  int v15; // ecx@27
+  GUIButton *pButton; // esi@27
   unsigned int v16; // eax@28
-  const char *v17; // ebx@29
-  int v18; // eax@29
-  unsigned int v19; // ecx@29
-  int v20; // eax@29
-  unsigned __int16 v21; // ax@29
+  int pTextHeight; // eax@29
+  unsigned __int16 pTextColor; // ax@29
   unsigned __int16 v22; // ST14_2@36
-  int v23; // eax@36
-  const char *v24; // ST18_4@37
-  unsigned __int16 v25; // ST14_2@37
-  int v26; // eax@37
   int v27; // [sp-4h] [bp-80h]@8
-  GUIWindow v28; // [sp+Ch] [bp-70h]@1
-  GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
-  unsigned int v30; // [sp+64h] [bp-18h]@1
-  int v31; // [sp+68h] [bp-14h]@1
+  GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1
   int v32; // [sp+6Ch] [bp-10h]@1
-  int v33; // [sp+70h] [bp-Ch]@17
   int v34; // [sp+74h] [bp-8h]@17
-  int v35; // [sp+78h] [bp-4h]@17
 
-  v0 = window_SpeakInHouse;
-  memcpy(&v28, window_SpeakInHouse, sizeof(v28));
-  v1 = pPlayers[uActiveCharacter];
-  v28.uFrameX = 483;
-  v28.uFrameWidth = 148;
-  v28.uFrameZ = 334;
-  v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  v2 = 52 * (unsigned int)v0->ptr_1C;
-  //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
-  v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
-  //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
-  v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
-  v4 = v3 * (100 - v1->GetMerchant()) / 100;
-  v32 = v4;
-  if ( v4 < v3 / 3 )
-  {
-    v4 = v3 / 3;
-    v32 = v3 / 3;
-  }
-  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
+  memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
+  dialog_window.uFrameX = 483;
+  dialog_window.uFrameWidth = 148;
+  dialog_window.uFrameZ = 334;
+  v2 = 52 * (unsigned int)window_SpeakInHouse->ptr_1C;
+  v32 = (unsigned __int8)(((p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
+  v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
+  pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
+  if ( pPrice < v3 / 3 )
+    pPrice = v3 / 3;
+  if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
-    if ( HouseUI_CheckIfPlayerCanInteract() )
+    if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+    {
+      pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);//
+      dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, TargetColor(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3);
+      pDialogueWindow->pNumPresenceButton = 0;
+      return;
+    }
+    if ( !HouseUI_CheckIfPlayerCanInteract() )
+      return;
+    v34 = 0;
+    for ( int i = pDialogueWindow->pStartingPosActiveItem;
+          i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
+    {
+      if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36]
+         && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
+      {
+        v12 += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
+        ++v34;
+      }
+    }
+    if ( !v34 )
     {
-      v5 = 0;
-
-      __debugbreak();
-      //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
-      __debugbreak(); // whacky condition - fix
-      if (false
-      //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
-        || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
+      strcat(pTmpBuf.data(), "\n \n");
+      strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить.
+      pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
+      dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
+      return; 
+    }
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu
+    dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
+    v32 = (149 - v12) / v34;
+    if ( (149 - v12) / v34 > 32 )
+      v32 = 32;
+    v34 = (149 - v34 * v32 - v12) / 2 - v32 / 2 + 162;
+    if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+    {
+      for ( int i = pDialogueWindow->pStartingPosActiveItem;
+            i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
       {
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
-      }
-      else
-      {
-        if ( pParty->uNumGold < v4 )
+        pButton = pDialogueWindow->GetControl(i);
+        if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] )
         {
-          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-          v27 = 4;
+          if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
+          {
+            pButton->uY = v32 + v34;
+            pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
+            pButton->uHeight = pTextHeight;
+            pButton->uW = pButton->uY + pTextHeight - 1;
+            v34 = pButton->uY + pTextHeight - 1;
+            pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+            if ( pDialogueWindow->pCurrentPosActiveItem != i )
+              pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
+            dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
+          }
         }
         else
         {
-          Party::TakeGold(v4);
-          *(short *)v6 = 1;
-          v27 = 2;
+          pButton->uW = 0;
+          pButton->uHeight = 0;
+          pButton->uY = 0;
         }
-        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
       }
     }
+  return;
+  }
+
+  if ( HouseUI_CheckIfPlayerCanInteract() )
+  {
+    v5 = 0;
+    __debugbreak();
+    //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
+    // or
+    //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
+    // or
+    //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
+    __debugbreak(); // whacky condition - fix
+    if (false
+    //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
+      || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + dialog_menu_id), *(short *)v6) )
+    {
+      pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+    }
     else
     {
-      v5 = 0;
-    }
-    /*result = pMessageQueue_50CBD0->uNumMessages;
-    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-      *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
-      ++pMessageQueue_50CBD0->uNumMessages;
-    }*/
-    pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
-    return; // void func
-  }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
-  {
-    v24 = pNPCTopics[171].pText;
-    v25 = v31;
-    v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
-    pDialogueWindow->pNumPresenceButton = 0;
-    return ;
-  }
-
-  if ( !HouseUI_CheckIfPlayerCanInteract() )
-    return;
-  v8 = pDialogueWindow;
-  v33 = 0;
-  v34 = 0;
-  v29 = pDialogueWindow;
-  v9 = pDialogueWindow->pStartingPosActiveItem;
-  v10 = v9 + pDialogueWindow->pNumPresenceButton;
-  v35 = pDialogueWindow->pStartingPosActiveItem;
-  if ( v9 >= v10 )
-    goto LABEL_40;
-  do
-  {
-    v11 = v8->GetControl(v35)->msg_param - 36;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
-    {
-      v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
-      v33 += v12;
-      ++v34;
-    }
-    v13 = v8->pStartingPosActiveItem;
-    ++v35;
-  }
-  while ( v35 < v8->pNumPresenceButton + v13 );
-  if ( !v34 )
-  {
-LABEL_40:
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
-    strcat(pTmpBuf.data(), "\n \n");
-    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
-    v22 = v31;
-    v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
-    return; 
-  }
-  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
-  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
-  v32 = (149 - v33) / v34;
-  if ( (149 - v33) / v34 > 32 )
-    v32 = 32;
-
-  v35 = v8->pStartingPosActiveItem;
-  v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
-  if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
-  {
-    v33 = 2;
-    do
-    {
-      v14 = v8->GetControl(v35);
-      v15 = v14->msg_param - 36;
-      if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
+      if ( pParty->uNumGold < pPrice )
       {
-        v16 = 0;
-        if ( !v1->pActiveSkills[v15] )
-        {
-          v17 = pSkillNames[v15];
-          v14->uY = v32 + v34;
-          v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
-          v19 = v14->uY;
-          v14->uHeight = v18;
-          v20 = v19 + v18 - 1;
-          v14->uW = v20;
-          v34 = v20;
-          v21 = v31;
-          if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
-            v21 = v30;
-          v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
-          goto LABEL_34;
-        }
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота
+        v27 = 4;
       }
       else
       {
-        v16 = 0;
+        Party::TakeGold(pPrice);
+        *(short *)v6 = 1;
+         v27 = 2;
       }
-      v14->uW = v16;
-      v14->uHeight = v16;
-      v14->uY = v16;
-LABEL_34:
-      v8 = v29;
-      ++v35;
-      ++v33;
+      PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
     }
-    while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
   }
-  return;
+  else
+  {
+    v5 = 0;
+  }
+  pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
+  return; // void func
 }
 
 //----- (004B2A74) --------------------------------------------------------
-void SimpleHouseAndBoatsDialog()
+void SimpleHouseDialog()
 {
   char *v2; // eax@3
   unsigned int i; // eax@5
@@ -3478,7 +3390,7 @@
   GUIFont *v47; // ebx@64
   int v48; // esi@64
   GUIWindow w; // [sp+Ch] [bp-110h]@64
-  GUIWindow v52; // [sp+60h] [bp-BCh]@13
+  GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13
   GUIWindow house_window; // [sp+B4h] [bp-68h]@1
   char *pInString; // [sp+114h] [bp-8h]@12
 
@@ -3527,90 +3439,32 @@
       }
     }
   }
-  memcpy(&v52, pDialogueWindow, sizeof(v52));
-  v52.uFrameX = 483;
-  v52.uFrameWidth = 148;
-  v52.uFrameZ = 334;
-  
-  if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
+  //for right panel
+  memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window));
+  right_panel_window.uFrameX = 483;
+  right_panel_window.uFrameWidth = 148;
+  right_panel_window.uFrameZ = 334;
+  for ( int i = right_panel_window.pStartingPosActiveItem;
+            i < right_panel_window.pStartingPosActiveItem + right_panel_window.pNumPresenceButton; ++i )
   {
-    v15 = "";
-    for ( int i = v52.pStartingPosActiveItem; i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i )
+    pButton = right_panel_window.GetControl(i);
+    switch ( pButton->msg_param )
     {
-      pButton = v52.GetControl(i);
-      if ( (signed int)pButton->msg_param > 24 )
-      {
-        if ( pButton->msg_param == 76 )
-        {
-          v15 = pGlobalTXT_LocalizationStrings[406];//Нанять
-          strcpy(pButton->pButtonName, v15);
-          continue;
-        }
-        if ( pButton->msg_param == 77 )
-        {
-          strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
-          continue;
-        }
-        if ( pButton->msg_param == 79 )
-        {
-          strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)v52.ptr_1C));
-          continue;
-        }
-        if ( pButton->msg_param == 82 )
-        {
-          strcpy(pButton->pButtonName, ContractSelectText((int)v52.ptr_1C));
-          continue;
-        }
-        if ( pButton->msg_param == 83 )
+      case 19://evt_A
+        v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic;
+        if ( !v15 )
         {
-          v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
-          v31 = *(int *)v29;
-          sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
-          sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
-          current_npc_text = pTmpBuf2.data();
-          strcpy(pButton->pButtonName, "");
-          continue;
+          pButton->msg_param = 0;
+          v15 = "";
         }
-        if ( pButton->msg_param != 93 )
-        {
-          strcpy(pButton->pButtonName, "");
-          continue;
-        }
-      }
-      else
-      {
-        if ( pButton->msg_param == 24 )//evt_F
+        strcpy(pButton->pButtonName, v15);
+        continue;
+      case 20://evt_B
+        v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic;
+        if ( !v15 )
         {
-          v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
-          if ( !v15 )
-          {
-            pButton->msg_param = 0;
-            v15 = "";
-          }
-          strcpy(pButton->pButtonName, v15);
-          continue;
-        }
-        v18 = pButton->msg_param - 13;
-        if ( v18 )
-        {
-          if ( pButton->msg_param == 19 )//evt_A
-          {
-            v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic;
-            if ( !v15 )
-            {
-              pButton->msg_param = 0;
-              v15 = "";
-            }
-            strcpy(pButton->pButtonName, v15);
-            continue;
-          }
-          if ( pButton->msg_param == 20 )//evt_B
-          {
-            v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic;
-            if ( !v15 )
-            {
-              pButton->msg_param = 0;
-              v15 = "";
+          pButton->msg_param = 0;
+          v15 = "";
             }
             if ( uDialogueType != 84 )
             {
@@ -3622,9 +3476,7 @@
             current_npc_text = pTmpBuf2.data();
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
-          if ( pButton->msg_param == 21 )//evt_C
-          {
+          case 21://evt_C
             v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic;
             if ( !v15 )
             {
@@ -3633,9 +3485,7 @@
             }
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
-          if ( pButton->msg_param == 22 )//evt_D
-          {
+          case 22://evt_D
             v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic;
             if ( !v15 )
             {
@@ -3644,9 +3494,7 @@
             }
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
-          if ( pButton->msg_param == 23 )//evt_E
-          {
+          case 23://evt_E
             v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic;
             if ( !v15 )
             {
@@ -3655,21 +3503,59 @@
             }
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
+          case 24://evt_F
+            v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
+            if ( !v15 )
+            {
+              pButton->msg_param = 0;
+              v15 = "";
+            }
+            strcpy(pButton->pButtonName, v15);
+            continue;
+          case 76:
+            strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять
+            continue;
+          case 77:
+            strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
+            continue;
+          case 79:
+            strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C));
+            continue;
+          case 82:
+            strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C));
+            continue;
+          case 83:
+            v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
+            v31 = *(int *)v29;
+            sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
+            sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
+            current_npc_text = pTmpBuf2.data();
+            strcpy(pButton->pButtonName, "");
+            continue;
+        }
+        if ( pButton->msg_param < 13 )
+        {
+          strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
+          continue;
+        }
+        if ( pButton->msg_param > 13 && pButton->msg_param < 19 )
+        {
           strcpy(pButton->pButtonName, "");
           continue;
         }
-        strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
-      }
+        if ( pButton->msg_param != 93 )
+        {
+          strcpy(pButton->pButtonName, "");
+          continue;
+        }
     }
-  }
   v34 = 0;
   v36 = pDialogueWindow->pStartingPosActiveItem;
   for ( i = v36 + pDialogueWindow->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
                                                                     + pDialogueWindow->pStartingPosActiveItem )
   {
     v37 = pDialogueWindow->GetControl(v36);
-    v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
+    v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &right_panel_window, 0, 0);
     v34 += v38;
     ++v36;
   }
@@ -3687,7 +3573,7 @@
       //v42 = v41;
       v43 = pButton->pButtonName;
       pButton->uY = (unsigned int)((char *)pNPC + v40);
-      v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &v52, 0, 0);
+      v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0);
       v45 = pButton->uY;
       pButton->uHeight = v44;
       v40 = v45 + v44 - 1;
@@ -3695,7 +3581,7 @@
       v46 = TargetColor(0xE1u, 0xCDu, 0x23u);
       if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString )
         v46 = TargetColor(0xFFu, 0xFFu, 0xFFu);
-      v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3);
+      right_panel_window.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3);
       ++pInString;
     }
   }
@@ -3726,5 +3612,5 @@
   jail_dialogue_window.uFrameWidth = 148;
   jail_dialogue_window.uFrameZ = 334;
   jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18,
-     TargetColor(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);
+     TargetColor(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения."
 }
\ No newline at end of file
--- a/mm7_data.h	Tue Sep 17 15:40:09 2013 +0200
+++ b/mm7_data.h	Tue Sep 17 15:40:36 2013 +0200
@@ -1215,7 +1215,7 @@
 void __fastcall ClickNPCTopic(signed int uMessageParam);
 char * _4B254D_SkillMasteryTeacher(int _this);
 const char *ContractSelectText(int pEventCode);
-void SimpleHouseAndBoatsDialog();
+void SimpleHouseDialog();
 void CreateButtonInColumn(int a1, unsigned int a2);
 void FillAviableSkillsToTeach(int _this);
 void sub_4B3E1E();