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

Merge pull request #2206 from Capostrophic/title

Loop title screen music (bug #4896)
This commit is contained in:
Bret Curtis 2019-03-18 08:58:14 +01:00 committed by GitHub
commit 4e3de9b00c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 11 deletions

View File

@ -40,6 +40,7 @@
Bug #4876: AI ratings handling inconsistencies Bug #4876: AI ratings handling inconsistencies
Bug #4877: Startup script executes only on a new game start Bug #4877: Startup script executes only on a new game start
Bug #4888: Global variable stray explicit reference calls break script compilation 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 #4911: Editor: QOpenGLContext::swapBuffers() warning with Qt5
Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used. Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used.
Feature #2229: Improve pathfinding AI Feature #2229: Improve pathfinding AI

View File

@ -710,17 +710,11 @@ void OMW::Engine::go()
{ {
// start in main menu // start in main menu
mEnvironment.getWindowManager()->pushGuiMode (MWGui::GM_MainMenu); mEnvironment.getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
try mEnvironment.getSoundManager()->playTitleMusic();
{
// Is there an ini setting for this filename or something?
mEnvironment.getSoundManager()->streamMusic("Special/morrowind title.mp3");
std::string logo = mFallbackMap["Movies_Morrowind_Logo"]; std::string logo = mFallbackMap["Movies_Morrowind_Logo"];
if (!logo.empty()) if (!logo.empty())
mEnvironment.getWindowManager()->playVideo(logo, true); mEnvironment.getWindowManager()->playVideo(logo, true);
} }
catch (...) {}
}
else else
{ {
mEnvironment.getStateManager()->newGame (!mNewGame); mEnvironment.getStateManager()->newGame (!mNewGame);

View File

@ -89,6 +89,9 @@ namespace MWBase
///< Start playing music from the selected folder ///< Start playing music from the selected folder
/// \param name of the folder that contains the playlist /// \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; virtual void say(const MWWorld::ConstPtr &reference, const std::string& filename) = 0;
///< Make an actor say some text. ///< Make an actor say some text.
/// \param filename name of a sound file in "Sound/" in the data directory. /// \param filename name of a sound file in "Sound/" in the data directory.

View File

@ -471,6 +471,36 @@ namespace MWSound
startRandomTitle(); 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) void SoundManager::say(const MWWorld::ConstPtr &ptr, const std::string &filename)
{ {
@ -1122,10 +1152,10 @@ namespace MWSound
if(!mOutput->isInitialized()) if(!mOutput->isInitialized())
return; return;
updateSounds(duration);
if (MWBase::Environment::get().getStateManager()->getState()!= if (MWBase::Environment::get().getStateManager()->getState()!=
MWBase::StateManager::State_NoGame) MWBase::StateManager::State_NoGame)
{ {
updateSounds(duration);
updateRegionSound(duration); updateRegionSound(duration);
updateWaterSound(duration); updateWaterSound(duration);
} }

View File

@ -168,6 +168,9 @@ namespace MWSound
///< Start playing music from the selected folder ///< Start playing music from the selected folder
/// \param name of the folder that contains the playlist /// \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); virtual void say(const MWWorld::ConstPtr &reference, const std::string& filename);
///< Make an actor say some text. ///< Make an actor say some text.
/// \param filename name of a sound file in "Sound/" in the data directory. /// \param filename name of a sound file in "Sound/" in the data directory.