Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Preference, Maximum Number of Credits #2139

Open
wants to merge 3 commits into
base: 5_1-new
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,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.
Connection=Verbinde zu Server (muss angegeben werden)
CourseSortOrder=Determines how courses are sorted.
Expand Down Expand Up @@ -992,6 +993,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
Connection=Connection
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,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.
Connection=Connect to Server (To be specified)
CourseSortOrder=Determines how courses are sorted.
Expand Down Expand Up @@ -1014,6 +1015,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
Connection=Connection
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,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.
Connection=Conecta con un servidor (que debe especificarse).
CourseSortOrder=Determina cuántos cursos se organizan.
CreateNew=
Expand Down Expand Up @@ -973,6 +974,7 @@ Clear clipboard=Descartar portapapeles
CoinMode=Modo monedas
CoinModeNoHome=Modo monedas
CoinsPerCredit=Mon. por crédito
MaxNumCredits=Max Credits
Connection=Conexión
Convert pause to beats=Convertir parada en compases
Convert delay to beats=Convertir latencia en compases
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/fr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,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.
Connection=Connecter au Serveur (À spécifier)
CourseSortOrder=Détermine comment les parcours sont triés.
Expand Down Expand Up @@ -949,6 +950,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
Expand Down
29 changes: 15 additions & 14 deletions Themes/_fallback/base._ini
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ IdleTimeoutSeconds=0

[ScreenOptionsAdvanced]
Fallback="ScreenOptionsServiceChild"
LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32"
LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33"
Line1="conf,MenuTimer"
Line2="conf,ScoringType"
Line3="conf,TimingWindowScale"
Expand All @@ -2771,19 +2771,20 @@ Line16="conf,UseUnlockSystem"
Line17="conf,CoinMode"
Line18="conf,SongsPerPlay"
Line19="conf,CoinsPerCredit"
Line20="conf,Premium"
Line21="conf,EventMode"
Line22="conf,AutoMapOnJoyChange"
Line23="conf,OnlyDedicatedMenuButtons"
Line24="conf,AutoPlay"
Line25="conf,DelayedBack"
Line26="conf,ArcadeOptionsNavigation"
Line27="conf,MusicWheelSwitchSpeed"
Line28="conf,AutogenSteps"
Line29="conf,AutogenGroupCourses"
Line30="conf,FastLoad"
Line31="conf,OnlyPreferredDifficulties"
Line32="conf,HiddenSongs"
Line20="conf,MaxNumCredits"
Line21="conf,Premium"
Line22="conf,EventMode"
Line23="conf,AutoMapOnJoyChange"
Line24="conf,OnlyDedicatedMenuButtons"
Line25="conf,AutoPlay"
Line26="conf,DelayedBack"
Line27="conf,ArcadeOptionsNavigation"
Line28="conf,MusicWheelSwitchSpeed"
Line29="conf,AutogenSteps"
Line30="conf,AutogenGroupCourses"
Line31="conf,FastLoad"
Line32="conf,OnlyPreferredDifficulties"
Line33="conf,HiddenSongs"

[ScreenOptionsGraphicsSound]
Fallback="ScreenOptionsServiceChild"
Expand Down
9 changes: 5 additions & 4 deletions Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3244,10 +3244,11 @@ 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"
LineHHLP="conf,HarshHotLifePenalty"
Expand Down
2 changes: 1 addition & 1 deletion src/Bookkeeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/GameConstantsAndTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const int MIN_METER = 1;
*/
const int MAX_METER = 35;

/** @brief The maximum number of credits for coin mode. */
const int MAX_NUM_CREDITS = 20;


/**
* @brief The various radar categories available.
Expand Down
1 change: 1 addition & 0 deletions src/PrefsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,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 ),
Expand Down
1 change: 1 addition & 0 deletions src/PrefsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class PrefsManager
Preference<AllowW1> m_AllowW1; // this should almost always be on, given use cases. -aj
Preference<bool> m_bEventMode;
Preference<int> m_iCoinsPerCredit;
Preference<int> m_iMaxNumCredits; // Should be able to change max number of credits, why cap? - CrashCringle
Preference<int> m_iSongsPerPlay;
Preference<bool> m_bDelayedCreditsReconcile; // zuh?
Preference<bool> m_bComboContinuesBetweenSongs;
Expand Down
8 changes: 8 additions & 0 deletions src/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -848,6 +854,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" ) );
Expand All @@ -862,6 +869,7 @@ static void InitializeConfOptions()
ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref<int>, "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<Premium>, "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";
Expand Down
2 changes: 1 addition & 1 deletion src/ScreenSystemLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/StepMania.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1287,10 +1287,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() );
Expand Down