Files
itgmania212121/stepmania/src/ScreenSelectGame.cpp
T

108 lines
2.5 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-05-20 08:59:37 +00:00
/*
-----------------------------------------------------------------------------
File: ScreenSelectGame.cpp
Desc: Select a song.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "ScreenSelectGame.h"
2003-07-26 23:05:16 +00:00
#include "RageSounds.h"
2002-05-20 08:59:37 +00:00
#include "ScreenManager.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "GameManager.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "InputMapper.h"
#include "ThemeManager.h"
#include "StepMania.h"
2002-05-20 08:59:37 +00:00
enum {
SG_GAME = 0,
NUM_SELECT_GAME_LINES
};
OptionRow g_SelectGameLines[NUM_SELECT_GAME_LINES] =
2002-05-20 08:59:37 +00:00
{
OptionRow( "Game" ),
2002-05-20 08:59:37 +00:00
};
ScreenSelectGame::ScreenSelectGame() :
2003-03-09 00:55:49 +00:00
ScreenOptions("ScreenSelectGame",false)
2002-05-20 08:59:37 +00:00
{
LOG->Trace( "ScreenSelectGame::ScreenSelectGame()" );
2002-05-20 08:59:37 +00:00
/* populate g_SelectGameLines */
2003-01-03 05:56:28 +00:00
vector<Game> aGames;
GAMEMAN->GetEnabledGames( aGames );
2003-03-17 00:49:35 +00:00
g_SelectGameLines[SG_GAME].choices.clear();
for( unsigned i=0; i<aGames.size(); i++ )
{
Game game = aGames[i];
CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName;
sGameName.MakeUpper();
2003-03-17 00:49:35 +00:00
g_SelectGameLines[SG_GAME].choices.push_back( sGameName );
2003-03-09 00:55:49 +00:00
}
2002-05-20 08:59:37 +00:00
Init(
INPUTMODE_BOTH,
2002-05-20 08:59:37 +00:00
g_SelectGameLines,
NUM_SELECT_GAME_LINES,
false, true );
2003-03-11 21:33:11 +00:00
m_Menu.m_MenuTimer.Disable();
2002-08-27 16:53:25 +00:00
2003-07-26 23:05:16 +00:00
SOUND->PlayMusic( THEME->GetPathToS("ScreenSelectGame music") );
2002-05-20 08:59:37 +00:00
}
void ScreenSelectGame::ImportOptions()
{
/* Search the list of games for the currently active game. If it's
* not there, we might have set a game and then the user removed its
* note skins; reset it to the first available. */
2003-01-03 05:56:28 +00:00
vector<Game> aGames;
GAMEMAN->GetEnabledGames( aGames );
ASSERT(!aGames.empty());
m_iSelectedOption[0][SG_GAME] = 0;
for(unsigned sel = 0; sel < aGames.size(); ++sel)
if(aGames[sel] == GAMESTATE->m_CurGame) m_iSelectedOption[0][SG_GAME] = sel;
2002-05-20 08:59:37 +00:00
}
void ScreenSelectGame::ExportOptions()
{
LOG->Trace("ScreenSelectGame::ExportOptions()");
2002-07-23 01:41:40 +00:00
INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game
PREFSMAN->SaveGamePrefsToDisk();
2002-05-27 08:23:27 +00:00
// Switch the current style to the frist style of the selected game
int iSelection = m_iSelectedOption[0][SG_GAME];
2003-01-03 05:56:28 +00:00
vector<Game> aGames;
GAMEMAN->GetEnabledGames( aGames );
Game game = aGames[iSelection];
2002-07-27 19:29:51 +00:00
GAMESTATE->m_CurGame = game;
2002-07-23 01:41:40 +00:00
PREFSMAN->ReadGamePrefsFromDisk();
INPUTMAPPER->ReadMappingsFromDisk();
2002-05-20 08:59:37 +00:00
}
void ScreenSelectGame::GoToPrevState()
{
2003-01-19 04:44:22 +00:00
ResetGame();
2002-05-20 08:59:37 +00:00
}
void ScreenSelectGame::GoToNextState()
{
2003-01-19 04:44:22 +00:00
ResetGame();
2002-05-20 08:59:37 +00:00
}