diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index 0039ca43d..105662ec6 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -462,14 +462,14 @@ int CSound::LoadWV(const char *pFilename) return SampleID; } -int CSound::LoadWVFromMem(const void *pData, unsigned DataSize) +int CSound::LoadWVFromMem(const void *pData, unsigned DataSize, bool FromEditor = false) { // don't waste memory on sound when we are stress testing if(g_Config.m_DbgStress) return -1; // no need to load sound when we are running with no sound - if(!m_SoundEnabled) + if(!m_SoundEnabled && !FromEditor) return -1; if(!pData) diff --git a/src/engine/client/sound.h b/src/engine/client/sound.h index fadb8432e..ab4f44faf 100644 --- a/src/engine/client/sound.h +++ b/src/engine/client/sound.h @@ -29,7 +29,7 @@ public: virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; } virtual int LoadWV(const char *pFilename); - virtual int LoadWVFromMem(const void *pData, unsigned DataSize); + virtual int LoadWVFromMem(const void *pData, unsigned DataSize, bool FromEditor); virtual void UnloadSample(int SampleID); virtual float GetSampleDuration(int SampleID); // in s diff --git a/src/engine/sound.h b/src/engine/sound.h index 925e754aa..3d5699b12 100644 --- a/src/engine/sound.h +++ b/src/engine/sound.h @@ -37,7 +37,7 @@ public: virtual bool IsSoundEnabled() = 0; virtual int LoadWV(const char *pFilename) = 0; - virtual int LoadWVFromMem(const void *pData, unsigned DataSize) = 0; + virtual int LoadWVFromMem(const void *pData, unsigned DataSize, bool FromEditor = false) = 0; virtual void UnloadSample(int SampleID) = 0; virtual float GetSampleDuration(int SampleID) = 0; // in s diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 5914f2649..821f2c66a 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -2927,7 +2927,7 @@ void CEditor::AddSound(const char *pFileName, int StorageType, void *pUser) io_close(SoundFile); // load sound - int SoundId = pEditor->Sound()->LoadWVFromMem(pData, (unsigned) DataSize); + int SoundId = pEditor->Sound()->LoadWVFromMem(pData, (unsigned) DataSize, true); if(SoundId == -1) return; diff --git a/src/game/editor/io.cpp b/src/game/editor/io.cpp index 102987893..209477d38 100644 --- a/src/game/editor/io.cpp +++ b/src/game/editor/io.cpp @@ -660,7 +660,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag io_close(SoundFile); if(pSound->m_DataSize > 0) { - pSound->m_SoundID = m_pEditor->Sound()->LoadWVFromMem(pSound->m_pData, pSound->m_DataSize); + pSound->m_SoundID = m_pEditor->Sound()->LoadWVFromMem(pSound->m_pData, pSound->m_DataSize, true); } } } @@ -672,7 +672,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag void *pData = DataFile.GetData(pItem->m_SoundData); pSound->m_pData = mem_alloc(pSound->m_DataSize, 1); mem_copy(pSound->m_pData, pData, pSound->m_DataSize); - pSound->m_SoundID = m_pEditor->Sound()->LoadWVFromMem(pSound->m_pData, pSound->m_DataSize); + pSound->m_SoundID = m_pEditor->Sound()->LoadWVFromMem(pSound->m_pData, pSound->m_DataSize, true); } // copy image name