From 4b0fa9aae6b607cbe1e310b0fb8c0d2dce6eaa8f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 19 Jan 2003 03:49:37 +0000 Subject: [PATCH] make select style graphics optional. (they're one of the few game- specific graphics in the default theme, so be tolerant if they're missing) --- stepmania/src/ScreenSelectStyle.cpp | 51 ++++++++++++++++++++--------- stepmania/src/ScreenSelectStyle.h | 3 +- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 327b81629f..0d8593abb2 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -59,11 +59,29 @@ ScreenSelectStyle::ScreenSelectStyle() unsigned i; for( i=0; iGetPathTo("Graphics",ssprintf("select style icons %s",GAMESTATE->GetCurrentGameDef()->m_szName) ) ); - m_sprIcon[i].StopAnimating(); - m_sprIcon[i].SetState( i ); - m_sprIcon[i].SetXY( ICONS_START_X + i*ICONS_SPACING_X, ICONS_START_Y + i*ICONS_SPACING_Y ); - this->AddChild( &m_sprIcon[i] ); + CString IconPath = THEME->GetPathToOptional("Graphics",ssprintf("select style icons %s",GAMESTATE->GetCurrentGameDef()->m_szName) ); + if(IconPath.empty()) + { + BitmapText *b = new BitmapText; + b->LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + b->SetText(GAMEMAN->GetStyleDefForStyle( m_aPossibleStyles[i] )->m_szName); + b->SetDiffuse(RageColor(.5,.5,.5,1)); + b->SetZoom(0.5f); + m_sprIcon[i] = b; + IconsAreText = true; + } + else + { + Sprite *s = new Sprite; + s->Load( IconPath ); + s->StopAnimating(); + s->SetState( i ); + m_sprIcon[i] = s; + IconsAreText = false; + } + + m_sprIcon[i]->SetXY( ICONS_START_X + i*ICONS_SPACING_X, ICONS_START_Y + i*ICONS_SPACING_Y ); + this->AddChild( m_sprIcon[i] ); } UpdateEnabledDisabled(); @@ -85,8 +103,8 @@ ScreenSelectStyle::ScreenSelectStyle() // Load dummy Sprites for( i=0; iGetPathTo("Graphics",ssprintf("select style preview %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); - m_sprDummyInfo[i].Load( THEME->GetPathTo("Graphics",ssprintf("select style info %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); + m_sprDummyPreview[i].Load( THEME->GetPathToOptional("Graphics",ssprintf("select style preview %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); + m_sprDummyInfo[i].Load( THEME->GetPathToOptional("Graphics",ssprintf("select style info %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); } @@ -154,18 +172,18 @@ void ScreenSelectStyle::HandleScreenMessage( const ScreenMessage SM ) void ScreenSelectStyle::BeforeChange() { - m_sprIcon[m_iSelection].SetEffectNone(); + m_sprIcon[m_iSelection]->SetEffectNone(); } void ScreenSelectStyle::AfterChange() { - m_sprIcon[m_iSelection].SetEffectGlowing(); + m_sprIcon[m_iSelection]->SetEffectGlowing(); const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef(); const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle( m_aPossibleStyles[m_iSelection] ); // Tween Preview - m_sprPreview.Load( THEME->GetPathTo("Graphics",ssprintf("select style preview %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); + m_sprPreview.Load( THEME->GetPathToOptional("Graphics",ssprintf("select style preview %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); m_sprPreview.StopTweening(); m_sprPreview.SetGlow( RageColor(1,1,1,0) ); @@ -186,7 +204,7 @@ void ScreenSelectStyle::AfterChange() // Tween Info - m_sprInfo.Load( THEME->GetPathTo("Graphics",ssprintf("select style info %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); + m_sprInfo.Load( THEME->GetPathToOptional("Graphics",ssprintf("select style info %s %s",pGameDef->m_szName,pStyleDef->m_szName)) ); m_sprInfo.StopTweening(); m_sprInfo.SetZoomY( 0 ); m_sprInfo.BeginTweening( 0.5f, Actor::TWEEN_BOUNCE_END ); @@ -285,7 +303,7 @@ void ScreenSelectStyle::MenuBack( PlayerNumber pn ) void ScreenSelectStyle::TweenOnScreen() { for( unsigned i=0; iFadeOn( (m_aPossibleStyles.size()-i)*0.05f, "Left Accelerate", MENU_ELEMENTS_TWEEN_TIME ); m_sprExplanation.FadeOn( 0, "Right Accelerate", MENU_ELEMENTS_TWEEN_TIME ); @@ -295,7 +313,7 @@ void ScreenSelectStyle::TweenOnScreen() void ScreenSelectStyle::TweenOffScreen() { for( unsigned i=0; iFadeOff( 0, "FoldY", MENU_ELEMENTS_TWEEN_TIME ); m_sprExplanation.FadeOff( 0, "FoldY", MENU_ELEMENTS_TWEEN_TIME ); @@ -330,10 +348,13 @@ void ScreenSelectStyle::UpdateEnabledDisabled() * will be undone by the tween. Hmm. */ for( i=0; iSetDiffuse( IconsAreText? RageColor(0.75f, 0.75f, 0.75f, 1): + RageColor(1,1,1,1) ); else - m_sprIcon[i].SetDiffuse( RageColor(0.25f,0.25f,0.25f,1) ); + m_sprIcon[i]->SetDiffuse( RageColor(0.25f,0.25f,0.25f,1) ); } // Select first enabled style diff --git a/stepmania/src/ScreenSelectStyle.h b/stepmania/src/ScreenSelectStyle.h index aef43f87a5..a66138d229 100644 --- a/stepmania/src/ScreenSelectStyle.h +++ b/stepmania/src/ScreenSelectStyle.h @@ -46,7 +46,8 @@ private: MenuElements m_Menu; - Sprite m_sprIcon[NUM_STYLES]; + Actor *m_sprIcon[NUM_STYLES]; + bool IconsAreText; Sprite m_sprExplanation; Sprite m_sprPreview; Sprite m_sprInfo;