From fac3d3aa69e385e06e29586de0d4d20a5756c157 Mon Sep 17 00:00:00 2001 From: Andrew Livy Date: Thu, 16 Jan 2003 21:21:09 +0000 Subject: [PATCH] Pump Music Select Screen now with sounds for changing songs or cycling songs. Also a metric to have it play preview music pump or ddr style. --- stepmania/Themes/default/metrics.ini | 9 +-- stepmania/src/MusicBannerWheel.cpp | 7 +- stepmania/src/MusicBannerWheel.h | 2 +- stepmania/src/ScreenEz2SelectMusic.cpp | 97 +++++++++++++++++++++++--- stepmania/src/ScreenEz2SelectMusic.h | 16 ++++- 5 files changed, 113 insertions(+), 18 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 3c2805c4f0..195a405a07 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -233,10 +233,11 @@ MeterP1X=999 // by default hide these elements MeterP1Y=999 MeterP2X=999 MeterP2Y=999 -SpeedIconP1X=0 -SpeedIconP2X=0 -SpeedIconP1Y=0 -SpeedIconP2Y=0 +SpeedIconP1X=40 +SpeedIconP2X=600 +SpeedIconP1Y=200 +SpeedIconP2Y=200 +PreviewMusicMode=0 // 0 = play music as you select, 1 = no music plays, select once and preview music plays, select again for confirm, 2 = no music plays at all. [ScreenSelectCourse] ExplanationX=132 diff --git a/stepmania/src/MusicBannerWheel.cpp b/stepmania/src/MusicBannerWheel.cpp index 5e36fd765d..4f8995b3f4 100644 --- a/stepmania/src/MusicBannerWheel.cpp +++ b/stepmania/src/MusicBannerWheel.cpp @@ -30,6 +30,7 @@ enum }; #define DEFAULT_SCROLL_DIRECTION THEME->GetMetricI("Notes","DefaultScrollDirection") +#define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode") MusicBannerWheel::MusicBannerWheel() { @@ -184,7 +185,8 @@ void MusicBannerWheel::InsertNewBanner(int direction) { ASSERT(0); // we should be going in some sort of direction. } - PlayMusicSample(); + if(PREVIEWMUSICMODE == 0) + PlayMusicSample(); } /**************************** @@ -274,7 +276,8 @@ void MusicBannerWheel::LoadSongData() m_ScrollingList.Load( asGraphicPaths ); if(SingleLoad == 2) SingleLoad = 1; - PlayMusicSample(); + if(PREVIEWMUSICMODE == 0) + PlayMusicSample(); } diff --git a/stepmania/src/MusicBannerWheel.h b/stepmania/src/MusicBannerWheel.h index ebda800ec9..b64458fb64 100644 --- a/stepmania/src/MusicBannerWheel.h +++ b/stepmania/src/MusicBannerWheel.h @@ -31,9 +31,9 @@ public: void BannersRight(); Song* GetSelectedSong(); int CheckSongsExist() { return SongsExist; } + void PlayMusicSample(); private: void SetNewPos(int NewPos); - void PlayMusicSample(); void LoadSongData(); void ChangeNotes(); void InsertNewBanner(int direction); diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 424e045ca0..f3d9e1a1c2 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -40,8 +40,9 @@ #define METER_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dY",p+1)) #define GUIDE_X THEME->GetMetricF("ScreenSelectMode","GuideX") #define GUIDE_Y THEME->GetMetricF("ScreenSelectMode","GuideY") -#define SPEEDICON_X( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("SpeedIconP%dX",p+1)) -#define SPEEDICON_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("SpeedIconP%dY",p+1)) +#define SPEEDICON_X( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("SpeedIconP%dX",p+1)) +#define SPEEDICON_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("SpeedIconP%dY",p+1)) +#define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode") const float TWEEN_TIME = 0.5f; @@ -54,6 +55,12 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic() i_ErrorDetected=0; CodeDetector::RefreshCacheItems(); + if(PREVIEWMUSICMODE == 1) + { + SOUNDMAN->music->StopPlaying(); + iConfirmSelection = 0; + } + m_Menu.Load( THEME->GetPathTo("BGAnimations","select music"), @@ -62,6 +69,8 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic() ); this->AddChild( &m_Menu ); + m_soundMusicChange.Load( THEME->GetPathTo("Sounds","select music change song")); + m_soundMusicCycle.Load( THEME->GetPathTo("Sounds","select music cycle songs")); m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") ); m_ChoiceListFrame.Load( THEME->GetPathTo("Graphics","select mode list frame")); @@ -72,16 +81,25 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic() m_Guide.SetXY( GUIDE_X, GUIDE_Y ); this->AddChild( &m_Guide ); + m_MusicBannerWheel.SetX(SCROLLING_LIST_X); m_MusicBannerWheel.SetY(SCROLLING_LIST_Y); + if(m_MusicBannerWheel.CheckSongsExist() != 0) { this->AddChild( &m_MusicBannerWheel ); + m_ChoiceListHighlight.Load( THEME->GetPathTo("Graphics","select mode list highlight")); m_ChoiceListHighlight.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y); this->AddChild( &m_ChoiceListHighlight ); + #ifdef _DEBUG + m_debugtext.LoadFromFont( THEME->GetPathTo("Fonts","small titles") ); + m_debugtext.SetXY( CENTER_X, CENTER_Y ); + this->AddChild(&m_debugtext); + #endif + for(int p=0; pAddChild(&m_SpeedIcon[p] ); + UpdateOptions((PlayerNumber) p,0); + m_iSelection[p] = 0; } @@ -112,6 +132,8 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic() m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprOptionsMessage ); + m_soundOptionsChange.Load( THEME->GetPathTo("Sounds","select music change options") ); + m_bGoToOptions = false; m_bMadeChoice = false; @@ -158,26 +180,50 @@ void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy } if( CodeDetector::DetectAndAdjustOptions(GameI.controller) ) { - UpdateOptions( pn ); + UpdateOptions(pn,1); } + if( type != IET_FIRST_PRESS ) + { + m_soundMusicCycle.Play(); + } + else + { + m_soundMusicChange.Play(); + } + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); } -void ScreenEz2SelectMusic::UpdateOptions(PlayerNumber pn) +void ScreenEz2SelectMusic::UpdateOptions(PlayerNumber pn, int nosound) { - CString sOptions = GAMESTATE->m_PlayerOptions[pn].GetString(); - CStringArray asOptions; + sOptions = GAMESTATE->m_PlayerOptions[pn].GetString(); + + #ifdef _DEBUG + m_debugtext.SetText( "DEBUG: " + sOptions ); + #endif + + asOptions.clear(); split( sOptions, ", ", asOptions, true ); - if(asOptions[0] != "1.0X") + + if(asOptions.size() > 0) // check it's not empty! { - m_SpeedIcon[pn].SetDiffuse( RageColor(1,1,1,1) ); + if(asOptions[0] != "1.0X" && asOptions[0] != "" && asOptions[0] != NULL) + { + m_SpeedIcon[pn].SetDiffuse( RageColor(1,1,1,1) ); + } + else + { + m_SpeedIcon[pn].SetDiffuse( RageColor(0,0,0,0) ); + } } else { m_SpeedIcon[pn].SetDiffuse( RageColor(0,0,0,0) ); } + if(nosound !=0) + m_soundOptionsChange.Play(); } void ScreenEz2SelectMusic::HandleScreenMessage( const ScreenMessage SM ) @@ -250,6 +296,15 @@ void ScreenEz2SelectMusic::MenuStart( PlayerNumber pn ) return; } + m_soundSelect.Play(); + + if(PREVIEWMUSICMODE == 1 && iConfirmSelection == 0) + { + iConfirmSelection = 1; + m_MusicBannerWheel.PlayMusicSample(); + return; + } + m_bMadeChoice = true; TweenOffScreen(); @@ -264,8 +319,6 @@ void ScreenEz2SelectMusic::MenuStart( PlayerNumber pn ) m_sprOptionsMessage.SetTweenDiffuse( RageColor(1,1,1,0) ); m_sprOptionsMessage.SetTweenZoomY( 0 ); - m_soundSelect.Play(); - m_Menu.TweenOffScreenToBlack( SM_None, false ); m_Menu.StopTimer(); @@ -304,6 +357,12 @@ void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn ) if( m_iSelection[pn] == 0 ) return; + if(PREVIEWMUSICMODE == 1 && iConfirmSelection == 1) + { + iConfirmSelection = 0; + SOUNDMAN->music->StopPlaying(); + } + m_iSelection[pn]--; // the user explicity switched difficulties. Update the preferred difficulty GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->GetDifficulty(); @@ -324,6 +383,18 @@ void ScreenEz2SelectMusic::HarderDifficulty( PlayerNumber pn ) if( m_iSelection[pn] == int(m_arrayNotes[pn].size()-1) ) return; + if( m_iSelection[pn] > int(m_arrayNotes[pn].size() - 1) ) + { + m_iSelection[pn] = int(m_arrayNotes[pn].size()-1 ); + return; + } + + if(PREVIEWMUSICMODE == 1 && iConfirmSelection == 1) + { + iConfirmSelection = 0; + SOUNDMAN->music->StopPlaying(); + } + m_iSelection[pn]++; // the user explicity switched difficulties. Update the preferred difficulty GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->GetDifficulty(); @@ -340,6 +411,12 @@ void ScreenEz2SelectMusic::MusicChanged() Song* pSong = m_MusicBannerWheel.GetSelectedSong(); GAMESTATE->m_pCurSong = pSong; + if(PREVIEWMUSICMODE == 1 && iConfirmSelection == 1) + { + iConfirmSelection = 0; + SOUNDMAN->music->StopPlaying(); + } + int pn; for( pn = 0; pn < NUM_PLAYERS; ++pn) m_arrayNotes[pn].clear(); diff --git a/stepmania/src/ScreenEz2SelectMusic.h b/stepmania/src/ScreenEz2SelectMusic.h index 3d1f009a43..d5eac021ce 100644 --- a/stepmania/src/ScreenEz2SelectMusic.h +++ b/stepmania/src/ScreenEz2SelectMusic.h @@ -42,7 +42,10 @@ protected: void EasierDifficulty( PlayerNumber pn ); void HarderDifficulty( PlayerNumber pn ); - void UpdateOptions( PlayerNumber pn ); + void UpdateOptions( PlayerNumber pn, int nosound ); + + CString sOptions; + CStringArray asOptions; void TweenOffScreen(); @@ -53,6 +56,11 @@ protected: Sprite m_PumpDifficultyCircle; Sprite m_SpeedIcon[NUM_PLAYERS]; BitmapText m_PumpDifficultyRating; + + RageSound m_soundOptionsChange; + RageSound m_soundMusicChange; + RageSound m_soundMusicCycle; + MusicBannerWheel m_MusicBannerWheel; MenuElements m_Menu; FootMeter m_FootMeter[NUM_PLAYERS]; @@ -63,6 +71,12 @@ protected: int i_ErrorDetected; + #ifdef _DEBUG + BitmapText m_debugtext; + #endif + + int iConfirmSelection; + RageSound m_soundSelect; };