changeset 1635:04cae215a13c

Слияние
author Ritor1
date Tue, 17 Sep 2013 16:30:43 +0600
parents 08ebd0fee604 (diff) 384a6b9d1333 (current diff)
children ff3d7af671ec
files
diffstat 3 files changed, 159 insertions(+), 247 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Tue Sep 17 12:40:37 2013 +0200
+++ b/GUIWindow.cpp	Tue Sep 17 16:30:43 2013 +0600
@@ -985,9 +985,9 @@
     }
     return;
   }
-  if ( v4 || !dword_591080 )
+  if ( v4 || !dword_591080 )//         
   {
-    SimpleHouseAndBoatsDialog();
+    SimpleHouseDialog();
   }
   else
   {
--- a/UI/UIHouses.cpp	Tue Sep 17 12:40:37 2013 +0200
+++ b/UI/UIHouses.cpp	Tue Sep 17 16:30:43 2013 +0600
@@ -2983,20 +2983,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
@@ -3007,7 +3007,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
 
@@ -3016,7 +3016,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;
@@ -3047,7 +3047,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
               {
@@ -3064,7 +3064,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 )
@@ -3076,10 +3076,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;
           }
         }
@@ -3096,7 +3096,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 )
         {
@@ -3161,81 +3161,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);
       }
     }
   }
@@ -3244,214 +3224,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
@@ -3722,5 +3634,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 12:40:37 2013 +0200
+++ b/mm7_data.h	Tue Sep 17 16:30:43 2013 +0600
@@ -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();