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"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-01-10 02:22:07 +00:00
|
|
|
#include "StepMania.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
SG_GAME = 0,
|
|
|
|
|
NUM_SELECT_GAME_LINES
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2003-03-15 19:25:37 +00:00
|
|
|
OptionRow g_SelectGameLines[NUM_SELECT_GAME_LINES] =
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-03-15 19:25: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
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectGame::ScreenSelectGame()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-10-24 03:47:37 +00:00
|
|
|
/* populate g_SelectGameLines */
|
2003-01-03 05:56:28 +00:00
|
|
|
vector<Game> aGames;
|
2002-08-13 23:26:46 +00:00
|
|
|
GAMEMAN->GetEnabledGames( aGames );
|
2003-03-15 19:25:37 +00:00
|
|
|
|
2003-03-17 00:49:35 +00:00
|
|
|
g_SelectGameLines[SG_GAME].choices.clear();
|
2003-03-15 19:25:37 +00:00
|
|
|
for( unsigned i=0; i<aGames.size(); i++ )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
|
|
|
|
Game game = aGames[i];
|
|
|
|
|
CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName;
|
2003-03-15 19:25:37 +00:00
|
|
|
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(
|
2002-08-13 23:26:46 +00:00
|
|
|
INPUTMODE_BOTH,
|
2002-05-20 08:59:37 +00:00
|
|
|
g_SelectGameLines,
|
2002-09-03 22:31:06 +00:00
|
|
|
NUM_SELECT_GAME_LINES,
|
2003-03-15 19:25:37 +00:00
|
|
|
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()
|
|
|
|
|
{
|
2002-10-24 03:47:37 +00:00
|
|
|
/* 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;
|
2002-10-24 03:47:37 +00:00
|
|
|
GAMEMAN->GetEnabledGames( aGames );
|
2002-10-31 03:16:02 +00:00
|
|
|
ASSERT(!aGames.empty());
|
2002-10-24 03:47:37 +00:00
|
|
|
|
|
|
|
|
m_iSelectedOption[0][SG_GAME] = 0;
|
2002-10-31 03:16:02 +00:00
|
|
|
for(unsigned sel = 0; sel < aGames.size(); ++sel)
|
2002-10-24 03:47:37 +00:00
|
|
|
if(aGames[sel] == GAMESTATE->m_CurGame) m_iSelectedOption[0][SG_GAME] = sel;
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectGame::ExportOptions()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace("ScreenSelectGame::ExportOptions()");
|
2002-07-12 04:16:52 +00:00
|
|
|
|
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
|
2002-08-13 23:26:46 +00:00
|
|
|
int iSelection = m_iSelectedOption[0][SG_GAME];
|
|
|
|
|
|
2003-01-03 05:56:28 +00:00
|
|
|
vector<Game> aGames;
|
2002-08-13 23:26:46 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|