2003-09-28 02:59:02 +00:00
#include "global.h"
#include "ScreenOptionsMasterPrefs.h"
#include "PrefsManager.h"
2003-09-28 07:14:07 +00:00
#include "ThemeManager.h"
#include "AnnouncerManager.h"
#include "NoteSkinManager.h"
#include "PlayerOptions.h"
#include "SongOptions.h"
2003-09-29 02:24:53 +00:00
#include "RageDisplay.h"
#include "RageUtil.h"
2003-09-29 03:22:51 +00:00
#include "GameManager.h"
#include "GameState.h"
2003-10-02 01:41:09 +00:00
#include "StepMania.h"
2004-07-25 17:07:32 +00:00
#include "Game.h"
2004-07-25 04:27:20 +00:00
#include "Foreach.h"
2005-01-04 10:51:25 +00:00
#include "GameConstantsAndTypes.h"
2005-11-26 07:22:33 +00:00
#include "DisplayResolutions.h"
2006-01-08 18:40:20 +00:00
#include "LocalizedString.h"
2006-08-08 18:55:16 +00:00
#include "SpecialFiles.h"
#include "RageLog.h"
2003-09-28 02:59:02 +00:00
2006-10-07 08:56:12 +00:00
using namespace StringConversion ;
2005-10-27 07:51:37 +00:00
static void GetPrefsDefaultModifiers ( PlayerOptions & po , SongOptions & so )
2003-09-29 06:28:17 +00:00
{
2005-11-09 10:55:30 +00:00
po . FromString ( PREFSMAN -> m_sDefaultModifiers );
so . FromString ( PREFSMAN -> m_sDefaultModifiers );
2003-09-29 06:28:17 +00:00
}
2005-10-27 07:51:37 +00:00
static void SetPrefsDefaultModifiers ( const PlayerOptions & po , const SongOptions & so )
2003-09-29 06:28:17 +00:00
{
2006-01-22 01:00:06 +00:00
vector < RString > as ;
2003-09-29 06:28:17 +00:00
if ( po . GetString () != "" )
as . push_back ( po . GetString () );
if ( so . GetString () != "" )
as . push_back ( so . GetString () );
2005-11-09 10:55:30 +00:00
PREFSMAN -> m_sDefaultModifiers . Set ( join ( ", " , as ) );
2003-09-29 06:28:17 +00:00
}
2005-10-27 15:46:16 +00:00
/* Ugly: the input values may be a different type than the mapping. For example,
* the mapping may be an enum, and value an int. This is because we don't
* have FromString/ToString for every enum type. Assume that the distance between
* T and U can be represented as a float. */
template < class T , class U >
int FindClosestEntry ( T value , const U * mapping , unsigned cnt )
2005-02-20 04:20:46 +00:00
{
int iBestIndex = 0 ;
2005-10-27 15:46:16 +00:00
float best_dist = 0 ;
2005-02-20 04:20:46 +00:00
bool have_best = false ;
for ( unsigned i = 0 ; i < cnt ; ++ i )
{
2005-10-27 15:46:16 +00:00
const U val = mapping [ i ];
float dist = value < val ? ( float )( val - value ) : ( float )( value - val );
2005-02-20 04:20:46 +00:00
if ( have_best && best_dist < dist )
continue ;
have_best = true ;
best_dist = dist ;
iBestIndex = i ;
}
if ( have_best )
return iBestIndex ;
else
return 0 ;
}
2005-05-06 20:41:05 +00:00
template < class T >
2003-09-30 05:33:33 +00:00
static void MoveMap ( int & sel , T & opt , bool ToSel , const T * mapping , unsigned cnt )
{
if ( ToSel )
{
2005-02-20 04:20:46 +00:00
sel = FindClosestEntry ( opt , mapping , cnt );
2003-09-30 05:33:33 +00:00
} else {
/* sel -> opt */
opt = mapping [ sel ];
}
}
2005-04-28 08:27:40 +00:00
template < class T >
2005-10-27 15:46:16 +00:00
static void MoveMap ( int & sel , IPreference & opt , bool ToSel , const T * mapping , unsigned cnt )
2005-02-20 04:20:46 +00:00
{
if ( ToSel )
{
2006-01-22 01:00:06 +00:00
RString sOpt = opt . ToString ();
2005-10-27 15:46:16 +00:00
/* This should really be T, but we can't FromString an enum. */
float val ;
FromString ( sOpt , val );
sel = FindClosestEntry ( val , mapping , cnt );
2005-02-20 04:20:46 +00:00
} else {
/* sel -> opt */
2006-01-22 01:00:06 +00:00
RString sOpt = ToString ( mapping [ sel ] );
2005-10-27 15:46:16 +00:00
opt . FromString ( sOpt );
}
}
template < class T >
static void MoveMap ( int & sel , const ConfOption * pConfOption , bool ToSel , const T * mapping , unsigned cnt )
{
2007-02-26 09:40:14 +00:00
ASSERT ( pConfOption );
2006-11-21 04:13:09 +00:00
IPreference * pPref = IPreference :: GetPreferenceByName ( pConfOption -> m_sPrefName );
ASSERT_M ( pPref != NULL , pConfOption -> m_sPrefName );
2005-10-27 15:46:16 +00:00
MoveMap ( sel , * pPref , ToSel , mapping , cnt );
}
2006-12-05 16:56:01 +00:00
template < class T >
2005-02-24 06:28:15 +00:00
static void MovePref ( int & iSel , bool bToSel , const ConfOption * pConfOption )
{
2006-11-21 04:13:09 +00:00
IPreference * pPref = IPreference :: GetPreferenceByName ( pConfOption -> m_sPrefName );
ASSERT_M ( pPref != NULL , pConfOption -> m_sPrefName );
2005-02-24 06:28:15 +00:00
2005-10-27 16:14:23 +00:00
if ( bToSel )
{
2006-12-05 16:56:01 +00:00
// TODO: why not get the int directly from pPref? Why are we writing it to a string and then back?
T t ;
FromString ( pPref -> ToString (), t );
iSel = static_cast < int > ( t );
2003-09-28 02:59:02 +00:00
}
2005-10-27 16:14:23 +00:00
else
{
2006-12-05 16:56:01 +00:00
pPref -> FromString ( ToString ( static_cast < T > ( iSel ) ) );
}
}
template <>
2008-06-18 18:55:10 +00:00
void MovePref < bool > ( int & iSel , bool bToSel , const ConfOption * pConfOption )
2006-12-05 16:56:01 +00:00
{
IPreference * pPref = IPreference :: GetPreferenceByName ( pConfOption -> m_sPrefName );
ASSERT_M ( pPref != NULL , pConfOption -> m_sPrefName );
if ( bToSel )
{
// TODO: why not get the int directly from pPref? Why are we writing it to a string and then back?
bool b ;
FromString ( pPref -> ToString (), b );
iSel = b ? 1 : 0 ;
}
else
{
// If we don't make a specific instantiation of MovePref<bool>, there is a compile warning here because of
// static_cast<bool>( iSel ) where iSel is an int. What is the best way to remove that compile warning?
pPref -> FromString ( ToString < bool > ( iSel ? true : false ) );
2005-10-27 16:14:23 +00:00
}
}
2003-09-28 02:59:02 +00:00
2006-07-05 02:39:47 +00:00
static void MoveNop ( int & iSel , bool bToSel , const ConfOption * pConfOption )
{
if ( bToSel )
iSel = 0 ;
}
2006-01-22 01:00:06 +00:00
static void GameChoices ( vector < RString > & out )
2003-09-29 03:22:51 +00:00
{
2004-07-25 17:07:32 +00:00
vector < const Game *> aGames ;
2008-03-24 12:50:16 +00:00
GameManager :: GetEnabledGames ( aGames );
2004-07-25 17:07:32 +00:00
FOREACH ( const Game * , aGames , g )
2003-09-29 03:22:51 +00:00
{
2006-01-22 01:00:06 +00:00
RString sGameName = ( * g ) -> m_szName ;
2003-09-29 03:22:51 +00:00
out . push_back ( sGameName );
}
}
2004-12-07 02:47:21 +00:00
static void GameSel ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 03:22:51 +00:00
{
2006-01-22 01:00:06 +00:00
vector < RString > choices ;
2004-12-07 02:47:21 +00:00
pConfOption -> MakeOptionsList ( choices );
2003-09-29 03:22:51 +00:00
if ( ToSel )
{
2006-01-22 01:00:06 +00:00
const RString sCurGameName = GAMESTATE -> m_pCurGame -> m_szName ;
2003-09-29 03:22:51 +00:00
sel = 0 ;
for ( unsigned i = 0 ; i < choices . size (); ++ i )
if ( ! stricmp ( choices [ i ], sCurGameName ) )
sel = i ;
} else {
2004-07-25 17:07:32 +00:00
vector < const Game *> aGames ;
2008-03-24 12:50:16 +00:00
GameManager :: GetEnabledGames ( aGames );
2005-12-02 01:16:28 +00:00
StepMania :: ChangeCurrentGame ( aGames [ sel ] );
2003-09-29 03:22:51 +00:00
}
}
2006-01-22 01:00:06 +00:00
static void LanguageChoices ( vector < RString > & out )
2003-09-28 07:14:07 +00:00
{
2006-01-27 08:13:01 +00:00
vector < RString > vs ;
THEME -> GetLanguages ( vs );
SortRStringArray ( vs , true );
FOREACH_CONST ( RString , vs , s )
{
const LanguageInfo * pLI = GetLanguageInfo ( * s );
if ( pLI )
2008-04-07 23:25:51 +00:00
out . push_back ( THEME -> GetString ( "NativeLanguageNames" , pLI -> szEnglishName ) );
2006-01-27 08:13:01 +00:00
else
out . push_back ( * s );
}
2003-09-28 07:14:07 +00:00
}
2004-12-07 02:47:21 +00:00
static void Language ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-28 07:14:07 +00:00
{
2006-01-27 08:13:01 +00:00
vector < RString > vs ;
THEME -> GetLanguages ( vs );
SortRStringArray ( vs , true );
2004-12-07 02:47:21 +00:00
2003-09-28 07:14:07 +00:00
if ( ToSel )
{
2006-08-08 18:55:16 +00:00
sel = - 1 ;
for ( unsigned i = 0 ; sel == - 1 && i < vs . size (); ++ i )
2006-01-27 08:13:01 +00:00
if ( ! stricmp ( vs [ i ], THEME -> GetCurLanguage ()) )
2003-09-28 07:14:07 +00:00
sel = i ;
2006-08-08 18:55:16 +00:00
/* If the current language doesn't exist, we'll show BASE_LANGUAGE, so select that. */
for ( unsigned i = 0 ; sel == - 1 && i < vs . size (); ++ i )
if ( ! stricmp ( vs [ i ], SpecialFiles :: BASE_LANGUAGE ) )
sel = i ;
if ( sel == - 1 )
{
LOG -> Warn ( "Couldn't find language \" %s \" or fallback \" %s \" ; using \" %s \" " ,
THEME -> GetCurLanguage (). c_str (), SpecialFiles :: BASE_LANGUAGE . c_str (), vs [ 0 ]. c_str () );
sel = 0 ;
}
2003-09-28 07:14:07 +00:00
} else {
2006-01-27 08:13:01 +00:00
const RString & sNewLanguage = vs [ sel ];
2003-09-28 07:14:07 +00:00
2006-03-03 07:32:45 +00:00
PREFSMAN -> m_sLanguage . Set ( sNewLanguage );
2003-09-28 07:14:07 +00:00
if ( THEME -> GetCurLanguage () != sNewLanguage )
2006-03-03 07:32:45 +00:00
THEME -> SwitchThemeAndLanguage ( THEME -> GetCurThemeName (), PREFSMAN -> m_sLanguage , PREFSMAN -> m_bPseudoLocalize );
2003-09-28 07:14:07 +00:00
}
}
2006-01-22 01:00:06 +00:00
static void ThemeChoices ( vector < RString > & out )
2003-09-28 07:14:07 +00:00
{
2006-06-14 07:42:40 +00:00
THEME -> GetSelectableThemeNames ( out );
FOREACH ( RString , out , s )
* s = THEME -> GetThemeDisplayName ( * s );
2003-09-28 07:14:07 +00:00
}
2006-01-22 01:00:06 +00:00
static void DisplayResolutionChoices ( vector < RString > & out )
2005-11-26 07:22:33 +00:00
{
DisplayResolutions d ;
DISPLAY -> GetDisplayResolutions ( d );
2006-02-07 08:29:36 +00:00
FOREACHS_CONST ( DisplayResolution , d , iter )
2005-11-26 07:22:33 +00:00
{
2006-01-22 01:00:06 +00:00
RString s = ssprintf ( "%dx%d" , iter -> iWidth , iter -> iHeight );
2005-11-26 07:22:33 +00:00
out . push_back ( s );
}
}
2004-12-07 02:47:21 +00:00
static void Theme ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-28 07:14:07 +00:00
{
2006-01-22 01:00:06 +00:00
vector < RString > choices ;
2004-12-07 02:47:21 +00:00
pConfOption -> MakeOptionsList ( choices );
2006-06-14 07:42:40 +00:00
vector < RString > vsThemeNames ;
THEME -> GetSelectableThemeNames ( vsThemeNames );
2003-09-28 07:14:07 +00:00
if ( ToSel )
{
sel = 0 ;
2006-06-14 07:42:40 +00:00
for ( unsigned i = 1 ; i < vsThemeNames . size (); i ++ )
2006-10-05 01:06:06 +00:00
if ( ! stricmp ( vsThemeNames [ i ], PREFSMAN -> m_sTheme . Get ()) )
2003-09-28 07:14:07 +00:00
sel = i ;
2006-06-16 21:36:17 +00:00
}
else
{
2006-06-14 07:42:40 +00:00
const RString sNewTheme = vsThemeNames [ sel ];
2006-11-21 04:13:09 +00:00
PREFSMAN -> m_sTheme . Set ( sNewTheme ); // OPT_APPLY_THEME will load the theme
2003-09-28 07:14:07 +00:00
}
}
2006-01-08 18:40:20 +00:00
static LocalizedString OFF ( "ScreenOptionsMasterPrefs" , "Off" );
2006-01-22 01:00:06 +00:00
static void AnnouncerChoices ( vector < RString > & out )
2003-09-28 07:14:07 +00:00
{
ANNOUNCER -> GetAnnouncerNames ( out );
2006-01-08 18:40:20 +00:00
out . insert ( out . begin (), OFF );
2003-09-28 07:14:07 +00:00
}
2004-12-07 02:47:21 +00:00
static void Announcer ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-28 07:14:07 +00:00
{
2006-01-22 01:00:06 +00:00
vector < RString > choices ;
2004-12-07 02:47:21 +00:00
pConfOption -> MakeOptionsList ( choices );
2003-09-28 07:14:07 +00:00
if ( ToSel )
{
sel = 0 ;
for ( unsigned i = 1 ; i < choices . size (); i ++ )
if ( ! stricmp ( choices [ i ], ANNOUNCER -> GetCurAnnouncerName ()) )
sel = i ;
2007-07-22 11:45:21 +00:00
}
else
{
2006-01-22 01:00:06 +00:00
const RString sNewAnnouncer = sel ? choices [ sel ] : RString ( "" );
2003-09-28 07:14:07 +00:00
ANNOUNCER -> SwitchAnnouncer ( sNewAnnouncer );
2007-07-22 11:45:21 +00:00
PREFSMAN -> m_sAnnouncer . Set ( sNewAnnouncer );
2003-09-28 07:14:07 +00:00
}
}
2006-01-22 01:00:06 +00:00
static void DefaultNoteSkinChoices ( vector < RString > & out )
2003-09-28 07:14:07 +00:00
{
NOTESKIN -> GetNoteSkinNames ( out );
}
2004-12-07 02:47:21 +00:00
static void DefaultNoteSkin ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-28 07:14:07 +00:00
{
2006-01-22 01:00:06 +00:00
vector < RString > choices ;
2004-12-07 02:47:21 +00:00
pConfOption -> MakeOptionsList ( choices );
2003-09-28 07:14:07 +00:00
if ( ToSel )
{
PlayerOptions po ;
2005-11-09 10:55:30 +00:00
po . FromString ( PREFSMAN -> m_sDefaultModifiers );
2003-09-28 07:14:07 +00:00
sel = 0 ;
for ( unsigned i = 0 ; i < choices . size (); i ++ )
if ( ! stricmp ( choices [ i ], po . m_sNoteSkin ) )
sel = i ;
2007-07-22 11:46:17 +00:00
}
else
{
2003-09-28 07:14:07 +00:00
PlayerOptions po ;
SongOptions so ;
2005-10-27 07:51:37 +00:00
GetPrefsDefaultModifiers ( po , so );
2003-09-28 07:14:07 +00:00
po . m_sNoteSkin = choices [ sel ];
2005-10-27 07:51:37 +00:00
SetPrefsDefaultModifiers ( po , so );
2003-09-28 07:14:07 +00:00
}
}
2003-09-29 00:07:36 +00:00
/* Background options */
2004-12-07 02:47:21 +00:00
static void BGBrightness ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 00:07:36 +00:00
{
2006-12-05 16:56:01 +00:00
// TODO: I hate the way the list of numbers is duplicated here and where the option is created.
// Try to find a way to only use the same list once. Do that for all of these float and int lists.
2003-09-30 05:33:33 +00:00
const float mapping [] = { 0.0f , 0.1f , 0.2f , 0.3f , 0.4f , 0.5f , 0.6f , 0.7f , 0.8f , 0.9f , 1.0f };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 00:07:36 +00:00
}
2005-10-30 05:37:13 +00:00
static void BGBrightnessNoZero ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
const float mapping [] = { 0.1f , 0.2f , 0.3f , 0.4f , 0.5f , 0.6f , 0.7f , 0.8f , 0.9f , 1.0f };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2005-10-30 05:37:13 +00:00
}
2005-10-29 20:59:08 +00:00
static void BGBrightnessOrStatic ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
2006-06-27 19:01:40 +00:00
const float mapping [] = { 0.5f , 0.25f , 0.5f , 0.75f };
2006-11-21 04:13:09 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2005-10-29 20:59:08 +00:00
2007-01-22 22:42:39 +00:00
IPreference * pSongBackgroundsPref = IPreference :: GetPreferenceByName ( "SongBackgrounds" );
if ( ToSel && pSongBackgroundsPref -> ToString () == "0" )
2005-10-29 20:59:08 +00:00
sel = 0 ;
if ( ! ToSel )
2007-01-22 22:42:39 +00:00
pSongBackgroundsPref -> FromString ( sel ? "1" : "0" );
2005-10-29 20:59:08 +00:00
}
2004-12-07 02:47:21 +00:00
static void NumBackgrounds ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 00:07:36 +00:00
{
2003-09-30 05:33:33 +00:00
const int mapping [] = { 5 , 10 , 15 , 20 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 00:07:36 +00:00
}
2003-09-29 00:46:25 +00:00
/* Input options */
2005-10-27 16:47:23 +00:00
static void MusicWheelSwitchSpeed ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 00:46:25 +00:00
{
2003-09-30 05:39:47 +00:00
const int mapping [] = { 5 , 10 , 15 , 25 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 00:46:25 +00:00
}
/* Gameplay options */
2004-12-07 02:47:21 +00:00
static void CoinModeNoHome ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-11-26 00:32:21 +00:00
{
2007-02-26 09:40:14 +00:00
// The mapping without home is easy: subtract one to compensate for the missing CoinMode_Home
2006-12-05 16:56:01 +00:00
if ( ToSel )
{
MovePref < CoinMode > ( sel , ToSel , pConfOption );
2007-02-26 09:40:14 +00:00
if ( sel > static_cast < int > ( CoinMode_Home ) )
2006-12-05 16:56:01 +00:00
-- sel ;
}
else
{
2007-02-26 09:40:14 +00:00
if ( sel >= static_cast < int > ( CoinMode_Home ) )
2006-12-05 16:56:01 +00:00
++ sel ;
MovePref < CoinMode > ( sel , ToSel , pConfOption );
}
2003-11-26 00:32:21 +00:00
}
2004-12-07 02:47:21 +00:00
static void CoinsPerCredit ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-10-06 05:59:58 +00:00
{
2005-06-21 17:59:21 +00:00
const int mapping [] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-10-06 05:59:58 +00:00
}
2007-04-26 18:13:37 +00:00
static void JointPremium ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
const Premium mapping [] = { Premium_DoubleFor1Credit , Premium_2PlayersFor1Credit };
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
}
2004-12-07 02:47:21 +00:00
static void SongsPerPlay ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-10-06 05:59:58 +00:00
{
2005-05-09 04:34:06 +00:00
const int mapping [] = { 1 , 2 , 3 , 4 , 5 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-10-06 05:59:58 +00:00
}
2005-04-28 08:27:40 +00:00
2005-02-19 09:16:16 +00:00
static void SongsPerPlayOrEventMode ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
2005-05-09 04:34:06 +00:00
const int mapping [] = { 1 , 2 , 3 , 4 , 5 , 6 };
2006-11-21 04:13:09 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2005-02-19 09:16:16 +00:00
if ( ToSel && PREFSMAN -> m_bEventMode )
2005-05-09 04:34:06 +00:00
sel = 5 ;
2005-02-19 09:16:16 +00:00
if ( ! ToSel )
2005-05-09 04:34:06 +00:00
PREFSMAN -> m_bEventMode . Set ( sel == 5 );
2005-02-19 09:16:16 +00:00
}
2003-10-06 05:59:58 +00:00
2003-09-29 03:02:54 +00:00
/* Machine options */
2005-10-27 16:47:23 +00:00
static void TimingWindowScale ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 03:02:54 +00:00
{
2008-03-12 10:12:20 +00:00
const float mapping [] = { 2.0f , 1.66f , 1.33f , 1.00f , 0.75f , 0.50f , 0.25f };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 03:02:54 +00:00
}
2005-06-25 02:37:18 +00:00
static void LifeDifficulty ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 03:02:54 +00:00
{
2008-03-12 10:12:20 +00:00
const float mapping [] = { 2.0f , 1.50f , 1.00f , 0.66f , 0.33f };
2006-11-21 04:13:09 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 03:02:54 +00:00
}
2008-03-12 09:48:34 +00:00
#include "LuaManager.h"
static int GetTimingDifficulty ()
{
int iTimingDifficulty = 0 ;
TimingWindowScale ( iTimingDifficulty , true , ConfOption :: Find ( "TimingWindowScale" ) );
iTimingDifficulty ++ ; // TimingDifficulty returns an index
return iTimingDifficulty ;
}
LuaFunction ( GetTimingDifficulty , GetTimingDifficulty () );
2005-06-25 02:37:18 +00:00
static int GetLifeDifficulty ()
{
2005-06-29 06:36:51 +00:00
int iLifeDifficulty = 0 ;
2007-03-07 02:51:34 +00:00
LifeDifficulty ( iLifeDifficulty , true , ConfOption :: Find ( "LifeDifficulty" ) );
2005-06-25 02:37:18 +00:00
iLifeDifficulty ++ ; // LifeDifficulty returns an index
return iLifeDifficulty ;
}
LuaFunction ( GetLifeDifficulty , GetLifeDifficulty () );
2008-03-12 09:48:34 +00:00
2004-12-07 02:47:21 +00:00
static void DefaultFailType ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 03:02:54 +00:00
{
if ( ToSel )
{
2007-05-12 23:48:29 +00:00
PlayerOptions po ;
po . FromString ( PREFSMAN -> m_sDefaultModifiers );
sel = po . m_FailType ;
2005-04-05 08:30:57 +00:00
}
else
{
2003-09-29 03:02:54 +00:00
PlayerOptions po ;
SongOptions so ;
2005-10-27 07:51:37 +00:00
GetPrefsDefaultModifiers ( po , so );
2003-09-29 06:28:17 +00:00
2003-09-29 03:02:54 +00:00
switch ( sel )
{
2007-05-12 23:48:29 +00:00
case 0 : po . m_FailType = PlayerOptions :: FAIL_IMMEDIATE ; break ;
case 1 : po . m_FailType = PlayerOptions :: FAIL_IMMEDIATE_CONTINUE ; break ;
case 2 : po . m_FailType = PlayerOptions :: FAIL_AT_END ; break ;
case 3 : po . m_FailType = PlayerOptions :: FAIL_OFF ; break ;
2003-09-29 03:02:54 +00:00
default :
ASSERT ( 0 );
}
2003-09-29 06:28:17 +00:00
2005-10-27 07:51:37 +00:00
SetPrefsDefaultModifiers ( po , so );
2003-09-29 03:02:54 +00:00
}
}
/* Graphic options */
2004-09-05 05:50:23 +00:00
struct res_t
{
int w , h ;
res_t () : w ( 0 ), h ( 0 ) { }
res_t ( int w_ , int h_ ) : w ( w_ ), h ( h_ ) { }
res_t operator - ( const res_t & rhs ) const
{
return res_t ( w - rhs . w , h - rhs . h );
}
bool operator < ( const res_t & rhs ) const
{
if ( w != rhs . w )
return w < rhs . w ;
return h < rhs . h ;
}
2005-10-27 15:46:16 +00:00
/* Ugly: allow convert to a float for FindClosestEntry. */
operator float () const { return w * 5000.0f + h ; }
2004-09-05 05:50:23 +00:00
};
2005-11-26 07:22:33 +00:00
static void DisplayResolutionM ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 02:24:53 +00:00
{
2005-11-26 07:22:33 +00:00
vector < res_t > v ;
DisplayResolutions d ;
DISPLAY -> GetDisplayResolutions ( d );
2006-02-07 08:29:36 +00:00
FOREACHS_CONST ( DisplayResolution , d , iter )
2004-09-05 05:50:23 +00:00
{
2005-11-26 07:22:33 +00:00
v . push_back ( res_t ( iter -> iWidth , iter -> iHeight ) );
}
2004-09-05 05:50:23 +00:00
res_t sel_res ( PREFSMAN -> m_iDisplayWidth , PREFSMAN -> m_iDisplayHeight );
2005-11-26 07:22:33 +00:00
MoveMap ( sel , sel_res , ToSel , & v [ 0 ], v . size () );
2003-09-29 02:24:53 +00:00
if ( ! ToSel )
2004-09-05 05:50:23 +00:00
{
2005-05-06 20:41:05 +00:00
PREFSMAN -> m_iDisplayWidth . Set ( sel_res . w );
PREFSMAN -> m_iDisplayHeight . Set ( sel_res . h );
2004-09-05 05:50:23 +00:00
}
2003-09-29 02:24:53 +00:00
}
2005-10-27 16:47:23 +00:00
static void DisplayColorDepth ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 02:24:53 +00:00
{
2003-09-29 04:46:37 +00:00
const int mapping [] = { 16 , 32 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 02:24:53 +00:00
}
2005-10-27 16:47:23 +00:00
static void MaxTextureResolution ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 02:24:53 +00:00
{
2003-09-29 04:46:37 +00:00
const int mapping [] = { 256 , 512 , 1024 , 2048 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 02:24:53 +00:00
}
2005-10-27 16:47:23 +00:00
static void TextureColorDepth ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 02:24:53 +00:00
{
2003-09-29 04:46:37 +00:00
const int mapping [] = { 16 , 32 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 02:24:53 +00:00
}
2005-10-27 16:47:23 +00:00
static void MovieColorDepth ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-10-07 08:18:28 +00:00
{
const int mapping [] = { 16 , 32 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-10-07 08:18:28 +00:00
}
2004-12-07 02:47:21 +00:00
static void RefreshRate ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-09-29 02:24:53 +00:00
{
2003-09-29 04:46:37 +00:00
const int mapping [] = { ( int ) REFRESH_DEFAULT , 60 , 70 , 72 , 75 , 80 , 85 , 90 , 100 , 120 , 150 };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-09-29 02:24:53 +00:00
}
2005-10-27 15:25:08 +00:00
static void DisplayAspectRatio ( int & sel , bool ToSel , const ConfOption * pConfOption )
2004-12-23 06:50:19 +00:00
{
2009-04-07 21:10:38 +00:00
const float mapping [] = { 3 / 4.f , 1 , 4 / 3.0f , 16 / 10.0f , 16 / 9.f , 8 / 3.f };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2004-12-23 06:50:19 +00:00
}
2006-02-22 08:25:49 +00:00
/* Simpler DisplayAspectRatio setting, which only offers "on" and "off". "On" can be 16:9
* or 16:10. */
static void WideScreen16_10 ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
const float mapping [] = { 4 / 3.0f , 16 / 10.0f };
2006-11-21 04:13:09 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2006-02-22 08:25:49 +00:00
}
static void WideScreen16_9 ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
const float mapping [] = { 4 / 3.0f , 16 / 9.0f };
2006-11-21 04:13:09 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2006-02-22 08:25:49 +00:00
}
2003-09-29 00:07:36 +00:00
/* Sound options */
2003-09-28 07:14:07 +00:00
2004-12-07 02:47:21 +00:00
static void SoundVolume ( int & sel , bool ToSel , const ConfOption * pConfOption )
2003-10-12 20:34:46 +00:00
{
const float mapping [] = { 0.0f , 0.1f , 0.2f , 0.3f , 0.4f , 0.5f , 0.6f , 0.7f , 0.8f , 0.9f , 1.0f };
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2003-10-12 20:34:46 +00:00
}
2007-05-03 06:01:21 +00:00
static void SoundVolumeAttract ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
const float mapping [] = { 0.0f , 0.1f , 0.2f , 0.3f , 0.4f , 0.5f , 0.6f , 0.7f , 0.8f , 0.9f , 1.0f };
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
}
2005-10-15 04:13:11 +00:00
static void GlobalOffsetSeconds ( int & sel , bool ToSel , const ConfOption * pConfOption )
{
float mapping [ 41 ];
for ( int i = 0 ; i < 41 ; ++ i )
mapping [ i ] = SCALE ( i , 0.0f , 40.0f , - 0.1f , + 0.1f );
2006-08-08 18:57:00 +00:00
MoveMap ( sel , pConfOption , ToSel , mapping , ARRAYLEN ( mapping ) );
2005-10-15 04:13:11 +00:00
}
2004-12-07 09:49:03 +00:00
static vector < ConfOption > g_ConfOptions ;
static void InitializeConfOptions ()
2003-09-28 02:59:02 +00:00
{
2004-12-07 09:49:03 +00:00
if ( ! g_ConfOptions . empty () )
return ;
2006-12-05 16:56:01 +00:00
// There are a couple ways of getting the current preference column or turning a new choice in the interface
// into a new preference. The easiest is when the interface choices are an exact mapping to the values the
// preference can be. In that case, the easiest thing to do is use MovePref<bool or enum>. The next
// easiest case is when there is a hardcoded mapping that is not 1-1, such as CoinModeNoHome. In that case,
// you need to remap the result of MovePref<enum> to the correct mapping. Harder yet is when there is a
// float or a dynamic set of options, such as Language or Theme. Those require individual attention.
2004-12-07 09:49:03 +00:00
#define ADD(x) g_ConfOptions.push_back( x )
2003-09-29 03:22:51 +00:00
/* Select game */
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "Game" , GameSel , GameChoices ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_RESET_GAME ;
2003-09-29 03:22:51 +00:00
2003-09-28 07:14:07 +00:00
/* Appearance options */
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "Language" , Language , LanguageChoices ) );
ADD ( ConfOption ( "Theme" , Theme , ThemeChoices ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_THEME ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "Announcer" , Announcer , AnnouncerChoices ) );
ADD ( ConfOption ( "DefaultNoteSkin" , DefaultNoteSkin , DefaultNoteSkinChoices ) );
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "ShowInstructions" , MovePref < bool > , "Skip" , "Show" ) );
ADD ( ConfOption ( "ShowCaution" , MovePref < bool > , "Skip" , "Show" ) );
ADD ( ConfOption ( "DancePointsForOni" , MovePref < bool > , "Percent" , "Dance Points" ) );
ADD ( ConfOption ( "ShowSelectGroup" , MovePref < bool > , "All Music" , "Choose" ) );
ADD ( ConfOption ( "MusicWheelUsesSections" , MovePref < MusicWheelUsesSections > , "Never" , "Always" , "Title Only" ) );
ADD ( ConfOption ( "CourseSortOrder" , MovePref < CourseSortOrders > , "Num Songs" , "Average Feet" , "Total Feet" , "Ranking" ) );
ADD ( ConfOption ( "MoveRandomToEnd" , MovePref < bool > , "No" , "Yes" ) );
ADD ( ConfOption ( "ShowNativeLanguage" , MovePref < bool > , "Romanization" , "Native Language" ) );
ADD ( ConfOption ( "ShowLyrics" , MovePref < bool > , "Hide" , "Show" ) );
2003-09-28 07:14:07 +00:00
2003-12-30 09:34:05 +00:00
/* Misc options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "AutogenSteps" , MovePref < bool > , "Off" , "On" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_SONG ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "AutogenGroupCourses" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "FastLoad" , MovePref < bool > , "Off" , "On" ) );
2003-09-29 00:07:36 +00:00
/* Background options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "RandomBackgroundMode" , MovePref < RandomBackgroundMode > , "Off" , "Animations" , "Random Movies" ) );
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "BGBrightness" , BGBrightness , "|0%" , "|10%" , "|20%" , "|30%" , "|40%" , "|50%" , "|60%" , "|70%" , "|80%" , "|90%" , "|100%" ) );
ADD ( ConfOption ( "BGBrightnessNoZero" , BGBrightnessNoZero , "|10%" , "|20%" , "|30%" , "|40%" , "|50%" , "|60%" , "|70%" , "|80%" , "|90%" , "|100%" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "BGBrightness" ;
2006-06-05 10:01:30 +00:00
ADD ( ConfOption ( "BGBrightnessOrStatic" , BGBrightnessOrStatic , "Disabled" , "25% Bright" , "50% Bright" , "75% Bright" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "BGBrightness" ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "ShowDanger" , MovePref < bool > , "Hide" , "Show" ) );
ADD ( ConfOption ( "ShowDancingCharacters" , MovePref < ShowDancingCharacters > , "Default to Off" , "Default to Random" , "Select" ) );
ADD ( ConfOption ( "ShowBeginnerHelper" , MovePref < bool > , "Off" , "On" ) );
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "NumBackgrounds" , NumBackgrounds , "|5" , "|10" , "|15" , "|20" ) );
2003-09-29 00:07:36 +00:00
2003-09-29 00:46:25 +00:00
/* Input options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "AutoMapOnJoyChange" , MovePref < bool > , "Off" , "On (recommended)" ) );
ADD ( ConfOption ( "OnlyDedicatedMenuButtons" , MovePref < bool > , "Use Gameplay Buttons" , "Only Dedicated Buttons" ) );
ADD ( ConfOption ( "AutoPlay" , MovePref < PlayerController > , "Off" , "On" , "CPU-Controlled" ) );
ADD ( ConfOption ( "DelayedBack" , MovePref < bool > , "Instant" , "Hold" ) );
ADD ( ConfOption ( "ArcadeOptionsNavigation" , MovePref < bool > , "StepMania Style" , "Arcade Style" ) );
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "MusicWheelSwitchSpeed" , MusicWheelSwitchSpeed , "Slow" , "Normal" , "Fast" , "Really Fast" ) );
2003-09-29 00:46:25 +00:00
/* Gameplay options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "Center1Player" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "HiddenSongs" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "EasterEggs" , MovePref < bool > , "Off" , "On" ) );
// W1 is Fantastic Timing
ADD ( ConfOption ( "AllowW1" , MovePref < AllowW1 > , "Never" , "Courses Only" , "Always" ) );
ADD ( ConfOption ( "AllowExtraStage" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "PickExtraStage" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "UseUnlockSystem" , MovePref < bool > , "Off" , "On" ) );
2003-09-29 00:46:25 +00:00
2003-09-29 03:02:54 +00:00
/* Machine options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "MenuTimer" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "CoinMode" , MovePref < CoinMode > , "Home" , "Pay" , "Free Play" ) );
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "CoinModeNoHome" , CoinModeNoHome , "Pay" , "Free Play" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "CoinMode" ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "SongsPerPlay" , SongsPerPlay , "|1" , "|2" , "|3" , "|4" , "|5" ) );
ADD ( ConfOption ( "SongsPerPlayOrEvent" , SongsPerPlayOrEventMode , "|1" , "|2" , "|3" , "|4" , "|5" , "Event" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "SongsPerPlay" ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "EventMode" , MovePref < bool > , "Off" , "On" ) );
2008-05-19 18:34:53 +00:00
ADD ( ConfOption ( "ScoringType" , MovePref < ScoringType > , "New" , "Old" , "Custom" ) );
2008-03-12 10:12:20 +00:00
ADD ( ConfOption ( "TimingWindowScale" , TimingWindowScale , "|1" , "|2" , "|3" , "|4" , "|5" , "|6" , "|7" ) );
2007-04-26 17:53:54 +00:00
ADD ( ConfOption ( "LifeDifficulty" , LifeDifficulty , "|1" , "|2" , "|3" , "|4" , "|5" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "LifeDifficultyScale" ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "ProgressiveLifebar" , MovePref < int > , "Off" , "|1" , "|2" , "|3" , "|4" , "|5" , "|6" , "|7" , "|8" ) );
ADD ( ConfOption ( "ProgressiveStageLifebar" , MovePref < int > , "Off" , "|1" , "|2" , "|3" , "|4" , "|5" , "|6" , "|7" , "|8" , "Insanity" ) );
ADD ( ConfOption ( "ProgressiveNonstopLifebar" , MovePref < int > , "Off" , "|1" , "|2" , "|3" , "|4" , "|5" , "|6" , "|7" , "|8" , "Insanity" ) );
ADD ( ConfOption ( "DefaultFailType" , DefaultFailType , "Immediate" , "ImmediateContinue" , "End of Song" , "Off" ) );
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "CoinsPerCredit" , CoinsPerCredit , "|1" , "|2" , "|3" , "|4" , "|5" , "|6" , "|7" , "|8" , "|9" , "|10" , "|11" , "|12" , "|13" , "|14" , "|15" , "|16" ) );
2007-02-26 09:40:14 +00:00
ADD ( ConfOption ( "Premium" , MovePref < Premium > , "Off" , "Double for 1 Credit" , "2 Players for 1 Credit" ) );
2007-04-26 18:13:37 +00:00
ADD ( ConfOption ( "JointPremium" , JointPremium , "Off" , "2 Players for 1 Credit" ) );
g_ConfOptions . back (). m_sPrefName = "Premium" ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "ShowSongOptions" , MovePref < Maybe > , "Ask" , "Hide" , "Show" ) );
ADD ( ConfOption ( "GetRankingName" , MovePref < GetRankingName > , "Off" , "On" , "Ranking Songs" ) );
2003-09-29 03:02:54 +00:00
2003-09-29 02:24:53 +00:00
/* Graphic options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "Windowed" , MovePref < bool > , "Full Screen" , "Windowed" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "DisplayResolution" , DisplayResolutionM , DisplayResolutionChoices ) );
2005-11-26 07:22:33 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS | OPT_APPLY_ASPECT_RATIO ;
2006-02-07 00:55:03 +00:00
ADD ( ConfOption ( "DisplayAspectRatio" , DisplayAspectRatio , "|3:4" , "|1:1" , "|4:3" , "|16:10" , "|16:9" , "|8:3" ) );
2009-04-07 21:10:38 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS | OPT_APPLY_ASPECT_RATIO ; // need OPT_APPLY_GRAPHICS because if windowed the width may change to make square pixels
2006-02-22 08:25:49 +00:00
ADD ( ConfOption ( "WideScreen16_10" , WideScreen16_10 , "Off" , "On" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "DisplayAspectRatio" ;
2006-02-22 08:25:49 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_ASPECT_RATIO ;
ADD ( ConfOption ( "WideScreen16_9" , WideScreen16_9 , "Off" , "On" ) );
2006-11-21 04:13:09 +00:00
g_ConfOptions . back (). m_sPrefName = "DisplayAspectRatio" ;
2006-02-22 08:25:49 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_ASPECT_RATIO ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "DisplayColorDepth" , DisplayColorDepth , "16bit" , "32bit" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2009-04-04 20:34:57 +00:00
ADD ( ConfOption ( "HighResolutionTextures" , MovePref < HighResolutionTextures > , "Auto" , "Force Off" , "Force On" ) );
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "MaxTextureResolution" , MaxTextureResolution , "|256" , "|512" , "|1024" , "|2048" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "TextureColorDepth" , TextureColorDepth , "16bit" , "32bit" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "MovieColorDepth" , MovieColorDepth , "16bit" , "32bit" ) );
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "DelayedTextureDelete" , MovePref < bool > , "Off" , "On" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "CelShadeModels" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "SmoothLines" , MovePref < bool > , "Off" , "On" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "RefreshRate" , RefreshRate , "Default" , "|60" , "|70" , "|72" , "|75" , "|80" , "|85" , "|90" , "|100" , "|120" , "|150" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "Vsync" , MovePref < bool > , "No" , "Yes" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_GRAPHICS ;
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "ShowStats" , MovePref < bool > , "Off" , "On" ) );
ADD ( ConfOption ( "ShowBanners" , MovePref < bool > , "Off" , "On" ) );
2003-09-29 02:24:53 +00:00
2003-09-28 07:14:07 +00:00
/* Sound options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "AttractSoundFrequency" , MovePref < AttractSoundFrequency > , "Never" , "Always" , "2 Times" , "3 Times" , "4 Times" , "5 Times" ) );
2006-01-25 09:42:26 +00:00
ADD ( ConfOption ( "SoundVolume" , SoundVolume , "Silent" , "|10%" , "|20%" , "|30%" , "|40%" , "|50%" , "|60%" , "|70%" , "|80%" , "|90%" , "|100%" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions . back (). m_iEffects = OPT_APPLY_SOUND ;
2007-05-24 21:08:28 +00:00
ADD ( ConfOption ( "SoundVolumeAttract" , SoundVolumeAttract , "Silent" , "|10%" , "|20%" , "|30%" , "|40%" , "|50%" , "|60%" , "|70%" , "|80%" , "|90%" , "|100%" ) );
2005-10-15 04:13:11 +00:00
{
ConfOption c ( "GlobalOffsetSeconds" , GlobalOffsetSeconds );
for ( int i = - 100 ; i <= + 100 ; i += 5 )
c . AddOption ( ssprintf ( "%+i ms" , i ) );
ADD ( c );
}
2008-05-13 01:18:10 +00:00
ADD ( ConfOption ( "EnableAttackSounds" , MovePref < bool > , "No" , "Yes" ) );
ADD ( ConfOption ( "EnableMineHitSound" , MovePref < bool > , "No" , "Yes" ) );
2005-07-20 00:17:14 +00:00
/* Editor options */
2006-12-05 16:56:01 +00:00
ADD ( ConfOption ( "EditorShowBGChangesPlay" , MovePref < bool > , "Hide" , "Show" ) );
2006-07-05 02:39:47 +00:00
ADD ( ConfOption ( "Invalid" , MoveNop , "|Invalid option" ) );
2004-12-07 09:49:03 +00:00
}
2003-09-28 02:59:02 +00:00
2003-09-29 02:24:53 +00:00
/* Get a mask of effects to apply if the given option changes. */
int ConfOption :: GetEffects () const
{
2004-12-07 09:49:03 +00:00
return m_iEffects | OPT_SAVE_PREFERENCES ;
2003-09-29 02:24:53 +00:00
}
2006-01-22 01:00:06 +00:00
ConfOption * ConfOption :: Find ( RString name )
2003-09-28 02:59:02 +00:00
{
2004-12-07 09:49:03 +00:00
InitializeConfOptions ();
for ( unsigned i = 0 ; i < g_ConfOptions . size (); ++ i )
2003-09-28 02:59:02 +00:00
{
2004-12-07 02:47:21 +00:00
ConfOption * opt = & g_ConfOptions [ i ];
2006-01-22 01:00:06 +00:00
RString match ( opt -> name );
2003-09-28 07:14:07 +00:00
if ( match . CompareNoCase ( name ) )
2003-09-28 02:59:02 +00:00
continue ;
return opt ;
}
return NULL ;
}
2004-12-07 02:47:21 +00:00
void ConfOption :: UpdateAvailableOptions ()
{
if ( MakeOptionsListCB != NULL )
{
names . clear ();
MakeOptionsListCB ( names );
}
}
2006-01-22 01:00:06 +00:00
void ConfOption :: MakeOptionsList ( vector < RString > & out ) const
2003-09-28 05:15:27 +00:00
{
2004-12-07 02:47:21 +00:00
out = names ;
2003-09-28 05:15:27 +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.
*/