add preference for number of backgrounds to load

This commit is contained in:
Glenn Maynard
2003-05-28 04:33:55 +00:00
parent b01975f1eb
commit f43aabe61f
3 changed files with 8 additions and 5 deletions
+4 -5
View File
@@ -35,7 +35,6 @@ const float FADE_SECONDS = 1.0f;
const CString STATIC_BACKGROUND = "static background";
const int MAX_RANDOM_BACKGROUNDS = 4;
CString RandomBackground(int num) { return ssprintf("__random%i", num); }
@@ -234,7 +233,7 @@ void Background::LoadFromSong( Song* pSong )
// Load random backgrounds
bool bLoadedAnyRandomBackgrounds = false;
{
for( int i=0; i<MAX_RANDOM_BACKGROUNDS; i++ )
for( int i=0; i<PREFSMAN->m_iNumBackgrounds; i++ )
{
CString sBGName = RandomBackground(i);
BGAnimation *pTempBGA = CreateRandomBGA();
@@ -267,7 +266,7 @@ void Background::LoadFromSong( Song* pSong )
m_BGAnimations[sBGName] = pTempBGA;
else // the background was not found. Use a random one instead
if( bLoadedAnyRandomBackgrounds )
sBGName = RandomBackground( rand()%MAX_RANDOM_BACKGROUNDS );
sBGName = RandomBackground( rand()%PREFSMAN->m_iNumBackgrounds );
else
sBGName = STATIC_BACKGROUND;
}
@@ -293,7 +292,7 @@ void Background::LoadFromSong( Song* pSong )
bool bFade = PREFSMAN->m_BackgroundMode==PrefsManager::BGMODE_RANDOMMOVIES ||
PREFSMAN->m_BackgroundMode==PrefsManager::BGMODE_MOVIEVIS;
m_aBGChanges.push_back( BackgroundChange(f,sBGName,1.f,bFade) );
ctr = (ctr+1)%MAX_RANDOM_BACKGROUNDS;
ctr = (ctr+1)%PREFSMAN->m_iNumBackgrounds;
}
}
@@ -310,7 +309,7 @@ void Background::LoadFromSong( Song* pSong )
if( bLoadedAnyRandomBackgrounds )
{
CString sBGName = RandomBackground( rand()%MAX_RANDOM_BACKGROUNDS );
CString sBGName = RandomBackground( rand()%PREFSMAN->m_iNumBackgrounds );
m_aBGChanges.push_back( BackgroundChange(bpmseg.m_fStartBeat,sBGName) );
}
}
+3
View File
@@ -50,6 +50,7 @@ PrefsManager::PrefsManager()
m_bShowStats = false;
#endif
m_BackgroundMode = BGMODE_ANIMATIONS;
m_iNumBackgrounds = 8;
m_bShowDanger = true;
m_fBGBrightness = 0.8f;
m_bMenuTimer = true;
@@ -147,6 +148,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.GetValueB( "Options", "ShowStats", m_bShowStats );
ini.GetValueI( "Options", "BackgroundMode", (int&)m_BackgroundMode );
ini.GetValueI( "Options", "NumBackgrounds", m_iNumBackgrounds);
ini.GetValueB( "Options", "ShowDanger", m_bShowDanger );
ini.GetValueF( "Options", "BGBrightness", m_fBGBrightness );
ini.GetValueB( "Options", "MenuTimer", m_bMenuTimer );
@@ -238,6 +240,7 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.SetValueB( "Options", "ShowStats", m_bShowStats );
ini.SetValueI( "Options", "BackgroundMode", m_BackgroundMode);
ini.SetValueI( "Options", "NumBackgrounds", m_iNumBackgrounds);
ini.SetValueB( "Options", "ShowDanger", m_bShowDanger );
ini.SetValueF( "Options", "BGBrightness", m_fBGBrightness );
ini.SetValueB( "Options", "MenuTimer", m_bMenuTimer );
+1
View File
@@ -28,6 +28,7 @@ public:
int m_iRefreshRate;
bool m_bShowStats;
enum { BGMODE_OFF, BGMODE_ANIMATIONS, BGMODE_MOVIEVIS, BGMODE_RANDOMMOVIES } m_BackgroundMode;
int m_iNumBackgrounds;
float m_fBGBrightness;
int m_iMovieDecodeMS;
bool m_bUseBGIfNoBanner;