support "easy" course mode

This commit is contained in:
Glenn Maynard
2004-05-20 22:56:11 +00:00
parent 7c1600a1c1
commit f09e7d2f16
3 changed files with 33 additions and 18 deletions
+31 -18
View File
@@ -31,7 +31,8 @@
#include "ProfileManager.h" #include "ProfileManager.h"
/* Amount to increase meter ranges to make them difficult: */ /* Amount to increase meter ranges to make them difficult: */
const int COURSE_DIFFICULTY_METER_CHANGE[NUM_COURSE_DIFFICULTIES] = { 0, 2 }; const int COURSE_DIFFICULTY_METER_CHANGE[NUM_COURSE_DIFFICULTIES] = { -2, 0, 2 };
const int COURSE_DIFFICULTY_CLASS_CHANGE[NUM_COURSE_DIFFICULTIES] = { -1, 0, 1 };
/* Maximum lower value of ranges when difficult: */ /* Maximum lower value of ranges when difficult: */
const int MAX_BOTTOM_RANGE = 10; const int MAX_BOTTOM_RANGE = 10;
@@ -83,6 +84,7 @@ float Course::GetMeter( CourseDifficulty cd ) const
fTotalMeter += (iMeterLow + iMeterHigh) / 2.0f; fTotalMeter += (iMeterLow + iMeterHigh) / 2.0f;
break; break;
} }
/* XXX? */
case DIFFICULTY_BEGINNER: fTotalMeter += 1; break; case DIFFICULTY_BEGINNER: fTotalMeter += 1; break;
case DIFFICULTY_EASY: fTotalMeter += 2; break; case DIFFICULTY_EASY: fTotalMeter += 2; break;
case DIFFICULTY_MEDIUM: fTotalMeter += 5; break; case DIFFICULTY_MEDIUM: fTotalMeter += 5; break;
@@ -541,15 +543,24 @@ bool Course::HasCourseDifficulty( StepsType nt, CourseDifficulty cd ) const
{ {
const CourseEntry &e = m_entries[ Normal[i].CourseIndex ]; const CourseEntry &e = m_entries[ Normal[i].CourseIndex ];
/* Difficulties under CHALLENGE change by getting harder. */ if( e.difficulty != DIFFICULTY_INVALID )
if( e.difficulty < DIFFICULTY_CHALLENGE ) {
return true; /* Check if the song's difficulty class will actually change. */
Difficulty dc = (Difficulty) (e.difficulty + COURSE_DIFFICULTY_CLASS_CHANGE[cd]);
dc = clamp( dc, DIFFICULTY_BEGINNER, DIFFICULTY_CHALLENGE );
if( dc != e.difficulty )
return true;
}
/* Meters under MAX_BOTTOM_RANGE..MAX_BOTTOM_RANGE change by getting harder. */ /* Meters under MAX_BOTTOM_RANGE..MAX_BOTTOM_RANGE change by getting harder. */
if( e.difficulty != DIFFICULTY_INVALID && if( e.difficulty == DIFFICULTY_INVALID )
e.low_meter < MAX_BOTTOM_RANGE && {
e.high_meter < MAX_BOTTOM_RANGE ) /* Check if the meter will actually change. */
return true; int iNewLowMeter = clamp( 1, e.low_meter + COURSE_DIFFICULTY_METER_CHANGE[cd], MAX_BOTTOM_RANGE );
int iNewHighMeter = clamp( 1, e.high_meter + COURSE_DIFFICULTY_METER_CHANGE[cd], MAX_BOTTOM_RANGE );
if( iNewLowMeter != e.low_meter || iNewHighMeter != e.high_meter )
return true;
}
continue; continue;
} }
@@ -747,17 +758,18 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, CourseDiffic
if( !pSong || !pNotes ) if( !pSong || !pNotes )
continue; // this song entry isn't playable. Skip. continue; // this song entry isn't playable. Skip.
/* If e.difficulty == DIFFICULTY_INVALID, then we already increased difficulty /* If e.difficulty == DIFFICULTY_INVALID, then we already adjusted difficulty
* based on meter. */ * based on meter. */
if( entry_difficulty > COURSE_DIFFICULTY_REGULAR && e.difficulty != DIFFICULTY_INVALID ) if( entry_difficulty != COURSE_DIFFICULTY_REGULAR && e.difficulty != DIFFICULTY_INVALID )
{ {
/* See if we can find a NoteData that's one notch more difficult than /* See if we can find a NoteData after adjusting the difficulty by COURSE_DIFFICULTY_CLASS_CHANGE.
* the one we found above. */ * If we can't, just use the one we already have. */
Difficulty dc = pNotes->GetDifficulty(); Difficulty original_dc = pNotes->GetDifficulty();
Difficulty new_dc = Difficulty( dc + entry_difficulty ); Difficulty dc = Difficulty( original_dc + COURSE_DIFFICULTY_CLASS_CHANGE[entry_difficulty] );
if( new_dc <= DIFFICULTY_CHALLENGE ) dc = clamp( dc, DIFFICULTY_BEGINNER, DIFFICULTY_CHALLENGE );
if( dc != original_dc )
{ {
Steps* pNewNotes = pSong->GetStepsByDifficulty( nt, new_dc ); Steps* pNewNotes = pSong->GetStepsByDifficulty( nt, dc );
if( pNewNotes ) if( pNewNotes )
pNotes = pNewNotes; pNotes = pNewNotes;
} }
@@ -871,8 +883,9 @@ bool Course::IsFixed() const
Difficulty Course::GetDifficulty( const Info &stage ) const Difficulty Course::GetDifficulty( const Info &stage ) const
{ {
Difficulty dc = m_entries[stage.CourseIndex].difficulty; Difficulty dc = m_entries[stage.CourseIndex].difficulty;
Difficulty new_dc = Difficulty( dc + stage.Difficulty ); Difficulty new_dc = Difficulty( dc + COURSE_DIFFICULTY_CLASS_CHANGE[stage.Difficulty] );
return (new_dc <= DIFFICULTY_CHALLENGE) ? new_dc : dc; new_dc = clamp( new_dc, DIFFICULTY_BEGINNER, DIFFICULTY_CHALLENGE );
return new_dc;
} }
void Course::GetMeterRange( int stage, int& iMeterLowOut, int& iMeterHighOut, CourseDifficulty cd ) const void Course::GetMeterRange( int stage, int& iMeterLowOut, int& iMeterHighOut, CourseDifficulty cd ) const
+1
View File
@@ -45,6 +45,7 @@ Difficulty StringToDifficulty( const CString& sDC )
static const CString CourseDifficultyNames[NUM_COURSE_DIFFICULTIES] = static const CString CourseDifficultyNames[NUM_COURSE_DIFFICULTIES] =
{ {
"Easy",
"Regular", "Regular",
"Difficult", "Difficult",
}; };
+1
View File
@@ -25,6 +25,7 @@ Difficulty StringToDifficulty( const CString& sDC );
enum CourseDifficulty enum CourseDifficulty
{ {
COURSE_DIFFICULTY_EASY,
COURSE_DIFFICULTY_REGULAR, COURSE_DIFFICULTY_REGULAR,
COURSE_DIFFICULTY_DIFFICULT, COURSE_DIFFICULTY_DIFFICULT,
NUM_COURSE_DIFFICULTIES, NUM_COURSE_DIFFICULTIES,