changeset 1477:7ef4b64f6329

* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load Added support for most of mm6 resources, placeholders for mm8 resources. Fixed few C4258
author Nomad
date Wed, 28 Aug 2013 18:43:07 +0200
parents d7720c1f1d3b
children 251111bac49f
files Actor.cpp AudioPlayer.cpp AudioPlayer.h CastSpellInfo.cpp Chest.cpp Chest.h DecorationList.cpp DecorationList.h Game.cpp IconFrameTable.cpp IconFrameTable.h Indoor.cpp Items.cpp LOD.cpp LOD.h Monsters.cpp Monsters.h ObjectList.cpp ObjectList.h Outdoor.cpp Overlays.cpp Overlays.h PlayerFrameTable.h SaveLoad.cpp SpriteObject.cpp Sprites.cpp Sprites.h Texture.cpp Texture.h TileFrameTable.h TileTable.cpp UI/Books/UIMapBook.cpp UI/Books/UINotesBooks.cpp UI/UIHouses.cpp UI/UIRest.cpp UI/UIShops.cpp UI/UITransition.cpp UI/UiGame.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 44 files changed, 553 insertions(+), 230 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Actor.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -2310,7 +2310,7 @@
   {
     pCastSpellInfo.data()->_427D48(v1);
     v4 = 0;
-    v5 = pMapStats->GetMapInfo(pCurrentMapName.data());
+    v5 = pMapStats->GetMapInfo(pCurrentMapName);
     if ( v5 )
       v4 = pMapStats->pInfos[v5]._steal_perm;
     v6 = &pOutdoor->ddm;
@@ -4895,9 +4895,9 @@
   v6 = 0;
   v7 = 0;
   v5 = 0;
-  if ( !_stricmp(pCurrentMapName.data(), "d25.blv") )
+  if ( !_stricmp(pCurrentMapName, "d25.blv") )
     v8 = 1;
-  if ( !_stricmp(pCurrentMapName.data(), "d26.blv") )
+  if ( !_stricmp(pCurrentMapName, "d26.blv") )
     v6 = 1;
   if (pParty->IsPartyGood())
     v7 = 1;
--- a/AudioPlayer.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/AudioPlayer.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -387,11 +387,27 @@
 }
 
 //----- (004A9E89) --------------------------------------------------------
-void *SoundList::FromFile(void *pSerialized)
+void SoundList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  sNumSounds = *(int *)pSerialized;
-  pSounds = (SoundDesc *)pAllocator->AllocNamedChunk(pSounds, 120 * sNumSounds, "Snd Des.");
-  return memcpy(pSounds, (char *)pSerialized + 4, 120 * sNumSounds);
+  uint num_mm6_sounds = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_sounds = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_sounds = data_mm8 ? *(int *)data_mm8 : 0;
+
+  sNumSounds = num_mm6_sounds + num_mm7_sounds + num_mm8_sounds;
+  assert(sNumSounds);
+  assert(!num_mm8_sounds);
+
+  pSounds = (SoundDesc *)pAllocator->AllocNamedChunk(pSounds, sNumSounds * sizeof(SoundDesc), "Snd Des.");
+  memcpy(pSounds, (char *)data_mm7 + 4, num_mm7_sounds * sizeof(SoundDesc));
+  for (uint i = 0; i < num_mm6_sounds; ++i)
+  {
+    auto src = (SoundDesc_mm6 *)((char *)data_mm6 + 4) + i;
+    auto dst = pSounds + num_mm7_sounds + i;
+
+    memcpy(dst, src, sizeof(SoundDesc_mm6));
+    dst->p3DSound = nullptr;
+    dst->bDecompressed = false;
+  }
 }
 
 //----- (004A9ED0) --------------------------------------------------------
@@ -2266,15 +2282,13 @@
     }
   }
 }
-// 4D82F4: using guessed type int __stdcall AIL_3D_sample_status(int);
-// 4ABF23: using guessed type int var_48[16];
 
 //----- (004ABFDB) --------------------------------------------------------
-void  PlayLevelMusic()
+void PlayLevelMusic()
 {
   unsigned int v0; // eax@1
 
-  v0 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v0 = pMapStats->GetMapInfo(pCurrentMapName);
   if ( v0 )
     pAudioPlayer->PlayMusicTrack((MusicID)pMapStats->pInfos[v0].uRedbookTrackID);
 }
@@ -2300,7 +2314,7 @@
   unsigned int pMapID; // eax@1
   int v3; // [sp+4h] [bp-4h]@3
 
-  pMapID = pMapStats->GetMapInfo(pCurrentMapName.data());
+  pMapID = pMapStats->GetMapInfo(pCurrentMapName);
   if ( this->b3DSoundInitialized && this->bEAXSupported )
   {
     v3 = pMapStats->pInfos[pMapID].uEAXEnv;
@@ -2335,7 +2349,7 @@
   int v13; // [sp+20h] [bp-4h]@6
 
   v1 = this;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v2 = pMapStats->GetMapInfo(pCurrentMapName);
   v3 = v1->b3DSoundInitialized == 0;
   v4 = v2;
   v12 = v2;
--- a/AudioPlayer.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/AudioPlayer.h	Wed Aug 28 18:43:07 2013 +0200
@@ -253,7 +253,7 @@
   char         pData[1];
 };
 
-struct SoundDesc
+struct SoundDesc_mm6
 {
   inline bool Is3D()  {return (uFlags & SOUND_DESC_3D) != 0;}
 
@@ -262,6 +262,10 @@
   SOUND_DESC_TYPE eType;
   int uFlags;
   SoundData *pSoundData[17];
+};
+
+struct SoundDesc: public SoundDesc_mm6
+{
   void *p3DSound;
   int bDecompressed;
 };
@@ -283,7 +287,7 @@
   void _4A9D79(int a2);
   void UnloadSound(unsigned int uSoundID, char a3);
   void ToFile();
-  void *FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   int FromFileTxt(const char *Args);
 
   signed int sNumSounds;
--- a/CastSpellInfo.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/CastSpellInfo.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -2122,7 +2122,7 @@
 		case SPELL_WATER_LLOYDS_BEACON:
 		{
 			LODWORD(v733) = 604800 * v2;
-			if ( !_stricmp(pCurrentMapName.data(), "d05.blv") )
+			if ( !_stricmp(pCurrentMapName, "d05.blv") )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
 				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
--- a/Chest.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Chest.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -80,7 +80,7 @@
   if ( !uActiveCharacter )
     return false;
   flag_shout = false;
-  pMapID = pMapStats->GetMapInfo(pCurrentMapName.data());
+  pMapID = pMapStats->GetMapInfo(pCurrentMapName);
   if ( chest->Trapped() && pMapID )
   {
     if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[pMapID].LockX5 )
@@ -419,11 +419,11 @@
     item_in_chest_count = CountChestItems(uChestID);
     if ( item_in_chest_count == -1 )
       return 0;
-    for( int i = 0; i < v5; i++)
+    for( int _i = 0; _i < v5; _i++)
 	{
-      if ( Chest::CanPlaceItemAt(i, v4->uItemID, pChestWindow->par1C) )
+      if ( Chest::CanPlaceItemAt(_i, v4->uItemID, pChestWindow->par1C) )
       {
-        v21 = i;
+        v21 = _i;
       }
     }
     if ( v22 == v5 )
@@ -625,11 +625,20 @@
 
 
 //----- (00458B4F) --------------------------------------------------------
-void ChestList::FromFile(void *pSerialized)
+void ChestList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumChests = *(int *)pSerialized;
-  pChests = (ChestDesc *)pAllocator->AllocNamedChunk(pChests, 36 * uNumChests, "Chest Descrip");
-  memcpy(pChests, (char *)pSerialized + 4, 36 * uNumChests);
+  uint num_mm6_chests = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_chests = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_chests = data_mm8 ? *(int *)data_mm8 : 0;
+
+  uNumChests = num_mm6_chests + num_mm7_chests + num_mm8_chests;
+  assert(uNumChests);
+  assert(!num_mm8_chests);
+
+  pChests = (ChestDesc *)pAllocator->AllocNamedChunk(pChests, uNumChests * sizeof(ChestDesc), "Chest Descrip");
+  memcpy(pChests,                                   (char *)data_mm7 + 4, num_mm7_chests * sizeof(ChestDesc));
+  memcpy(pChests + num_mm7_chests,                  (char *)data_mm6 + 4, num_mm6_chests * sizeof(ChestDesc));
+  memcpy(pChests + num_mm6_chests + num_mm7_chests, (char *)data_mm8 + 4, num_mm8_chests * sizeof(ChestDesc));
 }
 
 
--- a/Chest.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/Chest.h	Wed Aug 28 18:43:07 2013 +0200
@@ -33,7 +33,7 @@
   {}
 
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   int FromFileTxt(const char *Args);
 
 
--- a/DecorationList.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/DecorationList.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -7,12 +7,27 @@
 #include "Indoor.h"
 
 //----- (0045864C) --------------------------------------------------------
-void DecorationList::FromFile(void *pSerialized)
+void DecorationList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumDecorations = *(int *)pSerialized;
-  pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations,
-                           84 * uNumDecorations, "Dec Descrip");
-  memcpy(pDecorations, (char *)pSerialized + 4, 84 * uNumDecorations);
+  uint num_mm6_decs = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_decs = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_decs = data_mm8 ? *(int *)data_mm8 : 0;
+
+  uNumDecorations = num_mm6_decs + num_mm7_decs + num_mm8_decs;
+  assert(uNumDecorations);
+  assert(!num_mm8_decs);
+
+  pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations, uNumDecorations * sizeof(DecorationDesc), "Dec Descrip");
+  memcpy(pDecorations, (char *)data_mm7 + 4, num_mm7_decs * sizeof(DecorationDesc));
+  for (uint i = 0; i < num_mm6_decs; ++i)
+  {
+    memcpy(pDecorations + num_mm7_decs + i, (char *)data_mm6 + 4 + i * sizeof(DecorationDesc_mm6), sizeof(DecorationDesc_mm6));
+    pDecorations[num_mm7_decs + i].uColoredLightRed = 255;
+    pDecorations[num_mm7_decs + i].uColoredLightGreen = 255;
+    pDecorations[num_mm7_decs + i].uColoredLightBlue = 255;
+    pDecorations[num_mm7_decs + i].__padding = 255;
+  }
+  memcpy(pDecorations + num_mm6_decs + num_mm7_decs, (char *)data_mm8 + 4, num_mm8_decs * sizeof(DecorationDesc));
 }
 
 //----- (00458693) --------------------------------------------------------
--- a/DecorationList.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/DecorationList.h	Wed Aug 28 18:43:07 2013 +0200
@@ -23,7 +23,7 @@
 
 /*   54 */
 #pragma pack(push, 1)
-struct DecorationDesc
+struct DecorationDesc_mm6
 {
   inline bool CanMoveThrough() {return (uFlags & DECORATION_MOVE_THROUGH) != 0;}
   inline bool DontDraw()       {return (uFlags & DECORATION_DONT_DRAW) != 0;} 
@@ -40,6 +40,14 @@
   __int16 uFlags;
   __int16 uSoundID;
   __int16 _pad;
+  //unsigned __int8 uColoredLightRed;
+  //unsigned __int8 uColoredLightGreen;
+  //unsigned __int8 uColoredLightBlue;
+  //char __padding;
+};
+
+struct DecorationDesc: public DecorationDesc_mm6
+{
   unsigned __int8 uColoredLightRed;
   unsigned __int8 uColoredLightGreen;
   unsigned __int8 uColoredLightBlue;
@@ -56,7 +64,7 @@
   {}
 
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   bool FromFileTxt(const char *Args);
   void InitializeDecorationSprite(unsigned int uDecID);
   unsigned __int16 GetDecorIdByName(const char *pName);
--- a/Game.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Game.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -516,9 +516,9 @@
       pParty->uFallSpeed = 0;
       pParty->field_6E4 = 0;
       pParty->field_6E0 = 0;
-      if ( _stricmp(Source, pCurrentMapName.data()) )
+      if ( _stricmp(Source, pCurrentMapName) )
       {
-        strcpy(pCurrentMapName.data(), Source);
+        strcpy(pCurrentMapName, Source);
         _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
         _5B65AC_npcdata_fame_or_other = pParty->vPosition.y;
         _5B65B0_npcdata_rep_or_other = pParty->vPosition.z;
--- a/IconFrameTable.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/IconFrameTable.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -112,11 +112,20 @@
 }
 
 //----- (00495056) --------------------------------------------------------
-void IconFrameTable::FromFile(void *pSerialized)
+void IconFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumIcons = *(int *)pSerialized;
-  pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames");
-  memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons);
+  uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0;
+
+  uNumIcons = num_mm6_frames + num_mm7_frames + num_mm8_frames;
+  assert(uNumIcons);
+  assert(!num_mm8_frames);
+
+  pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, uNumIcons * sizeof(IconFrame), "I Frames");
+  memcpy(pIcons,                                   (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame));
+  memcpy(pIcons + num_mm7_frames,                  (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame));
+  memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame));
 }
 
 //----- (0049509D) --------------------------------------------------------
--- a/IconFrameTable.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/IconFrameTable.h	Wed Aug 28 18:43:07 2013 +0200
@@ -29,7 +29,7 @@
   IconFrame *GetFrame(unsigned int uIconID, unsigned int uFrameID);
   void InitializeAnimation(unsigned int uIconID);
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   int FromFileTxt(const char *Args);
   int GetIconAnimLength(unsigned int uIconID);
 
--- a/Indoor.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Indoor.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -2158,7 +2158,7 @@
   if (dword_6BE364_game_settings_1 & 0x2000 )
     _i = 29030400;
   bool _a = false;
-  if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName.data(), "d29.dlv") )
+  if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName, "d29.dlv") )
     _a = true;
 
   //v154 = 875;
@@ -3695,7 +3695,7 @@
     bUnderwater = 1;
     pGame->uFlags2 |= 8u;
   }
-  if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d23.blv") )
+  if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d23.blv") )
     bNoNPCHiring = 1;
   pPaletteManager->pPalette_tintColor[0] = 0;
   pPaletteManager->pPalette_tintColor[1] = 0;
@@ -3703,7 +3703,7 @@
   pPaletteManager->RecalculateAll();
   if ( qword_A750D8 )
     qword_A750D8 = 0i64;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v2 = pMapStats->GetMapInfo(pCurrentMapName);
   v39 = v2;
   if ( v2 )
   {
@@ -3721,8 +3721,7 @@
   _6A0D0C_txt_lod_loading = 0;
   TryLoadLevelFromLOD();
   pStationaryLightsStack->uNumLightsActive = 0;
-  v4 = pIndoor->Load(
-         pCurrentMapName.data(),
+  v4 = pIndoor->Load(pCurrentMapName,
          (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1,
          v1,
          (char *)&pDest)
--- a/Items.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Items.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -2053,7 +2053,7 @@
     signed int v23; // [sp+24h] [bp-4h]@2
 
     v18 = rand() % 100;  //main random
-    v0 = pMapStats->GetMapInfo(pCurrentMapName.data());
+    v0 = pMapStats->GetMapInfo(pCurrentMapName);
     //	v1 = pChests;
     v2 = &pMapStats->pInfos[v0];
     //v21 = pChests;
--- a/LOD.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/LOD.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -17,13 +17,19 @@
 
 
 
-LODFile_IconsBitmaps *pEvents_LOD;
-LODFile_IconsBitmaps *pIcons_LOD;
-LODFile_Sprites *pSprites_LOD;
-LODFile_IconsBitmaps *pBitmaps_LOD;
+LODFile_IconsBitmaps *pEvents_LOD = nullptr;
+
+LODFile_IconsBitmaps *pIcons_LOD = nullptr;
+LODFile_IconsBitmaps *pIcons_LOD_mm6 = nullptr;
 
-LODWriteableFile *pNew_LOD;
-LODWriteableFile *pGames_LOD;
+LODFile_IconsBitmaps *pBitmaps_LOD = nullptr;
+LODFile_IconsBitmaps *pBitmaps_LOD_mm6 = nullptr;
+
+LODFile_Sprites *pSprites_LOD = nullptr;
+LODFile_Sprites *pSprites_LOD_mm6 = nullptr;
+
+LODWriteableFile *pNew_LOD = nullptr;
+LODWriteableFile *pGames_LOD = nullptr;
 
 
 
@@ -1087,26 +1093,16 @@
 
 
 
+//----- (0040FAEE) --------------------------------------------------------
 //----- (0040FA2E) --------------------------------------------------------
-bool LODFile_IconsBitmaps::LoadBitmaps(const char *pFilename)
-{
-  ReleaseAll();
-  if (LoadHeader(pFilename, 1))
-    return false;
-  else
-    return LoadSubIndices("bitmaps") == 0;
-}
-
-
-//----- (0040FAEE) --------------------------------------------------------
-bool LODFile_IconsBitmaps::LoadIconsOrEvents(const char *pLODFilename)
+bool LODFile_IconsBitmaps::Load(const char *pLODFilename, const char *pFolderName)
 {
   ReleaseAll();
 
   if (LoadHeader(pLODFilename, 1))
     return false;
-  else
-    return LoadSubIndices("icons") == 0;
+
+  return LoadSubIndices(pFolderName) == 0;
 }
 
 
@@ -2925,7 +2921,7 @@
   char Drive[4]; // [sp+408h] [bp-8h]@1
   int DstBuf; // [sp+40Ch] [bp-4h]@2
 
-  strcpy(a1, pCurrentMapName.data());
+  strcpy(a1, pCurrentMapName);
   _splitpath(a1, Drive, Dir, Filename, Ext);
   sprintf(a1, "levels\\%s%s", Filename, ".lod");
   v0 = fopen(a1, "rb");
--- a/LOD.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/LOD.h	Wed Aug 28 18:43:07 2013 +0200
@@ -146,8 +146,7 @@
   virtual ~LODFile_IconsBitmaps();
   void SyncLoadedFilesCount();
   unsigned int FindTextureByName(const char *pName);
-  bool LoadBitmaps(const char *pFilename);
-  bool LoadIconsOrEvents(const char *pLODFilename);
+  bool Load(const char *pFilename, const char *pFolderName);
   void ReleaseAll();
   unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
   struct Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
@@ -304,8 +303,13 @@
 
 extern LODFile_IconsBitmaps *pEvents_LOD;
 extern LODFile_IconsBitmaps *pIcons_LOD;
+extern LODFile_IconsBitmaps *pIcons_LOD_mm6;
+
+extern LODFile_IconsBitmaps *pBitmaps_LOD;
+extern LODFile_IconsBitmaps *pBitmaps_LOD_mm6;
+
 extern LODFile_Sprites *pSprites_LOD;
-extern LODFile_IconsBitmaps *pBitmaps_LOD;
+extern LODFile_Sprites *pSprites_LOD_mm6;
 
 extern LODWriteableFile *pNew_LOD;
 extern LODWriteableFile *pGames_LOD;
--- a/Monsters.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Monsters.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -456,11 +456,33 @@
 }
 
 //----- (004598AF) --------------------------------------------------------
-void MonsterList::FromFile(void *pSerialized)
+void MonsterList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumMonsters = *(int *)pSerialized;
+  uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0;
+
+  uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters;
+  assert(uNumMonsters);
+  assert(!num_mm8_monsters);
+
   pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race");
-  memcpy(pMonsters, (char *)pSerialized + 4, sizeof(MonsterDesc) * uNumMonsters);
+  memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc));
+  for (uint i = 0; i < num_mm6_monsters; ++i)
+  {
+    auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i;
+    auto dst = pMonsters + num_mm7_monsters + i;
+
+    dst->uMonsterHeight = src->uMonsterHeight;
+    dst->uMonsterRadius = src->uMonsterRadius;
+    dst->uMovementSpeed = src->uMovementSpeed;
+    dst->uToHitRadius = src->uToHitRadius;
+    dst->uTintColor = 0xFFFFFFFF;
+    memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs, sizeof(src->pSoundSampleIDs));
+    memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName));
+    memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames));
+  }
+  memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters, (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc));
 }
 
 //----- (00459860) --------------------------------------------------------
--- a/Monsters.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/Monsters.h	Wed Aug 28 18:43:07 2013 +0200
@@ -188,6 +188,17 @@
 
 
 #pragma pack(push, 1)
+struct MonsterDesc_mm6
+{
+  unsigned __int16 uMonsterHeight;
+  unsigned __int16 uMonsterRadius;
+  unsigned __int16 uMovementSpeed;
+  __int16 uToHitRadius;
+  unsigned __int16 pSoundSampleIDs[4];
+  char pMonsterName[32];
+  char pSpriteNames[10][10];
+};
+
 struct MonsterDesc
 {
   unsigned __int16 uMonsterHeight;
@@ -210,7 +221,7 @@
   {}
     signed __int16 GetMonsterIDByName(const char *pMonsterName);
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   bool FromFileTxt(const char *Args);
 
   signed int uNumMonsters;
--- a/ObjectList.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/ObjectList.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -56,11 +56,38 @@
 }
 
 //----- (004590DC) --------------------------------------------------------
-void ObjectList::FromFile(void *pSerialized)
+void ObjectList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumObjects = *(int *)pSerialized;
-  pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, 56 * uNumObjects, "Obj Descrip");
-  memcpy(pObjects, (char *)pSerialized + 4, 56 * uNumObjects);
+  uint num_mm6_objs = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_objs = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_objs = data_mm8 ? *(int *)data_mm8 : 0;
+
+  uNumObjects = num_mm6_objs + num_mm7_objs + num_mm8_objs;
+  assert(uNumObjects);
+  assert(!num_mm8_objs);
+
+  pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, uNumObjects * sizeof(ObjectDesc), "Obj Descrip");
+  memcpy(pObjects, (char *)data_mm7 + 4, num_mm7_objs * sizeof(ObjectDesc));
+  for (uint i = 0; i < num_mm6_objs; ++i)
+  {
+    auto src = (ObjectDesc_mm6 *)((char *)data_mm6 + 4) + i;
+    auto dst = pObjects + num_mm7_objs + i;
+    memcpy(dst->field_0, src->field_0, sizeof(dst->field_0));
+    dst->uObjectID = src->uObjectID;
+    dst->uRadius = src->uRadius;
+    dst->uHeight = src->uHeight;
+    dst->uFlags = src->uFlags;
+    dst->uSpriteID = src->uSpriteID;
+    dst->uLifetime = src->uLifetime;
+    dst->uParticleTrailColor = src->uParticleTrailColor;
+    dst->uSpeed = src->uSpeed;
+    dst->uParticleTrailColorR = src->uParticleTrailColorR;
+    dst->uParticleTrailColorG = src->uParticleTrailColorG;
+    dst->uParticleTrailColorB = src->uParticleTrailColorB;
+    dst->field_35_clr = src->field_35_clr;
+    dst->field_36_clr = 0;
+    dst->field_37_clr = 0;
+  }
 }
 
 //----- (00459123) --------------------------------------------------------
--- a/ObjectList.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/ObjectList.h	Wed Aug 28 18:43:07 2013 +0200
@@ -24,6 +24,25 @@
 
 /*   56 */
 #pragma pack(push, 1)
+struct ObjectDesc_mm6
+{
+  inline bool NoSprite() const {return uFlags & OBJECT_DESC_NO_SPRITE;}
+
+  char field_0[32];
+  __int16 uObjectID;
+  __int16 uRadius;
+  __int16 uHeight;
+  __int16 uFlags;
+  unsigned __int16 uSpriteID;
+  __int16 uLifetime;
+  unsigned short uParticleTrailColor;
+  __int16 uSpeed;
+  char uParticleTrailColorR;
+  char uParticleTrailColorG;
+  char uParticleTrailColorB;
+  char field_35_clr;
+};
+
 struct ObjectDesc
 {
   inline bool NoSprite() const {return uFlags & OBJECT_DESC_NO_SPRITE;}
@@ -55,7 +74,7 @@
   {}
 
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   bool FromFileTxt(const char *Args);
   void InitializeSprites();
   __int16 ObjectIDByItemID(unsigned __int16 uItemID);
--- a/Outdoor.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Outdoor.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -649,9 +649,9 @@
 //----- (00489487) --------------------------------------------------------
 void OutdoorLocation::SetFog()
 {
-  strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
+  strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
 
-  auto map_id = pMapStats->GetMapInfo(pCurrentMapName.data());
+  auto map_id = pMapStats->GetMapInfo(pCurrentMapName);
   if (map_id == MAP_INVALID || map_id == MAP_CELESTIA || map_id == MAP_THE_PIT || map_id > MAP_SHOALS)
     return;
 
@@ -2701,7 +2701,7 @@
 
   v1 = 0;
   v8 = 0;
-  if ( !_stricmp(pCurrentMapName.data(), "out09.odm") )
+  if ( !_stricmp(pCurrentMapName, "out09.odm") )
     v8 = 1;
 
   for (uint i = 0; i < uNumLevelDecorations; ++i)
@@ -3558,7 +3558,7 @@
     || pParty->vPosition.y < -22528
     || pParty->vPosition.y > 22528 )
   {
-    strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
+    strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
     v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32);
     if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 )
     {
--- a/Overlays.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Overlays.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -183,11 +183,20 @@
 }
 
 //----- (00458E08) --------------------------------------------------------
-void OverlayList::FromFile(void *pSerialized)
+void OverlayList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumOverlays = *(int *)pSerialized;
-  pOverlays = (OverlayDesc *)pAllocator->AllocNamedChunk(pOverlays, 8 * uNumOverlays, "Ovl Des.");
-  memcpy(pOverlays, (char *)pSerialized + 4, 8 * uNumOverlays);
+  uint num_mm6_overlays = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_overlays = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_overlays = data_mm8 ? *(int *)data_mm8 : 0;
+
+  uNumOverlays = num_mm6_overlays + num_mm7_overlays + num_mm8_overlays;
+  assert(uNumOverlays);
+  assert(!num_mm8_overlays);
+
+  pOverlays = (OverlayDesc *)pAllocator->AllocNamedChunk(pOverlays, uNumOverlays * sizeof(OverlayDesc), "Ovl Des.");
+  memcpy(pOverlays,                                       (char *)data_mm7 + 4, num_mm7_overlays * sizeof(OverlayDesc));
+  memcpy(pOverlays + num_mm7_overlays,                    (char *)data_mm6 + 4, num_mm6_overlays * sizeof(OverlayDesc));
+  memcpy(pOverlays + num_mm6_overlays + num_mm7_overlays, (char *)data_mm8 + 4, num_mm8_overlays * sizeof(OverlayDesc));
 }
 
 //----- (00458E4F) --------------------------------------------------------
--- a/Overlays.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/Overlays.h	Wed Aug 28 18:43:07 2013 +0200
@@ -63,7 +63,7 @@
   {}
 
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   bool FromFileTxt(const char *Args);
   void InitializeSprites();
 
--- a/PlayerFrameTable.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/PlayerFrameTable.h	Wed Aug 28 18:43:07 2013 +0200
@@ -26,7 +26,7 @@
   PlayerFrame *GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID);
   PlayerFrame *GetFrameBy_y(int *a2, int *a3, int a4);
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   int FromFileTxt(const char *Args);
 
   unsigned int uNumFrames;
--- a/SaveLoad.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/SaveLoad.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -216,7 +216,7 @@
     Abortf(pTmpBuf.data());
   }
 
-  strcpy(pCurrentMapName.data(), header.pLocationName);
+  strcpy(pCurrentMapName, header.pLocationName);
   dword_6BE364_game_settings_1 |= 0x2001;
 
   for (uint i = 0; i < uNumSavegameFiles; ++i)
@@ -261,8 +261,8 @@
   unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23
  
   //v66 = a2;
-  strcpy(byte_6BE3B0.data(), pCurrentMapName.data());
-  if (!_stricmp(pCurrentMapName.data(), "d05.blv")) // arena
+  strcpy(byte_6BE3B0.data(), pCurrentMapName);
+  if (!_stricmp(pCurrentMapName, "d05.blv")) // arena
     return;
 
   uncompressed_buff = (char*)malloc(1000000);
@@ -312,7 +312,7 @@
   memset(save_header.pName, 0, 20);
   memset(save_header.pLocationName, 0, 20);
   memset(save_header.field_30, 0, 52);
-  strcpy(save_header.pLocationName, pCurrentMapName.data());
+  strcpy(save_header.pLocationName, pCurrentMapName);
   save_header.uWordTime = pParty->uTimePlayed;
   strcpy(pLodDirectory.pFilename, "header.bin");
   pLodDirectory.uDataSize = sizeof(SavegameHeader);
@@ -485,7 +485,7 @@
       memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
       data_write_pos += 56;
     }
-    strcpy(Source, pCurrentMapName.data());
+    strcpy(Source, pCurrentMapName);
     _splitpath(Source, Drive, Dir, Filename, Ext);
    
     Size = (int)data_write_pos - (int)uncompressed_buff;
@@ -541,13 +541,13 @@
 
   //v1 = uSlot;
   //v6 = uSlot;
-  bNotArena = _stricmp(pCurrentMapName.data(), "d05.blv");
+  bNotArena = _stricmp(pCurrentMapName, "d05.blv");
   if ( bNotArena )
   {
     LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
     SaveGame(0, 0);
     //v2 = 100 * v1;
-    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName.data());
+    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName);
     pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed;
     strcpy(pDir.pFilename, "header.bin");
     pDir.uDataSize = 100;
--- a/SpriteObject.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/SpriteObject.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -997,7 +997,7 @@
   int dir_z; // [sp+10h] [bp-8h]@1
   DAMAGE_TYPE pDamageType; // [sp+14h] [bp-4h]@14
 
-  pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())];
+  pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)];
   dir_x = abs(pParty->vPosition.x - this->vPosition.x);
   dir_y = abs(pParty->vPosition.y - this->vPosition.y);
   dir_z = abs(pParty->vPosition.z + pParty->sEyelevel - this->vPosition.z);
--- a/Sprites.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Sprites.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -245,7 +245,7 @@
     while ( 1 )
     {
         int searchRange = endPos - startPos;
-        int middleFrameIndex = (endPos - startPos) / 2 + startPos;
+        int middleFrameIndex = startPos + (endPos - startPos) / 2;
         int comparisonResult = _stricmp(pSpriteName, this->pSpritePFrames[middleFrameIndex]->pIconName);
         if ( !comparisonResult )
         {
@@ -360,23 +360,68 @@
 }
 
 //----- (0044D9D7) --------------------------------------------------------
-void SpriteFrameTable::FromFile(void *pSerialized)
+void SpriteFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  //v2 = this;
-  uNumSpriteFrames = *(int *)pSerialized;
-  uNumEFrames = *((int *)pSerialized + 1);
-  //memcpy(this, pSerialized, 4u);
-  //memcpy(&v2->field_4, (char *)pSerialized + 4, 4u);
-  pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(pSpriteSFrames, 60 * uNumSpriteFrames, "S Frames");
-  pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(pSpriteEFrames, 2 * uNumSpriteFrames, "E Frames");
-  //v3 = pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames");
-  //v4 = v2->uNumSpriteFrames;
+  uint num_mm6_frames = 0;
+  uint num_mm6_eframes = 0;
+  if (data_mm6)
+  {
+    num_mm6_frames = *(int *)data_mm6;
+    num_mm6_eframes = *((int *)data_mm6 + 1);
+  }
+
+  uint num_mm7_frames = 0;
+  uint num_mm7_eframes = 0;
+  if (data_mm7)
+  {
+    num_mm7_frames = *(int *)data_mm7;
+    num_mm7_eframes = *((int *)data_mm7 + 1);
+  }
+
+  uint num_mm8_frames = 0;
+  uint num_mm8_eframes = 0;
+  if (data_mm8)
+  {
+    num_mm8_frames = *(int *)data_mm8;
+    num_mm8_eframes = *((int *)data_mm8 + 1);
+  }
+  
+  uNumSpriteFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames;
+  uNumEFrames = num_mm6_eframes + num_mm7_eframes + num_mm8_eframes;
+
+  pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(pSpriteSFrames, uNumSpriteFrames * sizeof(SpriteFrame), "S Frames");
+  pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(pSpriteEFrames,     uNumSpriteFrames * sizeof(short), "E Frames");
+
   pSpritePFrames = (SpriteFrame **)pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames");
-  auto uSpriteFramesSize = 60 * uNumSpriteFrames;
-  memcpy(pSpriteSFrames, (char *)pSerialized + 8, uSpriteFramesSize);
-  memcpy(pSpriteEFrames, (char *)pSerialized + uSpriteFramesSize + 8, 2 * uNumEFrames);
-  for (uint i = 0; i < uNumSpriteFrames; ++i)
+
+  auto mm7_frames_size = num_mm7_frames * sizeof(SpriteFrame);
+  memcpy(pSpriteSFrames, (char *)data_mm7 + 8, mm7_frames_size);
+  memcpy(pSpriteEFrames, (char *)data_mm7 + 8 + mm7_frames_size, 2 * num_mm7_eframes);
+
+  auto mm6_frames_size = num_mm6_frames * sizeof(SpriteFrame_mm6);
+  for (uint i = 0; i < num_mm6_frames; ++i)
+  {
+    memcpy(pSpriteSFrames + num_mm7_frames + i, (char *)data_mm6 + 8 + i * sizeof(SpriteFrame_mm6), sizeof(SpriteFrame_mm6));
+    pSpriteSFrames[num_mm7_frames + i].uAnimLength = 0;
+  }
+  memcpy(pSpriteEFrames + num_mm7_frames, (char *)data_mm6 + 8 + mm6_frames_size, 2 * num_mm6_eframes);
+  
+  if (data_mm8) __debugbreak();
+  auto mm8_frames_size = num_mm8_frames * sizeof(SpriteFrame);
+  memcpy(pSpriteSFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8, mm8_frames_size);
+  memcpy(pSpriteEFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8 + mm8_frames_size, 2 * num_mm8_eframes);
+
+  for (uint i = 0; i < num_mm7_frames; ++i)
     pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];
+  
+  for (uint i = num_mm7_frames; i < num_mm6_frames + num_mm7_frames; ++i)
+    pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm7_frames];
+  
+  for (uint i = num_mm6_frames + num_mm7_frames; i < num_mm6_frames + num_mm7_frames + num_mm8_frames; ++i)
+    pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm6_frames + num_mm7_frames];
+
+  //for (uint i = 0; i < uNumSpriteFrames; ++i)
+  //  pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];
 }
 
 //----- (0044DA92) --------------------------------------------------------
--- a/Sprites.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/Sprites.h	Wed Aug 28 18:43:07 2013 +0200
@@ -24,9 +24,8 @@
 
 /*   42 */
 #pragma pack(push, 1)
-class SpriteFrame
+struct SpriteFrame_mm6
 {
-public:
     char pIconName[12]; 
     char pTextureName[12]; //c
     __int16 pHwSpriteIDs[8]; //18h
@@ -36,6 +35,12 @@
     __int16 uPaletteID;  //32
     __int16 uPaletteIndex;
     __int16 uAnimTime;
+    //__int16 uAnimLength;
+    //__int16 _pad;
+};
+
+struct SpriteFrame: SpriteFrame_mm6
+{
     __int16 uAnimLength;
     __int16 _pad;
 };
@@ -54,7 +59,7 @@
         pSpriteEFrames = nullptr;
     }
     void ToFile();
-    void FromFile(void *pSerialized);
+    void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
     bool FromFileTxt(const char *Args);
     void ReleaseSFrames();
     void ResetSomeSpriteFlags();
--- a/Texture.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/Texture.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -264,11 +264,21 @@
 }
 
 //----- (0044E0A0) --------------------------------------------------------
-void TextureFrameTable::FromFile(void *pSerialized)
+void TextureFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  sNumTextures = *(int *)pSerialized;
-  pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, 20 * sNumTextures, "Txt Frames");
-  memcpy(pTextures, (char *)pSerialized + 4, 20 * sNumTextures);
+  uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0;
+
+  sNumTextures = num_mm6_frames + num_mm7_frames + num_mm8_frames;
+  assert(sNumTextures);
+  assert(!num_mm8_frames);
+
+  pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, sNumTextures * sizeof(TextureFrame), "Txt Frames");
+
+  memcpy(pTextures,                                   (char *)data_mm7 + 4, num_mm7_frames * sizeof(TextureFrame));
+  memcpy(pTextures + num_mm7_frames,                  (char *)data_mm6 + 4, num_mm6_frames * sizeof(TextureFrame));
+  memcpy(pTextures + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(TextureFrame));
 }
 
 //----- (0044E0ED) --------------------------------------------------------
--- a/Texture.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/Texture.h	Wed Aug 28 18:43:07 2013 +0200
@@ -110,7 +110,7 @@
   }
   int FromFileTxt(const char *Args);
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   void LoadAnimationSequenceAndPalettes(signed int uIconID);
   unsigned int GetFrameTexture(int uFrameID, signed int a3);
   unsigned int FindTextureByName(const char *Str2);
--- a/TileFrameTable.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/TileFrameTable.h	Wed Aug 28 18:43:07 2013 +0200
@@ -67,7 +67,7 @@
   int GetTileForTerrainType(signed int a1, bool a2);
   unsigned int GetTileId(unsigned int uTerrainType, unsigned int uSection);
   void ToFile();
-  void FromFile(void *pSerialized);
+  void FromFile(void *data_mm6, void *data_mm7, void *data_mm8);
   int FromFileTxt(const char *pFilename);
 
   signed int sNumTiles;
--- a/TileTable.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/TileTable.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -119,11 +119,19 @@
 }
 
 //----- (00488000) --------------------------------------------------------
-void TileTable::FromFile(void *pSerialized)
+void TileTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  sNumTiles = *(int *)pSerialized;
-  pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sizeof(TileDesc) * sNumTiles, "Tile Descrip");
-  memcpy(pTiles, (char *)pSerialized + 4, sizeof(TileDesc) * sNumTiles);
+  uint num_mm6_tiles = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_tiles = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_tiles = data_mm8 ? *(int *)data_mm8 : 0;
+  sNumTiles = num_mm6_tiles + num_mm7_tiles + num_mm8_tiles;
+  assert(sNumTiles);
+  assert(!num_mm8_tiles);
+
+  pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sNumTiles * sizeof(TileDesc), "Tile Descrip");
+  memcpy(pTiles,                                 (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc));
+  memcpy(pTiles + num_mm7_tiles,                 (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc));
+  memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc));
 }
 
 //----- (00488047) --------------------------------------------------------
--- a/UI/Books/UIMapBook.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/Books/UIMapBook.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -255,7 +255,7 @@
   map_window.uFrameY = game_viewport_y;
   map_window.uFrameZ = game_viewport_z;
   map_window.uFrameW = game_viewport_w;
-  map_id = pMapStats->GetMapInfo(pCurrentMapName.data());
+  map_id = pMapStats->GetMapInfo(pCurrentMapName);
   if ( map_id )
     map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
 
--- a/UI/Books/UINotesBooks.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/Books/UINotesBooks.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -94,7 +94,7 @@
   sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
   calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0);
 
-  pMapID = pMapStats->GetMapInfo(pCurrentMapName.data());
+  pMapID = pMapStats->GetMapInfo(pCurrentMapName);
   if ( pMapID )
     pMapName = pMapStats->pInfos[pMapID].pName;
   else
--- a/UI/UIHouses.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/UIHouses.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -2298,10 +2298,10 @@
       v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
       if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
       {
-        if ( _stricmp(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename) )
+        if ( _stricmp(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
         {
           SaveGame(1, 0);
-          strcpy(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename);
+          strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
 
           dword_6BE364_game_settings_1 |= 1u;
           _5B65B8_npcdata_hiword_house_or_other = 0;
--- a/UI/UIRest.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/UIRest.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -60,7 +60,7 @@
         --uRestUI_FoodRequiredToRest;
     if ( uRestUI_FoodRequiredToRest < 1 )
         uRestUI_FoodRequiredToRest = 1;
-    if ( !_stricmp(pCurrentMapName.data(), "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )
+    if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )
         uRestUI_FoodRequiredToRest = 0;
 
     ++pIcons_LOD->uTexturePacksCount;
--- a/UI/UIShops.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/UIShops.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -2483,8 +2483,8 @@
       uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
       uNumSeconds = 0;
       a3 = 0;
-      if ( pMapStats->GetMapInfo(pCurrentMapName.data()) )
-        a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm;
+      if ( pMapStats->GetMapInfo(pCurrentMapName) )
+        a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
       party_reputation = GetPartyReputation();
       if (pPlayers[uActiveCharacter]->CanSteal())
       {
--- a/UI/UITransition.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/UITransition.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -78,7 +78,7 @@
   }
   else if ( !v23 )
   {
-      v14 = pMapStats->GetMapInfo(pCurrentMapName.data());
+      v14 = pMapStats->GetMapInfo(pCurrentMapName);
       if ( v14 )
       {
         sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s"
@@ -89,7 +89,7 @@
   }
   v15 = pLocationName;
   if ( *pLocationName == 48 )
-    v15 = pCurrentMapName.data();
+    v15 = pCurrentMapName;
   v16 = pMapStats->GetMapInfo(v15);
   if ( v16 )
   {
@@ -134,7 +134,7 @@
 
   pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
   pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE);
-  v1 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v1 = pMapStats->GetMapInfo(pCurrentMapName);
   if ( v1 )
     sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
   else
@@ -158,7 +158,7 @@
   unsigned int v9; // [sp+80h] [bp-4h]@1
 
   memcpy(&v7, pPrimaryWindow, sizeof(v7));
-  v9 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v9 = pMapStats->GetMapInfo(pCurrentMapName);
   pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20);
   v0 = pMapStats->GetMapInfo(pDestinationMapName);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
@@ -215,7 +215,7 @@
   int a3; // [sp+6Bh] [bp-1h]@11
 
   memcpy(&v8, pPrimaryWindow, sizeof(v8));
-  v10 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v10 = pMapStats->GetMapInfo(pCurrentMapName);
   v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C));
--- a/UI/UiGame.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/UI/UiGame.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -860,7 +860,7 @@
   if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) )
   {
 LABEL_14:
-    v17 = pMapStats->GetMapInfo(pCurrentMapName.data());
+    v17 = pMapStats->GetMapInfo(pCurrentMapName);
     if ( v17 == v2 )
       result = "No Maze Info for this maze on file!";
     else
--- a/mm7_2.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/mm7_2.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -3022,10 +3022,10 @@
 
   v2 = bLoading;
   v3 = a2;
-  pGameLoadingUI_ProgressBar->Reset(0x1Bu);
+  pGameLoadingUI_ProgressBar->Reset(27);
   pSoundList->_4A9D79(0);
-  uCurrentlyLoadedLevelType = (LEVEL_TYPE)2;
-  ODM_LoadAndInitialize(pCurrentMapName.data(), v3);
+  uCurrentlyLoadedLevelType = LEVEL_Outdoor;
+  ODM_LoadAndInitialize(pCurrentMapName, v3);
   if ( !v2 )
     TeleportToStartingPoint(uLevel_StartingPointType);
   viewparams->_443365();
@@ -3067,7 +3067,7 @@
   //v1 = 0;
   dword_5C6DF8 = 1;
   pNPCStats->uNewlNPCBufPos = 0;
-  v19 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v19 = pMapStats->GetMapInfo(pCurrentMapName);
 
   //v15 = 0;
   for (uint i = 0; i < uNumActors; ++i)
@@ -4090,7 +4090,7 @@
 //----- (00464839) --------------------------------------------------------
 char  Is_out15odm_underwater()
 {
-  return _stricmp(pCurrentMapName.data(), "out15.odm") == 0;
+  return _stricmp(pCurrentMapName, "out15.odm") == 0;
 }
 
 //----- (00464851) --------------------------------------------------------
@@ -4117,12 +4117,12 @@
   pDecalBuilder->Reset(0);
   pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen :
                                                                             GUIProgressBar::TYPE_Box);
-  strcpy(Str1, pCurrentMapName.data());
+  strcpy(Str1, pCurrentMapName);
   v3 = strtok(Str1, ".");
   strcpy(Str1, v3);
   Level_LoadEvtAndStr(Str1);
   LoadLevel_InitializeLevelEvt();
-  strcpy(Str1, pCurrentMapName.data());
+  strcpy(Str1, pCurrentMapName);
   _strrev(Str1);
   strtok(Str1, ".");
   _strrev(Str1);
@@ -4130,11 +4130,11 @@
   for (uint i = 0; i < 1000; ++i)
     pSpriteObjects[i].uObjectDescID = 0;
 
-  v5 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v5 = pMapStats->GetMapInfo(pCurrentMapName);
   bUnderwater = 0;
   uLevelMapStatsID = v5;
   pGame->uFlags2 &= 0xFFFFFFF7u;
-  if ( !_stricmp(pCurrentMapName.data(), "out15.odm") )
+  if ( !_stricmp(pCurrentMapName, "out15.odm") )
   {
     bUnderwater = 1;
     pGame->uFlags2 |= 8u;
@@ -4146,7 +4146,7 @@
     PrepareToLoadBLV(v9);
   pAudioPlayer->SetMapEAX();
   _461103_load_level_sub();
-  if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") )
+  if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") )
   {
     //spawning grounds & good analogue - no loot & exp from monsters
 
@@ -4818,7 +4818,7 @@
   ShowWindow(hWnd, SW_SHOWNORMAL);
 
   pIcons_LOD = new LODFile_IconsBitmaps;
-  if (!pIcons_LOD->LoadIconsOrEvents("data\\icons.lod"))
+  if (!pIcons_LOD->Load("data\\icons.lod", "icons"))
   {
     MessageBoxW(nullptr,
                 L"Some files are missing\n\nPlease Reinstall.",
@@ -4828,7 +4828,7 @@
   pIcons_LOD->dword_011BA4 = 0;
   
   pEvents_LOD = new LODFile_IconsBitmaps;
-  if (!pEvents_LOD->LoadIconsOrEvents("data\\events.lod"))
+  if (!pEvents_LOD->Load("data\\events.lod", "icons"))
   {
     MessageBoxW(nullptr,
                 L"Some files are missing\n\nPlease Reinstall.",
@@ -4839,7 +4839,7 @@
   InitializeGameText();
   
   pBitmaps_LOD = new LODFile_IconsBitmaps;
-  if (!pBitmaps_LOD->LoadBitmaps("data\\bitmaps.lod"))
+  if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps"))
   {
     MessageBoxA(nullptr,
                 pGlobalTXT_LocalizationStrings[63],
@@ -4867,6 +4867,51 @@
     return false;
   }
 
+
+
+  if (_access("../MM_VI/data/icons.lod", 0) == 0)
+  {
+    pIcons_LOD_mm6 = new LODFile_IconsBitmaps;
+    if (!pIcons_LOD_mm6->Load("../MM_VI/data/icons.lod", "icons"))
+    {
+      delete pIcons_LOD_mm6;
+      pIcons_LOD_mm6 = nullptr;
+      Log::Warning(L"Unable to load mm6:icons.lod");
+    }
+  }
+  else
+    Log::Warning(L"Unable to find mm6:icons.lod");
+  
+  if (_access("../MM_VI/data/bitmaps.lod", 0) == 0)
+  {
+    pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps;
+    if (!pBitmaps_LOD_mm6->Load("../MM_VI/data/bitmaps.lod", "bitmaps"))
+    {
+      delete pBitmaps_LOD_mm6;
+      pBitmaps_LOD_mm6 = nullptr;
+      Log::Warning(L"Unable to load mm6:bitmaps.lod");
+    }
+  }
+  else
+    Log::Warning(L"Unable to find mm6:bitmaps.lod");
+
+  auto mm6_sprite_container_name = bUseLoResSprites ? "../MM_VI/data/spriteLO.lod"
+                                                    : "../MM_VI/data/sprites.lod";
+  if (_access(mm6_sprite_container_name, 0) == 0)
+  {
+    pSprites_LOD_mm6 = new LODFile_Sprites;
+    if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name))
+    {
+      delete pSprites_LOD_mm6;
+      pSprites_LOD_mm6 = nullptr;
+      Log::Warning(L"Unable to load mm6:sprites.lod");
+    }
+  }
+  else
+    Log::Warning(L"Unable to find mm6:sprites.lod");
+
+
+
   if (bDebugResouces)
   {
     pSpriteFrameTable = new SpriteFrameTable;
@@ -4915,60 +4960,104 @@
   }
   else
   {
-    auto pSFT = pEvents_LOD->LoadRaw("dsft.bin", 1);
+    void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr,
+         *sft_mm8 = nullptr;
+    auto  sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1);
     pSpriteFrameTable = new SpriteFrameTable;
-    pSpriteFrameTable->FromFile(pSFT);
-    free(pSFT);
-
-    auto pTFT = pEvents_LOD->LoadRaw("dtft.bin", 1);
+    pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8);
+    free(sft_mm6);
+    free(sft_mm7);
+    free(sft_mm8);
+    
+    void *tft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtft.bin", 1) : nullptr,
+         *tft_mm8 = nullptr;
+    auto  tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1);
     pTextureFrameTable = new TextureFrameTable;
-    pTextureFrameTable->FromFile(pTFT);
-    free(pTFT);
-
-    auto pTiles = pEvents_LOD->LoadRaw("dtile.bin", 1);
+    pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8);
+    free(tft_mm6);
+    free(tft_mm7);
+    free(tft_mm8);
+
+    void *tiles_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtile.bin", 1) : nullptr,
+         *tiles_mm8 = nullptr;
+    auto  tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1);
     pTileTable = new TileTable;
-    pTileTable->FromFile(pTiles);
-    free(pTiles);
-
-    auto pPFT = pEvents_LOD->LoadRaw("dpft.bin", 1);
+    pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8);
+    free(tiles_mm6);
+    free(tiles_mm7);
+    free(tiles_mm8);
+    
+    void *pft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dpft.bin", 1) : nullptr,
+         *pft_mm8 = nullptr;
+    auto  pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1);
     pPlayerFrameTable = new PlayerFrameTable;
-    pPlayerFrameTable->FromFile(pPFT);
-    free(pPFT);
-
-    auto pIFT = pEvents_LOD->LoadRaw("dift.bin", 1);
+    pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8);
+    free(pft_mm6);
+    free(pft_mm7);
+    free(pft_mm8);
+
+    void *ift_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dift.bin", 1) : nullptr,
+         *ift_mm8 = nullptr;
+    auto  ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1);
     pIconsFrameTable = new IconFrameTable;
-    pIconsFrameTable->FromFile(pIFT);
-    free(pIFT);
-
-    auto pDecs = pEvents_LOD->LoadRaw("ddeclist.bin", 1);
+    pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8);
+    free(ift_mm6);
+    free(ift_mm7);
+    free(ift_mm8);
+
+    void *decs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("ddeclist.bin", 1) : nullptr,
+         *decs_mm8 = nullptr;
+    auto  decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1);
     pDecorationList = new DecorationList;
-    pDecorationList->FromFile(pDecs);
-    free(pDecs);
-
-    auto pObjs = pEvents_LOD->LoadRaw("dobjlist.bin", 1);
+    pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8);
+    free(decs_mm6);
+    free(decs_mm7);
+    free(decs_mm8);
+
+    void *objs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dobjlist.bin", 1) : nullptr,
+         *objs_mm8 = nullptr;
+    auto  objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1);
     pObjectList = new ObjectList;
-    pObjectList->FromFile(pObjs);
-    free(pObjs);
-
-    auto pMons = pEvents_LOD->LoadRaw("dmonlist.bin", 1);
+    pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8);
+    free(objs_mm6);
+    free(objs_mm7);
+    free(objs_mm8);
+
+    void *mons_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dmonlist.bin", 1) : nullptr,
+         *mons_mm8 = nullptr;
+    auto  mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1);
     pMonsterList = new MonsterList;
-    pMonsterList->FromFile(pMons);
-    free(pMons);
-
-    auto pChests = pEvents_LOD->LoadRaw("dchest.bin", 1);
+    pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8);
+    free(mons_mm6);
+    free(mons_mm7);
+    free(mons_mm8);
+    
+    void *chests_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dchest.bin", 1) : nullptr,
+         *chests_mm8 = nullptr;
+    auto  chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1);
     pChestList = new ChestList;
-    pChestList->FromFile(pChests);
-    free(pChests);
-
-    auto pOverlays = pEvents_LOD->LoadRaw("doverlay.bin", 1);
+    pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8);
+    free(chests_mm6);
+    free(chests_mm7);
+    free(chests_mm8);
+
+    void *overlays_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("doverlay.bin", 1) : nullptr,
+         *overlays_mm8 = nullptr;
+    auto  overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1);
     pOverlayList = new OverlayList;
-    pOverlayList->FromFile(pOverlays);
-    free(pOverlays);
-
-    auto pSounds = pEvents_LOD->LoadRaw("dsounds.bin", 1);
+    pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8);
+    free(overlays_mm6);
+    free(overlays_mm7);
+    free(overlays_mm8);
+
+    void *sounds_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsounds.bin", 1) : nullptr,
+         *sounds_mm8 = nullptr;
+    auto  sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1);
     pSoundList = new SoundList;
-    pSoundList->FromFile(pSounds);
-    free(pSounds);
+    pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8);
+    free(sounds_mm6);
+    free(sounds_mm7);
+    free(sounds_mm8);
   }
 
 
@@ -5168,6 +5257,17 @@
 
 void IntegrityTest()
 {
+  assert(sizeof(SoundDesc_mm6) == 112);
+  assert(sizeof(SoundDesc) == 120);
+  assert(sizeof(OverlayDesc) == 8);
+  assert(sizeof(ChestDesc) == 36);
+  assert(sizeof(ObjectDesc_mm6) == 52);
+  assert(sizeof(ObjectDesc) == 56);
+  assert(sizeof(DecorationDesc) == 84);
+  assert(sizeof(IconFrame) == 32);
+  assert(sizeof(PlayerFrame) == 10);
+  assert(sizeof(TextureFrame) == 20);
+  assert(sizeof(SpriteFrame) == 60);
   assert(sizeof(RenderVertexSoft) == 0x30);
   assert(sizeof(RenderBillboard) == 0x34);
   assert(sizeof(Texture) == 0x48);
@@ -5183,7 +5283,8 @@
   assert(sizeof(OverlayDesc) == 0x8);
   assert(sizeof(ChestDesc) == 0x24);
   assert(sizeof(TileDesc) == 0x1A);
-  assert(sizeof(MonsterDesc) == 0x98);
+  assert(sizeof(MonsterDesc_mm6) == 148);
+  assert(sizeof(MonsterDesc) == 152);
   assert(sizeof(Timer) == 0x28);
   assert(sizeof(OtherOverlay) == 0x14);
   assert(sizeof(ItemGen) == 0x24);
@@ -5392,7 +5493,7 @@
           pParty->Reset();
           pOtherOverlayList->Reset();
 
-          strcpy(pCurrentMapName.data(), pStartingMapName.data());
+          strcpy(pCurrentMapName, pStartingMapName);
           pParty->CreateDefaultParty(0);
           PlayerCreationUI_Initialize();
           if ( PlayerCreationUI_Loop() )
@@ -5452,7 +5553,7 @@
 				break;
 			  }
 			  _chdir("..\\");
-			  strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle);
+			  strcpy(pCurrentMapName, ofn.lpstrFileTitle);
 			  pMouse->Activate(1);
 			  pGame->Loop();
 		  }
@@ -5545,17 +5646,17 @@
 
   wchar_t pStartingMapNameW[1024];
   GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename);
-  sprintf(pStartingMapName.data(), "%S", pStartingMapNameW);
+  sprintf(pStartingMapName, "%S", pStartingMapNameW);
 
   v9 = 0;
-  if ( strlen(pStartingMapName.data()) )
+  if ( strlen(pStartingMapName) )
   {
     do
     {
-      if ( pStartingMapName[v9] == 32 )
+      if ( pStartingMapName[v9] == ' ' )
         pStartingMapName[v9] = 0;
       ++v9;
-      v2 = strlen(pStartingMapName.data());
+      v2 = strlen(pStartingMapName);
     }
     while ( v9 < v2 );
   }
--- a/mm7_3.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/mm7_3.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -5562,7 +5562,7 @@
   GetAlertStatus();
   if ( qword_A750D8 )
     qword_A750D8 = 0i64;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v2 = pMapStats->GetMapInfo(pCurrentMapName);
   v3 = 0;
   if ( v2 )
   {
@@ -7516,7 +7516,7 @@
   v16.uRadius = 32;
   v16.uKind = 3;
   v16.uIndex = v8 + 2 * v9 + v9;
-  v10 = pMapStats->GetMapInfo(pCurrentMapName.data());
+  v10 = pMapStats->GetMapInfo(pCurrentMapName);
   if ( v10 )
   {
     v11 = uNumActors;
@@ -7546,11 +7546,11 @@
   v2 = pMapName;
   pAudioPlayer->StopChannels(-1, -1);
   pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
-  if ( _stricmp(pCurrentMapName.data(), v2) )
+  if ( _stricmp(pCurrentMapName, v2) )
     SaveGame(1, 0);
 
   uGameState = GAME_STATE_2;
-  strcpy(pCurrentMapName.data(), v2);
+  strcpy(pCurrentMapName, v2);
   uLevel_StartingPointType = start_point;
 }
 // 6BE35C: using guessed type int uLevel_StartingPointType;
@@ -7782,7 +7782,7 @@
 //----- (0044C28F) --------------------------------------------------------
 bool TeleportToNWCDungeon()
 {
-  if (!_stricmp("nwc.blv", pCurrentMapName.data()))
+  if (!_stricmp("nwc.blv", pCurrentMapName))
     return false;
 
   _5B65A8_npcdata_uflags_or_other = 0;
--- a/mm7_4.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/mm7_4.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -1697,11 +1697,19 @@
 }
 
 //----- (00494C0F) --------------------------------------------------------
-void PlayerFrameTable::FromFile(void *pSerialized)
+void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  uNumFrames = *(int *)pSerialized;
-  pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames");
-  memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames);
+  uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0;
+  uNumFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames;
+  assert(uNumFrames);
+  assert(!num_mm8_frames);
+
+  pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, uNumFrames * sizeof(PlayerFrame), "P Frames");
+  memcpy(pFrames,                                   (char *)data_mm7 + 4, num_mm7_frames * sizeof(PlayerFrame));
+  memcpy(pFrames + num_mm7_frames,                  (char *)data_mm6 + 4, num_mm6_frames * sizeof(PlayerFrame));
+  memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame));
 }
 
 //----- (00494C5A) --------------------------------------------------------
@@ -2000,7 +2008,7 @@
         case 8:
           v63 = 0;
           v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits;
-          for ( uint i = 0; i < 28; ++i )
+          for ( uint _i = 0; _i < 28; ++_i )
           {
             if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) )
             {
@@ -2141,8 +2149,8 @@
           i += 2;
           break;
         case 23:
-          if ( pMapStats->GetMapInfo(pCurrentMapName.data()) )
-            pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())].pName;
+          if ( pMapStats->GetMapInfo(pCurrentMapName) )
+            pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName;
           else
             pText = pGlobalTXT_LocalizationStrings[394];// "Unknown"
           strcat(pTmpBuf2.data(), pText);
--- a/mm7_5.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/mm7_5.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -1667,7 +1667,7 @@
           dword_50CDC8 = 1;
           sub_42FBDD();
           //pNPCData4 = (NPCData *)GetTravelTime();
-          strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
+          strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
           if ( bUnderwater != 1 && pParty->bFlying
             || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
           {
@@ -1725,14 +1725,14 @@
             }
             pPaletteManager->ResetNonLocked();
             pSpriteFrameTable->ResetSomeSpriteFlags();
-            strcpy(pCurrentMapName.data(), pOut);
-            strcpy(pLevelName, pCurrentMapName.data());
+            strcpy(pCurrentMapName, pOut);
+            strcpy(pLevelName, pCurrentMapName);
             v41 = strtok(pLevelName, ".");
             strcpy(pLevelName, v41);
             Level_LoadEvtAndStr(pLevelName);
             pDecalBuilder->Reset(0);
             LoadLevel_InitializeLevelEvt();
-            uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName.data());
+            uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName);
             bUnderwater = 0;
             bNoNPCHiring = 0;
             pGame->uFlags2 &= 0xFFFFFFF7u;
@@ -1741,7 +1741,7 @@
               bUnderwater = 1;
               pGame->uFlags2 |= 8u;
             }
-            if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d47.blv") )
+            if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") )
               bNoNPCHiring = 1;
             PrepareToLoadODM(1u, (OutdoorCamera *)1);
             pAudioPlayer->SetMapEAX();
@@ -1911,7 +1911,7 @@
           dword_50CDC8 = 1;
           sub_42FBDD();
           SaveGame(1, 0);
-          strcpy(pCurrentMapName.data(), pMapStats->pInfos[uHouse_ExitPic].pFilename);
+          strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename);
           dword_6BE364_game_settings_1 |= 1;
           uGameState = GAME_STATE_2;
           //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C];
@@ -1971,7 +1971,7 @@
             GameUI_SetFooterString(pTmpBuf.data());
             continue;
           }
-          pMapNum = pMapStats->GetMapInfo(pCurrentMapName.data());
+          pMapNum = pMapStats->GetMapInfo(pCurrentMapName);
           pMapName = "Not in Map Stats";
           if ( pMapNum )
             pMapName = pMapStats->pInfos[pMapNum].pName;
@@ -2015,11 +2015,11 @@
           pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0);
           if ( bRecallingBeacon )
           {
-            if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) )
+            if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) )
             {
               SaveGame(1, 0);
               OnMapLeave();
-              strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]);
+              strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]);
               dword_6BE364_game_settings_1 |= 1;
               uGameState = GAME_STATE_2;
               _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
@@ -2059,7 +2059,7 @@
               continue;
             for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg )
             {
-              if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName.data()) )
+              if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) )
                 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg;
             }
           }
@@ -2086,7 +2086,7 @@
                 {
 LABEL_486:
                   SaveGame(1, 0);
-                  v64 = pMapStats->GetMapInfo(pCurrentMapName.data());
+                  v64 = pMapStats->GetMapInfo(pCurrentMapName);
                   v65 = uMessageParam;
                   if ( v64 == TownPortalList[uMessageParam].uMapInfoID )
                   {
@@ -2103,7 +2103,7 @@
                     OnMapLeave();
                     dword_6BE364_game_settings_1 |= 1;
                     uGameState = GAME_STATE_2;
-                    strcpy(pCurrentMapName.data(), pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
+                    strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
                     dword_5B65C0 = 1;
                     _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x;
                     _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y;
@@ -2283,7 +2283,7 @@
               while ( (signed int)pNPCData3 < (signed int)pNPCData4 );
               if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
               {
-                strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
+                strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
                 dword_6BE364_game_settings_1 |= 1u;
                 uGameState = GAME_STATE_2;
                 OnMapLeave();
@@ -2538,7 +2538,7 @@
             pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed;
             pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed;
             pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed;
-            v90 = pMapStats->GetMapInfo(pCurrentMapName.data());
+            v90 = pMapStats->GetMapInfo(pCurrentMapName);
             if ( !v90 )
               v90 = rand() % (signed int)pMapStats->uNumMaps + 1;
             pMapInfo = &pMapStats->pInfos[v90];
--- a/mm7_data.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/mm7_data.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -1015,7 +1015,7 @@
 int dword_50CDCC; // weak
 int bProcessorIsNotIntel; // weak
 Vec3_int_ layingitem_vel_50FDFC;
-std::array<char, 777> pStartingMapName; // idb
+char pStartingMapName[32]; // idb
 std::array<unsigned __int8, 5> IsPlayerWearingWatersuit;
 std::array<char, 54> party_has_equipment;
 std::array<char, 16> byte_5111F6;
@@ -1214,7 +1214,7 @@
 LONG uWindowStyle; // idb
 HMENU hOSMenu; // idb
 int dword_6BE340; // weak
-std::array<char, 20> pCurrentMapName; // idb
+char pCurrentMapName[32]; // idb
 unsigned int uLevelMapStatsID;
 int dword_6BE364_game_settings_1 = 0; // weak
 int dword_6BE368_debug_settings_2 = 0; // weak
--- a/mm7_data.h	Wed Aug 28 14:39:01 2013 +0600
+++ b/mm7_data.h	Wed Aug 28 18:43:07 2013 +0200
@@ -657,7 +657,7 @@
 extern int dword_50CDCC; // weak
 extern int bProcessorIsNotIntel; // weak
 extern Vec3_int_ layingitem_vel_50FDFC;
-extern std::array<char, 777> pStartingMapName; // idb
+extern char pStartingMapName[32]; // idb
 extern std::array<unsigned __int8, 5> IsPlayerWearingWatersuit;
 extern std::array<char, 54> party_has_equipment;
 extern std::array<char, 16> byte_5111F6;
@@ -860,7 +860,7 @@
 extern LONG uWindowStyle; // idb
 extern HMENU hOSMenu; // idb
 extern int dword_6BE340; // weak
-extern std::array<char, 20> pCurrentMapName; // idb
+extern char pCurrentMapName[32]; // idb
 extern unsigned int uLevelMapStatsID;
 extern int dword_6BE364_game_settings_1; // weak
 extern int dword_6BE368_debug_settings_2; // weak