Changed ScreenSelectMusic and Song to look for preview.ogg and use it for a sample if it exists instead of the music file. Sample length still comes from simfile. Changed foreach_ordered to work on tables with string and number keys.
This commit is contained in:
@@ -1796,9 +1796,9 @@ void ScreenSelectMusic::AfterMusicChange()
|
||||
case SampleMusicPreviewMode_Normal:
|
||||
case SampleMusicPreviewMode_LastSong: // fall through
|
||||
// play the sample music
|
||||
m_sSampleMusicToPlay = pSong->GetMusicPath();
|
||||
m_sSampleMusicToPlay = pSong->GetPreviewMusicPath();
|
||||
m_pSampleMusicTimingData = &pSong->m_SongTiming;
|
||||
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
|
||||
m_fSampleStartSeconds = pSong->GetPreviewStartSeconds();
|
||||
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1477,6 +1477,26 @@ RString Song::GetPreviewVidPath() const
|
||||
return GetSongAssetPath( m_sPreviewVidFile, m_sSongDir );
|
||||
}
|
||||
|
||||
RString Song::GetPreviewMusicPath() const
|
||||
{
|
||||
RString preview= GetSongDir() + "preview.ogg";
|
||||
if(FILEMAN->DoesFileExist(preview))
|
||||
{
|
||||
return preview;
|
||||
}
|
||||
return GetMusicPath();
|
||||
}
|
||||
|
||||
float Song::GetPreviewStartSeconds() const
|
||||
{
|
||||
RString preview= GetSongDir() + "preview.ogg";
|
||||
if(FILEMAN->DoesFileExist(preview))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
return m_fMusicSampleStartSeconds;
|
||||
}
|
||||
|
||||
RString Song::GetDisplayMainTitle() const
|
||||
{
|
||||
if(!PREFSMAN->m_bShowNativeLanguage) return GetTranslitMainTitle();
|
||||
|
||||
@@ -257,6 +257,8 @@ public:
|
||||
RString GetBackgroundPath() const;
|
||||
RString GetCDTitlePath() const;
|
||||
RString GetPreviewVidPath() const;
|
||||
RString GetPreviewMusicPath() const;
|
||||
float GetPreviewStartSeconds() const;
|
||||
|
||||
// For loading only:
|
||||
bool m_bHasMusic, m_bHasBanner, m_bHasBackground;
|
||||
|
||||
Reference in New Issue
Block a user