diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index e01d0559a1..b49fcdc58e 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -17,6 +17,10 @@ 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. * diff --git a/src/Profile.cpp b/src/Profile.cpp index 066a2f77f3..ce200ed9e2 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -38,6 +38,7 @@ const RString EDIT_COURSES_SUBDIR = "EditCourses/"; //const RString UPLOAD_SUBDIR = "Upload/"; const RString RIVAL_SUBDIR = "Rivals/"; +ThemeMetric SHOW_COIN_DATA( "Profile", "ShowCoinData" ); static Preference g_bProfileDataCompress( "ProfileDataCompress", false ); static ThemeMetric UNLOCK_AUTH_STRING( "Profile", "UnlockAuthString" ); #define GUID_SIZE_BYTES 8 @@ -947,6 +948,8 @@ XNode *Profile::SaveStatsXmlCreateNode() const xml->AppendChild( SaveCategoryScoresCreateNode() ); xml->AppendChild( SaveScreenshotDataCreateNode() ); xml->AppendChild( SaveCalorieDataCreateNode() ); + if( SHOW_COIN_DATA.GetValue() && IsMachine() ) + xml->AppendChild( SaveCoinDataCreateNode() ); return xml; } @@ -1835,6 +1838,19 @@ bool Profile::IsMachine() const return this == PROFILEMAN->GetMachineProfile(); } + +XNode* Profile::SaveCoinDataCreateNode() const +{ + CHECKPOINT; + + const Profile* pProfile = this; + ASSERT( pProfile != NULL ); + + XNode* pNode = new XNode( "CoinData" ); + + return pNode; +} + void Profile::MoveBackupToDir( RString sFromDir, RString sToDir ) { if( FILEMAN->IsAFile(sFromDir + STATS_XML) && diff --git a/src/Profile.h b/src/Profile.h index 3715b15010..60a700c004 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -369,6 +369,8 @@ public: XNode* SaveScreenshotDataCreateNode() const; XNode* SaveCalorieDataCreateNode() const; + XNode* SaveCoinDataCreateNode() const; + void SaveStatsWebPageToDir( RString sDir ) const; void SaveMachinePublicKeyToDir( RString sDir ) const; diff --git a/src/ScreenOptionsMasterPrefs.cpp b/src/ScreenOptionsMasterPrefs.cpp index 516c0b2dd4..7ad0da9665 100644 --- a/src/ScreenOptionsMasterPrefs.cpp +++ b/src/ScreenOptionsMasterPrefs.cpp @@ -383,6 +383,30 @@ static void MusicWheelSwitchSpeed( int &sel, bool ToSel, const ConfOption *pConf MoveMap( sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping) ); } +// Gameplay options +static void CoinModeNoHome( int &sel, bool ToSel, const ConfOption *pConfOption ) +{ + // The mapping without home is easy: subtract one to compensate for the missing CoinMode_Home + if( ToSel ) + { + MovePref( sel, ToSel, pConfOption ); + if( sel > static_cast(CoinMode_Home) ) + --sel; + } + else + { + if( sel >= static_cast(CoinMode_Home) ) + ++sel; + MovePref( sel, ToSel, pConfOption ); + } +} + +static void CoinsPerCredit( int &sel, bool ToSel, const ConfOption *pConfOption ) +{ + const int mapping[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 }; + MoveMap( sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping) ); +} + static void JointPremium( int &sel, bool ToSel, const ConfOption *pConfOption ) { const Premium mapping[] = { Premium_DoubleFor1Credit, Premium_2PlayersFor1Credit }; @@ -620,8 +644,8 @@ static void InitializeConfOptions() // 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. - // The next easiest case is when there is a hardcoded mapping that is not 1-1. - // In that case, you need to remap the result of + // 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 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. @@ -690,7 +714,8 @@ static void InitializeConfOptions() // Machine options ADD( ConfOption( "MenuTimer", MovePref, "Off","On" ) ); - ADD( ConfOption( "CoinMode", MovePref, "Home","Free Play" ) ); + ADD( ConfOption( "CoinMode", MovePref, "Home","Pay","Free Play" ) ); + ADD( ConfOption( "CoinModeNoHome", CoinModeNoHome, "Pay","Free Play" ) ); g_ConfOptions.back().m_sPrefName = "CoinMode"; ADD( ConfOption( "SongsPerPlay", SongsPerPlay, "|1","|2","|3","|4","|5" ) ); @@ -705,6 +730,7 @@ static void InitializeConfOptions() ADD( ConfOption( "ProgressiveStageLifebar", MovePref, "Off","|1","|2","|3","|4","|5","|6","|7","|8","Insanity") ); ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref, "Off","|1","|2","|3","|4","|5","|6","|7","|8","Insanity") ); ADD( ConfOption( "DefaultFailType", DefaultFailType, "Immediate","ImmediateContinue","EndOfSong","Off" ) ); + ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "|1","|2","|3","|4","|5","|6","|7","|8","|9","|10","|11","|12","|13","|14","|15","|16" ) ); 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";