Merge pull request #1426 from akortunov/multiplesoundfix

Allow to play only one copy of given sound at time (bug #3647)
pull/282/head
scrawl 7 years ago committed by GitHub
commit d749b7f2a7

@ -579,6 +579,9 @@ namespace MWSound
if((mode&Play_RemoveAtDistance) && (mListenerPos-objpos).length2() > 2000*2000) if((mode&Play_RemoveAtDistance) && (mListenerPos-objpos).length2() > 2000*2000)
return MWBase::SoundPtr(); return MWBase::SoundPtr();
// Only one copy of given sound can be played at time on ptr, so stop previous copy
stopSound3D(ptr, soundId);
if(!(mode&Play_NoPlayerLocal) && ptr == MWMechanics::getPlayer()) if(!(mode&Play_NoPlayerLocal) && ptr == MWMechanics::getPlayer())
{ {
sound.reset(new Sound(volume * sfx->mVolume, basevol, pitch, mode|type|Play_2D)); sound.reset(new Sound(volume * sfx->mVolume, basevol, pitch, mode|type|Play_2D));

Loading…
Cancel
Save