From 4bdc608b1ca399124177ab353490c3481e5798a7 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 8 Mar 2004 02:50:46 +0000 Subject: [PATCH] move empty score name logic into HighScore add FOV to ScreenNameEntryTraditional --- stepmania/Themes/default/metrics.ini | 3 ++- stepmania/src/HighScore.cpp | 12 +++++++++ stepmania/src/HighScore.h | 3 +++ stepmania/src/ScreenNameEntryTraditional.cpp | 27 +++++++++++++++----- stepmania/src/ScreenNameEntryTraditional.h | 1 + stepmania/src/ScreenRanking.cpp | 18 +++---------- 6 files changed, 43 insertions(+), 21 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index e45afdb704..a16513d2ed 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -3496,7 +3496,6 @@ NextScreen=ScreenUnlock SecondsPerPage=10 PageFadeSeconds=1.0 -EmptyScoreName=STEP NoScoreName=STEP RowSpacingX=0 @@ -4279,6 +4278,8 @@ VerificationInstructions= 07=D Failed=E +[HighScore] +EmptyName=STEP diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index 1aaeb3ebf5..7a4909c448 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -13,6 +13,10 @@ #include "HighScore.h" #include "PrefsManager.h" #include "GameConstantsAndTypes.h" +#include "ThemeManager.h" + +#define EMPTY_NAME THEME->GetMetric ("HighScore","EmptyName") + bool HighScore::operator>=( const HighScore& other ) const { @@ -73,6 +77,14 @@ void HighScore::LoadFromNode( const XNode* pNode ) grade = clamp( grade, GRADE_TIER_1, GRADE_FAILED ); } +CString HighScore::GetDisplayName() const +{ + if( sName.empty() ) + return EMPTY_NAME; + else + return sName; +} + void HighScoreList::Init() { diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index 9061bb1017..879a93cf5f 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -24,6 +24,7 @@ struct HighScore float fSurviveSeconds; CString sModifiers; + HighScore() { grade = GRADE_NO_DATA; @@ -36,6 +37,8 @@ struct HighScore XNode* CreateNode() const; void LoadFromNode( const XNode* pNode ); + + CString GetDisplayName() const; }; struct HighScoreList diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index 7185fd9e5a..d2da5e8cb8 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -32,11 +32,13 @@ #include #include "ProfileManager.h" #include "StageStats.h" +#include "RageDisplay.h" // // Defines specific to ScreenNameEntryTraditional // +#define FOV THEME->GetMetricF(m_sName,"FOV") #define ALPHABET_GAP_X THEME->GetMetricF(m_sName,"AlphabetGapX") #define NUM_ALPHABET_DISPLAYED THEME->GetMetricI(m_sName,"NumAlphabetDisplayed") #define MAX_RANKING_NAME_LENGTH THEME->GetMetricI(m_sName,"MaxRankingNameLength") @@ -66,7 +68,7 @@ void HighScoreWheelItem::Load( int iRankIndex, const HighScore& hs ) m_textName.SetName( "Name" ); m_textName.LoadFromFont( THEME->GetPathF(m_sName,"name") ); - m_textName.SetText( hs.sName ); + m_textName.SetText( hs.GetDisplayName() ); this->AddChild( &m_textName ); SET_XY_AND_ON_COMMAND( m_textName ); @@ -80,6 +82,12 @@ void HighScoreWheelItem::Load( int iRankIndex, const HighScore& hs ) SET_XY_AND_ON_COMMAND( m_textScore ); } +void HighScoreWheelItem::LoadBlank( int iRankIndex ) +{ + HighScore hs; + Load( iRankIndex, hs ); +} + void HighScoreWheelItem::ShowFocus() { CString sCommand = "diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1"; @@ -90,16 +98,18 @@ void HighScoreWheelItem::ShowFocus() void HighScoreWheel::Load( const HighScoreList& hsl, int iIndexToFocus ) { - int iSize = hsl.vHighScores.size(); - m_Items.resize( iSize ); - for( int i=0; im_iMaxHighScoresPerList ); + for( int i=0; im_iMaxHighScoresPerList; i++ ) { - m_Items[i].Load( i, hsl.vHighScores[i] ); + if( i < hsl.vHighScores.size() ) + m_Items[i].Load( i, hsl.vHighScores[i] ); + else + m_Items[i].LoadBlank( i ); this->AddChild( &m_Items[i] ); } m_iIndexToFocus = iIndexToFocus; - if( m_iIndexToFocus >= 0 && m_iIndexToFocus < iSize ) + if( m_iIndexToFocus >= 0 && m_iIndexToFocus < hsl.vHighScores.size() ) m_Items[m_iIndexToFocus].ShowFocus(); ActorScroller::Load( @@ -462,9 +472,14 @@ void ScreenNameEntryTraditional::Update( float fDelta ) void ScreenNameEntryTraditional::DrawPrimitives() { + DISPLAY->CameraPushMatrix(); + DISPLAY->LoadMenuPerspective( FOV, CENTER_X, CENTER_Y ); + m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); m_Menu.DrawTopLayer(); + + DISPLAY->CameraPopMatrix(); } void ScreenNameEntryTraditional::ChangeDisplayedFeat() diff --git a/stepmania/src/ScreenNameEntryTraditional.h b/stepmania/src/ScreenNameEntryTraditional.h index a7c26110dc..747cfbd78b 100644 --- a/stepmania/src/ScreenNameEntryTraditional.h +++ b/stepmania/src/ScreenNameEntryTraditional.h @@ -24,6 +24,7 @@ class HighScoreWheelItem : public ActorFrame { public: void Load( int iRankIndex, const HighScore& hs ); + void LoadBlank( int iRankIndex ); void ShowFocus(); BitmapText m_textRank; diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index 08870e9a02..86dd276727 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -37,7 +37,6 @@ #define PAGE_FADE_SECONDS THEME->GetMetricF("ScreenRanking","PageFadeSeconds") #define PERCENT_DECIMAL_PLACES THEME->GetMetricI("ScreenRanking","PercentDecimalPlaces") #define PERCENT_TOTAL_SIZE THEME->GetMetricI("ScreenRanking","PercentTotalSize") -#define EMPTY_SCORE_NAME THEME->GetMetric ("ScreenRanking","EmptyScoreName") #define NO_SCORE_NAME THEME->GetMetric ("ScreenRanking","NoScoreName") #define ROW_SPACING_X THEME->GetMetricF("ScreenRanking","RowSpacingX") @@ -686,10 +685,8 @@ float ScreenRanking::SetPage( PageToShow pts ) { hs.sName = NO_SCORE_NAME; } - if( hs.sName.empty() ) - hs.sName = EMPTY_SCORE_NAME; - m_textNames[l].SetText( hs.sName ); + m_textNames[l].SetText( hs.GetDisplayName() ); m_textScores[l].SetText( ssprintf("%09i",hs.iScore) ); m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) ); m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) ); @@ -729,10 +726,7 @@ float ScreenRanking::SetPage( PageToShow pts ) hs.sName = NO_SCORE_NAME; } - if( hs.sName.empty() ) - hs.sName = EMPTY_SCORE_NAME; - - m_textNames[l].SetText( hs.sName ); + m_textNames[l].SetText( hs.GetDisplayName() ); if( pts.pCourse->IsOni() ) { m_textPoints[l].SetText( ssprintf("%04d",hs.iScore) ); @@ -796,11 +790,9 @@ float ScreenRanking::SetPage( PageToShow pts ) { hs.sName = NO_SCORE_NAME; } - if( hs.sName.empty() ) - hs.sName = EMPTY_SCORE_NAME; CString s; - s = hs.sName + "\n"; + s = hs.GetDisplayName() + "\n"; s += ssprintf( "%0*.*f%%", PERCENT_TOTAL_SIZE, PERCENT_DECIMAL_PLACES, hs.fPercentDP*100 ); pTextStepsScore->SetText( s ); } @@ -835,11 +827,9 @@ float ScreenRanking::SetPage( PageToShow pts ) { hs.sName = NO_SCORE_NAME; } - if( hs.sName.empty() ) - hs.sName = EMPTY_SCORE_NAME; CString s; - s = hs.sName + "\n"; + s = hs.GetDisplayName() + "\n"; s += ssprintf( "%0*.*f%%", PERCENT_TOTAL_SIZE, PERCENT_DECIMAL_PLACES, hs.fPercentDP*100 ); pTextStepsScore->SetText( s ); }