add StageStats::GetPercentDancePoints

This commit is contained in:
Glenn Maynard
2003-10-12 21:48:05 +00:00
parent 037c26e20b
commit 259bbcb40b
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -15,6 +15,7 @@
#include "GameState.h"
#include "RageLog.h"
#include "SongManager.h"
#include "RageUtil.h"
StageStats::StageStats()
{
@@ -133,3 +134,14 @@ bool StageStats::OnePassed() const
return false;
}
float StageStats::GetPercentDancePoints( PlayerNumber pn ) const
{
if( iPossibleDancePoints[pn] == 0 )
return 0; // div/0
if( iActualDancePoints[pn] == iPossibleDancePoints[pn] )
return 1; // correct for rounding error
float fPercentDancePoints = iActualDancePoints[pn] / (float)iPossibleDancePoints[pn];
return clamp( fPercentDancePoints, 0, 1 );
}
+1
View File
@@ -24,6 +24,7 @@ struct StageStats
void AddStats( const StageStats& other ); // accumulate
Grade GetGrade( PlayerNumber pn );
bool OnePassed() const;
float GetPercentDancePoints( PlayerNumber pn ) const;
Song* pSong;
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;