hide locked steps

This commit is contained in:
Chris Danford
2005-04-24 20:32:03 +00:00
parent ad5c70f7df
commit c6040055eb
6 changed files with 29 additions and 12 deletions
+6 -5
View File
@@ -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<Steps*> 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() );
+2
View File
@@ -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() )
{
+9 -7
View File
@@ -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<Steps*> vSteps;
GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->GetCurrentStyle()->m_StepsType );
StepsUtil::SortNotesArrayByDifficulty( vSteps );
for( unsigned i=0; i<vSteps.size(); i++ )
vector<Steps*> vpSteps;
Song *pSong = GAMESTATE->m_pCurSong;
pSong->GetSteps( vpSteps, GAMESTATE->GetCurrentStyle()->m_StepsType );
StepsUtil::RemoveLockedSteps( pSong, vpSteps );
StepsUtil::SortNotesArrayByDifficulty( vpSteps );
for( unsigned i=0; i<vpSteps.size(); i++ )
{
Steps* pSteps = vSteps[i];
Steps* pSteps = vpSteps[i];
CString s;
if( pSteps->GetDifficulty() == DIFFICULTY_EDIT )
+1
View File
@@ -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 )
+10
View File
@@ -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<Steps*> &arraySongPointers )
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareStepsPointersByDescription );
}
void StepsUtil::RemoveLockedSteps( const Song *pSong, vector<Steps*> &vpSteps )
{
for( int i=vpSteps.size()-1; i>=0; i-- )
{
if( UNLOCKMAN->StepsIsLocked(pSong, vpSteps[i]) )
vpSteps.erase( vpSteps.begin()+i );
}
}
////////////////////////////////
// StepsID
+1
View File
@@ -21,6 +21,7 @@ namespace StepsUtil
void SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDescending );
bool CompareStepsPointersByDescription(const Steps *pStep1, const Steps *pStep2);
void SortStepsByDescription( vector<Steps*> &vStepsPointers );
void RemoveLockedSteps( const Song *pSong, vector<Steps*> &arrayNotess );
};
class StepsID