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) );
}
}