Files
itgmania212121/stepmania/src/ScreenOptionsMasterPrefs.cpp
T

687 lines
23 KiB
C++
Raw Normal View History

#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"
#include "InputMapper.h"
2003-10-02 01:41:09 +00:00
#include "StepMania.h"
2004-07-25 17:07:32 +00:00
#include "Game.h"
#include "Foreach.h"
#include "GameConstantsAndTypes.h"
2003-09-29 06:28:17 +00:00
static void GetDefaultModifiers( PlayerOptions &po, SongOptions &so )
{
po.FromString( PREFSMAN->m_sDefaultModifiers );
so.FromString( PREFSMAN->m_sDefaultModifiers );
}
static void SetDefaultModifiers( const PlayerOptions &po, const SongOptions &so )
{
CStringArray as;
if( po.GetString() != "" )
as.push_back( po.GetString() );
if( so.GetString() != "" )
as.push_back( so.GetString() );
2005-05-16 09:36:32 +00:00
PREFSMAN->m_sDefaultModifiers.Set( join(", ",as) );
2003-09-29 06:28:17 +00:00
}
2003-09-30 05:33:33 +00:00
template<class T>
2005-02-20 04:20:46 +00:00
int FindClosestEntry( T value, const T *mapping, unsigned cnt )
2003-09-30 05:33:33 +00:00
{
2005-02-20 04:20:46 +00:00
int iBestIndex = 0;
T best_dist = T();
bool have_best = false;
for( unsigned i = 0; i < cnt; ++i )
2003-09-30 05:33:33 +00:00
{
2005-02-20 04:20:46 +00:00
const T val = mapping[i];
T dist = value < val? (T)(val-value):(T)(value-val);
if( have_best && best_dist < dist )
continue;
2003-09-30 05:33:33 +00:00
2005-02-20 04:20:46 +00:00
have_best = true;
best_dist = dist;
2003-09-30 05:33:33 +00:00
2005-02-20 04:20:46 +00:00
iBestIndex = i;
}
2003-09-30 05:33:33 +00:00
2005-02-20 04:20:46 +00:00
if( have_best )
return iBestIndex;
else
return 0;
}
2005-05-06 20:41:05 +00:00
template <class T>
2005-02-20 04:20:46 +00:00
static void MoveMap( int &sel, T &opt, bool ToSel, const T *mapping, unsigned cnt )
{
if( ToSel )
{
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-05-06 20:41:05 +00:00
static void MoveMap( int &sel, Preference<T> &opt, bool ToSel, const T *mapping, unsigned cnt )
2005-02-20 04:20:46 +00:00
{
if( ToSel )
{
2005-05-06 20:41:05 +00:00
sel = FindClosestEntry( opt.Get(), mapping, cnt );
2005-02-20 04:20:46 +00:00
} else {
/* sel -> opt */
2005-05-06 20:41:05 +00:00
opt.Set( mapping[sel] );
2005-04-27 07:50:38 +00:00
}
}
2003-09-30 05:33:33 +00:00
static void MovePref( int &iSel, bool bToSel, const ConfOption *pConfOption )
{
IPreference *pPref = PREFSMAN->GetPreferenceByName( pConfOption->name );
ASSERT_M( pPref != NULL, pConfOption->name );
if( bToSel )
{
const CString sVal = pPref->ToString();
iSel = atoi( sVal );
}
else
{
const CString sVal = ToString(iSel);
pPref->FromString( sVal );
}
}
/* "sel" is the selection in the menu. */
2005-01-30 01:45:26 +00:00
static void MoveData( int &sel, int &opt, bool ToSel )
{
2005-01-30 01:45:26 +00:00
if( ToSel ) sel = opt;
else opt = !!sel;
}
2005-01-30 01:39:42 +00:00
template<class T>
static void MoveData( int &sel, Preference<T> &opt, bool ToSel )
2005-05-10 04:30:51 +00:00
{
if( ToSel ) sel = opt;
else opt.Set( sel );
}
template<>
static void MoveData( int &sel, Preference<bool> &opt, bool ToSel )
2005-01-30 01:39:42 +00:00
{
2005-05-06 20:41:05 +00:00
if( ToSel ) sel = opt;
else opt.Set( !!sel );
2005-01-30 01:39:42 +00:00
}
#define MOVE( name, opt ) \
static void name( int &sel, bool ToSel, const ConfOption *pConfOption ) \
{ \
MoveData( sel, opt, ToSel ); \
}
2003-09-28 07:14:07 +00:00
2003-09-29 03:22:51 +00:00
static void GameChoices( CStringArray &out )
{
2004-07-25 17:07:32 +00:00
vector<const Game*> aGames;
2003-09-29 03:22:51 +00:00
GAMEMAN->GetEnabledGames( aGames );
2004-07-25 17:07:32 +00:00
FOREACH( const Game*, aGames, g )
2003-09-29 03:22:51 +00:00
{
CString sGameName = (*g)->m_szName;
2003-09-29 03:22:51 +00:00
sGameName.MakeUpper();
out.push_back( sGameName );
}
}
static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 03:22:51 +00:00
{
CStringArray choices;
pConfOption->MakeOptionsList( choices );
2003-09-29 03:22:51 +00:00
if( ToSel )
{
const CString 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;
2003-09-29 03:22:51 +00:00
GAMEMAN->GetEnabledGames( aGames );
ChangeCurrentGame( aGames[sel] );
2003-09-29 03:22:51 +00:00
}
}
2003-09-28 07:14:07 +00:00
static void LanguageChoices( CStringArray &out )
{
THEME->GetLanguages( out );
}
static void Language( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-28 07:14:07 +00:00
{
CStringArray choices;
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], THEME->GetCurLanguage()) )
sel = i;
} else {
const CString sNewLanguage = choices[sel];
if( THEME->GetCurLanguage() != sNewLanguage )
THEME->SwitchThemeAndLanguage( THEME->GetCurThemeName(), sNewLanguage );
}
}
static void ThemeChoices( CStringArray &out )
{
THEME->GetThemeNames( out );
}
static void Theme( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-28 07:14:07 +00:00
{
CStringArray choices;
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], THEME->GetCurThemeName()) )
sel = i;
} else {
const CString sNewTheme = choices[sel];
if( THEME->GetCurThemeName() != sNewTheme )
THEME->SwitchThemeAndLanguage( sNewTheme, THEME->GetCurLanguage() );
}
}
static void AnnouncerChoices( CStringArray &out )
{
ANNOUNCER->GetAnnouncerNames( out );
out.insert( out.begin(), "OFF" );
}
static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-28 07:14:07 +00:00
{
CStringArray choices;
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;
} else {
2004-08-06 21:01:28 +00:00
const CString sNewAnnouncer = sel? choices[sel]:CString("");
2003-09-28 07:14:07 +00:00
ANNOUNCER->SwitchAnnouncer( sNewAnnouncer );
}
}
static void DefaultNoteSkinChoices( CStringArray &out )
{
NOTESKIN->GetNoteSkinNames( out );
for( unsigned i = 0; i < out.size(); ++i )
out[i].MakeUpper();
}
static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-28 07:14:07 +00:00
{
CStringArray choices;
pConfOption->MakeOptionsList( choices );
2003-09-28 07:14:07 +00:00
if( ToSel )
{
PlayerOptions po;
po.FromString( PREFSMAN->m_sDefaultModifiers );
sel = 0;
for( unsigned i=0; i < choices.size(); i++ )
if( !stricmp(choices[i], po.m_sNoteSkin) )
sel = i;
} else {
PlayerOptions po;
SongOptions so;
2003-09-29 06:28:17 +00:00
GetDefaultModifiers( po, so );
2003-09-28 07:14:07 +00:00
po.m_sNoteSkin = choices[sel];
2003-09-29 06:28:17 +00:00
SetDefaultModifiers( po, so );
2003-09-28 07:14:07 +00:00
}
}
2003-09-29 00:07:36 +00:00
/* Appearance options */
2004-12-07 09:22:38 +00:00
MOVE( Instructions, PREFSMAN->m_bShowInstructions );
MOVE( OniScoreDisplay, PREFSMAN->m_bDancePointsForOni );
MOVE( SongGroup, PREFSMAN->m_bShowSelectGroup );
static void WheelSections( int &sel, bool ToSel, const ConfOption *pConfOption )
{
// XXX: NEVER, ALWAYS, etc. seem kinda ambiguous...
const PrefsManager::MusicWheelUsesSections mapping[] = { PrefsManager::NEVER, PrefsManager::ALWAYS, PrefsManager::ABC_ONLY };
MoveMap( sel, PREFSMAN->m_MusicWheelUsesSections, ToSel, mapping, ARRAYSIZE(mapping) );
}
2005-05-16 09:36:32 +00:00
MOVE( CourseSort, (int &) PREFSMAN->m_CourseSortOrder );
2004-12-07 09:22:38 +00:00
MOVE( RandomAtEnd, PREFSMAN->m_bMoveRandomToEnd );
MOVE( Translations, PREFSMAN->m_bShowNativeLanguage );
MOVE( Lyrics, PREFSMAN->m_bShowLyrics );
2003-09-28 07:14:07 +00:00
2003-12-30 09:34:05 +00:00
/* Misc. options */
2004-12-07 09:22:38 +00:00
MOVE( AutogenSteps, PREFSMAN->m_bAutogenSteps );
MOVE( AutogenGroupCourses, PREFSMAN->m_bAutogenGroupCourses );
2003-09-29 00:07:36 +00:00
/* Background options */
2005-01-30 01:45:26 +00:00
MOVE( DancingCharacters, (int &) PREFSMAN->m_ShowDancingCharacters );
2004-12-07 09:22:38 +00:00
MOVE( BeginnerHelper, PREFSMAN->m_bShowBeginnerHelper );
2003-09-29 00:07:36 +00:00
static void BGBrightness( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 00:07:36 +00:00
{
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 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_fBGBrightness, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 00:07:36 +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 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iNumBackgrounds, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 00:07:36 +00:00
}
2003-09-29 00:46:25 +00:00
/* Input options */
2004-12-07 09:22:38 +00:00
MOVE( AutoMapOnJoyChange, PREFSMAN->m_bAutoMapOnJoyChange );
2005-05-18 07:15:56 +00:00
MOVE( AutoPlay, (int&)PREFSMAN->m_AutoPlay );
2004-12-07 09:22:38 +00:00
MOVE( BackDelayed, PREFSMAN->m_bDelayedBack );
MOVE( OptionsNavigation, PREFSMAN->m_bArcadeOptionsNavigation );
2003-09-29 00:46:25 +00:00
static void WheelSpeed( 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 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iMusicWheelSwitchSpeed, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 00:46:25 +00:00
}
/* Gameplay options */
2004-12-07 09:22:38 +00:00
MOVE( SoloSingles, PREFSMAN->m_bSoloSingle );
MOVE( EasterEggs, PREFSMAN->m_bEasterEggs );
MOVE( AllowExtraStage, PREFSMAN->m_bAllowExtraStage );
MOVE( PickExtraStage, PREFSMAN->m_bPickExtraStage );
MOVE( UnlockSystem, PREFSMAN->m_bUseUnlockSystem );
2003-09-29 00:46:25 +00:00
static void MarvelousTiming( int &sel, bool ToSel, const ConfOption *pConfOption )
{
2005-04-28 08:27:40 +00:00
const PrefsManager::MarvelousTiming mapping[] = { PrefsManager::MARVELOUS_NEVER, PrefsManager::MARVELOUS_COURSES_ONLY, PrefsManager::MARVELOUS_EVERYWHERE };
MoveMap( sel, PREFSMAN->m_MarvelousTiming, ToSel, mapping, ARRAYSIZE(mapping) );
}
static void CoinModeM( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const CoinMode mapping[] = { COIN_HOME, COIN_PAY, COIN_FREE };
MoveMap( sel, PREFSMAN->m_CoinMode, ToSel, mapping, ARRAYSIZE(mapping) );
}
2003-10-06 05:59:58 +00:00
static void CoinModeNoHome( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-11-26 00:32:21 +00:00
{
const CoinMode mapping[] = { COIN_PAY, COIN_FREE };
MoveMap( sel, PREFSMAN->m_CoinMode, ToSel, mapping, ARRAYSIZE(mapping) );
2003-11-26 00:32:21 +00:00
}
static void CoinsPerCredit( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-10-06 05:59:58 +00:00
{
const int mapping[] = { 1,2,3,4,5,6,7,8 };
2004-12-07 09:22:38 +00:00
MoveMap( sel, PREFSMAN->m_iCoinsPerCredit, ToSel, mapping, ARRAYSIZE(mapping) );
2003-10-06 05:59:58 +00:00
}
static void PremiumM( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-11-09 01:09:35 +00:00
{
const Premium mapping[] = { PREMIUM_NONE, PREMIUM_DOUBLES, PREMIUM_JOINT };
2003-11-09 01:09:35 +00:00
MoveMap( sel, PREFSMAN->m_Premium, ToSel, mapping, ARRAYSIZE(mapping) );
}
2003-10-06 05:59:58 +00:00
static void SongsPerPlay( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-10-06 05:59:58 +00:00
{
const int mapping[] = { 1,2,3,4,5 };
2005-04-28 08:27:40 +00:00
MoveMap( sel, PREFSMAN->m_iSongsPerPlay, ToSel, mapping, ARRAYSIZE(mapping) );
2003-10-06 05:59:58 +00:00
}
2005-04-28 08:27:40 +00:00
static void SongsPerPlayOrEventMode( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const int mapping[] = { 1,2,3,4,5,6 };
2005-04-28 08:27:40 +00:00
MoveMap( sel, PREFSMAN->m_iSongsPerPlay, ToSel, mapping, ARRAYSIZE(mapping) );
if( ToSel && PREFSMAN->m_bEventMode )
sel = 5;
if( !ToSel )
PREFSMAN->m_bEventMode.Set( sel == 5 );
}
2003-10-06 05:59:58 +00:00
2003-09-29 03:02:54 +00:00
/* Machine options */
2005-05-16 09:36:32 +00:00
MOVE( ScoringType, (int &) PREFSMAN->m_ScoringType );
2003-09-29 03:02:54 +00:00
static void JudgeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 03:02:54 +00:00
{
2003-09-29 04:46:37 +00:00
const float mapping[] = { 1.50f,1.33f,1.16f,1.00f,0.84f,0.66f,0.50f,0.33f,0.20f };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_fJudgeWindowScale, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 03:02:54 +00:00
}
void LifeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 03:02:54 +00:00
{
2003-09-29 04:46:37 +00:00
const float mapping[] = { 1.60f,1.40f,1.20f,1.00f,0.80f,0.60f,0.40f };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_fLifeDifficultyScale, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 03:02:54 +00:00
}
static void ShowSongOptions( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 03:02:54 +00:00
{
2003-09-30 05:23:12 +00:00
const PrefsManager::Maybe mapping[] = { PrefsManager::NO,PrefsManager::YES,PrefsManager::ASK };
2003-09-29 04:46:37 +00:00
MoveMap( sel, PREFSMAN->m_ShowSongOptions, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 03:02:54 +00:00
}
static void ShowNameEntry( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const PrefsManager::GetRankingName mapping[] = { PrefsManager::RANKING_OFF, PrefsManager::RANKING_ON, PrefsManager::RANKING_LIST };
2005-05-16 09:36:32 +00:00
MoveMap( sel, PREFSMAN->m_GetRankingName, ToSel, mapping, ARRAYSIZE(mapping) );
}
static void DefaultFailType( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 03:02:54 +00:00
{
if( ToSel )
{
SongOptions so;
so.FromString( PREFSMAN->m_sDefaultModifiers );
sel = so.m_FailType;
}
else
{
2003-09-29 03:02:54 +00:00
PlayerOptions po;
SongOptions so;
2003-09-29 06:28:17 +00:00
GetDefaultModifiers( po, so );
2003-09-29 03:02:54 +00:00
switch( sel )
{
2004-07-31 19:14:53 +00:00
case 0: so.m_FailType = SongOptions::FAIL_IMMEDIATE; break;
case 1: so.m_FailType = SongOptions::FAIL_END_OF_SONG; break;
case 2: so.m_FailType = SongOptions::FAIL_OFF; break;
2003-09-29 03:02:54 +00:00
default:
ASSERT(0);
}
2003-09-29 06:28:17 +00:00
SetDefaultModifiers( po, so );
2003-09-29 03:02:54 +00:00
}
}
MOVE( ProgressiveLifebar, PREFSMAN->m_iProgressiveLifebar );
2003-09-29 03:02:54 +00:00
MOVE( ProgressiveStageLifebar, PREFSMAN->m_iProgressiveStageLifebar );
MOVE( ProgressiveNonstopLifebar, PREFSMAN->m_iProgressiveNonstopLifebar );
/* Graphic options */
2004-12-07 09:22:38 +00:00
MOVE( CelShadeModels, PREFSMAN->m_bCelShadeModels );
MOVE( SmoothLines, PREFSMAN->m_bSmoothLines );
2003-09-29 03:02:54 +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;
}
};
static void DisplayResolution( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 02:24:53 +00:00
{
const res_t mapping[] =
{
res_t(320, 240),
res_t(400, 300),
res_t(512, 384),
res_t(640, 480),
res_t(800, 600),
res_t(1024, 768),
res_t(1280, 960),
res_t(1280, 1024)
};
res_t sel_res( PREFSMAN->m_iDisplayWidth, PREFSMAN->m_iDisplayHeight );
MoveMap( sel, sel_res, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 02:24:53 +00:00
if( !ToSel )
{
2005-05-06 20:41:05 +00:00
PREFSMAN->m_iDisplayWidth.Set( sel_res.w );
PREFSMAN->m_iDisplayHeight.Set( sel_res.h );
}
2003-09-29 02:24:53 +00:00
}
static void DisplayColor( 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 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iDisplayColorDepth, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 02:24:53 +00:00
}
static void TextureResolution( 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 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iMaxTextureResolution, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 02:24:53 +00:00
}
static void TextureColor( 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 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iTextureColorDepth, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 02:24:53 +00:00
}
static void MovieColor( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 02:24:53 +00:00
{
2003-10-07 08:18:28 +00:00
const int mapping[] = { 16,32 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iMovieColorDepth, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 02:24:53 +00:00
}
static void RefreshRate( int &sel, bool ToSel, const ConfOption *pConfOption )
2003-09-29 02:24:53 +00:00
{
2003-10-07 08:18:28 +00:00
const int mapping[] = { (int) REFRESH_DEFAULT,60,70,72,75,80,85,90,100,120,150 };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_iRefreshRate, ToSel, mapping, ARRAYSIZE(mapping) );
2003-09-29 02:24:53 +00:00
}
2004-12-23 06:50:19 +00:00
static void AspectRatio( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const float mapping[] = { 3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
2005-05-06 20:41:05 +00:00
MoveMap( sel, PREFSMAN->m_fDisplayAspectRatio, ToSel, mapping, ARRAYSIZE(mapping) );
2004-12-23 06:50:19 +00:00
}
2003-09-29 00:07:36 +00:00
/* Sound options */
2005-05-16 09:36:32 +00:00
MOVE( ResamplingQuality, (int&)PREFSMAN->m_SoundResampleQuality );
2003-12-28 19:46:50 +00:00
MOVE( AttractSoundFrequency,PREFSMAN->m_iAttractSoundFrequency );
2003-09-28 07:14:07 +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 };
2004-12-07 09:22:38 +00:00
MoveMap( sel, PREFSMAN->m_fSoundVolume, ToSel, mapping, ARRAYSIZE(mapping) );
2003-10-12 20:34:46 +00:00
}
2004-12-07 09:49:03 +00:00
static vector<ConfOption> g_ConfOptions;
static void InitializeConfOptions()
{
2004-12-07 09:49:03 +00:00
if( !g_ConfOptions.empty() )
return;
#define ADD(x) g_ConfOptions.push_back( x )
2003-09-29 03:22:51 +00:00
/* Select game */
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 */
ADD( ConfOption( "Language", Language, LanguageChoices ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_THEME;
ADD( ConfOption( "Theme", Theme, ThemeChoices ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_THEME;
ADD( ConfOption( "Announcer", Announcer, AnnouncerChoices ) );
ADD( ConfOption( "DefaultNoteSkin", DefaultNoteSkin, DefaultNoteSkinChoices ) );
ADD( ConfOption( "Instructions", Instructions, "SKIP","SHOW") );
ADD( ConfOption( "ShowCaution", MovePref, "SKIP","SHOW") );
ADD( ConfOption( "OniScoreDisplay", OniScoreDisplay, "PERCENT","DANCE POINTS") );
ADD( ConfOption( "SongGroup", SongGroup, "ALL MUSIC","CHOOSE") );
ADD( ConfOption( "WheelSections", WheelSections, "NEVER","ALWAYS", "ABC ONLY") );
ADD( ConfOption( "CourseSort", CourseSort, "# SONGS","AVG FEET","TOTAL FEET","RANKING") );
ADD( ConfOption( "RandomAtEnd", RandomAtEnd, "NO","YES") );
ADD( ConfOption( "Translations", Translations, "ROMANIZATION","NATIVE LANGUAGE") );
ADD( ConfOption( "Lyrics", Lyrics, "HIDE","SHOW") );
2003-09-28 07:14:07 +00:00
2003-12-30 09:34:05 +00:00
/* Misc options */
ADD( ConfOption( "AutogenSteps", AutogenSteps, "OFF","ON" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_SONG;
ADD( ConfOption( "AutogenGroupCourses", AutogenGroupCourses, "OFF","ON" ) );
ADD( ConfOption( "FastLoad", MovePref, "OFF","ON" ) );
2003-09-29 00:07:36 +00:00
/* Background options */
ADD( ConfOption( "BackgroundMode", MovePref, "OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES" ) );
ADD( ConfOption( "Brightness", BGBrightness, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%" ) );
ADD( ConfOption( "ShowDanger", MovePref, "HIDE","SHOW" ) );
ADD( ConfOption( "DancingCharacters", DancingCharacters, "DEFAULT TO OFF","DEFAULT TO RANDOM","SELECT" ) );
ADD( ConfOption( "BeginnerHelper", BeginnerHelper, "OFF","ON" ) );
ADD( ConfOption( "RandomBackgrounds", NumBackgrounds, "5","10","15","20" ) );
2003-09-29 00:07:36 +00:00
2003-09-29 00:46:25 +00:00
/* Input options */
ADD( ConfOption( "AutoMapOnJoyChange", AutoMapOnJoyChange, "OFF","ON (recommended)" ) );
ADD( ConfOption( "OnlyDedicatedMenuButtons", MovePref, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ) );
2005-05-18 07:15:56 +00:00
ADD( ConfOption( "AutoPlay", AutoPlay, "OFF","ON","CPU-Controlled" ) );
ADD( ConfOption( "BackDelayed", BackDelayed, "INSTANT","HOLD" ) );
ADD( ConfOption( "OptionsNavigation", OptionsNavigation, "SM STYLE","ARCADE STYLE" ) );
ADD( ConfOption( "WheelSpeed", WheelSpeed, "SLOW","NORMAL","FAST","REALLY FAST" ) );
2003-09-29 00:46:25 +00:00
/* Gameplay options */
ADD( ConfOption( "SoloSingles", SoloSingles, "OFF","ON" ) );
ADD( ConfOption( "HiddenSongs", MovePref, "OFF","ON" ) );
ADD( ConfOption( "EasterEggs", EasterEggs, "OFF","ON" ) );
ADD( ConfOption( "MarvelousTiming", MarvelousTiming, "NEVER","COURSES ONLY","ALWAYS" ) );
ADD( ConfOption( "AllowExtraStage", AllowExtraStage, "OFF","ON" ) );
ADD( ConfOption( "PickExtraStage", PickExtraStage, "OFF","ON" ) );
ADD( ConfOption( "UnlockSystem", UnlockSystem, "OFF","ON" ) );
2003-09-29 00:46:25 +00:00
2003-09-29 03:02:54 +00:00
/* Machine options */
ADD( ConfOption( "MenuTimer", MovePref, "OFF","ON" ) );
ADD( ConfOption( "CoinMode", CoinModeM, "HOME","PAY","FREE PLAY" ) );
ADD( ConfOption( "CoinModeNoHome", CoinModeNoHome, "PAY","FREE PLAY" ) );
ADD( ConfOption( "SongsPerPlay", SongsPerPlay, "1","2","3","4","5" ) );
ADD( ConfOption( "SongsPerPlayOrEvent", SongsPerPlayOrEventMode, "1","2","3","4","5","EVENT" ) );
ADD( ConfOption( "EventMode", MovePref, "OFF","ON" ) );
ADD( ConfOption( "ScoringType", ScoringType, "MAX2","5TH" ) );
ADD( ConfOption( "JudgeDifficulty", JudgeDifficulty, "1","2","3","4","5","6","7","8","JUSTICE" ) );
ADD( ConfOption( "LifeDifficulty", LifeDifficulty, "1","2","3","4","5","6","7" ) );
ADD( ConfOption( "ProgressiveLifebar", ProgressiveLifebar, "OFF","1","2","3","4","5","6","7","8") );
ADD( ConfOption( "ProgressiveStageLifebar", ProgressiveStageLifebar, "OFF","1","2","3","4","5","6","7","8","INSANITY") );
ADD( ConfOption( "ProgressiveNonstopLifebar", ProgressiveNonstopLifebar,"OFF","1","2","3","4","5","6","7","8","INSANITY") );
ADD( ConfOption( "DefaultFailType", DefaultFailType, "IMMEDIATE","COMBO OF 30 MISSES","END OF SONG","OFF" ) );
ADD( ConfOption( "DefaultFailTypeNoOff", DefaultFailType, "IMMEDIATE","COMBO OF 30 MISSES","END OF SONG" ) );
ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8" ) );
ADD( ConfOption( "Premium", PremiumM, "OFF","DOUBLE FOR 1 CREDIT","JOINT PREMIUM" ) );
ADD( ConfOption( "ShowSongOptions", ShowSongOptions, "HIDE","SHOW","ASK" ) );
ADD( ConfOption( "ShowNameEntry", ShowNameEntry, "OFF", "ON", "RANKING SONGS" ) );
2003-09-29 03:02:54 +00:00
2003-09-29 02:24:53 +00:00
/* Graphic options */
ADD( ConfOption( "Windowed", MovePref, "FULLSCREEN", "WINDOWED" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "DisplayResolution", DisplayResolution, "320","400","512","640","800","1024","1280x960","1280x1024" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "DisplayColor", DisplayColor, "16BIT","32BIT" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "TextureResolution", TextureResolution, "256","512","1024","2048" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "TextureColor", TextureColor, "16BIT","32BIT" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "MovieColor", MovieColor, "16BIT","32BIT" ) );
ADD( ConfOption( "DelayedTextureDelete", MovePref, "OFF","ON" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "CelShadeModels", CelShadeModels, "OFF","ON" ) );
ADD( ConfOption( "SmoothLines", SmoothLines, "OFF","ON" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
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;
ADD( ConfOption( "AspectRatio", AspectRatio, "3:4","1:1","4:3","16:10","16:9","8:3" ) );
2004-12-23 06:50:19 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_ASPECT_RATIO;
ADD( ConfOption( "Vsync", MovePref, "NO", "YES" ) );
2004-12-07 09:49:03 +00:00
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD( ConfOption( "ShowStats", MovePref, "OFF","ON" ) );
ADD( ConfOption( "ShowBanners", MovePref, "OFF","ON" ) );
2003-09-29 02:24:53 +00:00
2003-09-28 07:14:07 +00:00
/* Sound options */
ADD( ConfOption( "ResamplingQuality", ResamplingQuality, "FAST","NORMAL","HIGH QUALITY" ) );
ADD( ConfOption( "AttractSoundFrequency", AttractSoundFrequency, "NEVER","ALWAYS","2 TIMES","3 TIMES","4 TIMES","5 TIMES" ) );
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;
}
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
}
ConfOption *ConfOption::Find( CString name )
{
2004-12-07 09:49:03 +00:00
InitializeConfOptions();
for( unsigned i = 0; i < g_ConfOptions.size(); ++i )
{
ConfOption *opt = &g_ConfOptions[i];
CString match(opt->name);
2003-09-28 07:14:07 +00:00
if( match.CompareNoCase(name) )
continue;
return opt;
}
return NULL;
}
void ConfOption::UpdateAvailableOptions()
2003-09-28 05:15:27 +00:00
{
if( MakeOptionsListCB != NULL )
2003-09-28 05:15:27 +00:00
{
names.clear();
MakeOptionsListCB( names );
2003-09-28 05:15:27 +00:00
}
}
2003-09-28 05:15:27 +00:00
void ConfOption::MakeOptionsList( CStringArray &out ) const
{
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.
*/