diff --git a/stepmania/src/ModeChoice.cpp b/stepmania/src/ModeChoice.cpp index 46c76bed9d..59a2fa4ffb 100644 --- a/stepmania/src/ModeChoice.cpp +++ b/stepmania/src/ModeChoice.cpp @@ -77,6 +77,8 @@ bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const return false; if( m_pCharacter && GAMESTATE->m_pCurCharacters[pn] != m_pCharacter ) return false; + if( m_CourseDifficulty != COURSE_DIFFICULTY_INVALID && GAMESTATE->m_CourseDifficulty != m_CourseDifficulty ) + return false; return true; } @@ -281,6 +283,8 @@ void ModeChoice::Apply( PlayerNumber pn ) const GAMESTATE->m_pCurNotes[pn] = m_pSteps; if( m_pCharacter ) GAMESTATE->m_pCurCharacters[pn] = m_pCharacter; + if( m_CourseDifficulty != COURSE_DIFFICULTY_INVALID ) + GAMESTATE->m_CourseDifficulty = m_CourseDifficulty; // HACK: Set life type to BATTERY just once here so it happens once and // we don't override the user's changes if they back out. diff --git a/stepmania/src/ModeChoice.h b/stepmania/src/ModeChoice.h index 80836c1818..128e98d04a 100644 --- a/stepmania/src/ModeChoice.h +++ b/stepmania/src/ModeChoice.h @@ -44,6 +44,7 @@ struct ModeChoice // used in SelectMode CString m_sScreen; Steps* m_pSteps; Character* m_pCharacter; + CourseDifficulty m_CourseDifficulty; }; #endif diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index a33fc58742..dc3da20b53 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -120,6 +120,9 @@ void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand ) CString sDifficulty = CourseDifficultyToString( cd ); sDifficulty = Capitalize( sDifficulty ); row.choices.push_back( ENTRY_NAME(sDifficulty+"Courses") ); + ModeChoice mc; + mc.m_CourseDifficulty = cd; + hand.ListEntries.push_back( mc ); } } } @@ -138,6 +141,10 @@ void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand ) s += ssprintf( " (%d)", pSteps->GetMeter() ); row.choices.push_back( s ); + ModeChoice mc; + mc.m_pSteps = pSteps; + mc.m_dc = pSteps->GetDifficulty(); + hand.ListEntries.push_back( mc ); } } else @@ -173,9 +180,13 @@ void ScreenOptionsMaster::SetCharacter( OptionRowData &row, OptionRowHandler &ha GAMESTATE->GetCharacters( apCharacters ); for( unsigned i=0; im_sName; + Character* pCharacter = apCharacters[i]; + CString s = pCharacter->m_sName; s.MakeUpper(); row.choices.push_back( s ); + ModeChoice mc; + mc.m_pCharacter = pCharacter; + hand.ListEntries.push_back( mc ); } } @@ -315,6 +326,8 @@ void ScreenOptionsMaster::ImportOption( const OptionRowData &row, const OptionRo switch( hand.type ) { case ROW_LIST: + case ROW_STEP: + case ROW_CHARACTER: { for( unsigned e = 0; e < hand.ListEntries.size(); ++e ) { @@ -355,54 +368,6 @@ void ScreenOptionsMaster::ImportOption( const OptionRowData &row, const OptionRo } return; } - case ROW_STEP: - if( GAMESTATE->m_bEditing ) - { - SelectExactlyOne( 0, vbSelectedOut ); - return; - } - - if( GAMESTATE->m_pCurCourse ) // playing a course - { - Course* pCourse = GAMESTATE->m_pCurCourse; - StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; - if( pCourse->HasCourseDifficulty( st, GAMESTATE->m_CourseDifficulty ) ) - SelectExactlyOne( GAMESTATE->m_CourseDifficulty+(row.bMultiSelect?1:0), vbSelectedOut ); - else - SelectExactlyOne( 0+(row.bMultiSelect?1:0), vbSelectedOut ); - return; - } - - if( GAMESTATE->m_pCurSong ) // playing a song - { - vector vNotes; - GAMESTATE->m_pCurSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); - SortNotesArrayByDifficulty( vNotes ); - for( unsigned i=0; im_pCurNotes[pn] == vNotes[i] ) - { - SelectExactlyOne( i+(row.bMultiSelect?1:0), vbSelectedOut ); - return; - } - } - } - SelectExactlyOne( 0+(row.bMultiSelect?1:0), vbSelectedOut ); - return; - - case ROW_CHARACTER: - { - vector apCharacters; - GAMESTATE->GetCharacters( apCharacters ); - for( unsigned i=0; im_pCurCharacters[pn] == apCharacters[i] ) - { - SelectExactlyOne( i+1+(row.bMultiSelect?1:0), vbSelectedOut ); - return; - } - SelectExactlyOne( 0+(row.bMultiSelect?1:0), vbSelectedOut ); - return; - } case ROW_CONFIG: { @@ -473,6 +438,8 @@ int ScreenOptionsMaster::ExportOption( const OptionRowData &row, const OptionRow switch( hand.type ) { case ROW_LIST: + case ROW_CHARACTER: + case ROW_STEP: { hand.Default.Apply( (PlayerNumber)pn ); for( unsigned i=0; iGetEffects(); } - - case ROW_CHARACTER: - { - int sel = GetOneSelection( vbSelected ); - - if( sel == 0 ) - GAMESTATE->m_pCurCharacters[pn] = GAMESTATE->GetDefaultCharacter(); - else - { - vector apCharacters; - GAMESTATE->GetCharacters( apCharacters ); - ASSERT( sel - 1 < (int)apCharacters.size() ); - GAMESTATE->m_pCurCharacters[pn] = apCharacters[sel - 1]; - } - } - break; - - case ROW_STEP: - { - int sel = GetOneSelection( vbSelected ); - - if( GAMESTATE->m_bEditing ) - { - // do nothing - } - else if( GAMESTATE->m_pCurCourse ) // playing a course - { - GAMESTATE->m_CourseDifficulty = (CourseDifficulty)sel; - } - else if( GAMESTATE->m_pCurSong ) // playing a song - { - 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; case ROW_SAVE_TO_PROFILE: