changeset 105:e633cde38d64

Слияние
author Ritor1
date Fri, 02 Nov 2012 10:04:27 +0600
parents 62bfa3ffe7db (current diff) 2d3f4e0379ce (diff)
children 1e18102bd4d0
files Outdoor.cpp Outdoor.h VideoPlayer.cpp mm7_2.cpp
diffstat 10 files changed, 279 insertions(+), 307 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Fri Nov 02 10:04:08 2012 +0600
+++ b/AudioPlayer.cpp	Fri Nov 02 10:04:27 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	Fri Nov 02 10:04:08 2012 +0600
+++ b/Indoor.cpp	Fri Nov 02 10:04:27 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	Fri Nov 02 10:04:08 2012 +0600
+++ b/Outdoor.cpp	Fri Nov 02 10:04:27 2012 +0600
@@ -366,7 +366,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;
   }
@@ -720,7 +720,7 @@
 	pAllocator->FreeChunk(v3);
 	v3 = nullptr;
 	}
-  //pAllocator->FreeChunk(v3);//
+  //pAllocator->FreeChunk(v3); 
   v4 = v1->ptr_C;
   v1->pAttributemap = 0;
   pAllocator->FreeChunk(v4);
@@ -1073,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);
@@ -1162,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
@@ -1182,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
@@ -1313,34 +1313,34 @@
   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;
+  pNumSoundDecorations = 0;
   sprintf(FileName, "levels\\%s", pContainer);
   if ( GetFileAttributesA(FileName) != -1 )
   {
@@ -1353,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);
@@ -1372,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];
-        sprintf(FileName, "%s", v108);
-        v13 = v5->pBModels;
+        v108 = (int)&pOutdoorLocation->pBModels[v12];
+        sprintfex(FileName, "%s", v108);
+        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;
@@ -1481,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) )
         {
@@ -1492,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 )
@@ -1508,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:
@@ -1537,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;
@@ -1554,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;
@@ -1668,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;
@@ -1700,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];
+      v108 = (int)&pOutdoorLocation->pBModels[v48];
       sprintf(FileName, "%s", v108);
-      v49 = v5->pBModels;
+      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;
@@ -1819,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) )
@@ -1830,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 )
@@ -1869,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
@@ -1945,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;
@@ -1961,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);
@@ -2027,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;
@@ -2055,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 )
           {
@@ -2080,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;
@@ -2140,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 )
   {
@@ -2178,15 +2154,15 @@
         v108 = dword_4EC268[rand() % dword_4EC2A8];
       else
         v108 = dword_4EC28C[rand() % dword_4EC2AC];
-      sprintf(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);
@@ -2601,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 )
@@ -2747,7 +2723,7 @@
 }
 
 //----- (0047F420) --------------------------------------------------------
-bool OutdoorLocation::_47F420()
+bool OutdoorLocation::LoadTileGroupIds()
 {
   char *v1; // esi@1
   signed int v2; // edi@1
--- a/Outdoor.h	Fri Nov 02 10:04:08 2012 +0600
+++ b/Outdoor.h	Fri Nov 02 10:04:27 2012 +0600
@@ -157,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	Fri Nov 02 10:04:08 2012 +0600
+++ b/PaletteManager.cpp	Fri Nov 02 10:04:27 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	Fri Nov 02 10:04:08 2012 +0600
+++ b/PaletteManager.h	Fri Nov 02 10:04:27 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	Fri Nov 02 10:04:08 2012 +0600
+++ b/VideoPlayer.cpp	Fri Nov 02 10:04:27 2012 +0600
@@ -492,7 +492,7 @@
 LABEL_3:
     v7 = "Can't open file - anims\\%s.smk";
 LABEL_4:
-    sprintf(v3, v7, v8);
+    sprintfex(v3, v7, v8);
     MessageBoxA(0, v3, "Video File Error", 0);
     return;
   }
@@ -1025,13 +1025,13 @@
     MessageBoxA(nullptr, v12, v15, 0);
       return;
     }
-    sprintf(Str2, "%s.smk", pMovieName);
+    sprintfex(Str2, "%s.smk", pMovieName);
     v5 = OpenSmack(Str2);
     v3->pSmackerMovie = v5;
     if ( !v5 )
     {
       v3->Unload();
-      sprintf(pTmpBuf, "Can't load %s", &Str2);
+      sprintfex(pTmpBuf, "Can't load %s", &Str2);
       v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937";
       v12 = pTmpBuf;
       goto LABEL_6;
@@ -1105,7 +1105,7 @@
       if ( !v6 )
       {
         Unload();
-        sprintf(pVideoName, "Can't load file - anims\\%s.smk", pFilename);
+        sprintfex(pVideoName, "Can't load file - anims\\%s.smk", pFilename);
 LABEL_17:
         MessageBoxA(0, pVideoName, "Smacker Error", 0);
         return;
@@ -1121,7 +1121,7 @@
         Unload();
         v12 = "Can't allocate memory for buffer";
 LABEL_16:
-        sprintf(pVideoName, v12);
+        sprintfex(pVideoName, v12);
         goto LABEL_17;
       }
       SmackToBuffer(v4->pSmackerMovie, 0, 0, v4->pSmackerMovie->Width, v4->pSmackerMovie->Height, v9, 0);
--- a/mm7_2.cpp	Fri Nov 02 10:04:08 2012 +0600
+++ b/mm7_2.cpp	Fri Nov 02 10:04:27 2012 +0600
@@ -145,7 +145,7 @@
   _this.uFrameZ = 334;
   v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
+  sprintfex(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
   _this.DrawText2(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
   if ( dword_F8B19C == 1 )
   {
@@ -206,7 +206,7 @@
       v0 = ptr_507BC0;
       if ( ptr_507BC0->field_40 == 1 )
       {
-        sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
+        sprintfex(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
         _this.DrawText2(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
         _this.DrawText2(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
         v3 = pFontArrus;
@@ -257,8 +257,8 @@
     v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
     v7 = v5->pName;
     v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-    sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
-    sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
+    sprintfex(pTmpBuf, &byte_4F0F98, v8, v7, v6);
+    sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
     ptr_F8B1E8 = pTmpBuf2;
     memcpy(&a1, pDialogueWindow, sizeof(a1));
     w.uFrameWidth = 458;
@@ -310,7 +310,7 @@
   _this.uFrameZ = 334;
   *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
+  sprintfex(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
   _this.DrawText2(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
   if ( dword_F8B19C != 1 )
   {
@@ -394,7 +394,7 @@
       v11 = pGlobalTXT_LocalizationStrings[112];
       v10 = pGlobalTXT_LocalizationStrings[244];
     }
-    sprintf(pTmpBuf, "%s\n%s", v10, v11);
+    sprintfex(pTmpBuf, "%s\n%s", v10, v11);
     _this.DrawText2(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
     _this.DrawText2(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
     v4 = pFontArrus;
@@ -681,7 +681,7 @@
             while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton );
             if ( v86 )
             {
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString);
+              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString);
               v79.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
               pOutString = (GUIFont *)((149 - v89) / v86);
               if ( (149 - v89) / v86 > 32 )
@@ -731,7 +731,7 @@
             }
           }
           v26 = pTmpBuf;
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->uClass]);
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->uClass]);
           strcat(pTmpBuf, "\n \n");
           strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
           goto LABEL_97;
@@ -770,16 +770,16 @@
     v28 = *(int *)v84;
     if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
       v28 = v81;
-    sprintf(&Dest, format_4E2DC8, v28);
-    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
+    sprintfex(&Dest, format_4E2DC8, v28);
+    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
     strcat(&Dest, pTmpBuf2);
     v90 = pFontArrus->CalcTextHeight(&Dest, &v79, 0, 0);
     strcat(&Dest, "\n \n");
     v29 = *(int *)v84;
     if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
       v29 = v81;
-    sprintf(&a1, format_4E2DC8, v29);
-    sprintf(pTmpBuf2,
+    sprintfex(&a1, format_4E2DC8, v29);
+    sprintfex(pTmpBuf2,
       pGlobalTXT_LocalizationStrings[86],
       //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C],
       (signed __int64)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier,
@@ -790,7 +790,7 @@
     v30 = *(int *)v84;
     if ( pDialogueWindow->pCurrentPosActiveItem != 4 )
       v30 = v81;
-    sprintf(&v77, format_4E2DC8, v30);
+    sprintfex(&v77, format_4E2DC8, v30);
     strcat(&v77, pGlobalTXT_LocalizationStrings[160]);
     v82 = pFontArrus->CalcTextHeight(&v77, &v79, 0, 0);
     strcat(&v77, "\n \n");
@@ -802,7 +802,7 @@
       v32 = *(int *)v84;
       if ( pDialogueWindow->pCurrentPosActiveItem != 5 )
         v32 = v81;
-      sprintf(&v75, format_4E2DC8, v32);
+      sprintfex(&v75, format_4E2DC8, v32);
       strcat(&v75, pGlobalTXT_LocalizationStrings[611]);
       v87 = pFontArrus->CalcTextHeight(&v75, &v79, 0, 0);
     }
@@ -816,7 +816,7 @@
     if ( !(v37 ^ __OFSUB__(v34, v35)) )
     {
 LABEL_75:
-      sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
+      sprintfex(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
       v71 = 3;
       v69 = pTmpBuf;
       v67 = 0;
@@ -1215,7 +1215,7 @@
           if ( !v109 )
           {
 LABEL_105:
-            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);
             strcat(pTmpBuf, "\n \n");
             strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
             v7 = pTmpBuf;
@@ -1227,7 +1227,7 @@
             v77 = &v101;
             goto LABEL_15;
           }
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108);
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108);
           v101.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
           v108 = (149 - v106.y) / (signed int)v109;
           if ( (149 - v106.y) / (signed int)v109 > 32 )
@@ -1954,7 +1954,7 @@
           while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem );
           if ( v114 )
           {
-            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111);
             v104.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
             v111 = (const char **)((signed int)(149 - v112) / v114);
             if ( (signed int)(149 - v112) / v114 > 32 )
@@ -2004,7 +2004,7 @@
             return result;
           }
         }
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);
+        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);
         strcat(pTmpBuf, "\n \n");
         strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
         v21 = pTmpBuf;
@@ -2548,7 +2548,7 @@
         while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
         if ( v153 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
           v144.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
           _this = (Player *)((149 - v152) / v153);
           if ( (149 - v152) / v153 > 32 )
@@ -2597,7 +2597,7 @@
           return;
         }
       }
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]);
+      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]);
       strcat(pTmpBuf, "\n \n");
       strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
       v11 = 0;
@@ -5154,7 +5154,7 @@
   {
     v4 = pClassNames[(unsigned __int8)v3[17]];
     v5 = ((Player *)(v3 - 168))->GetBaseLevel();
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4);
+    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4);
     pWindow.DrawText2(
       pFont,
       1u,
@@ -5181,10 +5181,10 @@
   v9 = pGlobalTXT_LocalizationStrings[245];
   if ( v14 != 1 )
     v9 = pGlobalTXT_LocalizationStrings[132];
-  sprintf(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
+  sprintfex(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
   strcat(pTmpBuf, pTmpBuf2);
   pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf, 3u);
-  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23);
+  sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23);
   pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf, 3u);
   BYTE1(dword_6BE364_game_settings_1) |= 0x40u;
   pRenderer->EndScene();
@@ -7640,7 +7640,7 @@
 LABEL_24:
         v44 = "%s C";
 LABEL_25:
-        result = (void *)sprintf(&Source, v44, v45);
+        result = (void *)sprintfex(&Source, v44, v45);
 LABEL_26:
         if ( Source == 48 )
           return result;
@@ -7710,14 +7710,14 @@
             v44 = "%s C";
           }
         }
-        sprintf(&Str2, v44, v45);
+        sprintfex(&Str2, v44, v45);
       }
       v26 = pMonsterList->GetMonsterByName(&Str2);
       v50 = (signed __int16)v26;
       v45 = &Str2;
       if ( (signed __int16)v26 == -1 )
       {
-        sprintf(&Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45);
+        sprintfex(&Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45);
         MessageBoxA(nullptr, &Str, nullptr, 0);
         ExitProcess(0);
       }
@@ -10330,7 +10330,7 @@
                                     }
                                     if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") )
                                     {
-                                      sprintf(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4));
+                                      sprintfex(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4));
                                       MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0);
                                       result = 0;
                                       goto LABEL_76;
@@ -13532,7 +13532,7 @@
   v4 = hdc * BytesPerSector * SectorsPerCluster;
   if ( (unsigned int)v4 < 0x1E00000 )
   {
-    sprintf(
+    sprintfex(
       pTmpBuf,
       "Due to Window Virtual Memory requirements Might and Magic VII\nrequires 30MB of free hard drive space to operate properly.\n\nAvailable on Current Drive = %luk",
       (unsigned int)v4 / 1024i64);
@@ -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();
@@ -14017,7 +14017,7 @@
     v11 = 1;
     do
     {
-      sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", v10, v11);
+      sprintfex(pTmpBuf, "data\\lloyd%d%d.pcx", v10, v11);
       remove(pTmpBuf);
       ++v11;
     }
@@ -14056,7 +14056,7 @@
   int a2[4]; // [sp+1Ch] [bp-10h]@15
 
   auto mm7text_dll = LoadLibraryW(L"mm7text.dll");
-  sprintfex = (int (__cdecl *)(char *a1, const char *a2, ...))GetProcAddress(mm7text_dll, "_sprintf");
+  sprintfex = (int (__cdecl *)(char *a1, const char *a2, ...))GetProcAddress(mm7text_dll, "_sprintfex");
 
   if (pCmdLine && *pCmdLine)
   {
@@ -14300,7 +14300,7 @@
   unsigned int v9; // [sp+184h] [bp-4h]@28
 
   //_getcwd(v5, 120);
-  //sprintf(pIniFilename, "%s\\mm6.ini", v5);
+  //sprintfex(pIniFilename, "%s\\mm6.ini", v5);
   viewparams = new ViewingParams;
   viewparams->uScreenX = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
   viewparams->uScreenY = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
@@ -14972,7 +14972,7 @@
             }
           }
 LABEL_174:
-          sprintf(&Src, "Unknown DirectDraw/Direct3D error number %X", v4);
+          sprintfex(&Src, "Unknown DirectDraw/Direct3D error number %X", v4);
           v13 = strlen(&Src);
           v12 = &Src;
           goto LABEL_175;
@@ -15165,7 +15165,7 @@
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v1 = pItemsTable->pItems[(unsigned int)ptr_507BC4->ptr_1C + 700].pName;
   v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, format_4E2D80, v2, v1);
+  sprintfex(pTmpBuf, format_4E2D80, v2, v1);
   a1.DrawText2(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
   return a1.DrawText(
            pFontSmallnum,
@@ -15861,7 +15861,7 @@
         if ( pParty->pPickedItem.uItemID )
           return 1;
         v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName;
-        sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
+        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
         ShowStatusBarString(pTmpBuf2, 2u);
         if ( v19->uItemID == 506 )
           _449B7E_toggle_bit(pParty->_award_bits, 184, 1u);
--- a/mm7_data.cpp	Fri Nov 02 10:04:08 2012 +0600
+++ b/mm7_data.cpp	Fri Nov 02 10:04:27 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	Fri Nov 02 10:04:08 2012 +0600
+++ b/mm7_data.h	Fri Nov 02 10:04:27 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];