changeset 90:8c6308bb19b3

2.11.12
author Ritor1
date Fri, 02 Nov 2012 00:41:52 +0600
parents ecbd9b6ccf52
children 2d3f4e0379ce
files AudioPlayer.cpp Indoor.cpp Outdoor.cpp Outdoor.h PaletteManager.cpp PaletteManager.h VideoPlayer.cpp mm7_2.cpp mm7_data.cpp mm7_data.h
diffstat 10 files changed, 246 insertions(+), 268 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/AudioPlayer.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -1616,7 +1616,7 @@
         return;
       }
       v59 = v2;
-      if ( _6807E0_num_decorations_6807B8 <= v2 )
+      if ( pNumSoundDecorations <= v2 )
         return;
       while ( 1 )
       {
@@ -1630,7 +1630,7 @@
           break;
 LABEL_89:
         ++v59;
-        if ( v59 >= _6807E0_num_decorations_6807B8 )
+        if ( v59 >= pNumSoundDecorations )
           return;
       }
       v48 = &pDecorationList->pDecorations[v44->uDecorationDescID];
--- a/Indoor.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/Indoor.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -2026,7 +2026,7 @@
 
   //v5 = 0;
   //v6 = this;
-  _6807E0_num_decorations_6807B8 = 0;
+  pNumSoundDecorations = 0;
 
   #pragma region "loading from txt"
   /*sprintf(FileName, "levels\\%s", pFilename);
@@ -4445,9 +4445,9 @@
   }
   if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d23.blv") )
     bNoNPCHiring = 1;
-  pPaletteManager->field_267AD3 = 0;
-  pPaletteManager->field_267AD4 = 0;
-  pPaletteManager->field_267AD5 = 0;
+  pPaletteManager->pPalette_tintColor[0] = 0;
+  pPaletteManager->pPalette_tintColor[1] = 0;
+  pPaletteManager->pPalette_tintColor[2] = 0;
   pPaletteManager->RecalculateAll();
   if ( qword_A750D8 )
     qword_A750D8 = 0i64;
@@ -4610,10 +4610,10 @@
     pDecorationList->InitializeDecorationSprite(pDecortaion->uDecorationDescID);
 
     v15 = pDecorationList->pDecorations[pDecortaion->uDecorationDescID].uSoundID;
-    if (v15 && _6807E0_num_decorations_6807B8 < 9)
+    if (v15 && pNumSoundDecorations < 9)
     {
         pSoundList->_4A9A67(v15, 0);
-        v16 = _6807E0_num_decorations_6807B8++;
+        v16 = pNumSoundDecorations++;
         _6807B8_level_decorations_ids[v16] = i;
     }
 
--- a/Outdoor.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/Outdoor.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -715,7 +715,12 @@
   pAllocator->FreeChunk(v2);
   v3 = v1->pAttributemap;
   v1->pTilemap = 0;
-  pAllocator->FreeChunk(v3); //
+  if (v3)
+	{
+	pAllocator->FreeChunk(v3);
+	v3 = nullptr;
+	}
+  //pAllocator->FreeChunk(v3); 
   v4 = v1->ptr_C;
   v1->pAttributemap = 0;
   pAllocator->FreeChunk(v4);
@@ -1068,7 +1073,7 @@
   v1->pTileTypes[1].uTileGroup = 5;
   v1->pTileTypes[2].uTileGroup = 6;
   v1->pTileTypes[3].uTileGroup = 10;
-  v1->_47F420();
+  v1->LoadTileGroupIds();
   v1->_47F3EA();
   pAllocator->FreeChunk(v1->pBModels);
   pAllocator->FreeChunk(v1->pSpawnPoints);
@@ -1157,9 +1162,9 @@
 }
 
 //----- (0047D0A6) --------------------------------------------------------
-bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t a4, int thisa)
+bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa)
 {
-  OutdoorLocation *v5; // esi@1
+  OutdoorLocation *pOutdoorLocation; // esi@1
   bool result; // eax@9
   bool v7; // ebx@9
   size_t v8; // eax@10
@@ -1177,7 +1182,7 @@
   __int16 v20; // ax@16
   int v21; // ecx@16
   ODMFace *v22; // ebx@26
-  LayingItem *v23; // ecx@27
+  LayingItem *pItems; // ecx@27
   unsigned int v24; // eax@28
   unsigned __int8 v25; // zf@28
   unsigned __int8 v26; // sf@28
@@ -1308,35 +1313,35 @@
   int v151; // [sp+B78h] [bp-8h]@59
   void *uSourceLen; // [sp+B7Ch] [bp-4h]@59
 
-  v5 = this;
+  pOutdoorLocation = this;
   strcpy(pContainer, pFilename);
   if ( bUnderwater )
   {
-    pPaletteManager->field_267AD3 = 0x10u;
-    pPaletteManager->field_267AD4 = 0xC2u;
-    pPaletteManager->field_267AD5 = 0x99u;
-    pPaletteManager->field_267AD0 = 0x25u;
-    pPaletteManager->field_267AD1 = 0x8Fu;
-    pPaletteManager->field_267AD2 = 0x5Cu;
+    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->field_267AD3 = 0;
-  pPaletteManager->field_267AD4 = 0;
-  pPaletteManager->field_267AD5 = 0;
-  if ( pPaletteManager->field_267AD0 != 0x80u
-    || pPaletteManager->field_267AD1 != 0x80u
-    || pPaletteManager->field_267AD2 != 0x80u )
+  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 )
   {
-    pPaletteManager->field_267AD0 = 0x80u;
-    pPaletteManager->field_267AD1 = 0x80u;
-    pPaletteManager->field_267AD2 = 0x80u;
+    pPaletteManager->pPalette_mistColor[0] = 0x80u;
+    pPaletteManager->pPalette_mistColor[1] = 0x80u;
+    pPaletteManager->pPalette_mistColor[2] = 0x80u;
     goto LABEL_7;
   }
 LABEL_8:
-  _6807E0_num_decorations_6807B8 = 0;
-  sprintfex(FileName, "levels\\%s", pContainer);
+  pNumSoundDecorations = 0;
+  sprintf(FileName, "levels\\%s", pContainer);
   if ( GetFileAttributesA(FileName) != -1 )
   {
     result = (bool)fopen(FileName, "rb");
@@ -1348,17 +1353,15 @@
     v8 = strlen(pContainer);
     v108 = 2;
     *((char *)&v139 + v8) = 0;
-    viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(
-                                          pContainer,
-                                          (enum TEXTURE_TYPE)v108);
+    viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108);
     fread(&DstBuf, 0x180u, 1u, (FILE *)v7);
     fseek((FILE *)v7, Offset, 0);
-    fread(v5, 0xB0u, 1u, (FILE *)v7);
-    v5->_47F420();
-    v5->_47F3EA();
-    strcpy(v5->pGroundTileset, "grastyl");
+    fread(pOutdoorLocation, 0xB0u, 1u, (FILE *)v7);
+    pOutdoorLocation->LoadTileGroupIds();
+    pOutdoorLocation->_47F3EA();
+    strcpy(pOutdoorLocation->pGroundTileset, "grastyl");
     fseek((FILE *)v7, v114, 0);
-    fread(&v5->uNumBModels, 4u, 1u, (FILE *)v7);
+    fread(&pOutdoorLocation->uNumBModels, 4u, 1u, (FILE *)v7);
     fseek((FILE *)v7, v115, 0);
     fread(&uNumLayingItems, 4u, 1u, (FILE *)v7);
     fseek((FILE *)v7, v116, 0);
@@ -1367,91 +1370,79 @@
     fread(&uNumActors, 4u, 1u, (FILE *)v7);
     fseek((FILE *)v7, v118, 0);
     fread(&uNumChests, 4u, 1u, (FILE *)v7);
-    v5->pTerrain.Initialize();
+    pOutdoorLocation->pTerrain.Initialize();
     fseek((FILE *)v7, v119, 0);
-    fread(v5->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7);
+    fread(pOutdoorLocation->pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7);
     fseek((FILE *)v7, v120, 0);
-    fread(v5->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7);
+    fread(pOutdoorLocation->pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7);
     fseek((FILE *)v7, v121, 0);
-    fread(v5->pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7);
-    v5->pTerrain._47C80A(0, 0, 128, 128);
-    pAllocator->FreeChunk(v5->ptr_D4);
-    v5->ptr_D4 = 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;
     v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
-    v108 = (int)v5->pOMAP;
-    v5->ptr_D4 = v9;
+    v108 = (int)pOutdoorLocation->pOMAP;
+    pOutdoorLocation->ptr_D4 = v9;
     pAllocator->FreeChunk((void *)v108);
-    v5->pOMAP = 0;
+    pOutdoorLocation->pOMAP = 0;
     v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
     v108 = 0;
-    v5->pOMAP = (unsigned int *)v10;
+    pOutdoorLocation->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");
+    pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
     fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7);
-    v11 = pAllocator->AllocNamedChunk(v5->pBModels, 188 * v5->uNumBModels, "BDdata");
+    v11 = pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels, 188 * pOutdoorLocation->uNumBModels, "BDdata");
     v108 = 0;
-    v5->pBModels = (BSPModel *)v11;
+    pOutdoorLocation->pBModels = (BSPModel *)v11;
     fseek((FILE *)v7, v122, v108);
-    fread(v5->pBModels, 0xBCu, v5->uNumBModels, (FILE *)v7);
+    fread(pOutdoorLocation->pBModels, 0xBCu, pOutdoorLocation->uNumBModels, (FILE *)v7);
     fseek((FILE *)v7, v123, 0);
-    a4 = 0;
-    if ( (signed int)v5->uNumBModels > 0 )
+    pNumItems = 0;
+    if ( (signed int)pOutdoorLocation->uNumBModels > 0 )
     {
       v12 = 0;
       while ( 1 )
       {
-        v5->pBModels[v12].pVertices.pVertices = 0;
-        v5->pBModels[v12].pFaces = 0;
-        v5->pBModels[v12].pFacesOrdering = 0;
-        v5->pBModels[v12].pNodes = 0;
+        pOutdoorLocation->pBModels[v12].pVertices.pVertices = 0;
+        pOutdoorLocation->pBModels[v12].pFaces = 0;
+        pOutdoorLocation->pBModels[v12].pFacesOrdering = 0;
+        pOutdoorLocation->pBModels[v12].pNodes = 0;
         FileName[0] = 0;
-        v108 = (int)&v5->pBModels[v12];
+        v108 = (int)&pOutdoorLocation->pBModels[v12];
         sprintfex(FileName, "%s", v108);
-        v13 = v5->pBModels;
+        v13 = pOutdoorLocation->pBModels;
         v138 = 0;
-        v5->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(
-                                                               v13[v12].pVertices.pVertices,
-                                                               12 * v13[v12].pVertices.uNumVertices,
+        pOutdoorLocation->pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
                                                                FileName);
-        v5->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(
-                                                v5->pBModels[v12].pFaces,
-                                                308 * v5->pBModels[v12].uNumFaces,
+        pOutdoorLocation->pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pOutdoorLocation->pBModels[v12].pFaces, 308 * pOutdoorLocation->pBModels[v12].uNumFaces,
                                                 FileName);
-        v5->pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(
-                                                                 v5->pBModels[v12].pFacesOrdering,
-                                                                 2 * v5->pBModels[v12].uNumFaces,
-                                                                 FileName);
-        v14 = pAllocator->AllocNamedChunk(
-                v5->pBModels[v12].pNodes,
-                8 * v5->pBModels[v12].uNumNodes,
-                FileName);
-        v15 = v5->pBModels;
+        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;
         v108 = (int)File;
         v15[v12].pNodes = (BSPNode *)v14;
-        fread(v5->pBModels[v12].pVertices.pVertices, 0xCu, v5->pBModels[v12].pVertices.uNumVertices, (FILE *)v108);
-        fread(v5->pBModels[v12].pFaces, 0x134u, v5->pBModels[v12].uNumFaces, (FILE *)File);
-        fread(v5->pBModels[v12].pFacesOrdering, 2u, v5->pBModels[v12].uNumFaces, (FILE *)File);
-        fread(v5->pBModels[v12].pNodes, 8u, v5->pBModels[v12].uNumNodes, (FILE *)File);
-        v16 = malloc(10 * v5->pBModels[v12].uNumFaces);
+        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);
         v107 = (int)File;
-        v17 = v5->pBModels;
+        v17 = pOutdoorLocation->pBModels;
         ptr = (FILE *)v16;
         fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File);
-        v18 = v5->pBModels;
+        v18 = pOutdoorLocation->pBModels;
         Str2 = 0;
         if ( (signed int)v18[v12].uNumFaces > 0 )
           break;
 LABEL_25:
         free(ptr);
-        ++a4;
+        ++pNumItems;
         ++v12;
-        if ( (signed int)a4 >= (signed int)v5->uNumBModels )
+        if ( (signed int)pNumItems >= (signed int)pOutdoorLocation->uNumBModels )
           goto LABEL_26;
       }
       pDestLen = 0;
@@ -1476,8 +1467,7 @@
             pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
           goto LABEL_20;
         }
-        pTextureFrameTable->LoadAnimationSequenceAndPalettes(
-          *(unsigned __int16 *)((char *)&v5->pBModels[v12].pFaces->uTextureID + pDestLen));
+        pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v12].pFaces->uTextureID + pDestLen));
 LABEL_20:
         if ( *(short *)(thisa + 292) )
         {
@@ -1487,7 +1477,7 @@
             *(char *)(thisa + 30) &= 0xEFu;
         }
         ++Str2;
-        v18 = v5->pBModels;
+        v18 = pOutdoorLocation->pBModels;
         pDestLen += 308;
         pFilename += 10;
         if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces )
@@ -1503,18 +1493,18 @@
     fread(pLayingItems, 0x70u, uNumLayingItems, (FILE *)v22);
     if ( (signed int)uNumLayingItems > 0 )
     {
-      v23 = pLayingItems;
-      a4 = uNumLayingItems;
+      pItems = pLayingItems;
+      pNumItems = uNumLayingItems;
       do
       {
-        v24 = v23->stru_24.uItemID;
+        v24 = pItems->stru_24.uItemID;
         thisa = 0;
         v27 = (ODMFace *)(48 * v24);
         v25 = pObjectList->uNumObjects == 0;
         v26 = (pObjectList->uNumObjects & 0x80000000u) != 0;
         LOWORD(v27) = *(short *)((char *)&v27->pFacePlane.vNormal.x + (int)((char *)&pItemsTable + 24));
         File = v27;
-        v23->uItemType = (unsigned __int16)v27;
+        pItems->uItemType = (unsigned __int16)v27;
         if ( v26 | v25 )
         {
 LABEL_33:
@@ -1532,15 +1522,15 @@
           }
           v29 = thisa;
         }
-        v23->uObjectDescID = v29;
-        ++v23;
-        --a4;
+        pItems->uObjectDescID = v29;
+        ++pItems;
+        --pNumItems;
       }
-      while ( a4 );
+      while ( pNumItems );
     }
     fseek((FILE *)v22, v125, 0);
     fread(pLevelDecorations, 0x20u, uNumLevelDecorations, (FILE *)v22);
-    a4 = 0;
+    pNumItems = 0;
     if ( (signed int)uNumLevelDecorations > 0 )
     {
       thisa = (int)pLevelDecorations;
@@ -1549,73 +1539,70 @@
         fread(FileName, 1u, 0x20u, (FILE *)v22);
         v30 = pDecorationList->GetDecorIdByName(FileName);
         v31 = thisa;
-        ++a4;
+        ++pNumItems;
         thisa += 32;
         *(short *)v31 = v30;
       }
-      while ( (signed int)a4 < (signed int)uNumLevelDecorations );
+      while ( (signed int)pNumItems < (signed int)uNumLevelDecorations );
     }
     fseek((FILE *)v22, v126, 0);
     fread(pActors, 0x344u, uNumActors, (FILE *)v22);
     fseek((FILE *)v22, v127, 0);
     fread(pChests, 0x14CCu, uNumChests, (FILE *)v22);
     fseek((FILE *)v22, v128, 0);
-    fread(&v5->field_DC, 4u, 1u, (FILE *)v22);
-    pAllocator->FreeChunk(v5->pFaceIDLIST);
-    v32 = v5->field_DC;
-    v5->pFaceIDLIST = 0;
+    fread(&pOutdoorLocation->field_DC, 4u, 1u, (FILE *)v22);
+    pAllocator->FreeChunk(pOutdoorLocation->pFaceIDLIST);
+    v32 = pOutdoorLocation->field_DC;
+    pOutdoorLocation->pFaceIDLIST = 0;
     v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST");
     v108 = (int)v22;
-    v5->pFaceIDLIST = (unsigned __int16 *)v33;
-    fread(v33, 2u, v5->field_DC, (FILE *)v108);
+    pOutdoorLocation->pFaceIDLIST = (unsigned __int16 *)v33;
+    fread(v33, 2u, pOutdoorLocation->field_DC, (FILE *)v108);
     fseek((FILE *)v22, v129, 0);
-    fread(v5->pOMAP, 4u, 0x4000u, (FILE *)v22);
+    fread(pOutdoorLocation->pOMAP, 4u, 0x4000u, (FILE *)v22);
     fseek((FILE *)v22, v130, 0);
-    fread(&v5->uNumSpawnPoints, 4u, 1u, (FILE *)v22);
-    v5->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(
-                                          v5->pSpawnPoints,
-                                          24 * v5->uNumSpawnPoints,
-                                          "Spawn");
+    fread(&pOutdoorLocation->uNumSpawnPoints, 4u, 1u, (FILE *)v22);
+    pOutdoorLocation->pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pOutdoorLocation->pSpawnPoints, 24 * pOutdoorLocation->uNumSpawnPoints, "Spawn");
     fseek((FILE *)v22, v131, 0);
-    fread(v5->pSpawnPoints, 0x18u, v5->uNumSpawnPoints, (FILE *)v22);
+    fread(pOutdoorLocation->pSpawnPoints, 0x18u, pOutdoorLocation->uNumSpawnPoints, (FILE *)v22);
     fseek((FILE *)v22, v132, 0);
-    fread(&v5->ddm, 0x28u, 1u, (FILE *)v22);
+    fread(&pOutdoorLocation->ddm, 0x28u, 1u, (FILE *)v22);
     fseek((FILE *)v22, v133, 0);
     fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22);
     fseek((FILE *)v22, v134, 0);
-    fread(&v5->uLastVisitDay, 1u, 0x38u, (FILE *)v22);
+    fread(&pOutdoorLocation->uLastVisitDay, 1u, 0x38u, (FILE *)v22);
     fseek((FILE *)v22, v135, 0);
-    fread(&v5->uLastVisitDay, 1u, 4u, (FILE *)v22);
-    thisa = (int)v5->pTileTypes;
+    fread(&pOutdoorLocation->uLastVisitDay, 1u, 4u, (FILE *)v22);
+    thisa = (int)pOutdoorLocation->pTileTypes;
     pTileTable->InitializeTileset(4);
-    pTileTable->InitializeTileset(v5->pTileTypes[0].uTileGroup);
-    pTileTable->InitializeTileset(v5->pTileTypes[1].uTileGroup);
-    pTileTable->InitializeTileset(v5->pTileTypes[2].uTileGroup);
-    pTileTable->InitializeTileset(v5->pTileTypes[3].uTileGroup);
-    if ( v5 != (OutdoorLocation *)-96 && v5->pSkyTextureName[0] )
+    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] )
     {
       v108 = 0;
-      v107 = (int)v5->pSkyTextureName;
+      v107 = (int)pOutdoorLocation->pSkyTextureName;
     }
     else
     {
       v108 = 0;
       v107 = (int)pDefaultSkyTexture;
     }
-    v5->uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108);
-    strcpy(v5->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
-    v34 = pTileTable->GetTileById(v5->pTileTypes[0].uTileID);
+    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);
     v35 = pBitmaps_LOD->LoadTexture(v34->pTileName);
-    v36 = v5->uSky_TextureID;
-    v5->uMainTile_BitmapID = v35;
+    v36 = pOutdoorLocation->uSky_TextureID;
+    pOutdoorLocation->uMainTile_BitmapID = v35;
     if ( v36 != -1 )
       pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1);
 
-    v37 = v5->uMainTile_BitmapID;
+    v37 = pOutdoorLocation->uMainTile_BitmapID;
     if ( v37 != -1 )
       pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1);
 
-    v5->_47F0E2();
+    pOutdoorLocation->_47F0E2();
     pGameLoadingUI_ProgressBar->Progress();
     fclose((FILE *)v22);
     goto LABEL_150;
@@ -1663,30 +1650,30 @@
   {
     fread(v41, pSource, 1u, ptr);
   }
-  memcpy(v5, v42, 0xB0u);
+  memcpy(pOutdoorLocation, v42, 0xB0u);
   v43 = (char *)v42 + 176;
-  v5->_47F420();
-  v5->_47F3EA();
-  strcpy(v5->pGroundTileset, "grastyl");
+  pOutdoorLocation->LoadTileGroupIds();
+  pOutdoorLocation->_47F3EA();
+  strcpy(pOutdoorLocation->pGroundTileset, "grastyl");
   pGameLoadingUI_ProgressBar->Progress();
-  v5->pTerrain.Initialize();
+  pOutdoorLocation->pTerrain.Initialize();
   v108 = 16384;
   v107 = (int)v43;
-  v106 = (char *)v5->pTerrain.pHeightmap;
+  v106 = (char *)pOutdoorLocation->pTerrain.pHeightmap;
   memcpy(v106, v43, 0x4000u);
   v43 = (char *)v43 + 16384;
   v105 = 16384;
   v104 = (void *)v43;
-  v103 = v5->pTerrain.pTilemap;
+  v103 = pOutdoorLocation->pTerrain.pTilemap;
   memcpy(v103, v43, 0x4000u);
   v43 = (char *)v43 + 16384;
-  memcpy(v5->pTerrain.pAttributemap, v43, 0x4000u);
+  memcpy(pOutdoorLocation->pTerrain.pAttributemap, v43, 0x4000u);
   v43 = (char *)v43 + 16384;
-  v108 = (int)v5->ptr_D4;
+  v108 = (int)pOutdoorLocation->ptr_D4;
   pAllocator->FreeChunk((void *)v108);
-  v5->ptr_D4 = 0;
-  v5->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
-  v5->pTerrain._47C80A(0, 0, 128, 128);
+  pOutdoorLocation->ptr_D4 = 0;
+  pOutdoorLocation->ptr_D4 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
+  pOutdoorLocation->pTerrain._47C80A(0, 0, 128, 128);
   pGameLoadingUI_ProgressBar->Progress();
   memcpy(&uNumTerrainNormals, v43, 4u);
   v43 = (char *)v43 + 4;
@@ -1695,101 +1682,95 @@
   memcpy(pTerrainNormalIndices, v43, 0x10000u);
   v43 = (char *)v43 + 65536;
   pFilename = (char *)(12 * uNumTerrainNormals);
-  pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(
-                                     pTerrainNormals,
-                                     12 * uNumTerrainNormals,
-                                     "TerNorm");
+  pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
   memcpy(pTerrainNormals, v43, (size_t)pFilename);
   v44 = (char *)v43 + (int)pFilename;
-  memcpy(&v5->uNumBModels, v44, 4u);
+  memcpy(&pOutdoorLocation->uNumBModels, v44, 4u);
   v44 = (char *)v44 + 4;
   pGameLoadingUI_ProgressBar->Progress();
-  v45 = v5->uNumBModels;
+  v45 = pOutdoorLocation->uNumBModels;
   v108 = (int)"BDdata";
   v107 = 188 * v45;
-  v106 = (char *)v5->pBModels;
+  v106 = (char *)pOutdoorLocation->pBModels;
   v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata");
-  v47 = v5->uNumBModels;
-  v5->pBModels = v46;
+  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)v5->uNumBModels > 0 )
+  if ( (signed int)pOutdoorLocation->uNumBModels > 0 )
   {
     v48 = 0;
     while ( 1 )
     {
-      v5->pBModels[v48].pVertices.pVertices = 0;
-      v5->pBModels[v48].pFaces = 0;
-      v5->pBModels[v48].pFacesOrdering = 0;
-      v5->pBModels[v48].pNodes = 0;
+      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)&v5->pBModels[v48];
-      sprintfex(FileName, "%s", v108);
-      v49 = v5->pBModels;
+      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;
-      v5->pBModels[v48].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v51 = &v5->pBModels[v48];
+      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;
-      v5->pBModels[v48].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v52 = &v5->pBModels[v48];
+      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;
-      v5->pBModels[v48].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(
-                                                               v106,
-                                                               v107,
-                                                               FileName);
-      v53 = &v5->pBModels[v48];
+      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;
-      v5->pBModels[v48].pNodes = (BSPNode *)pAllocator->AllocNamedChunk(v106, v107, FileName);
-      v54 = &v5->pBModels[v48];
+      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 = &v5->pBModels[v48];
+      v55 = &pOutdoorLocation->pBModels[v48];
       v105 = 308 * v55->uNumFaces;
       v104 = uSourceLen;
       v103 = v55->pFaces;
       pFilename = (char *)v105;
       memcpy(v103, uSourceLen, v105);
-      v56 = &v5->pBModels[v48];
+      v56 = &pOutdoorLocation->pBModels[v48];
       uSourceLen = (char *)uSourceLen + (int)pFilename;
       v57 = v56->pFacesOrdering;
       pFilename = (char *)(2 * v56->uNumFaces);
       memcpy(v57, uSourceLen, (size_t)pFilename);
-      v58 = &v5->pBModels[v48];
+      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 * v5->pBModels[v48].uNumFaces);
-      pFilename = (char *)(10 * v5->pBModels[v48].uNumFaces);
+      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 = v5->pBModels;
+      v60 = pOutdoorLocation->pBModels;
       if ( (signed int)v60[v48].uNumFaces > 0 )
         break;
 LABEL_74:
       free(ptr);
       ++v151;
       ++v48;
-      if ( v151 >= (signed int)v5->uNumBModels )
+      if ( v151 >= (signed int)pOutdoorLocation->uNumBModels )
         goto LABEL_75;
     }
     v149 = 0;
@@ -1814,7 +1795,7 @@
           pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(v108);
         goto LABEL_69;
       }
-      v108 = *(unsigned __int16 *)((char *)&v5->pBModels[v48].pFaces->uTextureID + (unsigned int)v149);
+      v108 = *(unsigned __int16 *)((char *)&pOutdoorLocation->pBModels[v48].pFaces->uTextureID + (unsigned int)v149);
       pTextureFrameTable->LoadAnimationSequenceAndPalettes(v108);
 LABEL_69:
       if ( *((short *)pFilename + 146) )
@@ -1825,7 +1806,7 @@
           pFilename[30] &= 0xEFu;
       }
       ++v144;
-      v60 = v5->pBModels;
+      v60 = pOutdoorLocation->pBModels;
       v149 = (char *)v149 + 308;
       Str2 += 10;
       if ( v144 >= (signed int)v60[v48].uNumFaces )
@@ -1864,45 +1845,45 @@
     while ( v151 < (signed int)uNumLevelDecorations );
   }
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&v5->field_DC, uSourceLen, 4u);
+  memcpy(&pOutdoorLocation->field_DC, uSourceLen, 4u);
   uSourceLen = (char *)uSourceLen + 4;
-  v108 = (int)v5->pFaceIDLIST;
+  v108 = (int)pOutdoorLocation->pFaceIDLIST;
   pAllocator->FreeChunk((void *)v108);
-  v66 = v5->field_DC;
-  v5->pFaceIDLIST = 0;
+  v66 = pOutdoorLocation->field_DC;
+  pOutdoorLocation->pFaceIDLIST = 0;
   v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST");
-  v68 = v5->field_DC;
-  v5->pFaceIDLIST = (unsigned __int16 *)v67;
+  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)v5->pOMAP;
+  v108 = (int)pOutdoorLocation->pOMAP;
   pAllocator->FreeChunk((void *)v108);
-  v5->pOMAP = 0;
+  pOutdoorLocation->pOMAP = 0;
   v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
   v108 = 65536;
-  v5->pOMAP = (unsigned int *)v69;
+  pOutdoorLocation->pOMAP = (unsigned int *)v69;
   memcpy(v69, uSourceLen, v108);
   uSourceLen = (char *)uSourceLen + 65536;
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&v5->uNumSpawnPoints, uSourceLen, 4u);
+  memcpy(&pOutdoorLocation->uNumSpawnPoints, uSourceLen, 4u);
   uSourceLen = (char *)uSourceLen + 4;
   pGameLoadingUI_ProgressBar->Progress();
-  v70 = v5->uNumSpawnPoints;
+  v70 = pOutdoorLocation->uNumSpawnPoints;
   v108 = (int)"Spawn";
   v107 = 24 * v70;
-  v106 = (char *)v5->pSpawnPoints;
+  v106 = (char *)pOutdoorLocation->pSpawnPoints;
   v71 = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(v106, 24 * v70, "Spawn");
-  v72 = v5->uNumSpawnPoints;
-  v5->pSpawnPoints = v71;
+  v72 = pOutdoorLocation->uNumSpawnPoints;
+  pOutdoorLocation->pSpawnPoints = v71;
   memcpy(v71, uSourceLen, 24 * v72);
   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);
+  v151 = (int)pNew_LOD->FindContainer(pContainer, 1);//
   fread(&header, 0x10u, 1u, (FILE *)v151);
   Str2 = 0;
   if ( header.uVersion != 91969
@@ -1940,14 +1921,14 @@
     {
           MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0);
     }
-    memcpy(&v5->ddm, v75, 0x28u);
+    memcpy(&pOutdoorLocation->ddm, v75, 0x28u);
     v74 = (int)((char *)v75 + 40);
   }
-  v76 = v5->uNumBModels;
+  v76 = pOutdoorLocation->uNumBModels;
   v77 = 0;
   if ( (signed int)v76 > 0 )
   {
-    v78 = (char *)&v5->pBModels->uNumFaces;
+    v78 = (char *)&pOutdoorLocation->pBModels->uNumFaces;
     do
     {
       v77 += *(int *)v78;
@@ -1956,38 +1937,38 @@
     }
     while ( v76 );
   }
-  v79 = v5->ddm.uNumFacesInBModels;
+  v79 = pOutdoorLocation->ddm.uNumFacesInBModels;
   if ( v79 )
   {
-    if ( v5->ddm.uNumBModels )
+    if ( pOutdoorLocation->ddm.uNumBModels )
     {
-      v80 = v5->ddm.uNumDecorations;
+      v80 = pOutdoorLocation->ddm.uNumDecorations;
       if ( v80 )
       {
-        if ( v79 != v77 || v5->ddm.uNumBModels != v5->uNumBModels || v80 != uNumLevelDecorations )
+        if ( v79 != v77 || pOutdoorLocation->ddm.uNumBModels != pOutdoorLocation->uNumBModels || v80 != uNumLevelDecorations )
           Str2 = (char *)1;
       }
     }
   }
   if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 )
-    a4 = 29030400;
+    pNumItems = 29030400;
   if ( Str2 )
   {
     memset(Dst, 0, 0x3C8u);
     memset(Src, 0, 0x3C8u);
     goto LABEL_112;
   }
-  v81 = v5->ddm.uLastRepawnDay;
-  if ( (unsigned int)((char *)File - v81) >= a4 || !v81 )
+  v81 = pOutdoorLocation->ddm.uLastRepawnDay;
+  if ( (unsigned int)((char *)File - v81) >= pNumItems || !v81 )
   {
     memcpy(Dst, (const void *)v74, 0x3C8u);
     memcpy(Src, (const void *)(v74 + 968), 0x3C8u);
 LABEL_112:
     free(v149);
     v25 = Str2 == 0;
-    v5->ddm.uLastRepawnDay = (int)File;
+    pOutdoorLocation->ddm.uLastRepawnDay = (int)File;
     if ( v25 )
-      ++v5->ddm.uNumRespawns;
+      ++pOutdoorLocation->ddm.uNumRespawns;
     v108 = 0;
     *(int *)thisa = 1;
     v151 = (int)pGames_LOD->FindContainer(pContainer, v108);
@@ -2022,27 +2003,27 @@
   v108 = (int)".odm";
   v83 = strlen(pContainer);
   strcpy((char *)v141 + v83, (const char *)v108);
-  memcpy(v5->array_528, (const void *)v74, 0x3C8u);
+  memcpy(pOutdoorLocation->array_528, (const void *)v74, 0x3C8u);
   v84 = (const void *)(v74 + 968);
-  memcpy(v5->array_8F0, v84, 0x3C8u);
+  memcpy(pOutdoorLocation->array_8F0, v84, 0x3C8u);
   v85 = (char *)v84 + 968;
   pGameLoadingUI_ProgressBar->Progress();
   if ( *(int *)thisa )
   {
-    memcpy(v5->array_528, Dst, 0x3C8u);
-    memcpy(v5->array_8F0, Src, 0x3C8u);
+    memcpy(pOutdoorLocation->array_528, Dst, 0x3C8u);
+    memcpy(pOutdoorLocation->array_8F0, Src, 0x3C8u);
   }
-  v25 = v5->uNumBModels == 0;
-  v26 = (v5->uNumBModels & 0x80000000u) != 0;
+  v25 = pOutdoorLocation->uNumBModels == 0;
+  v26 = (pOutdoorLocation->uNumBModels & 0x80000000u) != 0;
   v151 = 0;
   if ( !(v26 | v25) )
   {
-    a4 = 0;
+    pNumItems = 0;
     do
     {
-      v86 = v5->pBModels;
+      v86 = pOutdoorLocation->pBModels;
       thisa = 0;
-      v87 = (unsigned int)((char *)v86 + a4);
+      v87 = (unsigned int)((char *)v86 + pNumItems);
       if ( *(int *)(v87 + 76) > 0 )
       {
         File = 0;
@@ -2050,22 +2031,22 @@
         {
           v106 = (char *)&File->uAttributes + *(int *)(v87 + 84);
           memcpy(v106, v85, 4u);
-          v88 = v5->pBModels;
+          v88 = pOutdoorLocation->pBModels;
           ++File;
           v85 = (char *)v85 + 4;
           ++thisa;
-          v87 = (unsigned int)((char *)v88 + a4);
+          v87 = (unsigned int)((char *)v88 + pNumItems);
         }
         while ( thisa < *(int *)(v87 + 76) );
       }
-      v89 = v5->pBModels;
+      v89 = pOutdoorLocation->pBModels;
       thisa = 0;
-      if ( *(signed int *)((char *)&v89->uNumFaces + a4) > 0 )
+      if ( *(signed int *)((char *)&v89->uNumFaces + pNumItems) > 0 )
       {
         pFilename = 0;
         do
         {
-          v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + a4)];
+          v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)];
           File = v90;
           if ( v90->sCogTriggeredID )
           {
@@ -2075,15 +2056,15 @@
               BYTE2(File->uAttributes) &= 0xEFu;
           }
           ++thisa;
-          v89 = v5->pBModels;
+          v89 = pOutdoorLocation->pBModels;
           pFilename += 308;
         }
-        while ( thisa < *(signed int *)((char *)&v89->uNumFaces + a4) );
+        while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) );
       }
       ++v151;
-      a4 += 188;
+      pNumItems += 188;
     }
-    while ( v151 < (signed int)v5->uNumBModels );
+    while ( v151 < (signed int)pOutdoorLocation->uNumBModels );
   }
   pGameLoadingUI_ProgressBar->Progress();
   v151 = 0;
@@ -2135,34 +2116,34 @@
   pGameLoadingUI_ProgressBar->Progress();
   memcpy(&stru_5E4C90, v96, 0xC8u);
   pGameLoadingUI_ProgressBar->Progress();
-  memcpy(&v5->uLastVisitDay, v96 + 200, 0x38u);
+  memcpy(&pOutdoorLocation->uLastVisitDay, v96 + 200, 0x38u);
   free(v149);
   pTileTable->InitializeTileset(4);
-  thisa = (int)v5->pTileTypes;
-  v108 = v5->pTileTypes[0].uTileGroup;
+  thisa = (int)pOutdoorLocation->pTileTypes;
+  v108 = pOutdoorLocation->pTileTypes[0].uTileGroup;
   pTileTable->InitializeTileset(v108);
-  v108 = v5->pTileTypes[1].uTileGroup;
+  v108 = pOutdoorLocation->pTileTypes[1].uTileGroup;
   pTileTable->InitializeTileset(v108);
-  v108 = v5->pTileTypes[2].uTileGroup;
+  v108 = pOutdoorLocation->pTileTypes[2].uTileGroup;
   pTileTable->InitializeTileset(v108);
-  v108 = v5->pTileTypes[3].uTileGroup;
+  v108 = pOutdoorLocation->pTileTypes[3].uTileGroup;
   pTileTable->InitializeTileset(v108);
-  strcpy(v5->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
-  v97 = v5->pTileTypes[0].uTileID;
+  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);
-  v5->uMainTile_BitmapID = v99;
+  pOutdoorLocation->uMainTile_BitmapID = v99;
   if ( v99 != -1 )
   {
     v108 = (v99 != -1 ? pBitmaps_LOD->pTextures[v99].palette_id1 : 36);
     if (v99 != -1)
       pBitmaps_LOD->pTextures[v99].palette_id2 = pPaletteManager->LoadPalette(v108);
   }
-  v5->_47F0E2();
+  pOutdoorLocation->_47F0E2();
 LABEL_150:
-  v100 = HIDWORD(v5->uLastVisitDay);
-  LODWORD(v142) = LODWORD(v5->uLastVisitDay);
+  v100 = HIDWORD(pOutdoorLocation->uLastVisitDay);
+  LODWORD(v142) = LODWORD(pOutdoorLocation->uLastVisitDay);
   HIDWORD(v142) = v100;
   if ( v100 | (unsigned int)v142 )
   {
@@ -2173,15 +2154,15 @@
         v108 = dword_4EC268[rand() % dword_4EC2A8];
       else
         v108 = dword_4EC28C[rand() % dword_4EC2AC];
-      sprintfex(v5->field_4F8, "plansky%d", v108);
+      sprintf(pOutdoorLocation->field_4F8, "plansky%d", v108);
     }
   }
   else
   {
-    strcpy(v5->field_4F8, "plansky3");
+    strcpy(pOutdoorLocation->field_4F8, "plansky3");
   }
-  v101 = pBitmaps_LOD->LoadTexture(v5->field_4F8);
-  v5->uSky_TextureID = v101;
+  v101 = pBitmaps_LOD->LoadTexture(pOutdoorLocation->field_4F8);
+  pOutdoorLocation->uSky_TextureID = v101;
   if ( v101 != -1 )
   {
     v108 = (v101 != -1 ? pBitmaps_LOD->pTextures[v101].palette_id1 : 36);
@@ -2596,10 +2577,10 @@
     {
       pDecorationList->InitializeDecorationSprite(v3->uDecorationDescID);
       v4 = pDecorationList->pDecorations[v3->uDecorationDescID].uSoundID;
-      if ( v4 && _6807E0_num_decorations_6807B8 < 9 )
+      if ( v4 && pNumSoundDecorations < 9 )
       {
         pSoundList->_4A9A67(v4, 0);
-        v5 = _6807E0_num_decorations_6807B8++;
+        v5 = pNumSoundDecorations++;
         _6807B8_level_decorations_ids[v5] = v2;
       }
       if ( v8 && v3->uCog == 20 )
@@ -2742,7 +2723,7 @@
 }
 
 //----- (0047F420) --------------------------------------------------------
-bool OutdoorLocation::_47F420()
+bool OutdoorLocation::LoadTileGroupIds()
 {
   char *v1; // esi@1
   signed int v2; // edi@1
--- a/Outdoor.h	Mon Oct 29 21:54:17 2012 +0600
+++ b/Outdoor.h	Fri Nov 02 00:41:52 2012 +0600
@@ -42,6 +42,7 @@
     this->ptr_C = 0;
     this->field_10 = 0;
     this->field_12 = 0;
+	this->pAttributemap = nullptr;
   }
 
   void _47C7A9();
@@ -156,7 +157,7 @@
   int _47F223_LooksLikeGenerateMonsterLoot();
   bool InitalizeActors(int a1);
   bool _47F3EA();
-  bool _47F420();
+  bool LoadTileGroupIds();
   double GetFogDensityByTime();
   int GetSomeOtherTileInfo(int sX, int sY);
   unsigned int GetTileTexture(int sX, int sZ);
--- a/PaletteManager.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/PaletteManager.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -329,7 +329,7 @@
 
   v2 = this;
   v3 = (char *)this + 768 * a2;
-  if ( this->field_267AD3 || this->field_267AD4 || this->field_267AD5 )
+  if ( this->pPalette_tintColor[0] || this->pPalette_tintColor[1] || this->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->field_267AD4;
-      LODWORD(v75) = v2->field_267AD5 + (unsigned __int8)v3[2];
+      v12 = v2->pPalette_tintColor[1];
+      LODWORD(v75) = v2->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->field_267AD3;
+      LODWORD(v75) = LODWORD(v14) + v2->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->field_267AD0;
-  if ( v45 || v2->field_267AD1 || v2->field_267AD2 )
+  v45 = v2->pPalette_mistColor[0];
+  if ( v45 || v2->pPalette_mistColor[1] || v2->pPalette_mistColor[2] )
   {
     v46 = (double)v45;
-    v80 = v2->field_267AD1;
-    v47 = v2->field_267AD2;
+    v80 = v2->pPalette_mistColor[1];
+    v47 = v2->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->field_267AD0 || v2->field_267AD1 || v2->field_267AD2 )
+      if ( v2->pPalette_mistColor[0] || v2->pPalette_mistColor[1] || v2->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 Oct 29 21:54:17 2012 +0600
+++ b/PaletteManager.h	Fri Nov 02 00:41:52 2012 +0600
@@ -31,12 +31,8 @@
   int pPaletteIDs[50];
   int _num_locked;
   int _pal_lock_test;
-  unsigned __int8 field_267AD0;
-  unsigned __int8 field_267AD1;
-  unsigned __int8 field_267AD2;
-  char field_267AD3;
-  char field_267AD4;
-  char field_267AD5;
+  unsigned __int8 pPalette_mistColor[2];
+  char pPalette_tintColor[2];
   char field_267AD6;
   char field_267AD7;
   unsigned int uNumTargetRBits;
--- a/VideoPlayer.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/VideoPlayer.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -505,7 +505,7 @@
     v8 = pTmpBuf;
     if ( !bCanLoadFromCD )
       goto LABEL_3;
-    sprintfex(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf);
+    sprintf(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf);
     v5 = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
     hMagicVid = v5;
     if ( v5 == (HANDLE)INVALID_HANDLE_VALUE )
--- a/mm7_2.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/mm7_2.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -13932,9 +13932,9 @@
   pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
   pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
   pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
-  pPaletteManager->field_267AD0 = 128;
-  pPaletteManager->field_267AD1 = 128;
-  pPaletteManager->field_267AD2 = 128;
+  pPaletteManager->pPalette_mistColor[0] = 128;
+  pPaletteManager->pPalette_mistColor[1] = 128;
+  pPaletteManager->pPalette_mistColor[2] = 128;
   pPaletteManager->RecalculateAll();
   pSprites_LOD->field_ECAC = 1;
   pObjectList->InitializeSprites();
--- a/mm7_data.cpp	Mon Oct 29 21:54:17 2012 +0600
+++ b/mm7_data.cpp	Fri Nov 02 00:41:52 2012 +0600
@@ -2311,7 +2311,7 @@
 char *pPotionNotesTXT_Raw;
 char *pHistoryTXT_Raw;
 int _6807B8_level_decorations_ids[777]; // idb
-int _6807E0_num_decorations_6807B8; // weak
+int pNumSoundDecorations; // weak
 int _6807E8_level_decorations_ids[777]; // idb
 int _6836C8_num_decorations_6807E8; // weak
 int dword_69B010[64];
--- a/mm7_data.h	Mon Oct 29 21:54:17 2012 +0600
+++ b/mm7_data.h	Fri Nov 02 00:41:52 2012 +0600
@@ -2218,7 +2218,7 @@
 extern char *pPotionNotesTXT_Raw;
 extern char *pHistoryTXT_Raw;
 extern int _6807B8_level_decorations_ids[]; // idb
-extern int _6807E0_num_decorations_6807B8; // weak
+extern int pNumSoundDecorations; // weak
 extern int _6807E8_level_decorations_ids[]; // idb
 extern int _6836C8_num_decorations_6807E8; // weak
 extern int dword_69B010[64];