From b63cbeb75e3ccd08337d1f0124d10a9462e5701b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 23 Mar 2003 18:47:13 +0000 Subject: [PATCH] Split off some functions. Use static members, not free functions. --- stepmania/src/ScreenJukebox.cpp | 19 +++++++++++++------ stepmania/src/ScreenJukebox.h | 5 ++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/stepmania/src/ScreenJukebox.cpp b/stepmania/src/ScreenJukebox.cpp index ddd77cd75f..7e3d516bf8 100644 --- a/stepmania/src/ScreenJukebox.cpp +++ b/stepmania/src/ScreenJukebox.cpp @@ -23,12 +23,8 @@ const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be same as in ScreenGameplay -bool PrepareForJukebox() // always return true. +bool ScreenJukebox::SetSong() { - // ScreeJukeboxMenu must set this - ASSERT( GAMESTATE->m_CurStyle != STYLE_INVALID ); - GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; - vector vSongs; if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC ) SONGMAN->GetSongs( vSongs ); @@ -68,9 +64,20 @@ bool PrepareForJukebox() // always return true. for( int p=0; pm_pCurNotes[p] = pNotes; - break; // done looking + return true; // done looking } + return false; +} + +bool ScreenJukebox::PrepareForJukebox() // always return true. +{ + // ScreeJukeboxMenu must set this + ASSERT( GAMESTATE->m_CurStyle != STYLE_INVALID ); + GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; + + SetSong(); + ASSERT( GAMESTATE->m_pCurSong ); GAMESTATE->m_MasterPlayerNumber = PLAYER_1; diff --git a/stepmania/src/ScreenJukebox.h b/stepmania/src/ScreenJukebox.h index 3162800e74..1f69971171 100644 --- a/stepmania/src/ScreenJukebox.h +++ b/stepmania/src/ScreenJukebox.h @@ -25,11 +25,14 @@ public: virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void HandleScreenMessage( const ScreenMessage SM ); -protected: + /* Hack: public for JukeboxMenu */ + static bool SetSong(); +protected: TransitionBGAnimation m_In; TransitionBGAnimation m_Out; + static bool PrepareForJukebox(); }; #endif