Added some sorely lacking filtering logic to EditMenu related to Practice mode.
This commit is contained in:
+45
-4
@@ -179,6 +179,9 @@ void EditMenu::Load( const RString &sType )
|
|||||||
|
|
||||||
// fill in data structures
|
// fill in data structures
|
||||||
GetGroupsToShow( m_sGroups );
|
GetGroupsToShow( m_sGroups );
|
||||||
|
|
||||||
|
// In EditMode_Practice this will be filled in by OnRowValueChanged()
|
||||||
|
if( EDIT_MODE.GetValue() != EditMode_Practice )
|
||||||
m_StepsTypes = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
|
m_StepsTypes = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
|
||||||
|
|
||||||
RefreshAll();
|
RefreshAll();
|
||||||
@@ -357,6 +360,8 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
{
|
{
|
||||||
UpdateArrows();
|
UpdateArrows();
|
||||||
|
|
||||||
|
EditMode mode = EDIT_MODE.GetValue();
|
||||||
|
|
||||||
switch( row )
|
switch( row )
|
||||||
{
|
{
|
||||||
case ROW_GROUP:
|
case ROW_GROUP:
|
||||||
@@ -367,7 +372,19 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
m_GroupBanner.PlayCommand("Changed");
|
m_GroupBanner.PlayCommand("Changed");
|
||||||
}
|
}
|
||||||
m_pSongs.clear();
|
m_pSongs.clear();
|
||||||
|
if( mode == EditMode_Practice )
|
||||||
|
{
|
||||||
|
m_pSongs.clear();
|
||||||
|
vector<Song*> vtSongs;
|
||||||
|
GetSongsToShowForGroup( GetSelectedGroup(), vtSongs );
|
||||||
|
// Filter out songs that aren't playable.
|
||||||
|
FOREACH( Song*, vtSongs, s )
|
||||||
|
if( SongUtil::IsSongPlayable(*s) )
|
||||||
|
m_pSongs.push_back(*s);
|
||||||
|
}
|
||||||
|
else
|
||||||
GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs );
|
GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs );
|
||||||
|
|
||||||
m_iSelection[ROW_SONG] = 0;
|
m_iSelection[ROW_SONG] = 0;
|
||||||
// fall through
|
// fall through
|
||||||
case ROW_SONG:
|
case ROW_SONG:
|
||||||
@@ -376,6 +393,33 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
m_SongBanner.PlayCommand("Changed");
|
m_SongBanner.PlayCommand("Changed");
|
||||||
m_SongTextBanner.SetFromSong( GetSelectedSong() );
|
m_SongTextBanner.SetFromSong( GetSelectedSong() );
|
||||||
|
|
||||||
|
if( mode == EditMode_Practice )
|
||||||
|
{
|
||||||
|
StepsType orgSel = StepsType_Invalid;
|
||||||
|
if( !m_StepsTypes.empty() ) // Not first run
|
||||||
|
{
|
||||||
|
ASSERT( m_StepsTypes.size() > m_iSelection[ROW_STEPS_TYPE] );
|
||||||
|
StepsType orgSel = m_StepsTypes[m_iSelection[ROW_STEPS_TYPE]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// The StepsType selection may no longer be valid. Zero it for now.
|
||||||
|
m_iSelection[ROW_STEPS_TYPE] = 0;
|
||||||
|
m_StepsTypes.clear();
|
||||||
|
|
||||||
|
// Only show StepsTypes for which we have valid Steps.
|
||||||
|
vector<StepsType> vSts = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
|
||||||
|
FOREACH( StepsType, vSts, st )
|
||||||
|
{
|
||||||
|
if( SongUtil::GetStepsByDifficulty( GetSelectedSong(), *st, Difficulty_Invalid, false) != NULL )
|
||||||
|
m_StepsTypes.push_back( *st );
|
||||||
|
|
||||||
|
// Try to preserve the user's StepsType selection.
|
||||||
|
if( *st == orgSel )
|
||||||
|
m_iSelection[ROW_STEPS_TYPE] = m_StepsTypes.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// fall through
|
// fall through
|
||||||
case ROW_STEPS_TYPE:
|
case ROW_STEPS_TYPE:
|
||||||
m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->GetStepsTypeInfo(GetSelectedStepsType()).GetLocalizedString() );
|
m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->GetStepsTypeInfo(GetSelectedStepsType()).GetLocalizedString() );
|
||||||
@@ -391,7 +435,6 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
{
|
{
|
||||||
if( dc == Difficulty_Edit )
|
if( dc == Difficulty_Edit )
|
||||||
{
|
{
|
||||||
EditMode mode = EDIT_MODE.GetValue();
|
|
||||||
switch( mode )
|
switch( mode )
|
||||||
{
|
{
|
||||||
case EditMode_Full:
|
case EditMode_Full:
|
||||||
@@ -431,8 +474,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
if( pSteps && UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) )
|
if( pSteps && UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) )
|
||||||
pSteps = NULL;
|
pSteps = NULL;
|
||||||
|
|
||||||
EditMode mode = EDIT_MODE.GetValue();
|
switch( mode )
|
||||||
switch( EDIT_MODE.GetValue() )
|
|
||||||
{
|
{
|
||||||
case EditMode_Home:
|
case EditMode_Home:
|
||||||
// don't allow selecting of non-edits in HomeMode
|
// don't allow selecting of non-edits in HomeMode
|
||||||
@@ -534,7 +576,6 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
m_Actions.clear();
|
m_Actions.clear();
|
||||||
if( GetSelectedSteps() )
|
if( GetSelectedSteps() )
|
||||||
{
|
{
|
||||||
EditMode mode = EDIT_MODE.GetValue();
|
|
||||||
switch( mode )
|
switch( mode )
|
||||||
{
|
{
|
||||||
case EditMode_Practice:
|
case EditMode_Practice:
|
||||||
|
|||||||
+2
-1
@@ -931,7 +931,8 @@ void SongUtil::FilterSongs( const SongCriteria &sc, const vector<Song*> &in,
|
|||||||
void SongUtil::GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut )
|
void SongUtil::GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut )
|
||||||
{
|
{
|
||||||
vector<const Style*> vpPossibleStyles;
|
vector<const Style*> vpPossibleStyles;
|
||||||
if( CommonMetrics::AUTO_SET_STYLE )
|
// If AutoSetStyle, or a Style hasn't been chosen, check StepsTypes for all Styles.
|
||||||
|
if( CommonMetrics::AUTO_SET_STYLE || GAMESTATE->m_pCurStyle == NULL )
|
||||||
GAMEMAN->GetCompatibleStyles( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), vpPossibleStyles );
|
GAMEMAN->GetCompatibleStyles( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), vpPossibleStyles );
|
||||||
else
|
else
|
||||||
vpPossibleStyles.push_back( GAMESTATE->m_pCurStyle );
|
vpPossibleStyles.push_back( GAMESTATE->m_pCurStyle );
|
||||||
|
|||||||
Reference in New Issue
Block a user