diff AudioPlayer.cpp @ 1487:cb396f55671e

Слияние
author Ritor1
date Thu, 29 Aug 2013 22:02:00 +0600
parents 59d1da1863df
children c4ab816fcc5e
line wrap: on
line diff
--- a/AudioPlayer.cpp	Thu Aug 29 22:01:47 2013 +0600
+++ b/AudioPlayer.cpp	Thu Aug 29 22:02:00 2013 +0600
@@ -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) --------------------------------------------------------
@@ -1665,7 +1681,7 @@
     auto decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID];
       //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID];
       //v49 = v48->uFlags;
-      uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_SLOW_LOOP) >> 6;
+      uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_DESC_SLOW_LOOP) >> 6;
  
     if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk())
     {
@@ -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;