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"
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include "RageTextureManager.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "RageMusic.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "ScreenOptions.h"
|
|
|
|
|
#include "ScreenTitleMenu.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "StepMania.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "GameManager.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "InputMapper.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
SG_GAME = 0,
|
|
|
|
|
NUM_SELECT_GAME_LINES
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
OptionRowData g_SelectGameLines[NUM_SELECT_GAME_LINES] =
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-07-23 01:41:40 +00:00
|
|
|
"Game", 0, { "" }
|
2002-05-20 08:59:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenSelectGame::ScreenSelectGame() :
|
|
|
|
|
ScreenOptions(
|
2002-09-23 07:35:47 +00:00
|
|
|
THEME->GetPathTo("BGAnimations","select game"),
|
2002-08-13 23:26:46 +00:00
|
|
|
THEME->GetPathTo("Graphics","select game page"),
|
|
|
|
|
THEME->GetPathTo("Graphics","select game top edge")
|
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-08-13 23:26:46 +00:00
|
|
|
//
|
2002-05-20 08:59:37 +00:00
|
|
|
// populate g_SelectGameLines
|
2002-08-13 23:26:46 +00:00
|
|
|
//
|
|
|
|
|
// CStringArray arrayGameNames;
|
|
|
|
|
// GAMEMAN->GetGameNames( arrayGameNames );
|
|
|
|
|
CArray<Game,Game> aGames;
|
|
|
|
|
GAMEMAN->GetEnabledGames( aGames );
|
|
|
|
|
for( int i=0; i<aGames.GetSize(); 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(
|
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,
|
|
|
|
|
false );
|
2002-09-24 02:55:32 +00:00
|
|
|
m_Menu.SetTimer( 99 );
|
|
|
|
|
m_Menu.StopTimer();
|
2002-08-27 16:53:25 +00:00
|
|
|
|
|
|
|
|
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","select game music") );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectGame::ImportOptions()
|
|
|
|
|
{
|
2002-07-27 19:29:51 +00:00
|
|
|
m_iSelectedOption[0][SG_GAME] = GAMESTATE->m_CurGame;
|
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];
|
|
|
|
|
|
|
|
|
|
CArray<Game,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()
|
|
|
|
|
{
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectGame::GoToNextState()
|
|
|
|
|
{
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|