diff --git a/stepmania/src/DifficultyList.cpp b/stepmania/src/DifficultyList.cpp index b01021278c..df1e7da2b9 100644 --- a/stepmania/src/DifficultyList.cpp +++ b/stepmania/src/DifficultyList.cpp @@ -242,14 +242,14 @@ void DifficultyList::PositionItems() void DifficultyList::SetFromGameState() { - Song *song = GAMESTATE->m_pCurSong; + Song *pSong = GAMESTATE->m_pCurSong; - const bool bSongChanged = (song != m_CurSong); + const bool bSongChanged = (pSong != m_CurSong); /* If the song has changed, update displays: */ if( bSongChanged ) { - m_CurSong = song; + m_CurSong = pSong; for( int m = 0; m < MAX_METERS; ++m ) { @@ -258,7 +258,7 @@ void DifficultyList::SetFromGameState() m_Rows.clear(); - if( song == NULL ) + if( pSong == NULL ) { // FIXME: This clamps to between the min and the max difficulty, but // it really should round to the nearest difficulty that's in @@ -280,9 +280,10 @@ void DifficultyList::SetFromGameState() else { vector CurSteps; - song->GetSteps( CurSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); + pSong->GetSteps( CurSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); /* Should match the sort in ScreenSelectMusic::AfterMusicChange. */ + StepsUtil::RemoveLockedSteps( pSong, CurSteps ); StepsUtil::SortNotesArrayByDifficulty( CurSteps ); m_Rows.resize( CurSteps.size() ); diff --git a/stepmania/src/EditMenu.cpp b/stepmania/src/EditMenu.cpp index c03823395f..bf792d252e 100644 --- a/stepmania/src/EditMenu.cpp +++ b/stepmania/src/EditMenu.cpp @@ -362,6 +362,8 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) else { Steps *pSteps = GetSelectedSong()->GetStepsByDifficulty( GetSelectedStepsType(), dc ); + if( UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) ) + pSteps = NULL; switch( EDIT_MODE.GetValue() ) { diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index e2c5d05d32..6c33a6f722 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -270,7 +270,7 @@ public: } } - void FillSteps( OptionRowDefinition &defOut, CString sParam, bool bLocked ) + void FillSteps( OptionRowDefinition &defOut, CString sParam, bool bLockedTogether ) { Init(); defOut.Init(); @@ -279,7 +279,7 @@ public: m_sName = sParam; defOut.name = "Steps"; - defOut.bOneChoiceForAllPlayers = bLocked; + defOut.bOneChoiceForAllPlayers = bLockedTogether; defOut.m_bAllowThemeItems = false; // we theme the text ourself // fill in difficulty names @@ -308,12 +308,14 @@ public: } else // !GAMESTATE->IsCourseMode(), playing a song { - vector vSteps; - GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); - StepsUtil::SortNotesArrayByDifficulty( vSteps ); - for( unsigned i=0; i vpSteps; + Song *pSong = GAMESTATE->m_pCurSong; + pSong->GetSteps( vpSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); + StepsUtil::RemoveLockedSteps( pSong, vpSteps ); + StepsUtil::SortNotesArrayByDifficulty( vpSteps ); + for( unsigned i=0; iGetDifficulty() == DIFFICULTY_EDIT ) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 228752dcfd..f097eb082f 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -1547,6 +1547,7 @@ void ScreenSelectMusic::AfterMusicChange() m_textTotalTime.SetText( SecondsToMMSSMsMs(pSong->m_fMusicLengthSeconds) ); pSong->GetSteps( m_vpSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); + StepsUtil::RemoveLockedSteps( pSong, m_vpSteps ); StepsUtil::SortNotesArrayByDifficulty( m_vpSteps ); if ( PREFSMAN->m_bShowBanners ) diff --git a/stepmania/src/StepsUtil.cpp b/stepmania/src/StepsUtil.cpp index ae8ce40d83..970c51b84c 100644 --- a/stepmania/src/StepsUtil.cpp +++ b/stepmania/src/StepsUtil.cpp @@ -6,6 +6,7 @@ #include "SongManager.h" #include "GameManager.h" #include "XmlFile.h" +#include "UnlockManager.h" // // Sorting stuff @@ -119,6 +120,15 @@ void StepsUtil::SortStepsByDescription( vector &arraySongPointers ) sort( arraySongPointers.begin(), arraySongPointers.end(), CompareStepsPointersByDescription ); } +void StepsUtil::RemoveLockedSteps( const Song *pSong, vector &vpSteps ) +{ + for( int i=vpSteps.size()-1; i>=0; i-- ) + { + if( UNLOCKMAN->StepsIsLocked(pSong, vpSteps[i]) ) + vpSteps.erase( vpSteps.begin()+i ); + } +} + //////////////////////////////// // StepsID diff --git a/stepmania/src/StepsUtil.h b/stepmania/src/StepsUtil.h index c16cbc19f9..07bd8bc60b 100644 --- a/stepmania/src/StepsUtil.h +++ b/stepmania/src/StepsUtil.h @@ -21,6 +21,7 @@ namespace StepsUtil void SortStepsPointerArrayByNumPlays( vector &vStepsPointers, const Profile* pProfile, bool bDescending ); bool CompareStepsPointersByDescription(const Steps *pStep1, const Steps *pStep2); void SortStepsByDescription( vector &vStepsPointers ); + void RemoveLockedSteps( const Song *pSong, vector &arrayNotess ); }; class StepsID