From 2dfb994fe0b5328b70be54b5fa438ac7111a82f3 Mon Sep 17 00:00:00 2001 From: Andrew Livy Date: Fri, 19 Dec 2003 09:30:54 +0000 Subject: [PATCH] Added: TotalScore element on Evaluation Screen Title, Artist and Current Character Icon's for the Stage Screen --- stepmania/src/Character.cpp | 26 ++++++++++ stepmania/src/Character.h | 1 + stepmania/src/ScreenEvaluation.cpp | 51 ++++++++++++++++++- stepmania/src/ScreenEvaluation.h | 4 ++ stepmania/src/ScreenSelectMusic.cpp | 3 ++ stepmania/src/ScreenSelectMusic.h | 3 ++ stepmania/src/ScreenStage.cpp | 78 ++++++++++++++++++++++++++++- stepmania/src/ScreenStage.h | 10 ++++ 8 files changed, 172 insertions(+), 4 deletions(-) diff --git a/stepmania/src/Character.cpp b/stepmania/src/Character.cpp index 915c45096c..4c78ff2548 100644 --- a/stepmania/src/Character.cpp +++ b/stepmania/src/Character.cpp @@ -103,6 +103,32 @@ CString Character::GetSongSelectIconPath() const return as[0]; } +CString Character::GetStageIconPath() const +{ + CStringArray as; + // first try and find an icon specific to the select music screen + // so you can have different icons for music select / char select + GetDirListing( m_sCharDir+"stageicon.png", as, false, true ); + GetDirListing( m_sCharDir+"stageicon.jpg", as, false, true ); + GetDirListing( m_sCharDir+"stageicon.gif", as, false, true ); + GetDirListing( m_sCharDir+"stageicon.bmp", as, false, true ); + + if( as.empty() ) + { + // if that failed, try using the regular icon + GetDirListing( m_sCharDir+"card.png", as, false, true ); + GetDirListing( m_sCharDir+"card.jpg", as, false, true ); + GetDirListing( m_sCharDir+"card.gif", as, false, true ); + GetDirListing( m_sCharDir+"card.bmp", as, false, true ); + if( as.empty() ) + return ""; + else + return as[0]; + } + else + return as[0]; +} + CString Character::GetCardPath() const { CStringArray as; diff --git a/stepmania/src/Character.h b/stepmania/src/Character.h index 378dcc4e8b..604fe64dc2 100644 --- a/stepmania/src/Character.h +++ b/stepmania/src/Character.h @@ -30,6 +30,7 @@ public: CString GetWarmUpAnimationPath() const; CString GetDanceAnimationPath() const; CString GetSongSelectIconPath() const; + CString GetStageIconPath() const; bool Has2DElems(); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 76342cecf6..313724381b 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -34,6 +34,7 @@ const int NUM_SCORE_DIGITS = 9; + // metrics that are common to all ScreenEvaluation classes #define BANNER_WIDTH THEME->GetMetricF("ScreenEvaluation","BannerWidth") #define BANNER_HEIGHT THEME->GetMetricF("ScreenEvaluation","BannerHeight") @@ -63,6 +64,7 @@ const char* STATS_STRING[NUM_STATS_LINES] = #define SHOW_JUDGMENT( l ) THEME->GetMetricB(m_sName,ssprintf("Show%s",JUDGE_STRING[l])) #define SHOW_STAT( s ) THEME->GetMetricB(m_sName,ssprintf("Show%s",STATS_STRING[l])) #define SHOW_SCORE_AREA THEME->GetMetricB(m_sName,"ShowScoreArea") +#define SHOW_TOTAL_SCORE_AREA THEME->GetMetricB(m_sName,"ShowTotalScoreArea") #define SHOW_TIME_AREA THEME->GetMetricB(m_sName,"ShowTimeArea") #define SHOW_GRAPH_AREA THEME->GetMetricB(m_sName,"ShowGraphArea") #define SHOW_COMBO_AREA THEME->GetMetricB(m_sName,"ShowComboArea") @@ -257,8 +259,6 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) m_SoundSequences.push_back(temp); } } - m_timerSoundSequences.SetZero(); // zero the sound sequence timer - m_timerSoundSequences.Touch(); // set the timer going :] m_bPassFailTriggered = false; // the sound hasn't been triggered yet if(m_bFailed && m_Type==stage) { @@ -650,6 +650,39 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) } } + if( SHOW_TOTAL_SCORE_AREA ) + { + m_sprTotalScoreLabel.Load( THEME->GetPathToG("ScreenEvaluation totalscore labels 1x2") ); + m_sprTotalScoreLabel.SetState( 0 ); + m_sprTotalScoreLabel.StopAnimating(); + m_sprTotalScoreLabel.SetName( "TotalScoreLabel" ); + UtilSetXYAndOnCommand( m_sprTotalScoreLabel, "ScreenEvaluation" ); + this->AddChild( &m_sprTotalScoreLabel ); + + for( p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + continue; // skip + + int iTotalScore=0; + + int i=0; + for(i=0; im_vPlayedStageStats.size();i++) + iTotalScore += GAMESTATE->m_vPlayedStageStats[i].iScore[p]; + + iTotalScore += stageStats.iScore[p]; + + m_textTotalScore[p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation totalscore") ); + m_textTotalScore[p].EnableShadow( false ); + m_textTotalScore[p].SetDiffuse( PlayerToColor(p) ); + m_textTotalScore[p].SetName( ssprintf("TotalScoreNumberP%d",p+1) ); + m_textTotalScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS+2, iTotalScore) ); + UtilSetXYAndOnCommand( m_textTotalScore[p], "ScreenEvaluation" ); + + this->AddChild( &m_textTotalScore[p] ); + } + } + // // init time area // @@ -791,6 +824,8 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) SOUND->PlayMusic( THEME->GetPathToS("ScreenEvaluation music") ); + m_timerSoundSequences.SetZero(); // zero the sound sequence timer + m_timerSoundSequences.Touch(); // set the timer going :] m_fScreenCreateTime = RageTimer::GetTimeSinceStart(); } @@ -1075,6 +1110,18 @@ void ScreenEvaluation::TweenOffScreen() } } + // total score area + if( SHOW_TOTAL_SCORE_AREA ) + { + UtilOffCommand( m_sprTotalScoreLabel, "ScreenEvaluation" ); + for( p=0; pIsPlayerEnabled(p) ) + continue; + UtilOffCommand( m_textTotalScore[p], "ScreenEvaluation" ); + } + } + // time area if( SHOW_TIME_AREA ) { diff --git a/stepmania/src/ScreenEvaluation.h b/stepmania/src/ScreenEvaluation.h index 3ee45de7b0..da4257aacf 100644 --- a/stepmania/src/ScreenEvaluation.h +++ b/stepmania/src/ScreenEvaluation.h @@ -120,6 +120,10 @@ protected: Sprite m_sprScoreLabel; BitmapText m_textScore[NUM_PLAYERS]; + // total score area + Sprite m_sprTotalScoreLabel; + BitmapText m_textTotalScore[NUM_PLAYERS]; + // time area Sprite m_sprTimeLabel; BitmapText m_textTime[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 2ba0c47895..09ce0d3506 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -296,6 +296,9 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : Screen( sClassName m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); // invisible //this->AddChild( &m_sprOptionsMessage ); // we have to draw this manually over the top of transitions + m_bgOverlay.SetName( "BGAOverlay"); + m_bgOverlay.LoadFromAniDir( THEME->GetPathToB("ScreenSelectMusic Overlay")); + this->AddChild( &m_bgOverlay ); m_soundSelect.Load( THEME->GetPathToS("Common start") ); m_soundChangeNotes.Load( THEME->GetPathToS("ScreenSelectMusic difficulty") ); diff --git a/stepmania/src/ScreenSelectMusic.h b/stepmania/src/ScreenSelectMusic.h index ea91c4651d..1a0ebec8d0 100644 --- a/stepmania/src/ScreenSelectMusic.h +++ b/stepmania/src/ScreenSelectMusic.h @@ -29,6 +29,7 @@ #include "HelpDisplay.h" #include "PaneDisplay.h" #include "Character.h" +#include "BGAnimation.h" class ScreenSelectMusic : public Screen { @@ -111,6 +112,8 @@ protected: float m_fSampleStartSeconds, m_fSampleLengthSeconds; bool m_bAllowOptionsMenu, m_bAllowOptionsMenuRepeat; + BGAnimation m_bgOverlay; + RageSound m_soundSelect; RageSound m_soundChangeNotes; RageSound m_soundOptionsChange; diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index 3a2369e961..82017384f3 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -1,4 +1,5 @@ #include "global.h" +#include "ActorUtil.h" /* ----------------------------------------------------------------------------- Class: ScreenStage @@ -23,7 +24,7 @@ #include "RageSounds.h" #include "ThemeManager.h" #include "LightsManager.h" - +#include "Song.h" #define NEXT_SCREEN THEME->GetMetric ("ScreenStage","NextScreen") @@ -63,6 +64,8 @@ ScreenStage::ScreenStage( CString sClassName ) : Screen( sClassName ) m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenStage "+GAMESTATE->GetStageText()) ); this->AddChild( &m_Background ); + m_Overlay.LoadFromAniDir( THEME->GetPathToB("ScreenStage Overlay")); + m_In.Load( THEME->GetPathToB("ScreenStage in") ); m_In.StartTransitioning(); this->AddChild( &m_In ); @@ -72,7 +75,7 @@ ScreenStage::ScreenStage( CString sClassName ) : Screen( sClassName ) m_Back.Load( THEME->GetPathToB("Common back") ); this->AddChild( &m_Back ); - + /* Prep the new screen once the animation is complete. This way, we * start loading the gameplay screen as soon as possible. */ this->PostScreenMessage( SM_PrepScreen, m_Background.GetLengthSeconds() ); @@ -88,6 +91,45 @@ ScreenStage::ScreenStage( CString sClassName ) : Screen( sClassName ) this->PostScreenMessage( SM_BeginFadingOut, fStartFadingOutSeconds ); + int p; + for( p=0; pm_pCurCharacters[p]; + m_sprCharacterIcon[p].SetName( ssprintf("CharacterIconP%d",p+1) ); + m_sprCharacterIcon[p].Load( pChar->GetStageIconPath() ); + SET_XY( m_sprCharacterIcon[p] ); + // this->AddChild( &m_sprCharacterIcon[p] ); + ON_COMMAND( m_sprCharacterIcon[p] ); + } + + m_SongTitle.SetName( "SongTitle"); + m_Artist.SetName( "Artist" ); + m_SongTitle.LoadFromFont( THEME->GetPathToF("ScreenStage Title") ); + m_Artist.LoadFromFont( THEME->GetPathToF("ScreenStage Artist") ); + + if(GAMESTATE->m_pCurSong != NULL) + { + m_SongTitle.SetText( GAMESTATE->m_pCurSong->m_sMainTitle ); + m_Artist.SetText( GAMESTATE->m_pCurSong->m_sArtist ); + } + else + { + m_SongTitle.SetText( "" ); + m_Artist.SetText( "" ); + } + + SET_XY( m_Artist ); + SET_XY( m_SongTitle ); + ON_COMMAND( m_Artist ); + ON_COMMAND( m_SongTitle ); + + if ( PREFSMAN->m_bShowBanners ) + if( GAMESTATE->m_pCurSong != NULL) + if( GAMESTATE->m_pCurSong->HasBanner() ) + m_Banner.LoadFromSong( GAMESTATE->m_pCurSong ); + m_Banner.SetName("Banner"); + SET_XY( m_Banner ); + ON_COMMAND(m_Banner); //g_StageType = (StageType)STAGE_TYPE; @@ -567,11 +609,35 @@ ScreenStage::ScreenStage( CString sClassName ) : Screen( sClassName ) void ScreenStage::Update( float fDeltaTime ) { Screen::Update( fDeltaTime ); + int p; + for( p=0; pm_bShowBanners ) + if( GAMESTATE->m_pCurSong != NULL) + if( GAMESTATE->m_pCurSong->HasBanner() ) + m_Banner.Update(fDeltaTime); + m_SongTitle.Update(fDeltaTime); + m_Artist.Update(fDeltaTime); } void ScreenStage::DrawPrimitives() { Screen::DrawPrimitives(); + int p; + for( p=0; pm_bShowBanners ) + if( GAMESTATE->m_pCurSong != NULL) + if( GAMESTATE->m_pCurSong->HasBanner() ) + m_Banner.Draw(); + m_SongTitle.Draw(); + m_Artist.Draw(); } void ScreenStage::HandleScreenMessage( const ScreenMessage SM ) @@ -583,6 +649,14 @@ void ScreenStage::HandleScreenMessage( const ScreenMessage SM ) break; case SM_BeginFadingOut: m_Out.StartTransitioning( SM_GoToNextScreen ); + int p; + for( p=0; p