mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-03 23:45:32 +00:00
Merge pull request #2956 from elsid/sound_reoder_conditions
Check distance to object before load sound
This commit is contained in:
commit
700f70595f
1 changed files with 4 additions and 4 deletions
|
@ -620,14 +620,14 @@ namespace MWSound
|
||||||
if(!mOutput->isInitialized())
|
if(!mOutput->isInitialized())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
const osg::Vec3f objpos(ptr.getRefData().getPosition().asVec3());
|
||||||
|
if ((mode & PlayMode::RemoveAtDistance) && (mListenerPos - objpos).length2() > 2000 * 2000)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
// Look up the sound in the ESM data
|
// Look up the sound in the ESM data
|
||||||
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
||||||
if(!sfx) return nullptr;
|
if(!sfx) return nullptr;
|
||||||
|
|
||||||
const osg::Vec3f objpos(ptr.getRefData().getPosition().asVec3());
|
|
||||||
if((mode&PlayMode::RemoveAtDistance) && (mListenerPos-objpos).length2() > 2000*2000)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
// Only one copy of given sound can be played at time on ptr, so stop previous copy
|
// Only one copy of given sound can be played at time on ptr, so stop previous copy
|
||||||
stopSound(sfx, ptr);
|
stopSound(sfx, ptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue