From 9af12628a9704c2eb4fd81ce06cc46b040698f5f Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 12 Jul 2004 00:10:28 +0000 Subject: [PATCH] weight all Steps and Trails evenly in PercentComplete calculation so there's more incentive to play easy Steps. --- stepmania/src/Profile.cpp | 40 +++++++++++++-------------------------- stepmania/src/Profile.h | 8 ++------ 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index b52c2e4143..3cb2e64866 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -211,9 +211,9 @@ int Profile::GetTotalNumSongsPassed() const return iTotal; } -int Profile::GetPossibleSongDancePoints( StepsType st, Difficulty dc ) const +float Profile::GetSongsPercentComplete( StepsType st, Difficulty dc ) const { - int iTotal = 0; + int iTotalSteps = 0; // add steps high scores const vector vSongs = SONGMAN->GetAllSongs(); @@ -235,17 +235,12 @@ int Profile::GetPossibleSongDancePoints( StepsType st, Difficulty dc ) const if( pSteps->GetDifficulty() != dc ) continue; // skip - const RadarValues& fRadars = pSteps->GetRadarValues(); - iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + iTotalSteps++; } } - return iTotal; -} -int Profile::GetActualSongDancePoints( StepsType st, Difficulty dc ) const -{ - int iTotal = 0; + float fTotalPercents = 0; // add steps high scores for( std::map::const_iterator i = m_SongHighScores.begin(); @@ -286,18 +281,16 @@ int Profile::GetActualSongDancePoints( StepsType st, Difficulty dc ) const const HighScoresForASteps& h = j->second; const HighScoreList& hs = h.hs; - const RadarValues& fRadars = pSteps->GetRadarValues(); - int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); + fTotalPercents += hs.GetTopScore().fPercentDP; } } - return iTotal; + return fTotalPercents / iTotalSteps; } -int Profile::GetPossibleCourseDancePoints( StepsType st, CourseDifficulty cd ) const +float Profile::GetCoursesPercentComplete( StepsType st, CourseDifficulty cd ) const { - int iTotal = 0; + int iTotalTrails = 0; // add course high scores vector vCourses; @@ -314,16 +307,11 @@ int Profile::GetPossibleCourseDancePoints( StepsType st, CourseDifficulty cd ) c if( pTrail == NULL ) continue; - const RadarValues& fRadars = pTrail->GetRadarValues(); - iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + iTotalTrails++; } - return iTotal; -} - -int Profile::GetActualCourseDancePoints( StepsType st, CourseDifficulty cd ) const -{ - int iTotal = 0; + + float fTotalPercents = 0; // add course high scores for( std::map::const_iterator i = m_CourseHighScores.begin(); @@ -365,13 +353,11 @@ int Profile::GetActualCourseDancePoints( StepsType st, CourseDifficulty cd ) con const HighScoresForATrail& h = j->second; const HighScoreList& hs = h.hs; - const RadarValues& fRadars = pTrail->GetRadarValues(); - int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); + fTotalPercents += hs.GetTopScore().fPercentDP; } } - return iTotal; + return fTotalPercents / iTotalTrails; } CString Profile::GetProfileDisplayNameFromDir( CString sDir ) diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index 0f863fe30b..53e89eab6b 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -62,12 +62,8 @@ public: CString GetDisplayTotalCaloriesBurnedToday() const; int GetTotalNumSongsPlayed() const; int GetTotalNumSongsPassed() const; - int GetActualSongDancePoints( StepsType st, Difficulty dc ) const; - int GetActualCourseDancePoints( StepsType st, CourseDifficulty cd ) const; - int GetPossibleSongDancePoints( StepsType st, Difficulty dc ) const; - int GetPossibleCourseDancePoints( StepsType st, CourseDifficulty cd ) const; - float GetSongsPercentComplete( StepsType st, Difficulty dc ) const { return (float)(GetActualSongDancePoints(st,dc))/GetPossibleSongDancePoints(st,dc); } - float GetCoursesPercentComplete( StepsType st, CourseDifficulty cd ) const { return (float)(GetActualCourseDancePoints(st,cd))/GetPossibleCourseDancePoints(st,cd); } + float GetSongsPercentComplete( StepsType st, Difficulty dc ) const; + float GetCoursesPercentComplete( StepsType st, CourseDifficulty cd ) const; static CString GetProfileDisplayNameFromDir( CString sDir ); int GetSongNumTimesPlayed( const Song* pSong ) const; int GetSongNumTimesPlayed( const SongID& songID ) const;