|
|
|
@ -195,21 +195,19 @@ namespace MWWorld
|
|
|
|
|
mThunderSoundID[3]
|
|
|
|
|
= ESM::RefId::stringRefId(Fallback::Map::getString("Weather_" + name + "_Thunder_Sound_ID_3"));
|
|
|
|
|
|
|
|
|
|
// TODO: support weathers that have both "Ambient Loop Sound ID" and "Rain Loop Sound ID", need to play both
|
|
|
|
|
// sounds at the same time.
|
|
|
|
|
|
|
|
|
|
if (!mRainEffect.empty()) // NOTE: in vanilla, the weathers with rain seem to be hardcoded; changing
|
|
|
|
|
// Using_Precip has no effect
|
|
|
|
|
{
|
|
|
|
|
mAmbientLoopSoundID
|
|
|
|
|
mRainLoopSoundID
|
|
|
|
|
= ESM::RefId::stringRefId(Fallback::Map::getString("Weather_" + name + "_Rain_Loop_Sound_ID"));
|
|
|
|
|
if (mAmbientLoopSoundID.empty()) // default to "rain" if not set
|
|
|
|
|
mAmbientLoopSoundID = ESM::RefId::stringRefId("rain");
|
|
|
|
|
if (mRainLoopSoundID.empty()) // default to "rain" if not set
|
|
|
|
|
mRainLoopSoundID = ESM::RefId::stringRefId("rain");
|
|
|
|
|
else if (mRainLoopSoundID == "None")
|
|
|
|
|
mRainLoopSoundID = ESM::RefId();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
mAmbientLoopSoundID
|
|
|
|
|
= ESM::RefId::stringRefId(Fallback::Map::getString("Weather_" + name + "_Ambient_Loop_Sound_ID"));
|
|
|
|
|
|
|
|
|
|
mAmbientLoopSoundID
|
|
|
|
|
= ESM::RefId::stringRefId(Fallback::Map::getString("Weather_" + name + "_Ambient_Loop_Sound_ID"));
|
|
|
|
|
if (mAmbientLoopSoundID == "None")
|
|
|
|
|
mAmbientLoopSoundID = ESM::RefId();
|
|
|
|
|
}
|
|
|
|
@ -552,8 +550,6 @@ namespace MWWorld
|
|
|
|
|
, mQueuedWeather(0)
|
|
|
|
|
, mRegions()
|
|
|
|
|
, mResult()
|
|
|
|
|
, mAmbientSound(nullptr)
|
|
|
|
|
, mPlayingSoundID()
|
|
|
|
|
{
|
|
|
|
|
mTimeSettings.mNightStart = mSunsetTime + mSunsetDuration;
|
|
|
|
|
mTimeSettings.mNightEnd = mSunriseTime;
|
|
|
|
@ -794,24 +790,52 @@ namespace MWWorld
|
|
|
|
|
mRendering.getSkyManager()->setWeather(mResult);
|
|
|
|
|
|
|
|
|
|
// Play sounds
|
|
|
|
|
if (mPlayingSoundID != mResult.mAmbientLoopSoundID)
|
|
|
|
|
if (mPlayingAmbientSoundID != mResult.mAmbientLoopSoundID)
|
|
|
|
|
{
|
|
|
|
|
stopSounds();
|
|
|
|
|
if (mAmbientSound)
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->stopSound(mAmbientSound);
|
|
|
|
|
mAmbientSound = nullptr;
|
|
|
|
|
}
|
|
|
|
|
if (!mResult.mAmbientLoopSoundID.empty())
|
|
|
|
|
mAmbientSound = MWBase::Environment::get().getSoundManager()->playSound(mResult.mAmbientLoopSoundID,
|
|
|
|
|
mResult.mAmbientSoundVolume, 1.0, MWSound::Type::Sfx, MWSound::PlayMode::Loop);
|
|
|
|
|
mPlayingSoundID = mResult.mAmbientLoopSoundID;
|
|
|
|
|
mPlayingAmbientSoundID = mResult.mAmbientLoopSoundID;
|
|
|
|
|
}
|
|
|
|
|
else if (mAmbientSound)
|
|
|
|
|
mAmbientSound->setVolume(mResult.mAmbientSoundVolume);
|
|
|
|
|
|
|
|
|
|
if (mPlayingRainSoundID != mResult.mRainLoopSoundID)
|
|
|
|
|
{
|
|
|
|
|
if (mRainSound)
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->stopSound(mRainSound);
|
|
|
|
|
mRainSound = nullptr;
|
|
|
|
|
}
|
|
|
|
|
if (!mResult.mRainLoopSoundID.empty())
|
|
|
|
|
mRainSound = MWBase::Environment::get().getSoundManager()->playSound(mResult.mRainLoopSoundID,
|
|
|
|
|
mResult.mAmbientSoundVolume, 1.0, MWSound::Type::Sfx, MWSound::PlayMode::Loop);
|
|
|
|
|
mPlayingRainSoundID = mResult.mRainLoopSoundID;
|
|
|
|
|
}
|
|
|
|
|
else if (mRainSound)
|
|
|
|
|
mRainSound->setVolume(mResult.mAmbientSoundVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WeatherManager::stopSounds()
|
|
|
|
|
{
|
|
|
|
|
if (mAmbientSound)
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->stopSound(mAmbientSound);
|
|
|
|
|
mAmbientSound = nullptr;
|
|
|
|
|
mPlayingSoundID = ESM::RefId();
|
|
|
|
|
mAmbientSound = nullptr;
|
|
|
|
|
}
|
|
|
|
|
mPlayingAmbientSoundID = ESM::RefId();
|
|
|
|
|
|
|
|
|
|
if (mRainSound)
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->stopSound(mRainSound);
|
|
|
|
|
mRainSound = nullptr;
|
|
|
|
|
}
|
|
|
|
|
mPlayingRainSoundID = ESM::RefId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float WeatherManager::getWindSpeed() const
|
|
|
|
@ -1118,6 +1142,7 @@ namespace MWWorld
|
|
|
|
|
mResult.mCloudSpeed = current.mCloudSpeed;
|
|
|
|
|
mResult.mGlareView = current.mGlareView;
|
|
|
|
|
mResult.mAmbientLoopSoundID = current.mAmbientLoopSoundID;
|
|
|
|
|
mResult.mRainLoopSoundID = current.mRainLoopSoundID;
|
|
|
|
|
mResult.mAmbientSoundVolume = 1.f;
|
|
|
|
|
mResult.mPrecipitationAlpha = 1.f;
|
|
|
|
|
|
|
|
|
@ -1237,6 +1262,7 @@ namespace MWWorld
|
|
|
|
|
mResult.mAmbientSoundVolume = 1.f - factor / threshold;
|
|
|
|
|
mResult.mPrecipitationAlpha = mResult.mAmbientSoundVolume;
|
|
|
|
|
mResult.mAmbientLoopSoundID = current.mAmbientLoopSoundID;
|
|
|
|
|
mResult.mRainLoopSoundID = current.mRainLoopSoundID;
|
|
|
|
|
mResult.mRainDiameter = current.mRainDiameter;
|
|
|
|
|
mResult.mRainMinHeight = current.mRainMinHeight;
|
|
|
|
|
mResult.mRainMaxHeight = current.mRainMaxHeight;
|
|
|
|
@ -1252,6 +1278,7 @@ namespace MWWorld
|
|
|
|
|
mResult.mAmbientSoundVolume = (factor - threshold) / (1 - threshold);
|
|
|
|
|
mResult.mPrecipitationAlpha = mResult.mAmbientSoundVolume;
|
|
|
|
|
mResult.mAmbientLoopSoundID = other.mAmbientLoopSoundID;
|
|
|
|
|
mResult.mRainLoopSoundID = other.mRainLoopSoundID;
|
|
|
|
|
|
|
|
|
|
mResult.mRainDiameter = other.mRainDiameter;
|
|
|
|
|
mResult.mRainMinHeight = other.mRainMinHeight;
|
|
|
|
|