changeset 810:f5156b8c61ad

savegame refactoring
author Gloval
date Tue, 26 Mar 2013 00:57:54 +0400
parents 14beae4f1723
children d6e84d158052
files Indoor.h LOD.h Outdoor.cpp Outdoor.h Render.cpp Render.h SaveLoad.cpp SpriteObject.cpp SpriteObject.h Time.h Weather.h mm7_2.cpp mm7_3.cpp mm7_6.cpp mm7_data.h
diffstat 15 files changed, 308 insertions(+), 344 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/Indoor.h	Tue Mar 26 00:57:54 2013 +0400
@@ -1,7 +1,7 @@
 #pragma once
 #include "VectorTypes.h"
 #include "IndoorCameraD3D.h"
-
+#include "Weather.h"
 
 
 
@@ -402,13 +402,7 @@
 
 
 
-#pragma pack(push, 1)
-struct IndoorLocation_stru1
-{
-  unsigned __int64 uLastVisitDay;
-  char field_2F4[48];
-};
-#pragma pack(pop)
+
 
 
 
@@ -475,7 +469,7 @@
   unsigned int uNumSpawnPoints;
   struct SpawnPointMM7 *pSpawnPoints;
   struct DDM_DLV_Header dlv;
-  IndoorLocation_stru1 stru1;
+  LocationTime_stru1 stru1;
   char _visible_outlines[876];
 };
 #pragma pack(pop)
--- a/LOD.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/LOD.h	Tue Mar 26 00:57:54 2013 +0400
@@ -14,9 +14,6 @@
   TEXTURE_16BIT_PALETTE = 0x2,
 };
 
-
-
-
 namespace LOD
 {
   #pragma pack(push, 1)
--- a/Outdoor.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/Outdoor.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -316,9 +316,9 @@
       MessageBoxA(0, "Error!", "Couldn't Load Map!", 0);
       CreateDebugLocation();
     }
-    ::day_attrib = v5->day_attrib;
-    ::day_fogrange_1 = v5->day_fogrange_1;
-    ::day_fogrange_2 = v5->day_fogrange_2;
+    ::day_attrib = v5->loc_time.day_attrib;
+    ::day_fogrange_1 = v5->loc_time.day_fogrange_1;
+    ::day_fogrange_2 = v5->loc_time.day_fogrange_2;
     if ( Is_out15odm_underwater() )
       SetUnderwaterFog();
     _6BE134_odm_main_tile_group = v5->pTileTypes[0].tileset;
@@ -679,9 +679,9 @@
 
   if ( Is_out15odm_underwater() )
     SetUnderwaterFog();
-  pOutdoor->day_fogrange_1 = ::day_fogrange_1;
-  pOutdoor->day_fogrange_2 = ::day_fogrange_2;
-  pOutdoor->day_attrib = ::day_attrib;
+  pOutdoor->loc_time.day_fogrange_1 = ::day_fogrange_1;
+  pOutdoor->loc_time.day_fogrange_2 = ::day_fogrange_2;
+  pOutdoor->loc_time.day_attrib = ::day_attrib;
 }
 
 //----- (00482170) --------------------------------------------------------
@@ -2324,7 +2324,7 @@
   pSrc += 0xC8;
 
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uLastVisitDay, pSrc, 0x38u);
+  memcpy(&loc_time, pSrc, 0x38u);
 
   free(pSrcMem);
 
@@ -2353,23 +2353,23 @@
   //v100 = HIDWORD(uLastVisitDay);
   //LODWORD(v142) = LODWORD(uLastVisitDay);
   //HIDWORD(v142) = v100;
-  if (uLastVisitDay)
+  if (loc_time.uLastVisitDay)
   {
-    if ( (signed int)((signed int)(signed __int64)((double)uLastVisitDay * 0.234375) / 60 / 60 / 24) % 28 != pParty->uDaysPlayed )
+    if ( (signed int)((signed int)(signed __int64)((double)loc_time.uLastVisitDay * 0.234375) / 60 / 60 / 24) % 28 != pParty->uDaysPlayed )
     {
       if ( rand() % 100 >= 20 )
         v108 = dword_4EC268[rand() % dword_4EC2A8];
       else
         v108 = dword_4EC28C[rand() % dword_4EC2AC];
-      sprintf(sky_texture_name, "plansky%d", v108);
+      sprintf(loc_time.sky_texture_name, "plansky%d", v108);
     }
   }
   else
   {
-    strcpy(sky_texture_name, "plansky3");
+    strcpy(loc_time.sky_texture_name, "plansky3");
   }
   //v101 = pBitmaps_LOD->LoadTexture(field_4F8);
-  uSky_TextureID = pBitmaps_LOD->LoadTexture(sky_texture_name);
+  uSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name);
   if (uSky_TextureID != -1)
     pBitmaps_LOD->pTextures[uSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uSky_TextureID].palette_id1);
 
--- a/Outdoor.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/Outdoor.h	Tue Mar 26 00:57:54 2013 +0400
@@ -4,7 +4,7 @@
 #include "Indoor.h"
 #include "TileFrameTable.h"
 #include "MapInfo.h"
-
+#include "Weather.h"
 
 
 #define DAY_ATTRIB_FOG  1
@@ -210,12 +210,13 @@
   unsigned int uNumSpawnPoints;
   struct SpawnPointMM7 *pSpawnPoints;
   struct DDM_DLV_Header ddm;
-  unsigned __int64 uLastVisitDay;
-  char sky_texture_name[12];
-  int day_attrib;
-  int day_fogrange_1;
-  int day_fogrange_2;
-  char field_510[24];
+  LocationTime_stru1 loc_time;
+  //unsigned __int64 uLastVisitDay;
+  //char sky_texture_name[12];
+  //int day_attrib;
+  //int day_fogrange_1;
+  //int day_fogrange_2;
+ // char field_510[24];
   unsigned char uUndiscoveredArea[88][11];//968
   unsigned char uDicovered_area[88][11];//[968]
   int field_CB8;
--- a/Render.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/Render.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -5204,13 +5204,13 @@
 // 4EFA84: using guessed type int dword_4EFA84;
 
 //----- (0049F5A2) --------------------------------------------------------
-int Render::_49F5A2(int a2, int a3, int a4, void *Dst, int a6, int a7)
-{
+void Render::PackPCXpicture( unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size )
+    {
   Render *v7; // ebx@1
   void *v8; // esi@3
   void *v9; // esi@3
   int v10; // ecx@4
-  int v11; // eax@4
+  unsigned short* v11; // eax@4
   int v12; // eax@6
   int v13; // eax@8
   int v14; // ecx@8
@@ -5220,158 +5220,141 @@
   char v18[58]; // [sp+Ch] [bp-ACh]@3
  // __int16 v19; // [sp+44h] [bp-74h]@3
   char v20[48]; // [sp+48h] [bp-70h]@3
-  char *v21; // [sp+78h] [bp-40h]@7
-  char *v22; // [sp+7Ch] [bp-3Ch]@7
+  char *lineG; // [sp+78h] [bp-40h]@7
+  char *lineB; // [sp+7Ch] [bp-3Ch]@7
   int v23; // [sp+80h] [bp-38h]@4
   int v24; // [sp+84h] [bp-34h]@4
   int v25; // [sp+88h] [bp-30h]@4
   int v26; // [sp+8Ch] [bp-2Ch]@4
-  char Src; // [sp+90h] [bp-28h]@3
-  char v28; // [sp+91h] [bp-27h]@3
-  char v29; // [sp+92h] [bp-26h]@3
-  char v30; // [sp+93h] [bp-25h]@3
-  __int16 v31; // [sp+94h] [bp-24h]@3
-  __int16 v32; // [sp+96h] [bp-22h]@3
-  __int16 v33; // [sp+98h] [bp-20h]@3
-  __int16 v34; // [sp+9Ah] [bp-1Eh]@3
-  __int16 v35; // [sp+9Ch] [bp-1Ch]@3
-  __int16 v36; // [sp+9Eh] [bp-1Ah]@3
-  char v37; // [sp+A0h] [bp-18h]@3
-  char v38; // [sp+A1h] [bp-17h]@3
-  __int16 v39; // [sp+A2h] [bp-16h]@3
-  __int16 v40; // [sp+A4h] [bp-14h]@3
-  void *ptr; // [sp+A8h] [bp-10h]@3
-  int v42; // [sp+ACh] [bp-Ch]@1
+  PCXHeader_1 Src; // [sp+90h] [bp-28h]@3
+  PCXHeader_2 v27; // [sp+A0h] [bp-18h]@3
+  char *lineRGB; // [sp+A8h] [bp-10h]@3
+  int pitch; // [sp+ACh] [bp-Ch]@1
   char v43; // [sp+B3h] [bp-5h]@18
   int i; // [sp+B4h] [bp-4h]@6
+  unsigned short* line_pictute_data;
+  byte test_byte;
+  unsigned char pict_byte;
 
   v7 = this;
-  v42 = a3;
-  if ( a3 & 1 )
-    v42 = a3 + 1;
-  v31 = 0;
-  v32 = 0;
-  v33 = a3 - 1;
-  v34 = a4 - 1;
-  v39 = v42;
+  pitch = wight;
+  if ( wight & 1 )
+      pitch = wight + 1;
+  Src.left = 0;
+  Src.up = 0;
+  Src.right = wight - 1;
+  Src.bottom = heidth - 1;
+  v27.pitch = pitch;
   memset(&v20, 0, 0x30u);
   memset(&v18, 0, 0x38u);
-  v8 = Dst;
-  v37 = 0;
+  v8 = data_buff;
+  v27.reserved = 0;
   *(_WORD *)&v18[56] = 0;
-  Src = 10;
-  v28 = 5;
-  v29 = 1;
-  v30 = 8;
-  v35 = 75;
-  v36 = 75;
-  v38 = 3;
-  v40 = 1;
-  memcpy(Dst, &Src, 1u);
+  Src.manufacturer = 10;
+  Src.version = 5;
+  Src.encoding = 1;
+  Src.bpp = 8;
+  Src.hdpi = 75;
+  Src.vdpi = 75;
+  v27.planes = 3;
+  v27.palette_info = 1;
+  memcpy(data_buff, &Src, 1u);
   v8 = (char *)v8 + 1;
-  memcpy(v8, &v28, 1u);
+  memcpy(v8, &Src.version, 1u);
   v8 = (char *)v8 + 1;
-  memcpy(v8, &v29, 1u);
+  memcpy(v8, &Src.encoding, 1u);
   v8 = (char *)v8 + 1;
-  memcpy(v8, &v30, 1u);
+  memcpy(v8, &Src.bpp, 1u);
   v8 = (char *)v8 + 1;
-  memcpy(v8, &v31, 2u);
+  memcpy(v8, &Src.left, 2u);
   v8 = (char *)v8 + 2;
-  memcpy(v8, &v32, 2u);
+  memcpy(v8, &Src.up, 2u);
   v8 = (char *)v8 + 2;
-  memcpy(v8, &v33, 2u);
+  memcpy(v8, &Src.right, 2u);
   v8 = (char *)v8 + 2;
-  memcpy(v8, &v34, 2u);
+  memcpy(v8, &Src.bottom, 2u);
   v8 = (char *)v8 + 2;
-  memcpy(v8, &v35, 2u);
+  memcpy(v8, &Src.hdpi, 2u);
   v8 = (char *)v8 + 2;
-  memcpy(v8, &v36, 2u);
+  memcpy(v8, &Src.vdpi, 2u);
   v8 = (char *)v8 + 2;
   memcpy(v8, &v20, 0x30u);
   v8 = (char *)v8 + 48;
-  memcpy(v8, &v37, 1u);
+  memcpy(v8, &v27, 1u);
   v8 = (char *)v8 + 1;
-  memcpy(v8, &v38, 1u);
+  memcpy(v8, &v27.planes, 1u);
   v8 = (char *)v8 + 1;
-  memcpy(v8, &v39, 2u);
+  memcpy(v8, &v27.pitch, 2u);
   v8 = (char *)v8 + 2;
-  memcpy(v8, &v40, 2u);
+  memcpy(v8, &v27.palette_info, 2u);
   v8 = (char *)v8 + 2;
   memcpy(v8, &v18, 0x3Au);
   v9 = (char *)v8 + 58;
-  ptr = pAllocator->AllocNamedChunk(0, 3 * a3 + 6, 0);
-  if ( a4 > 0 )
-  {
-    v10 = v42;
-    v25 = a4;
-    v26 = 3 * v42;
-    v23 = 2 * a3;
-    v11 = a2;
-    v24 = a2;
+
+  lineRGB = (char*)pAllocator->AllocNamedChunk(0, 3 * (wight + 2), 0);
+  if ( heidth > 0 )
+  {
+    v10 = pitch;
+    v25 = heidth;
+    v26 = 3 * pitch;
+    v23 = 2 * wight;
+    v11 = picture_data;
+    v24 = (int)picture_data;
     while ( 1 )
     {
-      a4 = v11;
+      line_pictute_data = v11;
       v12 = 0;
       i = 0;
-      if ( a3 > 0 )
-      {
-        v21 = (char *)ptr + v10;
-        v22 = (char *)ptr + 2 * v42;
+      if ( wight > 0 )
+      {
+        lineG = (char *)lineRGB + pitch;
+        lineB = (char *)lineRGB + 2 * pitch;
         do
         {
-          *((char *)ptr + v12) = (signed int)(v7->uTargetRMask & *(short *)a4) >> (LOBYTE(v7->uTargetGBits)
-                                                                                  + LOBYTE(v7->uTargetBBits)
-                                                                                  + v7->uTargetRBits
-                                                                                  - 8);
-          v13 = i;
-          v21[i] = (signed int)(v7->uTargetGMask & *(short *)a4) >> (LOBYTE(v7->uTargetBBits)
-                                                                   + LOBYTE(v7->uTargetGBits)
-                                                                   - 8);
-          v14 = a4;
-          a4 += 2;
-          v22[v13] = (v7->uTargetBMask & *(char *)v14) << (8 - LOBYTE(v7->uTargetBBits));
-          v12 = v13 + 1;
-          i = v12;
-        }
-        while ( v12 < a3 );
+          lineRGB[v12] = (signed int)(v7->uTargetRMask & *line_pictute_data) >> (v7->uTargetGBits  + v7->uTargetBBits  + v7->uTargetRBits  - 8);
+          lineG[v12] = (signed int)(v7->uTargetGMask & *line_pictute_data) >> ( v7->uTargetBBits + v7->uTargetGBits- 8);
+          lineB[v12] = (v7->uTargetBMask & *line_pictute_data) << (8 - v7->uTargetBBits);
+
+          v12++;
+        }
+        while ( v12 < wight );
       }
       for ( i = 0; i < v26; v9 = (char *)v9 + 1 )
       {
-        BYTE3(a4) = 1;
-        BYTE3(a2) = *((char *)ptr + i);
+        test_byte = 1;
+        pict_byte = lineRGB [i];
         do
         {
-          v15 = i + BYTE3(a4);
-          if ( *((char *)ptr + v15) != BYTE3(a2) )
+          v15 = i + test_byte;
+          if ( *((char *)lineRGB + v15) != pict_byte )
             break;
-          if ( !(v15 % v42) )
+          if ( !(v15 % pitch) )
             break;
-          ++BYTE3(a4);
-        }
-        while ( BYTE3(a4) < 0x3Fu );
-        if ( i + BYTE3(a4) > v26 )
-          BYTE3(a4) = 3 * v42 - i;
-        if ( BYTE3(a4) > 1u || BYTE3(a2) >= 0xC0u )
-        {
-          v43 = BYTE3(a4) | 0xC0;
+          ++test_byte;
+        }
+        while ( test_byte < 0x3Fu );
+        if ( i + test_byte > v26 )
+          test_byte = 3 * pitch - i;
+        if ( test_byte > 1u || pict_byte >= 0xC0u )
+        {
+          v43 = test_byte | 0xC0;
           memcpy(v9, &v43, 1u);
           v9 = (char *)v9 + 1;
         }
-        memcpy(v9, (char *)&a2 + 3, 1u);
-        i += BYTE3(a4);
-      }
-      v11 = v23 + v24;
+        memcpy(v9, &pict_byte, 1u);
+        i += test_byte;
+      }
+      v11 +=wight ;
       v16 = v25-- == 1;
-      v24 += v23;
+     
       if ( v16 )
         break;
-      v10 = v42;
-    }
-  }
-  pAllocator->FreeChunk(ptr);
-  result = a7;
-  *(int *)a7 = (char *)v9 - Dst;
-  return result;
+      v10 = pitch;
+    }
+  }
+  pAllocator->FreeChunk(lineRGB);
+  *(int *)packed_size = (char *)v9 - data_buff;
+ 
 }
 
 //----- (0049F8B5) --------------------------------------------------------
--- a/Render.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/Render.h	Tue Mar 26 00:57:54 2013 +0400
@@ -279,7 +279,7 @@
   void PresentBlackScreen();
   void SavePCXScreenshot();
   void _49F1BC(const char *a1);
-  int _49F5A2(int a2, int a3, int a4, void *Dst, int a6, int a7);
+  void PackPCXpicture(unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size);
   FILE *SavePCXImage(const char *Filename, char *a3, int a4, int a5);
   void ClearTarget(unsigned int uColor);
   void Release2();
--- a/SaveLoad.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/SaveLoad.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -24,6 +24,15 @@
 
 
 
+struct SaveDataHeader
+    {
+    int Signature;
+    char txt_ver[4];
+    int compressed_size;
+    int uncompressed_size;
+    };
+
+
 
 
 struct SavegameList *pSavegameList = new SavegameList;
@@ -228,16 +237,16 @@
 
 
 //----- (0045F469) --------------------------------------------------------
-int __fastcall SaveGame(int a1, __int16 *a2)
-{
+void SaveGame( bool IsAutoSAve, bool NotSaveWorld )
+    {
   int result; // eax@1
-  void *pScreenshot; // edi@5
-  int v4; // eax@6
+  unsigned short *pScreenshot; // edi@5
+  int text_pos; // eax@6
   int v5; // eax@6
   int v6; // eax@6
   const char *v7; // edi@8
   FILE *v8; // edi@24
-  int v9; // edi@30
+  char* compressed_buf; // edi@30
   void *v10; // esi@31
   void *v11; // esi@31
   void *v12; // esi@37
@@ -249,7 +258,7 @@
   unsigned int v18; // ecx@38
   unsigned int v19; // esi@39
   BSPModel *v20; // edx@39
-  void *v21; // esi@41
+  char *data_write_pos; // esi@41
   void *v22; // esi@41
   BSPModel *v23; // eax@42
   signed int v24; // edi@42
@@ -283,7 +292,7 @@
   int pPositionX; // [sp+20Ch] [bp-64h]@2
   int v53; // [sp+210h] [bp-60h]@2
   int v54; // [sp+214h] [bp-5Ch]@2
-  int Src; // [sp+218h] [bp-58h]@30
+  SaveDataHeader Src; // [sp+218h] [bp-58h]@30
   char v56; // [sp+21Ch] [bp-54h]@30
   char v57; // [sp+21Dh] [bp-53h]@30
   char v58; // [sp+21Eh] [bp-52h]@30
@@ -291,12 +300,12 @@
   int v60; // [sp+220h] [bp-50h]@30
   int v61; // [sp+224h] [bp-4Ch]@30
   int v62; // [sp+228h] [bp-48h]@2
-  LOD::Directory pDir; // [sp+22Ch] [bp-44h]@2
+  LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2
   size_t Size; // [sp+250h] [bp-20h]@26
   __int16 *v66; // [sp+254h] [bp-1Ch]@1
-  void *DstBuf; // [sp+258h] [bp-18h]@2
+  char *uncompressed_buff; // [sp+258h] [bp-18h]@2
   __int16 *v68; // [sp+25Ch] [bp-14h]@32
-  unsigned int v69; // [sp+260h] [bp-10h]@23
+  unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23
   int v70; // [sp+264h] [bp-Ch]@22
   std::string *v71; // [sp+268h] [bp-8h]@8
   int a3; // [sp+26Fh] [bp-1h]@8
@@ -304,10 +313,10 @@
   //v66 = a2;
   strcpy(byte_6BE3B0, pCurrentMapName);
   if (!_strcmpi(pCurrentMapName, "d05.blv")) // arena
-    return false;
+    return;
 
-  DstBuf = malloc(0xF4240);
-  pDir.Reset();
+  uncompressed_buff = (char*)malloc(1000000);
+  pLodDirectory.Reset();
   pPositionX = pParty->vPosition.x;
   v51 = pParty->vPosition.y;
   v62 = pParty->vPosition.z;
@@ -322,25 +331,25 @@
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
     pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
   else
-    pOutdoor->uLastVisitDay = pParty->uTimePlayed;
+    pOutdoor->loc_time.uLastVisitDay = pParty->uTimePlayed;
   pScreenshot = MakeScreenshot(150, 112);
-  strcpy(pDir.pFilename, "image.pcx");
-  pRenderer->_49F5A2((int)pScreenshot, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
+  strcpy(pLodDirectory.pFilename, "image.pcx");
+  pRenderer->PackPCXpicture(pScreenshot, 150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);
   free(pScreenshot);
   if (pCurrentScreen == SCREEN_SAVEGAME)
   {
     pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
     pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up));
-    v4 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[190]);
-    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); //Сохранение
-    v5 = pFontSmallnum->AlignText_Center(0xBA, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
-    pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0);
-    v6 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);
-    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //Пожалуйста, подождите
+    text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[190]);
+    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); //Сохранение
+    text_pos  = pFontSmallnum->AlignText_Center(186, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
+    pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, text_pos  + 25, 259, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0);
+    text_pos  = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]);
+    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos  + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //Пожалуйста, подождите
     pRenderer->Present();
   }
 
-  if (pNew_LOD->Write(&pDir, DstBuf, 0))
+  if (pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0))
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 200); //Сохраненная игра повреждена! Code=%d
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
@@ -352,45 +361,45 @@
   memset(header.field_30, 0, 52);
   strcpy(header.pLocationName, pCurrentMapName);
   header.uWordTime = pParty->uTimePlayed;
-  strcpy(pDir.pFilename, "header.bin");
-  pDir.uDataSize = sizeof(SavegameHeader);
-  if (pNew_LOD->Write(&pDir, &header, 0))
+  strcpy(pLodDirectory.pFilename, "header.bin");
+  pLodDirectory.uDataSize = sizeof(SavegameHeader);
+  if (pNew_LOD->Write(&pLodDirectory, &header, 0))
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 201);
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
   }
-  strcpy(pDir.pFilename, "party.bin");
-  pDir.uDataSize = 90680;
-  if ( pNew_LOD->Write(&pDir, pParty, 0) )
+  strcpy(pLodDirectory.pFilename, "party.bin");
+  pLodDirectory.uDataSize = sizeof(Party); //90680;
+  if ( pNew_LOD->Write(&pLodDirectory, pParty, 0) )
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 202);
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
   }
-  strcpy(pDir.pFilename, "clock.bin");
-  pDir.uDataSize = 40;
-  if ( pNew_LOD->Write(&pDir, pEventTimer, 0) )
+  strcpy(pLodDirectory.pFilename, "clock.bin");
+  pLodDirectory.uDataSize =sizeof(Timer);// 40;
+  if ( pNew_LOD->Write(&pLodDirectory, pEventTimer, 0) )
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 203);
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
   }
-  strcpy(pDir.pFilename, "overlay.bin");
-  pDir.uDataSize = 1008;
-  if ( pNew_LOD->Write(&pDir, pOtherOverlayList, 0) )
+  strcpy(pLodDirectory.pFilename, "overlay.bin");
+  pLodDirectory.uDataSize =sizeof(OtherOverlayList);// 1008;
+  if ( pNew_LOD->Write(&pLodDirectory, pOtherOverlayList, 0) )
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 204);
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
   }
-  strcpy(pDir.pFilename, "npcdata.bin");
-  pDir.uDataSize = 501 * sizeof(NPCData);
-  assert(pDir.uDataSize == 38076);
-  if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) )
+  strcpy(pLodDirectory.pFilename, "npcdata.bin");
+  pLodDirectory.uDataSize = 501 * sizeof(NPCData);
+  assert(pLodDirectory.uDataSize == 38076);
+  if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pNewNPCData, 0) )
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 205);
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
   }
-  strcpy(pDir.pFilename, "npcgroup.bin");
-  pDir.uDataSize = 102;
-  if ( pNew_LOD->Write(&pDir, pNPCStats->pGroups_copy, 0) )
+  strcpy(pLodDirectory.pFilename, "npcgroup.bin");
+  pLodDirectory.uDataSize = 102;
+  if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pGroups_copy, 0) )
   {
     sprintf(Str, pGlobalTXT_LocalizationStrings[612], 206);
     MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
@@ -406,13 +415,13 @@
         __debugbreak();
         sprintf(Str, "lloyd%d%d.pcx", i, j);
         fseek(v8, 0, 2);
-        pDir.uDataSize = ftell(v8);
+        pLodDirectory.uDataSize = ftell(v8);
         rewind(v8);
-        fread(DstBuf, pDir.uDataSize, 1, v8);
-        strcpy((char *)&pDir, Str);
+        fread(uncompressed_buff, pLodDirectory.uDataSize, 1, v8);
+        strcpy((char *)&pLodDirectory, Str);
         fclose(v8);
         remove(Str);
-        if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
+        if ( pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0) )
         {
           sprintf(Str, pGlobalTXT_LocalizationStrings[612], 207);
           MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
@@ -421,114 +430,100 @@
       }
 	}
   }
-  if ( !a2 )
+  if ( !NotSaveWorld )
   {
     //__debugbreak();
-    sub_42FA22_mess_with_laying_item_list();
-    v9 = (int)malloc(0xF4240);
-    v71 = (std::string *)v9;
-    Src = 91969;
-    v56 = 109;
-    v57 = 118;
-    v58 = 105;
-    v59 = 105;
-    v60 = 0;
-    v61 = 0;
-    memcpy((void *)v9, &Src, 0x10);
+    CompactLayingItemsList();
+    compressed_buf = (char*)malloc(1000000);
+  //  v71 = (std::string *)compressed_buf;
+    Src.Signature = 91969;
+    Src.txt_ver[0] = 'm';
+    Src.txt_ver[1] = 'v';
+    Src.txt_ver[2] = 'i';
+    Src.txt_ver[3] = 'i';
+    Src.compressed_size = 0;
+    Src.uncompressed_size = 0;
+    data_write_pos = uncompressed_buff;
+    memcpy((void *)compressed_buf, &Src, 0x10);
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
     {
       pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
       pIndoor->dlv.uNumBModels = 0;
       pIndoor->dlv.uNumDecorations = uNumLevelDecorations;
-      memcpy(DstBuf, &pIndoor->dlv, 0x28);
-      v10 = (char *)DstBuf + 40;
-      memcpy(v10, pIndoor->_visible_outlines, 0x36B);
-      v11 = (char *)v10 + 875;
-      if ( (signed int)pIndoor->uNumFaces > 0 )
-      {
-        v68 = 0;
-        for (int i =  0; i <= (signed int)pIndoor->uNumFaces; ++i)
+      memcpy(data_write_pos, &pIndoor->dlv, 0x28);
+      data_write_pos += 40;
+      memcpy(data_write_pos, pIndoor->_visible_outlines, 0x36B);
+      data_write_pos += 875;
+    
+        for (int i =  0; i <(signed int)pIndoor->uNumFaces; ++i)
         {
-		  v38 = &pIndoor->pFaces[i].uAttributes;//(char *)v68 + (unsigned int)pIndoor->pFaces + 44;
-          memcpy(v11, v38, 4);
-          v68 += 48;
-          v11 = (char *)v11 + 4;
+          memcpy(data_write_pos, &pIndoor->pFaces[i].uAttributes, 4);
+          data_write_pos += 4;
         }
-      }
-      if ( (signed int)uNumLevelDecorations > 0 )
-      {
-        v68 = &pLevelDecorations[0].field_2;
-        for (int i =  0; i <= (signed int)uNumLevelDecorations; ++i)
+
+        for (int i =  0; i <(signed int)uNumLevelDecorations; ++i)
         {
-          memcpy(v11, v68, 2);
-          v68 += 16;
-          v11 = (char *)v11 + 2;
+          memcpy(data_write_pos, &pLevelDecorations[i].field_2, 2);
+     
+          data_write_pos+= 2;
         }
-      }
-      memcpy(v11, &uNumActors, 4);
-      v12 = (char *)v11 + 4;
-      memcpy(v12, pActors, 836 * uNumActors);
-      v13 = (char *)v12 + 836 * uNumActors;
-      memcpy(v13, &uNumSpriteObjects, 4);
-      v13 = (char *)v13 + 4;
-      memcpy(v13, pSpriteObjects, 112 * uNumSpriteObjects);
-      v14 = (char *)v13 + 112 * uNumSpriteObjects;
-      memcpy(v14, &uNumChests, 4);
-      v14 = (char *)v14 + 4;
-      memcpy(v14, pChests, 5324 * uNumChests);
-      v15 = (char *)v14 + 5324 * uNumChests;
-      memcpy(v15, pIndoor->pDoors, 0x3E80);
-      v15 = (char *)v15 + 16000;
-      memcpy(v15, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
-      v16 = (char *)v15 + pIndoor->blv.uDoors_ddata_Size;
-      memcpy(v16, &stru_5E4C90, 0xC8);
-      v17 = (int)((char *)v16 + 200);
-      memcpy((void *)v17, &pIndoor->stru1, 0x38);
+      memcpy(data_write_pos, &uNumActors, 4);
+      data_write_pos += 4;
+      memcpy(data_write_pos, pActors, 836 * uNumActors);
+      data_write_pos += 836 * uNumActors;
+      memcpy(data_write_pos, &uNumSpriteObjects, 4);
+      data_write_pos += 4;
+      memcpy(data_write_pos, pSpriteObjects, 112 * uNumSpriteObjects);
+      data_write_pos += 112 * uNumSpriteObjects;
+      memcpy(data_write_pos, &uNumChests, 4);
+      data_write_pos += 4;
+      memcpy(data_write_pos, pChests, 5324 * uNumChests);
+      data_write_pos += 5324 * uNumChests;
+      memcpy(data_write_pos, pIndoor->pDoors, 0x3E80);
+      data_write_pos += 16000;
+      memcpy(data_write_pos, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
+      data_write_pos += pIndoor->blv.uDoors_ddata_Size;
+      memcpy(data_write_pos, &stru_5E4C90, 0xC8);
+      data_write_pos += 200;
+      memcpy(data_write_pos, &pIndoor->stru1, 0x38);
+      data_write_pos += 56;
+
     }
     else
     {
       v18 = 0;
       pOutdoor->ddm.uNumFacesInBModels = 0;
-      if ( (signed int)pOutdoor->uNumBModels > 0 )
-      {
-        v19 = pOutdoor->uNumBModels;
-		v20 = &pOutdoor->pBModels[0];
-        do
-        {
-		  v18 += v20->uNumFaces;
-          ++v20;
-          --v19;
-          pOutdoor->ddm.uNumFacesInBModels = v18;
-        }
-        while ( v19 );
-      }
-      v21 = DstBuf;
+      for (int i=0; i<pOutdoor->uNumBModels;++i)
+          {
+          v18 +=pOutdoor->pBModels[i].uNumFaces;
+          }
+      pOutdoor->ddm.uNumFacesInBModels = v18;
       pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
       pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
-      memcpy(DstBuf, &pOutdoor->ddm, 0x28);
-      v21 = (char *)v21 + 40;
-      memcpy(v21, pOutdoor->uUndiscoveredArea, 0x3C8);
-      v21 = (char *)v21 + 968;
-      memcpy(v21, pOutdoor->uDicovered_area, 0x3C8);
-      v22 = (char *)v21 + 968;
+      memcpy(data_write_pos, &pOutdoor->ddm, sizeof(DDM_DLV_Header));//0x28
+      data_write_pos += sizeof(DDM_DLV_Header);
+      memcpy(data_write_pos, pOutdoor->uUndiscoveredArea, 0x3C8);
+      data_write_pos += 968;
+      memcpy(data_write_pos, pOutdoor->uDicovered_area, 0x3C8);
+      data_write_pos += 968;
       if ( (signed int)pOutdoor->uNumBModels > 0 )
       {
         v23 = pOutdoor->pBModels;
         v24 = 76;
 		for (int i =  0; i < (signed int)pOutdoor->uNumBModels ; ++i)
         {
-		  v25 = v23[i].uNumFaces == 0;//*(int *)&v23->pModelName[v24] == 0;
-		  v26 = v23[i].uNumFaces < 0;//*(int *)&v23->pModelName[v24] < 0;
-          if ( !(v26 | v25) )
+		  //v25 = v23[i].uNumFaces == 0;//*(int *)&v23->pModelName[v24] == 0;
+		 // v26 = v23[i].uNumFaces < 0;//*(int *)&v23->pModelName[v24] < 0;
+          if ( pOutdoor->pBModels[i].uNumFaces>0)
           {
             v68 = 0;
 			for (int j =  0; j < pOutdoor->pBModels[i].uNumFaces;++j)//*(int *)&pOutdoor->pBModels->pModelName[v24]; ++j)
             {
 			  v38 = &(v23[i].pFaces[j].uAttributes); //(char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28;				 
-              memcpy(v22, v38, 4);
+              memcpy(data_write_pos, v38, 4);
               v23 = pOutdoor->pBModels;
               v68 += 154;
-              v22 = (char *)v22 + 4;
+              data_write_pos += 4;
             }
            }
           v24 += 188;
@@ -539,55 +534,56 @@
         v66 = &pLevelDecorations[0].field_2;
         for (int i = 0; i <= (signed int)uNumLevelDecorations; ++i)
         {
-          memcpy(v22, v66, 2);
+          memcpy(data_write_pos, v66, 2);
           v66 += 16;
-          v22 = (char *)v22 + 2;
+          data_write_pos += 2;
         }
       }
-      memcpy(v22, &uNumActors, 4);
-      v28 = (char *)v22 + 4;
-      memcpy(v28, pActors, 836 * uNumActors);
-      v29 = (char *)v28 + 836 * uNumActors;
-      memcpy(v29, &uNumSpriteObjects, 4);
-      v29 = (char *)v29 + 4;
-      memcpy(v29, pSpriteObjects, 112 * uNumSpriteObjects);
-      v30 = (char *)v29 + 112 * uNumSpriteObjects;
-      memcpy(v30, &uNumChests, 4);
-      v30 = (char *)v30 + 4;
-      memcpy(v30, pChests, 5324 * uNumChests);
-      v31 = (char *)v30 + 5324 * uNumChests;
-      memcpy(v31, &stru_5E4C90, 0xC8);
-      v17 = (int)((char *)v31 + 200);
-      memcpy((void *)v17, &pOutdoor->uLastVisitDay, 0x38);
-      v9 = (int)v71;
+      memcpy(data_write_pos, &uNumActors, 4);
+      data_write_pos += 4;
+      memcpy(data_write_pos, pActors, 836 * uNumActors);
+      data_write_pos +=  836 * uNumActors;
+      memcpy(data_write_pos, &uNumSpriteObjects, 4);
+      data_write_pos += 4;
+      memcpy(data_write_pos, pSpriteObjects, 112 * uNumSpriteObjects);
+      data_write_pos += 112 * uNumSpriteObjects;
+      memcpy(data_write_pos, &uNumChests, 4);
+      data_write_pos += 4;
+      memcpy(data_write_pos, pChests, 5324 * uNumChests);
+      data_write_pos += 5324 * uNumChests;
+      memcpy(data_write_pos, &stru_5E4C90, 0xC8);
+      data_write_pos += 200;
+      memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
+      data_write_pos += 56;
+
+      //compressed_buf = (int)v71;
     }
-    v32 = v17 + 56;
     strcpy(Source, pCurrentMapName);
     _splitpath(Source, Drive, Dir, Filename, Ext);
     v48 = 100;
-    Size = v32 - (int)DstBuf;
-    v69 = 999984;
-    LOBYTE(v33) = zlib::MemZip((char *)v9 + 16, (unsigned int *)&v69, DstBuf, v32 - (int)DstBuf);
-    if ( v33 || (signed int)v69 > (signed int)Size )
+    Size = (int)data_write_pos - (int)uncompressed_buff;
+    compressed_block_size = 999984;
+    LOBYTE(v33) = zlib::MemZip((char *)compressed_buf + 16, (unsigned int *)&compressed_block_size, uncompressed_buff,Size);
+    if ( v33 || (signed int)compressed_block_size > (signed int)Size )
     {
-      memcpy((void *)(v9 + 16), DstBuf, Size);
-      v69 = Size;
+      memcpy((void *)(compressed_buf + 16), uncompressed_buff, Size);
+      compressed_block_size = Size;
     }
-    v69 += 16;
-    memcpy((void *)(v9 + 8), &v69, 4);
-    memcpy((void *)(v9 + 12), &Size, 4);
+    compressed_block_size += 16;
+    memcpy(&((SaveDataHeader *)compressed_buf)->compressed_size, &compressed_block_size, 4);
+    memcpy(&((SaveDataHeader *)compressed_buf)->uncompressed_size, &Size, 4);
     sprintf(Source, "%s%s", &Filename, &Ext);
-    strcpy((char *)&pDir, Source);
-    pDir.uDataSize = v69;
-    if ( pNew_LOD->Write(&pDir, (const void *)v9, 0) )
+    strcpy((char *)&pLodDirectory, Source);
+    pLodDirectory.uDataSize = compressed_block_size;
+    if ( pNew_LOD->Write(&pLodDirectory, (const void *)compressed_buf, 0) )
     {
       sprintf(Str, pGlobalTXT_LocalizationStrings[612], 208);
       MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
     }
-    free((void *)v9);
+    free((void *)compressed_buf);
   }
-  free(DstBuf);
-  if ( a1 )
+  free(uncompressed_buff);
+  if ( IsAutoSAve )
   {
     if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
     {
@@ -602,9 +598,7 @@
   pParty->vPosition.z = v62;
   pParty->uFallStartY = v62;
   pParty->sRotationY = v53;
-  result = v54;
   pParty->sRotationX = v54;
-  return result;
 }
 
 
--- a/SpriteObject.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/SpriteObject.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -17,7 +17,7 @@
 #include "mm7_data.h"
 
 size_t uNumSpriteObjects;
-SpriteObject pSpriteObjects[1000];
+SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS];
 
 //----- (00404828) --------------------------------------------------------
 SpriteObject::SpriteObject()
@@ -83,7 +83,7 @@
     v21 = v6;
   }
   while ( (signed int)v7 < (signed int)((char *)&pObjectList->uNumObjects + 2) );*/
-  for (uint i = 0; i < 1000; ++i)
+  for (uint i = 0; i < MAX_SPRITE_OBJECTS; ++i)
     if (!pSpriteObjects[i].uObjectDescID)
     {
       v6 = i;
@@ -1100,3 +1100,17 @@
     }
   }
 }
+
+
+//----- (0042FA22) --------------------------------------------------------
+void CompactLayingItemsList()
+    {
+    int new_obj_pos=0;
+
+    for (int i=0; i<MAX_SPRITE_OBJECTS; ++i)
+        {
+        if (pSpriteObjects[i].uObjectDescID)
+            memcpy(&pSpriteObjects[new_obj_pos++], &pSpriteObjects[i],sizeof(SpriteObject));
+        }
+    uNumSpriteObjects = new_obj_pos;
+    }
\ No newline at end of file
--- a/SpriteObject.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/SpriteObject.h	Tue Mar 26 00:57:54 2013 +0400
@@ -7,7 +7,7 @@
   OBJECT_ATTACHED_TO_ACTOR = 0x80,
 };
 
-
+#define MAX_SPRITE_OBJECTS 1000
 /*   72 */
 #pragma pack(push, 1)
 struct SpriteObject
@@ -52,4 +52,4 @@
 
 
 extern size_t uNumSpriteObjects;
-extern SpriteObject pSpriteObjects[1000];
\ No newline at end of file
+extern SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS];
\ No newline at end of file
--- a/Time.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/Time.h	Tue Mar 26 00:57:54 2013 +0400
@@ -1,6 +1,8 @@
 #pragma once
 
 
+
+
 /*   61 */
 #pragma pack(push, 1)
 struct Timer
--- a/Weather.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/Weather.h	Tue Mar 26 00:57:54 2013 +0400
@@ -1,7 +1,17 @@
 #pragma once
 
 
-
+#pragma pack(push, 1)
+struct LocationTime_stru1
+    {
+    unsigned __int64 uLastVisitDay;
+    char sky_texture_name[12];
+    int day_attrib;
+    int day_fogrange_1;
+    int day_fogrange_2;
+    char field_2F4[24];
+    };
+#pragma pack(pop)
 
 
 
--- a/mm7_2.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/mm7_2.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -6256,8 +6256,8 @@
 }
 
 //----- (0045E03A) --------------------------------------------------------
-unsigned __int16 *__fastcall MakeScreenshot(signed int width, signed int height)
-{
+unsigned short * MakeScreenshot( signed int width, signed int height )
+    {
   signed int v2; // edi@1
   unsigned __int16 *v3; // ebx@1
   int v4; // edx@7
@@ -6293,7 +6293,8 @@
   v23 = 452.0 / (double)width;
   v25 = 336.0 / (double)height;
   pPixels = (unsigned __int16 *)malloc(2 * height * width);
-  v3 = pPixels;
+  memset(pPixels,0,2 * height * width);
+  /*v3 = pPixels;
   if ( pRenderer->pRenderD3D )
   {
     pRenderer->BeginSceneD3D();
@@ -6421,7 +6422,7 @@
       }
     }
     pRenderer->EndScene();
-  }
+  }*/
   return pPixels;
 }
 
--- a/mm7_3.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/mm7_3.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -11963,7 +11963,7 @@
 		else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
 		{
 			v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
-			v20 = pOutdoor->uLastVisitDay;
+			v20 = pOutdoor->loc_time.uLastVisitDay;
 			if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
 				v20 = pIndoor->stru1.uLastVisitDay;
 
--- a/mm7_6.cpp	Mon Mar 25 14:56:50 2013 +0200
+++ b/mm7_6.cpp	Tue Mar 26 00:57:54 2013 +0400
@@ -8290,39 +8290,7 @@
   }
 }
 
-//----- (0042FA22) --------------------------------------------------------
-SpriteObject *__cdecl sub_42FA22_mess_with_laying_item_list()
-{
-  size_t v0; // edx@1
-  int v1; // ebp@1
-  SpriteObject *result; // eax@1
-  SpriteObject *v3; // ebx@1
-
-  v0 = 0;
-  v1 = 0;
-  //result = (char *)&pSpriteObjects[0].uObjectDescID;
-  result = pSpriteObjects;
-  v3 = pSpriteObjects;
-  do
-  {
-	if ( result->uObjectDescID )
-    {
-      if ( v1 != v0 )
-      {
-        memcpy(v3, result, 0x70u);
-        result->uObjectDescID = 0;
-      }
-      ++v0;
-      ++v3;// = (char *)v3 + 112;
-    }
-    ++result;// += 112;
-    ++v1;
-  }
-  //while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) );
-  while( result <= &pSpriteObjects[999] );
-  uNumSpriteObjects = v0;
-  return result;
-}
+
 
 //----- (0042FA66) --------------------------------------------------------
 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
--- a/mm7_data.h	Mon Mar 25 14:56:50 2013 +0200
+++ b/mm7_data.h	Tue Mar 26 00:57:54 2013 +0400
@@ -1761,7 +1761,7 @@
 signed int __cdecl sub_42F4DA();
 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9);
 void __fastcall sub_42F960_create_object(int x, int y, int z); // idb
-SpriteObject *__cdecl sub_42FA22_mess_with_laying_item_list();
+void CompactLayingItemsList();
 signed int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6);
 bool __fastcall sub_42FB5C(signed int a1);
 // int __cdecl crt_sub_42FBB7();
@@ -1896,12 +1896,12 @@
 unsigned int __fastcall SkillToMastery(unsigned __int16 a1);
 unsigned int __fastcall GetSpellColor(signed int a1);
 void *__thiscall unknown_vdtor_6(void *_this, bool a2);
-unsigned __int16 *__fastcall MakeScreenshot(signed int width, signed int height);
+unsigned short * MakeScreenshot(signed int width, signed int height);
 void __thiscall SaveScreenshot(const char *pFilename);
 void __fastcall GameUI_DrawLoadMenu(unsigned int uDialogueType); // idb
 void __cdecl GameUI_DrawSaveMenu();
 void __fastcall LoadGame(unsigned int uSlot); // idb
-int __fastcall SaveGame(int a1, __int16 *a2);
+void SaveGame(bool IsAutoSAve, bool NotSaveWorld);
 void __fastcall DoSavegame(unsigned int uSlot); // idb
 void GameUI_MainMenu_DoDrawLoad(int a1);
 void GameUI_MainMenu_DrawLoad();