add Double* difficulty sorts
This commit is contained in:
@@ -148,6 +148,10 @@ static const char *SortOrderNames[] = {
|
|||||||
"MediumMeter",
|
"MediumMeter",
|
||||||
"HardMeter",
|
"HardMeter",
|
||||||
"ChallengeMeter",
|
"ChallengeMeter",
|
||||||
|
"DoubleEasyMeter",
|
||||||
|
"DoubleMediumMeter",
|
||||||
|
"DoubleHardMeter",
|
||||||
|
"DoubleChallengeMeter",
|
||||||
"ModeMenu",
|
"ModeMenu",
|
||||||
"AllCourses",
|
"AllCourses",
|
||||||
"Nonstop",
|
"Nonstop",
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ enum SortOrder
|
|||||||
SORT_MEDIUM_METER,
|
SORT_MEDIUM_METER,
|
||||||
SORT_HARD_METER,
|
SORT_HARD_METER,
|
||||||
SORT_CHALLENGE_METER,
|
SORT_CHALLENGE_METER,
|
||||||
|
SORT_DOUBLE_EASY_METER,
|
||||||
|
SORT_DOUBLE_MEDIUM_METER,
|
||||||
|
SORT_DOUBLE_HARD_METER,
|
||||||
|
SORT_DOUBLE_CHALLENGE_METER,
|
||||||
SORT_MODE_MENU,
|
SORT_MODE_MENU,
|
||||||
SORT_ALL_COURSES,
|
SORT_ALL_COURSES,
|
||||||
SORT_NONSTOP_COURSES,
|
SORT_NONSTOP_COURSES,
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
|
|||||||
// obey order specified by the preferred sort list
|
// obey order specified by the preferred sort list
|
||||||
break;
|
break;
|
||||||
case SORT_ROULETTE:
|
case SORT_ROULETTE:
|
||||||
SongUtil::SortSongPointerArrayByMeter( arraySongs, Difficulty_Easy );
|
SongUtil::SortSongPointerArrayByStepsTypeAndMeter( arraySongs, GAMESTATE->m_pCurStyle->m_StepsType, Difficulty_Easy );
|
||||||
if( (bool)PREFSMAN->m_bPreferredSortUsesGroups )
|
if( (bool)PREFSMAN->m_bPreferredSortUsesGroups )
|
||||||
stable_sort( arraySongs.begin(), arraySongs.end(), SongUtil::CompareSongPointersByGroup );
|
stable_sort( arraySongs.begin(), arraySongs.end(), SongUtil::CompareSongPointersByGroup );
|
||||||
bUseSections = false;
|
bUseSections = false;
|
||||||
@@ -469,16 +469,17 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
|
|||||||
SongUtil::SortSongPointerArrayByLength( arraySongs );
|
SongUtil::SortSongPointerArrayByLength( arraySongs );
|
||||||
break;
|
break;
|
||||||
case SORT_EASY_METER:
|
case SORT_EASY_METER:
|
||||||
SongUtil::SortSongPointerArrayByMeter( arraySongs, Difficulty_Easy );
|
|
||||||
break;
|
|
||||||
case SORT_MEDIUM_METER:
|
case SORT_MEDIUM_METER:
|
||||||
SongUtil::SortSongPointerArrayByMeter( arraySongs, Difficulty_Medium );
|
|
||||||
break;
|
|
||||||
case SORT_HARD_METER:
|
case SORT_HARD_METER:
|
||||||
SongUtil::SortSongPointerArrayByMeter( arraySongs, Difficulty_Hard );
|
|
||||||
break;
|
|
||||||
case SORT_CHALLENGE_METER:
|
case SORT_CHALLENGE_METER:
|
||||||
SongUtil::SortSongPointerArrayByMeter( arraySongs, Difficulty_Challenge );
|
case SORT_DOUBLE_EASY_METER:
|
||||||
|
case SORT_DOUBLE_MEDIUM_METER:
|
||||||
|
case SORT_DOUBLE_HARD_METER:
|
||||||
|
case SORT_DOUBLE_CHALLENGE_METER:
|
||||||
|
StepsType st;
|
||||||
|
Difficulty dc;
|
||||||
|
SongUtil::GetStepsTypeAndDifficultyFromSortOrder( so, st, dc );
|
||||||
|
SongUtil::SortSongPointerArrayByStepsTypeAndMeter( arraySongs, st, dc );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0); // unhandled SortOrder
|
ASSERT(0); // unhandled SortOrder
|
||||||
@@ -752,16 +753,11 @@ void MusicWheel::UpdateSwitch()
|
|||||||
//
|
//
|
||||||
// Change difficulty for sorts by meter - XXX: do this with GameCommand?
|
// Change difficulty for sorts by meter - XXX: do this with GameCommand?
|
||||||
//
|
//
|
||||||
Difficulty dc = Difficulty_Invalid;
|
StepsType st;
|
||||||
switch( GAMESTATE->m_SortOrder )
|
Difficulty dc;
|
||||||
{
|
if( SongUtil::GetStepsTypeAndDifficultyFromSortOrder( GAMESTATE->m_SortOrder, st, dc ) )
|
||||||
case SORT_EASY_METER: dc = Difficulty_Easy; break;
|
|
||||||
case SORT_MEDIUM_METER: dc = Difficulty_Medium; break;
|
|
||||||
case SORT_HARD_METER: dc = Difficulty_Hard; break;
|
|
||||||
case SORT_CHALLENGE_METER: dc = Difficulty_Challenge; break;
|
|
||||||
}
|
|
||||||
if( dc != Difficulty_Invalid )
|
|
||||||
{
|
{
|
||||||
|
ASSERT( dc != Difficulty_Invalid );
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
GAMESTATE->m_PreferredDifficulty[p].Set( dc );
|
GAMESTATE->m_PreferredDifficulty[p].Set( dc );
|
||||||
|
|||||||
+72
-21
@@ -602,29 +602,20 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
|
|||||||
return GradeToLocalizedString( Grade_NoData );
|
return GradeToLocalizedString( Grade_NoData );
|
||||||
}
|
}
|
||||||
case SORT_EASY_METER:
|
case SORT_EASY_METER:
|
||||||
{
|
|
||||||
Steps* pSteps = GetStepsByDifficulty(pSong, GAMESTATE->GetCurrentStyle()->m_StepsType,Difficulty_Easy);
|
|
||||||
if( pSteps && !UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
|
||||||
return ssprintf("%02d", pSteps->GetMeter() );
|
|
||||||
return SORT_NOT_AVAILABLE.GetValue();
|
|
||||||
}
|
|
||||||
case SORT_MEDIUM_METER:
|
case SORT_MEDIUM_METER:
|
||||||
{
|
|
||||||
Steps* pSteps = GetStepsByDifficulty(pSong, GAMESTATE->GetCurrentStyle()->m_StepsType,Difficulty_Medium);
|
|
||||||
if( pSteps && !UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
|
||||||
return ssprintf("%02d", pSteps->GetMeter() );
|
|
||||||
return SORT_NOT_AVAILABLE.GetValue();
|
|
||||||
}
|
|
||||||
case SORT_HARD_METER:
|
case SORT_HARD_METER:
|
||||||
{
|
|
||||||
Steps* pSteps = GetStepsByDifficulty(pSong, GAMESTATE->GetCurrentStyle()->m_StepsType,Difficulty_Hard);
|
|
||||||
if( pSteps && !UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
|
||||||
return ssprintf("%02d", pSteps->GetMeter() );
|
|
||||||
return SORT_NOT_AVAILABLE.GetValue();
|
|
||||||
}
|
|
||||||
case SORT_CHALLENGE_METER:
|
case SORT_CHALLENGE_METER:
|
||||||
|
case SORT_DOUBLE_EASY_METER:
|
||||||
|
case SORT_DOUBLE_MEDIUM_METER:
|
||||||
|
case SORT_DOUBLE_HARD_METER:
|
||||||
|
case SORT_DOUBLE_CHALLENGE_METER:
|
||||||
{
|
{
|
||||||
Steps* pSteps = GetStepsByDifficulty(pSong, GAMESTATE->GetCurrentStyle()->m_StepsType,Difficulty_Challenge);
|
StepsType st;
|
||||||
|
Difficulty dc;
|
||||||
|
SongUtil::GetStepsTypeAndDifficultyFromSortOrder( so, st, dc );
|
||||||
|
|
||||||
|
|
||||||
|
Steps* pSteps = GetStepsByDifficulty(pSong,st,dc);
|
||||||
if( pSteps && !UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
if( pSteps && !UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
||||||
return ssprintf("%02d", pSteps->GetMeter() );
|
return ssprintf("%02d", pSteps->GetMeter() );
|
||||||
return SORT_NOT_AVAILABLE.GetValue();
|
return SORT_NOT_AVAILABLE.GetValue();
|
||||||
@@ -660,13 +651,13 @@ void SongUtil::SortSongPointerArrayBySectionName( vector<Song*> &vpSongsInOut, S
|
|||||||
g_mapSongSortVal.clear();
|
g_mapSongSortVal.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongUtil::SortSongPointerArrayByMeter( vector<Song*> &vpSongsInOut, Difficulty dc )
|
void SongUtil::SortSongPointerArrayByStepsTypeAndMeter( vector<Song*> &vpSongsInOut, StepsType st, Difficulty dc )
|
||||||
{
|
{
|
||||||
g_mapSongSortVal.clear();
|
g_mapSongSortVal.clear();
|
||||||
for(unsigned i = 0; i < vpSongsInOut.size(); ++i)
|
for(unsigned i = 0; i < vpSongsInOut.size(); ++i)
|
||||||
{
|
{
|
||||||
/* Ignore locked steps. */
|
/* Ignore locked steps. */
|
||||||
const Steps* pSteps = GetClosestNotes( vpSongsInOut[i], GAMESTATE->GetCurrentStyle()->m_StepsType, dc, true );
|
const Steps* pSteps = GetClosestNotes( vpSongsInOut[i], st, dc, true );
|
||||||
RString &s = g_mapSongSortVal[vpSongsInOut[i]];
|
RString &s = g_mapSongSortVal[vpSongsInOut[i]];
|
||||||
s = ssprintf("%03d", pSteps ? pSteps->GetMeter() : 0);
|
s = ssprintf("%03d", pSteps ? pSteps->GetMeter() : 0);
|
||||||
|
|
||||||
@@ -910,6 +901,66 @@ bool SongUtil::IsStepsPlayable( Song *pSong, Steps *pSteps )
|
|||||||
return find( vpSteps.begin(), vpSteps.end(), pSteps ) != vpSteps.end();
|
return find( vpSteps.begin(), vpSteps.end(), pSteps ) != vpSteps.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &stOut, Difficulty &dcOut )
|
||||||
|
{
|
||||||
|
switch( so )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
case SORT_EASY_METER:
|
||||||
|
case SORT_MEDIUM_METER:
|
||||||
|
case SORT_HARD_METER:
|
||||||
|
case SORT_CHALLENGE_METER:
|
||||||
|
case SORT_DOUBLE_EASY_METER:
|
||||||
|
case SORT_DOUBLE_MEDIUM_METER:
|
||||||
|
case SORT_DOUBLE_HARD_METER:
|
||||||
|
case SORT_DOUBLE_CHALLENGE_METER:
|
||||||
|
break; // fall through
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( so )
|
||||||
|
{
|
||||||
|
DEFAULT_FAIL( so );
|
||||||
|
case SORT_EASY_METER:
|
||||||
|
case SORT_MEDIUM_METER:
|
||||||
|
case SORT_HARD_METER:
|
||||||
|
case SORT_CHALLENGE_METER:
|
||||||
|
stOut = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
break;
|
||||||
|
case SORT_DOUBLE_EASY_METER:
|
||||||
|
case SORT_DOUBLE_MEDIUM_METER:
|
||||||
|
case SORT_DOUBLE_HARD_METER:
|
||||||
|
case SORT_DOUBLE_CHALLENGE_METER:
|
||||||
|
stOut = GAMESTATE->GetCurrentStyle()->m_StepsType; // in case we don't find any matches below
|
||||||
|
vector<const Style*> vpStyles;
|
||||||
|
GameManager::GetStylesForGame(GAMESTATE->m_pCurGame,vpStyles);
|
||||||
|
FOREACH_CONST( const Style*, vpStyles, i )
|
||||||
|
{
|
||||||
|
if( (*i)->m_StyleType == StyleType_OnePlayerTwoSides )
|
||||||
|
{
|
||||||
|
stOut = (*i)->m_StepsType;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( so )
|
||||||
|
{
|
||||||
|
DEFAULT_FAIL( so );
|
||||||
|
case SORT_EASY_METER: dcOut = Difficulty_Easy; break;
|
||||||
|
case SORT_MEDIUM_METER: dcOut = Difficulty_Medium; break;
|
||||||
|
case SORT_HARD_METER: dcOut = Difficulty_Hard; break;
|
||||||
|
case SORT_CHALLENGE_METER: dcOut = Difficulty_Challenge; break;
|
||||||
|
case SORT_DOUBLE_EASY_METER: dcOut = Difficulty_Easy; break;
|
||||||
|
case SORT_DOUBLE_MEDIUM_METER: dcOut = Difficulty_Medium; break;
|
||||||
|
case SORT_DOUBLE_HARD_METER: dcOut = Difficulty_Hard; break;
|
||||||
|
case SORT_DOUBLE_CHALLENGE_METER: dcOut = Difficulty_Challenge; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// SongID
|
// SongID
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ namespace SongUtil
|
|||||||
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &vpSongsInOut );
|
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &vpSongsInOut );
|
||||||
void SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, ProfileSlot slot, bool bDescending );
|
void SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, ProfileSlot slot, bool bDescending );
|
||||||
void SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, const Profile* pProfile, bool bDescending );
|
void SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, const Profile* pProfile, bool bDescending );
|
||||||
void SortSongPointerArrayByMeter( vector<Song*> &vpSongsInOut, Difficulty dc );
|
void SortSongPointerArrayByStepsTypeAndMeter( vector<Song*> &vpSongsInOut, StepsType st, Difficulty dc );
|
||||||
RString GetSectionNameFromSongAndSort( const Song *pSong, SortOrder so );
|
RString GetSectionNameFromSongAndSort( const Song *pSong, SortOrder so );
|
||||||
void SortSongPointerArrayBySectionName( vector<Song*> &vpSongsInOut, SortOrder so );
|
void SortSongPointerArrayBySectionName( vector<Song*> &vpSongsInOut, SortOrder so );
|
||||||
void SortByMostRecentlyPlayedForMachine( vector<Song*> &vpSongsInOut );
|
void SortByMostRecentlyPlayedForMachine( vector<Song*> &vpSongsInOut );
|
||||||
@@ -115,6 +115,8 @@ namespace SongUtil
|
|||||||
void GetPlayableSteps( const Song *pSong, vector<Steps*> &vOut );
|
void GetPlayableSteps( const Song *pSong, vector<Steps*> &vOut );
|
||||||
bool IsStepsTypePlayable( Song *pSong, StepsType st );
|
bool IsStepsTypePlayable( Song *pSong, StepsType st );
|
||||||
bool IsStepsPlayable( Song *pSong, Steps *pSteps );
|
bool IsStepsPlayable( Song *pSong, Steps *pSteps );
|
||||||
|
|
||||||
|
bool GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &st, Difficulty &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
class SongID
|
class SongID
|
||||||
|
|||||||
Reference in New Issue
Block a user