mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Check distance to object before load sound
This commit is contained in:
parent
49489b31f7
commit
624baa6d89
@ -620,14 +620,14 @@ namespace MWSound
|
||||
if(!mOutput->isInitialized())
|
||||
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
|
||||
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
||||
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
|
||||
stopSound(sfx, ptr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user