From 3952930730e3a8ddef84ba4db24ab769f1e3b51d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 29 Nov 2003 18:10:43 +0000 Subject: [PATCH] add meter to options screen Steps row set preferred difficulty when changing options screen Steps row --- stepmania/src/DifficultyList.cpp | 10 +++++---- stepmania/src/ScreenOptionsMaster.cpp | 29 ++++++++++++++++----------- stepmania/src/SongManager.cpp | 6 +++--- stepmania/src/SongManager.h | 2 +- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/stepmania/src/DifficultyList.cpp b/stepmania/src/DifficultyList.cpp index 7188189422..f4cc695e5c 100644 --- a/stepmania/src/DifficultyList.cpp +++ b/stepmania/src/DifficultyList.cpp @@ -149,12 +149,14 @@ void DifficultyList::SetFromGameState() continue; } - met.SetFromNotes( m_CurSteps[m] ); - const CString desc = m_CurSteps[m]->GetDescription(); + Steps* pSteps = m_CurSteps[m]; + + met.SetFromNotes( pSteps ); + Difficulty dc = pSteps->GetDifficulty(); m_Descriptions[m].SetZoomX(1); - m_Descriptions[m].SetTextMaxWidth( DESCRIPTION_MAX_WIDTH, SONGMAN->GetDifficultyThemeName(desc) ); + m_Descriptions[m].SetTextMaxWidth( DESCRIPTION_MAX_WIDTH, SONGMAN->GetDifficultyThemeName(dc) ); /* Don't mess with alpha; it might be fading on. */ - m_Descriptions[m].SetDiffuseColor( SONGMAN->GetDifficultyColor( m_CurSteps[m]->GetDifficulty() ) ); + m_Descriptions[m].SetDiffuseColor( SONGMAN->GetDifficultyColor(dc) ); } } diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index e9ceb4f5a9..1c68bf2cfe 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -105,16 +105,17 @@ void ScreenOptionsMaster::SetStep( OptionRow &row, OptionRowHandler &hand ) } else if( GAMESTATE->m_pCurSong ) // playing a song { - vector vNotes; - GAMESTATE->m_pCurSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); - SortNotesArrayByDifficulty( vNotes ); - for( unsigned i=0; i vSteps; + GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); + SortNotesArrayByDifficulty( vSteps ); + for( unsigned i=0; iGetDescription(); - s.MakeUpper(); + Steps* pSteps = vSteps[i]; - // convert to theme-defined values - s = SONGMAN->GetDifficultyThemeName(s); + CString s; + // convert to theme-defined difficulty name + s = SONGMAN->GetDifficultyThemeName( pSteps->GetDifficulty() ); + s += ssprintf( " (%d)", pSteps->GetMeter() ); row.choices.push_back( s ); } @@ -443,10 +444,14 @@ int ScreenOptionsMaster::ExportOption( const OptionRow &row, const OptionRowHand } else if( GAMESTATE->m_pCurSong ) // playing a song { - vector vNotes; - GAMESTATE->m_pCurSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); - SortNotesArrayByDifficulty( vNotes ); - GAMESTATE->m_pCurNotes[pn] = vNotes[ sel ]; + vector vSteps; + GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); + SortNotesArrayByDifficulty( vSteps ); + Steps* pSteps = vSteps[ sel ]; + // set current notes + GAMESTATE->m_pCurNotes[pn] = pSteps; + // set preferred difficulty + GAMESTATE->m_PreferredDifficulty[pn] = pSteps->GetDifficulty(); } break; diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index e57e17b9c7..7d805243f8 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -914,16 +914,16 @@ RageColor SongManager::GetDifficultyColor( Difficulty dc ) const } } -CString SongManager::GetDifficultyThemeName( const CString &in ) const +CString SongManager::GetDifficultyThemeName( Difficulty dc ) const { - switch( StringToDifficulty(in) ) + switch( dc ) { case DIFFICULTY_BEGINNER: return BEGINNER_DESCRIPTION; case DIFFICULTY_EASY: return EASY_DESCRIPTION; case DIFFICULTY_MEDIUM: return MEDIUM_DESCRIPTION; case DIFFICULTY_HARD: return HARD_DESCRIPTION; case DIFFICULTY_CHALLENGE: return CHALLENGE_DESCRIPTION; - default: return in; // something else + default: ASSERT(0); return ""; // something else } } diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index b5a067eb85..ca34aa6613 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -52,7 +52,7 @@ public: RageColor GetGroupColor( const CString &sGroupName ); RageColor GetSongColor( const Song* pSong ); RageColor GetDifficultyColor( Difficulty dc ) const; - CString GetDifficultyThemeName( const CString &in ) const; + CString GetDifficultyThemeName( Difficulty dc ) const; static CString ShortenGroupName( CString sLongGroupName ); static int GetNumStagesForSong( const Song* pSong ); // LongVer songs take 2 stages, MarathonVer take 3