1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-23 15:40:42 +00:00

Merge branch 'thunderstorm' into 'master'

Interrupt thunder SFX indoors (bug #6402)

Closes #6402

See merge request OpenMW/openmw!3741
This commit is contained in:
psi29a 2024-01-11 16:23:16 +00:00
commit 4c88ab5e07
3 changed files with 15 additions and 4 deletions

View File

@ -32,6 +32,7 @@
Bug #6190: Unintuitive sun specularity time of day dependence Bug #6190: Unintuitive sun specularity time of day dependence
Bug #6222: global map cell size can crash openmw if set to too high a value Bug #6222: global map cell size can crash openmw if set to too high a value
Bug #6313: Followers with high Fight can turn hostile Bug #6313: Followers with high Fight can turn hostile
Bug #6402: The sound of a thunderstorm does not stop playing after entering the premises
Bug #6427: Enemy health bar disappears before damaging effect ends Bug #6427: Enemy health bar disappears before damaging effect ends
Bug #6550: Cloned body parts don't inherit texture effects Bug #6550: Cloned body parts don't inherit texture effects
Bug #6645: Enemy block sounds align with animation instead of blocked hits Bug #6645: Enemy block sounds align with animation instead of blocked hits

View File

@ -180,7 +180,6 @@ namespace MWWorld
, mTransitionDelta(Fallback::Map::getFloat("Weather_" + name + "_Transition_Delta")) , mTransitionDelta(Fallback::Map::getFloat("Weather_" + name + "_Transition_Delta"))
, mThunderFrequency(Fallback::Map::getFloat("Weather_" + name + "_Thunder_Frequency")) , mThunderFrequency(Fallback::Map::getFloat("Weather_" + name + "_Thunder_Frequency"))
, mThunderThreshold(Fallback::Map::getFloat("Weather_" + name + "_Thunder_Threshold")) , mThunderThreshold(Fallback::Map::getFloat("Weather_" + name + "_Thunder_Threshold"))
, mThunderSoundID()
, mFlashDecrement(Fallback::Map::getFloat("Weather_" + name + "_Flash_Decrement")) , mFlashDecrement(Fallback::Map::getFloat("Weather_" + name + "_Flash_Decrement"))
, mFlashBrightness(0.0f) , mFlashBrightness(0.0f)
{ {
@ -823,19 +822,29 @@ namespace MWWorld
void WeatherManager::stopSounds() void WeatherManager::stopSounds()
{ {
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
if (mAmbientSound) if (mAmbientSound)
{ {
MWBase::Environment::get().getSoundManager()->stopSound(mAmbientSound); sndMgr->stopSound(mAmbientSound);
mAmbientSound = nullptr; mAmbientSound = nullptr;
} }
mPlayingAmbientSoundID = ESM::RefId(); mPlayingAmbientSoundID = ESM::RefId();
if (mRainSound) if (mRainSound)
{ {
MWBase::Environment::get().getSoundManager()->stopSound(mRainSound); sndMgr->stopSound(mRainSound);
mRainSound = nullptr; mRainSound = nullptr;
} }
mPlayingRainSoundID = ESM::RefId(); mPlayingRainSoundID = ESM::RefId();
for (ESM::RefId soundId : mWeatherSettings[mCurrentWeather].mThunderSoundID)
if (!soundId.empty() && sndMgr->getSoundPlaying(MWWorld::ConstPtr(), soundId))
sndMgr->stopSound3D(MWWorld::ConstPtr(), soundId);
if (inTransition())
for (ESM::RefId soundId : mWeatherSettings[mNextWeather].mThunderSoundID)
if (!soundId.empty() && sndMgr->getSoundPlaying(MWWorld::ConstPtr(), soundId))
sndMgr->stopSound3D(MWWorld::ConstPtr(), soundId);
} }
float WeatherManager::getWindSpeed() const float WeatherManager::getWindSpeed() const

View File

@ -162,6 +162,8 @@ namespace MWWorld
// This is used for Rain and Thunderstorm // This is used for Rain and Thunderstorm
ESM::RefId mRainLoopSoundID; ESM::RefId mRainLoopSoundID;
std::array<ESM::RefId, 4> mThunderSoundID;
// Is this an ash storm / blight storm? If so, the following will happen: // Is this an ash storm / blight storm? If so, the following will happen:
// - The particles and clouds will be oriented so they appear to come from the Red Mountain. // - The particles and clouds will be oriented so they appear to come from the Red Mountain.
// - Characters will animate their hand to protect eyes from the storm when looking in its direction (idlestorm // - Characters will animate their hand to protect eyes from the storm when looking in its direction (idlestorm
@ -213,7 +215,6 @@ namespace MWWorld
// non-zero values. // non-zero values.
float mThunderFrequency; float mThunderFrequency;
float mThunderThreshold; float mThunderThreshold;
ESM::RefId mThunderSoundID[4];
float mFlashDecrement; float mFlashDecrement;
float mFlashBrightness; float mFlashBrightness;