changeset 1006:e865f349aa41

ui cleanup
author Gloval
date Sat, 18 May 2013 22:01:26 +0400
parents eac5af72b614
children 7e4045b6f191
files Chest.cpp Events.cpp GUIButton.cpp GUIWindow.cpp GUIWindow.h Indoor.cpp Indoor.h Items.cpp LOD.cpp LOD.h Mouse.cpp Player.cpp Player.h UIBooks.cpp UICharacter.cpp UIOptions.cpp UIPopup.cpp UIRest.cpp mm7_1.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 24 files changed, 298 insertions(+), 297 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Chest.cpp	Sat May 18 22:01:26 2013 +0400
@@ -347,7 +347,7 @@
     if ( !areWeLoadingTexture )
         {
         item_texture->Release();
-        pIcons_LOD->_40F9C5();
+        pIcons_LOD->SyncLoadedFilesCount();
         }
     if ( (texture_cell_width + test_cell_position % chest_cell_width <= chest_cell_width) && 
         (texture_cell_height + test_cell_position / chest_cell_width <= chest_cell_heght) )
@@ -475,7 +475,7 @@
     if ( !areWeLoadingTexture )
     {
       ((Texture *)v9)->Release();
-      pIcons_LOD->_40F9C5();
+      pIcons_LOD->SyncLoadedFilesCount();
     }
     if ( v13 > 0 )
     {
@@ -550,7 +550,7 @@
     if ( !areWeLoadingTexture )
         {
         v8->Release();
-        pIcons_LOD->_40F9C5();
+        pIcons_LOD->SyncLoadedFilesCount();
         }
     chest_cell_width = pChestWidthsByType[pChests[ uChestID].uChestBitmapID];
     chest_cell_row_pos = 0;
@@ -787,7 +787,7 @@
     if ( !areWeLoadingTexture )
     {
         v5->Release();
-        pIcons_LOD->_40F9C5();
+        pIcons_LOD->SyncLoadedFilesCount();
         v10 = v21;
     }
     if ( v10 > 0 )
--- a/Events.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Events.cpp	Sat May 18 22:01:26 2013 +0400
@@ -1337,7 +1337,7 @@
 							pDialogueWindow->Release();
 							dialog_menu_id = HOUSE_DIALOGUE_NULL;
 							pDialogueWindow = 0;
-							pIcons_LOD->_40F9C5();
+							pIcons_LOD->SyncLoadedFilesCount();
 							}
 						OnMapLeave();
 						return;
--- a/GUIButton.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/GUIButton.cpp	Sat May 18 22:01:26 2013 +0400
@@ -157,23 +157,23 @@
 
 
 //----- (00415180) --------------------------------------------------------
-char GUIButton::DrawLabel(const char *edx0, GUIFont *pFont, int a5, int *a9)
-{
+void GUIButton::DrawLabel( const char *label_text, struct GUIFont *pFont, int a5, int uFontShadowColor )
+    {
   const char *v5; // ebx@1
   GUIButton *v6; // esi@1
   int v7; // eax@1
 
-  v5 = edx0;
+  v5 = label_text;
   v6 = this;
   //strlen(edx0);
-  v7 = pFont->GetLineWidth(edx0);
+  v7 = pFont->GetLineWidth(label_text);
   return pParent->DrawText(
            pFont,
            v6->uX + (signed int)(v6->uWidth - v7) / 2,
-           v6->uY + (signed int)(v6->uHeight - LOBYTE(pFont->uFontHeight)) / 2,
+           v6->uY + (signed int)(v6->uHeight - pFont->uFontHeight) / 2,
            a5,
-           v5,
+           label_text,
            0,
            0,
-           (unsigned int)a9);
+           uFontShadowColor);
 }
--- a/GUIWindow.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/GUIWindow.cpp	Sat May 18 22:01:26 2013 +0400
@@ -176,8 +176,8 @@
 // 5075E0: using guessed type int pVisibleWindowsIdxs[20];
 
 //----- (0041D73D) --------------------------------------------------------
-char GUIWindow::_41D73D_draw_buff_tooltip()
-{
+void GUIWindow::_41D73D_draw_buff_tooltip()
+    {
   GUIFont *v1; // esi@1
   GUIWindow *v2; // edi@1
   SpellBuff *v3; // eax@1
@@ -242,7 +242,7 @@
               (unsigned __int8)*v8,
               (unsigned __int8)v8[1]);
       v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0);
-      LOBYTE(v9) = sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2);
+      sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2);
       v1 = a2;
     }
     ++v18;
@@ -250,7 +250,7 @@
     v8 += 3;
   }
   while ( (signed int)v18 < (signed int)pParty->pPlayers );
-  return v9;
+  
 }
 
 
@@ -297,7 +297,7 @@
   {
 	case WINDOW_GreetingNPC:
 		{
-		pIcons_LOD->_40F9C5();
+		pIcons_LOD->SyncLoadedFilesCount();
 		pCurrentScreen = pMainScreenNum;
 		pKeyActionMap->_459ED1(3);
 		break;
@@ -309,7 +309,7 @@
 		uNumDialogueNPCPortraits = 0;
 		pTexture_Dialogue_Background->Release();
 
-		pIcons_LOD->_40F9C5();
+		pIcons_LOD->SyncLoadedFilesCount();
 		pIcons_LOD->_4114F2();
 		dword_5C35D4 = 0;
 		if ( bFlipOnExit )
@@ -326,7 +326,7 @@
 		pVideoPlayer->Unload();
 		pTexture_outside->Release();
 		pTexture_Dialogue_Background->Release();
-		pIcons_LOD->_40F9C5();
+		pIcons_LOD->SyncLoadedFilesCount();
 		pCurrentScreen = pMainScreenNum;
 		break;
 		}
@@ -345,7 +345,7 @@
 		{
         pTexture_outside->Release();
         pTexture_Dialogue_Background->Release();
-        pIcons_LOD->_40F9C5();
+        pIcons_LOD->SyncLoadedFilesCount();
         pCurrentScreen = pMainScreenNum;
         break;
 		}
@@ -356,7 +356,7 @@
         uNumDialogueNPCPortraits = 0;
         pTexture_Dialogue_Background->Release();
 
-        pIcons_LOD->_40F9C5();
+        pIcons_LOD->SyncLoadedFilesCount();
         pCurrentScreen = pMainScreenNum;
 		}
 	default:
@@ -1240,8 +1240,8 @@
 
 
 //----- (0044CE08) --------------------------------------------------------
-char GUIWindow::DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor)
-{
+void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor )
+    {
   GUIWindow *v9; // edi@1
   GUIFont *v10; // ebx@1
   int v11; // eax@2
@@ -1275,7 +1275,7 @@
   if ( !Str )
   {
     MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0);
-    return v11;
+    return;
   }
   v11 = strcmp(Str, "null");
   if ( v11 )
@@ -1350,7 +1350,7 @@
 LABEL_36:
                   v11 = v11 + v13 - 3;
                   if ( v11 > a8 )
-                    return v11;
+                    return;
                   break;
                 }
                 break;
@@ -1402,7 +1402,7 @@
       }
     }
   }
-  return v11;
+  return;
 }
 
 
--- a/GUIWindow.h	Thu May 16 15:14:58 2013 +0200
+++ b/GUIWindow.h	Sat May 18 22:01:26 2013 +0400
@@ -322,7 +322,7 @@
 	                      UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...);
   void DrawFlashingInputCursor(signed int a3, int a4, struct GUIFont *a2);
   int DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8);
-  char DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor);
+  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 HouseDialogManager();
@@ -332,7 +332,7 @@
   GUIButton *GetControl(unsigned int uID);
   void Release();
   void _41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5);
-  char _41D73D_draw_buff_tooltip();
+  void _41D73D_draw_buff_tooltip();
 
   static GUIWindow *Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eType, int a4, int a5);
 
@@ -498,9 +498,9 @@
 // character ui
 struct GUIWindow *CharacterUI_Initialize(unsigned int _this);
 const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType);
-char CharacterUI_SkillsTab_ShowHint();
+void CharacterUI_SkillsTab_ShowHint();
 void CharacterUI_StatsTab_ShowHint();
-char CharacterUI_StatsTab_Draw(Player *player);
+void CharacterUI_StatsTab_Draw(Player *player);
 void CharacterUI_SkillsTab_CreateButtons();
 void CharacterUI_SkillsTab_Draw(Player *player);
 void CharacterUI_AwardsTab_Draw(Player *player);
@@ -563,7 +563,7 @@
 #pragma pack(push, 1)
 struct GUIButton
 {
-  char DrawLabel(const char *edx0, struct GUIFont *pFont, int a5, int *a9);
+void DrawLabel(const char *label_text, struct GUIFont *pFont, int a5, int uFontShadowColor);
 
   void Release();
 
--- a/Indoor.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Indoor.cpp	Sat May 18 22:01:26 2013 +0400
@@ -69,6 +69,21 @@
 };
 
 
+const char *_4E6BDC_loc_names[11]=
+    {
+    "mdt12.blv",
+    "d18.blv",
+    "mdt14.blv",
+    "d37.blv",
+    "mdk01.blv",
+    "mdt01.blv",
+    "mdr01.blv",
+    "mdt10.blv",
+    "mdt09.blv",
+    "mdt15.blv",
+    "mdt11.blv"
+    };
+
 
 //----- (0043F39E) --------------------------------------------------------
 void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this)
@@ -145,7 +160,6 @@
 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2)
 {
   IndoorLocation_drawstru *v2; // ebx@1
-  BLVRenderParams *v3; // esi@1
   int v4; // ST08_4@1
   int v5; // ST04_4@1
   int v6; // ST00_4@1
@@ -174,7 +188,6 @@
   int v29; // [sp+24h] [bp+8h]@5
 
   v2 = a2;
-  v3 = this;
   this->field_0_timer_ = a2->field_0_timer;
   this->uFlags = a2->uFlags;
   this->vPartyPos.x = a2->vPosition.x;
@@ -186,82 +199,82 @@
   v6 = this->vPartyPos.x;
   this->sPartyRotX = a2->sRotationX;
   v7 = pIndoor->GetSector(v6, v5, v4);
-  v3->uPartySectorID = v7;
+  this->uPartySectorID = v7;
   if ( !v7 )
   {
-    v8 = v3->vPartyPos.z;
-    v3->vPartyPos.x = pParty->vPosition.x;
+    v8 = this->vPartyPos.z;
+    this->vPartyPos.x = pParty->vPosition.x;
     v9 = pParty->vPosition.y;
-    v10 = v3->vPartyPos.x;
-    v3->vPartyPos.y = pParty->vPosition.y;
-    v3->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
+    v10 = this->vPartyPos.x;
+    this->vPartyPos.y = pParty->vPosition.y;
+    this->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
   }
   if ( pRenderer->pRenderD3D )
   {
-    v3->sCosineY = stru_5C6E00->Cos(v3->sPartyRotY);
-    v3->sSineY = stru_5C6E00->Sin(v3->sPartyRotY);
-    v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX);
-    v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX);
-    v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125);
-    v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125);
-    v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125);
-    v3->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125);
-    v3->field_64 = a2->field_3C;
-    v11 = v3->uViewportW;
-    v12 = v3->uViewportX;
-    v13 = v3->uViewportZ - v12;
-    v14 = v3->uViewportZ + v12;
-    v3->field_70 = v13 + 1;
-    v15 = v3->uViewportY;
-    v3->uViewportHeight = v11 - v15 + 1;
-    v16 = v3->uViewportW;
-    v3->uViewportCenterX = v14 >> 1;
-    v3->uViewportCenterY = (signed int)(v16 + v15) >> 1;
+    this->sCosineY = stru_5C6E00->Cos(this->sPartyRotY);
+    this->sSineY = stru_5C6E00->Sin(this->sPartyRotY);
+    this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
+    this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
+    this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125);
+    this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125);
+    this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125);
+    this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125);
+    this->field_64 = a2->field_3C;
+    v11 = this->uViewportW;
+    v12 = this->uViewportX;
+    v13 = this->uViewportZ - v12;
+    v14 = this->uViewportZ + v12;
+    this->field_70 = v13 + 1;
+    v15 = this->uViewportY;
+    this->uViewportHeight = v11 - v15 + 1;
+    v16 = this->uViewportW;
+    this->uViewportCenterX = v14 >> 1;
+    this->uViewportCenterY = (signed int)(v16 + v15) >> 1;
   }
   else
   {
-    v3->sCosineY = stru_5C6E00->Cos(-v3->sPartyRotY);
-    v3->sSineY = stru_5C6E00->Sin(-v3->sPartyRotY);
-    v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX);
-    v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX);
-    v17 = cos((double)-v3->sPartyRotY * 0.0030664064);
-    v18 = v3->sPartyRotY;
-    v3->fCosineY = v17;
+    this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY);
+    this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY);
+    this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
+    this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
+    v17 = cos((double)-this->sPartyRotY * 0.0030664064);
+    v18 = this->sPartyRotY;
+    this->fCosineY = v17;
     v19 = sin((double)-v18 * 0.0030664064);
-    v20 = v3->sPartyRotX;
-    v3->fSineY = v19;
+    v20 = this->sPartyRotX;
+    this->fSineY = v19;
     v21 = cos((double)-v20 * 0.0030664064);
-    v22 = v3->sPartyRotX;
-    v3->fCosineNegX = v21;
-    v3->fSineNegX = sin((double)-v22 * 0.0030664064);
-    v23 = v3->uViewportX;
-    v3->field_64 = a2->field_3C;
-    v24 = v3->uViewportZ;
-    v3->field_70 = v3->uViewportZ - v23 + 1;
-    v25 = v3->uViewportW - v3->uViewportY + 1;
-    v3->uViewportHeight = v25;
+    v22 = this->sPartyRotX;
+    this->fCosineNegX = v21;
+    this->fSineNegX = sin((double)-v22 * 0.0030664064);
+    v23 = this->uViewportX;
+    this->field_64 = a2->field_3C;
+    v24 = this->uViewportZ;
+    this->field_70 = this->uViewportZ - v23 + 1;
+    v25 = this->uViewportW - this->uViewportY + 1;
+    this->uViewportHeight = v25;
     v29 = v25;
-    v26 = v3->field_64;
-    v3->uViewportCenterX = (signed int)(v24 + v23) >> 1;
-    v3->uViewportCenterY = v3->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
+    v26 = this->field_64;
+    this->uViewportCenterX = (signed int)(v24 + v23) >> 1;
+    this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
   }
-  v27 = (unsigned int)(signed __int64)((double)v3->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
+  v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329)
                                      + 0.5) << 16;
-  v3->field_40 = v27;
-  LODWORD(v3->field_44) = 4294967296i64 / v27;
-  v3->pRenderTarget = v2->pRenderTarget;
-  v3->uTargetWidth = v2->uTargetWidth;
-  v3->uTargetHeight = v2->uTargetHeight;
-  v3->uViewportX = v2->uViewportX;
-  v3->uViewportY = v2->uViewportY;
-  v3->uViewportZ = v2->uViewportZ;
-  v3->uViewportW = v2->uViewportW;
-  v3->pTargetZBuffer = v2->pTargetZ;
+  this->field_40 = v27;
+  this->field_44 = 0x100000000i64 / v27;
+  this->pRenderTarget = v2->pRenderTarget;
+  this->uTargetWidth = v2->uTargetWidth;
+  this->uTargetHeight = v2->uTargetHeight;
+  this->uViewportX = v2->uViewportX;
+  this->uViewportY = v2->uViewportY;
+  this->uViewportZ = v2->uViewportZ;
+  this->uViewportW = v2->uViewportW;
+  this->pTargetZBuffer = v2->pTargetZ;
   result = 0;
-  v3->field_8C = 0;
-  v3->field_84 = 0;
-  v3->uNumFacesRenderedThisFrame = 0;
-  v3->field_88 = 0;
+  this->field_8C = 0;
+  this->field_84 = 0;
+  this->uNumFacesRenderedThisFrame = 0;
+  this->field_88 = 0;
   pBLVRenderParams->field_90 = 64;
   pBLVRenderParams->field_94 = 6;
   return result;
@@ -510,7 +523,8 @@
                      static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
       {
         a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
-        v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
+        v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel))
+            | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
         sub_4B0E07(uFaceID);
         pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
         pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
@@ -1638,8 +1652,8 @@
   v1->ptr_0002B0_sector_rdata = 0;
   pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata);
   v1->ptr_0002B8_sector_lrdata = 0;
-  pAllocator->FreeChunk(v1->ptr_2AC);
-  v1->ptr_2AC = 0;
+  pAllocator->FreeChunk(v1->pLFaces);
+  v1->pLFaces = 0;
   pAllocator->FreeChunk(v1->pSpawnPoints);
   v3 = v1->pVertices;
   v1->pSpawnPoints = 0;
@@ -2435,30 +2449,30 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace));
-  ptr_2AC = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData");
-
-  memcpy(ptr_2AC, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size);
+  pLFaces = (unsigned __int16 *)pAllocator->AllocNamedChunk(pLFaces, blv.uFaces_fdata_Size, "L.FData");
+
+  memcpy(pLFaces, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size);
 
   for (uint i = 0, j = 0; i < uNumFaces; ++i)
   {
     auto pFace = pFaces + i;
 
-    pFace->pVertexIDs = ptr_2AC + j;
+    pFace->pVertexIDs = pLFaces + j;
     
     j += pFace->uNumVertices + 1;
-    pFace->pXInterceptDisplacements = (short *)(ptr_2AC + j);
+    pFace->pXInterceptDisplacements = (short *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pYInterceptDisplacements = (short *)(ptr_2AC + j);
+    pFace->pYInterceptDisplacements = (short *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pZInterceptDisplacements = (short *)(ptr_2AC + j);
+    pFace->pZInterceptDisplacements = (short *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pVertexUIDs = (__int16 *)(ptr_2AC + j);
+    pFace->pVertexUIDs = (__int16 *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
-    pFace->pVertexVIDs = (__int16 *)(ptr_2AC + j);
+    pFace->pVertexVIDs = (__int16 *)(pLFaces + j);
 
     j += pFace->uNumVertices + 1;
       /*v93 = &pFaces[v92];
--- a/Indoor.h	Thu May 16 15:14:58 2013 +0200
+++ b/Indoor.h	Sat May 18 22:01:26 2013 +0400
@@ -417,7 +417,7 @@
     ptr_0002B8_sector_lrdata = 0;
     ptr_0002B4_doors_ddata = 0;
     ptr_0002B0_sector_rdata = 0;
-    ptr_2AC = 0;
+    pLFaces = 0;
     pVertices = 0;
     pFaces = 0;
     pFaceExtras = 0;
@@ -462,7 +462,7 @@
   unsigned int uNumNodes;
   struct BSPNode *pNodes;
   BLVMapOutlines *pMapOutlines;
-  unsigned __int16 *ptr_2AC;
+  unsigned __int16 *pLFaces;
   unsigned __int16 *ptr_0002B0_sector_rdata;
   unsigned __int16 *ptr_0002B4_doors_ddata;
   unsigned __int16 *ptr_0002B8_sector_lrdata;
@@ -546,7 +546,7 @@
   float fCosineNegX;
   float fSineNegX;
   int field_40;
-  float field_44;
+  int field_44;//float
   unsigned __int16 *pRenderTarget;
   unsigned int uTargetWidth;
   unsigned int uTargetHeight;
--- a/Items.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Items.cpp	Sat May 18 22:01:26 2013 +0400
@@ -914,7 +914,7 @@
 				break;
 		}
 
-	//ChanceByTreasureLvl Summ - anti cheating?
+	//ChanceByTreasureLvl Summ - to calculate chance
 	memset(&uChanceByTreasureLvlSumm, 0, 24);
 	for(i=0;i<6;++i)
 		{
--- a/LOD.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/LOD.cpp	Sat May 18 22:01:26 2013 +0400
@@ -1236,20 +1236,20 @@
 }
 
 //----- (0040F9C5) --------------------------------------------------------
-int LODFile_IconsBitmaps::_40F9C5()
-{
-  signed int result; // eax@1
+void LODFile_IconsBitmaps::SyncLoadedFilesCount()
+    {
+  signed int loaded_files; // eax@1
   Texture *pTex; // edx@1
 
-  result = this->uNumLoadedFiles;
-  for ( pTex = &this->pTextures[result]; !pTex->pName[0]; --pTex )
-    --result;
-  if ( result < (signed int)this->uNumLoadedFiles )
+  loaded_files = this->uNumLoadedFiles;
+  for ( pTex = &this->pTextures[loaded_files]; !pTex->pName[0]; --pTex )
+    --loaded_files;
+  if ( loaded_files < (signed int)this->uNumLoadedFiles )
   {
-    ++result;
-    this->uNumLoadedFiles = result;
+    ++loaded_files;
+    this->uNumLoadedFiles = loaded_files;
   }
-  return result;
+ 
 }
 
 
--- a/LOD.h	Thu May 16 15:14:58 2013 +0200
+++ b/LOD.h	Sat May 18 22:01:26 2013 +0400
@@ -143,7 +143,7 @@
 {
   LODFile_IconsBitmaps();
   virtual ~LODFile_IconsBitmaps();
-  int _40F9C5();
+  void SyncLoadedFilesCount();
   unsigned int FindTextureByName(const char *pName);
   bool LoadBitmaps(const char *pFilename);
   bool LoadIconsOrEvents(const char *pLODFilename);
--- a/Mouse.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Mouse.cpp	Sat May 18 22:01:26 2013 +0400
@@ -95,7 +95,7 @@
     {
       if (uCursorTextureID != -1)
         pIcons_LOD->pTextures[uCursorTextureID].Release();
-      pIcons_LOD->_40F9C5();
+      pIcons_LOD->SyncLoadedFilesCount();
     }
     return;
   }
--- a/Player.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/Player.cpp	Sat May 18 22:01:26 2013 +0400
@@ -1376,7 +1376,7 @@
   if ( !areWeLoadingTexture )
   {
     v4->Release();
-    pIcons_LOD->_40F9C5();
+    pIcons_LOD->SyncLoadedFilesCount();
   }
   if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 )
   {
@@ -1471,7 +1471,7 @@
     if ( !areWeLoadingTexture )
     {
       v8->Release();
-      pIcons_LOD->_40F9C5();
+      pIcons_LOD->SyncLoadedFilesCount();
     }
     if ( (signed int)uItemIDa > 0 )
     {
@@ -1680,7 +1680,7 @@
     if ( !areWeLoadingTexture )
     {
       v7->Release();
-      pIcons_LOD->_40F9C5();
+      pIcons_LOD->SyncLoadedFilesCount();
     }
     v8 = uSlot;
     if ( (signed int)v11 > 0 )
@@ -1720,7 +1720,7 @@
   if ( !areWeLoadingTexture )
   {
     v6->Release();
-    pIcons_LOD->_40F9C5();
+    pIcons_LOD->SyncLoadedFilesCount();
   }
   if ( (signed int)a2a > 0 )
   {
@@ -1741,8 +1741,8 @@
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (00492A36) --------------------------------------------------------
-unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot)
-{
+void Player::RemoveItemAtInventoryIndex( unsigned int uSlot )
+    {
   int *pIndices; // edi@1
   ItemGen *v3; // ecx@1
   unsigned int v4; // esi@1
@@ -1764,7 +1764,7 @@
   if ( !areWeLoadingTexture )
   {
     v6->Release();
-    result = pIcons_LOD->_40F9C5();
+    pIcons_LOD->SyncLoadedFilesCount();
   }
   if ( (signed int)v8 > 0 )
   {
@@ -1781,7 +1781,7 @@
     }
     while ( v8 );
   }
-  return result;
+  
 }
 // 506128: using guessed type int areWeLoadingTexture;
 
@@ -2431,7 +2431,7 @@
         if ( !v21 )
         {
           v7->Release();
-          pIcons_LOD->_40F9C5();
+          pIcons_LOD->SyncLoadedFilesCount();
         }
         goto LABEL_15;
       }
@@ -2443,7 +2443,7 @@
     if ( !v21 )
     {
       v7->Release();
-      pIcons_LOD->_40F9C5();
+      pIcons_LOD->SyncLoadedFilesCount();
     }
     result = 1;
   }
--- a/Player.h	Thu May 16 15:14:58 2013 +0200
+++ b/Player.h	Sat May 18 22:01:26 2013 +0400
@@ -427,8 +427,8 @@
 #pragma pack(push, 1)
 struct Player
 {
-  enum Condition: unsigned __int32
-  {
+enum Condition: unsigned __int32
+    {
     Condition_Cursed = 0,
     Condition_Weak = 1,
     Condition_Sleep = 2,
@@ -448,7 +448,7 @@
     Condition_Eradicated = 16,
     Condition_Zombie = 17,
     Condition_Good = 18
-  };
+    };
 
   Player();
 
@@ -546,7 +546,7 @@
   int AddItem2(unsigned int uSlot, ItemGen *Src);
   int CreateItemInInventory2(unsigned int uSlot, ItemGen *Src);
   bool _49298B(ItemGen *a2, int a3, int a4);
-  unsigned int RemoveItemAtInventoryIndex(unsigned int uSlot);
+  void RemoveItemAtInventoryIndex(unsigned int uSlot);
   bool CanAct();
   bool CanSteal();
   bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID);
--- a/UIBooks.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/UIBooks.cpp	Sat May 18 22:01:26 2013 +0400
@@ -286,7 +286,7 @@
     --v0;
   }
   while ( v0 >= -11 );
-  pIcons_LOD->_40F9C5();
+  pIcons_LOD->SyncLoadedFilesCount();
   v1 = pGUIWindow_CurrentMenu->pControlsHead;
   if ( v1 )
   {
--- a/UICharacter.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/UICharacter.cpp	Sat May 18 22:01:26 2013 +0400
@@ -87,6 +87,8 @@
 unsigned int ui_book_journal_title_color;
 unsigned int ui_book_journal_text_color;
 unsigned int ui_book_journal_text_shadow;
+
+
 void set_default_ui_skin()
 {
   ui_mainmenu_copyright_color = TargetColor(255, 255, 255);
@@ -2048,8 +2050,8 @@
 
 
 //----- (00418511) --------------------------------------------------------
-char CharacterUI_StatsTab_Draw(Player *player)
-{
+    void CharacterUI_StatsTab_Draw( Player *player )
+        {
         //Player *pPlayer; // edi@1
         //unsigned int v4; // eax@2
         int v7; // ebp@4
@@ -2342,7 +2344,7 @@
             v111 = UI_GetHealthManaStringColor(v136, 200);
             sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
         }
-        return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 }
 
 //----- (00419100) --------------------------------------------------------
--- a/UIOptions.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/UIOptions.cpp	Sat May 18 22:01:26 2013 +0400
@@ -52,7 +52,7 @@
 
 
 //----- (004142D3) --------------------------------------------------------
-char __cdecl GameMenuUI_DrawKeyBindings()
+void GameMenuUI_DrawKeyBindings()
     {
     unsigned int v0; // ebp@1
     int v1; // ecx@2
@@ -284,7 +284,7 @@
         v62 = pKeyActionMap->GetVKeyDisplayName(pWindowList_at_506F50_minus1_indexing[0]);
         v59 = sub_414D24(27);
         }
-    return pGUIWindow_CurrentMenu->DrawText(pFontLucida, v22, 268, v59, v62, 0, 0, 0);
+     pGUIWindow_CurrentMenu->DrawText(pFontLucida, v22, 268, v59, v62, 0, 0, 0);
     }
 
 
--- a/UIPopup.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/UIPopup.cpp	Sat May 18 22:01:26 2013 +0400
@@ -336,7 +336,7 @@
         if ( !areWeLoadingTexture )
             {
             v73->Release();
-            pIcons_LOD->_40F9C5();
+            pIcons_LOD->SyncLoadedFilesCount();
             }
         return;
         }
@@ -360,7 +360,7 @@
         if ( !areWeLoadingTexture )
             {
             v73->Release();
-            pIcons_LOD->_40F9C5();
+            pIcons_LOD->SyncLoadedFilesCount();
             }
         return;
         }
@@ -577,7 +577,7 @@
                         if ( !areWeLoadingTexture )
                             {
                             v73->Release();
-                            pIcons_LOD->_40F9C5();
+                            pIcons_LOD->SyncLoadedFilesCount();
                             }
                         return;
                         }
@@ -598,7 +598,7 @@
             if ( !areWeLoadingTexture )
                 {
                 v73->Release();
-                pIcons_LOD->_40F9C5();
+                pIcons_LOD->SyncLoadedFilesCount();
                 }
             return;
     }
@@ -1543,8 +1543,8 @@
     }
 
 //----- (00417FE5) --------------------------------------------------------
-char __cdecl CharacterUI_SkillsTab_ShowHint()
-    {
+    void CharacterUI_SkillsTab_ShowHint()
+        {
     unsigned int v0; // ecx@1
     unsigned int v1; // eax@1
     GUIButton *i; // esi@6
@@ -1574,9 +1574,9 @@
         }
     else
         {
-        LOBYTE(v1) = sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
+        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
         }
-    return v1;
+    
     }
 
 //----- (00418083) --------------------------------------------------------
--- a/UIRest.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/UIRest.cpp	Sat May 18 22:01:26 2013 +0400
@@ -4,6 +4,7 @@
 
 #include "MapInfo.h"
 #include "Game.h"
+#include "Player.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
 #include "GUIProgressBar.h"
@@ -113,114 +114,111 @@
 //----- (0041FA01) --------------------------------------------------------
 void __cdecl RestUI_Draw()
     {
-    int v0; // esi@1
-    Player **ppPlayers; // ecx@1
-    Player *pPlayer; // eax@2
+    int live_characters; // esi@1
     unsigned int v3; // eax@15
     //char v4; // al@17
     bool v5; // eax@21
-    GUIButton Dst; // [sp+8h] [bp-DCh]@19
+    GUIButton tmp_button; // [sp+8h] [bp-DCh]@19
     //double v7; // [sp+C4h] [bp-20h]@17
     float v8; // [sp+CCh] [bp-18h]@17
     __int64 v9; // [sp+D0h] [bp-14h]@17
-    unsigned int v10; // [sp+D8h] [bp-Ch]@9
-    __int16 a9[2]; // [sp+DCh] [bp-8h]@1
-    int a5; // [sp+E0h] [bp-4h]@1
+    unsigned int am_pm_hours; // [sp+D8h] [bp-Ch]@9
+    __int16 shadow_color; // [sp+DCh] [bp-8h]@1
+    int text_color; // [sp+E0h] [bp-4h]@1
 
-    v0 = 0;
-    a5 = TargetColor(0xAu, 0, 0);
-    *(int *)a9 = TargetColor(0xE6u, 0xD6u, 0xC1u);
-    ppPlayers = &pPlayers[1];
-    do
+    live_characters = 0;
+    text_color =   TargetColor(10, 0, 0);
+    shadow_color = TargetColor(230, 214, 193);
+    for(int i=1; i<5; ++i)
+        if ( !pPlayers[i]->pConditions[Player::Condition_Dead] && !pPlayers[i]->pConditions[Player::Condition_Eradicated] && pPlayers[i]->sHealth > 0 )
+            ++live_characters;
+
+    if ( live_characters )
         {
-        pPlayer = *ppPlayers;
-        if ( !(*ppPlayers)->pConditions[14] && !pPlayer->pConditions[16] && pPlayer->sHealth > 0 )
-            ++v0;
-        ++ppPlayers;
-        }
-        while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] );
-        if ( v0 )
+        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain));
+        am_pm_hours = pParty->uCurrentHour;
+        dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem;
+        if ( (signed int)pParty->uCurrentHour <= 12 )
             {
-            pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain));
-            v10 = pParty->uCurrentHour;
-            dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem;
-            if ( (signed int)pParty->uCurrentHour <= 12 )
-                {
-                if ( !v10 )
-                    v10 = 12;
-                }
-            else
-                {
-                v10 -= 12;
-                }
-            pRenderer->DrawTextureIndexed(16u, 26u, pTexture_RestUI_CurrentSkyFrame);
-            if ( pTexture_RestUI_CurrentHourglassFrame )
-                {
-                pTexture_RestUI_CurrentHourglassFrame->Release();
-                pIcons_LOD->_40F9C5();
-                }
-            v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller;
-            _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed;
-            if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 )
-                {
-                v3 = 0;
-                _507CD4_RestUI_hourglass_anim_controller = 0;
-                }
-            v9 = v3;
-            v8 = (double)v3 / 512.0 * 120.0;
-            //v7 = v8 + 6.7553994e15;
-            HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7);
-            hourglass_icon_idx = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1;
-            //hourglass_icon_idx = v4;
-            if (hourglass_icon_idx >= 120 )
-                {
-                //v4 = 1;
-                hourglass_icon_idx = 1;
-                }
-            sprintf(pTmpBuf, "hglas%03d", hourglass_icon_idx);
-            pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
-            pRenderer->DrawTextureIndexed(0x10Bu, 0x9Fu, pTexture_RestUI_CurrentHourglassFrame);
-            memset(&Dst, 0, 0xBCu);
-            Dst.uX = 24;
-            Dst.uY = 154;
-            Dst.uWidth = 171;
-            Dst.uHeight = 37;
-            Dst.uZ = 194;
-            Dst.uW = 190;
-            Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent;
-            Dst.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, a5, *(int **)a9);
-            Dst.pParent = 0;
-            sprintf(pTmpBuf, "\r408%d", uRestUI_FoodRequiredToRest);
-            pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
-            pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, a5, *(int **)a9);
-            pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, a5, *(int **)a9);
-            pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, a5, *(int **)a9);
-            pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, a5, *(int **)a9);
-            memset(&Dst, 0, 0xBCu);
-            Dst.uX = 45;
-            Dst.uY = 199;
-            Dst.uWidth = 185;
-            Dst.uHeight = 30;
-            Dst.uZ = 229;
-            Dst.uW = 228;
-            Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent;
-            Dst.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, a5, *(int **)a9);
-            Dst.pParent = 0;
-            v5 = pParty->uCurrentHour >= 0xC && pParty->uCurrentHour < 0x18;
-            sprintf(pTmpBuf, "%d:%02d %s", v10, pParty->uCurrentMinute, aAMPMNames[v5]);
-            pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
-            sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);
-            pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
-            sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);
-            pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
-            sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);
-            pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
-            if ( dword_506F14 )
-                Sleep6Hours();
+            if ( !am_pm_hours )
+                am_pm_hours = 12;
             }
         else
+            {
+            am_pm_hours -= 12;
+            }
+        pRenderer->DrawTextureIndexed(16u, 26u, pTexture_RestUI_CurrentSkyFrame);
+        if ( pTexture_RestUI_CurrentHourglassFrame )
+            {
+            pTexture_RestUI_CurrentHourglassFrame->Release();
+            pIcons_LOD->SyncLoadedFilesCount();
+            }
+        v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller;
+        _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed;
+        if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 )
+            {
+            v3 = 0;
+            _507CD4_RestUI_hourglass_anim_controller = 0;
+            }
+        v9 = v3;
+        v8 = (double)v3 / 512.0 * 120.0;
+        //v7 = v8 + 6.7553994e15;
+        HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7);
+        hourglass_icon_idx = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1;
+        //hourglass_icon_idx = v4;
+        if (hourglass_icon_idx >= 120 )
+            hourglass_icon_idx = 1;
+
+        sprintf(pTmpBuf, "hglas%03d", hourglass_icon_idx);
+        pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+        pRenderer->DrawTextureIndexed(267, 159, pTexture_RestUI_CurrentHourglassFrame);
+        memset(&tmp_button, 0, sizeof(GUIButton));
+        tmp_button.uX = 24;
+        tmp_button.uY = 154;
+
+        tmp_button.uZ = 194;
+        tmp_button.uW = 190;
+
+        tmp_button.uWidth = 171;
+        tmp_button.uHeight = 37;
+
+        tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent;
+        tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, text_color, shadow_color);
+        tmp_button.pParent = 0;
+        sprintf(pTmpBuf, "\r408%d", uRestUI_FoodRequiredToRest);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, text_color, pTmpBuf, 0, 0, shadow_color);
+        pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, text_color, shadow_color);
+        pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, text_color, shadow_color);
+        pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, text_color, shadow_color);
+        pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, text_color, shadow_color);
+        memset(&tmp_button, 0, sizeof(GUIButton));
+        tmp_button.uX = 45;
+        tmp_button.uY = 199;
+
+        tmp_button.uZ = 229;
+        tmp_button.uW = 228;
+
+        tmp_button.uWidth = 185;
+        tmp_button.uHeight = 30;
+
+        tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent;
+        tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, text_color, shadow_color);
+        tmp_button.pParent = 0;
+        v5 = (pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24)? 1:0;
+        sprintf(pTmpBuf, "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[v5]);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, text_color, pTmpBuf, 0, 0, shadow_color);
+        sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, text_color, pTmpBuf, 0, 0, shadow_color);
+        sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, text_color, pTmpBuf, 0, 0, shadow_color);
+        sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, text_color, pTmpBuf, 0, 0, shadow_color);
+        if ( dword_506F14 )
+            Sleep6Hours();
+        }
+    else
         {
-          GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn,
-           (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);
+        GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn,
+            (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);
         }
     }
\ No newline at end of file
--- a/mm7_1.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/mm7_1.cpp	Sat May 18 22:01:26 2013 +0400
@@ -362,8 +362,8 @@
 }
 
 //----- (0041D20D) --------------------------------------------------------
-char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, GUIWindow *edx0, __int64 a3, GUIFont *a2)
-{
+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
@@ -427,7 +427,7 @@
     sprintf(pTmpBuf2, "%d %s ", v18, v13);
     strcat(pTmpBuf, pTmpBuf2);
   }
-  return a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0);
+  a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0);
 }
 
 //----- (0041F54A) --------------------------------------------------------
@@ -437,7 +437,7 @@
     pTexture_RestUI_CurrentSkyFrame->Release();
   if ( pTexture_RestUI_CurrentHourglassFrame )
     pTexture_RestUI_CurrentHourglassFrame->Release();
-  pIcons_LOD->_40F9C5();
+  pIcons_LOD->SyncLoadedFilesCount();
   sprintf(pTmpBuf, "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour);
   pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
 }
@@ -468,7 +468,7 @@
       pTexture_RestUI_CurrentHourglassFrame = 0;
       pTexture_RestUI_CurrentSkyFrame = 0;
       pIcons_LOD->_4114F2();
-      pIcons_LOD->_40F9C5();
+      pIcons_LOD->SyncLoadedFilesCount();
       pCurrentScreen = SCREEN_GAME;
       viewparams->bRedrawGameUI = 1;
       if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
@@ -763,7 +763,7 @@
   if ( !v11 )
   {
     v1->Release();
-    pIcons_LOD->_40F9C5();
+    pIcons_LOD->SyncLoadedFilesCount();
   }
   return 1;
 }
@@ -1166,7 +1166,7 @@
 			if (v10 != -1)
 				pIcons_LOD->pTextures[v10].Release();
 			pMouse->RemoveHoldingItem();
-			pIcons_LOD->_40F9C5();
+			pIcons_LOD->SyncLoadedFilesCount();
 			return;
         }
         v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID;
--- a/mm7_2.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/mm7_2.cpp	Sat May 18 22:01:26 2013 +0400
@@ -854,7 +854,7 @@
     pDialogueWindow->Release();
     dialog_menu_id = HOUSE_DIALOGUE_NULL;
     pDialogueWindow = 0;
-    pIcons_LOD->_40F9C5();
+    pIcons_LOD->SyncLoadedFilesCount();
     v1 = uNumDialogueNPCPortraits;
     if ( uNumDialogueNPCPortraits != 1 )
     {
@@ -9951,8 +9951,8 @@
 }
 
 //----- (00467FB6) --------------------------------------------------------
-char __cdecl CreateScrollWindow()
-{
+void CreateScrollWindow()
+    {
   unsigned int v0; // eax@1
   char *v1; // ST18_4@3
   unsigned int v2; // eax@3
@@ -9985,7 +9985,7 @@
   v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, format_4E2D80, v2, v1);
   a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
-  return a1.DrawText(
+  a1.DrawText(
            pFontSmallnum,
            1,
            LOBYTE(pFontCreate->uFontHeight) - 3,
--- a/mm7_4.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/mm7_4.cpp	Sat May 18 22:01:26 2013 +0400
@@ -8020,12 +8020,12 @@
 }
 
 //----- (004B46A5) --------------------------------------------------------
-char __fastcall DrawTextAtStatusBar(const char *sText, int font_color)
-{
+void __fastcall DrawTextAtStatusBar( const char *Str, int a5 )
+    {
   int v4; // eax@1
   pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
-  v4 = pFontLucida->AlignText_Center(450, sText);
-  return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0);
+  v4 = pFontLucida->AlignText_Center(450, Str);
+  pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0);
 }
 
 //----- (004B46F8) --------------------------------------------------------
--- a/mm7_5.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/mm7_5.cpp	Sat May 18 22:01:26 2013 +0400
@@ -383,7 +383,7 @@
         case UIMSG_StartNewGame:
           if ( dword_6BE138 == 124 || uMessageParam )
           {
-            pIcons_LOD->_40F9C5();
+            pIcons_LOD->SyncLoadedFilesCount();
             pIcons_LOD->_4114F2();
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -401,7 +401,7 @@
           stru_506E40.Release();
           continue;
         case UIMSG_Game_OpenLoadGameDialog:
-          pIcons_LOD->_40F9C5();
+          pIcons_LOD->SyncLoadedFilesCount();
           pIcons_LOD->_4114F2();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -412,7 +412,7 @@
         case UIMSG_Quit:
           if ( dword_6BE138 == 132 || uMessageParam )
           {
-            pIcons_LOD->_40F9C5();
+            pIcons_LOD->SyncLoadedFilesCount();
             pIcons_LOD->_4114F2();
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -433,7 +433,7 @@
           continue;
         case UIMSG_80:
 			__debugbreak();
-          pIcons_LOD->_40F9C5();
+          pIcons_LOD->SyncLoadedFilesCount();
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
           pCurrentScreen = SCREEN_OPTIONS;
@@ -1147,7 +1147,7 @@
                       continue;
                     case SCREEN_OPTIONS://Close
                       options_menu_skin.Relaease();
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
                       WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
@@ -1177,9 +1177,9 @@
                       stru_506E40.Release();
                       break;
                     case SCREEN_MENU:
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
                       stru_506E40.Release();
                       break;
@@ -1217,7 +1217,7 @@
                           }
                           while ( thisb < (signed int)&dword_507C08 );
                           memset(&uTextureID_Optkb, 0, 0x14u);
-                          pIcons_LOD->_40F9C5();
+                          pIcons_LOD->SyncLoadedFilesCount();
                           uAction = 0;
                           do
                           {
@@ -1263,7 +1263,7 @@
                       pTexture_RestUI_CurrentHourglassFrame->Release();
                       pTexture_RestUI_CurrentHourglassFrame = 0;
                       pTexture_RestUI_CurrentSkyFrame = 0;
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
                       _506F18_num_hours_to_sleep = 0;
                       dword_506F14 = 0;
@@ -9165,14 +9165,14 @@
 
 
 //----- (0040D75D) --------------------------------------------------------
-char __fastcall pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY)
-{
+void pPrimaryWindow_draws_text( int a1, const char *pText, int *pXY )
+    {
   const char *v3; // ST0C_4@1
   __int64 v4; // qax@1
 
   v3 = pText;
   v4 = LOBYTE(pFontComic->uFontHeight) - 3;
-  return pPrimaryWindow->DrawText(
+  pPrimaryWindow->DrawText(
            pFontComic,
            *pXY,
            pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3,
@@ -11354,8 +11354,8 @@
 }
 
 //----- (004179BC) --------------------------------------------------------
-char __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2)
-{
+void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 )
+    {
   const char *v2; // ebx@1
   const char *v3; // edi@1
   unsigned int v4; // eax@1
@@ -11382,7 +11382,7 @@
   v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, format_4E2D80, v4, v3);
   Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
-  return Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
+  Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
 }
 
 //----- (00417AD4) --------------------------------------------------------
--- a/mm7_data.cpp	Thu May 16 15:14:58 2013 +0200
+++ b/mm7_data.cpp	Sat May 18 22:01:26 2013 +0400
@@ -826,20 +826,7 @@
 	"idoor",
 	"isecdoor"
 };
-const char *_4E6BDC_loc_names[11]=
-{
-	"mdt12.blv",
-	"d18.blv",
-	"mdt14.blv",
-	"d37.blv",
-	"mdk01.blv",
-	"mdt01.blv",
-	"mdr01.blv",
-	"mdt10.blv",
-	"mdt09.blv",
-	"mdt15.blv",
-	"mdt11.blv"
-};
+
 char aMer[777]; // idb
 char aMir[777]; // idb
 char aSel[777]; // idb
--- a/mm7_data.h	Thu May 16 15:14:58 2013 +0200
+++ b/mm7_data.h	Sat May 18 22:01:26 2013 +0400
@@ -1521,7 +1521,7 @@
 int __fastcall am_40D402(int, int); // weak
 int __cdecl am_40D444();
 void ModalWindow(const char *pStr, int a4);
-char __fastcall pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY);
+void  pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY);
 void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
 void __fastcall Blt_Chroma(struct ArcomageRect *pSrcXYZW, int *pTargetXY, int a3, int a4);
 void __fastcall Blt_Copy(struct ArcomageRect *pSrcXYZW, int *pTargetXY, int a3);
@@ -1550,7 +1550,7 @@
 void uGameUIFontShadow_initialize();
 void sub_41420D_press_esc();
 void sub_41426F();
-char GameMenuUI_DrawKeyBindings();
+void GameMenuUI_DrawKeyBindings();
 unsigned int __thiscall sub_414D24(int _this);
 void GameMenuUI_DrawVideoOptions();
 void DrawGameOptions();
@@ -1567,7 +1567,7 @@
 void sub_4178E1();
 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2);
 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx); // idb
-char __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2); // idb
+void  __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2); // idb
 void FillAwardsData();
 void sub_419220();
 void sub_419379();
@@ -1576,7 +1576,7 @@
 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall);
 void __cdecl MainMenuUI_LoadFontsAndSomeStuff();
 void __cdecl MainMenuUI_Create();
-char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2);
+void  __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2);
 bool UI_OnKeyDown(unsigned int vkKey);
 void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb
 void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0);
@@ -1804,7 +1804,7 @@
 void __thiscall sub_467E7F_EquipBody(unsigned int uEquipType); // idb
 void __fastcall sub_467F48(signed int a1);
 void __cdecl free_book_subwindow();
-char __cdecl CreateScrollWindow();
+void  CreateScrollWindow();
 void __cdecl OnPaperdollLeftClick();
 int __thiscall UnprojectX(int x);
 int __thiscall UnprojectY(int _this);
@@ -1979,7 +1979,7 @@
 void __fastcall sub_4B3FE5(int a4);
 void  NPCHireableDialogPrepare();
 void  _4B4224_UpdateNPCTopics(int _this);
-char __fastcall DrawTextAtStatusBar(const char *Str, int a5);
+void __fastcall DrawTextAtStatusBar(const char *Str, int a5);
 int __fastcall sub_4B46F8(int a1);
 
 signed int __fastcall sub_4BB756(signed int a1);