ScreenSelectGame support

This commit is contained in:
Glenn Maynard
2003-09-29 03:22:51 +00:00
parent 2fa9093471
commit 92b1e53678
3 changed files with 52 additions and 2 deletions
+7 -1
View File
@@ -498,6 +498,12 @@ void ScreenOptionsMaster::ExportOptions()
PREFSMAN->SaveGlobalPrefsToDisk(); PREFSMAN->SaveGlobalPrefsToDisk();
PREFSMAN->SaveGamePrefsToDisk(); PREFSMAN->SaveGamePrefsToDisk();
} }
if( ChangeMask & OPT_RESET_GAME )
{
ResetGame();
m_NextScreen = "";
}
} }
void ScreenOptionsMaster::MenuStart( PlayerNumber pn ) void ScreenOptionsMaster::MenuStart( PlayerNumber pn )
@@ -515,7 +521,7 @@ void ScreenOptionsMaster::GoToNextState()
{ {
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
SCREENMAN->PopTopScreen(); SCREENMAN->PopTopScreen();
else else if( m_NextScreen != "" )
SCREENMAN->SetNewScreen( m_NextScreen ); SCREENMAN->SetNewScreen( m_NextScreen );
} }
+44 -1
View File
@@ -9,6 +9,9 @@
#include "SongOptions.h" #include "SongOptions.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "GameManager.h"
#include "GameState.h"
#include "InputMapper.h"
/* "sel" is the selection in the menu. */ /* "sel" is the selection in the menu. */
template<class T> template<class T>
@@ -32,6 +35,42 @@ static void MoveData( int &sel, bool &opt, bool ToSel )
} }
static void GameChoices( CStringArray &out )
{
vector<Game> aGames;
GAMEMAN->GetEnabledGames( aGames );
for( unsigned i=0; i<aGames.size(); i++ )
{
Game game = aGames[i];
CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName;
sGameName.MakeUpper();
out.push_back( sGameName );
}
}
static void GameSel( int &sel, bool ToSel, const CStringArray &choices )
{
if( ToSel )
{
const CString sCurGameName = GAMEMAN->GetGameDefForGame(GAMESTATE->m_CurGame)->m_szName;
sel = 0;
for(unsigned i = 0; i < choices.size(); ++i)
if( !stricmp(choices[i], sCurGameName) )
sel = i;
} else {
PREFSMAN->SaveGamePrefsToDisk();
INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game
vector<Game> aGames;
GAMEMAN->GetEnabledGames( aGames );
GAMESTATE->m_CurGame = aGames[sel];
PREFSMAN->ReadGamePrefsFromDisk();
INPUTMAPPER->ReadMappingsFromDisk();
}
}
static void LanguageChoices( CStringArray &out ) static void LanguageChoices( CStringArray &out )
{ {
THEME->GetLanguages( out ); THEME->GetLanguages( out );
@@ -353,6 +392,9 @@ MOVE( ResamplingQuality, PREFSMAN->m_iSoundResampleQuality );
static const ConfOption g_ConfOptions[] = static const ConfOption g_ConfOptions[] =
{ {
/* Select game */
ConfOption( "Game", GameSel, GameChoices ),
/* Appearance options */ /* Appearance options */
ConfOption( "Language", Language, LanguageChoices ), ConfOption( "Language", Language, LanguageChoices ),
ConfOption( "Theme", Theme, ThemeChoices ), ConfOption( "Theme", Theme, ThemeChoices ),
@@ -445,7 +487,8 @@ int ConfOption::GetEffects() const
{ TextureResolution, OPT_APPLY_GRAPHICS }, { TextureResolution, OPT_APPLY_GRAPHICS },
{ KeepTexturesInMemory, OPT_APPLY_GRAPHICS }, { KeepTexturesInMemory, OPT_APPLY_GRAPHICS },
{ RefreshRate, OPT_APPLY_GRAPHICS }, { RefreshRate, OPT_APPLY_GRAPHICS },
{ WaitForVsync, OPT_APPLY_GRAPHICS } { WaitForVsync, OPT_APPLY_GRAPHICS },
{ GameSel, OPT_RESET_GAME }
}; };
int ret = OPT_SAVE_PREFERENCES; int ret = OPT_SAVE_PREFERENCES;
+1
View File
@@ -5,6 +5,7 @@ static const int MAX_OPTIONS=16;
#define OPT_SAVE_PREFERENCES 0x1 #define OPT_SAVE_PREFERENCES 0x1
#define OPT_APPLY_GRAPHICS 0x2 #define OPT_APPLY_GRAPHICS 0x2
#define OPT_APPLY_THEME 0x4 #define OPT_APPLY_THEME 0x4
#define OPT_RESET_GAME 0x8
struct ConfOption struct ConfOption
{ {