Files
itgmania212121/stepmania/src/ScreenSelectGame.cpp
T

112 lines
2.6 KiB
C++
Raw Normal View History

2002-05-20 08:59:37 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: ScreenSelectGame.cpp
Desc: Select a song.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "ScreenSelectGame.h"
2003-01-02 07:54:28 +00:00
#include "RageSoundManager.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
};
OptionRowData g_SelectGameLines[NUM_SELECT_GAME_LINES] =
2002-05-20 08:59:37 +00:00
{
2002-11-16 20:21:00 +00:00
{ "Game", 0, { "" } }
2002-05-20 08:59:37 +00:00
};
ScreenSelectGame::ScreenSelectGame() :
ScreenOptions(
THEME->GetPathTo("BGAnimations","select game"),
THEME->GetPathTo("Graphics","select game page"),
THEME->GetPathTo("Graphics","select game top edge")
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 );
2002-11-16 20:21:00 +00:00
unsigned i;
for( i=0; i<aGames.size(); i++ )
{
Game game = aGames[i];
CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName;
strcpy( g_SelectGameLines[0].szOptionsText[i], sGameName );
}
g_SelectGameLines[0].iNumOptions = i;
2002-08-01 13:42:56 +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 );
m_Menu.StopTimer();
2002-08-27 16:53:25 +00:00
2003-01-02 07:39:58 +00:00
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","select game 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
}