implement not changing banners when fast if banners aren't preloaded
This commit is contained in:
@@ -22,6 +22,7 @@ static const float FadeTime = 0.25;
|
|||||||
|
|
||||||
FadingBanner::FadingBanner()
|
FadingBanner::FadingBanner()
|
||||||
{
|
{
|
||||||
|
m_bMovingFast = false;
|
||||||
m_iIndexFront = 0;
|
m_iIndexFront = 0;
|
||||||
for( int i=0; i<2; i++ )
|
for( int i=0; i<2; i++ )
|
||||||
this->AddChild( &m_Banner[i] );
|
this->AddChild( &m_Banner[i] );
|
||||||
@@ -86,9 +87,13 @@ void FadingBanner::BeforeChange()
|
|||||||
/* If this returns false, the banner couldn't be loaded. */
|
/* If this returns false, the banner couldn't be loaded. */
|
||||||
bool FadingBanner::LoadFromCachedBanner( const CString &path )
|
bool FadingBanner::LoadFromCachedBanner( const CString &path )
|
||||||
{
|
{
|
||||||
|
/* No matter what we load, ensure we don't fade to a stale path. */
|
||||||
|
m_sPendingBanner = "";
|
||||||
|
|
||||||
if( TEXTUREMAN->IsTextureRegistered( Banner::BannerTex( path ) ) )
|
if( TEXTUREMAN->IsTextureRegistered( Banner::BannerTex( path ) ) )
|
||||||
{
|
{
|
||||||
/* The actual file is already cached. Use it. */
|
/* The actual file is already cached. Use it. */
|
||||||
|
BeforeChange();
|
||||||
m_Banner[GetBackIndex()].Load( Banner::BannerTex(path) );
|
m_Banner[GetBackIndex()].Load( Banner::BannerTex(path) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -98,6 +103,7 @@ bool FadingBanner::LoadFromCachedBanner( const CString &path )
|
|||||||
if( !TEXTUREMAN->IsTextureRegistered(ID) )
|
if( !TEXTUREMAN->IsTextureRegistered(ID) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
BeforeChange();
|
||||||
m_Banner[GetBackIndex()].Load( ID );
|
m_Banner[GetBackIndex()].Load( ID );
|
||||||
m_sPendingBanner = path;
|
m_sPendingBanner = path;
|
||||||
m_PendingTimer.GetDeltaTime(); /* reset */
|
m_PendingTimer.GetDeltaTime(); /* reset */
|
||||||
@@ -107,10 +113,20 @@ bool FadingBanner::LoadFromCachedBanner( const CString &path )
|
|||||||
|
|
||||||
void FadingBanner::LoadFromSong( Song* pSong )
|
void FadingBanner::LoadFromSong( Song* pSong )
|
||||||
{
|
{
|
||||||
BeforeChange();
|
|
||||||
|
|
||||||
if( !LoadFromCachedBanner(pSong->GetBannerPath()) )
|
if( !LoadFromCachedBanner(pSong->GetBannerPath()) )
|
||||||
m_Banner[GetBackIndex()].LoadFromSong( pSong );
|
{
|
||||||
|
/* Oops. We couldn't load a banner quickly. We can load the actual
|
||||||
|
* banner, but that's slow, so we don't want to do that when we're moving
|
||||||
|
* fast on the music wheel. In that case, we should just keep the banner
|
||||||
|
* that's there (or load a "moving fast" banner). Once we settle down,
|
||||||
|
* we'll get called again and load the real banner. */
|
||||||
|
|
||||||
|
if( !m_bMovingFast )
|
||||||
|
{
|
||||||
|
BeforeChange();
|
||||||
|
m_Banner[GetBackIndex()].LoadFromSong( pSong );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadingBanner::LoadAllMusic()
|
void FadingBanner::LoadAllMusic()
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public:
|
|||||||
void LoadRandom();
|
void LoadRandom();
|
||||||
void LoadFallback();
|
void LoadFallback();
|
||||||
|
|
||||||
|
void SetMovingFast( bool fast ) { m_bMovingFast=fast; }
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ protected:
|
|||||||
|
|
||||||
CString m_sPendingBanner;
|
CString m_sPendingBanner;
|
||||||
RageTimer m_PendingTimer;
|
RageTimer m_PendingTimer;
|
||||||
|
bool m_bMovingFast;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -778,6 +778,7 @@ void ScreenSelectMusic::AfterMusicChange()
|
|||||||
m_arrayNotes[pn].clear();
|
m_arrayNotes[pn].clear();
|
||||||
|
|
||||||
bool no_banner_change = false;
|
bool no_banner_change = false;
|
||||||
|
m_Banner.SetMovingFast( !!m_MusicWheel.IsMoving() );
|
||||||
// if(PREFSMAN->m_BannerCacheType == PREFSMAN->preload_none && m_MusicWheel.IsMoving())
|
// if(PREFSMAN->m_BannerCacheType == PREFSMAN->preload_none && m_MusicWheel.IsMoving())
|
||||||
// {
|
// {
|
||||||
/* If we're moving fast and we didn't preload banners, don't touch it. */
|
/* If we're moving fast and we didn't preload banners, don't touch it. */
|
||||||
|
|||||||
Reference in New Issue
Block a user