Loop title screen music (bug #4896)

pull/2206/head
Capostrophic 5 years ago
parent 0ab0e6ef93
commit abae35e88b

@ -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

@ -706,16 +706,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…
Cancel
Save