broadcast on Preference changes

This commit is contained in:
Chris Danford
2005-05-06 20:41:05 +00:00
parent 5ebf6942f8
commit 820fb0b361
17 changed files with 80 additions and 74 deletions
+1 -1
View File
@@ -1153,7 +1153,7 @@ void Player::HandleAutosync(float fNoteOffset)
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += mean; GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += mean;
break; break;
case SongOptions::AUTOSYNC_MACHINE: case SongOptions::AUTOSYNC_MACHINE:
PREFSMAN->m_fGlobalOffsetSeconds = PREFSMAN->m_fGlobalOffsetSeconds + mean; PREFSMAN->m_fGlobalOffsetSeconds.Set( PREFSMAN->m_fGlobalOffsetSeconds + mean );
break; break;
default: default:
ASSERT(0); ASSERT(0);
+7
View File
@@ -5,6 +5,7 @@
#include "RageLog.h" #include "RageLog.h"
#include "LuaFunctions.h" #include "LuaFunctions.h"
#include "LuaManager.h" #include "LuaManager.h"
#include "MessageManager.h"
static const CString PrefsGroupNames[] = { static const CString PrefsGroupNames[] = {
"Debug", "Debug",
@@ -84,6 +85,12 @@ void IPreference::WriteTo( IniFile &ini ) const
ini.SetValue( PrefsGroupToString(m_PrefsGroup), m_sName, ToString() ); ini.SetValue( PrefsGroupToString(m_PrefsGroup), m_sName, ToString() );
} }
void BroadcastPreferenceChanged( const CString& sPreferenceName )
{
if( MESSAGEMAN )
MESSAGEMAN->Broadcast( sPreferenceName+"Changed" );
}
/* /*
* (c) 2001-2004 Chris Danford, Chris Gomez * (c) 2001-2004 Chris Danford, Chris Gomez
* All rights reserved. * All rights reserved.
+6 -3
View File
@@ -40,6 +40,8 @@ protected:
CString m_sName; CString m_sName;
}; };
void BroadcastPreferenceChanged( const CString& sPreferenceName );
template <class T> template <class T>
class Preference : public IPreference class Preference : public IPreference
{ {
@@ -68,19 +70,20 @@ public:
m_currentValue = m_defaultValue; m_currentValue = m_defaultValue;
} }
T &Value() T Get() const
{ {
return m_currentValue; return m_currentValue;
} }
operator const T () const operator const T () const
{ {
return m_currentValue; return Get();
} }
void operator=( const T& other ) void Set( const T& other )
{ {
m_currentValue = other; m_currentValue = other;
BroadcastPreferenceChanged( m_sName );
} }
}; };
+3 -3
View File
@@ -351,7 +351,7 @@ void PrefsManager::ResetToFactoryDefaults()
{ {
// clobber the users prefs by initing then applying defaults // clobber the users prefs by initing then applying defaults
Init(); Init();
m_bFirstRun = false; m_bFirstRun.Set( false );
ReadPrefsFromFile( DEFAULTS_INI_PATH ); ReadPrefsFromFile( DEFAULTS_INI_PATH );
ReadPrefsFromFile( STATIC_INI_PATH ); ReadPrefsFromFile( STATIC_INI_PATH );
@@ -380,7 +380,7 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini )
ini.GetValue( "Options", "LightsDriver", m_sLightsDriver ); ini.GetValue( "Options", "LightsDriver", m_sLightsDriver );
ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality ); ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
m_iCoinsPerCredit = max( (int)m_iCoinsPerCredit, 1); m_iCoinsPerCredit.Set( max(m_iCoinsPerCredit.Get(),1) );
ini.GetValue( "Options", "BoostAppPriority", m_iBoostAppPriority ); ini.GetValue( "Options", "BoostAppPriority", m_iBoostAppPriority );
ini.GetValue( "Options", "LightsStepsDifficulty", m_sLightsStepsDifficulty ); ini.GetValue( "Options", "LightsStepsDifficulty", m_sLightsStepsDifficulty );
@@ -451,7 +451,7 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini )
FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p ) FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
(*p)->ReadFrom( ini ); (*p)->ReadFrom( ini );
CLAMP( m_iSongsPerPlay.Value(), 0, MAX_SONGS_PER_PLAY ); m_iSongsPerPlay.Set( clamp(m_iSongsPerPlay.Get(),0,MAX_SONGS_PER_PLAY) );
} }
void PrefsManager::SaveGlobalPrefsToDisk() const void PrefsManager::SaveGlobalPrefsToDisk() const
+1 -1
View File
@@ -189,7 +189,7 @@ bool Screen::ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventTy
{ {
CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1); CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1);
wrap( (int&)cm, NUM_COIN_MODES ); wrap( (int&)cm, NUM_COIN_MODES );
PREFSMAN->m_CoinMode = cm; PREFSMAN->m_CoinMode.Set( cm );
/* Show the real coin mode, not GetCoinMode(), or F3 will go "home, free, free" /* Show the real coin mode, not GetCoinMode(), or F3 will go "home, free, free"
* in event mode. XXX: move GetCoinMode to GameState to keep PrefsManager dumb? */ * in event mode. XXX: move GetCoinMode to GameState to keep PrefsManager dumb? */
+1 -1
View File
@@ -73,7 +73,7 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
switch( GAMESTATE->GetCoinMode() ) switch( GAMESTATE->GetCoinMode() )
{ {
case COIN_PAY: case COIN_PAY:
LOG->Trace("ScreenAttract::AttractInput: COIN_PAY (%i/%i)", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Value() ); LOG->Trace("ScreenAttract::AttractInput: COIN_PAY (%i/%i)", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() );
if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit )
break; // don't fall through break; // don't fall through
// fall through // fall through
+9 -9
View File
@@ -56,10 +56,10 @@ void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType
{ {
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_SPACE ) if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_SPACE )
{ {
PREFSMAN->m_iCenterImageTranslateX = 0; PREFSMAN->m_iCenterImageTranslateX.Set( 0 );
PREFSMAN->m_iCenterImageTranslateY = 0; PREFSMAN->m_iCenterImageTranslateY.Set( 0 );
PREFSMAN->m_fCenterImageAddWidth = 0; PREFSMAN->m_fCenterImageAddWidth.Set( 0 );
PREFSMAN->m_fCenterImageAddHeight = 0; PREFSMAN->m_fCenterImageAddHeight.Set( 0 );
return; return;
} }
@@ -162,7 +162,7 @@ void ScreenCenterImage::Move( Axis axis, float fDelta )
&PREFSMAN->m_fCenterImageAddHeight &PREFSMAN->m_fCenterImageAddHeight
}; };
*piValues[axis] = *piValues[axis] + lrintf( fDelta ); piValues[axis]->Set( *piValues[axis] + lrintf( fDelta ) );
DISPLAY->ChangeCentering( DISPLAY->ChangeCentering(
PREFSMAN->m_iCenterImageTranslateX, PREFSMAN->m_iCenterImageTranslateX,
@@ -172,10 +172,10 @@ void ScreenCenterImage::Move( Axis axis, float fDelta )
CString sMessage = CString sMessage =
ssprintf( "Centering: x=%d, y=%d, width=%d, height=%d", ssprintf( "Centering: x=%d, y=%d, width=%d, height=%d",
PREFSMAN->m_iCenterImageTranslateX.Value(), PREFSMAN->m_iCenterImageTranslateX.Get(),
PREFSMAN->m_iCenterImageTranslateY.Value(), PREFSMAN->m_iCenterImageTranslateY.Get(),
PREFSMAN->m_fCenterImageAddWidth.Value(), PREFSMAN->m_fCenterImageAddWidth.Get(),
PREFSMAN->m_fCenterImageAddHeight.Value() ); PREFSMAN->m_fCenterImageAddHeight.Get() );
SCREENMAN->SystemMessageNoAnimate( sMessage ); SCREENMAN->SystemMessageNoAnimate( sMessage );
} }
+1 -1
View File
@@ -1430,7 +1430,7 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
break; break;
case EDIT_BUTTON_TOGGLE_AUTOPLAY: case EDIT_BUTTON_TOGGLE_AUTOPLAY:
{ {
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay; PREFSMAN->m_bAutoPlay.Set( !PREFSMAN->m_bAutoPlay );
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN; GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
} }
+1 -1
View File
@@ -1947,7 +1947,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
break; break;
case KEY_F8: case KEY_F8:
{ {
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay; PREFSMAN->m_bAutoPlay.Set( !PREFSMAN->m_bAutoPlay );
UpdateAutoPlayText(); UpdateAutoPlayText();
bool bIsHoldingShift = bool bIsHoldingShift =
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) || INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ||
+1 -1
View File
@@ -89,7 +89,7 @@ void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM )
NSMAN->PostStartUp(sNewName); NSMAN->PostStartUp(sNewName);
NSMAN->DisplayStartupStatus(); NSMAN->DisplayStartupStatus();
UpdateConnectStatus( ); UpdateConnectStatus( );
g_sLastServer = ScreenTextEntry::s_sLastAnswer; g_sLastServer.Set( ScreenTextEntry::s_sLastAnswer );
} }
} }
else if( SM == SM_ServerNameEnter ) else if( SM == SM_ServerNameEnter )
+20 -24
View File
@@ -59,12 +59,11 @@ int FindClosestEntry( T value, const T *mapping, unsigned cnt )
return 0; return 0;
} }
template<class T> template <class T>
static void MoveMap( int &sel, T &opt, bool ToSel, const T *mapping, unsigned cnt ) static void MoveMap( int &sel, T &opt, bool ToSel, const T *mapping, unsigned cnt )
{ {
if( ToSel ) if( ToSel )
{ {
/* opt -> sel. Find the closest entry in mapping. */
sel = FindClosestEntry( opt, mapping, cnt ); sel = FindClosestEntry( opt, mapping, cnt );
} else { } else {
/* sel -> opt */ /* sel -> opt */
@@ -72,19 +71,15 @@ static void MoveMap( int &sel, T &opt, bool ToSel, const T *mapping, unsigned cn
} }
} }
/*
* MoveMap for a generic preference.
* TODO: make this templated.
*/
template <class T> template <class T>
static void MoveMap( int &sel, Preference<T> &pOption, bool ToSel, const T *mapping, unsigned cnt ) static void MoveMap( int &sel, Preference<T> &opt, bool ToSel, const T *mapping, unsigned cnt )
{ {
if( ToSel ) if( ToSel )
{ {
sel = FindClosestEntry( (T)pOption, mapping, cnt ); sel = FindClosestEntry( opt.Get(), mapping, cnt );
} else { } else {
/* sel -> opt */ /* sel -> opt */
pOption = mapping[sel]; opt.Set( mapping[sel] );
} }
} }
@@ -121,7 +116,8 @@ static void MoveData( int &sel, bool &opt, bool ToSel )
template<class T> template<class T>
static void MoveData( int &sel, Preference<T> &opt, bool ToSel ) static void MoveData( int &sel, Preference<T> &opt, bool ToSel )
{ {
MoveData( sel, opt.Value(), ToSel ); if( ToSel ) sel = opt;
else opt.Set( !!sel );
} }
#define MOVE( name, opt ) \ #define MOVE( name, opt ) \
@@ -290,13 +286,13 @@ MOVE( BeginnerHelper, PREFSMAN->m_bShowBeginnerHelper );
static void BGBrightness( int &sel, bool ToSel, const ConfOption *pConfOption ) static void BGBrightness( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const float mapping[] = { 0.0f,0.1f,0.2f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f,1.0f }; const float mapping[] = { 0.0f,0.1f,0.2f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f,1.0f };
MoveMap( sel, PREFSMAN->m_fBGBrightness.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_fBGBrightness, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void NumBackgrounds( int &sel, bool ToSel, const ConfOption *pConfOption ) static void NumBackgrounds( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { 5,10,15,20 }; const int mapping[] = { 5,10,15,20 };
MoveMap( sel, PREFSMAN->m_iNumBackgrounds.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iNumBackgrounds, ToSel, mapping, ARRAYSIZE(mapping) );
} }
/* Input options */ /* Input options */
@@ -308,7 +304,7 @@ MOVE( OptionsNavigation, PREFSMAN->m_bArcadeOptionsNavigation );
static void WheelSpeed( int &sel, bool ToSel, const ConfOption *pConfOption ) static void WheelSpeed( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { 5, 10, 15, 25 }; const int mapping[] = { 5, 10, 15, 25 };
MoveMap( sel, (int&)PREFSMAN->m_iMusicWheelSwitchSpeed, ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iMusicWheelSwitchSpeed, ToSel, mapping, ARRAYSIZE(mapping) );
} }
/* Gameplay options */ /* Gameplay options */
@@ -362,7 +358,7 @@ static void SongsPerPlayOrEventMode( int &sel, bool ToSel, const ConfOption *pCo
if( ToSel && PREFSMAN->m_bEventMode ) if( ToSel && PREFSMAN->m_bEventMode )
sel = 7; sel = 7;
if( !ToSel ) if( !ToSel )
PREFSMAN->m_bEventMode = (sel == 7); PREFSMAN->m_bEventMode.Set( sel == 7 );
} }
/* Machine options */ /* Machine options */
@@ -371,13 +367,13 @@ MOVE( ScoringType, (int &) PREFSMAN->m_iScoringType );
static void JudgeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption ) static void JudgeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const float mapping[] = { 1.50f,1.33f,1.16f,1.00f,0.84f,0.66f,0.50f,0.33f,0.20f }; const float mapping[] = { 1.50f,1.33f,1.16f,1.00f,0.84f,0.66f,0.50f,0.33f,0.20f };
MoveMap( sel, PREFSMAN->m_fJudgeWindowScale.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_fJudgeWindowScale, ToSel, mapping, ARRAYSIZE(mapping) );
} }
void LifeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption ) void LifeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const float mapping[] = { 1.60f,1.40f,1.20f,1.00f,0.80f,0.60f,0.40f }; const float mapping[] = { 1.60f,1.40f,1.20f,1.00f,0.80f,0.60f,0.40f };
MoveMap( sel, PREFSMAN->m_fLifeDifficultyScale.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_fLifeDifficultyScale, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void ShowSongOptions( int &sel, bool ToSel, const ConfOption *pConfOption ) static void ShowSongOptions( int &sel, bool ToSel, const ConfOption *pConfOption )
@@ -462,45 +458,45 @@ static void DisplayResolution( int &sel, bool ToSel, const ConfOption *pConfOpti
MoveMap( sel, sel_res, ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, sel_res, ToSel, mapping, ARRAYSIZE(mapping) );
if( !ToSel ) if( !ToSel )
{ {
PREFSMAN->m_iDisplayWidth = sel_res.w; PREFSMAN->m_iDisplayWidth.Set( sel_res.w );
PREFSMAN->m_iDisplayHeight = sel_res.h; PREFSMAN->m_iDisplayHeight.Set( sel_res.h );
} }
} }
static void DisplayColor( int &sel, bool ToSel, const ConfOption *pConfOption ) static void DisplayColor( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { 16,32 }; const int mapping[] = { 16,32 };
MoveMap( sel, PREFSMAN->m_iDisplayColorDepth.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iDisplayColorDepth, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void TextureResolution( int &sel, bool ToSel, const ConfOption *pConfOption ) static void TextureResolution( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { 256,512,1024,2048 }; const int mapping[] = { 256,512,1024,2048 };
MoveMap( sel, PREFSMAN->m_iMaxTextureResolution.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iMaxTextureResolution, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void TextureColor( int &sel, bool ToSel, const ConfOption *pConfOption ) static void TextureColor( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { 16,32 }; const int mapping[] = { 16,32 };
MoveMap( sel, PREFSMAN->m_iTextureColorDepth.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iTextureColorDepth, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void MovieColor( int &sel, bool ToSel, const ConfOption *pConfOption ) static void MovieColor( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { 16,32 }; const int mapping[] = { 16,32 };
MoveMap( sel, PREFSMAN->m_iMovieColorDepth.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iMovieColorDepth, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void RefreshRate( int &sel, bool ToSel, const ConfOption *pConfOption ) static void RefreshRate( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const int mapping[] = { (int) REFRESH_DEFAULT,60,70,72,75,80,85,90,100,120,150 }; const int mapping[] = { (int) REFRESH_DEFAULT,60,70,72,75,80,85,90,100,120,150 };
MoveMap( sel, PREFSMAN->m_iRefreshRate.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_iRefreshRate, ToSel, mapping, ARRAYSIZE(mapping) );
} }
static void AspectRatio( int &sel, bool ToSel, const ConfOption *pConfOption ) static void AspectRatio( int &sel, bool ToSel, const ConfOption *pConfOption )
{ {
const float mapping[] = { 3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f }; const float mapping[] = { 3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
MoveMap( sel, PREFSMAN->m_fDisplayAspectRatio.Value(), ToSel, mapping, ARRAYSIZE(mapping) ); MoveMap( sel, PREFSMAN->m_fDisplayAspectRatio, ToSel, mapping, ARRAYSIZE(mapping) );
} }
/* Sound options */ /* Sound options */
+1 -1
View File
@@ -775,7 +775,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_F9 ) if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_F9 )
{ {
if( type != IET_FIRST_PRESS ) return; if( type != IET_FIRST_PRESS ) return;
PREFSMAN->m_bShowNativeLanguage = !PREFSMAN->m_bShowNativeLanguage; PREFSMAN->m_bShowNativeLanguage.Set( !PREFSMAN->m_bShowNativeLanguage );
m_MusicWheel.RebuildAllMusicWheelItems(); m_MusicWheel.RebuildAllMusicWheelItems();
if( SHOW_COURSE_CONTENTS ) if( SHOW_COURSE_CONTENTS )
m_CourseContents.SetFromGameState(); m_CourseContents.SetFromGameState();
+1 -1
View File
@@ -193,7 +193,7 @@ CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
if( Credits > 0 || PREFSMAN->m_iCoinsPerCredit == 1 ) if( Credits > 0 || PREFSMAN->m_iCoinsPerCredit == 1 )
sCredits += ssprintf(" %d", Credits); sCredits += ssprintf(" %d", Credits);
if( PREFSMAN->m_iCoinsPerCredit > 1 ) if( PREFSMAN->m_iCoinsPerCredit > 1 )
sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit.Value() ); sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit.Get() );
return sCredits; return sCredits;
} }
case COIN_FREE: case COIN_FREE:
+1 -1
View File
@@ -190,7 +190,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
return; return;
//The user wants to input text traditionally //The user wants to input text traditionally
if ( g_bAllowOldKeyboardInput.Value() && ( type == IET_FIRST_PRESS ) ) if ( g_bAllowOldKeyboardInput.Get() && ( type == IET_FIRST_PRESS ) )
{ {
if ( DeviceI.button == KEY_BACK ) if ( DeviceI.button == KEY_BACK )
{ {
+1 -1
View File
@@ -84,7 +84,7 @@ void ScreenTitleMenu::Init()
CString sText = CString sText =
GAMESTATE->IsEventMode() ? GAMESTATE->IsEventMode() ?
CString("event mode") : CString("event mode") :
ssprintf( "%d %s%s max", PREFSMAN->m_iSongsPerPlay.Value(), MAX_STAGES_TEXT.c_str(), (PREFSMAN->m_iSongsPerPlay>1)?"s":"" ); ssprintf( "%d %s%s max", PREFSMAN->m_iSongsPerPlay.Get(), MAX_STAGES_TEXT.c_str(), (PREFSMAN->m_iSongsPerPlay>1)?"s":"" );
m_textMaxStages.SetText( sText ); m_textMaxStages.SetText( sText );
this->AddChild( &m_textMaxStages ); this->AddChild( &m_textMaxStages );
SET_XY_AND_ON_COMMAND( m_textMaxStages ); SET_XY_AND_ON_COMMAND( m_textMaxStages );
+4 -4
View File
@@ -100,14 +100,14 @@ void SongManager::Reload( LoadingWindow *ld )
/* Always check songs for changes. */ /* Always check songs for changes. */
const bool OldVal = PREFSMAN->m_bFastLoad; const bool OldVal = PREFSMAN->m_bFastLoad;
PREFSMAN->m_bFastLoad = false; PREFSMAN->m_bFastLoad.Set( false );
InitAll( ld ); InitAll( ld );
// reload scores afterward // reload scores afterward
PROFILEMAN->LoadMachineProfile(); PROFILEMAN->LoadMachineProfile();
PREFSMAN->m_bFastLoad = OldVal; PREFSMAN->m_bFastLoad.Set( OldVal );
} }
void SongManager::InitSongsFromDisk( LoadingWindow *ld ) void SongManager::InitSongsFromDisk( LoadingWindow *ld )
@@ -786,10 +786,10 @@ void SongManager::RevertFromDisk( Song *pSong, bool bAllowNotesLoss )
/* Erase existing data and reload. */ /* Erase existing data and reload. */
pSong->Reset(); pSong->Reset();
const bool OldVal = PREFSMAN->m_bFastLoad; const bool OldVal = PREFSMAN->m_bFastLoad;
PREFSMAN->m_bFastLoad = false; PREFSMAN->m_bFastLoad.Set( false );
pSong->LoadFromSongDir( dir ); pSong->LoadFromSongDir( dir );
/* XXX: reload edits? */ /* XXX: reload edits? */
PREFSMAN->m_bFastLoad = OldVal; PREFSMAN->m_bFastLoad.Set( OldVal );
/* Courses cache Steps pointers. On the off chance that this isn't the last /* Courses cache Steps pointers. On the off chance that this isn't the last
+17 -17
View File
@@ -106,12 +106,12 @@ static RageDisplay::VideoModeParams GetCurVideoModeParams()
static void StoreActualGraphicOptions( bool initial ) static void StoreActualGraphicOptions( bool initial )
{ {
// find out what we actually have // find out what we actually have
PREFSMAN->m_bWindowed = DISPLAY->GetVideoModeParams().windowed; PREFSMAN->m_bWindowed.Set( DISPLAY->GetVideoModeParams().windowed );
PREFSMAN->m_iDisplayWidth = DISPLAY->GetVideoModeParams().width; PREFSMAN->m_iDisplayWidth.Set( DISPLAY->GetVideoModeParams().width );
PREFSMAN->m_iDisplayHeight = DISPLAY->GetVideoModeParams().height; PREFSMAN->m_iDisplayHeight.Set( DISPLAY->GetVideoModeParams().height );
PREFSMAN->m_iDisplayColorDepth = DISPLAY->GetVideoModeParams().bpp; PREFSMAN->m_iDisplayColorDepth.Set( DISPLAY->GetVideoModeParams().bpp );
PREFSMAN->m_iRefreshRate = DISPLAY->GetVideoModeParams().rate; PREFSMAN->m_iRefreshRate.Set( DISPLAY->GetVideoModeParams().rate );
PREFSMAN->m_bVsync = DISPLAY->GetVideoModeParams().vsync; PREFSMAN->m_bVsync.Set( DISPLAY->GetVideoModeParams().vsync );
CString log = ssprintf("%s %dx%d %d color %d texture %dHz %s %s", CString log = ssprintf("%s %dx%d %d color %d texture %dHz %s %s",
PREFSMAN->m_bWindowed ? "Windowed" : "Fullscreen", PREFSMAN->m_bWindowed ? "Windowed" : "Fullscreen",
@@ -322,7 +322,7 @@ void ResetGame( bool ReturnToFirstScreen )
else else
SCREENMAN->SetNewScreen( INITIAL_SCREEN ); SCREENMAN->SetNewScreen( INITIAL_SCREEN );
PREFSMAN->m_bFirstRun = false; PREFSMAN->m_bFirstRun.Set( false );
PREFSMAN->SaveGlobalPrefsToDisk(); // persist FirstRun setting in case we don't exit normally PREFSMAN->SaveGlobalPrefsToDisk(); // persist FirstRun setting in case we don't exit normally
} }
@@ -387,12 +387,12 @@ static void CheckSettings()
/* Two memory-consuming features that we can disable are texture caching and /* Two memory-consuming features that we can disable are texture caching and
* preloaded banners. Texture caching can use a lot of memory; disable it for * preloaded banners. Texture caching can use a lot of memory; disable it for
* low-memory systems. */ * low-memory systems. */
PREFSMAN->m_bDelayedTextureDelete = HighMemory; PREFSMAN->m_bDelayedTextureDelete.Set( HighMemory );
/* Preloaded banners takes about 9k per song. Although it's smaller than the /* Preloaded banners takes about 9k per song. Although it's smaller than the
* actual song data, it still adds up with a lot of songs. Disable it for 64-meg * actual song data, it still adds up with a lot of songs. Disable it for 64-meg
* systems. */ * systems. */
PREFSMAN->m_BannerCache = LowMemory ? PrefsManager::BNCACHE_OFF:PrefsManager::BNCACHE_LOW_RES_PRELOAD; PREFSMAN->m_BannerCache.Set( LowMemory ? PrefsManager::BNCACHE_OFF:PrefsManager::BNCACHE_LOW_RES_PRELOAD );
PREFSMAN->SaveGlobalPrefsToDisk(); PREFSMAN->SaveGlobalPrefsToDisk();
#endif #endif
@@ -653,12 +653,12 @@ static void CheckVideoDefaultSettings()
if( SetDefaultVideoParams ) if( SetDefaultVideoParams )
{ {
PREFSMAN->m_sVideoRenderers = pDefaults->szVideoRenderers; PREFSMAN->m_sVideoRenderers = pDefaults->szVideoRenderers;
PREFSMAN->m_iDisplayWidth = pDefaults->iWidth; PREFSMAN->m_iDisplayWidth.Set( pDefaults->iWidth );
PREFSMAN->m_iDisplayHeight = pDefaults->iHeight; PREFSMAN->m_iDisplayHeight.Set( pDefaults->iHeight );
PREFSMAN->m_iDisplayColorDepth = pDefaults->iDisplayColor; PREFSMAN->m_iDisplayColorDepth.Set( pDefaults->iDisplayColor );
PREFSMAN->m_iTextureColorDepth = pDefaults->iTextureColor; PREFSMAN->m_iTextureColorDepth.Set( pDefaults->iTextureColor );
PREFSMAN->m_iMovieColorDepth = pDefaults->iMovieColor; PREFSMAN->m_iMovieColorDepth.Set( pDefaults->iMovieColor );
PREFSMAN->m_iMaxTextureResolution = pDefaults->iTextureSize; PREFSMAN->m_iMaxTextureResolution.Set( pDefaults->iTextureSize );
PREFSMAN->m_bSmoothLines = pDefaults->bSmoothLines; PREFSMAN->m_bSmoothLines = pDefaults->bSmoothLines;
// Update last seen video card // Update last seen video card
@@ -1265,7 +1265,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature,
void InsertCoin( int iNum ) void InsertCoin( int iNum )
{ {
GAMESTATE->m_iCoins += iNum; GAMESTATE->m_iCoins += iNum;
LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Value() ); LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() );
BOOKKEEPER->CoinInserted(); BOOKKEEPER->CoinInserted();
SCREENMAN->RefreshCreditsMessages(); SCREENMAN->RefreshCreditsMessages();
SCREENMAN->PlayCoinSound(); SCREENMAN->PlayCoinSound();
@@ -1394,7 +1394,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) ) INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
{ {
/* alt-enter */ /* alt-enter */
PREFSMAN->m_bWindowed = !PREFSMAN->m_bWindowed; PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed );
ApplyGraphicOptions(); ApplyGraphicOptions();
return true; return true;
} }