1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 10:36:42 +00:00

fix weather sounds sometimes playing in interiors

This commit is contained in:
scrawl 2012-03-13 17:25:07 +01:00
parent cbbc295eb6
commit f46d9b094b

View file

@ -488,7 +488,10 @@ WeatherResult WeatherManager::transition(float factor)
void WeatherManager::update(float duration) void WeatherManager::update(float duration)
{ {
mWeatherUpdateTime -= duration; mWeatherUpdateTime -= duration;
if (mEnvironment->mWorld->isCellExterior() || mEnvironment->mWorld->isCellQuasiExterior())
bool exterior = (mEnvironment->mWorld->isCellExterior() || mEnvironment->mWorld->isCellQuasiExterior());
if (exterior)
{ {
std::string regionstr = mEnvironment->mWorld->getPlayer().getPlayer().getCell()->cell->region; std::string regionstr = mEnvironment->mWorld->getPlayer().getPlayer().getCell()->cell->region;
boost::algorithm::to_lower(regionstr); boost::algorithm::to_lower(regionstr);
@ -663,7 +666,7 @@ void WeatherManager::update(float duration)
mRendering->getSkyManager()->secundaDisable(); mRendering->getSkyManager()->secundaDisable();
} }
if (mCurrentWeather == "thunderstorm" && mNextWeather == "") if (mCurrentWeather == "thunderstorm" && mNextWeather == "" && exterior)
{ {
if (mThunderFlash > 0) if (mThunderFlash > 0)
{ {
@ -725,6 +728,7 @@ void WeatherManager::update(float duration)
// play sounds // play sounds
std::string ambientSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mAmbientLoopSoundID : ""); std::string ambientSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mAmbientLoopSoundID : "");
if (!exterior) ambientSnd = "";
if (ambientSnd != "") if (ambientSnd != "")
{ {
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), ambientSnd) == mSoundsPlaying.end()) if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), ambientSnd) == mSoundsPlaying.end())
@ -735,6 +739,7 @@ void WeatherManager::update(float duration)
} }
std::string rainSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mRainLoopSoundID : ""); std::string rainSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mRainLoopSoundID : "");
if (!exterior) rainSnd = "";
if (rainSnd != "") if (rainSnd != "")
{ {
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end()) if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end())