diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 63c65dbccf..ca27eb219d 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -11,6 +11,8 @@ */ /* Obsolete: use DifficultyClass. */ +/* DifficultyClass was the old name for enum Difficulty, right? -Chris */ + #include "DifficultyIcon.h" #include "RageUtil.h" #include "GameConstantsAndTypes.h" @@ -43,21 +45,27 @@ bool DifficultyIcon::Load( CString sPath ) void DifficultyIcon::SetFromNotes( PlayerNumber pn, Steps* pNotes ) { if( pNotes == NULL ) - { - SetDiffuse( RageColor(1,1,1,0) ); - return; - } + SetHidden(true); else + SetFromDifficulty( pn, pNotes->GetDifficulty() ); +} + +void DifficultyIcon::SetFromDifficulty( PlayerNumber pn, Difficulty dc ) +{ + switch( GetNumStates() ) { - SetDiffuse( RageColor(1,1,1,1) ); + case NUM_DIFFICULTIES: SetState( dc ); break; + case NUM_DIFFICULTIES*2: SetState( dc*2+pn ); break; + default: ASSERT(0); + } +} - int iStateNo = pNotes->GetDifficulty(); - - switch( GetNumStates() ) - { - case NUM_DIFFICULTIES: SetState( iStateNo ); break; - case NUM_DIFFICULTIES*2: SetState( iStateNo*2+pn ); break; - default: SetState( 0 ); break; - } +void DifficultyIcon::SetFromCourseDifficulty( PlayerNumber pn, CourseDifficulty cd ) +{ + switch( cd ) + { + case COURSE_DIFFICULTY_REGULAR: SetFromDifficulty(pn,DIFFICULTY_MEDIUM); break; + case COURSE_DIFFICULTY_DIFFICULT: SetFromDifficulty(pn,DIFFICULTY_HARD); break; + default: ASSERT(0); } } diff --git a/stepmania/src/DifficultyIcon.h b/stepmania/src/DifficultyIcon.h index 933f490034..086d6ba4bf 100644 --- a/stepmania/src/DifficultyIcon.h +++ b/stepmania/src/DifficultyIcon.h @@ -13,6 +13,7 @@ #include "Sprite.h" #include "PlayerNumber.h" +#include "GameConstantsAndTypes.h" class Steps; @@ -22,6 +23,8 @@ public: bool Load( CString sFilePath ); void SetFromNotes( PlayerNumber pn, Steps* pNotes ); + void SetFromDifficulty( PlayerNumber pn, Difficulty dc ); + void SetFromCourseDifficulty( PlayerNumber pn, CourseDifficulty cd ); }; #endif diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 50118710fa..9687e78c0e 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -1105,7 +1105,7 @@ struct SongAndSteps bool operator<( const SongAndSteps& other ) const { return pSong<=other.pSong && pSteps<=other.pSteps; } }; -void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsOut ) const +void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsOut ) const { if( !IsHumanPlayer(pn) ) return; @@ -1162,8 +1162,10 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsO if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] ) continue; - RankingFeats feat; - feat.Type = RankingFeats::SONG; + RankingFeat feat; + feat.Type = RankingFeat::SONG; + feat.pSong = pSong; + feat.pSteps = pSteps; feat.Feat = ssprintf("MR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() ); feat.pStringToFill = &hs.sName; feat.grade = hs.grade; @@ -1188,8 +1190,10 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsO if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] ) continue; - RankingFeats feat; - feat.Type = RankingFeats::SONG; + RankingFeat feat; + feat.pSong = pSong; + feat.pSteps = pSteps; + feat.Type = RankingFeat::SONG; feat.Feat = ssprintf("PR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() ); feat.pStringToFill = &hs.sName; feat.grade = hs.grade; @@ -1224,8 +1228,8 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsO if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] ) continue; - RankingFeats feat; - feat.Type = RankingFeats::CATEGORY; + RankingFeat feat; + feat.Type = RankingFeat::CATEGORY; feat.Feat = ssprintf("MR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] ); feat.pStringToFill = &hs.sName; feat.grade = GRADE_NO_DATA; @@ -1248,8 +1252,8 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsO if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] ) continue; - RankingFeats feat; - feat.Type = RankingFeats::CATEGORY; + RankingFeat feat; + feat.Type = RankingFeat::CATEGORY; feat.Feat = ssprintf("PR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] ); feat.pStringToFill = &hs.sName; feat.grade = GRADE_NO_DATA; @@ -1284,8 +1288,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsO if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] ) continue; - RankingFeats feat; - feat.Type = RankingFeats::COURSE; + RankingFeat feat; + feat.Type = RankingFeat::COURSE; + feat.pCourse = pCourse; feat.Feat = ssprintf("MR #%d in %s", i+1, pCourse->m_sName.c_str() ); feat.pStringToFill = &hs.sName; feat.grade = GRADE_NO_DATA; @@ -1307,8 +1312,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsO if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] ) continue; - RankingFeats feat; - feat.Type = RankingFeats::COURSE; + RankingFeat feat; + feat.Type = RankingFeat::COURSE; + feat.pCourse = pCourse; feat.Feat = ssprintf("PR #%d in %s", i+1, pCourse->m_sName.c_str() ); feat.pStringToFill = &hs.sName; feat.grade = GRADE_NO_DATA; @@ -1351,7 +1357,7 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name ) } } - vector aFeats; + vector aFeats; GetRankingFeats( pn, aFeats ); for( unsigned i=0; i &asFeatsOut ) const; + void GetRankingFeats( PlayerNumber pn, vector &vFeatsOut ) const; void StoreRankingName( PlayerNumber pn, CString name ); // Called by name entry screens vector m_vpsNamesThatWereFilled; // filled on StoreRankingName, diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index b7c4b73537..1aaeb3ebf5 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -88,12 +88,13 @@ void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut ) if( hs >= vHighScores[i] ) break; } - if( i < NUM_RANKING_LINES ) + const int iMaxScores = PREFSMAN->m_iMaxHighScoresPerList; + if( i < iMaxScores ) { vHighScores.insert( vHighScores.begin()+i, hs ); iIndexOut = i; - if( vHighScores.size() > unsigned(NUM_RANKING_LINES) ) - vHighScores.erase( vHighScores.begin()+NUM_RANKING_LINES, vHighScores.end() ); + if( vHighScores.size() > unsigned(iMaxScores) ) + vHighScores.erase( vHighScores.begin()+iMaxScores, vHighScores.end() ); } } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 688fd6fdea..ca7b3d212c 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -215,6 +215,7 @@ PrefsManager::PrefsManager() m_bAllowExtraStage = true; m_bLockWheelAfterRandom = true; m_bHideDefaultNoteSkin = false; + m_iMaxHighScoresPerList = 10; m_fPadStickSeconds = 0; g_bAutoRestart = false; m_bSignProfileData = false; @@ -495,6 +496,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.GetValue( "Options", "LockWheelAfterRandom", m_bLockWheelAfterRandom ); ini.GetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin ); + ini.GetValue( "Options", "MaxHighScoresPerList", m_iMaxHighScoresPerList ); ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds ); ini.GetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.GetValue( "Options", "SignProfileData", m_bSignProfileData ); @@ -709,6 +711,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.SetValue( "Options", "LockWheelAfterRandom", m_bLockWheelAfterRandom ); ini.SetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin ); + ini.SetValue( "Options", "MaxHighScoresPerList", m_iMaxHighScoresPerList ); ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds ); ini.SetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.SetValue( "Options", "SignProfileData", m_bSignProfileData ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index b0c8b181fe..6297e14fa5 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -190,6 +190,7 @@ public: bool m_bAllowExtraStage; bool m_bLockWheelAfterRandom; bool m_bHideDefaultNoteSkin; + int m_iMaxHighScoresPerList; // Number of seconds it takes for a button on the controller to release // after pressed. diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 324f0dbbf2..a960984b9c 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -875,7 +875,7 @@ void ScreenEvaluation::CommitScores( const StageStats &stageStats, int iPersonal ASSERT( GAMESTATE->m_pCurNotes[p] ); - if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore ) + if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForHighScore ) PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index ce60034883..1249a22ec1 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -137,7 +137,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName ) int p; - vector aFeats[NUM_PLAYERS]; + vector aFeats[NUM_PLAYERS]; // Find out if players deserve to enter their name for( p=0; pGetMetricI(m_sName,"NumAlphabetDisplayed") #define MAX_RANKING_NAME_LENGTH THEME->GetMetricI(m_sName,"MaxRankingNameLength") #define FEAT_INTERVAL THEME->GetMetricF(m_sName,"FeatInterval") -#define KEYBOARD_LETTERS THEME->GetMetric (m_sName,"KeyboardLetters") +#define KEYBOARD_LETTERS THEME->GetMetric (m_sName,"KeyboardLetters") #define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen") #define COMMAND_OPTIONAL( actor, command_name ) \ if( !actor.GetName().empty() ) \ COMMAND( actor, command_name ); - - - const ScreenMessage SM_ChangeDisplayedFeat = ScreenMessage(SM_User+0); static const int CHAR_OK = -1; static const int CHAR_BACK = -2; +void HighScoreWheelItem::Load( int iRankIndex, const HighScore& hs ) +{ + SetName( "HighScoreWheelItem" ); + + m_textRank.SetName( "Rank" ); + m_textRank.LoadFromFont( THEME->GetPathF(m_sName,"rank") ); + m_textRank.SetText( ssprintf("%d", iRankIndex+1) ); + this->AddChild( &m_textRank ); + SET_XY_AND_ON_COMMAND( m_textRank ); + + m_textName.SetName( "Name" ); + m_textName.LoadFromFont( THEME->GetPathF(m_sName,"name") ); + m_textName.SetText( hs.sName ); + this->AddChild( &m_textName ); + SET_XY_AND_ON_COMMAND( m_textName ); + + m_textScore.SetName( "Score" ); + m_textScore.LoadFromFont( THEME->GetPathF(m_sName,"score") ); + if( PREFSMAN->m_bPercentageScoring ) + m_textScore.SetText( ssprintf("%.2f%%", hs.fPercentDP*100) ); + else + m_textScore.SetText( ssprintf("%i", hs.iScore) ); + this->AddChild( &m_textScore ); + SET_XY_AND_ON_COMMAND( m_textScore ); +} + +void HighScoreWheelItem::ShowFocus() +{ + CString sCommand = "diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1"; + m_textRank.Command( sCommand ); + m_textName.Command( sCommand ); + m_textScore.Command( sCommand ); +} + +void HighScoreWheel::Load( const HighScoreList& hsl, int iIndexToFocus ) +{ + int iSize = hsl.vHighScores.size(); + m_Items.resize( iSize ); + for( int i=0; iAddChild( &m_Items[i] ); + } + m_iIndexToFocus = iIndexToFocus; + + if( m_iIndexToFocus >= 0 && m_iIndexToFocus < iSize ) + m_Items[m_iIndexToFocus].ShowFocus(); + + ActorScroller::Load( + 0.2f, // fSecondsPerItem + 8, // iNumItemsToDraw + RageVector3(18,0,0), // vRotationDegrees + RageVector3(0,0,90), // vTranslateTerm0 + RageVector3(0,0,0), // vTranslateTerm1 + RageVector3(0,0,0) // vTranslateTerm2 + ); + Scroll(); +} + +float HighScoreWheel::Scroll() +{ + SetCurrentAndDestinationItem( m_SubActors.size()+5 ); + int iIndexToFocus = max( m_iIndexToFocus, 3 ); + SetDestinationItem( iIndexToFocus ); + return GetTweenTimeLeft(); +} + ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : Screen( sClassName ) { LOG->Trace( "ScreenNameEntryTraditional::ScreenNameEntryTraditional()" ); @@ -73,27 +137,32 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S for( int z = 0; z < 3; ++z ) { st.pSong = SONGMAN->GetRandomSong(); + st.iPossibleDancePoints[PLAYER_1] = 100; + st.iActualDancePoints[PLAYER_1] = 100; + st.iScore[PLAYER_1] = 100; + st.iPossibleDancePoints[PLAYER_2] = 100; + st.iActualDancePoints[PLAYER_2] = 100; + st.iScore[PLAYER_2] = 100; ASSERT( st.pSong ); ASSERT( st.pSong->m_apNotes.size() ); - for( int i = 0; i < 2; ++i ) + for( int p = 0; p < NUM_PLAYERS; ++p ) { - GAMESTATE->m_pCurNotes[i] = st.pSteps[i] = st.pSong->m_apNotes[0]; - st.iPossibleDancePoints[i] = 1000; - st.iActualDancePoints[i] = 985; + GAMESTATE->m_pCurNotes[p] = st.pSteps[p] = st.pSong->m_apNotes[0]; + st.iPossibleDancePoints[p] = 1000; + st.iActualDancePoints[p] = 985; HighScore hs; hs.grade = GRADE_TIER_3; - hs.iScore = 42; + hs.fPercentDP = st.GetPercentDancePoints((PlayerNumber)p); + hs.iScore = st.iScore[p]; + StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType; int a, b; - PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[i], (PlayerNumber)i, hs, a, b ); - - if( i == 0 ) - { - HighScore hs; - hs.iScore = 1234567; - StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType; - PROFILEMAN->AddCategoryHighScore( nt, RANKING_A, (PlayerNumber)i, hs, a, b ); - } + PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b ); + PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b ); + PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b ); + PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b ); + PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b ); + PROFILEMAN->AddCategoryHighScore( nt, RANKING_A, (PlayerNumber)p, hs, a, b ); } g_vPlayedStageStats.push_back( st ); @@ -103,13 +172,13 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S int p; - vector aFeats[NUM_PLAYERS]; // Find out if players deserve to enter their name for( p=0; pGetRankingFeats( (PlayerNumber)p, aFeats[p] ); - m_bStillEnteringName[p] = aFeats[p].size()>0; + vector aFeats; + GAMESTATE->GetRankingFeats( (PlayerNumber)p, aFeats ); + m_bStillEnteringName[p] = aFeats.size()>0; } if( !AnyStillEntering() ) @@ -124,7 +193,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S for( p=0; pm_pCurCourse; + int iHighScoreIndex = -1; // -1 means "out of ranking" + Grade grade = ss.GetGrade((PlayerNumber)p); + int iScore = ss.iScore[p]; + float fPercentDP = ss.GetPercentDancePoints((PlayerNumber)p); + + const HighScoreList& hsl = + GAMESTATE->IsCourseMode() ? + PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_CourseDifficulty[p]) : + PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps); + + for( int h=0; hAddChild( &m_sprBanner[p][i] ); + const HighScore &hs = hsl.vHighScores[h]; + if( hs.sName == RANKING_TO_FILL_IN_MARKER[p] && + hs.fPercentDP == fPercentDP && + hs.iScore == iScore ) + { + iHighScoreIndex = h; + break; + } } - if( feat.grade != GRADE_NO_DATA ) - { - m_Grade[p][i].SetName( ssprintf("GradeP%i",p+1) ); - m_Grade[p][i].Load( THEME->GetPathToG("ScreenNameEntryTraditional grades") ); - m_Grade[p][i].SetGrade( (PlayerNumber)p, feat.grade ); - SET_ON( m_Grade[p][i] ); - this->AddChild( &m_Grade[p][i] ); - } + m_FeatDisplay[p][i].m_Wheel.SetName( ssprintf("WheelP%i",p+1) ); + m_FeatDisplay[p][i].m_Wheel.Load( hsl, iHighScoreIndex ); + SET_ON( m_FeatDisplay[p][i].m_Wheel ); + this->AddChild( &m_FeatDisplay[p][i].m_Wheel ); - m_textScore[p][i].SetName( ssprintf("ScoreP%i",p+1) ); - m_textScore[p][i].LoadFromNumbers( THEME->GetPathToN("ScreenNameEntryTraditional score") ); - if( PREFSMAN->m_bPercentageScoring ) - m_textScore[p][i].SetText( ssprintf("%.2f%%", feat.fPercentDP*100) ); + CString sBanner; + if( GAMESTATE->IsCourseMode() ) + sBanner = pCourse->m_sBannerPath; else - m_textScore[p][i].SetText( ssprintf("%i", feat.iScore) ); - SET_ON( m_textScore[p][i] ); - this->AddChild( &m_textScore[p][i] ); - - if( feat.Feat != "" ) + sBanner = pSong->GetBannerPath(); + if( !sBanner.empty() ) { - m_textCategory[p][i].SetName( ssprintf("CategoryP%i", p+1) ); - m_textCategory[p][i].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional category") ); - m_textCategory[p][i].SetText( feat.Feat ); - SET_ON( m_textCategory[p][i] ); - this->AddChild( &m_textCategory[p][i] ); + m_FeatDisplay[p][i].m_sprBanner.SetName( ssprintf("BannerP%i",p+1) ); + m_FeatDisplay[p][i].m_sprBanner.Load( sBanner ); + SET_ON( m_FeatDisplay[p][i].m_sprBanner ); + this->AddChild( &m_FeatDisplay[p][i].m_sprBanner ); } + + if( grade != GRADE_NO_DATA ) + { + m_FeatDisplay[p][i].m_Grade.SetName( ssprintf("GradeP%i",p+1) ); + m_FeatDisplay[p][i].m_Grade.Load( THEME->GetPathToG("ScreenNameEntryTraditional grades") ); + m_FeatDisplay[p][i].m_Grade.SetGrade( (PlayerNumber)p, grade ); + SET_ON( m_FeatDisplay[p][i].m_Grade ); + this->AddChild( &m_FeatDisplay[p][i].m_Grade ); + } + + m_FeatDisplay[p][i].m_Difficulty.SetName( ssprintf("DifficultyP%i",p+1) ); + m_FeatDisplay[p][i].m_Difficulty.Load( THEME->GetPathToG(ssprintf("ScreenNameEntryTraditional difficulty icons 1x%d",NUM_DIFFICULTIES)) ); + if( GAMESTATE->IsCourseMode() ) + m_FeatDisplay[p][i].m_Difficulty.SetFromCourseDifficulty( (PlayerNumber)p, GAMESTATE->m_CourseDifficulty[p] ); + else + m_FeatDisplay[p][i].m_Difficulty.SetFromNotes( (PlayerNumber)p, pSteps ); + SET_ON( m_FeatDisplay[p][i].m_Difficulty ); + this->AddChild( &m_FeatDisplay[p][i].m_Difficulty ); + + m_FeatDisplay[p][i].m_textScore.SetName( ssprintf("ScoreP%i",p+1) ); + m_FeatDisplay[p][i].m_textScore.LoadFromNumbers( THEME->GetPathToN("ScreenNameEntryTraditional score") ); + if( PREFSMAN->m_bPercentageScoring ) + m_FeatDisplay[p][i].m_textScore.SetText( ssprintf("%.2f%%", fPercentDP*100) ); + else + m_FeatDisplay[p][i].m_textScore.SetText( ssprintf("%i", iScore) ); + SET_ON( m_FeatDisplay[p][i].m_textScore ); + this->AddChild( &m_FeatDisplay[p][i].m_textScore ); + +// if( feat.Feat != "" ) +// { +// m_FeatDisplay[p][i].m_textCategory.SetName( ssprintf("CategoryP%i", p+1) ); +// m_FeatDisplay[p][i].m_textCategory.LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional category") ); +// m_FeatDisplay[p][i].m_textCategory.SetText( feat.Feat ); +// SET_ON( m_FeatDisplay[p][i].m_textCategory ); +// this->AddChild( &m_FeatDisplay[p][i].m_textCategory ); +// } + + /* We always show the banner frame (if any), because fading from a graphic to + * itself is ugly. */ + m_FeatDisplay[p][i].m_sprBannerFrame.SetName( ssprintf("BannerFrameP%i",p+1) ); + m_FeatDisplay[p][i].m_sprBannerFrame.Load( THEME->GetPathToG(ssprintf("ScreenNameEntryTraditional banner frame p%i",p+1)) ); + SET_XY_AND_ON_COMMAND( m_FeatDisplay[p][i].m_sprBannerFrame ); + this->AddChild( &m_FeatDisplay[p][i].m_sprBannerFrame ); } - #undef SET_ON - - /* We always show the banner frame (if any), because fading from a graphic to - * itself is ugly. */ - m_sprBannerFrame[p].SetName( ssprintf("BannerFrameP%i",p+1) ); - m_sprBannerFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenNameEntryTraditional banner frame p%i",p+1)) ); - SET_XY_AND_ON_COMMAND( m_sprBannerFrame[p] ); - this->AddChild( &m_sprBannerFrame[p] ); } this->PostScreenMessage( SM_ChangeDisplayedFeat, FEAT_INTERVAL ); @@ -367,14 +480,21 @@ void ScreenNameEntryTraditional::ChangeDisplayedFeat() int OldFeat = m_CurFeat[pn]; m_CurFeat[pn] = NewFeat; - COMMAND_OPTIONAL( m_Grade[pn][OldFeat], "Hide" ); - COMMAND_OPTIONAL( m_Grade[pn][NewFeat], "Unhide" ); - COMMAND_OPTIONAL( m_sprBanner[pn][OldFeat], "Hide" ); - COMMAND_OPTIONAL( m_sprBanner[pn][NewFeat], "Unhide" ); - COMMAND_OPTIONAL( m_textScore[pn][OldFeat], "Hide" ); - COMMAND_OPTIONAL( m_textScore[pn][NewFeat], "Unhide" ); - COMMAND_OPTIONAL( m_textCategory[pn][OldFeat], "Hide" ); - COMMAND_OPTIONAL( m_textCategory[pn][NewFeat], "Unhide" ); + + COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_Wheel, "Hide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_Wheel, "Unhide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_Grade, "Hide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_Grade, "Unhide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_Difficulty, "Hide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_Difficulty, "Unhide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_sprBanner, "Hide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_sprBanner, "Unhide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_textScore, "Hide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_textScore, "Unhide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_textCategory, "Hide" ); + COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_textCategory, "Unhide" ); + + float fSecUntilDoneScrolling = m_FeatDisplay[pn][NewFeat].m_Wheel.Scroll(); } } diff --git a/stepmania/src/ScreenNameEntryTraditional.h b/stepmania/src/ScreenNameEntryTraditional.h index b6bb0aea33..a7c26110dc 100644 --- a/stepmania/src/ScreenNameEntryTraditional.h +++ b/stepmania/src/ScreenNameEntryTraditional.h @@ -16,6 +16,30 @@ #include "MenuElements.h" #include "GradeDisplay.h" #include "Banner.h" +#include "HighScore.h" +#include "DifficultyIcon.h" + + +class HighScoreWheelItem : public ActorFrame +{ +public: + void Load( int iRankIndex, const HighScore& hs ); + void ShowFocus(); + + BitmapText m_textRank; + BitmapText m_textName; + BitmapText m_textScore; +}; + +class HighScoreWheel : public ActorScroller +{ +public: + void Load( const HighScoreList& hsl, int iIndexToFocus ); + float Scroll(); // return seconds until done scrolling + + vector m_Items; + int m_iIndexToFocus; +}; class ScreenNameEntryTraditional : public Screen { @@ -31,7 +55,6 @@ public: void MenuLeft( PlayerNumber pn, const InputEventType type ); void MenuRight( PlayerNumber pn, const InputEventType type ); - enum { MAX_DISPLAYED_FEATS=16 }; private: bool AnyStillEntering() const; void PositionCharsAndCursor( int pn ); @@ -52,11 +75,18 @@ private: int m_SelectedChar[NUM_PLAYERS]; /* Feat display: */ - GradeDisplay m_Grade[NUM_PLAYERS][MAX_DISPLAYED_FEATS]; - BitmapText m_textCategory[NUM_PLAYERS][MAX_DISPLAYED_FEATS]; - BitmapText m_textScore[NUM_PLAYERS][MAX_DISPLAYED_FEATS]; - Banner m_sprBanner[NUM_PLAYERS][MAX_DISPLAYED_FEATS]; - Sprite m_sprBannerFrame[NUM_PLAYERS]; + struct FeatDisplay + { + HighScoreWheel m_Wheel; + GradeDisplay m_Grade; + DifficultyIcon m_Difficulty; + BitmapText m_textCategory; + BitmapText m_textScore; + Banner m_sprBanner; + Sprite m_sprBannerFrame; + }; + + vector m_FeatDisplay[NUM_PLAYERS]; Sprite m_sprNameFrame[NUM_PLAYERS];