From f612f70cf72ab8dd44c215adbbe555f582710a04 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 24 Feb 2008 01:13:14 +0000 Subject: [PATCH] fix WorkoutGraph getting out of sync with course (remove FitnessText, Intermediate because they don't play well with a repeating course --- stepmania/src/Workout.cpp | 46 +++++++++++---------------------------- stepmania/src/Workout.h | 2 -- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/stepmania/src/Workout.cpp b/stepmania/src/Workout.cpp index 6c48c2f59f..583e8278a6 100644 --- a/stepmania/src/Workout.cpp +++ b/stepmania/src/Workout.cpp @@ -11,8 +11,6 @@ static const char *WorkoutProgramNames[] = { "FatBurn", - "FitnessTest", - "Intermediate", "Interval", "Runner", "Flat", @@ -44,8 +42,8 @@ int Workout::GetEstimatedNumSongsFromSeconds( float fSeconds ) const float fAverageSongLengthSeconds = 105; static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, int iSongInBodyIndex, int iNumSongsInBody ) { - int iMaxMeter = iAverageMeter + 2; - int iMinMeter = iAverageMeter - 2; + const int iMaxMeter = iAverageMeter + 1; + const int iMinMeter = iAverageMeter - 1; float fPercentThroughBody = SCALE( iSongInBodyIndex, 0.0f, (float)iNumSongsInBody-1, 0.0f, 1.0f ); CLAMP( fPercentThroughBody, 0.0f, 1.0f ); @@ -57,35 +55,11 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i DEFAULT_FAIL( wp ); case WorkoutProgram_FatBurn: { - float fMeter = SCALE( iSongInBodyIndex % 4, 0.0f, 3.0f, (float)iMinMeter, (float)iMaxMeter ); + const int iSongInterval = 3; + float fMeter = SCALE( iSongInBodyIndex % iSongInterval, 0.0f, (float)(iSongInterval-1), (float)iMinMeter, (float)iMaxMeter ); iMeter = lrintf( fMeter ); } break; - case WorkoutProgram_FitnessTest: - { - iMeter = (int)floorf( SCALE( fPercentThroughBody, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter+0.95f ) ); - } - break; - case WorkoutProgram_Intermediate: - { - switch( iSongInBodyIndex % 6 ) - { - DEFAULT_FAIL(iSongInBodyIndex % 6); - case 0: - case 3: - iMeter = iMinMeter; - break; - case 1: - case 2: - iMeter = iMaxMeter; - break; - case 4: - case 5: - iMeter = lrintf( SCALE( 0.5f, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter ) ); - break; - } - } - break; case WorkoutProgram_Interval: { iMeter = (iSongInBodyIndex % 2) ? iMaxMeter:iMinMeter; @@ -93,8 +67,9 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i break; case WorkoutProgram_Runner: { - float fMeter = SCALE( iSongInBodyIndex % 4, 0.0f, 3.0f, (float)iMinMeter, (float)iMaxMeter ); - if( (iSongInBodyIndex % 8) >= 4 ) + const int iSongInterval = 6; + float fMeter = SCALE( iSongInBodyIndex % (iSongInterval/2), 0.0f, (iSongInterval/2)-1.0f, (float)iMinMeter, (float)iMaxMeter ); + if( (iSongInBodyIndex % iSongInterval) >= iSongInterval/2 ) fMeter = SCALE( fMeter, (float)iMinMeter, (float)iMaxMeter, (float)iMaxMeter, (float)iMinMeter ); iMeter = lrintf( fMeter ); } @@ -123,10 +98,15 @@ void Workout::GetEstimatedMeters( int iNumSongs, vector &viMetersOut ) void Workout::GenerateCourse( Course &out ) { + out = Course(); + out.m_sMainTitle = "temp"; out.m_bRepeat = true; - const int iNumCourseEntries = 10; + // Choose a large number of course entries. We may loop if the goal + // is not yet reached, and it would be bad to play the same sequence + // of songs over again. + const int iNumCourseEntries = 60; // choose a multiple of the intervals above, or else the WorkoutGraph will get out of sync with the actual songs. vector viMeter; GetEstimatedMeters( iNumCourseEntries, viMeter ); diff --git a/stepmania/src/Workout.h b/stepmania/src/Workout.h index 23ef2e8958..0547224854 100644 --- a/stepmania/src/Workout.h +++ b/stepmania/src/Workout.h @@ -6,8 +6,6 @@ enum WorkoutProgram { WorkoutProgram_FatBurn, - WorkoutProgram_FitnessTest, - WorkoutProgram_Intermediate, WorkoutProgram_Interval, WorkoutProgram_Runner, WorkoutProgram_Flat,