diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index d5957352ba..d3734b354c 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -427,7 +427,7 @@ void Course::Save() } -void Course::AutogenEndlessFromGroup( CString sGroupName, vector &apSongsInGroup ) +void Course::AutogenEndlessFromGroup( CString sGroupName, vector &apSongsInGroup, Difficulty diff ) { m_bIsAutogen = true; m_bRepeat = true; @@ -435,7 +435,8 @@ void Course::AutogenEndlessFromGroup( CString sGroupName, vector &apSongs m_iLives = -1; m_iMeter[0] = m_iMeter[1] = -1; - m_sName = SONGMAN->ShortenGroupName( sGroupName ); + m_sName = SONGMAN->ShortenGroupName( sGroupName ) + GetAutogenDifficultySuffix( diff ); + m_sBannerPath = SONGMAN->GetGroupBannerPath( sGroupName ); // We want multiple songs, so we can try to prevent repeats during @@ -444,7 +445,7 @@ void Course::AutogenEndlessFromGroup( CString sGroupName, vector &apSongs CourseEntry e; e.type = COURSE_ENTRY_RANDOM_WITHIN_GROUP; e.group_name = sGroupName; - e.difficulty = DIFFICULTY_MEDIUM; + e.difficulty = diff; e.mystery = true; vector vSongs; @@ -453,9 +454,39 @@ void Course::AutogenEndlessFromGroup( CString sGroupName, vector &apSongs m_entries.push_back( e ); } -void Course::AutogenNonstopFromGroup( CString sGroupName, vector &apSongsInGroup ) +void Course::AutogenEndlessFromVector( CString sCourseName, vector &apSongsInCourse, Difficulty diff ) { - AutogenEndlessFromGroup( sGroupName, apSongsInGroup ); + m_bIsAutogen = true; + m_bRepeat = true; + m_bRandomize = true; + m_iLives = -1; + m_iMeter[0] = m_iMeter[1] = -1; + + m_sName = SONGMAN->ShortenGroupName( sCourseName ) + GetAutogenDifficultySuffix( diff ); + //m_sBannerPath = SONGMAN->GetGroupBannerPath( sBannerName ); + + CourseEntry e; + e.type = COURSE_ENTRY_FIXED; + e.group_name = sCourseName; + e.difficulty = diff; + e.mystery = true; + + for ( unsigned i = 0; i < apSongsInCourse.size(); ++i ) + { + e.pSong = apSongsInCourse[i]; + m_entries.push_back( e ); + } + + //This means that the course will be the same each time until re-init + //Currently, this is only used for the All Songs endless course, so it's + //a non-issue + //Also, it appears to be what COURSE_ENTRY_RANDOM does anyways + random_shuffle(m_entries.begin(),m_entries.end()); +} + +void Course::AutogenNonstopFromGroup( CString sGroupName, vector &apSongsInGroup, Difficulty diff ) +{ + AutogenEndlessFromGroup( sGroupName, apSongsInGroup, diff ); m_bRepeat = false; @@ -468,6 +499,13 @@ void Course::AutogenNonstopFromGroup( CString sGroupName, vector &apSongs m_entries.pop_back(); } +CString Course::GetAutogenDifficultySuffix( Difficulty diff ) const +{ + if ( diff == DIFFICULTY_MEDIUM ) + return ""; + return " " + DifficultyToThemedString( diff ); +} + /* * Difficult courses do the following: * diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 761701368f..5113aac849 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -139,8 +139,9 @@ public: void LoadFromCRSFile( CString sPath ); void Unload(); void Save(); - void AutogenEndlessFromGroup( CString sGroupName, vector &apSongsInGroup ); - void AutogenNonstopFromGroup( CString sGroupName, vector &apSongsInGroup ); + void AutogenEndlessFromGroup( CString sGroupName, vector &apSongsInGroup, Difficulty diff ); + void AutogenEndlessFromVector( CString sCourseName, vector &apSongsInCourse, Difficulty diff ); + void AutogenNonstopFromGroup( CString sGroupName, vector &apSongsInGroup, Difficulty diff ); RadarValues GetRadarValues( StepsType st, CourseDifficulty cd ) const; @@ -155,6 +156,7 @@ public: void ClearCache(); private: + CString GetAutogenDifficultySuffix( Difficulty diff ) const; void GetMeterRange( int stage, int& iMeterLowOut, int& iMeterHighOut, CourseDifficulty cd ) const; typedef pair InfoParams; diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index f8c9b4e2b1..1913bf2f6c 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -574,15 +574,48 @@ void SongManager::InitAutogenCourses() GetSongs( apGroupSongs, sGroupName ); Course* pCourse; - + //Generate random courses from each group for each of the main three difficulty levels pCourse = new Course; - pCourse->AutogenEndlessFromGroup( sGroupName, apGroupSongs ); + pCourse->AutogenEndlessFromGroup( sGroupName, apGroupSongs, DIFFICULTY_EASY ); m_pCourses.push_back( pCourse ); pCourse = new Course; - pCourse->AutogenNonstopFromGroup( sGroupName, apGroupSongs ); + pCourse->AutogenEndlessFromGroup( sGroupName, apGroupSongs, DIFFICULTY_MEDIUM ); + m_pCourses.push_back( pCourse ); + + pCourse = new Course; + pCourse->AutogenEndlessFromGroup( sGroupName, apGroupSongs, DIFFICULTY_HARD ); + m_pCourses.push_back( pCourse ); + + pCourse = new Course; + pCourse->AutogenNonstopFromGroup( sGroupName, apGroupSongs, DIFFICULTY_EASY ); + m_pCourses.push_back( pCourse ); + + pCourse = new Course; + pCourse->AutogenNonstopFromGroup( sGroupName, apGroupSongs, DIFFICULTY_MEDIUM ); + m_pCourses.push_back( pCourse ); + + pCourse = new Course; + pCourse->AutogenNonstopFromGroup( sGroupName, apGroupSongs, DIFFICULTY_HARD ); m_pCourses.push_back( pCourse ); } + + vector apCourseSongs = GetAllSongs(); + + Course* pCourse; + + //Generate "All Songs" endless course + pCourse = new Course; + pCourse->AutogenEndlessFromVector( "All Groups", apCourseSongs, DIFFICULTY_EASY ); + m_pCourses.push_back( pCourse ); + + pCourse = new Course; + pCourse->AutogenEndlessFromVector( "All Groups", apCourseSongs, DIFFICULTY_MEDIUM ); + m_pCourses.push_back( pCourse ); + + pCourse = new Course; + pCourse->AutogenEndlessFromVector( "All Groups", apCourseSongs, DIFFICULTY_HARD ); + m_pCourses.push_back( pCourse ); }