1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Wait for the previous sound to stop

This commit is contained in:
unknown 2020-10-25 12:20:14 +01:00
parent 1ce296aa7f
commit eebb320916
4 changed files with 9 additions and 8 deletions

View File

@ -60,6 +60,7 @@
Bug #5639: Tooltips cover Messageboxes Bug #5639: Tooltips cover Messageboxes
Bug #5644: Summon effects running on the player during game initialization cause crashes Bug #5644: Summon effects running on the player during game initialization cause crashes
Bug #5656: Sneaking characters block hits while standing Bug #5656: Sneaking characters block hits while standing
Bug #5661: Region sounds don't play at the right interval
Feature #390: 3rd person look "over the shoulder" Feature #390: 3rd person look "over the shoulder"
Feature #2386: Distant Statics in the form of Object Paging Feature #2386: Distant Statics in the form of Object Paging
Feature #2404: Levelled List can not be placed into a container Feature #2404: Levelled List can not be placed into a container

View File

@ -20,10 +20,9 @@ namespace MWSound
} }
RegionSoundSelector::RegionSoundSelector() RegionSoundSelector::RegionSoundSelector()
{ : mMinTimeBetweenSounds(Fallback::Map::getFloat("Weather_Minimum_Time_Between_Environmental_Sounds"))
mMinTimeBetweenSounds = Fallback::Map::getFloat("Weather_Minimum_Time_Between_Environmental_Sounds"); , mMaxTimeBetweenSounds(Fallback::Map::getFloat("Weather_Maximum_Time_Between_Environmental_Sounds"))
mMaxTimeBetweenSounds = Fallback::Map::getFloat("Weather_Maximum_Time_Between_Environmental_Sounds"); {}
}
boost::optional<std::string> RegionSoundSelector::getNextRandom(float duration, const std::string& regionName, boost::optional<std::string> RegionSoundSelector::getNextRandom(float duration, const std::string& regionName,
const MWBase::World& world) const MWBase::World& world)
@ -71,9 +70,6 @@ namespace MWSound
if (it == region->mSoundList.end()) if (it == region->mSoundList.end())
return {}; return {};
// TODO
// mTimeToNextEnvSound += soundDuration
return it->mSound; return it->mSound;
} }
} }

View File

@ -895,9 +895,11 @@ namespace MWSound
if (!cell->isExterior()) if (!cell->isExterior())
return; return;
if (mCurrentRegionSound && mOutput->isSoundPlaying(mCurrentRegionSound))
return;
if (const auto next = mRegionSoundSelector.getNextRandom(duration, cell->mRegion, *world)) if (const auto next = mRegionSoundSelector.getNextRandom(duration, cell->mRegion, *world))
playSound(*next, 1.0f, 1.0f); mCurrentRegionSound = playSound(*next, 1.0f, 1.0f);
} }
void SoundManager::updateWaterSound() void SoundManager::updateWaterSound()

View File

@ -120,6 +120,8 @@ namespace MWSound
const ESM::Cell *mLastCell = nullptr; const ESM::Cell *mLastCell = nullptr;
Sound* mCurrentRegionSound;
Sound_Buffer *insertSound(const std::string &soundId, const ESM::Sound *sound); Sound_Buffer *insertSound(const std::string &soundId, const ESM::Sound *sound);
Sound_Buffer *lookupSound(const std::string &soundId) const; Sound_Buffer *lookupSound(const std::string &soundId) const;