From f62938787af0719873ae38f21992bbdb4fc8e577 Mon Sep 17 00:00:00 2001 From: Lamar Cooley <30600688+CrashCringle12@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:00:38 -0400 Subject: [PATCH] Add new Preference, Maximum Number of Credits Grant users the ability to change the maximum amount of credits available rather than the constant cap at 20. (cherry picked from commit 2ec2355d7a7d9fec9410cf6b7d2b5c31a4406074) (cherry picked from commit 48245ab51600ede16096e70e27c94345918eaed7) --- Themes/_fallback/Languages/de.ini | 2 ++ Themes/_fallback/Languages/en.ini | 2 ++ Themes/_fallback/Languages/es.ini | 2 ++ Themes/_fallback/Languages/fr.ini | 2 ++ Themes/_fallback/metrics.ini | 23 ++++++++++++----------- src/Bookkeeper.cpp | 2 +- src/PrefsManager.cpp | 1 + src/PrefsManager.h | 1 + src/ScreenOptionsMasterPrefs.cpp | 8 ++++++++ src/ScreenSystemLayer.cpp | 2 +- src/StepMania.cpp | 4 ++-- 11 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Themes/_fallback/Languages/de.ini b/Themes/_fallback/Languages/de.ini index de7338a7bb..078c9b29da 100644 --- a/Themes/_fallback/Languages/de.ini +++ b/Themes/_fallback/Languages/de.ini @@ -369,6 +369,7 @@ Clear Machine Stats=Clear all scores saved to this machine. CoinMode=&oq;Home&cq;: Options are shown on the Title Menu. &oq;Pay&cq;: Title Menu choices are hidden; must insert coins before playing. &oq;Free Play&cq;: Title Menu choices are hidden; Play without inserting coins. CoinModeNoHome=When set to PAY you must insert coins before joining in. When set to FREE you can join in without inserting coins. CoinsPerCredit=The number of coins that must be inserted before a player can join. (when Coin Mode = Pay) +MaxNumCredits=The maximum number of credits for coin mode. ComboContinuesBetweenSongs=If turned on, the combo will not be reset to 0 after every song. CourseSortOrder=Determines how courses are sorted. CreateNew= @@ -981,6 +982,7 @@ Clear clipboard=Zwischenablage löschen CoinMode=Münzen Modus CoinModeNoHome=Münzen Modus CoinsPerCredit=Münzen pro Credit +MaxNumCredits=Max Credits ComboContinuesBetweenSongs=Carry Combo Combo segments=Combo-Segmente Convert pause to beats=Convert stop to beats diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 76fb9fcad1..c08409154b 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -370,6 +370,7 @@ Clear Machine Stats=Clear all scores saved to this machine. CoinMode=&oq;Home&cq;: Options are shown on the Title Menu. &oq;Pay&cq;: Title Menu choices are hidden; must insert coins before playing. &oq;Free Play&cq;: Title Menu choices are hidden; Play without inserting coins. CoinModeNoHome=When set to PAY you must insert coins before joining in. When set to FREE you can join in without inserting coins. CoinsPerCredit=The number of coins that must be inserted before a player can join. (when Coin Mode = Pay) +MaxNumCredits=The maximum number of credits for coin mode. ComboContinuesBetweenSongs=If turned on, the combo will not be reset to 0 after every song. CourseSortOrder=Determines how courses are sorted. CustomSongsEnable=Custom songs are loaded from USB profiles. @@ -1004,6 +1005,7 @@ Clear timing in region=Clear timing in region CoinMode=Coin Mode CoinModeNoHome=Coin Mode CoinsPerCredit=Coins Per Credit +MaxNumCredits=Max Credits ComboContinuesBetweenSongs=Carry Combo Combo segments=Combo segments Convert pause to beats=Convert stop to beats diff --git a/Themes/_fallback/Languages/es.ini b/Themes/_fallback/Languages/es.ini index 4a1e036cca..943b7bda6e 100644 --- a/Themes/_fallback/Languages/es.ini +++ b/Themes/_fallback/Languages/es.ini @@ -362,6 +362,7 @@ Clear Machine Edits=Guardar todas las ediciones de pasos a esta máquina. Clear USB edits=Descartar ediciones en USB. Clear Machine Stats=Descartar todas las puntuaciones guardadas en esta máquina. CoinsPerCredit=Número de monedas que se deben insertar para que un jugador pueda unirse (cuando está activado el modo Pagar). +MaxNumCredits=The maximum number of credits for coin mode. CourseSortOrder=Determina cuántos cursos se organizan. CreateNew= Create New Course=Crear un curso nuevo. @@ -962,6 +963,7 @@ Clear clipboard=Descartar portapapeles CoinMode=Modo monedas CoinModeNoHome=Modo monedas CoinsPerCredit=Mon. por crédito +MaxNumCredits=Max Credits Convert pause to beats=Convertir parada en compases Convert delay to beats=Convertir latencia en compases Convert selection to attack=Convertir selección en ataque diff --git a/Themes/_fallback/Languages/fr.ini b/Themes/_fallback/Languages/fr.ini index b6a6178c6e..892a752a72 100644 --- a/Themes/_fallback/Languages/fr.ini +++ b/Themes/_fallback/Languages/fr.ini @@ -367,6 +367,7 @@ Clear Machine Stats=Clear all scores saved to this machine. CoinMode=&oq;Home&cq;: Options are shown on the Title Menu. &oq;Pay&cq;: Title Menu choices are hidden; must insert coins before playing. &oq;Free Play&cq;: Title Menu choices are hidden; Play without inserting coins. CoinModeNoHome=When set to PAY you must insert coins before joining in. When set to FREE you can join in without inserting coins. CoinsPerCredit=The number of coins that must be inserted before a player can join. (when Coin Mode = Pay) +MaxNumCredits=The maximum number of credits for coin mode. ComboContinuesBetweenSongs=If turned on, the combo will not be reset to 0 after every song. CourseSortOrder=Détermine comment les parcours sont triés. CreateNew= @@ -937,6 +938,7 @@ GetRankingName=Afficher les Noms CoinMode=Mode  Jeton SongsPerPlay=Chansons Par Partie CoinsPerCredit=Jetons Par Crédit +MaxNumCredits=Max Credits Premium=Premium EventMode=Mode Évènement AllowMultipleHighScoreWithSameName=Mode Compétition diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 3a8358aabe..7bac0aa31a 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -3183,23 +3183,24 @@ Fallback="ScreenOptionsServiceChild" NextScreen="ScreenOptionsService" PrevScreen="ScreenOptionsService" # stuff tied to arcade features -LineNames="1,2,3,4,5,6,7,8,AMT,9,HHLP,10,11,12,13,14" +LineNames="1,2,3,4,5,6,7,8,9,AMT,10,HHLP,11,12,13,14,15" Line1="conf,GetRankingName" Line2="conf,CoinMode" Line3="conf,SongsPerPlay" Line4="conf,CoinsPerCredit" -Line5="conf,Premium" -Line6="conf,EventMode" -Line7="conf,AllowMultipleHighScoreWithSameName" -Line8="conf,ComboContinuesBetweenSongs" +Line5="conf,MaxNumCredits" +Line6="conf,Premium" +Line7="conf,EventMode" +Line8="conf,AllowMultipleHighScoreWithSameName" +Line9="conf,ComboContinuesBetweenSongs" LineAMT="conf,AllowMultipleToasties" -Line9="conf,Disqualification" +Line10="conf,Disqualification" LineHHLP="conf,HarshHotLifePenalty" -Line10="conf,FailOffForFirstStageEasy" -Line11="conf,FailOffInBeginner" -Line12="conf,LockCourseDifficulties" -Line13="conf,MaxHighScoresPerListForMachine" -Line14="conf,MaxHighScoresPerListForPlayer" +Line11="conf,FailOffForFirstStageEasy" +Line12="conf,FailOffInBeginner" +Line13="conf,LockCourseDifficulties" +Line14="conf,MaxHighScoresPerListForMachine" +Line15="conf,MaxHighScoresPerListForPlayer" [ScreenOptionsTheme] Fallback="ScreenOptionsServiceChild" diff --git a/src/Bookkeeper.cpp b/src/Bookkeeper.cpp index f421db7df7..279d383129 100644 --- a/src/Bookkeeper.cpp +++ b/src/Bookkeeper.cpp @@ -127,7 +127,7 @@ void Bookkeeper::ReadFromDisk() if ( numCoins < 0 ) numCoins = 0; - else if ( numCoins / PREFSMAN->m_iCoinsPerCredit > MAX_NUM_CREDITS ) + else if ( numCoins / PREFSMAN->m_iCoinsPerCredit > PREFSMAN->m_iMaxNumCredits ) numCoins = 0; LOG->Trace("Number of Coins to Load on boot: %i", numCoins); diff --git a/src/PrefsManager.cpp b/src/PrefsManager.cpp index dd176edad1..136148a069 100644 --- a/src/PrefsManager.cpp +++ b/src/PrefsManager.cpp @@ -208,6 +208,7 @@ PrefsManager::PrefsManager() : m_AllowW1 ( "AllowW1", ALLOW_W1_EVERYWHERE ), m_bEventMode ( "EventMode", true ), m_iCoinsPerCredit ( "CoinsPerCredit", 1 ), + m_iMaxNumCredits ( "MaxNumCredits", 20 ), m_iSongsPerPlay ( "SongsPerPlay", 3, ValidateSongsPerPlay ), m_bDelayedCreditsReconcile ( "DelayedCreditsReconcile", false ), m_bComboContinuesBetweenSongs ( "ComboContinuesBetweenSongs", false ), diff --git a/src/PrefsManager.h b/src/PrefsManager.h index b8f212cc48..e993e1ff20 100644 --- a/src/PrefsManager.h +++ b/src/PrefsManager.h @@ -209,6 +209,7 @@ public: Preference m_AllowW1; // this should almost always be on, given use cases. -aj Preference m_bEventMode; Preference m_iCoinsPerCredit; + Preference m_iMaxNumCredits; Preference m_iSongsPerPlay; Preference m_bDelayedCreditsReconcile; // zuh? Preference m_bComboContinuesBetweenSongs; diff --git a/src/ScreenOptionsMasterPrefs.cpp b/src/ScreenOptionsMasterPrefs.cpp index f7118ecd32..6efe407cc5 100644 --- a/src/ScreenOptionsMasterPrefs.cpp +++ b/src/ScreenOptionsMasterPrefs.cpp @@ -456,6 +456,12 @@ static void CoinsPerCredit( int &sel, bool ToSel, const ConfOption *pConfOption } } +static void MaxNumCredits( int &sel, bool ToSel, const ConfOption *pConfOption ) +{ + int const mapping[]= {20, 40, 60, 80, 100}; + MoveMap(sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping)); +} + static void JointPremium( int &sel, bool ToSel, const ConfOption *pConfOption ) { const Premium mapping[] = { Premium_DoubleFor1Credit, Premium_2PlayersFor1Credit }; @@ -847,6 +853,7 @@ static void InitializeConfOptions() ADD( ConfOption( "CoinModeNoHome", CoinModeNoHome, "Pay","Free Play" ) ); g_ConfOptions.back().m_sPrefName = "CoinMode"; ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "|1","|2","|3","|4","|5","|6","|7","|8","|9","|10","|11","|12","|13","|14","|15","|16" ) ); + ADD( ConfOption( "MaxNumCredits", MaxNumCredits, "|20","|40","|60","|80","|100" ) ); ADD( ConfOption( "SongsPerPlay", SongsPerPlay, "|1","|2","|3","|4","|5" ) ); ADD( ConfOption( "SongsPerPlayOrEvent", SongsPerPlayOrEventMode,"|1","|2","|3","|4","|5","Event" ) ); @@ -861,6 +868,7 @@ static void InitializeConfOptions() ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref, "Off","|1","|2","|3","|4","|5","|6","|7","|8","Insanity") ); ADD( ConfOption( "DefaultFailType", DefaultFailType, DefaultFailChoices ) ); ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "|1","|2","|3","|4","|5","|6","|7","|8","|9","|10","|11","|12","|13","|14","|15","|16" ) ); + ADD( ConfOption( "MaxNumCredits", MaxNumCredits, "|20","|40","|60","|80","|100" ) ); ADD( ConfOption( "Premium", MovePref, "Off","Double for 1 Credit","2 Players for 1 Credit" ) ); ADD( ConfOption( "JointPremium", JointPremium, "Off","2 Players for 1 Credit" ) ); g_ConfOptions.back().m_sPrefName = "Premium"; diff --git a/src/ScreenSystemLayer.cpp b/src/ScreenSystemLayer.cpp index e47beecbdd..ec60f2c0f0 100644 --- a/src/ScreenSystemLayer.cpp +++ b/src/ScreenSystemLayer.cpp @@ -116,7 +116,7 @@ namespace sCredits += ssprintf(" %d", iCredits); if( PREFSMAN->m_iCoinsPerCredit > 1 ) sCredits += ssprintf(" %d/%d", iCoins, PREFSMAN->m_iCoinsPerCredit.Get() ); - if( iCredits >= MAX_NUM_CREDITS ) + if( iCredits >= PREFSMAN->m_iMaxNumCredits ) sCredits += " " + CREDITS_MAX.GetValue(); return sCredits; } diff --git a/src/StepMania.cpp b/src/StepMania.cpp index 2b5bcd1e87..033fd07b2f 100644 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -1113,10 +1113,10 @@ void StepMania::InsertCoin( int iNum, bool bCountInBookkeeping ) } int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit; - bool bMaxCredits = iCredits >= MAX_NUM_CREDITS; + bool bMaxCredits = iCredits >= PREFSMAN->m_iMaxNumCredits; if( bMaxCredits ) { - GAMESTATE->m_iCoins.Set( MAX_NUM_CREDITS * PREFSMAN->m_iCoinsPerCredit ); + GAMESTATE->m_iCoins.Set( PREFSMAN->m_iMaxNumCredits * PREFSMAN->m_iCoinsPerCredit ); } LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins.Get(), PREFSMAN->m_iCoinsPerCredit.Get() );