From 82a2f6d48ebff0b304578b2a433f93152f3e2e4c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 29 Sep 2003 03:02:54 +0000 Subject: [PATCH] Machine options --- stepmania/Themes/default/metrics.ini | 21 +++- stepmania/src/ScreenOptionsMasterPrefs.cpp | 117 ++++++++++++++++++--- 2 files changed, 123 insertions(+), 15 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 8e340ff3dd..5980707ac7 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1996,9 +1996,26 @@ DefaultFailType=Choose the conditions for game over.::ARCADE will stop the music CoinMode=When set to HOME, options will be shown on the title screen.::When set to PAY the title menu choices are hidden and you must::insert coins before joining in. When set to FREE the title menu::choices are hidden and you can joining in without inserting coins. CoinsPerCredit=The number of coins that must be inserted before a player can join. JointPremium=When set to OFF, game styles that require both sides of the machine::will cost 2 credits. When set to ON game styles that require both sides::of the machine will cost only 1 credit. -SongOptions=Select the availability of the Song Options screen.::When HIDE, it can not be accessed. When SHOW, it will always be shown.::When set to ASK, it can be accessed by pressing START a::second time after the Player Options screen. +ShowSongOptions=Select the availability of the Song Options screen.::When HIDE, it can not be accessed. When SHOW, it will always be shown.::When set to ASK, it can be accessed by pressing START a::second time after the Player Options screen. StyleIcon=0 TimerSeconds=0 +PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster +NextScreen=ScreenOptionsMenu@ScreenOptionsMaster + +OptionMenuFlags=rows,13;together;explanations +Line1=conf,MenuTimer +Line2=conf,CoinMode +Line3=conf,SongsPerPlay +Line4=conf,ScoringType +Line5=conf,JudgeDifficulty +Line6=conf,LifeDifficulty +Line7=conf,ProgressiveLifebar +Line8=conf,ProgressiveStageLifebar +Line9=conf,ProgressiveNonstopLifebar +Line10=conf,DefaultFailType +Line11=conf,CoinsPerCredit +Line12=conf,JointPremium +Line13=conf,ShowSongOptions [ScreenGraphicOptions] HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options::START to accept changes BACK to discard changes @@ -2857,7 +2874,7 @@ Graphic Options,1=screen,ScreenGraphicOptions@ScreenOptionsMaster Graphic OptionsName,1=Graphic Options Machine Options=1,together Machine OptionsDefault= -Machine Options,1=screen,ScreenMachineOptions +Machine Options,1=screen,ScreenMachineOptions@ScreenOptionsMaster Machine OptionsName,1=Machine Options Sound Options=1,together Sound OptionsDefault= diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index 91be851351..8ed5c59bae 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -199,29 +199,27 @@ MOVE( MarvelousTiming, PREFSMAN->m_iMarvelousTiming ); MOVE( PickExtraStage, PREFSMAN->m_bPickExtraStage ); MOVE( UnlockSystem, PREFSMAN->m_bUseUnlockSystem ); -/* Graphic options */ -MOVE( DisplayMode, PREFSMAN->m_bWindowed ); -MOVE( WaitForVsync, PREFSMAN->m_bVsync ); -MOVE( ShowStats, PREFSMAN->m_bShowStats ); -MOVE( KeepTexturesInMemory, PREFSMAN->m_bDelayedTextureDelete ); - +/* Machine options */ +MOVE( MenuTimer, PREFSMAN->m_bMenuTimer ); +MOVE( CoinMode, PREFSMAN->m_iCoinMode ); +MOVE( ScoringType, PREFSMAN->m_iScoringType ); template static void MoveMap( int &sel, T &opt, bool ToSel, const T *map, unsigned cnt ) { if( ToSel ) { /* opt -> sel. Find the closest entry in map. */ - T best_dist = -1; - + T best_dist = (T) 0; + bool have_best = false; + for( unsigned i = 0; i < cnt; ++i ) { const T val = map[i]; - T dist = opt-val; - if( dist < 0 ) - dist = -dist; - if( best_dist != -1 && dist > best_dist ) + T dist = opt < val? (T)(opt-val): (T)(val-opt); + if( have_best && dist > best_dist ) continue; - + + have_best = true; best_dist = dist; sel = i; @@ -232,6 +230,84 @@ static void MoveMap( int &sel, T &opt, bool ToSel, const T *map, unsigned cnt ) } } + +static void JudgeDifficulty( int &sel, bool ToSel, const CStringArray &choices ) +{ + const float map[] = { 1.50f,1.33f,1.16f,1.00f,0.84f,0.66f,0.50f,0.33f,0.20f }; + MoveMap( sel, PREFSMAN->m_fJudgeWindowScale, ToSel, map, ARRAYSIZE(map) ); +} + +static void LifeDifficulty( int &sel, bool ToSel, const CStringArray &choices ) +{ + const float map[] = { 1.60f,1.40f,1.20f,1.00f,0.80f,0.60f,0.40f }; + MoveMap( sel, PREFSMAN->m_fLifeDifficultyScale, ToSel, map, ARRAYSIZE(map) ); +} + +static void ShowSongOptions( int &sel, bool ToSel, const CStringArray &choices ) +{ + const PrefsManager::Maybe map[] = { PrefsManager::YES,PrefsManager::NO,PrefsManager::ASK }; + MoveMap( sel, PREFSMAN->m_ShowSongOptions, ToSel, map, ARRAYSIZE(map) ); +} + +static void CoinsPerCredit( int &sel, bool ToSel, const CStringArray &choices ) +{ + const int map[] = { 1,2,3,4,5,6,7,8 }; + MoveMap( sel, PREFSMAN->m_iCoinsPerCredit, ToSel, map, ARRAYSIZE(map) ); +} + +static void DefaultFailType( int &sel, bool ToSel, const CStringArray &choices ) +{ + if( ToSel ) + { + SongOptions so; + so.FromString( PREFSMAN->m_sDefaultModifiers ); + sel = so.m_FailType; + } else { + CString sModifiers = PREFSMAN->m_sDefaultModifiers; + PlayerOptions po; + po.FromString( sModifiers ); + SongOptions so; + so.FromString( sModifiers ); + switch( sel ) + { + case 0: so.m_FailType = SongOptions::FAIL_ARCADE; break; + case 1: so.m_FailType = SongOptions::FAIL_END_OF_SONG; break; + case 2: so.m_FailType = SongOptions::FAIL_OFF; break; + default: + ASSERT(0); + } + CStringArray as; + if( po.GetString() != "" ) + as.push_back( po.GetString() ); + if( so.GetString() != "" ) + as.push_back( so.GetString() ); + } +} + +MOVE( ProgressiveLifebar, PREFSMAN->m_iProgressiveLifebar ); +MOVE( ProgressiveStageLifebar, PREFSMAN->m_iProgressiveStageLifebar ); +MOVE( ProgressiveNonstopLifebar, PREFSMAN->m_iProgressiveNonstopLifebar ); + +MOVE( JointPremium, PREFSMAN->m_bJointPremium ); + + +static void SongsPerPlay( int &sel, bool ToSel, const CStringArray &choices ) +{ + const int map[] = { 1,2,3,4,5,6,7,8 }; + MoveMap( sel, PREFSMAN->m_iNumArcadeStages, ToSel, map, ARRAYSIZE(map) ); + + if( ToSel && PREFSMAN->m_bEventMode ) + sel = 7; + if( !ToSel ) + PREFSMAN->m_bEventMode = (sel == 7); +} + +/* Graphic options */ +MOVE( DisplayMode, PREFSMAN->m_bWindowed ); +MOVE( WaitForVsync, PREFSMAN->m_bVsync ); +MOVE( ShowStats, PREFSMAN->m_bShowStats ); +MOVE( KeepTexturesInMemory, PREFSMAN->m_bDelayedTextureDelete ); + static void DisplayResolution( int &sel, bool ToSel, const CStringArray &choices ) { const int map[] = { 320,400,512,640,800,1024,1280 }; @@ -321,6 +397,21 @@ static const ConfOption g_ConfOptions[] = ConfOption( "Pick Extra\nStage", PickExtraStage, "OFF","ON" ), ConfOption( "Unlock\nSystem", UnlockSystem, "OFF","ON" ), + /* Machine options */ + ConfOption( "Menu\nTimer", MenuTimer, "OFF","ON" ), + ConfOption( "Coin\nMode", CoinMode, "HOME","PAY","FREE PLAY" ), + ConfOption( "Songs Per\nPlay", SongsPerPlay, "1","2","3","4","5","6","7","EVENT MODE" ), + ConfOption( "Scoring\nType", ScoringType, "MAX2","5TH" ), + ConfOption( "Judge\nDifficulty", JudgeDifficulty, "1","2","3","4","5","6","7","8","JUSTICE" ), + ConfOption( "Life\nDifficulty", LifeDifficulty, "1","2","3","4","5","6","7" ), + ConfOption( "Progressive\nLifebar", ProgressiveLifebar, "OFF","1","2","3","4","5","6","7","8"), + ConfOption( "Progressive\nStage Lifebar",ProgressiveStageLifebar, "OFF","1","2","3","4","5","6","7","8","INSANITY"), + ConfOption( "Progressive\nNonstop Lifebar",ProgressiveNonstopLifebar,"OFF","1","2","3","4","5","6","7","8","INSANITY"), + ConfOption( "Default\nFail Type", DefaultFailType, "ARCADE","END OF SONG","OFF" ), + ConfOption( "Coins Per\nCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8" ), + ConfOption( "Joint\nPremium", JointPremium, "OFF","ON" ), + ConfOption( "Show Song\nOptions", ShowSongOptions, "HIDE","SHOW","ASK" ), + /* Graphic options */ ConfOption( "Display\nMode", DisplayMode, "FULLSCREEN", "WINDOWED" ), ConfOption( "Display\nResolution", DisplayResolution, "320","400","512","640","800","1024","1280" ),