diff Texture.cpp @ 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 dfc9484ed94c
children c4ab816fcc5e
line wrap: on
line diff
--- 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) --------------------------------------------------------