2003-09-28 02:59:02 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
|
|
#include "ScreenOptionsMaster.h"
|
|
|
|
|
#include "RageException.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "SongManager.h"
|
2003-09-28 05:04:55 +00:00
|
|
|
#include "PrefsManager.h"
|
2004-07-08 00:10:34 +00:00
|
|
|
#include "GameSoundManager.h"
|
2003-09-28 07:14:07 +00:00
|
|
|
#include "StepMania.h"
|
2003-10-12 20:34:46 +00:00
|
|
|
#include "RageSoundManager.h"
|
2005-01-29 21:56:24 +00:00
|
|
|
#include "Foreach.h"
|
2005-02-24 04:56:36 +00:00
|
|
|
#include "OptionRowHandler.h"
|
|
|
|
|
#include "ScreenOptionsMasterPrefs.h"
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-02-20 10:12:50 +00:00
|
|
|
#define LINE_NAMES THEME->GetMetric (m_sName,"LineNames")
|
|
|
|
|
#define OPTION_MENU_FLAGS THEME->GetMetric (m_sName,"OptionMenuFlags")
|
|
|
|
|
#define LINE(sLineName) THEME->GetMetric (m_sName,ssprintf("Line%s",sLineName.c_str()))
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
// keep this in sync with OptionRowHandler.cpp
|
2005-02-20 10:12:50 +00:00
|
|
|
#define ENTRY_NAME(s) THEME->GetMetric ("OptionNames", s)
|
2005-02-24 04:56:36 +00:00
|
|
|
|
2005-02-20 10:12:50 +00:00
|
|
|
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
|
|
|
|
|
#define PREV_SCREEN THEME->GetMetric (m_sName,"PrevScreen")
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
const CString NEXT_ROW_NAME = "NextRow";
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-01-29 21:56:24 +00:00
|
|
|
|
2004-11-26 17:28:47 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenOptionsMaster );
|
2003-09-28 02:59:02 +00:00
|
|
|
ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
|
|
|
|
|
ScreenOptions( sClassName )
|
|
|
|
|
{
|
2003-09-28 04:34:15 +00:00
|
|
|
LOG->Trace("ScreenOptionsMaster::ScreenOptionsMaster(%s)", m_sName.c_str() );
|
2005-02-23 06:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptionsMaster::Init()
|
|
|
|
|
{
|
|
|
|
|
ScreenOptions::Init();
|
2003-09-28 04:07:53 +00:00
|
|
|
|
2004-02-13 05:27:18 +00:00
|
|
|
CStringArray asLineNames;
|
|
|
|
|
split( LINE_NAMES, ",", asLineNames );
|
|
|
|
|
if( asLineNames.empty() )
|
|
|
|
|
RageException::Throw( "%s::LineNames is empty.", m_sName.c_str() );
|
|
|
|
|
|
|
|
|
|
|
2003-09-28 04:07:53 +00:00
|
|
|
CStringArray Flags;
|
|
|
|
|
split( OPTION_MENU_FLAGS, ";", Flags, true );
|
|
|
|
|
InputMode im = INPUTMODE_INDIVIDUAL;
|
|
|
|
|
bool Explanations = false;
|
2005-01-31 03:32:59 +00:00
|
|
|
bool bShowUnderlines = true;
|
2004-02-13 05:27:18 +00:00
|
|
|
|
2004-09-21 07:53:39 +00:00
|
|
|
for( unsigned i = 0; i < Flags.size(); ++i )
|
2003-09-28 04:07:53 +00:00
|
|
|
{
|
2005-02-23 05:51:10 +00:00
|
|
|
CString sFlag = Flags[i];
|
|
|
|
|
sFlag.MakeLower();
|
2003-09-28 04:07:53 +00:00
|
|
|
|
2005-02-23 05:51:10 +00:00
|
|
|
if( sFlag == "together" )
|
2004-03-14 18:53:19 +00:00
|
|
|
im = INPUTMODE_SHARE_CURSOR;
|
2005-02-23 05:51:10 +00:00
|
|
|
else if( sFlag == "explanations" )
|
2003-09-28 04:07:53 +00:00
|
|
|
Explanations = true;
|
2005-02-23 05:51:10 +00:00
|
|
|
else if( sFlag == "forceallplayers" )
|
2003-09-28 04:07:53 +00:00
|
|
|
{
|
2004-05-24 06:10:11 +00:00
|
|
|
FOREACH_PlayerNumber( pn )
|
2003-09-28 04:07:53 +00:00
|
|
|
GAMESTATE->m_bSideIsJoined[pn] = true;
|
|
|
|
|
GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0);
|
|
|
|
|
}
|
2005-02-23 05:51:10 +00:00
|
|
|
else if( sFlag == "smnavigation" )
|
2004-01-09 05:50:15 +00:00
|
|
|
SetNavigation( NAV_THREE_KEY_MENU );
|
2005-02-23 05:51:10 +00:00
|
|
|
else if( sFlag == "toggle" || sFlag == "firstchoicegoesdown" )
|
2004-08-12 22:10:48 +00:00
|
|
|
SetNavigation( PREFSMAN->m_bArcadeOptionsNavigation? NAV_TOGGLE_THREE_KEY:NAV_TOGGLE_FIVE_KEY );
|
2005-02-23 05:51:10 +00:00
|
|
|
else if( sFlag == "hideunderlines" )
|
2005-01-31 03:32:59 +00:00
|
|
|
bShowUnderlines = false;
|
2005-02-23 05:51:10 +00:00
|
|
|
else
|
|
|
|
|
RageException::Throw( "Unknown flag \"%s\"", sFlag.c_str() );
|
2003-09-28 04:07:53 +00:00
|
|
|
}
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
m_OptionRowAlloc.resize( asLineNames.size() );
|
|
|
|
|
OptionRowHandlers.resize( asLineNames.size() );
|
2004-09-21 07:53:39 +00:00
|
|
|
for( unsigned i = 0; i < asLineNames.size(); ++i )
|
2003-09-28 02:59:02 +00:00
|
|
|
{
|
2004-02-13 05:27:18 +00:00
|
|
|
CString sLineName = asLineNames[i];
|
2005-02-24 06:10:11 +00:00
|
|
|
OptionRowDefinition &def = m_OptionRowAlloc[i];
|
2004-02-13 05:27:18 +00:00
|
|
|
CString sRowCommands = LINE(sLineName);
|
2005-02-24 06:10:11 +00:00
|
|
|
OptionRowHandler* &pHand = OptionRowHandlers[i];
|
|
|
|
|
pHand = NULL;
|
2004-01-10 20:43:32 +00:00
|
|
|
|
2004-12-03 05:19:46 +00:00
|
|
|
Commands vCommands;
|
|
|
|
|
ParseCommands( sRowCommands, vCommands );
|
2005-02-24 06:10:11 +00:00
|
|
|
if( vCommands.v.size() != 1 )
|
2003-09-28 02:59:02 +00:00
|
|
|
RageException::Throw( "Parse error in %s::Line%i", m_sName.c_str(), i+1 );
|
|
|
|
|
|
2005-02-24 06:10:11 +00:00
|
|
|
Command& command = vCommands.v[0];
|
|
|
|
|
pHand = OptionRowHandlerUtil::Make( command, def );
|
|
|
|
|
if( pHand == NULL )
|
|
|
|
|
RageException::Throw( "Invalid OptionRowHandler '%s' in %s::Line%i", command.GetOriginalCommandString().c_str(), m_sName.c_str(), i );
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2004-01-14 04:59:07 +00:00
|
|
|
|
|
|
|
|
// TRICKY: Insert a down arrow as the first choice in the row.
|
2004-08-12 22:10:48 +00:00
|
|
|
if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY )
|
2005-02-24 06:10:11 +00:00
|
|
|
def.choices.insert( def.choices.begin(), ENTRY_NAME(NEXT_ROW_NAME) );
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
2004-02-13 05:27:18 +00:00
|
|
|
ASSERT( OptionRowHandlers.size() == asLineNames.size() );
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
InitMenu( im, &m_OptionRowAlloc[0], asLineNames.size(), bShowUnderlines );
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenOptionsMaster::~ScreenOptionsMaster()
|
|
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
FOREACH( OptionRowHandler*, OptionRowHandlers, h )
|
|
|
|
|
SAFE_DELETE( *h );
|
|
|
|
|
OptionRowHandlers.clear();
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
2005-02-20 00:22:37 +00:00
|
|
|
void ScreenOptionsMaster::Update( float fDelta )
|
|
|
|
|
{
|
|
|
|
|
if( m_bFirstUpdate )
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Don't play sounds during the ctor, since derived classes havn't loaded yet.
|
|
|
|
|
* If this file doesn't exist, leave the music alone (eg. ScreenPlayerOptions music sample
|
|
|
|
|
* left over from ScreenSelectMusic). If you really want to play no music, add a redir
|
|
|
|
|
* to _silent.
|
|
|
|
|
*/
|
|
|
|
|
CString MusicPath = THEME->GetPathS( m_sName, "music", true );
|
|
|
|
|
if( MusicPath != "" )
|
|
|
|
|
SOUND->PlayMusic( MusicPath );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenOptions::Update( fDelta );
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
//if( row.selectType != SELECT_MULTIPLE )
|
|
|
|
|
//{
|
|
|
|
|
// // The first row ("go down") should not be selected.
|
|
|
|
|
// ASSERT( !vbSelectedOut[0] );
|
2005-02-14 01:42:21 +00:00
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
// // there should be exactly one option selected
|
|
|
|
|
// int iNumSelected = 0;
|
|
|
|
|
// for( unsigned e = 1; e < pHand->ListEntries.size(); ++e )
|
|
|
|
|
// if( vbSelectedOut[e] )
|
|
|
|
|
// iNumSelected++;
|
|
|
|
|
// ASSERT( iNumSelected == 1 );
|
|
|
|
|
//}
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-02-24 06:10:11 +00:00
|
|
|
/* Hack: the NextRow entry is never set, and should be transparent. Remove
|
|
|
|
|
* it, and readd it below. */
|
|
|
|
|
#define ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( vbSelected ) \
|
|
|
|
|
if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY ) \
|
|
|
|
|
vbSelected.erase( vbSelected.begin() );
|
|
|
|
|
#define INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( vbSelected ) \
|
|
|
|
|
if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY ) \
|
|
|
|
|
vbSelected.insert( vbSelected.begin(), false );
|
|
|
|
|
|
|
|
|
|
|
2005-02-24 01:17:39 +00:00
|
|
|
void ScreenOptionsMaster::ImportOptions( int r )
|
2003-09-28 02:59:02 +00:00
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
const OptionRowHandler *pHand = OptionRowHandlers[r];
|
2005-02-24 01:17:39 +00:00
|
|
|
const OptionRowDefinition &def = m_OptionRowAlloc[r];
|
|
|
|
|
OptionRow &row = *m_Rows[r];
|
2003-09-28 02:59:02 +00:00
|
|
|
|
2005-02-24 01:17:39 +00:00
|
|
|
if( def.bOneChoiceForAllPlayers )
|
|
|
|
|
{
|
2005-02-24 06:10:11 +00:00
|
|
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[0] );
|
2005-02-24 04:56:36 +00:00
|
|
|
pHand->ImportOption(def, PLAYER_1, row.m_vbSelected[0] );
|
2005-02-24 06:10:11 +00:00
|
|
|
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[0] );
|
2005-02-24 01:17:39 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FOREACH_HumanPlayer( p )
|
2005-02-24 06:10:11 +00:00
|
|
|
{
|
|
|
|
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[p] );
|
2005-02-24 04:56:36 +00:00
|
|
|
pHand->ImportOption( def, p, row.m_vbSelected[p] );
|
2005-02-24 06:10:11 +00:00
|
|
|
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[p] );
|
|
|
|
|
}
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-02 00:58:26 +00:00
|
|
|
/* Import only settings specific to the given player. */
|
|
|
|
|
void ScreenOptionsMaster::ImportOptionsForPlayer( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
if( !GAMESTATE->IsHumanPlayer(pn) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < OptionRowHandlers.size(); ++i )
|
|
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
const OptionRowHandler *pHand = OptionRowHandlers[i];
|
2005-02-20 10:12:50 +00:00
|
|
|
const OptionRowDefinition &def = m_OptionRowAlloc[i];
|
2005-02-11 07:50:26 +00:00
|
|
|
OptionRow &row = *m_Rows[i];
|
2004-04-02 00:58:26 +00:00
|
|
|
|
2005-02-20 10:12:50 +00:00
|
|
|
if( def.bOneChoiceForAllPlayers )
|
2004-04-02 00:58:26 +00:00
|
|
|
continue;
|
2005-02-24 04:56:36 +00:00
|
|
|
pHand->ImportOption( def, pn, row.m_vbSelected[pn] );
|
2004-04-02 00:58:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-24 01:17:39 +00:00
|
|
|
void ScreenOptionsMaster::ExportOptions( int iRow )
|
2005-02-12 09:07:59 +00:00
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
const OptionRowHandler *pHand = OptionRowHandlers[iRow];
|
2005-02-20 10:12:50 +00:00
|
|
|
const OptionRowDefinition &def = m_OptionRowAlloc[iRow];
|
2005-02-12 09:07:59 +00:00
|
|
|
OptionRow &row = *m_Rows[iRow];
|
|
|
|
|
|
2005-02-24 06:10:11 +00:00
|
|
|
if( def.bOneChoiceForAllPlayers )
|
|
|
|
|
{
|
|
|
|
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[0] );
|
|
|
|
|
m_iChangeMask |= pHand->ExportOption( def, PLAYER_1, row.m_vbSelected[0] );
|
|
|
|
|
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[0] );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FOREACH_HumanPlayer( p )
|
|
|
|
|
{
|
|
|
|
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[p] );
|
|
|
|
|
m_iChangeMask |= pHand->ExportOption( def, p, row.m_vbSelected[p] );
|
|
|
|
|
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( row.m_vbSelected[p] );
|
|
|
|
|
}
|
2005-02-12 09:07:59 +00:00
|
|
|
}
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-05 11:59:39 +00:00
|
|
|
void ScreenOptionsMaster::GoToNextScreen()
|
2003-09-28 02:59:02 +00:00
|
|
|
{
|
|
|
|
|
if( GAMESTATE->m_bEditing )
|
|
|
|
|
SCREENMAN->PopTopScreen();
|
2004-12-05 11:55:35 +00:00
|
|
|
else if( m_sNextScreen != "" )
|
|
|
|
|
SCREENMAN->SetNewScreen( m_sNextScreen );
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-05 11:59:39 +00:00
|
|
|
void ScreenOptionsMaster::GoToPrevScreen()
|
2003-09-28 02:59:02 +00:00
|
|
|
{
|
|
|
|
|
/* XXX: A better way to handle this would be to check if we're a pushed screen. */
|
|
|
|
|
if( GAMESTATE->m_bEditing )
|
2004-12-09 09:41:06 +00:00
|
|
|
{
|
2003-09-28 02:59:02 +00:00
|
|
|
SCREENMAN->PopTopScreen();
|
2004-12-09 09:41:06 +00:00
|
|
|
// XXX: handle different destinations based on play mode?
|
|
|
|
|
}
|
2003-09-28 02:59:02 +00:00
|
|
|
else
|
2004-12-09 09:41:06 +00:00
|
|
|
{
|
|
|
|
|
SCREENMAN->DeletePreparedScreens();
|
2003-09-28 02:59:02 +00:00
|
|
|
SCREENMAN->SetNewScreen( PREV_SCREEN ); // (GAMESTATE->m_PlayMode) );
|
2004-12-09 09:41:06 +00:00
|
|
|
}
|
2003-09-28 02:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-07 07:25:52 +00:00
|
|
|
void ScreenOptionsMaster::RefreshIcons()
|
|
|
|
|
{
|
2004-07-11 02:44:42 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
2003-11-07 07:25:52 +00:00
|
|
|
{
|
2004-01-10 07:30:08 +00:00
|
|
|
for( unsigned i=0; i<m_Rows.size(); ++i ) // foreach options line
|
2003-11-07 07:25:52 +00:00
|
|
|
{
|
2005-02-19 19:17:28 +00:00
|
|
|
if( m_Rows[i]->GetRowType() == OptionRow::ROW_EXIT )
|
2004-01-10 04:35:30 +00:00
|
|
|
continue; // skip
|
|
|
|
|
|
2005-02-11 07:50:26 +00:00
|
|
|
OptionRow &row = *m_Rows[i];
|
2005-02-20 10:12:50 +00:00
|
|
|
const OptionRowDefinition &def = row.GetRowDef();
|
2003-11-07 07:25:52 +00:00
|
|
|
|
2004-01-11 02:28:10 +00:00
|
|
|
// find first selection and whether multiple are selected
|
2005-02-14 01:38:57 +00:00
|
|
|
int iFirstSelection = row.GetOneSelection( p, true );
|
2003-11-07 07:25:52 +00:00
|
|
|
|
|
|
|
|
// set icon name
|
|
|
|
|
CString sIcon;
|
2004-01-11 02:28:10 +00:00
|
|
|
|
2005-02-14 01:38:57 +00:00
|
|
|
if( iFirstSelection == -1 )
|
2004-01-11 02:28:10 +00:00
|
|
|
{
|
2004-01-11 04:34:00 +00:00
|
|
|
sIcon = "Multi";
|
2004-01-11 02:28:10 +00:00
|
|
|
}
|
|
|
|
|
else if( iFirstSelection != -1 )
|
2003-11-07 07:25:52 +00:00
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
const OptionRowHandler *pHand = OptionRowHandlers[i];
|
2005-02-24 06:10:11 +00:00
|
|
|
sIcon = pHand->GetIconText( def, iFirstSelection+(m_OptionsNavigation==NAV_TOGGLE_THREE_KEY?-1:0) );
|
2003-11-07 07:25:52 +00:00
|
|
|
}
|
2004-01-11 02:28:10 +00:00
|
|
|
|
2003-11-07 07:25:52 +00:00
|
|
|
|
2003-11-08 04:25:33 +00:00
|
|
|
/* XXX: hack to not display text in the song options menu */
|
2005-02-20 10:12:50 +00:00
|
|
|
if( def.bOneChoiceForAllPlayers )
|
2003-11-08 04:25:33 +00:00
|
|
|
sIcon = "";
|
|
|
|
|
|
2004-07-11 02:44:42 +00:00
|
|
|
LoadOptionIcon( p, i, sIcon );
|
2003-11-07 07:25:52 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-06-08 05:22:33 +00:00
|
|
|
|
2005-02-20 10:12:50 +00:00
|
|
|
void ScreenOptionsMaster::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
|
|
|
|
{
|
|
|
|
|
ScreenOptions::ChangeValueInRow( pn, iDelta, Repeat );
|
|
|
|
|
|
|
|
|
|
int iRow = m_iCurrentRow[pn];
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
const OptionRowHandler *pHand = OptionRowHandlers[iRow];
|
2005-02-20 10:12:50 +00:00
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
FOREACH_CONST( CString, pHand->m_vsRefreshRowNames, sRowToRefreshName )
|
2005-02-20 10:12:50 +00:00
|
|
|
{
|
|
|
|
|
for( unsigned r=0; r<m_Rows.size(); r++ )
|
|
|
|
|
{
|
|
|
|
|
OptionRow &rowOther = *m_Rows[r];
|
|
|
|
|
|
|
|
|
|
if( rowOther.GetRowType() == OptionRow::ROW_EXIT )
|
|
|
|
|
continue;
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
OptionRowHandler *pHandOther = OptionRowHandlers[r];
|
2005-02-20 10:12:50 +00:00
|
|
|
OptionRowDefinition &defOther = m_OptionRowAlloc[r];
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
if( *sRowToRefreshName == pHandOther->m_sName )
|
2005-02-20 10:12:50 +00:00
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
pHandOther->Reload( defOther );
|
2005-02-20 10:12:50 +00:00
|
|
|
ScreenOptions::RefreshRowChoices( r, defOther );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-24 01:17:39 +00:00
|
|
|
void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
|
|
|
|
case SM_GoToNextScreen:
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Override ScreenOptions's calling of ExportOptions
|
|
|
|
|
//
|
|
|
|
|
m_iChangeMask = 0;
|
|
|
|
|
|
|
|
|
|
CHECKPOINT;
|
|
|
|
|
|
|
|
|
|
const unsigned uFocusRow = this->GetCurrentRow();
|
|
|
|
|
/* If the selection is on a LIST, and the selected LIST option sets the screen,
|
|
|
|
|
* honor it. */
|
|
|
|
|
m_sNextScreen = "";
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
for( unsigned r = 0; r < OptionRowHandlers.size(); ++r )
|
2005-02-24 01:17:39 +00:00
|
|
|
{
|
2005-02-24 04:56:36 +00:00
|
|
|
OptionRow &row = *m_Rows[r];
|
|
|
|
|
|
|
|
|
|
CHECKPOINT_M( ssprintf("%i/%i", r, int(OptionRowHandlers.size())) );
|
2005-02-24 01:17:39 +00:00
|
|
|
|
|
|
|
|
/* If SELECT_NONE, only apply it if it's the selected option. */
|
2005-02-24 04:56:36 +00:00
|
|
|
const OptionRowDefinition &def = m_OptionRowAlloc[r];
|
|
|
|
|
if( def.selectType == SELECT_NONE && r != uFocusRow )
|
2005-02-24 01:17:39 +00:00
|
|
|
continue;
|
|
|
|
|
|
2005-02-24 04:56:36 +00:00
|
|
|
OptionRowHandler *pHand = OptionRowHandlers[r];
|
|
|
|
|
|
|
|
|
|
const int iChoice = row.m_iChoiceInRowWithFocus[GAMESTATE->m_MasterPlayerNumber];
|
|
|
|
|
CString sScreen = pHand->GetAndEraseScreen( iChoice );
|
|
|
|
|
if( !sScreen.empty() )
|
|
|
|
|
m_sNextScreen = sScreen;
|
|
|
|
|
|
|
|
|
|
ExportOptions( r );
|
2005-02-24 01:17:39 +00:00
|
|
|
}
|
|
|
|
|
CHECKPOINT;
|
|
|
|
|
|
|
|
|
|
// NEXT_SCREEN;
|
|
|
|
|
if( m_sNextScreen == "" )
|
|
|
|
|
m_sNextScreen = NEXT_SCREEN;
|
|
|
|
|
|
|
|
|
|
if( m_iChangeMask & OPT_APPLY_ASPECT_RATIO )
|
|
|
|
|
{
|
|
|
|
|
THEME->UpdateLuaGlobals(); // This needs to be done before resetting the projection matrix below
|
|
|
|
|
SCREENMAN->ThemeChanged(); // recreate ScreenSystemLayer and SharedBGA
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the theme changes, we need to reset RageDisplay to apply new theme
|
|
|
|
|
* window title and icon. */
|
|
|
|
|
/* If the aspect ratio changes, we need to reset RageDisplay so that the
|
|
|
|
|
* projection matrix is re-created using the new screen dimensions. */
|
|
|
|
|
if( (m_iChangeMask & OPT_APPLY_THEME) ||
|
|
|
|
|
(m_iChangeMask & OPT_APPLY_GRAPHICS) ||
|
|
|
|
|
(m_iChangeMask & OPT_APPLY_ASPECT_RATIO) )
|
|
|
|
|
ApplyGraphicOptions();
|
|
|
|
|
|
|
|
|
|
if( m_iChangeMask & OPT_SAVE_PREFERENCES )
|
|
|
|
|
{
|
|
|
|
|
/* Save preferences. */
|
|
|
|
|
LOG->Trace("ROW_CONFIG used; saving ...");
|
|
|
|
|
PREFSMAN->SaveGlobalPrefsToDisk();
|
|
|
|
|
SaveGamePrefsToDisk();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( m_iChangeMask & OPT_RESET_GAME )
|
|
|
|
|
{
|
|
|
|
|
ResetGame();
|
|
|
|
|
m_sNextScreen = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( m_iChangeMask & OPT_APPLY_SOUND )
|
|
|
|
|
{
|
|
|
|
|
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( m_iChangeMask & OPT_APPLY_SONG )
|
|
|
|
|
SONGMAN->SetPreferences();
|
|
|
|
|
|
|
|
|
|
CHECKPOINT;
|
|
|
|
|
this->GoToNextScreen();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ScreenOptions::HandleScreenMessage( SM );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-20 10:12:50 +00:00
|
|
|
|
2004-06-08 05:22:33 +00:00
|
|
|
/*
|
|
|
|
|
* (c) 2003-2004 Glenn Maynard
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|