Moved lua music logic to a separate function so that ScreenSelectMusic can use lua for the various kinds of sample music.

This commit is contained in:
Kyzentun Keeslala
2015-11-08 22:58:10 -07:00
parent d496f8145c
commit 65c84ef7dc
4 changed files with 73 additions and 60 deletions
+6 -1
View File
@@ -379,7 +379,7 @@ void ScreenSelectMusic::CheckBackgroundRequests( bool bForce )
g_bSampleMusicWaiting = false;
GameSoundManager::PlayMusicParams PlayParams;
PlayParams.sFile = m_sSampleMusicToPlay;
PlayParams.sFile = HandleLuaMusicFile(m_sSampleMusicToPlay);
PlayParams.pTiming = m_pSampleMusicTimingData;
PlayParams.bForceLoop = SAMPLE_MUSIC_LOOPS;
PlayParams.fStartSecond = m_fSampleStartSeconds;
@@ -1859,6 +1859,11 @@ void ScreenSelectMusic::AfterMusicChange()
case SampleMusicPreviewMode_LastSong: // fall through
// play the sample music
m_sSampleMusicToPlay = pSong->GetPreviewMusicPath();
if(ActorUtil::GetFileType(m_sSampleMusicToPlay) != FT_Sound)
{
LuaHelpers::ReportScriptErrorFmt("Music file %s for song is not a sound file, ignoring.", m_sSampleMusicToPlay.c_str());
m_sSampleMusicToPlay= "";
}
m_pSampleMusicTimingData = &pSong->m_SongTiming;
m_fSampleStartSeconds = pSong->GetPreviewStartSeconds();
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;