changeset 1589:f408fbf3d9cc

m
author Ritor1
date Wed, 11 Sep 2013 09:23:41 +0600
parents e6ac4919b22c
children 5792fdafe2f5
files GUIWindow.cpp NPC.cpp UI/UIHouses.cpp UI/UIHouses.h mm7_2.cpp mm7_data.cpp mm7_data.h
diffstat 7 files changed, 130 insertions(+), 189 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Sep 09 09:13:40 2013 +0600
+++ b/GUIWindow.cpp	Wed Sep 11 09:23:41 2013 +0600
@@ -1726,31 +1726,29 @@
   if (eWindowType == WINDOW_HouseInterior)
   {
     pCurrentScreen = SCREEN_HOUSE;
-    pBtn_ExitCancel = pWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания
+    pBtn_ExitCancel = pWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания
                    pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
-  
-      for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
+    for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
+    {
+      if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
       {
-        if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
-        {
-          v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
-          v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];
-        }
+        v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
+        v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];
+      }
+      else
+      {
+        if ( v26 || !dword_591080 )
+          v27 = HouseNPCData[v26 +1 - ((dword_591080 != 0)? 1:0)]->pName;
         else
-        {
-          if ( v26 || !dword_591080 )
-            v27 = HouseNPCData[v26 +1 - ((dword_591080 != 0)? 1:0)]->pName;
-          else
-            v27 = (char*)p2DEvents[pButton - 1].pProprieterName;
-          v30 = v27;
-          v29 = (char*)pGlobalTXT_LocalizationStrings[435];
-        }
-        sprintfex(byte_591180[v26].data(), v29, v30);
-        dword_5913F4[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
-                                                                 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
-                                             0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0);
+          v27 = (char*)p2DEvents[pButton - 1].pProprieterName;
+        v30 = v27;
+        v29 = (char*)pGlobalTXT_LocalizationStrings[435];
       }
-  
+      sprintfex(byte_591180[v26].data(), v29, v30);
+      HouseNPCPortraitsButtonsList[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
+                                                                pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
+                                           63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0);
+    }
     if ( uNumDialogueNPCPortraits == 1 )
     {
       window_SpeakInHouse = &pWindowList[uNextFreeWindowID];
--- a/NPC.cpp	Mon Sep 09 09:13:40 2013 +0600
+++ b/NPC.cpp	Wed Sep 11 09:23:41 2013 +0600
@@ -1648,7 +1648,7 @@
     else
     {
       for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
-        dword_5913F4[i]->Release();
+        HouseNPCPortraitsButtonsList[i]->Release();
     }
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, UIMSG_Escape,  0,  0,
--- a/UI/UIHouses.cpp	Mon Sep 09 09:13:40 2013 +0600
+++ b/UI/UIHouses.cpp	Wed Sep 11 09:23:41 2013 +0600
@@ -89,8 +89,8 @@
 {
   {  0,   1,   1,  34},  // HOUSE_STABLES_HARMONDALE
   {  2,   3,   4,   5},  // HOUSE_STABLES_STEADWICK
-  {  6,   7,   8,   8},  // HOUSE_STABLES_56
-  {  9,  10,  10,  10},  // HOUSE_STABLES_57
+  {  6,   7,   8,   8},  // HOUSE_STABLES_TULAREAN_FOREST
+  {  9,  10,  10,  10},  // HOUSE_STABLES_DEYJA
   { 11,  11,  12,  12},  // HOUSE_STABLES_58
   { 13,  13,  13,  13},  // HOUSE_STABLES_59
   { 14,  14,  15,  15},  // HOUSE_STABLES_60
@@ -989,7 +989,6 @@
 {
   int experience_for_next_level; // eax@5
   GUIWindow *v8; // esi@10
-  //int v11; // edi@31
   int v16; // eax@32
   int v17; // eax@33
   int v18; // eax@34
@@ -1911,239 +1910,195 @@
 void  TravelByTransport()
 {
   signed int v4; // ebx@1
-  stru365_travel_info *v5; // esi@7
-  int v11; // ecx@12
+  stru365_travel_info *pTravel; // esi@7
   signed int v12; // esi@13
   signed int v13; // edi@14
   DWORD v14; // eax@26
   DWORD v15; // edi@26
-  //GUIWindow *v16; // ebx@36
-  int v17; // esi@36
-  int v18; // eax@36
-  int v19; // ecx@36
-  int v20; // esi@36
-  int v21; // eax@36
-  void *v22; // eax@39
-  int v23; // esi@39
-  GUIButton *v24; // ebx@39
+  int pTextHeight; // eax@36
+  int pRealTextHeight; // esi@36
+  int schedule_id; // esi@39
+  GUIButton *pButton; // ebx@39
   signed int v25; // eax@41
-  char *v28; // eax@62
-  int v29; // eax@62
   unsigned int v30; // ecx@62
-  char *v31; // eax@63
-  MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
-  char v48[5][100]; // [sp+14h] [bp-27Ch]@37
-  GUIWindow v53; // [sp+208h] [bp-88h]@1
-  int v54; // [sp+25Ch] [bp-34h]@36
-  int v55; // [sp+260h] [bp-30h]@36
-  unsigned int v60; // [sp+274h] [bp-1Ch]@36
-  int v62; // [sp+27Ch] [bp-14h]@36
-  int v63; // [sp+280h] [bp-10h]@14
-  char *a1; // [sp+284h] [bp-Ch]@37
-  unsigned int s1; // [sp+288h] [bp-8h]@1
-  int v66; // [sp+28Ch] [bp-4h]@48
+  MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62
+  char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37
+  GUIWindow travel_window; // [sp+208h] [bp-88h]@1
+  int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36
+  //unsigned int v60; // [sp+274h] [bp-1Ch]@36
+  int index; // [sp+27Ch] [bp-14h]@36
+  //char *a1; // [sp+284h] [bp-Ch]@37
+  unsigned int pPrice; // [sp+288h] [bp-8h]@1
+  int travel_time; // [sp+28Ch] [bp-4h]@48
+  enum PlayerSpeech pSpeech;
+  unsigned int pCurrentButton;
 
-  memcpy(&v53, window_SpeakInHouse, sizeof(v53));
-  v53.uFrameX = 483;
-  v53.uFrameWidth = 148;
-  v53.uFrameZ = 334;
+  memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window));
+  travel_window.uFrameX = 483;
+  travel_window.uFrameWidth = 148;
+  travel_window.uFrameZ = 334;
 
   v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50;
   v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
 
-  s1 = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
-  if ( (signed int)s1 < v4 / 3 )
-    s1 = v4 / 3;
+  pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
+  if ( (signed int)pPrice < v4 / 3 )
+    pPrice = v4 / 3;
   if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
     if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      v62 = 0;
-      v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
-      v54 = v17;
-      strcpy(v48[4], "");
-      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
-      v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0);
-      v19 = pDialogueWindow->pNumPresenceButton;
-      v20 = v18 + v17 + 146;
-      v21 = pDialogueWindow->pStartingPosActiveItem;
-      v63 = v20;
-      v55 = v20;
-      v60 = v21;
-      if ( v21 >= v21 + v19 )
-        goto LABEL_71;
-      s1 = 2;
-      a1 = (char *)v48;
-      while ( 1 )
+      index = 0;
+      strcpy(pTopicArray[4], "");
+      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold
+      pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0);
+      pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146;
+      pPrimaryTextHeight = pRealTextHeight;
+      pCurrentButton = 2;
+      for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i )
       {
-        int v47 = v60;
-        v22 = window_SpeakInHouse->ptr_1C;
-        v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
-        //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
-        //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
-        v24 = pDialogueWindow->GetControl(v60);
+        schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index];
+        pButton = pDialogueWindow->GetControl(i);
 
-        if (v23 != 255)
+        if (schedule_id != 255)
         {
-          if (v23 >= 25)
+          if (schedule_id >= 25)
             Log::Warning(L"Transport UI: scedule overflow");
-          if (s1 >= 6)
+          if ( pCurrentButton >= 6 )
             v25 = true;
           else
-            v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7];
+            v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7];
         }
 
-        if (v23 != 255 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
+        if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit
+           || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )
         {
-            //v58 = v23;
-            if ( pDialogueWindow->pCurrentPosActiveItem == s1 )
-              sprintf(a1, "\f%05d", TargetColor(255, 255, 155));
-            else
-              sprintf(a1, "\f%05d", TargetColor(255, 255, 255));
-
-          //v32.uRedbookTrackID = v27;
-          v66 = transport_schedule[v23].uTravelTime;
+//get color for current string(определение цвета текущей строки)------------
+          if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton )
+            sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155));
+          else
+            sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 255));
+  //hired NPC premium(премия наёмного НПС)----------------------------------
+          travel_time = transport_schedule[schedule_id].uTravelTime;
           if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 )
           {
             if ( CheckHiredNPCSpeciality(Sailor) )
-              v66 -= 2;
+              travel_time -= 2;
             if ( CheckHiredNPCSpeciality(Navigator) )
-              v66 -= 3;
+              travel_time -= 3;
             if ( CheckHiredNPCSpeciality(Pirate) )
-              v66 -= 2;
+              travel_time -= 2;
           }
           else
           {
             if ( CheckHiredNPCSpeciality(Horseman) )
-              v66 -= 2;
+              travel_time -= 2;
           }
           if ( CheckHiredNPCSpeciality(Explorer) )
-            --v66;
-          if ( v66 < 1 )
-            v66 = 1;
-          if ( v23 != 255 )
+            --travel_time;
+
+          if ( travel_time < 1 )
+            travel_time = 1;
+          if ( schedule_id != 255 )
           {
-            memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
-                      v66, v32.pName);
-            strcat(a1, pTmpBuf.data());
-            v28 = a1;
-            a1 += 100;
-            ++v62;
-            ++s1;
-            strcat(v28, "\n \n");
-            v24->uY = v63;
-            v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0);
-            v30 = v24->uY;
-            v24->uHeight = v29;
-            //v2 = 255;
-            v24->uW = v30 + v29 - 1;
-            v63 += v54 + v29;
+            memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s
+            strcat(pTopicArray[index], pTmpBuf.data());
+            strcat(pTopicArray[index], "\n \n");
+            pButton->uY = pRealTextHeight;
+            pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0);
+            v30 = pButton->uY;
+            pButton->uHeight = pTextHeight;
+            pButton->uW = v30 + pTextHeight - 1;
+            pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight;
           }
         }
         else
         {
-          v31 = a1;
-          ++v62;
-          ++s1;
-          a1 += 100;
-          strcpy(v31, "");
-          if ( v24 )
+          strcpy(pTopicArray[index], "");
+          if ( pButton )
           {
-            v24->uW = 0;
-            v24->uHeight = 0;
-            v24->uY = 0;
+            pButton->uW = 0;
+            pButton->uHeight = 0;
+            pButton->uY = 0;
           }
         }
-        ++v60;
-        if ( (signed int)v60 >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
-          break;
-        //v16 = v59;
+        ++index;
+        ++pCurrentButton;
       }
-      if ( v63 != v55 )
+      if ( pRealTextHeight != pPrimaryTextHeight )
       {
-        /*v47[1] = &Dest;
-        v47[0] = &v51;
-        v46 = &v50;
-        v45 = (unsigned int)&v49;
-        v44 = &v48;
-        v43 = pTmpBuf2.data();*/
-        sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), v48[0], v48[1], v48[2], v48[3], v48[4]);
-        v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
+        sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]);
+        travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
       }
       else
       {
-LABEL_71:
-        v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,//"Извините, приходите в другой день"
+        travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//"Извините, приходите в другой день"
                           TargetColor(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3);
         pAudioPlayer->StopChannels(-1, -1);
       }
     }
   }
-  else
+  else//после нажатия топика
   {
     if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 )
     {
-      if ( pParty->uNumGold < s1 )
+      if ( pParty->uNumGold < pPrice )
       {
-        ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота"
         PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
         pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
         return;
       }
 
-      Party::TakeGold(s1);
+      Party::TakeGold(pPrice);
 
-      v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
-      if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
+      pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
+      if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] )
       {
-        if ( _stricmp(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
+        if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) )
         {
           SaveGame(1, 0);
-          strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
+          strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename);
 
           dword_6BE364_game_settings_1 |= 1u;
           _5B65B8_npcdata_hiword_house_or_other = 0;
           dword_5B65BC = 0;
-          _5B65B4_npcdata_loword_house_or_other = v5->arrival_rot_y;
-          v11 = *((int *)v5 + 3);
+          _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y;
           uGameState = GAME_STATE_2;
-          _5B65A8_npcdata_uflags_or_other = v11;
-          _5B65AC_npcdata_fame_or_other = v5->arrival_y;
-          _5B65B0_npcdata_rep_or_other = v5->arrival_z;
-          dword_5B65C0 = v11 | v5->arrival_y | v5->arrival_z | v5->arrival_rot_y;
+          _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x;
+          _5B65AC_npcdata_fame_or_other = pTravel->arrival_y;
+          _5B65B0_npcdata_rep_or_other = pTravel->arrival_z;
+          dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y;
         }
         else
         {
           pIndoorCamera->sRotationY = 0;
           pParty->uFlags |= 2u;
-          pParty->vPosition.x = v5->arrival_x;
-          pParty->vPosition.y = v5->arrival_y;
-          pParty->vPosition.z = v5->arrival_z;
+          pParty->vPosition.x = pTravel->arrival_x;
+          pParty->vPosition.y = pTravel->arrival_y;
+          pParty->vPosition.z = pTravel->arrival_z;
           pParty->uFallStartY = pParty->vPosition.z;
           pParty->sRotationX = 0;
-          pParty->sRotationY = v5->arrival_rot_y;
+          pParty->sRotationY = pTravel->arrival_rot_y;
         }
         PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
-        v12 = v5->uTravelTime;
-        int _v47;
+        v12 = pTravel->uTravelTime;
         if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
         {
-          v63 = SPEECH_SetSail;
+          pSpeech = SPEECH_SetSail;
           v13 = 2500;
           if ( CheckHiredNPCSpeciality(Sailor) )
             v12 -= 2;
           if ( CheckHiredNPCSpeciality(Navigator) )
             v12 -= 3;
-          //_v47 = 45;
           if ( CheckHiredNPCSpeciality(Pirate) )
             v12 -= 2;
         }
         else
         {
-          v63 = SPEECH_CarriageReady;
+          pSpeech = SPEECH_CarriageReady;
           v13 = 1500;
-          //_v47 = 35;
           if ( CheckHiredNPCSpeciality(Horseman) )
             v12 -= 2;
         }
@@ -2152,7 +2107,7 @@
         if ( v12 < 1 )
           v12 = 1;
         RestAndHeal(1440 * v12);
-        pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v63, 0);
+        pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0);
         v14 = GetTickCount();
         v15 = v14 + v13;
         if ( v15 < v14 )
--- a/UI/UIHouses.h	Mon Sep 09 09:13:40 2013 +0600
+++ b/UI/UIHouses.h	Wed Sep 11 09:23:41 2013 +0600
@@ -56,8 +56,8 @@
   HOUSE_ALCHEMIST_HARMONDALE = 43,
   HOUSE_STABLES_HARMONDALE = 54,
   HOUSE_STABLES_STEADWICK = 55,
-  HOUSE_STABLES_56 = 56,
-  HOUSE_STABLES_57 = 57,
+  HOUSE_STABLES_TULAREAN_FOREST = 56,
+  HOUSE_STABLES_DEYJA = 57,
   HOUSE_STABLES_58 = 58,
   HOUSE_STABLES_59 = 59,
   HOUSE_STABLES_60 = 60,
--- a/mm7_2.cpp	Mon Sep 09 09:13:40 2013 +0600
+++ b/mm7_2.cpp	Wed Sep 11 09:23:41 2013 +0600
@@ -578,9 +578,6 @@
 int sub_4BD8B5()
 {
   int v0; // eax@4
-  int v1; // eax@29
-  unsigned int v2; // esi@30
-  //const char *v3; // ebx@31
 
   if ( pMessageQueue_50CBD0->uNumMessages )
     pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -591,12 +588,9 @@
   if ( pDialogueNPCCount )
   {
     v0 = dialog_menu_id;
-    if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
-      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL
-      && dialog_menu_id != HOUSE_DIALOGUE_97
-      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR
-      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY
-      && ShopTexture )
+    if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL
+      && dialog_menu_id != HOUSE_DIALOGUE_97 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR
+      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY && ShopTexture )
     {
       ShopTexture->Release();
       v0 = dialog_menu_id;
@@ -645,23 +639,17 @@
     dialog_menu_id = HOUSE_DIALOGUE_NULL;
     pDialogueWindow = 0;
     pIcons_LOD->SyncLoadedFilesCount();
-    v1 = uNumDialogueNPCPortraits;
     if ( uNumDialogueNPCPortraits != 1 )
     {
-      v2 = 0;
       pBtn_ExitCancel = window_SpeakInHouse->pControlsHead;
       if ( uNumDialogueNPCPortraits > 0 )
       {
-        //v3 = byte_591180;
-        do
+        for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i )
         {
-          dword_5913F4[v2] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
-                                              0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2].data(), 0, 0, 0);
-          v1 = uNumDialogueNPCPortraits;
-          ++v2;
-          //v3 += 100;
+          HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i],
+                                                                              pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i],
+                                              63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0);
         }
-        while ( (signed int)v2 < uNumDialogueNPCPortraits );
       }
       pVideoPlayer->_4BF5B2();
       return 1;
--- a/mm7_data.cpp	Mon Sep 09 09:13:40 2013 +0600
+++ b/mm7_data.cpp	Wed Sep 11 09:23:41 2013 +0600
@@ -1044,7 +1044,7 @@
 int dword_59117C_teleportx; // weak
 std::array<std::array<char, 100>, 6> byte_591180; // idb
 std::array<struct NPCData *, 7> HouseNPCData;//0 zero element holds standart house npc
-GUIButton* dword_5913F4[6];
+GUIButton* HouseNPCPortraitsButtonsList[6];//dword_5913F4
 struct Texture *pTexture_591428;
 struct Texture *pTexture_outside; // idb
 struct Texture *pTexture_Dialogue_Background;
--- a/mm7_data.h	Mon Sep 09 09:13:40 2013 +0600
+++ b/mm7_data.h	Wed Sep 11 09:23:41 2013 +0600
@@ -694,7 +694,7 @@
 extern int dword_59117C_teleportx; // weak
 extern std::array<std::array<char, 100>, 6> byte_591180; // idb
 extern std::array<struct NPCData *, 7> HouseNPCData; //0this array size temporarily increased to 60 from 6 to work aroud house overflow
-extern GUIButton* dword_5913F4[6];
+extern GUIButton* HouseNPCPortraitsButtonsList[6];
 extern struct Texture *pTexture_591428;
 extern struct Texture *pTexture_outside; // idb
 extern struct Texture *pTexture_Dialogue_Background;