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
+9 -3
View File
@@ -301,9 +301,16 @@ 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;
if( m_BackgroundAnimations.GetSize() == 2) {
m_aBGSegments.Add( BGSegment(fFirstBeat,1) );
} else {
// change BG every 4 bars
for( float f=fFirstBeat; f<fLastBeat; f+=16 ) for( float f=fFirstBeat; f<fLastBeat; f+=16 )
{ {
int index; int index;
@@ -331,14 +338,13 @@ void Background::LoadFromSong( Song* pSong )
index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1); index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1);
m_aBGSegments.Add( BGSegment(bpmseg.m_fStartBeat,index) ); m_aBGSegments.Add( BGSegment(bpmseg.m_fStartBeat,index) );
} }
}
// end showing the static song background // end showing the static song background
m_aBGSegments.Add( BGSegment(pSong->m_fLastBeat,0) ); m_aBGSegments.Add( BGSegment(pSong->m_fLastBeat,0) );
// 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++ )