diff --git a/stepmania/src/ModeChoice.cpp b/stepmania/src/ModeChoice.cpp index e789006fb1..9b9871b048 100644 --- a/stepmania/src/ModeChoice.cpp +++ b/stepmania/src/ModeChoice.cpp @@ -7,6 +7,9 @@ #include "RageDisplay.h" #include "AnnouncerManager.h" #include "ProfileManager.h" +#include "StepMania.h" +#include "ScreenManager.h" +#include "SongManager.h" #include "arch/ArchHooks/ArchHooks.h" void ModeChoice::Init() @@ -18,7 +21,9 @@ void ModeChoice::Init() m_dc = DIFFICULTY_INVALID; m_sAnnouncer = ""; m_sName = ""; + m_sScreen = ""; m_bInvalid = true; + m_sInvalidReason = ""; } bool ModeChoice::DescribesCurrentMode() const @@ -110,10 +115,40 @@ void ModeChoice::Load( int iIndex, CString sChoice ) m_sAnnouncer = sValue; } + /* Hmm. I feel like I'm overloading ModeChoice here; this makes it + * a generic menu choice. */ if( sName == "name" ) { m_sName = sValue; } + + if( sName == "screen" ) + { + m_sScreen = sValue; +/* XXX: do this in GameState::IsPlayable, but move GameState::IsPlayable to ModeChoice::IsPlayable */ +/* if( m_sScreen == "ScreenEditCoursesMenu" ) + { + vector vCourses; + SONGMAN->GetAllCourses( vCourses, false ); + + if( vCourses.size() == 0 ) + { + m_bInvalid = true; + m_sInvalidReason = "No courses are installed"; + } + } + + if( m_sScreen == "ScreenJukeboxMenu" || + m_sScreen == "ScreenEditMenu" || + m_sScreen == "ScreenEditCoursesMenu" ) + { + if( SONGMAN->GetNumSongs() == 0 ) + { + m_bInvalid = true; + m_sInvalidReason = "No songs are installed"; + } + } +*/ } } } @@ -122,6 +157,9 @@ void ModeChoice::ApplyToAllPlayers() for( int pn=0; pnIsHumanPlayer(pn) ) Apply((PlayerNumber) pn); + + if( m_sScreen != "" ) + SCREENMAN->SetNewScreen( m_sScreen ); } void ModeChoice::Apply( PlayerNumber pn ) diff --git a/stepmania/src/ModeChoice.h b/stepmania/src/ModeChoice.h index 75f68d25ab..c3eee46e58 100644 --- a/stepmania/src/ModeChoice.h +++ b/stepmania/src/ModeChoice.h @@ -27,12 +27,16 @@ struct ModeChoice // used in SelectMode bool DescribesCurrentMode() const; bool m_bInvalid; + /* If the reason this selection is invalid may not be obvious to the user, this + * is set to a message. */ + CString m_sInvalidReason; int m_iIndex; Game m_game; Style m_style; PlayMode m_pm; Difficulty m_dc; CString m_sAnnouncer; + CString m_sScreen; CString m_sName; };