mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-29 03:26:38 +00:00 
			
		
		
		
	added weather sounds
This commit is contained in:
		
							parent
							
								
									69127fa8f1
								
							
						
					
					
						commit
						2196e1321b
					
				
					 2 changed files with 37 additions and 1 deletions
				
			
		|  | @ -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) | ||||
|  |  | |||
|  | @ -243,8 +243,10 @@ namespace MWWorld | |||
|         MWWorld::Environment* mEnvironment; | ||||
|          | ||||
|         std::map<Ogre::String, Weather> mWeatherSettings; | ||||
|          | ||||
| 
 | ||||
|         std::map<std::string, std::string> mRegionOverrides; | ||||
| 
 | ||||
|         std::vector<std::string> mSoundsPlaying; | ||||
|          | ||||
|         Ogre::String mCurrentWeather; | ||||
|         Ogre::String mNextWeather; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue