changeset 107:ccc0cf95706a

Слияние
author Ritor1
date Mon, 05 Nov 2012 09:16:17 +0600
parents 1e18102bd4d0 (current diff) 67f843a23f8b (diff)
children d543bd89a31e
files Outdoor.cpp Outdoor.h SaveLoad.cpp VideoPlayer.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp
diffstat 17 files changed, 969 insertions(+), 873 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/AudioPlayer.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -1616,7 +1616,7 @@
         return;
       }
       v59 = v2;
-      if ( pNumSoundDecorations <= v2 )
+      if ( _6807E0_num_decorations_with_sounds_6807B8 <= v2 )
         return;
       while ( 1 )
       {
@@ -1630,7 +1630,7 @@
           break;
 LABEL_89:
         ++v59;
-        if ( v59 >= pNumSoundDecorations )
+        if ( v59 >= _6807E0_num_decorations_with_sounds_6807B8 )
           return;
       }
       v48 = &pDecorationList->pDecorations[v44->uDecorationDescID];
--- a/GameUIs.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/GameUIs.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -1,5 +1,6 @@
 #include <direct.h>
 #include <io.h>
+#include <assert.h>
 
 #include "GUIWindow.h"
 #include "GUIFont.h"
@@ -15,18 +16,18 @@
 {
   unsigned int v1; // ebp@5
   unsigned int v2; // eax@5
-  signed int v3; // ebp@11
+  //signed int v3; // ebp@11
   FILE *v4; // eax@14
   FILE *v5; // eax@18
   unsigned int v6; // eax@25
   GUIButton *v7; // eax@27
   const char *v8; // [sp-8h] [bp-26Ch]@25
-  char *v9; // [sp-4h] [bp-268h]@19
+  //char *v9; // [sp-4h] [bp-268h]@19
   enum TEXTURE_TYPE v10; // [sp-4h] [bp-268h]@25
   unsigned int uDialogueType_; // [sp+10h] [bp-254h]@1
-  RGBTexture *pTex; // [sp+10h] [bp-254h]@12
-  SavegameHeader *Dest; // [sp+14h] [bp-250h]@12
-  const char *Str1; // [sp+18h] [bp-24Ch]@12
+  //RGBTexture *pTex; // [sp+10h] [bp-254h]@12
+  //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12
+  //const char *Str1; // [sp+18h] [bp-24Ch]@12
   LODWriteableFile v15; // [sp+1Ch] [bp-248h]@1
   int v16; // [sp+260h] [bp-4h]@1
 
@@ -51,7 +52,7 @@
     pRenderer->DrawTextureIndexed(
       8u,
       8u,
-      (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+      (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
     if ( pCurrentScreen == 11 )
     {
       v1 = uTextureID_save_up;
@@ -67,7 +68,7 @@
     pRenderer->DrawTextureIndexed(
       351u,
       302u,
-      (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0));
+      (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
   }
   else
   {
@@ -90,46 +91,55 @@
     uLoadGameUI_SelectedSlot = 0;
   }
   v15.AllocSubIndicesAndIO(0x12Cu, 0);
-  v3 = 0;
-  if ( (signed int)uNumSavegameFiles > 0 )
+
+  assert(sizeof(SavegameHeader) == 0x64);
+
+  //v3 = 0;
+  for (uint i = 0; i < uNumSavegameFiles; ++i)
   {
-    Dest = pSavegameHeader;
-    pTex = pSavegameThumbnails;
-    Str1 = (const char *)pSavegameList->pSavesNames;
-    while ( 1 )
+    //Dest = pSavegameHeader;
+    //pTex = pSavegameThumbnails;
+    //Str1 = (const char *)pSavegameList->pSavesNames;
+    //while ( 1 )
+    //{
+    sprintf(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[i]);
+    if (_access(pTmpBuf, 6))
     {
-      sprintf(pTmpBuf, "saves\\%s", Str1);
-      if ( _access(pTmpBuf, 6) )
-        break;
-      v15.LoadFile(pTmpBuf, 1);
-      v4 = v15.FindContainer("header.bin", true);
-      if ( v4 )
-        fread(Dest, 0x64u, 1u, v4);
-      if ( !_strcmpi(Str1, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7"
-        strcpy(Dest->pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave"
-      v5 = v15.FindContainer("image.pcx", true);
-      if ( !v5 )
-      {
-        v9 = "";
-LABEL_22:
-        pSavegameUsedSlots[v3] = 0;
-        strcpy(Dest->pName, v9);
-        goto LABEL_23;
-      }
-      pTex->LoadFromFILE(v5, 0, true);
+      pSavegameUsedSlots[i] = 0;
+      strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty"
+      continue;
+    }
+
+    v15.LoadFile(pTmpBuf, 1);
+    v4 = v15.FindContainer("header.bin", true);
+    if ( v4 )
+      fread(&pSavegameHeader[i], 0x64u, 1u, v4);
+    if ( !_strcmpi(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7"
+      strcpy(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[16]);// "Autosave"
+
+    v5 = v15.FindContainer("image.pcx", true);
+    if ( !v5 )
+    {
+      pSavegameUsedSlots[i] = 0;
+      strcpy(pSavegameList->pSavesNames[i], "");
+    }
+    else
+    {
+      pSavegameThumbnails[i].LoadFromFILE(v5, 0, true);
       v15.CloseWriteFile();
-      pSavegameUsedSlots[v3] = 1;
-LABEL_23:
-      Str1 += 280;
-      ++pTex;
-      ++Dest;
-      ++v3;
-      if ( v3 >= (signed int)uNumSavegameFiles )
-        goto LABEL_24;
+      pSavegameUsedSlots[i] = 1;
     }
-    v9 = pGlobalTXT_LocalizationStrings[72];    // "Empty"
-    goto LABEL_22;
+//LABEL_23:
+      //Str1 += 280;
+      //++pTex;
+      //++Dest;
+      //++v3;
+      //if ( v3 >= (signed int)uNumSavegameFiles )
+      //  goto LABEL_24;
+    //}
+    //goto LABEL_22;
   }
+
 LABEL_24:
   v15.FreeSubIndexAndIO();
   if ( pCurrentScreen == 11 )
--- a/Indoor.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/Indoor.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -67,7 +67,7 @@
 
 
 //----- (0043F39E) --------------------------------------------------------
-void __fastcall sub_43F39E(IndoorLocation_drawstru *_this)
+void __fastcall PrepareDrawLists_BLV(IndoorLocation_drawstru *_this)
 {
   //int *v1; // ecx@1
   //double v2; // ST30_8@3
@@ -93,10 +93,9 @@
   {
     //v2 = pParty->flt_TorchlightColorB + 6.7553994e15;
     //v11 = LOBYTE(v2);
-    if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime <= 0 )
-      v5 = 800;
-    else
-      v5 = 800 * pParty->pPartyBuffs[16].uPower;
+    v5 = 800;
+    if (pParty->TorchlightActive())
+      v5 *= pParty->pPartyBuffs[16].uPower;
     //LOBYTE(v1) = byte_4E94D0;
     //v4 = pParty->flt_TorchlightColorR + 6.7553994e15;
     //v3 = pParty->flt_TorchlightColorG + 6.7553994e15;
@@ -310,7 +309,7 @@
   signed int v6; // [sp+8h] [bp-8h]@7
   int v7; // [sp+Ch] [bp-4h]@8
 
-  sub_43F39E(_this);
+  PrepareDrawLists_BLV(_this);
   if (pBLVRenderParams->uPartySectorID)
     IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0);
   pRenderer->DrawBillboardList_BLV();
@@ -325,7 +324,7 @@
       if ( (signed int)pStru170->std__vector_000FA8 > 0 )
       {
         v7 = 0;
-        v2 = (char *)&pStru170->field_FA8[0].field_C.field_4;
+        v2 = (char *)&pStru170->field_FA8[0].field_C._viewport_space_w;
         do
         {
           v3 = *((int *)v2 - 1);
@@ -453,8 +452,8 @@
   //char v21; // dl@27
   //unsigned int v22; // eax@44
   unsigned int v23; // eax@35
-  DWORD v24; // eax@37
-  int v25; // eax@38
+  //DWORD v24; // eax@37
+  //int v25; // eax@38
   //char *v26; // edi@38
   IDirect3DTexture2 *v27; // eax@42
   Texture *v28; // [sp+Ch] [bp-1Ch]@15
@@ -503,7 +502,7 @@
       static_vertices_F7C228[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y;
       static_vertices_F7C228[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z;
       static_vertices_F7C228[i].u = (signed short)pFace->pVertexUIDs[i];
-      static_vertices_F7C228[i].v = (signed short)pFace->pVertexUIDs[i];
+      static_vertices_F7C228[i].v = (signed short)pFace->pVertexVIDs[i];
     }
 
     if (!pVertices ||
@@ -568,19 +567,21 @@
 
         if (pFace->Animated())
         {
-          v24 = GetTickCount() / 4;
-          v25 = v24 - stru_5C6E00->uIntegerHalfPi;
-
+          //auto v24 = GetTickCount() / 4;
+          //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi;
+          uint eightSeconds = GetTickCount() % 8000;
+          float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f;
+
+          //animte lava back and forth
           for (uint i = 0; i < uNumVerticesa; ++i)
-            array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
+            //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
+            array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle);
 
           v23 = pFace->uBitmapID;
           goto LABEL_42;
         }
-        else
+        else if (pFace->uAttributes & 0x4000)
         {
-          if (pFace->uAttributes & 0x4000)
-          {
             v23 = pTextureFrameTable->GetFrameTexture(
                             pFace->uBitmapID,
                             pBLVRenderParams->field_0_timer_);
@@ -591,7 +592,6 @@
                     else
                       pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0);
                     return;
-          }
         }
       }
     }
@@ -872,7 +872,7 @@
                 v23 = 640 * stru_F8A590._viewport_space_y;
                 v119 = 640 * stru_F8A590._viewport_space_y;
                 v100 = v22;
-                if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 )
+                if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
                 {
                   v24 = 2 * stru_F8A590._viewport_space_y;
                   v120 = 2 * stru_F8A590._viewport_space_y;
@@ -1196,7 +1196,7 @@
                     v24 += 2;
                     v120 = v24;
                     v119 = v23;
-                    if ( a2 > stru_F8A590.field_4 )
+                    if ( a2 > stru_F8A590._viewport_space_w )
                       break;
                     v21 = a2;
                   }
@@ -1645,7 +1645,7 @@
           {
             v4 = stru_F8A590._viewport_space_y;
             v5 = pBLVRenderParams->pRenderTarget;
-            if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 )
+            if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
             {
               v6 = 640 * stru_F8A590._viewport_space_y;
               do
@@ -1656,7 +1656,7 @@
                 v5[v7] = -1;
                 ++v4;
               }
-              while ( v4 <= stru_F8A590.field_4 );
+              while ( v4 <= stru_F8A590._viewport_space_w );
             }
           }
         }
@@ -2026,7 +2026,7 @@
 
   //v5 = 0;
   //v6 = this;
-  pNumSoundDecorations = 0;
+  _6807E0_num_decorations_with_sounds_6807B8 = 0;
 
   #pragma region "loading from txt"
   /*sprintf(FileName, "levels\\%s", pFilename);
@@ -4610,10 +4610,10 @@
     pDecorationList->InitializeDecorationSprite(pDecortaion->uDecorationDescID);
 
     v15 = pDecorationList->pDecorations[pDecortaion->uDecorationDescID].uSoundID;
-    if (v15 && pNumSoundDecorations < 9)
+    if (v15 && _6807E0_num_decorations_with_sounds_6807B8 < 9)
     {
         pSoundList->_4A9A67(v15, 0);
-        v16 = pNumSoundDecorations++;
+        v16 = _6807E0_num_decorations_with_sounds_6807B8++;
         _6807B8_level_decorations_ids[v16] = i;
     }
 
--- a/Indoor_stuff.h	Mon Nov 05 09:15:53 2012 +0600
+++ b/Indoor_stuff.h	Mon Nov 05 09:16:17 2012 +0600
@@ -8,10 +8,10 @@
 #pragma pack(push, 1)
 struct stru170_stru2
 {
-  __int16 *_43F9E1(__int16 x, int y, __int16 z, int w);
+  void _43F9E1(__int16 x, int y, __int16 z, int w);
 
   int _viewport_space_y;
-  int field_4;
+  int _viewport_space_w;
   int field_8;
   int field_C;
   int field_10;
--- a/Outdoor.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/Outdoor.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -1,3 +1,5 @@
+#include <assert.h>
+
 #include "Outdoor.h"
 #include "Party.h"
 #include "LayingItem.h"
@@ -366,7 +368,7 @@
   {
     v12 = (unsigned __int8)aTiletableLoadU[v10 + 39];
     uDefaultTravelTime_ByFoot = (unsigned __int8)byte_4ECA93[v10];
-    sprintf(pOut, "out%02d.odm", v12);
+    sprintfex(pOut, "out%02d.odm", v12);
     uLevel_StartingPointType = (unsigned __int8)byte_4ECACF[v10];
     return 1;
   }
@@ -703,28 +705,27 @@
 //----- (0047C7C2) --------------------------------------------------------
 void OutdoorLocationTerrain::Release()
 {
-  OutdoorLocationTerrain *v1; // esi@1
-  void *v2; // ST00_4@1
-  void *v3; // ST00_4@1
-  void *v4; // ST00_4@1
+  if (pHeightmap)
+  {
+    pAllocator->FreeChunk(this->pHeightmap);
+    pHeightmap = nullptr;
+  }
+  if (pTilemap)
+  {
+    pAllocator->FreeChunk(pTilemap);
+    pTilemap = nullptr;
+  }
+  if (pAttributemap)
+  {
+    pAllocator->FreeChunk(pAttributemap);
+    pAttributemap = nullptr;
+  }
+  if (ptr_C)
+  {
+    pAllocator->FreeChunk(ptr_C);
+    ptr_C = nullptr;
+  }
 
-  v1 = this;
-  pAllocator->FreeChunk(this->pHeightmap);
-  v2 = v1->pTilemap;
-  v1->pHeightmap = 0;
-  pAllocator->FreeChunk(v2);
-  v3 = v1->pAttributemap;
-  v1->pTilemap = 0;
-  if (v3)
-	{
-	pAllocator->FreeChunk(v3);
-	v3 = nullptr;
-	}
-  //pAllocator->FreeChunk(v3); 
-  v4 = v1->ptr_C;
-  v1->pAttributemap = 0;
-  pAllocator->FreeChunk(v4);
-  v1->ptr_C = 0;
   _47C7A9();
 }
 
@@ -1093,7 +1094,7 @@
   v1->pOMAP = (unsigned int *)v4;
   memset(v4, 0, 0x10000u);
   v5 = v1->pFaceIDLIST;
-  v1->field_DC = 0;
+  v1->numFaceIDListElems = 0;
   pAllocator->FreeChunk(v5);
   v1->pFaceIDLIST = 0;
   v6 = pAllocator->AllocNamedChunk(0, 2u, "IDLIST");
@@ -1116,56 +1117,66 @@
 //----- (0047CF9C) --------------------------------------------------------
 void OutdoorLocation::Release()
 {
-  OutdoorLocation *v1; // esi@1
-  signed int v2; // edi@1
-  int v3; // ebx@2
-  void *v4; // ST24_4@4
-  char *v5; // ebx@4
-  void **v6; // esi@4
+  //OutdoorLocation *v1; // esi@1
+  //signed int v2; // edi@1
+  //int v3; // ebx@2
+  //void *v4; // ST24_4@4
+  //char *v5; // ebx@4
+  //void **v6; // esi@4
 
-  v1 = this;
-  strcpy(this->pLevelFilename, "blank");
-  strcpy(v1->pLocationFileName, "default.odm");
-  strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00");
-  strcpy(v1->pSkyTextureName, "sky043");
-  strcpy(v1->pGroundTileset, "hm005");
-  v2 = 0;
-  if ( (signed int)v1->uNumBModels > 0 )
+  //v1 = this;
+  strcpy(pLevelFilename, "blank");
+  strcpy(pLocationFileName, "default.odm");
+  strcpy(pLocationFileDescription, "MM6 Outdoor v1.00");
+  strcpy(pSkyTextureName, "sky043");
+  strcpy(pGroundTileset, "hm005");
+
+  if (pBModels)
+  {
+    for (uint i = 0; i < uNumBModels; ++i)
+      pBModels[i].Release();
+
+    pAllocator->FreeChunk(pBModels);
+    pBModels = nullptr;
+    uNumBModels = 0;
+  }
+
+  if (pSpawnPoints)
   {
-    v3 = 0;
-    do
-    {
-      ((BSPModel *)((char *)&v1->pBModels[v3] + 68))->Release();
-      ++v2;
-      ++v3;
-    }
-    while ( v2 < (signed int)v1->uNumBModels );
+    pAllocator->FreeChunk(pSpawnPoints);
+    pSpawnPoints = nullptr;
+  }
+  uNumSpawnPoints = 0;
+
+  pTerrain.Release();
+
+  if (ptr_D4)
+  {
+    pAllocator->FreeChunk(ptr_D4);
+    ptr_D4 = nullptr;
   }
-  v1->uNumBModels = 0;
-  v4 = v1->pBModels;
-  v1->uNumSpawnPoints = 0;
-  pAllocator->FreeChunk(v4);
-  pAllocator->FreeChunk(v1->pSpawnPoints);
-  v1->pBModels = 0;
-  v1->pSpawnPoints = 0;
-  v1->pTerrain.Release();
-  pAllocator->FreeChunk(v1->ptr_D4);
-  v1->ptr_D4 = 0;
-  v5 = (char *)&v1->pOMAP;
-  pAllocator->FreeChunk(v1->pOMAP);
-  v6 = (void **)&v1->pFaceIDLIST;
-  *(int *)v5 = 0;
-  pAllocator->FreeChunk(*v6);
-  *v6 = 0;
-  pAllocator->FreeChunk(pTerrainNormals);
-  pTerrainNormals = 0;
+  if (pOMAP)
+  {
+    pAllocator->FreeChunk(pOMAP);
+    pOMAP = nullptr;
+  }
+  if (pFaceIDLIST)
+  {
+    pAllocator->FreeChunk(pFaceIDLIST);
+    pFaceIDLIST = nullptr;
+  }
+  if (pTerrainNormals)
+  {
+    pAllocator->FreeChunk(pTerrainNormals);
+    pTerrainNormals = nullptr;
+  }
 }
 
 //----- (0047D0A6) --------------------------------------------------------
 bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa)
 {
-  OutdoorLocation *pOutdoorLocation; // esi@1
-  bool result; // eax@9
+  //OutdoorLocation *pOutdoorLocation; // esi@1
+  /*bool result; // eax@9
   bool v7; // ebx@9
   size_t v8; // eax@10
   void *v9; // eax@10
@@ -1184,8 +1195,8 @@
   ODMFace *v22; // ebx@26
   LayingItem *pItems; // ecx@27
   unsigned int v24; // eax@28
-  unsigned __int8 v25; // zf@28
-  unsigned __int8 v26; // sf@28
+  //unsigned __int8 v25; // zf@28
+  //unsigned __int8 v26; // sf@28
   ODMFace *v27; // eax@28
   const char *i; // edx@29
   unsigned __int16 v29; // ax@33
@@ -1196,81 +1207,81 @@
   TileDesc *v34; // eax@43
   unsigned int v35; // eax@43
   unsigned int v36; // edi@43
-  unsigned int v37; // edi@45
-  size_t v38; // eax@50
+  unsigned int v37; // edi@45*/
+  //size_t v38; // eax@50
   FILE *v39; // eax@50
-  unsigned int v40; // edi@56
-  void *v41; // eax@56
-  void *v42; // ebx@56
-  const void *v43; // ebx@59
-  const void *v44; // ebx@59
-  unsigned int v45; // eax@59
-  BSPModel *v46; // eax@59
-  unsigned int v47; // ecx@59
-  int v48; // ebx@60
-  BSPModel *v49; // eax@61
-  BSPModel *v50; // eax@61
-  BSPModel *v51; // eax@61
-  BSPModel *v52; // eax@61
-  BSPModel *v53; // eax@61
-  BSPModel *v54; // ecx@61
-  BSPModel *v55; // ecx@61
-  BSPModel *v56; // ecx@61
-  void *v57; // ST24_4@61
-  BSPModel *v58; // ecx@61
-  void *v59; // ST18_4@61
-  BSPModel *v60; // eax@61
-  __int16 v61; // ax@64
+  //unsigned int v40; // edi@56
+  //void *v41; // eax@56
+  //void *v42; // ebx@56
+  //const void *v43; // ebx@59
+  //const void *v44; // ebx@59
+  //unsigned int v45; // eax@59
+  //BSPModel *v46; // eax@59
+  //unsigned int v47; // ecx@59
+  //int v48; // ebx@60
+  //BSPModel *v49; // eax@61
+  //BSPModel *v50; // eax@61
+  //BSPModel *v51; // eax@61
+  //BSPModel *v52; // eax@61
+  //BSPModel *v53; // eax@61
+  //BSPModel *v54; // ecx@61
+  //BSPModel *v55; // ecx@61
+  //BSPModel *v56; // ecx@61
+  //void *v57; // ST24_4@61
+  //BSPModel *v58; // ecx@61
+  //void *v59; // ST18_4@61
+  //BSPModel *v60; // eax@61
+  //__int16 v61; // ax@64
   unsigned __int16 v62; // ax@65
-  ODMFace *v63; // ecx@65
-  unsigned __int16 v64; // ax@80
-  const char *v65; // ecx@80
-  int v66; // eax@81
-  void *v67; // eax@81
-  int v68; // ecx@81
-  void *v69; // eax@81
-  unsigned int v70; // eax@81
-  SpawnPointMM7 *v71; // eax@81
-  unsigned int v72; // ecx@81
-  size_t v73; // eax@81
-  int v74; // edi@87
-  void *v75; // edi@88
-  unsigned int v76; // edx@94
-  int v77; // ecx@94
-  char *v78; // eax@95
-  unsigned int v79; // edx@97
-  unsigned int v80; // eax@99
-  int v81; // eax@107
-  void *v82; // edi@114
-  size_t v83; // eax@120
-  const void *v84; // edi@120
-  const void *v85; // edi@120
-  BSPModel *v86; // eax@124
-  unsigned int v87; // eax@124
-  BSPModel *v88; // eax@126
-  BSPModel *v89; // eax@127
-  ODMFace *v90; // eax@129
-  const void *v91; // edi@138
-  const void *v92; // edi@141
-  const void *v93; // edi@141
-  const void *v94; // edi@144
-  const void *v95; // edi@144
-  const char *v96; // edi@147
-  unsigned int v97; // eax@147
-  TileDesc *v98; // eax@147
-  unsigned int v99; // eax@147
-  int v100; // ecx@150
-  unsigned int v101; // eax@157
+  //ODMFace *v63; // ecx@65
+  //unsigned __int16 v64; // ax@80
+  //const char *v65; // ecx@80
+  //int v66; // eax@81
+  //void *v67; // eax@81
+  //int v68; // ecx@81
+  //void *v69; // eax@81
+  //unsigned int v70; // eax@81
+  //SpawnPointMM7 *v71; // eax@81
+  //unsigned int v72; // ecx@81
+  //size_t v73; // eax@81
+  //int v74; // edi@87
+  //void *v75; // edi@88
+  //unsigned int v76; // edx@94
+  //int v77; // ecx@94
+  //char *v78; // eax@95
+  //unsigned int v79; // edx@97
+  //unsigned int v80; // eax@99
+  //int v81; // eax@107
+  //void *v82; // edi@114
+  //size_t v83; // eax@120
+  //const void *v84; // edi@120
+  //const void *v85; // edi@120
+  //BSPModel *v86; // eax@124
+  //unsigned int v87; // eax@124
+  //BSPModel *v88; // eax@126
+  //BSPModel *v89; // eax@127
+  //ODMFace *v90; // eax@129
+  //const void *v91; // edi@138
+  //const void *v92; // edi@141
+  //const void *v93; // edi@141
+  //const void *v94; // edi@144
+  //const void *v95; // edi@144
+  //const char *v96; // edi@147
+  //unsigned int v97; // eax@147
+  //TileDesc *v98; // eax@147
+  //unsigned int v99; // eax@147
+  //int v100; // ecx@150
+  //unsigned int v101; // eax@157
   int v102; // edi@159
-  void *v103; // [sp-14h] [bp-B94h]@55
-  void *v104; // [sp-10h] [bp-B90h]@59
-  size_t v105; // [sp-Ch] [bp-B8Ch]@59
-  char *v106; // [sp-8h] [bp-B88h]@59
+  //void *v103; // [sp-14h] [bp-B94h]@55
+  //void *v104; // [sp-10h] [bp-B90h]@59
+  //size_t v105; // [sp-Ch] [bp-B8Ch]@59
+  //char *v106; // [sp-8h] [bp-B88h]@59
   int v107; // [sp-4h] [bp-B84h]@12
   int v108; // [sp+0h] [bp-B80h]@10
   char Src[968]; // [sp+10h] [bp-B70h]@110
   char Dst[968]; // [sp+3D8h] [bp-7A8h]@50
-  char Str[256]; // [sp+7A0h] [bp-3E0h]@50
+  /*char Str[256]; // [sp+7A0h] [bp-3E0h]@50
   char DstBuf; // [sp+8A0h] [bp-2E0h]@10
   __int32 Offset; // [sp+8A4h] [bp-2DCh]@10
   __int32 v114; // [sp+8B0h] [bp-2D0h]@10
@@ -1295,53 +1306,54 @@
   __int32 v133; // [sp+994h] [bp-1ECh]@38
   __int32 v134; // [sp+9A0h] [bp-1E0h]@38
   __int32 v135; // [sp+9ACh] [bp-1D4h]@38
-  __int32 v136; // [sp+9D0h] [bp-1B0h]@10
-  char FileName[8]; // [sp+A20h] [bp-160h]@8
-  char v138; // [sp+A28h] [bp-158h]@12
-  int v139; // [sp+B1Ch] [bp-64h]@10
-  char pContainer[32]; // [sp+B20h] [bp-60h]@1
-  int *v141; // [sp+B40h] [bp-40h]@50
-  __int64 v142; // [sp+B44h] [bp-3Ch]@55
-  size_t pSource; // [sp+B4Ch] [bp-34h]@56
-  int v144; // [sp+B50h] [bp-30h]@61
-  int v145; // [sp+B54h] [bp-2Ch]@68
+  __int32 v136; // [sp+9D0h] [bp-1B0h]@10*/
+  //char FileName[8]; // [sp+A20h] [bp-160h]@8
+  //char v138; // [sp+A28h] [bp-158h]@12
+  //int v139; // [sp+B1Ch] [bp-64h]@10
+  //char pContainer[32]; // [sp+B20h] [bp-60h]@1
+  //int *v141; // [sp+B40h] [bp-40h]@50
+  //__int64 v142; // [sp+B44h] [bp-3Ch]@55
+  //size_t pSource; // [sp+B4Ch] [bp-34h]@56
+  //int v144; // [sp+B50h] [bp-30h]@61
+  //int v145; // [sp+B54h] [bp-2Ch]@68
   ODMHeader header; // [sp+B58h] [bp-28h]@50
-  unsigned int pDestLen; // [sp+B68h] [bp-18h]@13
-  FILE *ptr; // [sp+B6Ch] [bp-14h]@12
-  void *v149; // [sp+B70h] [bp-10h]@19
+  //unsigned int pDestLen; // [sp+B68h] [bp-18h]@13
+  //FILE *ptr; // [sp+B6Ch] [bp-14h]@12
+  //void *v149; // [sp+B70h] [bp-10h]@19
   char *Str2; // [sp+B74h] [bp-Ch]@12
-  int v151; // [sp+B78h] [bp-8h]@59
-  void *uSourceLen; // [sp+B7Ch] [bp-4h]@59
+  //int v151; // [sp+B78h] [bp-8h]@59
+  //void *uSourceLen; // [sp+B7Ch] [bp-4h]@59
 
-  pOutdoorLocation = this;
-  strcpy(pContainer, pFilename);
-  if ( bUnderwater )
+  //pOutdoorLocation = this;
+  //strcpy(pContainer, pFilename);
+
+  if (bUnderwater)
   {
-    pPaletteManager->pPalette_tintColor[0] = 0x10u;
-    pPaletteManager->pPalette_tintColor[1] = 0xC2u;
-    pPaletteManager->pPalette_tintColor[2] = 0x99u;
-    pPaletteManager->pPalette_mistColor[0] = 0x25u;
-    pPaletteManager->pPalette_mistColor[1] = 0x8Fu;
-    pPaletteManager->pPalette_mistColor[2] = 0x5Cu;
-LABEL_7:
-    pPaletteManager->RecalculateAll();
-    goto LABEL_8;
+    pPaletteManager->pPalette_tintColor[0] = 0x10;
+    pPaletteManager->pPalette_tintColor[1] = 0xC2;
+    pPaletteManager->pPalette_tintColor[2] = 0x99;
+    pPaletteManager->pPalette_mistColor[0] = 0x25;
+    pPaletteManager->pPalette_mistColor[1] = 0x8F;
+    pPaletteManager->pPalette_mistColor[2] = 0x5C;
   }
-  pPaletteManager->pPalette_tintColor[0] = 0;
-  pPaletteManager->pPalette_tintColor[1] = 0;
-  pPaletteManager->pPalette_tintColor[2] = 0;
-  if ( pPaletteManager->pPalette_mistColor[0] != 0x80u
-    || pPaletteManager->pPalette_mistColor[1] != 0x80u
-    || pPaletteManager->pPalette_mistColor[2] != 0x80u )
+  else
   {
-    pPaletteManager->pPalette_mistColor[0] = 0x80u;
-    pPaletteManager->pPalette_mistColor[1] = 0x80u;
-    pPaletteManager->pPalette_mistColor[2] = 0x80u;
-    goto LABEL_7;
+    pPaletteManager->pPalette_tintColor[0] = 0;
+    pPaletteManager->pPalette_tintColor[1] = 0;
+    pPaletteManager->pPalette_tintColor[2] = 0;
+    if (pPaletteManager->pPalette_mistColor[0] != 0x80 ||
+        pPaletteManager->pPalette_mistColor[1] != 0x80 ||
+        pPaletteManager->pPalette_mistColor[2] != 0x80)
+    {
+      pPaletteManager->pPalette_mistColor[0] = 0x80;
+      pPaletteManager->pPalette_mistColor[1] = 0x80;
+      pPaletteManager->pPalette_mistColor[2] = 0x80;
+      pPaletteManager->RecalculateAll();
+    }
   }
-LABEL_8:
-  pNumSoundDecorations = 0;
-  sprintf(FileName, "levels\\%s", pContainer);
+
+  _6807E0_num_decorations_with_sounds_6807B8 = 0;
+  /*sprintf(FileName, "levels\\%s", pContainer);
   if ( GetFileAttributesA(FileName) != -1 )
   {
     result = (bool)fopen(FileName, "rb");
@@ -1356,12 +1368,12 @@
     viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108);
     fread(&DstBuf, 0x180u, 1u, (FILE *)v7);
     fseek((FILE *)v7, Offset, 0);
-    fread(pOutdoorLocation, 0xB0u, 1u, (FILE *)v7);
-    pOutdoorLocation->LoadTileGroupIds();
-    pOutdoorLocation->_47F3EA();
-    strcpy(pOutdoorLocation->pGroundTileset, "grastyl");
+    fread(this, 0xB0u, 1u, (FILE *)v7);
+    LoadTileGroupIds();
+    _47F3EA();
+    strcpy(pGroundTileset, "grastyl");
     fseek((FILE *)v7, v114, 0);
-    fread(&pOutdoorLocation->uNumBModels, 4u, 1u, (FILE *)v7);
+    fread(&uNumBModels, 4u, 1u, (FILE *)v7);
     fseek((FILE *)v7, v115, 0);
     fread(&uNumLayingItems, 4u, 1u, (FILE *)v7);
     fseek((FILE *)v7, v116, 0);
@@ -1370,71 +1382,71 @@
     fread(&uNumActors, 4u, 1u, (FILE *)v7);
     fseek((FILE *)v7, v118, 0);
     fread(&uNumChests, 4u, 1u, (FILE *)v7);
-    pOutdoorLocation->pTerrain.Initialize();
+    pTerrain.Initialize();
     fseek((FILE *)v7, v119, 0);
-    fread(pOutdoorLocation->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7);
+    fread(pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7);
     fseek((FILE *)v7, v120, 0);
-    fread(pOutdoorLocation->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7);
+    fread(pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7);
     fseek((FILE *)v7, v121, 0);
-    fread(pOutdoorLocation->pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7);
-    pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128);
-    pAllocator->FreeChunk(pOutdoorLocation->ptr_D4);
-    pOutdoorLocation->ptr_D4 = 0;
+    fread(pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7);
+    pTerrain._47C80A(0, 0, 128, 128);
+    pAllocator->FreeChunk(ptr_D4);
+    ptr_D4 = 0;
     v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
-    v108 = (int)pOutdoorLocation->pOMAP;
-    pOutdoorLocation->ptr_D4 = v9;
+    v108 = (int)pOMAP;
+    ptr_D4 = v9;
     pAllocator->FreeChunk((void *)v108);
-    pOutdoorLocation->pOMAP = 0;
+    pOMAP = 0;
     v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
     v108 = 0;
-    pOutdoorLocation->pOMAP = (unsigned int *)v10;
+    pOMAP = (unsigned int *)v10;
     fseek((FILE *)v7, v136, v108);
     fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7);
     fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7);
     fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7);
     pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
     fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7);
-    v11 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels, 188 * pOutdoorLocation->uNumBModels, "BDdata");
+    v11 = pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata");
     v108 = 0;
-    pOutdoorLocation->pBModels = (BSPModel *)v11;
+    pBModels = (BSPModel *)v11;
     fseek((FILE *)v7, v122, v108);
-    fread(pOutdoorLocation->pBModels, 0xBCu, pOutdoorLocation->uNumBModels, (FILE *)v7);
+    fread(pBModels, 0xBCu, uNumBModels, (FILE *)v7);
     fseek((FILE *)v7, v123, 0);
     pNumItems = 0;
-    if ( (signed int)pOutdoorLocation->uNumBModels > 0 )
+    if ( (signed int)uNumBModels > 0 )
     {
       v12 = 0;
       while ( 1 )
       {
-        pOutdoorLocation->pBModels[v12].pVertices.pVertices = 0;
-        pOutdoorLocation->pBModels[v12].pFaces = 0;
-        pOutdoorLocation->pBModels[v12].pFacesOrdering = 0;
-        pOutdoorLocation->pBModels[v12].pNodes = 0;
+        pBModels[v12].pVertices.pVertices = 0;
+        pBModels[v12].pFaces = 0;
+        pBModels[v12].pFacesOrdering = 0;
+        pBModels[v12].pNodes = 0;
         FileName[0] = 0;
-        v108 = (int)&pOutdoorLocation->pBModels[v12];
-        sprintf(FileName, "%s", v108);
-        v13 = pOutdoorLocation->pBModels;
+        v108 = (int)&pBModels[v12];
+        sprintfex(FileName, "%s", v108);
+        v13 = pBModels;
         v138 = 0;
-        pOutdoorLocation->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
+        pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
                                                                FileName);
-        pOutdoorLocation->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFaces, 308 * pOutdoorLocation->pBModels[v12].uNumFaces,
+        pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces,
                                                 FileName);
-        pOutdoorLocation->pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFacesOrdering,
-                                                                 2 * pOutdoorLocation->pBModels[v12].uNumFaces, FileName);
-        v14 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pNodes, 8 * pOutdoorLocation->pBModels[v12].uNumNodes, FileName);
-        v15 = pOutdoorLocation->pBModels;
+        pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pBModels[v12].pFacesOrdering,
+                                                                 2 * pBModels[v12].uNumFaces, FileName);
+        v14 = pAllocator->AllocNamedChunk(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName);
+        v15 = pBModels;
         v108 = (int)File;
         v15[v12].pNodes = (BSPNode *)v14;
-        fread(pOutdoorLocation->pBModels[v12].pVertices.pVertices, 0xCu, pOutdoorLocation->pBModels[v12].pVertices.uNumVertices, (FILE *)v108);
-        fread(pOutdoorLocation->pBModels[v12].pFaces, 0x134u, pOutdoorLocation->pBModels[v12].uNumFaces, (FILE *)File);
-        fread(pOutdoorLocation->pBModels[v12].pFacesOrdering, 2u, pOutdoorLocation->pBModels[v12].uNumFaces, (FILE *)File);
-        fread(pOutdoorLocation->pBModels[v12].pNodes, 8u, pOutdoorLocation->pBModels[v12].uNumNodes, (FILE *)File);
-        v16 = malloc(10 * pOutdoorLocation->pBModels[v12].uNumFaces);
+        fread(pBModels[v12].pVertices.pVertices, 0xCu, pBModels[v12].pVertices.uNumVertices, (FILE *)v108);
+        fread(pBModels[v12].pFaces, 0x134u, pBModels[v12].uNumFaces, (FILE *)File);
+        fread(pBModels[v12].pFacesOrdering, 2u, pBModels[v12].uNumFaces, (FILE *)File);
+        fread(pBModels[v12].pNodes, 8u, pBModels[v12].uNumNodes, (FILE *)File);
+        v16 = malloc(10 * pBModels[v12].uNumFaces);
         v107 = (int)File;
-        v17 = pOutdoorLocation->pBModels;
+        v17 = pBModels;
         ptr = (FILE *)v16;
         fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File);
-        v18 = pOutdoorLocation->pBModels;
+        v18 = pBModels;
         Str2 = 0;
         if ( (signed int)v18[v12].uNumFaces > 0 )
           break;
@@ -1442,7 +1454,7 @@
         free(ptr);
         ++pNumItems;
         ++v12;
-        if ( (signed int)pNumItems >= (signed int)pOutdoorLocation->uNumBModels )
+        if ( (signed int)pNumItems >= (signed int)uNumBModels )
           goto LABEL_26;
       }
       pDestLen = 0;
@@ -1467,7 +1479,7 @@
             pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
           goto LABEL_20;
         }
-        pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v12].pFaces->uTextureID + pDestLen));
+        pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pBModels[v12].pFaces->uTextureID + pDestLen));
 LABEL_20:
         if ( *(short *)(thisa + 292) )
         {
@@ -1477,7 +1489,7 @@
             *(char *)(thisa + 30) &= 0xEFu;
         }
         ++Str2;
-        v18 = pOutdoorLocation->pBModels;
+        v18 = pBModels;
         pDestLen += 308;
         pFilename += 10;
         if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces )
@@ -1550,406 +1562,485 @@
     fseek((FILE *)v22, v127, 0);
     fread(pChests, 0x14CCu, uNumChests, (FILE *)v22);
     fseek((FILE *)v22, v128, 0);
-    fread(&pOutdoorLocation->field_DC, 4u, 1u, (FILE *)v22);
-    pAllocator->FreeChunk(pOutdoorLocation->pFaceIDLIST);
-    v32 = pOutdoorLocation->field_DC;
-    pOutdoorLocation->pFaceIDLIST = 0;
+    fread(&field_DC, 4u, 1u, (FILE *)v22);
+    pAllocator->FreeChunk(pFaceIDLIST);
+    v32 = field_DC;
+    pFaceIDLIST = 0;
     v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST");
     v108 = (int)v22;
-    pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v33;
-    fread(v33, 2u, pOutdoorLocation->field_DC, (FILE *)v108);
+    pFaceIDLIST = (unsigned __int16 *)v33;
+    fread(v33, 2u, field_DC, (FILE *)v108);
     fseek((FILE *)v22, v129, 0);
-    fread(pOutdoorLocation->pOMAP, 4u, 0x4000u, (FILE *)v22);
+    fread(pOMAP, 4u, 0x4000u, (FILE *)v22);
     fseek((FILE *)v22, v130, 0);
-    fread(&pOutdoorLocation->uNumSpawnPoints, 4u, 1u, (FILE *)v22);
-    pOutdoorLocation->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pSpawnPoints, 24 * pOutdoorLocation->uNumSpawnPoints, "Spawn");
+    fread(&uNumSpawnPoints, 4u, 1u, (FILE *)v22);
+    pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn");
     fseek((FILE *)v22, v131, 0);
-    fread(pOutdoorLocation->pSpawnPoints, 0x18u, pOutdoorLocation->uNumSpawnPoints, (FILE *)v22);
+    fread(pSpawnPoints, 0x18u, uNumSpawnPoints, (FILE *)v22);
     fseek((FILE *)v22, v132, 0);
-    fread(&pOutdoorLocation->ddm, 0x28u, 1u, (FILE *)v22);
+    fread(&ddm, 0x28u, 1u, (FILE *)v22);
     fseek((FILE *)v22, v133, 0);
     fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22);
     fseek((FILE *)v22, v134, 0);
-    fread(&pOutdoorLocation->uLastVisitDay, 1u, 0x38u, (FILE *)v22);
+    fread(&uLastVisitDay, 1u, 0x38u, (FILE *)v22);
     fseek((FILE *)v22, v135, 0);
-    fread(&pOutdoorLocation->uLastVisitDay, 1u, 4u, (FILE *)v22);
-    thisa = (int)pOutdoorLocation->pTileTypes;
+    fread(&uLastVisitDay, 1u, 4u, (FILE *)v22);
+    thisa = (int)pTileTypes;
     pTileTable->InitializeTileset(4);
-    pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[0].uTileGroup);
-    pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[1].uTileGroup);
-    pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[2].uTileGroup);
-    pTileTable->InitializeTileset(pOutdoorLocation->pTileTypes[3].uTileGroup);
-    if ( pOutdoorLocation != (OutdoorLocation *)-96 && pOutdoorLocation->pSkyTextureName[0] )
+    pTileTable->InitializeTileset(pTileTypes[0].uTileGroup);
+    pTileTable->InitializeTileset(pTileTypes[1].uTileGroup);
+    pTileTable->InitializeTileset(pTileTypes[2].uTileGroup);
+    pTileTable->InitializeTileset(pTileTypes[3].uTileGroup);
+    if ( this != (OutdoorLocation *)-96 && pSkyTextureName[0] )
     {
       v108 = 0;
-      v107 = (int)pOutdoorLocation->pSkyTextureName;
+      v107 = (int)pSkyTextureName;
     }
     else
     {
       v108 = 0;
       v107 = (int)pDefaultSkyTexture;
     }
-    pOutdoorLocation->uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108);
-    strcpy(pOutdoorLocation->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
-    v34 = pTileTable->GetTileById(pOutdoorLocation->pTileTypes[0].uTileID);
+    uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108);
+    strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
+    v34 = pTileTable->GetTileById(pTileTypes[0].uTileID);
     v35 = pBitmaps_LOD->LoadTexture(v34->pTileName);
-    v36 = pOutdoorLocation->uSky_TextureID;
-    pOutdoorLocation->uMainTile_BitmapID = v35;
+    v36 = uSky_TextureID;
+    uMainTile_BitmapID = v35;
     if ( v36 != -1 )
       pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1);
 
-    v37 = pOutdoorLocation->uMainTile_BitmapID;
+    v37 = uMainTile_BitmapID;
     if ( v37 != -1 )
       pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1);
 
-    pOutdoorLocation->_47F0E2();
+    _47F0E2();
     pGameLoadingUI_ProgressBar->Progress();
     fclose((FILE *)v22);
     goto LABEL_150;
-  }
-  if ( !pGames_LOD->DoesContainerExist(pContainer) )
-    Abortf("Unable to find %s in Games.LOD", pContainer);
-  strcpy(FileName, pContainer);
-  strcpy(Str, pContainer);
-  Dst[strlen(Str) + 964] = 0;
+  }*/
+
+  assert(sizeof(BSPModel) == 188);
+
+  if (!pGames_LOD->DoesContainerExist(pFilename))
+    Abortf("Unable to find %s in Games.LOD", pFilename);
+
+  //strcpy(FileName, pContainer);
+  strcpy(Str, pFilename);
+  strcpy(Str + strlen(Str) - 4, ".odm");
   viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(Str, TEXTURE_16BIT_PALETTE);
-  v141 = &v139;
-  v38 = strlen(pContainer);
-  strcpy((char *)&v139 + v38, ".odm");
-  v39 = pGames_LOD->FindContainer(pContainer, 1);
+  //v141 = &v139;
+  //v38 = strlen(pFilename);
+  //strcpy((char *)&v139 + v38, ".odm");
+  v39 = pGames_LOD->FindContainer(Str, 1);
+  //Str[strlen(Str) - 4] = 0;
+
   header.uCompressedSize = 0;
   header.uDecompressedSize = 0;
-  ptr = v39;
+  //ptr = v39;
   header.uVersion = 91969;
   header.pMagic[0] = 'm';
   header.pMagic[1] = 'v';
   header.pMagic[2] = 'i';
   header.pMagic[3] = 'i';
   fread(&header, 0x10u, 1u, v39);
-  if ( header.uVersion != 91969
-    || header.pMagic[0] != 'm'
-    || header.pMagic[1] != 'v'
-    || header.pMagic[2] != 'i'
-    || header.pMagic[3] != 'i' )
+  if (header.uVersion != 91969 ||
+      header.pMagic[0] != 'm' ||
+      header.pMagic[1] != 'v' ||
+      header.pMagic[2] != 'i' ||
+      header.pMagic[3] != 'i')
   {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:507", 0);
+    MessageBoxW(nullptr, L"Can't load file!",
+                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:507", 0);
   }
-  v40 = header.uCompressedSize;
-  pSource = header.uDecompressedSize;
-  v41 = malloc(header.uDecompressedSize);
-  v42 = v41;
-  HIDWORD(v142) = (uint32)v41;
-  if ( v40 < pSource )
+  //v40 = header.uCompressedSize;
+  //pSource = header.uDecompressedSize;
+  //v41 = malloc(header.uDecompressedSize);
+  auto pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
+  auto pSrc = pSrcMem;
+  //v42 = v41;
+  //HIDWORD(v142) = (uint32)pSrc;
+  if (header.uCompressedSize < header.uDecompressedSize)
   {
-    pFilename = (char *)malloc(v40);
-    fread((void *)pFilename, v40, 1u, ptr);
-    zlib::MemUnzip(v42, &pSource, pFilename, v40);
-    free((void *)pFilename);
+    auto pComressedSrc = (char *)malloc(header.uCompressedSize);
+    fread(pComressedSrc, header.uCompressedSize, 1, v39);
+
+    uint actualDecompressedSize = header.uDecompressedSize;
+    zlib::MemUnzip(pSrc, &actualDecompressedSize, pComressedSrc, header.uCompressedSize);
+    free(pComressedSrc);
   }
   else
   {
-    fread(v41, pSource, 1u, ptr);
+    fread(pSrc, header.uDecompressedSize, 1, v39);
   }
-  memcpy(pOutdoorLocation, v42, 0xB0u);
-  v43 = (char *)v42 + 176;
-  pOutdoorLocation->LoadTileGroupIds();
-  pOutdoorLocation->_47F3EA();
-  strcpy(pOutdoorLocation->pGroundTileset, "grastyl");
+
+  memcpy(pLevelFilename, pSrc, 0x20);
+  memcpy(pLocationFileName, pSrc + 0x20, 0x20);
+  memcpy(pLocationFileDescription, pSrc + 0x40, 0x20);
+  memcpy(pSkyTextureName, pSrc + 0x60, 0x20);
+  memcpy(pGroundTileset, pSrc + 0x80, 0x20);
+  memcpy(pTileTypes, pSrc + 0xA0, 0x10);
+  pSrc += 0xB0;
+
+  //v43 = (char *)pSrc + 176;
+  LoadTileGroupIds();
+  _47F3EA();
+  strcpy(pGroundTileset, "grastyl");
   pGameLoadingUI_ProgressBar->Progress();
-  pOutdoorLocation->pTerrain.Initialize();
-  v108 = 16384;
-  v107 = (int)v43;
-  v106 = (char *)pOutdoorLocation->pTerrain.pHeightmap;
-  memcpy(v106, v43, 0x4000u);
-  v43 = (char *)v43 + 16384;
-  v105 = 16384;
-  v104 = (void *)v43;
-  v103 = pOutdoorLocation->pTerrain.pTilemap;
-  memcpy(v103, v43, 0x4000u);
-  v43 = (char *)v43 + 16384;
-  memcpy(pOutdoorLocation->pTerrain.pAttributemap, v43, 0x4000u);
-  v43 = (char *)v43 + 16384;
-  v108 = (int)pOutdoorLocation->ptr_D4;
-  pAllocator->FreeChunk((void *)v108);
-  pOutdoorLocation->ptr_D4 = 0;
-  pOutdoorLocation->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
-  pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128);
+  pTerrain.Initialize();
+  //v108 = 16384;
+  //v107 = (int)v43;
+  //v106 = (char *)pTerrain.pHeightmap;
+  memcpy(pTerrain.pHeightmap, pSrc, 0x4000);
+  pSrc += 0x4000;
+
+  //v43 = (char *)v43 + 16384;
+  //v105 = 16384;
+  //v104 = (void *)v43;
+  //v103 = pTerrain.pTilemap;
+  memcpy(pTerrain.pTilemap, pSrc, 0x4000);
+  pSrc += 0x4000;
+
+  //v43 = (char *)v43 + 16384;
+  memcpy(pTerrain.pAttributemap, pSrc, 0x4000);
+  pSrc += 0x4000;
+
+  //v43 = (char *)v43 + 16384;
+  //v108 = (int)ptr_D4;
+  if (ptr_D4)
+  {
+    pAllocator->FreeChunk(ptr_D4);
+    ptr_D4 = nullptr;
+  }
+  ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
+  pTerrain._47C80A(0, 0, 128, 128);
+
+  pGameLoadingUI_ProgressBar->Progress();
+  memcpy(&uNumTerrainNormals, pSrc, 4);
+  //v43 = (char *)v43 + 4;
+  memcpy(pTerrainSomeOtherData, pSrc + 4, 0x20000);
+  pSrc += 4 + 0x20000;
+  //v43 = (char *)v43 + 131072;
+  memcpy(pTerrainNormalIndices, pSrc, 0x10000);
+  pSrc += 0x10000;
+  //v43 = (char *)v43 + 65536;
+
+  //pFilename = (char *)(12 * uNumTerrainNormals);
+  pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
+  memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals);
+  pSrc += 12 * uNumTerrainNormals;
+  //v44 = (char *)v43 + (int)pFilename;
+  //v44 = (char *)v44 + 4;
+  //v45 = uNumBModels;
+  //v108 = (int)"BDdata";
+
+  pGameLoadingUI_ProgressBar->Progress();
+
+  //v107 = 188 * v45;
+  //v106 = (char *)pBModels;
+  //v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata");
+  //v47 = uNumBModels;
+  memcpy(&uNumBModels, pSrc, 4);
+  pBModels = (BSPModel *)pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata");
+  //pFilename = (char *)(188 * v47);
+  memcpy(pBModels, pSrc + 4, 188 * uNumBModels);
+  pSrc += 4 + 188 * uNumBModels;
+  
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uNumTerrainNormals, v43, 4u);
-  v43 = (char *)v43 + 4;
-  memcpy(pTerrainSomeOtherData, v43, 0x20000u);
-  v43 = (char *)v43 + 131072;
-  memcpy(pTerrainNormalIndices, v43, 0x10000u);
-  v43 = (char *)v43 + 65536;
-  pFilename = (char *)(12 * uNumTerrainNormals);
-  pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
-  memcpy(pTerrainNormals, v43, (size_t)pFilename);
-  v44 = (char *)v43 + (int)pFilename;
-  memcpy(&pOutdoorLocation->uNumBModels, v44, 4u);
-  v44 = (char *)v44 + 4;
-  pGameLoadingUI_ProgressBar->Progress();
-  v45 = pOutdoorLocation->uNumBModels;
-  v108 = (int)"BDdata";
-  v107 = 188 * v45;
-  v106 = (char *)pOutdoorLocation->pBModels;
-  v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata");
-  v47 = pOutdoorLocation->uNumBModels;
-  pOutdoorLocation->pBModels = v46;
-  pFilename = (char *)(188 * v47);
-  memcpy(v46, v44, 188 * v47);
-  uSourceLen = (char *)v44 + (int)pFilename;
-  pGameLoadingUI_ProgressBar->Progress();
-  v151 = 0;
-  if ( (signed int)pOutdoorLocation->uNumBModels > 0 )
+
+  //uSourceLen = (char *)v44 + (int)pFilename;
+  //v151 = 0;
+  for (uint i = 0; i < uNumBModels; ++i)
   {
-    v48 = 0;
-    while ( 1 )
+    //v48 = 0;
+    auto model = pBModels + i;
+
+    model->pVertices.pVertices = nullptr;
+    model->pFaces = nullptr;
+    model->pFacesOrdering = nullptr;
+    model->pNodes = nullptr;
+      //FileName[0] = 0;
+      //v108 = (int)&pBModels[i];
+      //sprintf(FileName, "%s", v108);
+      //v49 = pBModels;
+      //v138 = 0;
+      //v50 = &pBModels[v48];
+      //v108 = (int)FileName;
+      //v107 = 12 * v50->pVertices.uNumVertices;
+      //v106 = (char *)v50->pVertices.pVertices;
+    assert(sizeof(Vec3_int_) == 12);
+    uint verticesSize = model->pVertices.uNumVertices * sizeof(Vec3_int_);
+    model->pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(model->pVertices.pVertices, verticesSize, "");
+    memcpy(model->pVertices.pVertices, pSrc, verticesSize);
+    pSrc += verticesSize;
+      //v51 = &pBModels[v48];
+      //v108 = (int)FileName;
+      //v107 = 308 * v51->uNumFaces;
+      //v106 = (char *)v51->pFaces;
+    assert(sizeof(ODMFace) == 308);
+    uint facesSize = model->uNumFaces * sizeof(ODMFace);
+    model->pFaces = (ODMFace *)pAllocator->AllocNamedChunk(model->pFaces, facesSize, "");
+    memcpy(model->pFaces, pSrc, facesSize);
+    pSrc += facesSize;
+      //v52 = &pBModels[v48];
+      //v108 = (int)FileName;
+      //v107 = 2 * v52->uNumFaces;
+      //v106 = (char *)v52->pFacesOrdering;
+    uint facesOrderingSize = model->uNumFaces * sizeof(short);
+    model->pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(model->pFacesOrdering, facesOrderingSize, "");
+    memcpy(model->pFacesOrdering, pSrc, facesOrderingSize);
+    pSrc += facesOrderingSize;
+      //v53 = &pBModels[v48];
+      //v108 = (int)FileName;
+      //v107 = 8 * v53->uNumNodes;
+      //v106 = (char *)v53->pNodes;
+    assert(sizeof(BSPNode) == 8);
+    uint nodesSize = model->uNumNodes * sizeof(BSPNode);
+    model->pNodes = (BSPNode *)pAllocator->AllocNamedChunk(model->pNodes, nodesSize, "");
+    memcpy(model->pNodes, pSrc, nodesSize);
+    pSrc += nodesSize;
+      //v54 = &pBModels[v48];
+      //v108 = 12 * v54->pVertices.uNumVertices;
+      //pFilename = (char *)v108;
+      //v107 = (int)uSourceLen;
+      //v106 = (char *)v54->pVertices.pVertices;
+      //memcpy(v106, uSourceLen, v108);
+      //uSourceLen = (char *)uSourceLen + (int)pFilename;
+      //v55 = &pBModels[v48];
+      //v105 = 308 * v55->uNumFaces;
+      //v104 = uSourceLen;
+      //v103 = v55->pFaces;
+      //pFilename = (char *)v105;
+      //memcpy(v103, uSourceLen, v105);
+      //v56 = &pBModels[v48];
+      //uSourceLen = (char *)uSourceLen + (int)pFilename;
+      //v57 = v56->pFacesOrdering;
+      //pFilename = (char *)(2 * v56->uNumFaces);
+      //memcpy(v57, uSourceLen, (size_t)pFilename);
+      //v58 = &pBModels[v48];
+      //uSourceLen = (char *)uSourceLen + (int)pFilename;
+      //v59 = v58->pNodes;
+      //pFilename = (char *)(8 * v58->uNumNodes);
+      //memcpy(v59, uSourceLen, (size_t)pFilename);
+      //uSourceLen = (char *)uSourceLen + (int)pFilename;
+    //ptr = (FILE *)malloc(10 * model->uNumFaces);
+    auto textureFilenames = (const char *)malloc(10 * model->uNumFaces);
+      //pFilename = (char *)(10 * pBModels[v48].uNumFaces);
+    memcpy((char *)textureFilenames, pSrc, 10 * model->uNumFaces);
+    pSrc += 10 * model->uNumFaces;
+      //v144 = 0;
+      //uSourceLen = (char *)uSourceLen + (int)pFilename;
+      //v60 = pBModels;
+    for (uint j = 0; j < model->uNumFaces; ++j)
     {
-      pOutdoorLocation->pBModels[v48].pVertices.pVertices = 0;
-      pOutdoorLocation->pBModels[v48].pFaces = 0;
-      pOutdoorLocation->pBModels[v48].pFacesOrdering = 0;
-      pOutdoorLocation->pBModels[v48].pNodes = 0;
-      FileName[0] = 0;
-      v108 = (int)&pOutdoorLocation->pBModels[v48];
-      sprintf(FileName, "%s", v108);
-      v49 = pOutdoorLocation->pBModels;
-      v138 = 0;
-      v50 = &v49[v48];
-      v108 = (int)FileName;
-      v107 = 12 * v50->pVertices.uNumVertices;
-      v106 = (char *)v50->pVertices.pVertices;
-      pOutdoorLocation->pBModels[v48].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v51 = &pOutdoorLocation->pBModels[v48];
-      v108 = (int)FileName;
-      v107 = 308 * v51->uNumFaces;
-      v106 = (char *)v51->pFaces;
-      pOutdoorLocation->pBModels[v48].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v52 = &pOutdoorLocation->pBModels[v48];
-      v108 = (int)FileName;
-      v107 = 2 * v52->uNumFaces;
-      v106 = (char *)v52->pFacesOrdering;
-      pOutdoorLocation->pBModels[v48].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v53 = &pOutdoorLocation->pBModels[v48];
-      v108 = (int)FileName;
-      v107 = 8 * v53->uNumNodes;
-      v106 = (char *)v53->pNodes;
-      pOutdoorLocation->pBModels[v48].pNodes = (BSPNode *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v54 = &pOutdoorLocation->pBModels[v48];
-      v108 = 12 * v54->pVertices.uNumVertices;
-      pFilename = (char *)v108;
-      v107 = (int)uSourceLen;
-      v106 = (char *)v54->pVertices.pVertices;
-      memcpy(v106, uSourceLen, v108);
-      uSourceLen = (char *)uSourceLen + (int)pFilename;
-      v55 = &pOutdoorLocation->pBModels[v48];
-      v105 = 308 * v55->uNumFaces;
-      v104 = uSourceLen;
-      v103 = v55->pFaces;
-      pFilename = (char *)v105;
-      memcpy(v103, uSourceLen, v105);
-      v56 = &pOutdoorLocation->pBModels[v48];
-      uSourceLen = (char *)uSourceLen + (int)pFilename;
-      v57 = v56->pFacesOrdering;
-      pFilename = (char *)(2 * v56->uNumFaces);
-      memcpy(v57, uSourceLen, (size_t)pFilename);
-      v58 = &pOutdoorLocation->pBModels[v48];
-      uSourceLen = (char *)uSourceLen + (int)pFilename;
-      v59 = v58->pNodes;
-      pFilename = (char *)(8 * v58->uNumNodes);
-      memcpy(v59, uSourceLen, (size_t)pFilename);
-      uSourceLen = (char *)uSourceLen + (int)pFilename;
-      ptr = (FILE *)malloc(10 * pOutdoorLocation->pBModels[v48].uNumFaces);
-      pFilename = (char *)(10 * pOutdoorLocation->pBModels[v48].uNumFaces);
-      memcpy(ptr, uSourceLen, (size_t)pFilename);
-      v144 = 0;
-      uSourceLen = (char *)uSourceLen + (int)pFilename;
-      v60 = pOutdoorLocation->pBModels;
-      if ( (signed int)v60[v48].uNumFaces > 0 )
-        break;
-LABEL_74:
-      free(ptr);
-      ++v151;
-      ++v48;
-      if ( v151 >= (signed int)pOutdoorLocation->uNumBModels )
-        goto LABEL_75;
-    }
-    v149 = 0;
-    Str2 = (char *)ptr;
-    while ( 1 )
-    {
-      pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces;
-      if ( !(pFilename[29] & 0x40) )
-        break;
-      v61 = pTextureFrameTable->FindTextureByName(Str2);
-      *((short *)pFilename + 136) = v61;
-      if ( !v61 )
+      auto texFilename = textureFilenames + j * 10;
+    //v149 = 0;
+    //Str2 = (char *)ptr;
+
+      auto face = model->pFaces + j;
+      //pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces;
+      if (~face->uAttributes & 0x40)
       {
-        v62 = pBitmaps_LOD->LoadTexture(Str2);
-        v63 = (ODMFace *)pFilename;
-        BYTE1(v63->uAttributes) &= 0xBFu;
+        v62 = pBitmaps_LOD->LoadTexture(texFilename);
+//        v63 = (ODMFace *)pFilename;
+        goto LABEL_68;
+      }
+      //v61 = pTextureFrameTable->FindTextureByName(texFilename);
+      face->uTextureID = pTextureFrameTable->FindTextureByName(texFilename);
+      if (!face->uTextureID)
+      {
+        v62 = pBitmaps_LOD->LoadTexture(texFilename);
+        //v63 = (ODMFace *)pFilename;
+        BYTE1(face->uAttributes) &= 0xBFu;
 LABEL_68:
-        v63->uTextureID = v62;
-        v145 = (signed __int16)v62 != -1 ? (int)&pBitmaps_LOD->pTextures[(signed __int16)v62] : 0;
-        v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36);
+        face->uTextureID = v62;
+        //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0;
+        //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36);
         if ((signed __int16)v62 != -1)
-          pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(v108);
+          pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1);
         goto LABEL_69;
       }
-      v108 = *(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v48].pFaces->uTextureID + (unsigned int)v149);
-      pTextureFrameTable->LoadAnimationSequenceAndPalettes(v108);
+      pTextureFrameTable->LoadAnimationSequenceAndPalettes(face->uTextureID);
 LABEL_69:
-      if ( *((short *)pFilename + 146) )
+      if (face->sCogTriggeredID)
       {
-        if ( ((ODMFace *)pFilename)->HasEventHint() )
-          pFilename[30] |= 0x10u;
+        if (face->HasEventHint())
+          BYTE2(face->uAttributes) |= 0x10u;
         else
-          pFilename[30] &= 0xEFu;
+          BYTE2(face->uAttributes) &= 0xEFu;
       }
-      ++v144;
-      v60 = pOutdoorLocation->pBModels;
-      v149 = (char *)v149 + 308;
-      Str2 += 10;
-      if ( v144 >= (signed int)v60[v48].uNumFaces )
-        goto LABEL_74;
-    }
-    v62 = pBitmaps_LOD->LoadTexture(Str2);
-    v63 = (ODMFace *)pFilename;
-    goto LABEL_68;
+      //++v144;
+      //v60 = pBModels;
+      //v149 = (char *)v149 + 308;
+      //Str2 += 10;
+      //if ( v144 >= (signed int)v60[v48].uNumFaces )
+        //goto LABEL_74;
+      }
+
+//LABEL_74:
+      free((void *)textureFilenames);
+//      ++v151;
+//      ++v48;
+//      if ( v151 >= (signed int)uNumBModels )
+//        goto LABEL_75;
   }
-LABEL_75:
+//LABEL_75:
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uNumLevelDecorations, uSourceLen, 4u);
-  uSourceLen = (char *)uSourceLen + 4;
-  if ( (uNumLevelDecorations & 0x80000000u) != 0 || (signed int)uNumLevelDecorations > 3000 )
-  {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:678", 0);
-  }
+
+  memcpy(&uNumLevelDecorations, pSrc, 4u);
+  //uSourceLen = (char *)uSourceLen + 4;
+  if (uNumLevelDecorations > 3000)
+    MessageBoxW(nullptr, L"Can't load file!",
+                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:678", 0);
+
+  assert(sizeof(LevelDecoration) == 32);
+  //pFilename = (char *)(32 * uNumLevelDecorations);
+  memcpy(pLevelDecorations, pSrc + 4, uNumLevelDecorations * sizeof(LevelDecoration));
+  pSrc += 4 + 32 * uNumLevelDecorations;
+
   pGameLoadingUI_ProgressBar->Progress();
-  pFilename = (char *)(32 * uNumLevelDecorations);
-  memcpy(pLevelDecorations, uSourceLen, 32 * uNumLevelDecorations);
-  v151 = 0;
-  uSourceLen = (char *)uSourceLen + (int)pFilename;
-  if ( (signed int)uNumLevelDecorations > 0 )
+
+  //v151 = 0;
+  //uSourceLen = (char *)uSourceLen + (int)pFilename;
+  for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
-    pFilename = (char *)pLevelDecorations;
-    do
-    {
-      memcpy(FileName, uSourceLen, 0x20u);
-      uSourceLen = (char *)uSourceLen + 32;
-      v64 = pDecorationList->GetDecorIdByName(FileName);
-      v65 = pFilename;
-      ++v151;
-      pFilename += 32;
-      *(short *)v65 = v64;
-    }
-    while ( v151 < (signed int)uNumLevelDecorations );
+    char name[256];
+    memcpy(name, pSrc, 32);
+    pSrc += 32;
+
+    pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name);
+  }
+
+  pGameLoadingUI_ProgressBar->Progress();
+
+  memcpy(&numFaceIDListElems, pSrc, 4);
+
+  //uSourceLen = (char *)uSourceLen + 4;
+  //v108 = (int)pFaceIDLIST;
+  if (pFaceIDLIST)
+  {
+    pAllocator->FreeChunk(pFaceIDLIST);
+    pFaceIDLIST = nullptr;
   }
+  //v66 = field_DC;
+  //pFaceIDLIST = 0;
+  //v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST");
+  uint faceIDListSize = 2 * numFaceIDListElems;
+  pFaceIDLIST = (unsigned short *)pAllocator->AllocNamedChunk(0, faceIDListSize, "IDLIST");
+  //v68 = field_DC;
+  //pFaceIDLIST = (unsigned __int16 *)v67;
+  //pFilename = (char *)(2 * v68);
+  memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize);
+  pSrc += 4 + faceIDListSize;
+
+  //uSourceLen = (char *)uSourceLen + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&pOutdoorLocation->field_DC, uSourceLen, 4u);
-  uSourceLen = (char *)uSourceLen + 4;
-  v108 = (int)pOutdoorLocation->pFaceIDLIST;
-  pAllocator->FreeChunk((void *)v108);
-  v66 = pOutdoorLocation->field_DC;
-  pOutdoorLocation->pFaceIDLIST = 0;
-  v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST");
-  v68 = pOutdoorLocation->field_DC;
-  pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v67;
-  pFilename = (char *)(2 * v68);
-  memcpy(v67, uSourceLen, 2 * v68);
-  uSourceLen = (char *)uSourceLen + (int)pFilename;
-  pGameLoadingUI_ProgressBar->Progress();
-  v108 = (int)pOutdoorLocation->pOMAP;
-  pAllocator->FreeChunk((void *)v108);
-  pOutdoorLocation->pOMAP = 0;
-  v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
-  v108 = 65536;
-  pOutdoorLocation->pOMAP = (unsigned int *)v69;
-  memcpy(v69, uSourceLen, v108);
-  uSourceLen = (char *)uSourceLen + 65536;
+
+  //v108 = (int)pOMAP;
+  //pAllocator->FreeChunk((void *)v108);
+  //pOMAP = 0;
+  if (pOMAP)
+  {
+    pAllocator->FreeChunk(pOMAP);
+    pOMAP = nullptr;
+  }
+  //v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
+  pOMAP = (unsigned int *)pAllocator->AllocNamedChunk(0, 0x10000, "OMAP");
+  //v108 = 65536;
+  //pOMAP = (unsigned int *)v69;
+  memcpy(pOMAP, pSrc, 65536);
+  pSrc += 65536;
+
+  //uSourceLen = (char *)uSourceLen + 65536;
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&pOutdoorLocation->uNumSpawnPoints, uSourceLen, 4u);
-  uSourceLen = (char *)uSourceLen + 4;
+
+  memcpy(&uNumSpawnPoints, pSrc, 4);
+  //uSourceLen = (char *)uSourceLen + 4;
   pGameLoadingUI_ProgressBar->Progress();
-  v70 = pOutdoorLocation->uNumSpawnPoints;
-  v108 = (int)"Spawn";
-  v107 = 24 * v70;
-  v106 = (char *)pOutdoorLocation->pSpawnPoints;
-  v71 = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(v106, 24 * v70, "Spawn");
-  v72 = pOutdoorLocation->uNumSpawnPoints;
-  pOutdoorLocation->pSpawnPoints = v71;
-  memcpy(v71, uSourceLen, 24 * v72);
+  //v70 = uNumSpawnPoints;
+  //v108 = (int)"Spawn";
+  //v107 = 24 * v70;
+  //v106 = (char *)pSpawnPoints;
+  assert(sizeof(SpawnPointMM7) == 24);
+  uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7);
+  pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, spawnPointsSize, "Spawn");
+  //v72 = uNumSpawnPoints;
+  //pSpawnPoints = v71;
+  memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize);
+  pSrc += 4 + spawnPointsSize;
+
   pGameLoadingUI_ProgressBar->Progress();
-  free((void *)HIDWORD(v142));
-  v108 = (int)".ddm";
-  v73 = strlen(pContainer);
-  strcpy((char *)v141 + v73, (const char *)v108);
-  v151 = (int)pNew_LOD->FindContainer(pContainer, 1);//
-  fread(&header, 0x10u, 1u, (FILE *)v151);
+
+  free(pSrcMem);
+
+  //v108 = (int)".ddm";
+  //v73 = strlen(pContainer);
+  strcpy(Str + strlen(Str) - 4, ".ddm");
+  //strcpy((char *)v141 + v73, (const char *)v108);
+  v39 = pNew_LOD->FindContainer(Str, 1);//
+  fread(&header, 0x10u, 1u, v39);
   Str2 = 0;
-  if ( header.uVersion != 91969
-    || header.pMagic[0] != 'm'
-    || header.pMagic[1] != 'v'
-    || header.pMagic[2] != 'i'
-    || header.pMagic[3] != 'i' )
+  if (header.uVersion != 91969 ||
+      header.pMagic[0] != 'm' ||
+      header.pMagic[1] != 'v' ||
+      header.pMagic[2] != 'i' ||
+      header.pMagic[3] != 'i' )
   {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0);
+    MessageBoxW(nullptr, L"Can't load file!",
+                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0);
     Str2 = (char *)1;
   }
-  v74 = 0;
-  pFilename = (char *)header.uCompressedSize;
-  v149 = 0;
-  pDestLen = header.uDecompressedSize;
+  //v74 = 0;
+  //pFilename = (char *)header.uCompressedSize;
+  //v149 = 0;
+  //pDestLen = header.uDecompressedSize;
   if ( !Str2 )
   {
-    v75 = malloc(header.uDecompressedSize);
-    v149 = v75;
-    if ( (unsigned int)pFilename <= pDestLen )
+    pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
+    pSrc = pSrcMem;
+    //v149 = v75;
+    if (header.uCompressedSize == header.uDecompressedSize)
+      fread(pSrc, header.uDecompressedSize, 1u, v39);
+    else if (header.uCompressedSize < header.uDecompressedSize)
     {
-      if ( pFilename == (const char *)pDestLen )
-      {
-        fread(v75, pDestLen, 1u, (FILE *)v151);
-      }
-      else
-      {
-        uSourceLen = malloc((size_t)pFilename);
-        fread(uSourceLen, (size_t)pFilename, 1u, (FILE *)v151);
-        zlib::MemUnzip(v75, &pDestLen, uSourceLen, (unsigned int)pFilename);
-        free(uSourceLen);
-      }
+      auto compressedMem = malloc(header.uCompressedSize);
+      fread(compressedMem, header.uCompressedSize, 1, v39);
+
+      uint actualDecompressedSize = header.uDecompressedSize;
+      zlib::MemUnzip(pSrc, &actualDecompressedSize, compressedMem, header.uCompressedSize);
+      free(compressedMem);
     }
     else
-    {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
-    }
-    memcpy(&pOutdoorLocation->ddm, v75, 0x28u);
-    v74 = (int)((char *)v75 + 40);
+      MessageBoxW(nullptr, L"Can't load file!",
+                  L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
+
+    assert(sizeof(DDM_DLV_Header) == 0x28);
+    memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header));
+    pSrc += sizeof(DDM_DLV_Header);
+    //v74 = (int)((char *)v75 + 40);
   }
-  v76 = pOutdoorLocation->uNumBModels;
-  v77 = 0;
-  if ( (signed int)v76 > 0 )
+  //v76 = uNumBModels;
+  //v77 = actualNumFacesInLevel = 0;
+  uint actualNumFacesInLevel = 0;
+  for (uint i = 0; i < uNumBModels; ++i)
+    actualNumFacesInLevel += pBModels[i].uNumFaces;
+
+  //v79 = ddm.uNumFacesInBModels;
+  if (ddm.uNumFacesInBModels)
   {
-    v78 = (char *)&pOutdoorLocation->pBModels->uNumFaces;
-    do
+    if ( ddm.uNumBModels )
     {
-      v77 += *(int *)v78;
-      v78 += 188;
-      --v76;
-    }
-    while ( v76 );
-  }
-  v79 = pOutdoorLocation->ddm.uNumFacesInBModels;
-  if ( v79 )
-  {
-    if ( pOutdoorLocation->ddm.uNumBModels )
-    {
-      v80 = pOutdoorLocation->ddm.uNumDecorations;
-      if ( v80 )
+      //v80 = ddm.uNumDecorations;
+      if (ddm.uNumDecorations)
       {
-        if ( v79 != v77 || pOutdoorLocation->ddm.uNumBModels != pOutdoorLocation->uNumBModels || v80 != uNumLevelDecorations )
+        if (ddm.uNumFacesInBModels != actualNumFacesInLevel ||
+            ddm.uNumBModels != uNumBModels ||
+            ddm.uNumDecorations != uNumLevelDecorations )
           Str2 = (char *)1;
       }
     }
   }
+
   if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 )
     pNumItems = 29030400;
   if ( Str2 )
@@ -1958,217 +2049,244 @@
     memset(Src, 0, 0x3C8u);
     goto LABEL_112;
   }
-  v81 = pOutdoorLocation->ddm.uLastRepawnDay;
-  if ( (unsigned int)((char *)File - v81) >= pNumItems || !v81 )
+  //v81 = ddm.uLastRepawnDay;
+  if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)
   {
-    memcpy(Dst, (const void *)v74, 0x3C8u);
-    memcpy(Src, (const void *)(v74 + 968), 0x3C8u);
+    memcpy(Dst, pSrc, 0x3C8u);
+    memcpy(Src, pSrc + 968, 0x3C8u);
 LABEL_112:
-    free(v149);
-    v25 = Str2 == 0;
-    pOutdoorLocation->ddm.uLastRepawnDay = (int)File;
-    if ( v25 )
-      ++pOutdoorLocation->ddm.uNumRespawns;
+    free(pSrcMem);
+
+    ddm.uLastRepawnDay = (int)File;
+    if (Str2 == 0)
+      ++ddm.uNumRespawns;
     v108 = 0;
     *(int *)thisa = 1;
-    v151 = (int)pGames_LOD->FindContainer(pContainer, v108);
-    fread(&header, 0x10u, 1u, (FILE *)v151);
-    pFilename = (char *)header.uCompressedSize;
-    pDestLen = header.uDecompressedSize;
-    v82 = malloc(header.uDecompressedSize);
-    v149 = v82;
-    if ( (unsigned int)pFilename <= pDestLen )
+    v39 = pGames_LOD->FindContainer(Str, 0);
+    fread(&header, 0x10, 1u, v39);
+    //pFilename = (char *)header.uCompressedSize;
+    //pDestLen = header.uDecompressedSize;
+    //v82 = malloc(header.uDecompressedSize);
+    pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
+    //v149 = v82;
+    if (header.uCompressedSize == header.uDecompressedSize)
+      fread(pSrcMem, header.uDecompressedSize, 1, v39);
+    else if (header.uCompressedSize < header.uDecompressedSize)
     {
-      if ( pFilename == (const char *)pDestLen )
-      {
-        fread(v82, pDestLen, 1u, (FILE *)v151);
-      }
-      else
-      {
-        uSourceLen = malloc((size_t)pFilename);
-        fread(uSourceLen, (size_t)pFilename, 1u, (FILE *)v151);
-        zlib::MemUnzip(v82, &pDestLen, uSourceLen, (unsigned int)pFilename);
-        free(uSourceLen);
-      }
+      auto compressedMem = malloc(header.uCompressedSize);
+      fread(compressedMem, header.uCompressedSize, 1u, v39);
+
+      uint actualDecompressedSize = header.uDecompressedSize;
+      zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize);
+      free(compressedMem);
     }
     else
-    {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
-    }
-    v74 = (int)((char *)v82 + 40);
+      MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
+
+    pSrc = pSrcMem + 40;
     goto LABEL_120;
+
   }
   *(int *)thisa = 0;
 LABEL_120:
-  v108 = (int)".odm";
-  v83 = strlen(pContainer);
-  strcpy((char *)v141 + v83, (const char *)v108);
-  memcpy(pOutdoorLocation->array_528, (const void *)v74, 0x3C8u);
-  v84 = (const void *)(v74 + 968);
-  memcpy(pOutdoorLocation->array_8F0, v84, 0x3C8u);
-  v85 = (char *)v84 + 968;
+  //v108 = (int)".odm";
+  //v83 = strlen(pContainer);
+  //strcpy((char *)v141 + v83, (const char *)v108);
+  memcpy(array_528, pSrc, 0x3C8);
+  //v84 = (const void *)(v74 + 968);
+  memcpy(array_8F0, pSrc + 0x3C8, 0x3C8);
+  pSrc += 2 * 0x3C8;
+  //v85 = (char *)v84 + 968;
+
   pGameLoadingUI_ProgressBar->Progress();
+
   if ( *(int *)thisa )
   {
-    memcpy(pOutdoorLocation->array_528, Dst, 0x3C8u);
-    memcpy(pOutdoorLocation->array_8F0, Src, 0x3C8u);
+    memcpy(array_528, Dst, 0x3C8u);
+    memcpy(array_8F0, Src, 0x3C8u);
   }
-  v25 = pOutdoorLocation->uNumBModels == 0;
-  v26 = (pOutdoorLocation->uNumBModels & 0x80000000u) != 0;
-  v151 = 0;
-  if ( !(v26 | v25) )
+
+  //v25 = uNumBModels == 0;
+  //v26 = (uNumBModels & 0x80000000u) != 0;
+  //v151 = 0;
+  for (uint i = 0; i < uNumBModels; ++i)
   {
-    pNumItems = 0;
-    do
+    auto model = pBModels + i;
+    //pNumItems = 0;
+    //do
+    //{
+      //v86 = pBModels;
+      //thisa = 0;
+      //v87 = (unsigned int)((char *)v86 + pNumItems);
+    for (uint j = 0; j < model->uNumFaces; ++j)
     {
-      v86 = pOutdoorLocation->pBModels;
-      thisa = 0;
-      v87 = (unsigned int)((char *)v86 + pNumItems);
-      if ( *(int *)(v87 + 76) > 0 )
-      {
-        File = 0;
-        do
-        {
-          v106 = (char *)&File->uAttributes + *(int *)(v87 + 84);
-          memcpy(v106, v85, 4u);
-          v88 = pOutdoorLocation->pBModels;
-          ++File;
-          v85 = (char *)v85 + 4;
-          ++thisa;
-          v87 = (unsigned int)((char *)v88 + pNumItems);
-        }
-        while ( thisa < *(int *)(v87 + 76) );
-      }
-      v89 = pOutdoorLocation->pBModels;
-      thisa = 0;
-      if ( *(signed int *)((char *)&v89->uNumFaces + pNumItems) > 0 )
+      auto face = model->pFaces + j;
+
+      //if ( *(int *)(v87 + 76) > 0 )
+      //{
+        //File = 0;
+        //do
+        //{
+          //v106 = (char *)&File->uAttributes + *(int *)(v87 + 84);
+      memcpy(&face->uAttributes, pSrc, 4);
+      pSrc += 4;
+          //v88 = pBModels;
+          //++File;
+          //v85 = (char *)v85 + 4;
+          //++thisa;
+          //v87 = (unsigned int)((char *)v88 + pNumItems);
+        //}
+        //while ( thisa < *(int *)(v87 + 76) );
+    }
+
+      //v89 = pBModels;
+      //thisa = 0;
+    for (uint j = 0; j < model->uNumFaces; ++j)
+    {
+      auto face = model->pFaces + j;
+        //pFilename = 0;
+        //do
+        //{
+          //v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)];
+          //File = v90;
+      if (face->sCogTriggeredID)
       {
-        pFilename = 0;
-        do
-        {
-          v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)];
-          File = v90;
-          if ( v90->sCogTriggeredID )
-          {
-            if ( v90->HasEventHint() )
-              BYTE2(File->uAttributes) |= 0x10u;
-            else
-              BYTE2(File->uAttributes) &= 0xEFu;
-          }
-          ++thisa;
-          v89 = pOutdoorLocation->pBModels;
-          pFilename += 308;
-        }
-        while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) );
+        if (face->HasEventHint())
+          BYTE2(face->uAttributes) |= 0x10u;
+        else
+          BYTE2(face->uAttributes) &= 0xEFu;
       }
-      ++v151;
-      pNumItems += 188;
+          //++thisa;
+          //v89 = pBModels;
+          //pFilename += 308;
+        //}
+        //while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) );
     }
-    while ( v151 < (signed int)pOutdoorLocation->uNumBModels );
+      //++v151;
+      //pNumItems += 188;
+    //}
+    //while ( v151 < (signed int)uNumBModels );
   }
+
   pGameLoadingUI_ProgressBar->Progress();
-  v151 = 0;
-  if ( (signed int)uNumLevelDecorations > 0 )
+
+  //v151 = 0;
+  for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
-    thisa = (int)&pLevelDecorations[0].field_2;
-    do
-    {
-      memcpy((void *)thisa, v85, 2u);
-      thisa += 32;
-      v85 = (char *)v85 + 2;
-      ++v151;
-    }
-    while ( v151 < (signed int)uNumLevelDecorations );
+    //thisa = (int)&pLevelDecorations[0].field_2;
+    //do
+    //{
+    memcpy(&pLevelDecorations[i].field_2, pSrc, 2);
+    pSrc += 2;
+      //thisa += 32;
+      //v85 = (char *)v85 + 2;
+      //++v151;
+    //}
+    //while ( v151 < (signed int)uNumLevelDecorations );
   }
+
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uNumActors, v85, 4u);
-  v91 = (char *)v85 + 4;
-  if ( (uNumActors & 0x80000000u) != 0 || (signed int)uNumActors > 500 )
-  {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0);
-  }
+
+  memcpy(&uNumActors, pSrc, 4);
+  //v91 = (char *)v85 + 4;
+  if (uNumActors > 500)
+    MessageBoxW(nullptr, L"Can't load file!",
+                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0);
+
   pGameLoadingUI_ProgressBar->Progress();
-  pFilename = (char *)(836 * uNumActors);
-  memcpy(pActors, v91, 836 * uNumActors);
-  v92 = (char *)v91 + (int)pFilename;
+
+  assert(sizeof(Actor) == 836);
+  //pFilename = (char *)(836 * uNumActors);
+  memcpy(pActors, pSrc + 4, uNumActors * sizeof(Actor));
+  pSrc += 4 + uNumActors * sizeof(Actor);
+  //v92 = (char *)v91 + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uNumLayingItems, v92, 4u);
-  v93 = (char *)v92 + 4;
-  if ( (uNumLayingItems & 0x80000000u) != 0 || (signed int)uNumLayingItems > 1000 )
-  {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:954", 0);
-  }
-  pGameLoadingUI_ProgressBar->Progress();
-  pFilename = (char *)(112 * uNumLayingItems);
-  memcpy(pLayingItems, v93, 112 * uNumLayingItems);
-  v94 = (char *)v93 + (int)pFilename;
+
+  memcpy(&uNumLayingItems, pSrc, 4);
+  //v93 = (char *)v92 + 4;
+  if (uNumLayingItems > 1000)
+    MessageBoxW(nullptr, L"Can't load file!",
+                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:954", 0);
+
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&uNumChests, v94, 4u);
-  v95 = (char *)v94 + 4;
-  if ( (uNumChests & 0x80000000u) != 0 || (signed int)uNumChests > 20 )
-  {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0);
-  }
+
+  assert(sizeof(LayingItem) == 112);
+  //pFilename = (char *)(112 * uNumLayingItems);
+  memcpy(pLayingItems, pSrc + 4, uNumLayingItems * sizeof(LayingItem));
+  pSrc += 4 + uNumLayingItems * sizeof(LayingItem);
+
+  //v94 = (char *)v93 + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
-  pFilename = (char *)(5324 * uNumChests);
-  memcpy(pChests, v95, 5324 * uNumChests);
-  v96 = (char *)v95 + (int)pFilename;
+
+  memcpy(&uNumChests, pSrc, 4);
+  //v95 = (char *)v94 + 4;
+  if (uNumChests > 20)
+    MessageBoxW(nullptr, L"Can't load file!",
+                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0);
+
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&stru_5E4C90, v96, 0xC8u);
+
+  assert(sizeof(Chest) == 5324);
+  //pFilename = (char *)(5324 * uNumChests);
+  memcpy(pChests, pSrc + 4 , uNumChests * sizeof(Chest));
+  pSrc += 4 + uNumChests * sizeof(Chest);
+  //v96 = (char *)v95 + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&pOutdoorLocation->uLastVisitDay, v96 + 200, 0x38u);
-  free(v149);
+
+  memcpy(&stru_5E4C90, pSrc, 0xC8);
+  pSrc += 0xC8;
+
+  pGameLoadingUI_ProgressBar->Progress();
+  memcpy(&uLastVisitDay, pSrc, 0x38u);
+
+  free(pSrcMem);
+
   pTileTable->InitializeTileset(4);
-  thisa = (int)pOutdoorLocation->pTileTypes;
-  v108 = pOutdoorLocation->pTileTypes[0].uTileGroup;
-  pTileTable->InitializeTileset(v108);
-  v108 = pOutdoorLocation->pTileTypes[1].uTileGroup;
-  pTileTable->InitializeTileset(v108);
-  v108 = pOutdoorLocation->pTileTypes[2].uTileGroup;
-  pTileTable->InitializeTileset(v108);
-  v108 = pOutdoorLocation->pTileTypes[3].uTileGroup;
-  pTileTable->InitializeTileset(v108);
-  strcpy(pOutdoorLocation->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
-  v97 = pOutdoorLocation->pTileTypes[0].uTileID;
-  v108 = 0;
-  v98 = pTileTable->GetTileById(v97);
-  v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, (enum TEXTURE_TYPE)v108);
-  pOutdoorLocation->uMainTile_BitmapID = v99;
-  if ( v99 != -1 )
+  //thisa = (int)pTileTypes;
+  //v108 = pTileTypes[0].uTileGroup;
+  pTileTable->InitializeTileset(pTileTypes[0].uTileGroup);
+  //v108 = pTileTypes[1].uTileGroup;
+  pTileTable->InitializeTileset(pTileTypes[1].uTileGroup);
+  //v108 = pTileTypes[2].uTileGroup;
+  pTileTable->InitializeTileset(pTileTypes[2].uTileGroup);
+  //v108 = pTileTypes[3].uTileGroup;
+  pTileTable->InitializeTileset(pTileTypes[3].uTileGroup);
+  strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
+  //v97 = pTileTypes[0].uTileID;
+  //v108 = 0;
+  auto v98 = pTileTable->GetTileById(pTileTypes[0].uTileID);
+  //v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT);
+  uMainTile_BitmapID = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT);
+  if (uMainTile_BitmapID != -1)
+    pBitmaps_LOD->pTextures[uMainTile_BitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uMainTile_BitmapID].palette_id1);
+
+  _47F0E2();
+
+LABEL_150:
+  //v100 = HIDWORD(uLastVisitDay);
+  //LODWORD(v142) = LODWORD(uLastVisitDay);
+  //HIDWORD(v142) = v100;
+  if (uLastVisitDay)
   {
-    v108 = (v99 != -1 ? pBitmaps_LOD->pTextures[v99].palette_id1 : 36);
-    if (v99 != -1)
-      pBitmaps_LOD->pTextures[v99].palette_id2 = pPaletteManager->LoadPalette(v108);
-  }
-  pOutdoorLocation->_47F0E2();
-LABEL_150:
-  v100 = HIDWORD(pOutdoorLocation->uLastVisitDay);
-  LODWORD(v142) = LODWORD(pOutdoorLocation->uLastVisitDay);
-  HIDWORD(v142) = v100;
-  if ( v100 | (unsigned int)v142 )
-  {
-    v108 = 28;
-    if ( (signed int)((signed int)(signed __int64)((double)v142 * 0.234375) / 60 / 60 / 0x18u) % 28 != pParty->uDaysPlayed )
+    auto v108 = 28;
+    if ( (signed int)((signed int)(signed __int64)((double)uLastVisitDay * 0.234375) / 60 / 60 / 0x18u) % 28 != pParty->uDaysPlayed )
     {
       if ( rand() % 100 >= 20 )
         v108 = dword_4EC268[rand() % dword_4EC2A8];
       else
         v108 = dword_4EC28C[rand() % dword_4EC2AC];
-      sprintf(pOutdoorLocation->field_4F8, "plansky%d", v108);
+      sprintf(field_4F8, "plansky%d", v108);
     }
   }
   else
   {
-    strcpy(pOutdoorLocation->field_4F8, "plansky3");
+    strcpy(field_4F8, "plansky3");
   }
-  v101 = pBitmaps_LOD->LoadTexture(pOutdoorLocation->field_4F8);
-  pOutdoorLocation->uSky_TextureID = v101;
-  if ( v101 != -1 )
-  {
-    v108 = (v101 != -1 ? pBitmaps_LOD->pTextures[v101].palette_id1 : 36);
-    if (v101 != -1)
-      pBitmaps_LOD->pTextures[v101].palette_id2 = pPaletteManager->LoadPalette(v108);
-  }
+  //v101 = pBitmaps_LOD->LoadTexture(field_4F8);
+  uSky_TextureID = pBitmaps_LOD->LoadTexture(field_4F8);
+  if (uSky_TextureID != -1)
+    pBitmaps_LOD->pTextures[uSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uSky_TextureID].palette_id1);
+
   pPaletteManager->RecalculateAll();
   pSoundList->_4A9A67(53, 0);
   pSoundList->_4A9A67(92, 0);
@@ -2230,15 +2348,8 @@
     --thisa;
   }
   while ( thisa );
-  return 1;
+  return true;
 }
-// 4EC268: using guessed type int dword_4EC268[];
-// 4EC28C: using guessed type int dword_4EC28C[];
-// 4EC2A8: using guessed type int dword_4EC2A8;
-// 4EC2AC: using guessed type int dword_4EC2AC;
-// 6807E0: using guessed type int _6807E0_num_decorations_6807B8;
-// 6BE364: using guessed type int dword_6BE364_game_settings_1;
-// 6BE3C4: using guessed type char bUnderwater;
 
 //----- (0047ECC1) --------------------------------------------------------
 int OutdoorLocation::_47ECC1(signed int a2)
@@ -2577,10 +2688,10 @@
     {
       pDecorationList->InitializeDecorationSprite(v3->uDecorationDescID);
       v4 = pDecorationList->pDecorations[v3->uDecorationDescID].uSoundID;
-      if ( v4 && pNumSoundDecorations < 9 )
+      if ( v4 && _6807E0_num_decorations_with_sounds_6807B8 < 9 )
       {
         pSoundList->_4A9A67(v4, 0);
-        v5 = pNumSoundDecorations++;
+        v5 = _6807E0_num_decorations_with_sounds_6807B8++;
         _6807B8_level_decorations_ids[v5] = v2;
       }
       if ( v8 && v3->uCog == 20 )
@@ -2725,19 +2836,10 @@
 //----- (0047F420) --------------------------------------------------------
 bool OutdoorLocation::LoadTileGroupIds()
 {
-  char *v1; // esi@1
-  signed int v2; // edi@1
+  for (uint i = 0; i < 3; ++i)
+    pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].uTileGroup, 1);
 
-  v1 = (char *)&this->pTileTypes[0].uTileID;
-  v2 = 3;
-  do
-  {
-    *(short *)v1 = pTileTable->method_487ED6(*((short *)v1 - 1), 1);
-    v1 += 4;
-    --v2;
-  }
-  while ( v2 );
-  return 1;
+  return true;
 }
 
 //----- (0047B42C) --------------------------------------------------------
--- a/Outdoor.h	Mon Nov 05 09:15:53 2012 +0600
+++ b/Outdoor.h	Mon Nov 05 09:16:17 2012 +0600
@@ -42,7 +42,8 @@
     this->ptr_C = 0;
     this->field_10 = 0;
     this->field_12 = 0;
-	this->pAttributemap = nullptr;
+
+    pAttributemap = nullptr;
   }
 
   void _47C7A9();
@@ -183,7 +184,7 @@
   struct OutdoorLocationTerrain pTerrain;
   void *ptr_D4;
   struct BSPModel *pBModels;
-  int field_DC;
+  unsigned int numFaceIDListElems;
   unsigned __int16 *pFaceIDLIST;
   unsigned int *pOMAP;
   unsigned int uSky_TextureID;
--- a/PaletteManager.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/PaletteManager.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -329,7 +329,7 @@
 
   v2 = this;
   v3 = (char *)this + 768 * a2;
-  if ( this->pPalette_tintColor[0] || this->pPalette_tintColor[1] || this->pPalette_tintColor[2] )
+  if (pPalette_tintColor[0] || pPalette_tintColor[1] || pPalette_tintColor[2])
   {
     v8 = 0;
     i = 0;
@@ -338,13 +338,13 @@
       v9 = (float *)((char *)v63 + v8);
       v10 = (float *)((char *)a6 + v8);
       v11 = (float *)((char *)v64 + v8);
-      v12 = v2->pPalette_tintColor[1];
-      LODWORD(v75) = v2->pPalette_tintColor[2] + (unsigned __int8)v3[2];
+      v12 = pPalette_tintColor[1];
+      LODWORD(v75) = pPalette_tintColor[2] + (unsigned __int8)v3[2];
       v13 = v12 + (unsigned __int8)v3[1];
       LODWORD(v14) = (unsigned __int8)*v3;
       v15 = (double)SLODWORD(v75) * 0.00196078431372549;
       LODWORD(v75) = v13;
-      LODWORD(v75) = LODWORD(v14) + v2->pPalette_tintColor[0];
+      LODWORD(v75) = LODWORD(v14) + pPalette_tintColor[0];
       v16 = (double)v13 * 0.00196078431372549;
       v17 = (double)SLODWORD(v75) * 0.00196078431372549;
       RGB2HSV(v11, v9, v17, v16, v15, v10);
@@ -500,12 +500,12 @@
     i += 4;
   }
   while ( v18 ^ v19 );
-  v45 = v2->pPalette_mistColor[0];
-  if ( v45 || v2->pPalette_mistColor[1] || v2->pPalette_mistColor[2] )
+  v45 = pPalette_mistColor[0];
+  if (v45 || pPalette_mistColor[1] || pPalette_mistColor[2])
   {
     v46 = (double)v45;
-    v80 = v2->pPalette_mistColor[1];
-    v47 = v2->pPalette_mistColor[2];
+    v80 = pPalette_mistColor[1];
+    v47 = pPalette_mistColor[2];
     v70 = v46 * 0.00392156862745098;
     *((float *)&v71 + 1) = (double)v80 * 0.00392156862745098;
     v75 = (double)v47 * 0.00392156862745098;
@@ -538,7 +538,7 @@
         a2a = a2a * 31.0;
         a3 = a3 * 31.0;
       }
-      if ( v2->pPalette_mistColor[0] || v2->pPalette_mistColor[1] || v2->pPalette_mistColor[2] )
+      if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2])
       {
         v55 = (double)v72 * 0.03225806451612903;
         v52 = (signed __int64)((double)(1 << v2->uNumTargetRBits) * v70 * v55 + a1 * (1.0 - v55));
--- a/PaletteManager.h	Mon Nov 05 09:15:53 2012 +0600
+++ b/PaletteManager.h	Mon Nov 05 09:16:17 2012 +0600
@@ -31,8 +31,8 @@
   int pPaletteIDs[50];
   int _num_locked;
   int _pal_lock_test;
-  unsigned __int8 pPalette_mistColor[2];
-  char pPalette_tintColor[2];
+  unsigned __int8 pPalette_mistColor[3];
+  unsigned char pPalette_tintColor[3];
   char field_267AD6;
   char field_267AD7;
   unsigned int uNumTargetRBits;
--- a/Party.h	Mon Nov 05 09:15:53 2012 +0600
+++ b/Party.h	Mon Nov 05 09:16:17 2012 +0600
@@ -150,6 +150,7 @@
 
   inline bool WizardEyeActive()      {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;}
   inline int  WizardEyeSkillLevel()  {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;}
+  inline bool TorchlightActive()     {return pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0;}
   inline bool FlyActive()            {return pPartyBuffs[PARTY_BUFF_FLY].uExpireTime > 0;}
   inline bool WaterWalkActive()      {return pPartyBuffs[PARTY_BUFF_WATER_WALK].uExpireTime > 0;}
   inline bool ImmolationActive()     {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uExpireTime > 0;}
--- a/SaveLoad.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/SaveLoad.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -27,8 +27,8 @@
 struct SavegameList *pSavegameList = new SavegameList;
 unsigned int uNumSavegameFiles;
 unsigned int pSavegameUsedSlots[45];
-struct RGBTexture *pSavegameThumbnails = new RGBTexture[45];
-SavegameHeader *pSavegameHeader = new SavegameHeader[45];
+struct RGBTexture pSavegameThumbnails[45];
+SavegameHeader    pSavegameHeader[45];
 
 
 
--- a/SaveLoad.h	Mon Nov 05 09:15:53 2012 +0600
+++ b/SaveLoad.h	Mon Nov 05 09:16:17 2012 +0600
@@ -29,5 +29,6 @@
 
 extern unsigned int uNumSavegameFiles;
 extern unsigned int pSavegameUsedSlots[45];
-extern struct SavegameList *pSavegameList;
-extern struct RGBTexture *pSavegameThumbnails;
\ No newline at end of file
+extern struct SavegameList  *pSavegameList;
+extern struct RGBTexture     pSavegameThumbnails[];
+extern struct SavegameHeader pSavegameHeader[];
\ No newline at end of file
--- a/mm7_1.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/mm7_1.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -7261,7 +7261,7 @@
   v10 = v65;
   v68 = 0;
   v5->_viewport_space_y = v7;
-  v5->field_4 = v8;
+  v5->_viewport_space_w = v8;
   v55 = v65;
   if ( v4 > 0 )
   {
@@ -7449,14 +7449,14 @@
   }
   v39 = a3;
   v40 = v73;
-  if ( v73 < a3->_viewport_space_y || (v41 = a3->field_4, v7 > v41) )
+  if ( v73 < a3->_viewport_space_y || (v41 = a3->_viewport_space_w, v7 > v41) )
     return 0;
   if ( v7 < a3->_viewport_space_y )
     v7 = a3->_viewport_space_y;
   if ( v73 > v41 )
   {
-    v40 = a3->field_4;
-    v73 = a3->field_4;
+    v40 = a3->_viewport_space_w;
+    v73 = a3->_viewport_space_w;
   }
   v71 = v7;
   if ( v7 <= v40 )
@@ -7510,7 +7510,7 @@
   }
   while ( v46 );
   v5->_viewport_space_y = v7;
-  v5->field_4 = v73;
+  v5->_viewport_space_w = v73;
   v5->field_8 = v5->array_18[v7];
   v48 = v5->array_3D8[v7];
   v5->field_10 = v7;
--- a/mm7_2.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/mm7_2.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -11471,7 +11471,7 @@
     pRenderer->DrawTextureIndexed(
       8u,
       8u,
-      (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+      uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0);
     if ( a4 )
     {
       v2 = uTextureID_save_up;
@@ -11482,23 +11482,20 @@
       v2 = uTextureID_load_up;
       v3 = uTextureID_LS_loadU;
     }
-    pRenderer->DrawTextureIndexed(0xF1u, 0x12Eu, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0));
-    pRenderer->DrawTextureIndexed(0x12u, 0x8Bu, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
-    pRenderer->DrawTextureIndexed(
-      0x15Fu,
-      0x12Eu,
-      (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0));
+    pRenderer->DrawTextureIndexed(241, 302, (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0));
+    pRenderer->DrawTextureIndexed(18, 139, (Texture *)(v2 != -1 ? &pIcons_LOD->pTextures[v2] : 0));
+    pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
     v1 = 255;
   }
   if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
   {
     memset(&Dst, 0, 0x54u);
     Dst.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;
-    v4 = pGUIWindow_CurrentMenu->uFrameY - LOBYTE(pFontSmallnum->uFontHeight);
+    v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight;
     Dst.uFrameWidth = 220;
     v4 += 157;
     Dst.uFrameY = v4;
-    v5 = LOBYTE(pFontSmallnum->uFontHeight);
+    v5 = pFontSmallnum->uFontHeight;
     Dst.uFrameZ = Dst.uFrameX + 219;
     Dst.uFrameHeight = v5;
     Dst.uFrameW = v5 + v4 - 1;
@@ -11592,10 +11589,10 @@
     v18 = pGlobalTXT_LocalizationStrings[135];
     v19 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[135]);
     pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, v18, 0, 0, 0);
-    v20 = (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot);
+    v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
     v21 = pFontSmallnum->AlignText_Center(
             0xBAu,
-            (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
+            (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
     pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106u, 0, v20, 185, 0);
     v22 = pGlobalTXT_LocalizationStrings[165];
     v23 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]);
--- a/mm7_3.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/mm7_3.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -2174,10 +2174,6 @@
     goto LABEL_74;
   }
 }
-// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
-// 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
-// 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
-
 
 
 
@@ -12908,37 +12904,26 @@
 }
 
 //----- (0043F9E1) --------------------------------------------------------
-__int16 *stru170_stru2::_43F9E1(__int16 x, int y, __int16 z, int w)
-{
-  signed int v5; // edx@1
-  __int16 *result; // eax@1
-
-  auto a2 = x;
-  auto a3 = y;
-  auto a4 = z;
-  auto a5 = w;
-
-  this->_viewport_space_y = a3;
-  this->field_4 = a5;
-  v5 = 0;
-  result = this->array_3D8;
-  do
-  {
-    if ( v5 < a3 || v5 > a5 )
-    {
-      *result = -1;
-      *(result - 480) = 640;
-    }
-    else
-    {
-      *(result - 480) = a2;
-      *result = a4;
-    }
-    ++v5;
-    ++result;
-  }
-  while ( v5 < 480 );
-  return result;
+void stru170_stru2::_43F9E1(__int16 x, int y, __int16 z, int w)
+{
+  __debugbreak();
+
+  _viewport_space_y = y;
+  _viewport_space_w = w;
+
+  for (uint i = 0; i < 480; ++i)
+  {
+    if ( i < y || i > w )
+    {
+      array_3D8[i] = -1;
+      array_18[i] = 640;
+    }
+    else
+    {
+      array_18[i] = x;
+      array_3D8[i] = z;
+    } 
+  }
 }
 
 //----- (0043FA33) --------------------------------------------------------
--- a/mm7_4.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/mm7_4.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -7220,7 +7220,7 @@
 }
 
 //----- (004A597D) --------------------------------------------------------
-void __cdecl Present_NoColorKey()
+void Present_NoColorKey()
 {
   //unsigned __int16 *v0; // eax@4
   unsigned __int16 *v1; // esi@4
@@ -7310,7 +7310,7 @@
         auto uHalfWidth = v20 = (pViewport->uViewportZ - pViewport->uViewportX) / 2;
         v13 = v24;
 
-        for (uint y = pViewport->uViewportY; y < pViewport->uViewportW; ++y)
+        for (uint y = pViewport->uViewportY; y < pViewport->uViewportW + 1; ++y)
         {
           //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
           //       pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
@@ -7934,7 +7934,7 @@
               v89 = v4->pLevelOfDetail3;
               v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
               v104 = 2 * pBLVRenderParams->field_0_timer_;
-              if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 )
+              if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
               {
                 v12 = 2 * stru_F8A590._viewport_space_y;
                 v101 = 2 * stru_F8A590._viewport_space_y;
@@ -8266,7 +8266,7 @@
                   result = a2;
                   v101 += 2;
                   v99 += 640;
-                  if ( a2 > stru_F8A590.field_4 )
+                  if ( a2 > stru_F8A590._viewport_space_w )
                     break;
                   v12 = v101;
                   result = a2;
@@ -8420,7 +8420,7 @@
           v12 = stru_F8A590._viewport_space_y;
           v51 = v11;
           v60 = stru_F8A590._viewport_space_y;
-          if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 )
+          if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
           {
             v13 = 2 * stru_F8A590._viewport_space_y;
             v14 = &stru_F83B80[stru_F8A590._viewport_space_y];
@@ -8549,7 +8549,7 @@
               ++i;
               v56 += 640;
               v55 += 2;
-              if ( v60 > stru_F8A590.field_4 )
+              if ( v60 > stru_F8A590._viewport_space_w )
                 break;
               v13 = v55;
               v12 = v60;
--- a/mm7_data.cpp	Mon Nov 05 09:15:53 2012 +0600
+++ b/mm7_data.cpp	Mon Nov 05 09:16:17 2012 +0600
@@ -2311,7 +2311,7 @@
 char *pPotionNotesTXT_Raw;
 char *pHistoryTXT_Raw;
 int _6807B8_level_decorations_ids[777]; // idb
-int pNumSoundDecorations; // weak
+int _6807E0_num_decorations_with_sounds_6807B8; // weak
 int _6807E8_level_decorations_ids[777]; // idb
 int _6836C8_num_decorations_6807E8; // weak
 int dword_69B010[64];
--- a/mm7_data.h	Mon Nov 05 09:15:53 2012 +0600
+++ b/mm7_data.h	Mon Nov 05 09:16:17 2012 +0600
@@ -2218,13 +2218,12 @@
 extern char *pPotionNotesTXT_Raw;
 extern char *pHistoryTXT_Raw;
 extern int _6807B8_level_decorations_ids[]; // idb
-extern int pNumSoundDecorations; // weak
+extern int _6807E0_num_decorations_with_sounds_6807B8; // weak
 extern int _6807E8_level_decorations_ids[]; // idb
 extern int _6836C8_num_decorations_6807E8; // weak
 extern int dword_69B010[64];
 extern float flt_69B138_dist; // weak
 extern char byte_69BD41_unused; // weak
-extern struct SavegameHeader *pSavegameHeader;
 extern unsigned int uTextureID_x_u;
 extern unsigned int uTextureID_LS_saveU;
 extern unsigned int uTextureID_LS_loadU;
@@ -2758,7 +2757,7 @@
 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1);
 void __fastcall WetsuitOn(unsigned int uPlayerID); // idb
 unsigned int __fastcall WetsuitOff(unsigned int uPlayerID);
-void __fastcall sub_43F39E(struct IndoorLocation_drawstru *_this);
+void __fastcall PrepareDrawLists_BLV(struct IndoorLocation_drawstru *_this);
 int /*__usercall*/ sr_sub_4D6FB0/*<eax>*/(struct stru315 *a1/*<ebp>*/);
 int /*__usercall*/ sr_sub_4D705A/*<eax>*/(struct stru315 *a1/*<ebp>*/);
 void __cdecl MessWithBillboards_BLV();