Cleanup PercentDisplay, ScreenNameEntryTraditional
This commit is contained in:
@@ -66,7 +66,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
|
|||||||
if( bPlayerEnabled )
|
if( bPlayerEnabled )
|
||||||
{
|
{
|
||||||
m_Percent.SetName( "LifeMeterBattery Percent" );
|
m_Percent.SetName( "LifeMeterBattery Percent" );
|
||||||
m_Percent.Load( pn );
|
m_Percent.Load( pn, &g_CurStageStats );
|
||||||
this->AddChild( &m_Percent );
|
this->AddChild( &m_Percent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,14 @@
|
|||||||
|
|
||||||
PercentageDisplay::PercentageDisplay()
|
PercentageDisplay::PercentageDisplay()
|
||||||
{
|
{
|
||||||
|
m_pSource = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PercentageDisplay::Load( PlayerNumber pn )
|
void PercentageDisplay::Load( PlayerNumber pn, StageStats* pSource )
|
||||||
{
|
{
|
||||||
ASSERT( m_sName != "" ); // set this!
|
ASSERT( m_sName != "" ); // set this!
|
||||||
m_PlayerNumber = pn;
|
m_PlayerNumber = pn;
|
||||||
|
m_pSource = pSource;
|
||||||
m_Last = -1;
|
m_Last = -1;
|
||||||
|
|
||||||
if( PREFSMAN->m_bDancePointsForOni )
|
if( PREFSMAN->m_bDancePointsForOni )
|
||||||
@@ -28,7 +30,7 @@ void PercentageDisplay::Load( PlayerNumber pn )
|
|||||||
else
|
else
|
||||||
m_textPercent.SetName( ssprintf("PercentP%i", pn+1) );
|
m_textPercent.SetName( ssprintf("PercentP%i", pn+1) );
|
||||||
|
|
||||||
m_textPercent.LoadFromNumbers( THEME->GetPathToN(m_sName + " text") );
|
m_textPercent.LoadFromNumbers( THEME->GetPathN(m_sName,"text") );
|
||||||
SET_XY_AND_ON_COMMAND( m_textPercent );
|
SET_XY_AND_ON_COMMAND( m_textPercent );
|
||||||
this->AddChild( &m_textPercent );
|
this->AddChild( &m_textPercent );
|
||||||
|
|
||||||
@@ -60,7 +62,7 @@ void PercentageDisplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void PercentageDisplay::Refresh()
|
void PercentageDisplay::Refresh()
|
||||||
{
|
{
|
||||||
const int iActualDancePoints = g_CurStageStats.iActualDancePoints[m_PlayerNumber];
|
const int iActualDancePoints = m_pSource->iActualDancePoints[m_PlayerNumber];
|
||||||
if( iActualDancePoints == m_Last )
|
if( iActualDancePoints == m_Last )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -69,7 +71,7 @@ void PercentageDisplay::Refresh()
|
|||||||
CString sNumToDisplay;
|
CString sNumToDisplay;
|
||||||
if( !PREFSMAN->m_bDancePointsForOni )
|
if( !PREFSMAN->m_bDancePointsForOni )
|
||||||
{
|
{
|
||||||
float fPercentDancePoints = g_CurStageStats.GetPercentDancePoints( m_PlayerNumber );
|
float fPercentDancePoints = m_pSource->GetPercentDancePoints( m_PlayerNumber );
|
||||||
|
|
||||||
// clamp percentage - feedback is that negative numbers look weird here.
|
// clamp percentage - feedback is that negative numbers look weird here.
|
||||||
CLAMP( fPercentDancePoints, 0.f, 1.f );
|
CLAMP( fPercentDancePoints, 0.f, 1.f );
|
||||||
|
|||||||
@@ -4,18 +4,20 @@
|
|||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
|
#include "StageStats.h"
|
||||||
|
|
||||||
class PercentageDisplay: public ActorFrame
|
class PercentageDisplay: public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PercentageDisplay();
|
PercentageDisplay();
|
||||||
void Load( PlayerNumber pn );
|
void Load( PlayerNumber pn, StageStats *pSource );
|
||||||
void Update( float fDeltaTime );
|
void Update( float fDeltaTime );
|
||||||
void TweenOffScreen();
|
void TweenOffScreen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Refresh();
|
void Refresh();
|
||||||
PlayerNumber m_PlayerNumber;
|
PlayerNumber m_PlayerNumber;
|
||||||
|
StageStats *m_pSource;
|
||||||
int m_Last;
|
int m_Last;
|
||||||
BitmapText m_textPercent;
|
BitmapText m_textPercent;
|
||||||
BitmapText m_textPercentRemainder;
|
BitmapText m_textPercentRemainder;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "ScoreDisplayPercentage.h"
|
#include "ScoreDisplayPercentage.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "StageStats.h"
|
||||||
|
|
||||||
ScoreDisplayPercentage::ScoreDisplayPercentage()
|
ScoreDisplayPercentage::ScoreDisplayPercentage()
|
||||||
{
|
{
|
||||||
@@ -14,5 +15,5 @@ ScoreDisplayPercentage::ScoreDisplayPercentage()
|
|||||||
|
|
||||||
void ScoreDisplayPercentage::Init( PlayerNumber pn )
|
void ScoreDisplayPercentage::Init( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_Percent.Load( pn );
|
m_Percent.Load( pn, &g_CurStageStats );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ void ScreenEvaluation::Init()
|
|||||||
/* Use "ScreenEvaluation Percent" for the [metric set], but position and
|
/* Use "ScreenEvaluation Percent" for the [metric set], but position and
|
||||||
* tween it with "PercentP1X", etc. */
|
* tween it with "PercentP1X", etc. */
|
||||||
m_Percent[p].SetName( "ScreenEvaluation Percent" );
|
m_Percent[p].SetName( "ScreenEvaluation Percent" );
|
||||||
m_Percent[p].Load( (PlayerNumber) p );
|
m_Percent[p].Load( (PlayerNumber) p, &g_CurStageStats );
|
||||||
m_Percent[p].SetXY( THEME->GetMetricF(m_sName, ssprintf("PercentP%dX",p+1)),
|
m_Percent[p].SetXY( THEME->GetMetricF(m_sName, ssprintf("PercentP%dX",p+1)),
|
||||||
THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) );
|
THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) );
|
||||||
m_Percent[p].Command( THEME->GetMetric(m_sName,ssprintf("PercentP%dOnCommand",p+1)) );
|
m_Percent[p].Command( THEME->GetMetric(m_sName,ssprintf("PercentP%dOnCommand",p+1)) );
|
||||||
|
|||||||
@@ -376,12 +376,9 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
|||||||
SET_ON( m_FeatDisplay[p][i].m_Difficulty );
|
SET_ON( m_FeatDisplay[p][i].m_Difficulty );
|
||||||
this->AddChild( &m_FeatDisplay[p][i].m_Difficulty );
|
this->AddChild( &m_FeatDisplay[p][i].m_Difficulty );
|
||||||
|
|
||||||
|
m_FeatDisplay[p][i].m_textScore.SetName( "ScreenNameEntryTraditional Percent" );
|
||||||
|
m_FeatDisplay[p][i].m_textScore.Load( (PlayerNumber)p, &ss );
|
||||||
m_FeatDisplay[p][i].m_textScore.SetName( ssprintf("ScoreP%i",p+1) );
|
m_FeatDisplay[p][i].m_textScore.SetName( ssprintf("ScoreP%i",p+1) );
|
||||||
m_FeatDisplay[p][i].m_textScore.LoadFromNumbers( THEME->GetPathToN("ScreenNameEntryTraditional score") );
|
|
||||||
if( PREFSMAN->m_bPercentageScoring )
|
|
||||||
m_FeatDisplay[p][i].m_textScore.SetText( ssprintf("%.2f%%", fPercentDP*100) );
|
|
||||||
else
|
|
||||||
m_FeatDisplay[p][i].m_textScore.SetText( ssprintf("%i", iScore) );
|
|
||||||
SET_ON( m_FeatDisplay[p][i].m_textScore );
|
SET_ON( m_FeatDisplay[p][i].m_textScore );
|
||||||
this->AddChild( &m_FeatDisplay[p][i].m_textScore );
|
this->AddChild( &m_FeatDisplay[p][i].m_textScore );
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "Banner.h"
|
#include "Banner.h"
|
||||||
#include "HighScore.h"
|
#include "HighScore.h"
|
||||||
#include "DifficultyIcon.h"
|
#include "DifficultyIcon.h"
|
||||||
|
#include "PercentageDisplay.h"
|
||||||
|
|
||||||
|
|
||||||
class HighScoreWheelItem : public ActorFrame
|
class HighScoreWheelItem : public ActorFrame
|
||||||
@@ -78,13 +79,13 @@ private:
|
|||||||
/* Feat display: */
|
/* Feat display: */
|
||||||
struct FeatDisplay
|
struct FeatDisplay
|
||||||
{
|
{
|
||||||
HighScoreWheel m_Wheel;
|
HighScoreWheel m_Wheel;
|
||||||
GradeDisplay m_Grade;
|
GradeDisplay m_Grade;
|
||||||
DifficultyIcon m_Difficulty;
|
DifficultyIcon m_Difficulty;
|
||||||
BitmapText m_textCategory;
|
BitmapText m_textCategory;
|
||||||
BitmapText m_textScore;
|
PercentageDisplay m_textScore;
|
||||||
Banner m_sprBanner;
|
Banner m_sprBanner;
|
||||||
Sprite m_sprBannerFrame;
|
Sprite m_sprBannerFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
vector<FeatDisplay> m_FeatDisplay[NUM_PLAYERS];
|
vector<FeatDisplay> m_FeatDisplay[NUM_PLAYERS];
|
||||||
|
|||||||
Reference in New Issue
Block a user