add StageStats::GetPercentDancePoints
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "SongManager.h"
|
#include "SongManager.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
|
||||||
StageStats::StageStats()
|
StageStats::StageStats()
|
||||||
{
|
{
|
||||||
@@ -133,3 +134,14 @@ bool StageStats::OnePassed() const
|
|||||||
return false;
|
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 );
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ struct StageStats
|
|||||||
void AddStats( const StageStats& other ); // accumulate
|
void AddStats( const StageStats& other ); // accumulate
|
||||||
Grade GetGrade( PlayerNumber pn );
|
Grade GetGrade( PlayerNumber pn );
|
||||||
bool OnePassed() const;
|
bool OnePassed() const;
|
||||||
|
float GetPercentDancePoints( PlayerNumber pn ) const;
|
||||||
|
|
||||||
Song* pSong;
|
Song* pSong;
|
||||||
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
|
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
|
||||||
|
|||||||
Reference in New Issue
Block a user