Merge remote branch 'scrawl/weather'

actorid
Marc Zinnschlag 13 years ago
commit 52dd5ab213

@ -722,6 +722,40 @@ void WeatherManager::update(float duration)
mRendering->skyDisable();
mRendering->getSkyManager()->setThunder(0.f);
}
// play sounds
std::string ambientSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mAmbientLoopSoundID : "");
if (ambientSnd != "")
{
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), ambientSnd) == mSoundsPlaying.end())
{
mSoundsPlaying.push_back(ambientSnd);
mEnvironment->mSoundManager->playSound(ambientSnd, 1.0, 1.0, true);
}
}
std::string rainSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mRainLoopSoundID : "");
if (rainSnd != "")
{
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end())
{
mSoundsPlaying.push_back(rainSnd);
mEnvironment->mSoundManager->playSound(rainSnd, 1.0, 1.0, true);
}
}
// stop sounds
std::vector<std::string>::iterator it=mSoundsPlaying.begin();
while (it!=mSoundsPlaying.end())
{
if ( *it != ambientSnd && *it != rainSnd)
{
mEnvironment->mSoundManager->stopSound(*it);
it = mSoundsPlaying.erase(it);
}
else
++it;
}
}
void WeatherManager::setHour(const float hour)

@ -246,6 +246,8 @@ namespace MWWorld
std::map<std::string, std::string> mRegionOverrides;
std::vector<std::string> mSoundsPlaying;
Ogre::String mCurrentWeather;
Ogre::String mNextWeather;

Loading…
Cancel
Save