add option to push random courses to end or sort them based on GetMeter

This commit is contained in:
Andrew Wong
2003-08-12 23:18:19 +00:00
parent cbc0458cc6
commit 1ebe763c9a
6 changed files with 39 additions and 13 deletions
+24 -13
View File
@@ -125,8 +125,7 @@ float Course::GetMeter( int Difficult ) const
else
fTotalMeter += ci[c].pNotes->GetMeter();
}
LOG->Trace("Course '%s': %f", m_sName.c_str(), fTotalMeter/ci.size() );
// LOG->Trace("Course '%s': %f", m_sName.c_str(), fTotalMeter/ci.size() );
return fTotalMeter / ci.size();
}
@@ -514,7 +513,7 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
for( unsigned i=0; i<entries.size(); i++ )
{
const CourseEntry &e = entries[i];
CourseEntry &e = entries[i];
Song* pSong = NULL; // fill this in
Steps* pNotes = NULL; // fill this in
@@ -537,6 +536,7 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
else
pNotes = pSong->GetStepsByDifficulty( nt, DIFFICULTY_MEDIUM, PREFSMAN->m_bAutogenMissingTypes );
}
e.mystery = false;
break;
case COURSE_ENTRY_RANDOM:
case COURSE_ENTRY_RANDOM_WITHIN_GROUP:
@@ -566,6 +566,7 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
pNotes = NULL;
}
}
e.mystery = true;
break;
case COURSE_ENTRY_BEST:
case COURSE_ENTRY_WORST:
@@ -599,6 +600,7 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
if( pNotes == NULL )
pNotes = pSong->GetClosestNotes( nt, DIFFICULTY_MEDIUM );
}
e.mystery = false;
break;
default:
ASSERT(0);
@@ -873,16 +875,6 @@ static bool CompareCoursePointersByAvgDifficulty(const Course* pCourse1, const C
float fNum1 = pCourse1->GetMeter( false );
float fNum2 = pCourse2->GetMeter( false );
// push non-fixed courses to end
if ( !pCourse1->IsFixed() )
fNum1 = 1000.0f;
if ( !pCourse2->IsFixed() )
fNum2 = 1000.0f;
LOG->Trace("Comparison between %s (%f) and %s (%f)",
pCourse1->m_sName.c_str() , fNum1,
pCourse2->m_sName.c_str() , fNum2);
if( fNum1 < fNum2 )
return true;
else if( fNum1 > fNum2 )
@@ -934,6 +926,21 @@ static bool MovePlayersBestToEnd( const Course* pCourse1, const Course* pCourse2
return pCourse1->m_sName < pCourse2->m_sName;
}
static bool CompareRandom( const Course* pCourse1, const Course* pCourse2 )
{
bool C1Fixed = pCourse1->IsFixed();
bool C2Fixed = pCourse2->IsFixed();
if( !C1Fixed && !C2Fixed )
return false;
if( C1Fixed && !C2Fixed )
return true;
if( !C1Fixed && C2Fixed )
return false;
return false;
// return pCourse1->m_sName < pCourse2->m_sName;
}
static bool CompareCoursePointersByRanking(const Course* pCourse1, const Course* pCourse2)
{
int iNum1 = pCourse1->SortOrder_Ranking;
@@ -977,6 +984,10 @@ static bool CompareCoursePointersByType(const Course* pCourse1, const Course* pC
return pCourse1->GetPlayMode() < pCourse2->GetPlayMode();
}
void MoveRandomToEnd( vector<Course*> &apCourses )
{
stable_sort( apCourses.begin(), apCourses.end(), CompareRandom );
}
void SortCoursePointerArrayByType( vector<Course*> &apCourses )
{
+1
View File
@@ -166,5 +166,6 @@ void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses );
void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &apCourses );
void SortCoursePointerArrayByRanking( vector<Course*> &apCourses );
void MoveRandomToEnd( vector<Course*> &apCourses );
#endif
+4
View File
@@ -586,6 +586,10 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
if (PREFSMAN->m_iCourseSortOrder == PrefsManager::COURSE_SORT_RANK)
SortCoursePointerArrayByRanking( apCourses );
// since we can't agree, make it an option
if (PREFSMAN->m_bMoveRandomToEnd)
MoveRandomToEnd( apCourses );
}
if( so == SORT_ALL_COURSES )
+5
View File
@@ -116,6 +116,7 @@ PrefsManager::PrefsManager()
// default to old sort order
m_iCourseSortOrder = COURSE_SORT_SONGS;
m_bMoveRandomToEnd = false;
m_iScoringType = SCORING_MAX2;
m_fLongVerSongSeconds = 60*2.5f; // Dynamite Rave is 2:55
@@ -235,7 +236,9 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValueB( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
ini.GetValueB( "Options", "ShowDancingCharacters", m_bShowDancingCharacters );
ini.GetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed );
ini.GetValueI( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder );
ini.GetValueB( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
ini.GetValueI( "Options", "ScoringType", (int&)m_iScoringType );
@@ -358,6 +361,8 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValueB( "Options", "TenFooterInRed", m_bTenFooterInRed );
ini.SetValueI( "Options", "CourseSortOrder", m_iCourseSortOrder );
ini.SetValueB( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
ini.SetValueI( "Options", "ScoringType", m_iScoringType );
ini.SetValueI( "Options", "ProgressiveLifebar", m_iProgressiveLifebar );
+1
View File
@@ -93,6 +93,7 @@ public:
// course ranking
enum { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder;
bool m_bMoveRandomToEnd;
// scoring type; SCORING_MAX2 should always be first
enum { SCORING_MAX2, SCORING_5TH } m_iScoringType;
@@ -38,6 +38,7 @@ enum {
AO_WHEEL_SECTIONS,
AO_TEN_FOOT_RED,
AO_COURSE_SORT,
AO_COURSE_MOVE_RANDOM,
AO_SHOW_TRANSLATIONS,
AO_SHOW_LYRICS,
NUM_APPEARANCE_OPTIONS_LINES
@@ -55,6 +56,7 @@ OptionRow g_AppearanceOptionsLines[NUM_APPEARANCE_OPTIONS_LINES] = {
OptionRow( "Wheel\nSections", "NEVER","ALWAYS", "ABC ONLY"),
OptionRow( "10+ foot\nIn Red", "NO", "YES"),
OptionRow( "Course\nSort", "# SONGS", "AVG FEET", "TOTAL FEET", "RANKING"),
OptionRow( "Random\nAt End", "NO","YES"),
OptionRow( "Translations", "NATIVE","TRANSLITERATE"),
OptionRow( "Lyrics", "HIDE","SHOW"),
};
@@ -148,6 +150,7 @@ void ScreenAppearanceOptions::ImportOptions()
m_iSelectedOption[0][AO_WHEEL_SECTIONS] = (int)PREFSMAN->m_MusicWheelUsesSections;
m_iSelectedOption[0][AO_TEN_FOOT_RED] = PREFSMAN->m_bTenFooterInRed? 1:0;
m_iSelectedOption[0][AO_COURSE_SORT] = (int)PREFSMAN->m_iCourseSortOrder;
m_iSelectedOption[0][AO_COURSE_MOVE_RANDOM] = PREFSMAN->m_bMoveRandomToEnd? 1:0;
m_iSelectedOption[0][AO_SHOW_TRANSLATIONS] = PREFSMAN->m_bShowNative? 0:1;
m_iSelectedOption[0][AO_SHOW_LYRICS] = PREFSMAN->m_bShowLyrics;
}
@@ -199,6 +202,7 @@ void ScreenAppearanceOptions::ExportOptions()
PREFSMAN->m_bDancePointsForOni = !!m_iSelectedOption[0][AO_DANCE_POINTS_FOR_ONI];
PREFSMAN->m_bTenFooterInRed = !!m_iSelectedOption[0][AO_TEN_FOOT_RED];
(int&)PREFSMAN->m_iCourseSortOrder = m_iSelectedOption[0][AO_COURSE_SORT];
PREFSMAN->m_bMoveRandomToEnd = !!m_iSelectedOption[0][AO_COURSE_MOVE_RANDOM];
PREFSMAN->SaveGamePrefsToDisk();
PREFSMAN->SaveGlobalPrefsToDisk();