Don't randomly change backgrounds when all we have is one

image; we end up looping movies.
This commit is contained in:
Glenn Maynard
2002-09-07 05:53:24 +00:00
parent 35e5845ba7
commit 40f9f8c238
+32 -26
View File
@@ -301,35 +301,43 @@ void Background::LoadFromSong( Song* pSong )
// start off showing the static song background // start off showing the static song background
m_aBGSegments.Add( BGSegment(-10000,0) ); m_aBGSegments.Add( BGSegment(-10000,0) );
// change BG every 4 bars /* If we have only 2, only generate a single animation segment for for the
* whole song. Otherwise, if it's a movie., it'll loop every four bars; we
* want it to play continuously. */
const float fFirstBeat = m_BackgroundMode==MODE_MOVIE_BG ? 0 : pSong->m_fFirstBeat; const float fFirstBeat = m_BackgroundMode==MODE_MOVIE_BG ? 0 : pSong->m_fFirstBeat;
const float fLastBeat = pSong->m_fLastBeat; const float fLastBeat = pSong->m_fLastBeat;
for( float f=fFirstBeat; f<fLastBeat; f+=16 )
{
int index;
if( m_BackgroundAnimations.GetSize()==1 )
index = 0;
else if( f == fFirstBeat )
index = 1; // force the first random background to play first
else
index = 1 + rand()%(m_BackgroundAnimations.GetSize()-1);
m_aBGSegments.Add( BGSegment(f,index) );
}
// change BG every BPM change if( m_BackgroundAnimations.GetSize() == 2) {
for( int i=0; i<pSong->m_BPMSegments.GetSize(); i++ ) m_aBGSegments.Add( BGSegment(fFirstBeat,1) );
{ } else {
const BPMSegment& bpmseg = pSong->m_BPMSegments[i]; // change BG every 4 bars
for( float f=fFirstBeat; f<fLastBeat; f+=16 )
{
int index;
if( m_BackgroundAnimations.GetSize()==1 )
index = 0;
else if( f == fFirstBeat )
index = 1; // force the first random background to play first
else
index = 1 + rand()%(m_BackgroundAnimations.GetSize()-1);
m_aBGSegments.Add( BGSegment(f,index) );
}
if( bpmseg.m_fStartBeat < fFirstBeat || bpmseg.m_fStartBeat > fLastBeat ) // change BG every BPM change
continue; // skip] for( int i=0; i<pSong->m_BPMSegments.GetSize(); i++ )
{
const BPMSegment& bpmseg = pSong->m_BPMSegments[i];
int index; if( bpmseg.m_fStartBeat < fFirstBeat || bpmseg.m_fStartBeat > fLastBeat )
if( m_BackgroundAnimations.GetSize()==1 ) continue; // skip]
index = 0;
else int index;
index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1); if( m_BackgroundAnimations.GetSize()==1 )
m_aBGSegments.Add( BGSegment(bpmseg.m_fStartBeat,index) ); index = 0;
else
index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1);
m_aBGSegments.Add( BGSegment(bpmseg.m_fStartBeat,index) );
}
} }
// end showing the static song background // end showing the static song background
@@ -337,8 +345,6 @@ void Background::LoadFromSong( Song* pSong )
// sort segments // sort segments
SortBGSegmentArray( m_aBGSegments ); SortBGSegmentArray( m_aBGSegments );
} }
for( int i=0; i<m_BackgroundAnimations.GetSize(); i++ ) for( int i=0; i<m_BackgroundAnimations.GetSize(); i++ )