mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 18:56:43 +00:00 
			
		
		
		
	Merge pull request #2206 from Capostrophic/title
Loop title screen music (bug #4896)
This commit is contained in:
		
						commit
						4e3de9b00c
					
				
					 5 changed files with 42 additions and 11 deletions
				
			
		|  | @ -40,6 +40,7 @@ | |||
|     Bug #4876: AI ratings handling inconsistencies | ||||
|     Bug #4877: Startup script executes only on a new game start | ||||
|     Bug #4888: Global variable stray explicit reference calls break script compilation | ||||
|     Bug #4896: Title screen music doesn't loop | ||||
|     Bug #4911: Editor: QOpenGLContext::swapBuffers() warning with Qt5 | ||||
|     Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used. | ||||
|     Feature #2229: Improve pathfinding AI | ||||
|  |  | |||
|  | @ -710,16 +710,10 @@ void OMW::Engine::go() | |||
|     { | ||||
|         // start in main menu
 | ||||
|         mEnvironment.getWindowManager()->pushGuiMode (MWGui::GM_MainMenu); | ||||
|         try | ||||
|         { | ||||
|             // Is there an ini setting for this filename or something?
 | ||||
|             mEnvironment.getSoundManager()->streamMusic("Special/morrowind title.mp3"); | ||||
| 
 | ||||
|             std::string logo = mFallbackMap["Movies_Morrowind_Logo"]; | ||||
|             if (!logo.empty()) | ||||
|                 mEnvironment.getWindowManager()->playVideo(logo, true); | ||||
|         } | ||||
|         catch (...) {} | ||||
|         mEnvironment.getSoundManager()->playTitleMusic(); | ||||
|         std::string logo = mFallbackMap["Movies_Morrowind_Logo"]; | ||||
|         if (!logo.empty()) | ||||
|             mEnvironment.getWindowManager()->playVideo(logo, true); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|  |  | |||
|  | @ -89,6 +89,9 @@ namespace MWBase | |||
|             ///< Start playing music from the selected folder
 | ||||
|             /// \param name of the folder that contains the playlist
 | ||||
| 
 | ||||
|             virtual void playTitleMusic() = 0; | ||||
|             ///< Start playing title music
 | ||||
| 
 | ||||
|             virtual void say(const MWWorld::ConstPtr &reference, const std::string& filename) = 0; | ||||
|             ///< Make an actor say some text.
 | ||||
|             /// \param filename name of a sound file in "Sound/" in the data directory.
 | ||||
|  |  | |||
|  | @ -471,6 +471,36 @@ namespace MWSound | |||
|         startRandomTitle(); | ||||
|     } | ||||
| 
 | ||||
|     void SoundManager::playTitleMusic() | ||||
|     { | ||||
|         if (mCurrentPlaylist == "Title") | ||||
|             return; | ||||
| 
 | ||||
|         if (mMusicFiles.find("Title") == mMusicFiles.end()) | ||||
|         { | ||||
|             std::vector<std::string> filelist; | ||||
|             const std::map<std::string, VFS::File*>& index = mVFS->getIndex(); | ||||
|             // Is there an ini setting for this filename or something?
 | ||||
|             std::string filename = "music/special/morrowind title.mp3"; | ||||
|             auto found = index.find(filename); | ||||
|             if (found != index.end()) | ||||
|             { | ||||
|                 filelist.emplace_back(found->first); | ||||
|                 mMusicFiles["Title"] = filelist; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 Log(Debug::Warning) << "Title music not found"; | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (mMusicFiles["Title"].empty()) | ||||
|             return; | ||||
| 
 | ||||
|         mCurrentPlaylist = "Title"; | ||||
|         startRandomTitle(); | ||||
|     } | ||||
| 
 | ||||
|     void SoundManager::say(const MWWorld::ConstPtr &ptr, const std::string &filename) | ||||
|     { | ||||
|  | @ -1122,10 +1152,10 @@ namespace MWSound | |||
|         if(!mOutput->isInitialized()) | ||||
|             return; | ||||
| 
 | ||||
|         updateSounds(duration); | ||||
|         if (MWBase::Environment::get().getStateManager()->getState()!= | ||||
|             MWBase::StateManager::State_NoGame) | ||||
|         { | ||||
|             updateSounds(duration); | ||||
|             updateRegionSound(duration); | ||||
|             updateWaterSound(duration); | ||||
|         } | ||||
|  |  | |||
|  | @ -168,6 +168,9 @@ namespace MWSound | |||
|         ///< Start playing music from the selected folder
 | ||||
|         /// \param name of the folder that contains the playlist
 | ||||
| 
 | ||||
|         virtual void playTitleMusic(); | ||||
|         ///< Start playing title music
 | ||||
| 
 | ||||
|         virtual void say(const MWWorld::ConstPtr &reference, const std::string& filename); | ||||
|         ///< Make an actor say some text.
 | ||||
|         /// \param filename name of a sound file in "Sound/" in the data directory.
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue