From 88f1da651c6beb3922341932edc5f3e45f3317aa Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 19 Apr 2010 00:09:21 -0500 Subject: [PATCH] add SampleMusicPreviewMode_LastSong, now that it works. There is a hack in there for playing the song associated with the Random option, based on Takuya's DDR Extreme theme having music for it. I am not sure if this is accurate behavior, though. --- src/GameConstantsAndTypes.cpp | 2 +- src/GameConstantsAndTypes.h | 2 +- src/ScreenSelectMusic.cpp | 38 ++++++++++++++++++++++++----------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index 0bf98e905b..f6a98329e1 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -418,7 +418,7 @@ static const char *SampleMusicPreviewModeNames[] = { "Normal", //"StartToPreview", "ScreenMusic", - //"LastSong" + "LastSong" }; XToString( SampleMusicPreviewMode ); StringToX( SampleMusicPreviewMode ); diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index 06b7c342d8..5463bf5b19 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -463,7 +463,7 @@ enum SampleMusicPreviewMode SampleMusicPreviewMode_Normal, //SampleMusicPreviewMode_StartToPreview, SampleMusicPreviewMode_ScreenMusic, - //SampleMusicPreviewMode_LastSong, // continue playing the last song + SampleMusicPreviewMode_LastSong, // continue playing the last song NUM_SampleMusicPreviewMode, SampleMusicPreviewMode_Invalid, }; diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 631655a6d4..971d714635 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -1457,7 +1457,10 @@ void ScreenSelectMusic::AfterMusicChange() vector m_Artists, m_AltArtists; - m_sSampleMusicToPlay = ""; + if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) + { + m_sSampleMusicToPlay = ""; + } m_pSampleMusicTimingData = NULL; g_sCDTitlePath = ""; g_sBannerPath = ""; @@ -1482,30 +1485,40 @@ void ScreenSelectMusic::AfterMusicChange() g_sCDTitlePath = ""; // none - //if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) - //{ - m_fSampleStartSeconds = 0; - m_fSampleLengthSeconds = -1; - //} + if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) + { + m_fSampleStartSeconds = 0; + m_fSampleLengthSeconds = -1; + } + else + { + // HACK: Make random music work in LastSong mode (IDK if this is + // accurate or not) -aj + if( m_sSampleMusicToPlay == m_sRandomMusicPath ) + { + m_fSampleStartSeconds = 0; + m_fSampleLengthSeconds = -1; + } + } switch( m_MusicWheel.GetSelectedType() ) { case TYPE_SECTION: g_sBannerPath = SONGMAN->GetSongGroupBannerPath( m_MusicWheel.GetSelectedSection() ); - //if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) - m_sSampleMusicToPlay = m_sSectionMusicPath; + if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) + m_sSampleMusicToPlay = m_sSectionMusicPath; break; case TYPE_SORT: bWantBanner = false; // we load it ourself m_Banner.LoadMode(); - //if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) - m_sSampleMusicToPlay = m_sSortMusicPath; + if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) + m_sSampleMusicToPlay = m_sSortMusicPath; break; case TYPE_ROULETTE: bWantBanner = false; // we load it ourself m_Banner.LoadRoulette(); - //if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) - m_sSampleMusicToPlay = m_sRouletteMusicPath; + if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) + m_sSampleMusicToPlay = m_sRouletteMusicPath; break; case TYPE_RANDOM: bWantBanner = false; // we load it ourself @@ -1542,6 +1555,7 @@ void ScreenSelectMusic::AfterMusicChange() // we want to load the sample music, but we don't want to // actually play it; fall through for now. -aj case SampleMusicPreviewMode_Normal: + case SampleMusicPreviewMode_LastSong: // fall through // play the sample music m_sSampleMusicToPlay = pSong->GetMusicPath(); m_pSampleMusicTimingData = &pSong->m_Timing;