convert prefs to Preference

This commit is contained in:
Glenn Maynard
2005-02-22 04:00:14 +00:00
parent 6c9cc1b273
commit 61d94e97d8
3 changed files with 10 additions and 14 deletions
+3 -7
View File
@@ -118,7 +118,9 @@ PrefsManager::PrefsManager() :
m_fLifeDeltaPercentChangeOK ( Options, "LifeDeltaPercentChangeOK", +0.008f ),
m_fLifeDeltaPercentChangeNG ( Options, "LifeDeltaPercentChangeNG", -0.080f ),
m_bShowCaution ( Options, "ShowCaution", true ),
m_bEventMode ( Options, "EventMode", false )
m_bEventMode ( Options, "EventMode", false ),
m_iNumArcadeStages ( Options, "NumArcadeStages", 3 ),
m_fGlobalOffsetSeconds ( Options, "GlobalOffsetSeconds", 0 )
{
Init();
ReadGlobalPrefsFromDisk();
@@ -128,7 +130,6 @@ void PrefsManager::Init()
{
m_bCelShadeModels = false; // Work-In-Progress.. disable by default.
m_fConstantUpdateDeltaSeconds = 0;
m_iNumArcadeStages = 3;
m_bAutoPlay = false;
m_fTugMeterPercentChangeMarvelous = +0.010f;
@@ -221,7 +222,6 @@ void PrefsManager::Init()
m_bUseUnlockSystem = false;
m_bFirstRun = true;
m_bAutoMapOnJoyChange = true;
m_fGlobalOffsetSeconds = 0;
m_bShowBeginnerHelper = false;
m_bEndlessBreakEnabled = true;
m_iEndlessNumStagesUntilBreak = 5;
@@ -379,7 +379,6 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini )
{
ini.GetValue( "Options", "CelShadeModels", m_bCelShadeModels );
ini.GetValue( "Options", "ConstantUpdateDeltaSeconds", m_fConstantUpdateDeltaSeconds );
ini.GetValue( "Options", "NumArcadeStages", m_iNumArcadeStages );
ini.GetValue( "Options", "AutoPlay", m_bAutoPlay );
ini.GetValue( "Options", "TugMeterPercentChangeMarvelous", m_fTugMeterPercentChangeMarvelous );
ini.GetValue( "Options", "TugMeterPercentChangePerfect", m_fTugMeterPercentChangePerfect );
@@ -509,7 +508,6 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini )
ini.GetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking );
ini.GetValue( "Options", "GetRankingName", (int&)m_iGetRankingName);
ini.GetValue( "Options", "SmoothLines", m_bSmoothLines );
ini.GetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
ini.GetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper );
ini.GetValue( "Options", "Language", m_sLanguage );
ini.GetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled );
@@ -589,7 +587,6 @@ void PrefsManager::SaveGlobalPrefsToIni( IniFile &ini ) const
ini.SetValue( "Options", "BackgroundMode", m_iBackgroundMode);
ini.SetValue( "Options", "NumBackgrounds", m_iNumBackgrounds);
ini.SetValue( "Options", "BGBrightness", m_fBGBrightness );
ini.SetValue( "Options", "NumArcadeStages", m_iNumArcadeStages );
ini.SetValue( "Options", "AutoPlay", m_bAutoPlay );
ini.SetValue( "Options", "JudgeWindowScale", m_fJudgeWindowScale );
ini.SetValue( "Options", "JudgeWindowAdd", m_fJudgeWindowAdd );
@@ -730,7 +727,6 @@ void PrefsManager::SaveGlobalPrefsToIni( IniFile &ini ) const
ini.SetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking );
ini.SetValue( "Options", "GetRankingName", m_iGetRankingName);
ini.SetValue( "Options", "SmoothLines", m_bSmoothLines );
ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder );
ini.SetValue( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
+2 -2
View File
@@ -143,7 +143,7 @@ public:
int m_iMarvelousTiming;
Preference<bool> m_bEventMode;
int m_iCoinsPerCredit;
int m_iNumArcadeStages;
Preference<int> m_iNumArcadeStages;
// These options have weird interactions depending on m_bEventMode,
// so wrap them.
@@ -173,7 +173,7 @@ public:
bool m_bUseUnlockSystem;
bool m_bFirstRun;
bool m_bAutoMapOnJoyChange;
float m_fGlobalOffsetSeconds;
Preference<float> m_fGlobalOffsetSeconds;
int m_iProgressiveLifebar;
int m_iProgressiveStageLifebar;
int m_iProgressiveNonstopLifebar;
+5 -5
View File
@@ -76,19 +76,19 @@ static void MoveMap( int &sel, T &opt, bool ToSel, const T *mapping, unsigned cn
* MoveMap for a generic preference. We don't know its type, but MoveMap is only used on numeric
* values, so pretend it's a float.
*/
static void MoveMap( int &sel, IPreference *pOption, bool ToSel, const float *mapping, unsigned cnt )
static void MoveMap( int &sel, IPreference &pOption, bool ToSel, const float *mapping, unsigned cnt )
{
if( ToSel )
{
/* opt -> sel. Find the closest entry in mapping. */
CString sStr = pOption->ToString();
CString sStr = pOption.ToString();
float fValue = strtof( sStr, NULL );
sel = FindClosestEntry( fValue, mapping, cnt );
} else {
/* sel -> opt */
CString sStr = ssprintf( "%f", mapping[sel] );
pOption->FromString( sStr );
pOption.FromString( sStr );
}
}
@@ -348,12 +348,12 @@ static void PremiumM( int &sel, bool ToSel, const ConfOption *pConfOption )
static void SongsPerPlay( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const int mapping[] = { 1,2,3,4,5,6,7 };
const float mapping[] = { 1,2,3,4,5,6,7 };
MoveMap( sel, PREFSMAN->m_iNumArcadeStages, ToSel, mapping, ARRAYSIZE(mapping) );
}
static void SongsPerPlayOrEventMode( int &sel, bool ToSel, const ConfOption *pConfOption )
{
const int mapping[] = { 1,2,3,4,5,6,7,8 };
const float mapping[] = { 1,2,3,4,5,6,7,8 };
MoveMap( sel, PREFSMAN->m_iNumArcadeStages, ToSel, mapping, ARRAYSIZE(mapping) );
if( ToSel && PREFSMAN->m_bEventMode )