fix "last background change never happens"
This commit is contained in:
@@ -330,7 +330,7 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
|
|
||||||
CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathToG("Common fallback background");
|
CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathToG("Common fallback background");
|
||||||
|
|
||||||
// Load the static background that will before notes start and after notes end
|
// Load the static background that will show before notes start and after notes end
|
||||||
{
|
{
|
||||||
BGAnimation *pTempBGA = new BGAnimation;
|
BGAnimation *pTempBGA = new BGAnimation;
|
||||||
pTempBGA->LoadFromStaticGraphic( sSongBGPath );
|
pTempBGA->LoadFromStaticGraphic( sSongBGPath );
|
||||||
@@ -440,12 +440,19 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
|
|
||||||
int Background::FindBGSegmentForBeat( float fBeat ) const
|
int Background::FindBGSegmentForBeat( float fBeat ) const
|
||||||
{
|
{
|
||||||
int i;
|
if( m_aBGChanges.empty() )
|
||||||
for( i=0; i<(int)(m_aBGChanges.size()) - 1; i++ )
|
|
||||||
if( fBeat < m_aBGChanges[i+1].m_fStartBeat )
|
|
||||||
return i;
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
if( fBeat < m_aBGChanges[0].m_fStartBeat )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// assumption: m_aBGChanges are sorted by m_fStartBeat
|
||||||
|
for( int i=m_aBGChanges.size()-1; i>=0; i-- )
|
||||||
|
{
|
||||||
|
if( fBeat >= m_aBGChanges[i].m_fStartBeat )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the BG segment has changed, move focus to it. Send Update() calls. */
|
/* If the BG segment has changed, move focus to it. Send Update() calls. */
|
||||||
|
|||||||
Reference in New Issue
Block a user