more banners

separate command for fading from low res
This commit is contained in:
Glenn Maynard
2005-04-23 10:19:47 +00:00
parent f52f45d2ca
commit c401a65864
3 changed files with 28 additions and 18 deletions
+21 -14
View File
@@ -29,7 +29,7 @@ FadingBanner::FadingBanner()
m_bMovingFast = false; m_bMovingFast = false;
m_bSkipNextBannerUpdate = false; m_bSkipNextBannerUpdate = false;
m_iIndexLatest = 0; m_iIndexLatest = 0;
for( int i=0; i<3; i++ ) for( int i=0; i<NUM_BANNERS; i++ )
{ {
m_Banner[i].SetName( "Banner" ); m_Banner[i].SetName( "Banner" );
ActorUtil::OnCommand( m_Banner[i], "FadingBanner" ); ActorUtil::OnCommand( m_Banner[i], "FadingBanner" );
@@ -41,7 +41,7 @@ FadingBanner::FadingBanner()
void FadingBanner::ScaleToClipped( float fWidth, float fHeight ) void FadingBanner::ScaleToClipped( float fWidth, float fHeight )
{ {
for( int i=0; i<3; i++ ) for( int i=0; i<NUM_BANNERS; i++ )
m_Banner[i].ScaleToClipped( fWidth, fHeight ); m_Banner[i].ScaleToClipped( fWidth, fHeight );
} }
@@ -53,9 +53,8 @@ void FadingBanner::Update( float fDeltaTime )
if( !m_bSkipNextBannerUpdate ) if( !m_bSkipNextBannerUpdate )
{ {
m_Banner[0].Update( fDeltaTime ); for( int i = 0; i < NUM_BANNERS; ++i )
m_Banner[1].Update( fDeltaTime ); m_Banner[i].Update( fDeltaTime );
m_Banner[2].Update( fDeltaTime );
} }
m_bSkipNextBannerUpdate = false; m_bSkipNextBannerUpdate = false;
@@ -67,28 +66,36 @@ void FadingBanner::DrawPrimitives()
// ActorFrame::DrawPrimitives(); // ActorFrame::DrawPrimitives();
/* Render the latest banner first. */ /* Render the latest banner first. */
for( int i = 0; i < 3; ++i ) for( int i = 0; i < NUM_BANNERS; ++i )
{ {
int index = m_iIndexLatest - i; int index = m_iIndexLatest - i;
wrap( index, 3 ); wrap( index, NUM_BANNERS );
m_Banner[index].Draw(); m_Banner[index].Draw();
} }
} }
bool FadingBanner::Load( RageTextureID ID ) bool FadingBanner::Load( RageTextureID ID, bool bLowResToHighRes )
{ {
BeforeChange(); BeforeChange( bLowResToHighRes );
bool bRet = m_Banner[m_iIndexLatest].Load(ID); bool bRet = m_Banner[m_iIndexLatest].Load(ID);
return bRet; return bRet;
} }
void FadingBanner::BeforeChange() /* If bFromLowRes is true, we're fading from a low-res banner to the corresponding
* high-res banner. */
void FadingBanner::BeforeChange( bool bLowResToHighRes )
{ {
m_Banner[m_iIndexLatest].PlayCommand( "FadeOff" ); CString sCommand;
++m_iIndexLatest; if( bLowResToHighRes )
wrap( m_iIndexLatest, 3 ); sCommand = "FadeFromCached";
else
sCommand = "FadeOff";
m_Banner[m_iIndexLatest].PlayCommand( "FadeOn" ); m_Banner[m_iIndexLatest].PlayCommand( sCommand );
++m_iIndexLatest;
wrap( m_iIndexLatest, NUM_BANNERS );
m_Banner[m_iIndexLatest].PlayCommand( "ResetFade" );
/* We're about to load a banner. It'll probably cause a frame skip or /* We're about to load a banner. It'll probably cause a frame skip or
* two. Skip an update, so the fade-in doesn't skip. */ * two. Skip an update, so the fade-in doesn't skip. */
+6 -3
View File
@@ -36,7 +36,9 @@ public:
void ScaleToClipped( float fWidth, float fHeight ); void ScaleToClipped( float fWidth, float fHeight );
bool Load( RageTextureID ID ); /* If you previously loaded a cached banner, and are now loading the full-
* resolution banner, set bLowResToHighRes to true. */
bool Load( RageTextureID ID, bool bLowResToHighRes=false );
void LoadFromSong( const Song* pSong ); // NULL means no song void LoadFromSong( const Song* pSong ); // NULL means no song
void LoadAllMusic(); void LoadAllMusic();
void LoadMode(); void LoadMode();
@@ -56,9 +58,10 @@ public:
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
protected: protected:
void BeforeChange(); void BeforeChange( bool bLowResToHighRes=false );
Banner m_Banner[3]; enum { NUM_BANNERS = 5 };
Banner m_Banner[NUM_BANNERS];
int m_iIndexLatest; int m_iIndexLatest;
bool m_bMovingFast; bool m_bMovingFast;
+1 -1
View File
@@ -743,7 +743,7 @@ void ScreenSelectMusic::CheckBackgroundRequests()
} }
g_bBannerWaiting = false; g_bBannerWaiting = false;
m_Banner.Load( sPath ); m_Banner.Load( sPath, true );
if( bFreeCache ) if( bFreeCache )
m_BackgroundLoader.FinishedWithCachedFile( g_sBannerPath ); m_BackgroundLoader.FinishedWithCachedFile( g_sBannerPath );