changeset 1760:a2ea57410b15

Merge
author Grumpy7
date Tue, 01 Oct 2013 06:19:58 +0200
parents 845a6503f55c (current diff) 24e756a50073 (diff)
children 2051dfa0a00c 110727780974 633f81bb3ae7
files Player.cpp
diffstat 16 files changed, 666 insertions(+), 1018 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.h	Tue Oct 01 06:17:32 2013 +0200
+++ b/AudioPlayer.h	Tue Oct 01 06:19:58 2013 +0200
@@ -77,7 +77,8 @@
   SOUND_EnteringAHouse = 0x6,
   SOUND_7 = 7,
   SOUND_8 = 0x8,
-  SOUND_27 = 0x1B,
+  SOUND_24 = 24,
+  SOUND_error = 27,
   SOUND_64 = 64,
   SOUND_Button = 66,
   SOUND_67 = 67,
--- a/GUIWindow.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/GUIWindow.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -230,7 +230,7 @@
       Y_pos = string_count * pFontComic->uFontHeight + 40; 
       text_color = TargetColor(spell_tooltip_colors[i].R, spell_tooltip_colors[i].G, spell_tooltip_colors[i].B);
       DrawText(pFontComic, 52, Y_pos, text_color, aSpellNames[i], 0, 0, 0);
-      sub_41D20D_buff_remaining_time_string(Y_pos, this, remaing_time, pFontComic); 
+      DrawBuff_remaining_time_string(Y_pos, this, remaing_time, pFontComic); 
       ++string_count;
         }
   }
@@ -1063,74 +1063,57 @@
 }
 
 //----- (004B1854) --------------------------------------------------------
-void GUIWindow::DrawCurrentTime( __int64 a2 )
-	{
-  unsigned int v2; // edi@1
-  unsigned int v3; // esi@1
-  unsigned int v4; // ebp@1
-  unsigned int v5; // ebx@1
-  signed __int64 v6; // ST2C_8@1
-  signed __int64 v7; // kr00_8@1
-  char *v8; // eax@2
-  char *v9; // eax@7
-  char *v10; // eax@13
-  char *v11; // eax@19
-  unsigned __int16 v12; // ST0C_2@22
-  int v13; // eax@22
-  GUIWindow *v15; // [sp+0h] [bp-1Ch]@1
-  signed __int64 v16; // [sp+Ch] [bp-10h]@1
-  signed __int64 v17; // [sp+14h] [bp-8h]@1
-  unsigned int v18; // [sp+20h] [bp+4h]@1
+void GUIWindow::DrawShops_next_generation_time_string( __int64 next_generation_time )
+{
+  unsigned int full_time; // esi@1
+  signed __int64 hours; // kr00_8@1
+  char *text; // eax@2
+  signed __int64 minutes; // [sp+Ch] [bp-10h]@1
+  signed __int64 seconds; // [sp+14h] [bp-8h]@1
+  unsigned int days; // [sp+20h] [bp+4h]@1
 
-  v15 = this;
-  v2 = (unsigned __int64)(signed __int64)((double)a2 * 0.234375) >> 32;
-  v3 = (signed __int64)((double)a2 * 0.234375);
-  v4 = (unsigned __int64)((signed __int64)((double)a2 * 0.234375) / 60) >> 32;
-  v5 = (signed __int64)((double)a2 * 0.234375) / 60;
-  v6 = (signed __int64)((double)a2 * 0.234375) / 60 / 60;
-  v18 = (unsigned int)v6 / 0x18;
-  v17 = (signed __int64)__PAIR__(v2, v3) % 60;
-  v16 = (signed __int64)__PAIR__(v4, v5) % 60;
-  v7 = v6 % 24;
+  full_time = (signed __int64)((double)next_generation_time * 0.234375);
+  seconds = (signed __int64)full_time % 60;
+  minutes = (signed __int64)(full_time / 60) % 60;
+  hours = ((full_time / 60) / 60) % 24;
+  days = (unsigned int)((full_time / 60) / 60) / 24;
   strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[532]);
-  if ( (unsigned int)v6 /24 )
+  if ( days )
   {
-    v8 = pGlobalTXT_LocalizationStrings[57];
-    if ( v18 <= 1 )
-      v8 = pGlobalTXT_LocalizationStrings[56];
-    sprintfex(pTmpBuf2.data(), "%d %s ", v18, v8);
+    text = pGlobalTXT_LocalizationStrings[57];//Days
+    if ( days <= 1 )
+      text = pGlobalTXT_LocalizationStrings[56];//Day
+    sprintfex(pTmpBuf2.data(), "%d %s ", days, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  if ( v7 )
+  if ( hours )
   {
-    if ( v7 <= 1 )
-      v9 = pGlobalTXT_LocalizationStrings[109];
+    if ( hours <= 1 )
+      text = pGlobalTXT_LocalizationStrings[109];//Hour
     else
-      v9 = pGlobalTXT_LocalizationStrings[110];
-    sprintfex(pTmpBuf2.data(), "%d %s ", v7, v9);
+      text = pGlobalTXT_LocalizationStrings[110];//Hours
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  if ( v16 && !v18 )
+  if ( minutes && !days )
   {
-    if ( v16 <= 1 )
-      v10 = pGlobalTXT_LocalizationStrings[437];//"Minute"
+    if ( minutes <= 1 )
+      text = pGlobalTXT_LocalizationStrings[437];//"Minute"
     else
-      v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes"
-    sprintfex(pTmpBuf2.data(), "%d %s ", v16, v10);
+      text = pGlobalTXT_LocalizationStrings[436]; //"Minutes"
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  if ( v17 && !v7 )
+  if ( seconds && !hours )
   {
-    if ( v17 <= 1 )
-      v11 = pGlobalTXT_LocalizationStrings[439]; //"Second"	
+    if ( seconds <= 1 )
+      text = pGlobalTXT_LocalizationStrings[439]; //"Second"	
     else
-      v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds"
-    sprintfex(pTmpBuf2.data(), "%d %s ", v17, v11);
+      text = pGlobalTXT_LocalizationStrings[438]; //"Seconds"
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  v13 = pFontArrus->CalcTextHeight(pTmpBuf.data(), v15, 0, 0);
-  v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf.data(), 3u);
+  this->DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), this, 0, 0)) / 2 + 101, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
 }
 
 
--- a/GUIWindow.h	Tue Oct 01 06:17:32 2013 +0200
+++ b/GUIWindow.h	Tue Oct 01 06:19:58 2013 +0200
@@ -329,7 +329,7 @@
   int DrawTextInRect(GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text);
   void DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor);
   void DrawTitleText(GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing);
-  void DrawCurrentTime(__int64 a2);
+  void DrawShops_next_generation_time_string(__int64 next_generation_time);
   void HouseDialogManager();
   void OpenSpellBook();
   void InitializeBookView();
--- a/Player.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/Player.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -918,7 +918,7 @@
   }
   if ( !CanFitItem(index, uItemID) )
   {
-    pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+    pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
     return 0;
   }
   return CreateItemInInventory(index, uItemID);
--- a/SaveLoad.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/SaveLoad.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -58,7 +58,7 @@
   dword_5B65C8_timers_count = 0;
   if (!pSavegameUsedSlots[uSlot])
   {
-    pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+    pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
     Log::Warning(L"LoadGame: slot %u is empty", uSlot);
     return;
   }
--- a/UI/UICharacter.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UICharacter.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -2405,7 +2405,7 @@
         }
         if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() && (pEquipType != EQUIP_ARMOUR || bUnderwater) )
         {
-          pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+          pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
           return;
         }
         pPlayers[uActiveCharacter]->EquipBody(pEquipType);
@@ -2416,7 +2416,7 @@
       case EQUIP_RING:
         if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() )
         {
-          pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+          pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
           return;
         }
         //слоты для колец
@@ -2453,7 +2453,7 @@
       case EQUIP_SHIELD://Щит
         if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() )//в акваланге
         {
-          pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+          pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
           return;
         }
         if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )//нет навыка
@@ -2506,7 +2506,7 @@
           && pParty->pPickedItem.uItemID != 64
           && pParty->pPickedItem.uItemID != 65 )
         {
-          pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+          pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
           return;
         }
         if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )
@@ -2608,7 +2608,7 @@
       case EQUIP_MAIN_HAND:
         if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() )
         {
-          pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+          pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
           return;
         }
         if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )
@@ -2620,7 +2620,7 @@
         {
           if ( v2 )
           {
-            pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+            pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
             return;
           }
           --v1;
@@ -2677,7 +2677,7 @@
     {
       if ( bUnderwater )
       {
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+        pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
         return;
       }
       WetsuitOff(uActiveCharacter);
--- a/UI/UIGuilds.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UIGuilds.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -223,7 +223,7 @@
       DrawTextAtStatusBar(statusbar_string, 0);
       if ( !v8 )
       {
-        working_window.DrawCurrentTime(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//"Приходите через 14 дней"
+        working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//"Приходите через 14 дней"
         return;
       }
       v12 = pMouse->GetCursorPos(&v51);
@@ -249,7 +249,7 @@
       {
         sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
         ShowStatusBarString(pTmpBuf.data(), 2);
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+        pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
       }
       else
       {
--- a/UI/UIHouses.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UIHouses.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -1606,7 +1606,7 @@
       else
       {
         dialog_menu_id = HOUSE_DIALOGUE_MAIN;
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+        pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
       }
     }
   }
@@ -2809,7 +2809,7 @@
     //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);
+      pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
     }
     else
     {
--- a/UI/UIPopup.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UIPopup.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -1662,7 +1662,7 @@
     {
       if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands
       {
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+        pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
         return;
       }
 
@@ -1995,3 +1995,4 @@
   GameUI_DrawItemInfo(item);
   return;
 }
+
--- a/UI/UIShops.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UIShops.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -116,7 +116,7 @@
           }
         }
         else
-          dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней
+          dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней
       }
       break;
     }
@@ -167,7 +167,7 @@
           }
         }
         else
-          dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C]  - pParty->uTimePlayed);
+          dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C]  - pParty->uTimePlayed);
       }
       break;
     }
@@ -450,7 +450,7 @@
         }
         return;
       }
-      dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
+      dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
       return;
     }
     break;
@@ -513,7 +513,7 @@
         }
         return;
       }
-      dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
+      dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
       return;
     }
     break;
@@ -689,10 +689,10 @@
   signed int v5; // esi@9
   int v18; // eax@23
   char *pText; // edx@29
-  unsigned int v47; // edi@55
-  unsigned int v48; // esi@57
-  unsigned int v51; // edi@67
-  unsigned int v52; // esi@69
+  unsigned int product_height_1row; // edi@55
+  unsigned int product_width_1row; // esi@57
+  unsigned int product_height_2row; // edi@67
+  unsigned int product_width_2row; // esi@69
   ItemGen *item; // esi@118
   int v71; // eax@123
   int all_text_height; // edi@125
@@ -750,47 +750,47 @@
       {
         if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
         {
-          v47 = 152 - ItemsInShopTexture[i]->uTextureHeight;
-          if ( (signed int)v47 < 1 )
-            v47 = 0;
-          v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+          product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+          if ( (signed int)product_height_1row < 1 )
+            product_height_1row = 0;
+          product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth )
-                v48 = 457 - ItemsInShopTexture[5]->uTextureWidth;
+              if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
+                product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
             }
           }
-          else if ( (signed int)v48 < 18 )
-            v48 = 18;
-          pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1);
+          else if ( (signed int)product_width_1row < 18 )
+            product_width_1row = 18;
+          pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
         }
       }
       for ( uint i = 0; i < 6; ++i )
       {
         if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID )
         {
-          v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
-          if ( (signed int)v51 < 1 )
-            v51 = 0;
-          v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+          product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
+          if ( (signed int)product_height_2row < 1 )
+            product_height_2row = 0;
+          product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth )
-                v52 = 457 - ItemsInShopTexture[11]->uTextureWidth;
+              if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
+                product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
             }
           }
           else
           {
-            if ( (signed int)v52 < 18 )
-              v52 = 18;
+            if ( (signed int)product_width_2row < 18 )
+              product_width_2row = 18;
           }
-          pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7);
+          pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
         }
       }
       if ( HouseUI_CheckIfPlayerCanInteract() )
@@ -807,7 +807,7 @@
           DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);
         if ( !item_num )
         {
-          dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
+          dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
           return;
         }
         pMouse->GetCursorPos(&mouse);
@@ -835,50 +835,50 @@
       {
         if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
         {
-          v47 = 152 - ItemsInShopTexture[i]->uTextureHeight;
-          if ( (signed int)v47 < 1 )
-            v47 = 0;
-          v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+          product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+          if ( (signed int)product_height_1row < 1 )
+            product_height_1row = 0;
+          product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth )
-                v48 = 457 - ItemsInShopTexture[5]->uTextureWidth;
+              if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
+                product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
             }
           }
           else
           {
-            if ( (signed int)v48 < 18 )
-              v48 = 18;
+            if ( (signed int)product_width_1row < 18 )
+              product_width_1row = 18;
           }
-          pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1);
+          pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
         }
       }
       for ( uint i = 0; i < 6; ++i )
       {
         if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid
         {
-          v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
-          if ( (signed int)v51 < 1 )
-            v51 = 0;
-          v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+          product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
+          if ( (signed int)product_height_2row < 1 )
+            product_height_2row = 0;
+          product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth )
-                v52 = 457 - ItemsInShopTexture[11]->uTextureWidth;
+              if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
+                product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
             }
           }
           else
           {
-            if ( (signed int)v52 < 18 )
-              v52 = 18;
+            if ( (signed int)product_width_2row < 18 )
+              product_width_2row = 18;
           }
-          pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7);
+          pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
         }
       }
       if ( HouseUI_CheckIfPlayerCanInteract() )
@@ -895,7 +895,7 @@
           DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);
         if ( !item_num )
         {
-          dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
+          dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
           return;
         }
         pMouse->GetCursorPos(&mouse);
@@ -1062,125 +1062,30 @@
 //----- (004B4FCF) --------------------------------------------------------
 void MagicShopDialog()
 {
-  int result; // eax@6
-  signed int v2; // esi@8
-  unsigned int v3; // ebx@10
-  char *v4; // eax@11
-  char *v5; // eax@12
-  unsigned int v6; // eax@12
-  int v7; // ST08_4@14
-  int v8; // eax@14
-  unsigned __int8 v9; // dl@14
-  char *v10; // ecx@14
-  signed int v11; // esi@16
-  int v12; // ST08_4@19
-  int v13; // eax@19
   int all_text_height; // edi@21
-  char **v15; // esi@21
-  int v16; // eax@22
-  int v18; // edx@23
-  int v19; // edi@23
-  unsigned __int8 v20; // sf@23
   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 text_color; // ax@25
-  signed int pTextHeight; // esi@30
-  int v28; // ST08_4@34
-  int v29; // eax@34
   char *v30; // edx@35
-  void *v32; // eax@40
   signed int v33; // esi@40
-  unsigned int v34; // esi@42
-  int v35; // eax@42
-  unsigned int v36; // eax@43
-  int v37; // eax@45
-  int v38; // ecx@50
-  int v41; // eax@52
-  char *v42; // eax@54
-  int v43; // eax@54
-  unsigned int v44; // ecx@54
-  int v45; // edx@54
-  int v46; // eax@54
-  unsigned __int16 v47; // ax@54
-  int v48; // eax@58
-  signed int v49; // esi@62
-  Texture *v50; // ecx@64
-  unsigned int v51; // edi@64
-  unsigned int v52; // esi@66
-  int v53; // edx@70
-  Texture *v54; // ecx@76
-  unsigned int v55; // edi@76
-  unsigned int v56; // esi@76
-  int v57; // edx@80
-  unsigned int v59; // edi@86
-  unsigned int v60; // esi@88
-  int v61; // edx@92
-  unsigned int v63; // edi@98
-  unsigned int v64; // esi@100
-  int v65; // edx@104
-  signed int v66; // ecx@109
-  SHORT v67; // di@117
-  bool v68; // eax@117
-  const char *v69; // ecx@119
-  POINT *v70; // esi@124
-  int v71; // ecx@125
-  int v73; // ecx@125
+  unsigned int product_height_1row; // edi@64
+  unsigned int product_width_1row; // esi@66
+  unsigned int product_height_2row; // edi@76
+  unsigned int product_width_2row; // esi@76
   int v75; // eax@130
-  int v78; // eax@132
-  int v80; // edx@133
-  int v81; // edi@133
-  const char **v83; // eax@135
-  int v84; // eax@135
-  unsigned int v85; // ecx@135
-  int v86; // edx@135
-  int v89; // [sp-14h] [bp-10Ch]@35
-  int v91; // [sp-10h] [bp-108h]@35
-  unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
-  void *v93; // [sp-Ch] [bp-104h]@14
-  int v94; // [sp-8h] [bp-100h]@11
-  char *v95; // [sp-8h] [bp-100h]@12
-  __int64 *v96; // [sp-4h] [bp-FCh]@11
-  unsigned int v97; // [sp-4h] [bp-FCh]@12
-  POINT v98; // [sp+Ch] [bp-ECh]@8
-  POINT v99; // [sp+14h] [bp-E4h]@16
-  POINT v100; // [sp+1Ch] [bp-DCh]@124
-  POINT v101; // [sp+24h] [bp-D4h]@17
-  POINT v102; // [sp+2Ch] [bp-CCh]@124
-  POINT v103; // [sp+34h] [bp-C4h]@9
-  POINT v104; // [sp+3Ch] [bp-BCh]@31
-  POINT v105; // [sp+44h] [bp-B4h]@16
-  POINT v106; // [sp+4Ch] [bp-ACh]@30
-  POINT v107; // [sp+54h] [bp-A4h]@16
-  POINT v108; // [sp+5Ch] [bp-9Ch]@30
-  POINT a2; // [sp+64h] [bp-94h]@8
-  POINT v110; // [sp+6Ch] [bp-8Ch]@30
-  POINT v111; // [sp+74h] [bp-84h]@8
+  POINT mouse; // [sp+6Ch] [bp-8Ch]@30
   GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
-  char *Str; // [sp+D0h] [bp-28h]@54
-  int v146; // [sp+D4h] [bp-24h]@23
-  unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1
-  unsigned int pWhiteColor; // [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
-  int _this; // [sp+ECh] [bp-Ch]@1
-  unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
-  int v152; // [sp+F4h] [bp-4h]@23
-  int v122;
-  int v114;
+  int item_num; // [sp+E0h] [bp-18h]@8
+  int v117; // [sp+E4h] [bp-14h]@40
+  int pPrice; // [sp+E8h] [bp-10h]@24
+  int one_string; // [sp+ECh] [bp-Ch]@1
   int pSrtingNum;
-  int pActiveItemNum;
   ItemGen *item;
 
   memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pWhiteColor = TargetColor(255, 255, 255);
-  pYellowColor = TargetColor(225, 205, 35);
   if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
     if ( !HouseUI_CheckIfPlayerCanInteract() )
@@ -1192,292 +1097,200 @@
     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 )
+    one_string = (174 - all_text_height) / 4;
+    v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138;
+    int pNumString = 0;
+    for (int i = pDialogueWindow->pStartingPosActiveItem;
+             i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;  ++i)
     {
-      int th = 2;
-      for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;  ++v152)
-      {
-        control_button = pDialogueWindow->GetControl(v152);
-        control_button->uY = v146 + v23;
-        pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
-        control_button->uHeight = pTextHeight;
-        v23 = control_button->uY + control_button->uHeight - 1;
-        control_button->uW = v23;
-        text_color = pYellowColor;
-        if ( pDialogueWindow->pCurrentPosActiveItem != th )
-          text_color = pWhiteColor;
-        dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
-        ++th;               
-        ++j;
-      }
+      control_button = pDialogueWindow->GetControl(i);
+      control_button->uY = one_string + v23;
+      control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
+      v23 = control_button->uY + control_button->uHeight - 1;
+      control_button->uW = v23;
+      text_color = TargetColor(225, 205, 35);
+      if ( pDialogueWindow->pCurrentPosActiveItem != i )
+        text_color = TargetColor(255, 255, 255);
+      dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3);
+      ++pNumString;
     }
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
   {
     pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
-    v3 = 0;
-    v49 = 0;
-    v122 = 0;
-    do
+    for ( uint i = 0; i < 6; ++i )
     {
-      if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
+      if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
       {
-        v50 = ItemsInShopTexture[v49];
-        v51 = 152 - v50->uTextureHeight;
-        if ( (signed int)v51 < 1 )
-          v51 = 0;
-        v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
-        if ( v122 )
+        product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+        if ( (signed int)product_height_1row < 1 )
+          product_height_1row = 0;
+        product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+        if ( i )
         {
-          if ( v122 == 5 )
+          if ( i == 5 )
           {
-            v53 = ItemsInShopTexture[5]->uTextureWidth;
-            if ( (signed int)v52 > 457 - v53 )
-              v52 = 457 - v53;
+            if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
+              product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
           }
         }
         else
         {
-          if ( (signed int)v52 < 18 )
-            v52 = 18;
+          if ( (signed int)product_width_1row < 18 )
+            product_width_1row = 18;
         }
-        pRenderer->DrawTextureTransparent(v52, v51, v50);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
-        v49 = v122;
+        pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
       }
-      ++v49;
-      v122 = v49;
     }
-    while ( v49 < 6 );
-    v122 = 0;
-    do
+    for ( uint i = 0; i < 6; ++i )
     {
-      if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID)
+      if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
       {
-        v54 = ItemsInShopTexture[v122 + 6];
-        v55 = 306 - v54->uTextureHeight;
-        v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
-        if ( v122 )
+        product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
+        product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+        if ( i )
         {
-          if ( v122 == 5 )
+          if ( i == 5 )
           {
-            v57 = ItemsInShopTexture[11]->uTextureWidth;
-            if ( (signed int)v56 > 457 - v57 )
-              v56 = 457 - v57;
+            if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
+              product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
           }
         }
         else
         {
-          if ( (signed int)v56 < 18 )
-            v56 = 18;
+          if ( (signed int)product_width_2row < 18 )
+            product_width_2row = 18;
         }
-        pRenderer->DrawTextureTransparent(v56, v55, v54);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
+        pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
       }
-      ++v122;
     }
-    while ( v122 < 6 );
     if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      v66 = 0;
-      v117 = 0;
-      if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-      {
-        do
-        {
-          if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-            ++v117;
-          ++v66;
-        }
-        while ( v66 < 12 );
-      }
-      else
+      item_num = 0;
+      for ( uint i = 0; i < 12; ++i )
       {
-        do
-        {
-          if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
-            ++v117;
-          ++v66;
-        }
-        while ( v66 < 12 );
+        if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
+          ++item_num;
       }
-      v67 = GetAsyncKeyState(VK_CONTROL);
-      v68 = pPlayers[uActiveCharacter]->CanSteal();
-      Str = (char *)v68;
-      if ( v67 && v68 )
+      if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
+        DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item"
+      else
+        DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy"
+      if ( !item_num )
       {
-        v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
-      }
-      else
-      {
-        v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
-        if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-          v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
-      }
-      DrawTextAtStatusBar(v69, 0);
-      if ( !v117 )
-      {
-        dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
+        dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
         return;
       }
-      v70 = pMouse->GetCursorPos(&v102);
-      result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
-      if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
+      pMouse->GetCursorPos(&mouse);
+      if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
       {
-        v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
-        item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
-        if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-          item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
-        if ( v67 && Str )
-          v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
+        item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
+        if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
+          v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24"
         else
         {
           v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
-          v10 = (char *)pMerchantsBuyPhrases[v75];
+          v30 = BuildDialogueString((char *)pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
         }
-        v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
-        v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
-        dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
         return;
       }
     }
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
   {
     pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
-    v3 = 0;
-    v49 = 0;
-    v122 = 0;
-    do
+    for ( uint i = 0; i < 6; ++i )
     {
-      if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
+      if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
       {
-        v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight;
-        if ( (signed int)v59 < 1 )
-          v59 = 0;
-        v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40;
-        if ( v122 )
-        {
-          if ( v122 == 5 )
-          {
-            v61 = ItemsInShopTexture[5]->uTextureWidth;
-            if ( (signed int)v60 > 457 - v61 )
-              v60 = 457 - v61;
-          }
-        }
-        else
+        product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+        if ( (signed int)product_height_1row < 1 )
+          product_height_1row = 0;
+        product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+        if ( i )
         {
-          if ( (signed int)v60 < 18 )
-            v60 = 18;
-        }
-        pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
-        v49 = v122;
-      }
-      ++v49;
-      v122 = v49;
-    }
-    while ( v49 < 6 );
-    v122 = 0;
-    do
-    {
-      if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID)
-      {
-        v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight;
-        if ( (signed int)v63 < 1 )
-          v63 = 0;
-        v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40;
-        if ( v122 )
-        {
-          if ( v122 == 5 )
+          if ( i == 5 )
           {
-            v65 = ItemsInShopTexture[11]->uTextureWidth;
-            if ( (signed int)v64 > 457 - v65 )
-              v64 = 457 - v65;
+            if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
+              product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
           }
         }
         else
         {
-          if ( (signed int)v64 < 18 )
-            v64 = 18;
+          if ( (signed int)product_width_1row < 18 )
+            product_width_1row = 18;
         }
-        pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
+        pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
       }
-      ++v122;
     }
-    while ( v122 < 6 );
+    for ( uint i = 0; i < 6; ++i )
+    {
+      if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
+      {
+        product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
+        if ( (signed int)product_height_2row < 1 )
+          product_height_2row = 0;
+        product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+        if ( i )
+        {
+          if ( i == 5 )
+          {
+            if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
+              product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
+          }
+        }
+        else
+        {
+          if ( (signed int)product_width_2row < 18 )
+            product_width_2row = 18;
+        }
+        pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
+      }
+    }
     if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      v66 = 0;
-      v117 = 0;
-      if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-      {
-        do
-        {
-          if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-            ++v117;
-          ++v66;
-        }
-        while ( v66 < 12 );
-      }
-      else
+      item_num = 0;
+      for ( uint i = 0; i < 12; ++i )
       {
-        do
-        {
-          if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
-            ++v117;
-          ++v66;
-        }
-        while ( v66 < 12 );
+        if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
+          ++item_num;
       }
-      v67 = GetAsyncKeyState(VK_CONTROL);
-      v68 = pPlayers[uActiveCharacter]->CanSteal();
-      Str = (char *)v68;
-      if ( v67 && v68 )
+      if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
+        DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item"
+      else
+        DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy"
+      if ( !item_num )
       {
-        v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
-      }
-      else
-      {
-        v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
-        if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-          v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
-      }
-      DrawTextAtStatusBar(v69, 0);
-      if ( !v117 )
-      {
-        dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
+        dialog_window.DrawShops_next_generation_time_string( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
         return;
       }
-      v70 = pMouse->GetCursorPos(&v102);
-      result = v70->x + pSRZBufferLineOffsets[v70->y];
-      if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
+      pMouse->GetCursorPos(&mouse);
+      if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
       {
-        v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
-        item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
-        if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-          item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
-        if ( v67 && Str )
-          v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
+        item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
+        if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
+          v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24"
         else
         {
           v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
-          v10 = (char *)pMerchantsBuyPhrases[v75];
+          v30 = BuildDialogueString((char *)pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
         }
-        v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
-        v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
-        dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
         return;
       }
     }
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
   {
     draw_leather();
@@ -1488,55 +1301,46 @@
     all_text_height = 0;
     for ( uint i = 0; i < 3; ++i )
       all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
-    _this = ((174 - all_text_height) / 3);
-    v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
-    v20 = -pDialogueWindow->pNumPresenceButton < 0;
-    v118 = pDialogueWindow->pStartingPosActiveItem;
-    if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) )
+    one_string = ((174 - all_text_height) / 3);
+    v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
+    pSrtingNum = 0;
+    for ( int i = pDialogueWindow->pStartingPosActiveItem;
+              i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
     {
-      v122 = 2;
-      pSrtingNum = 0;
-      do
-      {
-        control_button = pDialogueWindow->GetControl(v118);
-        control_button->uY = (unsigned int)((char *)_this + v81);
-        pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0);
-        v85 = control_button->uY;
-        control_button->uHeight = pTextHeight;
-        v81 = pTextHeight + v85 - 1;
-        control_button->uW = v81;
-        text_color = pYellowColor;
-        if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
-          text_color = pWhiteColor;
-        dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3);
-        ++v122;
-        ++pSrtingNum;
-        ++v118;
-      }
-      while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+      control_button = pDialogueWindow->GetControl(i);
+      control_button->uY = one_string + v23;
+      control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0);
+      v23 = control_button->uHeight + control_button->uY - 1;
+      control_button->uW = v23;
+      text_color = TargetColor(225, 205, 35);
+      if ( pDialogueWindow->pCurrentPosActiveItem != i )
+        text_color = TargetColor(255, 255, 255);
+      dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3);
+      ++pSrtingNum;
     }
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL)
   {
     draw_leather();
     CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
     DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
-    if ( !HouseUI_CheckIfPlayerCanInteract()
-      || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
-          v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
-          result = (int)pMouse->GetCursorPos(&v105),
-          *(int *)result <= 13)
-      || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
-      || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
+    if ( !HouseUI_CheckIfPlayerCanInteract() )
+      return;
+    pMouse->GetCursorPos(&mouse);
+    v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
+    if ( mouse.x <= 13 || mouse.x >= 462 )
       return;
-    item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1];
-    v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3);
-    v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
-    v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
-    dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
+    if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) )
+      return;
+    item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
+    v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3);
+    v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
+    dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY)
   {
     draw_leather();
@@ -1544,137 +1348,108 @@
     DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
     if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      v2 = pMouse->GetCursorPos(&a2)->x - 14;
-      v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
-      result = (int)pMouse->GetCursorPos(&v111);
-      if ( *(int *)result > 13 )
+      pMouse->GetCursorPos(&mouse);
+      v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5);
+      if ( mouse.x > 13 && mouse.x < 462 )
       {
-        result = (int)pMouse->GetCursorPos(&v103);
-        if ( *(int *)result < 462 )
+        if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) )
         {
-          result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117);
-          if ( result )
+          item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
+          if ( item->uAttributes & 1 )
           {
-            item = &pPlayers[uActiveCharacter]->pInventoryItemList[result-1];
-            if ( item->uAttributes & 1 )
-            {
-              v5 = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
-              v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
-              dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3); 
-              return;
-            }
-            v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
-            v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
-            v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138;
-            dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3);
+            dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101,
+               TargetColor(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3); 
             return;
           }
+          v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
+          v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
+          dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
+          return;
         }
       }
     }
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR)
   {
     draw_leather();
     CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
     DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
-    if ( !HouseUI_CheckIfPlayerCanInteract()
-      || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14,
-          v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
-          result = (int)pMouse->GetCursorPos(&v106),
-          *(int *)result <= 13)
-      || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
-      || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
-     // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) )
-        || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) )
+    if ( !HouseUI_CheckIfPlayerCanInteract() )
+      return;
+    pMouse->GetCursorPos(&mouse);
+    v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
+    if ( mouse.x <= 13 || mouse.x >= 462 )
       return;
-    item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1];
-    v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
-    v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
-    v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
-    dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
+    if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)
+      || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) )
+      return;
+    item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
+    v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1],
+             BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
+    v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
+    dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
     return;
   }
+
   if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
   {
     if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      v3 = 0;
       all_text_height = 0;
       v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
-      v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100);
-      if ( (signed int)v119 < v33 / 3 )
-        v119 = (const char **)(v33 / 3);
-      pActiveItemNum = pDialogueWindow->pStartingPosActiveItem;
-      v122 = 0;
-      if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+      pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
+      if ( pPrice < v33 / 3 )
+        pPrice = v33 / 3;
+      item_num = 0;
+      for ( int i = pDialogueWindow->pStartingPosActiveItem;
+                i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
+      {
+        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[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
+          ++item_num;
+        }
+      }
+      if ( !item_num )
       {
         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."
-        v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
-        dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3);
-        return;
-      }
-      do
-      {
-        v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36;
-        if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] )
-        {
-          all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
-          ++v122;
-        }
-        ++pActiveItemNum;
-      }
-      while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
-      if ( !v122 )
-      {
-        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."
-        v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
-        dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(225, 205, 35), pTmpBuf.data(), 3);
         return;
       }
-      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
-      dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
-      v119 = (const char **)((149 - all_text_height) / v122);
-      if ( (149 - all_text_height) / v122 > 32 )
-        v119 = (const char **)32;
-      v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162;
-      v118 = 2;
-      if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu"
+      dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
+      one_string = (149 - all_text_height) / item_num;
+      if ( one_string > 32 )
+        one_string = 32;
+      v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162;
+      for ( int i = pDialogueWindow->pStartingPosActiveItem;
+                i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i)
       {
-        v122 = 2;
-        do
+        control_button = pDialogueWindow->GetControl(i);
+        if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36]
+           || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] )
         {
-          control_button = pDialogueWindow->GetControl(v122);
-          v41 = control_button->msg_param - 36;
-          if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] )
-          {
-            control_button->uW = 0;
-            control_button->uHeight = 0;
-            control_button->uY = 0;
-          }
-          else
-          {
-            control_button->uY = (unsigned int)((char *)v119 + v38);
-            pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
-            v44 = control_button->uY;
-            control_button->uHeight = pTextHeight;
-            v38 = v44 + pTextHeight - 1;
-            control_button->uW = v38;
-            text_color = pYellowColor;
-            if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
-              text_color = pWhiteColor;
-            dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3);
-          }
-          ++v122;
+          control_button->uW = 0;
+          control_button->uHeight = 0;
+          control_button->uY = 0;
         }
-        while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+        else
+        {
+          control_button->uY = one_string + v23;
+          control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0);
+          v23 = control_button->uY + control_button->uHeight - 1;
+          control_button->uW = v23;
+          text_color = TargetColor(225, 205, 35);
+          if ( pDialogueWindow->pCurrentPosActiveItem != i )
+            text_color = TargetColor(255, 255, 255);
+          dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3);
+        }
       }
     }
     return;
@@ -1713,7 +1488,7 @@
   }
   if ( !HouseUI_CheckIfPlayerCanInteract() )
   {
-    pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+    pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
     return;
   }
 
@@ -1727,8 +1502,8 @@
     }
     case HOUSE_DIALOGUE_GUILD_BUY_BOOKS:
     {
-      pCursorPos = pMouse->GetCursorPos(&cursor);
-      v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF;
+      pMouse->GetCursorPos(&cursor);
+      v18 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
       if ( !v18 )
         return;
       bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C));
@@ -1775,7 +1550,7 @@
         return;
       }
       pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
-      pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+      pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
       break;
     }
     case HOUSE_DIALOGUE_SHOP_IDENTIFY:
@@ -1805,7 +1580,7 @@
               PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
               return;
             }
-            pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+            pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
             pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
             return;
           }
@@ -1847,7 +1622,7 @@
                 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
                 return;
               }
-              pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+              pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
               pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
               return;
             }
@@ -1868,7 +1643,7 @@
       if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
         bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
       else
-        bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
+        bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
       uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
       uNumSeconds = 0;
       a3 = 0;
@@ -1973,64 +1748,47 @@
 //----- (004B1A2D) --------------------------------------------------------
 void  ShowPopupShopItem()
 {
-  POINT *v1; // esi@5
-  unsigned int v2; // eax@5
   int v3; // ecx@5
-  POINT *v4; // esi@12
-  int v5; // eax@12
   unsigned int v6; // eax@13
   ItemGen *v7; // ecx@13
-  signed int v8; // esi@17
-  unsigned int v9; // eax@19
-  POINT v10; // [sp+8h] [bp-44h]@12
-  POINT v11; // [sp+10h] [bp-3Ch]@12
-  POINT  v12; // [sp+18h] [bp-34h]@18
-  POINT  v13; // [sp+20h] [bp-2Ch]@17
-  POINT v14; // [sp+28h] [bp-24h]@17
-  POINT  v15; // [sp+30h] [bp-1Ch]@17
-  POINT v16; // [sp+38h] [bp-14h]@5
-  POINT a2; // [sp+40h] [bp-Ch]@5
+  POINT  cursor; // [sp+30h] [bp-1Ch]@17
 
   if ( in_current_building_type <= 0 )
     return;
+  if ( dialog_menu_id < HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
+    return;
   if ( in_current_building_type <= BuildingType_AlchemistShop )
   {
-    if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
+    if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
     {
-      if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-        return;
-      if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
-      {
-        v8 = pMouse->GetCursorPos(&v15)->x - 14;
-        v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5);
-        if ( pMouse->GetCursorPos(&v13)->x <= 13
-          || pMouse->GetCursorPos(&v12)->x >= 462
-          || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 )
-          return;
-        GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[v9 - 1]);
+      pMouse->GetCursorPos(&cursor);
+      v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
+      if ( !v3 )
         return;
-      }
-      if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
-        return;
+      v7 = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1];
+      if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
+        v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1];
+      GameUI_DrawItemInfo(v7);
+      return;
     }
-    v4 = pMouse->GetCursorPos(&v11);
-    v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF;
-    if ( !v5 )
+
+    if ( dialog_menu_id >= HOUSE_DIALOGUE_SHOP_SELL && dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR
+      || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
+    {
+      pMouse->GetCursorPos(&cursor);
+      v3 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5);
+      if ( cursor.x <= 13 || cursor.x >= 462
+        || !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) )
+        return;
+      GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) - 1]);
       return;
-    v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
-    v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
-    if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-      v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1];
-    GameUI_DrawItemInfo(v7);
-    return;
+    }
   }
   if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS )
   {
-    v1 = pMouse->GetCursorPos(&a2);
-    v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y];
-    v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
-    v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
-    if ( v5 )
+    pMouse->GetCursorPos(&cursor);
+    v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
+    if ( v3 )
       sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
   }
 }
--- a/UI/UITransition.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UITransition.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -26,18 +26,9 @@
 //----- (00444839) --------------------------------------------------------
 void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName)
 {
-  unsigned int v12; // eax@6
-  const char *v13; // ST0C_4@6
-  unsigned int v14; // eax@8
   const char *v15; // eax@14
-  unsigned int v16; // eax@16
-  const char *v18; // [sp-8h] [bp-40h]@9
-  char *v20; // [sp-4h] [bp-3Ch]@9
-  const char *v21; // [sp-4h] [bp-3Ch]@11
   char pContainer[40]; // [sp+Ch] [bp-2Ch]@1
-  unsigned int v23; // [sp+34h] [bp-4h]@1
 
-  v23 = IndoorLocation::GetLocationIndex(pLocationName);
   dword_59117C_teleportx = x;
   dword_591178_teleporty = y;
   dword_591174_teleportz = z;
@@ -57,60 +48,63 @@
     default: Error("Invalid alignment: %u", pParty->alignment);
   }
 
-  v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-  v13 = pHouse_ExitPictures[exit_pic_id];
-  pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12];
-  pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE);
+  pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
+  pTexture_outside = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[exit_pic_id], TEXTURE_16BIT_PALETTE);
   if (anim_id)
   {
-    if ( !v23 )
-      //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u);
+    if ( !IndoorLocation::GetLocationIndex(pLocationName) )
       pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1);
   }
-  else if ( !v23 )
+  else if ( !IndoorLocation::GetLocationIndex(pLocationName) )
   {
-      v14 = pMapStats->GetMapInfo(pCurrentMapName);
-      if ( v14 )
-      {
-        sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s"
-        goto LABEL_20;
-      }
-      v21 = pGlobalTXT_LocalizationStrings[79];
-      goto LABEL_19;
+    if ( pMapStats->GetMapInfo(pCurrentMapName) )
+    {
+      sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s"
+      pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data());
+      //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
+        //PlayHouseSound(anim_id, HouseSound_Greeting);
+      if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
+        pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
+      if ( IndoorLocation::GetLocationIndex(pLocationName) )
+        uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+      return;
+    }
+    strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);
+    pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data());
+    //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
+      //PlayHouseSound(anim_id, HouseSound_Greeting);
+    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
+      pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
+    if ( IndoorLocation::GetLocationIndex(pLocationName) )
+      uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+    return;
   }
   v15 = pLocationName;
   if ( *pLocationName == 48 )
     v15 = pCurrentMapName;
-  v16 = pMapStats->GetMapInfo(v15);
-  if ( v16 )
+  if ( pMapStats->GetMapInfo(v15) )
   {
-    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName);
-    goto LABEL_20;
+    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s]
+    pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data());
+    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
+      pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
+    if ( IndoorLocation::GetLocationIndex(pLocationName) )
+      uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+    return;
   }
-  v21 = pGlobalTXT_LocalizationStrings[73];
-LABEL_19:
-  strcpy(sHouseName.data(), v21);
-LABEL_20:
+  strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data());
-  //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
-  if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
-    PlayHouseSound(anim_id, HouseSound_Greeting);
+  //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
+    //PlayHouseSound(anim_id, HouseSound_Greeting);
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
     pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
-  if ( v23 )
-    uCurrentHouse_Animation = v23;
+  if ( IndoorLocation::GetLocationIndex(pLocationName) )
+    uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
 }
 
-
-
-
 //----- (00444C8F) --------------------------------------------------------
 void TravelUI_Load()
 {
-  //signed int v0; // eax@1
-  unsigned int v1; // eax@6
-  GUIWindow *result; // eax@9
-  //const char *v3; // [sp-4h] [bp-2Ch]@2
   char pContainer[32]; // [sp+0h] [bp-28h]@1
 
   pEventTimer->Pause();
@@ -125,88 +119,57 @@
 
   pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
   pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE);
-  v1 = pMapStats->GetMapInfo(pCurrentMapName);
-  if ( v1 )
-    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
+  if ( pMapStats->GetMapInfo(pCurrentMapName) )
+    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);// "Leave %s"
   else
     strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit"
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, sHouseName.data());
 }
 
-
-
 //----- (00444DCA) --------------------------------------------------------
 void TravelUI_Draw()
 {
-  unsigned int v0; // edi@1
-  MapInfo *v1; // edi@2
-  signed int v3; // eax@2
-  int v4; // eax@5
-  const char *v5; // [sp-Ch] [bp-90h]@3
-  signed int v6; // [sp-8h] [bp-8Ch]@3
-  GUIWindow v7; // [sp+Ch] [bp-78h]@1
+  GUIWindow travel_window; // [sp+Ch] [bp-78h]@1
   char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1
-  unsigned int v9; // [sp+80h] [bp-4h]@1
 
-  memcpy(&v7, pPrimaryWindow, sizeof(v7));
-  v9 = pMapStats->GetMapInfo(pCurrentMapName);
+  memcpy(&travel_window, pPrimaryWindow, sizeof(travel_window));
   pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20);
-  v0 = pMapStats->GetMapInfo(pDestinationMapName);
-  pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
-  pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
+  pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background);
+  pRenderer->DrawTextureTransparent(468, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside);
-  pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u));
-  pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
-  if ( v0 )
+  pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
+  pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
+  if ( pMapStats->GetMapInfo(pDestinationMapName) )
   {
-    v1 = &pMapStats->pInfos[v0];
-    v7.uFrameX = 493;
-    v7.uFrameWidth = 126;
-    v7.uFrameZ = 366;
-    v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3);
-    v7.uFrameX = 483;
-    v7.uFrameWidth = 148;
-    v7.uFrameZ = 334;
-    v3 = GetTravelTime();
-    if ( v3 == 1 )
-    {
-      v6 = 1;
-      v5 = pGlobalTXT_LocalizationStrings[663]; // "It will take %d day to cross to %s."
-    }
+    travel_window.uFrameX = 493;
+    travel_window.uFrameWidth = 126;
+    travel_window.uFrameZ = 366;
+    travel_window.DrawTitleText(pFontCreate, 0, 4, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName, 3);
+    travel_window.uFrameX = 483;
+    travel_window.uFrameWidth = 148;
+    travel_window.uFrameZ = 334;
+    if ( GetTravelTime() == 1 )
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[663], 1, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d day to cross to %s."
     else
-    {
-      v6 = v3;
-      v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s."
-    }
-    sprintfex(pTmpBuf.data(), v5, v6, v1->pName);
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[128], GetTravelTime(), pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d days to travel to %s."
+
     strcat(pTmpBuf.data(), "\n \n");
-    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
-    v4 = pFontCreate->CalcTextHeight(pTmpBuf.data(), &v7, 0, 0);
-    v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf.data(), 3);
+    travel_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3);
     _unused_5B5924_is_travel_ui_drawn = 1;
   }
 }
 
-
-
 //----- (00444A51) --------------------------------------------------------
 void TransitionUI_Draw()
 {
-  MapInfo *pMapInfo; // esi@5
-  char *v1; // eax@6
-  std::string v3; // [sp-18h] [bp-84h]@11
   unsigned int v4; // [sp-10h] [bp-7Ch]@12
-  int v5; // [sp-Ch] [bp-78h]@12
-  const char *v6; // [sp-8h] [bp-74h]@11
-  signed int v7; // [sp-4h] [bp-70h]@11
-  GUIWindow v8; // [sp+Ch] [bp-60h]@1
+  GUIWindow transition_window; // [sp+Ch] [bp-60h]@1
   unsigned int v9; // [sp+60h] [bp-Ch]@1
-  unsigned int v10; // [sp+64h] [bp-8h]@1
-  int a3; // [sp+6Bh] [bp-1h]@11
+  unsigned int map_id; // [sp+64h] [bp-8h]@1
 
-  memcpy(&v8, pPrimaryWindow, sizeof(v8));
-  v10 = pMapStats->GetMapInfo(pCurrentMapName);
+  memcpy(&transition_window, pPrimaryWindow, sizeof(transition_window));
   v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C));
@@ -215,29 +178,27 @@
   pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel));
   pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
   pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
+  map_id = pMapStats->GetMapInfo(pCurrentMapName);
   if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' )
-    v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name);
-  pMapInfo = &pMapStats->pInfos[v10];
-  v8.uFrameX = 493;
-  v8.uFrameWidth = 126;
-  v8.uFrameZ = 366;
-  v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3);
-  v8.uFrameX = 483;
-  v8.uFrameWidth = 148;
-  v8.uFrameZ = 334;
+    map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name);
+  transition_window.uFrameX = 493;
+  transition_window.uFrameWidth = 126;
+  transition_window.uFrameZ = 366;
+  transition_window.DrawTitleText(pFontCreate, 0, 5, 0, pMapStats->pInfos[map_id].pName, 3);
+  transition_window.uFrameX = 483;
+  transition_window.uFrameWidth = 148;
+  transition_window.uFrameZ = 334;
 
-  v1 = "";
   if ( uCurrentHouse_Animation )
   {
-    v1 = pTransitionStrings[uCurrentHouse_Animation];
-    v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101;
-    v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3);
+    v4 = (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uCurrentHouse_Animation], &transition_window, 0, 0)) / 2 + 101;
+    transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTransitionStrings[uCurrentHouse_Animation], 3);
   }
-  else if ( v10 )
+  else if ( map_id )
   {
-    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?"
-    v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &v8, 0, 0)) / 2 + 101;
-    v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapStats->pInfos[map_id].pName);// "Do you wish to leave %s?"
+    v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &transition_window, 0, 0)) / 2 + 101;
+    transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3);
   }
   else Error("Troubles in da house");
 
--- a/UI/UiGame.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/UI/UiGame.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -824,7 +824,7 @@
     {
       v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134;
       window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0);
-      sub_41D20D_buff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic);
+      DrawBuff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic);
     }
   }
 
--- a/mm7_1.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/mm7_1.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -74,72 +74,57 @@
 }
 
 //----- (0041D20D) --------------------------------------------------------
-void __fastcall sub_41D20D_buff_remaining_time_string( int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2 )
-    {
-  unsigned int v4; // edi@1
-  unsigned int v5; // esi@1
-  unsigned int v6; // ebp@1
-  unsigned int v7; // ebx@1
-  signed __int64 v8; // ST34_8@1
-  signed __int64 v9; // kr00_8@1
-  char *v10; // eax@2
-  char *v11; // eax@7
-  char *v12; // eax@13
-  char *v13; // eax@19
-  int uY; // [sp+0h] [bp-20h]@1
-  GUIWindow *a1; // [sp+4h] [bp-1Ch]@1
-  signed __int64 v17; // [sp+10h] [bp-10h]@1
-  signed __int64 v18; // [sp+18h] [bp-8h]@1
-  unsigned int v19; // [sp+24h] [bp+4h]@1
+void DrawBuff_remaining_time_string( int uY, struct GUIWindow *window, __int64 remaining_time, struct GUIFont *Font )
+{
+  unsigned int full_time; // esi@1
+  signed __int64 hours; // kr00_8@1
+  char *text; // eax@2
+  signed __int64 minutes; // [sp+10h] [bp-10h]@1
+  signed __int64 seconds; // [sp+18h] [bp-8h]@1
+  unsigned int day; // [sp+24h] [bp+4h]@1
 
-  a1 = edx0;
-  uY = ecx0;
-  v4 = (unsigned __int64)(signed __int64)((double)a3 * 0.234375) >> 32;
-  v5 = (signed __int64)((double)a3 * 0.234375);
-  v6 = (unsigned __int64)((signed __int64)((double)a3 * 0.234375) / 60) >> 32;
-  v7 = (signed __int64)((double)a3 * 0.234375) / 60;
-  v8 = (signed __int64)((double)a3 * 0.234375) / 60 / 60;
-  v19 = (unsigned int)v8 / 0x18;
-  v18 = (signed __int64)__PAIR__(v4, v5) % 60;
-  v17 = (signed __int64)__PAIR__(v6, v7) % 60;
-  v9 = v8 % 24;
+  full_time = (signed __int64)((double)remaining_time * 0.234375);
+  day = (unsigned int)((full_time / 60) / 60) / 24;
+  hours = ((full_time / 60) / 60) % 24;
+  minutes = (signed __int64)(full_time / 60) % 60;
+  seconds = (signed __int64)full_time % 60;
   strcpy(pTmpBuf.data(), "\r020");
-  if ( (unsigned int)v8 / 0x18 )
+  if ( day )
   {
-    v10 = pGlobalTXT_LocalizationStrings[57];   // Days
-    if ( v19 <= 1 )
-      v10 = pGlobalTXT_LocalizationStrings[56]; // Day
-    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v19, v10);
+    text = pGlobalTXT_LocalizationStrings[57];   // Days
+    if ( day <= 1 )
+      text = pGlobalTXT_LocalizationStrings[56]; // Day
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)day, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  if ( v9 )
+  if ( hours )
   {
-    if ( v9 <= 1 )
-      v11 = pGlobalTXT_LocalizationStrings[109];// Hour
+    if ( hours <= 1 )
+      text = pGlobalTXT_LocalizationStrings[109];// Hour
     else
-      v11 = pGlobalTXT_LocalizationStrings[110];// Hours
-    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v9, v11);
+      text = pGlobalTXT_LocalizationStrings[110];// Hours
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  if ( v17 && !v19 )
+  if ( minutes && !day )
   {
-    if ( v17 <= 1 )
-      v12 = pGlobalTXT_LocalizationStrings[437];// Minute
+    if ( minutes <= 1 )
+      text = pGlobalTXT_LocalizationStrings[437];// Minute
     else
-      v12 = pGlobalTXT_LocalizationStrings[436];// Minutes
-    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v17, v12);
+      text = pGlobalTXT_LocalizationStrings[436];// Minutes
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  if ( v18 && !v9 )
+  if ( seconds && !hours )
   {
-    if ( v18 <= 1 )
-      v13 = pGlobalTXT_LocalizationStrings[439];// Second
+    if ( seconds <= 1 )
+      text = pGlobalTXT_LocalizationStrings[439];// Second
     else
-      v13 = pGlobalTXT_LocalizationStrings[438];// Seconds
-    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v18, v13);
+      text = pGlobalTXT_LocalizationStrings[438];// Seconds
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text);
     strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  a1->DrawText(a2, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
+  window->DrawText(Font, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
 }
 
 //----- (004226C2) --------------------------------------------------------
@@ -161,199 +146,188 @@
 //----- (004226EF) --------------------------------------------------------
 void SetUserInterface(PartyAlignment align, bool bReplace)
 {
-  unsigned int v3; // eax@7
-  unsigned __int16 v4; // dx@7
-  unsigned __int16 v5; // cx@7
-  unsigned __int16 v6; // [sp-4h] [bp-14h]@7
-
-
   extern void set_default_ui_skin();
   set_default_ui_skin();
 
-    if (align == PartyAlignment_Evil)
+  if (align == PartyAlignment_Evil)
+  {
+    if ( bReplace )
     {
-      if ( bReplace )
-      {
-        pTexture_RightFrame->Reload("ib-r-C.pcx");
-        pTexture_BottomFrame->Reload("ib-b-C.pcx");
-        pTexture_TopFrame->Reload("ib-t-C.pcx");
-        pTexture_LeftFrame->Reload("ib-l-C.pcx");
-        pTexture_StatusBar->Reload("IB-Foot-c.pcx");
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2);
+      pTexture_RightFrame->Reload("ib-r-C.pcx");
+      pTexture_BottomFrame->Reload("ib-b-C.pcx");
+      pTexture_TopFrame->Reload("ib-t-C.pcx");
+      pTexture_LeftFrame->Reload("ib-l-C.pcx");
+      pTexture_StatusBar->Reload("IB-Foot-c.pcx");
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2);
 
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2);
 
-        pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
-        pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID);
-        pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
-        pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID);
+      pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
+      pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID);
+      pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
+      pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID);
 
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2);
-        pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2);
-      }
-      else
-      {
-        pTexture_RightFrame->Load("ib-r-C.pcx", 0);
-        pTexture_BottomFrame->Load("ib-b-c.pcx", 0);
-        pTexture_TopFrame->Load("ib-t-C.pcx", 0);
-        pTexture_LeftFrame->Load("ib-l-C.pcx", 0);
-        pTexture_StatusBar->Load("IB-Foot-c.pcx", 0);
-        uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE);
-        uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE);
-        dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE);
-        dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE);
-        dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE);
-        uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE);
-        uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
-        pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
-        pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
-        pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
-        pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
-      }
-      v3 = TargetColor(0xC8u, 0, 0);
-      v4 = 0;
-      v6 = 0;
-      v5 = 10;
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2);
+      pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2);
     }
-    else if (align == PartyAlignment_Neutral)
+    else
+    {
+      pTexture_RightFrame->Load("ib-r-C.pcx", 0);
+      pTexture_BottomFrame->Load("ib-b-c.pcx", 0);
+      pTexture_TopFrame->Load("ib-t-C.pcx", 0);
+      pTexture_LeftFrame->Load("ib-l-C.pcx", 0);
+      pTexture_StatusBar->Load("IB-Foot-c.pcx", 0);
+      uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE);
+      uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE);
+      dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE);
+      dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE);
+      dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE);
+      uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE);
+      uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE);
+      uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
+      pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
+      pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
+      pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
+      pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
+    }
+    uGameUIFontMain = TargetColor(0xC8u, 0, 0);
+    uGameUIFontShadow = TargetColor(10, 0, 0);
+  }
+  else if (align == PartyAlignment_Neutral)
+  {
+    if ( bReplace )
     {
-      if ( bReplace )
-      {
-        pTexture_RightFrame->Reload("ib-r-a.pcx");
-        pTexture_BottomFrame->Reload("ib-b-a.pcx");
-        pTexture_TopFrame->Reload("ib-t-a.pcx");
-        pTexture_LeftFrame->Reload("ib-l-a.pcx");
-        pTexture_StatusBar->Reload("IB-Foot-a.pcx");
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2);
-        pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
-        pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
-        pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
-        pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2);
-        pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2);
-      }
-      else
-      {
-        pTexture_RightFrame->Load("ib-r-A.pcx", 0);
-        pTexture_BottomFrame->Load("ib-b-A.pcx", 0);
-        pTexture_TopFrame->Load("ib-t-A.pcx", 0);
-        pTexture_LeftFrame->Load("ib-l-A.pcx", 0);
-        pTexture_StatusBar->Load("IB-Foot-a.pcx", 0);
-        uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE);
-        uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE);
-        dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE);
-        dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE);
-        dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE);
-        uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE);
-        uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE);
-        uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE);
-        uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
-        pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
-        pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
-        pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
-        pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
-        uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE);
-        uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE);
-        uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE);
-        uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE);
-        uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE);
-        uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE);
-        uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE);
-        uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE);
-        uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE);
-        pTexture_591428 = pIcons_LOD->LoadTexturePtr("endcap", TEXTURE_16BIT_PALETTE);
-
-      }
-      v3 = TargetColor(0xAu, 0, 0);
-      v4 = 214;
-      v5 = 230;
-      v6 = 193;
+      pTexture_RightFrame->Reload("ib-r-a.pcx");
+      pTexture_BottomFrame->Reload("ib-b-a.pcx");
+      pTexture_TopFrame->Reload("ib-t-a.pcx");
+      pTexture_LeftFrame->Reload("ib-l-a.pcx");
+      pTexture_StatusBar->Reload("IB-Foot-a.pcx");
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2);
+      pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
+      pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
+      pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
+      pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2);
+      pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2);
     }
+    else
+    {
+      pTexture_RightFrame->Load("ib-r-A.pcx", 0);
+      pTexture_BottomFrame->Load("ib-b-A.pcx", 0);
+      pTexture_TopFrame->Load("ib-t-A.pcx", 0);
+      pTexture_LeftFrame->Load("ib-l-A.pcx", 0);
+      pTexture_StatusBar->Load("IB-Foot-a.pcx", 0);
+      uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE);
+      uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE);
+      dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE);
+      dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE);
+      dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE);
+      uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE);
+      uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE);
+      uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE);
+      uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
+      pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
+      pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
+      pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
+      pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
+      uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE);
+      uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE);
+      uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE);
+      uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE);
+      uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE);
+      uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE);
+      uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE);
+      uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE);
+      uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE);
+      pTexture_591428 = pIcons_LOD->LoadTexturePtr("endcap", TEXTURE_16BIT_PALETTE);
+    }
+    uGameUIFontMain = TargetColor(0xAu, 0, 0);
+    uGameUIFontShadow = TargetColor(230, 214, 193);
+  }
   else if (align == PartyAlignment_Good)
   {
     if ( bReplace )
@@ -400,19 +374,12 @@
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2);
       pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2);
     }
-    v3 = TargetColor(0, 0, 0xC8u);
-    v5 = 255;
-    v4 = 225;
-    v6 = 255;
+    uGameUIFontMain = TargetColor(0, 0, 0xC8u);
+    uGameUIFontShadow = TargetColor(255, 255, 255);
   }
   else Error("Invalid alignment type: %u", align);
-
-  uGameUIFontMain = v3;
-  uGameUIFontShadow = TargetColor(v5, v4, v6);
 }
 
-
-
 //----- (00424CD7) --------------------------------------------------------
 int sr_424CD7(unsigned int num_vertices)
 {
--- a/mm7_4.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/mm7_4.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -2715,27 +2715,22 @@
 
 
 //----- (004B1447) --------------------------------------------------------
-Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)
+void sub_4B1447_party_fine(int a1, int a2, int a3)
 {
   signed int v3; // esi@1
   char v4; // sf@8
   int v5; // eax@8
   unsigned __int64 v6; // qax@12
   DDM_DLV_Header *v7; // eax@14
-  Player **v8; // edi@18
-  Player *result; // eax@19
-  //char *v10; // esi@20
 
   v3 = 0;
   if ( a2 )
   {
-    if ( a2 != 1 )
-    {
-      if ( a2 == 2 )
-        v3 = 2;
+    if ( a2 == 1 )
+      v3 = 2;
+    if ( a2 == 2 )
+      v3 = 2;
       goto LABEL_13;
-    }
-    v3 = 2;
   }
   else
   {
@@ -2768,22 +2763,14 @@
     if ( v7->uReputation > 10000 )
       v7->uReputation = 10000;
   }
-  v8 = &pPlayers[1];
-  do
+  for ( uint i = 1; i <= 4; ++i )
   {
-    result = *v8;
     if ( pParty->uFine )
     {
-      //v10 = result->_guilds_member_bits;
-      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_achieved_awards_bits, 1);
-      if ( !(short)result )
-		  __debugbreak();
-        //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
+      if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) )
+        _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1);
     }
-    ++v8;
   }
-  while ( (signed int)v8 <= (signed int)&pPlayers[4] );
-  return result;
 }
 
 //----- (004B1523) --------------------------------------------------------
--- a/mm7_5.cpp	Tue Oct 01 06:17:32 2013 +0200
+++ b/mm7_5.cpp	Tue Oct 01 06:19:58 2013 +0200
@@ -2336,7 +2336,7 @@
                 }
               }
             }
-            pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+            pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
             v73 = "Can't jump to that location!";
           }
           ShowStatusBarString(v73, 6u);
@@ -3380,11 +3380,9 @@
           pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0);
           break;
         case UIMSG_PlayerCreationSelectActiveSkill:
-          pPlayer = &pPlayer[uPlayerCreationUI_SelectedCharacter];
-          v6 = pPlayer->GetSkillIdxByOrder(pParam + 4);
-          if ( pPlayer->GetSkillIdxByOrder(3) == 37 )
-            pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1;
-          pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
+          if ( pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37 )
+            pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pParam + 4)] = 1;
+          pAudioPlayer->PlaySound(SOUND_24, 0, 0, -1, 0, 0, 0, 0);
           break;
         case UIMSG_PlayerCreationSelectClass:
           pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam);
@@ -3402,14 +3400,14 @@
           pParty->Reset();
           break;
         case UIMSG_PlayerCreationRemoveUpSkill:
-          uPlayerCreationUI_SelectedCharacter = pParam;
           v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
-          //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem;
-          v41 = 2;
-          v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
-          pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5;
-          pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41)
-                                         + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
+          pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
+          pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0;
+          break;
+        case UIMSG_PlayerCreationRemoveDownSkill:
+          v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
+          pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
+          pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0;
           break;
         case UIMSG_PlayerCreationChangeName:
           pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
@@ -3567,14 +3565,6 @@
             //VideoPlayer::dtor();
           }
           break;
-        case UIMSG_PlayerCreationRemoveDownSkill:
-          uPlayerCreationUI_SelectedCharacter = pParam;
-          //__debugbreak();
-          pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7
-             + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
-          pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3)
-                                             + 3486 * uPlayerCreationUI_SelectedCharacter] = 0;
-          break;
         default:
           break;
       }
--- a/mm7_data.h	Tue Oct 01 06:17:32 2013 +0200
+++ b/mm7_data.h	Tue Oct 01 06:19:58 2013 +0200
@@ -1080,7 +1080,7 @@
 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels);
 struct GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey); // idb
 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall);
-void  __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2);
+void DrawBuff_remaining_time_string(int uY, struct GUIWindow *window, __int64 remaining_time, struct GUIFont *Font);
 bool UI_OnKeyDown(unsigned int vkKey);
 void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb
 void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *window);
@@ -1272,7 +1272,7 @@
 struct _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void);
 void PlayLevelMusic();
 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb
-struct Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3);
+void sub_4B1447_party_fine(int a1, int a2, int a3);
 void sub_4B1523(int *_this);
 void ShowPopupShopItem();
 void RestAndHeal(__int64 uNumMinutes); // idb