mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 01:26:39 +00:00 
			
		
		
		
	fix weather sounds sometimes playing in interiors
This commit is contained in:
		
							parent
							
								
									cbbc295eb6
								
							
						
					
					
						commit
						f46d9b094b
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -488,7 +488,10 @@ WeatherResult WeatherManager::transition(float factor)
 | 
			
		|||
void WeatherManager::update(float 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;
 | 
			
		||||
        boost::algorithm::to_lower(regionstr);
 | 
			
		||||
| 
						 | 
				
			
			@ -663,7 +666,7 @@ void WeatherManager::update(float duration)
 | 
			
		|||
            mRendering->getSkyManager()->secundaDisable();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if (mCurrentWeather == "thunderstorm" && mNextWeather == "")
 | 
			
		||||
        if (mCurrentWeather == "thunderstorm" && mNextWeather == "" && exterior)
 | 
			
		||||
        {
 | 
			
		||||
            if (mThunderFlash > 0)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -725,6 +728,7 @@ void WeatherManager::update(float duration)
 | 
			
		|||
 | 
			
		||||
    // play sounds
 | 
			
		||||
    std::string ambientSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mAmbientLoopSoundID : "");
 | 
			
		||||
    if (!exterior) ambientSnd = "";
 | 
			
		||||
    if (ambientSnd != "")
 | 
			
		||||
    {
 | 
			
		||||
        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 : "");
 | 
			
		||||
    if (!exterior) rainSnd = "";
 | 
			
		||||
    if (rainSnd != "")
 | 
			
		||||
    {
 | 
			
		||||
        if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue