Cleanup PercentDisplay, ScreenNameEntryTraditional

This commit is contained in:
Chris Danford
2004-03-24 01:11:16 +00:00
parent 74fc3d8ff4
commit 7bc830888b
7 changed files with 23 additions and 20 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
if( bPlayerEnabled )
{
m_Percent.SetName( "LifeMeterBattery Percent" );
m_Percent.Load( pn );
m_Percent.Load( pn, &g_CurStageStats );
this->AddChild( &m_Percent );
}
+6 -4
View File
@@ -15,12 +15,14 @@
PercentageDisplay::PercentageDisplay()
{
m_pSource = NULL;
}
void PercentageDisplay::Load( PlayerNumber pn )
void PercentageDisplay::Load( PlayerNumber pn, StageStats* pSource )
{
ASSERT( m_sName != "" ); // set this!
m_PlayerNumber = pn;
m_pSource = pSource;
m_Last = -1;
if( PREFSMAN->m_bDancePointsForOni )
@@ -28,7 +30,7 @@ void PercentageDisplay::Load( PlayerNumber pn )
else
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 );
this->AddChild( &m_textPercent );
@@ -60,7 +62,7 @@ void PercentageDisplay::Update( float fDeltaTime )
void PercentageDisplay::Refresh()
{
const int iActualDancePoints = g_CurStageStats.iActualDancePoints[m_PlayerNumber];
const int iActualDancePoints = m_pSource->iActualDancePoints[m_PlayerNumber];
if( iActualDancePoints == m_Last )
return;
@@ -69,7 +71,7 @@ void PercentageDisplay::Refresh()
CString sNumToDisplay;
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( fPercentDancePoints, 0.f, 1.f );
+3 -1
View File
@@ -4,18 +4,20 @@
#include "ActorFrame.h"
#include "PlayerNumber.h"
#include "BitmapText.h"
#include "StageStats.h"
class PercentageDisplay: public ActorFrame
{
public:
PercentageDisplay();
void Load( PlayerNumber pn );
void Load( PlayerNumber pn, StageStats *pSource );
void Update( float fDeltaTime );
void TweenOffScreen();
private:
void Refresh();
PlayerNumber m_PlayerNumber;
StageStats *m_pSource;
int m_Last;
BitmapText m_textPercent;
BitmapText m_textPercentRemainder;
+2 -1
View File
@@ -2,6 +2,7 @@
#include "ScoreDisplayPercentage.h"
#include "ThemeManager.h"
#include "StageStats.h"
ScoreDisplayPercentage::ScoreDisplayPercentage()
{
@@ -14,5 +15,5 @@ ScoreDisplayPercentage::ScoreDisplayPercentage()
void ScoreDisplayPercentage::Init( PlayerNumber pn )
{
m_Percent.Load( pn );
m_Percent.Load( pn, &g_CurStageStats );
}
+1 -1
View File
@@ -496,7 +496,7 @@ void ScreenEvaluation::Init()
/* Use "ScreenEvaluation Percent" for the [metric set], but position and
* tween it with "PercentP1X", etc. */
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)),
THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) );
m_Percent[p].Command( THEME->GetMetric(m_sName,ssprintf("PercentP%dOnCommand",p+1)) );
+2 -5
View File
@@ -376,12 +376,9 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
SET_ON( 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.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 );
this->AddChild( &m_FeatDisplay[p][i].m_textScore );
+8 -7
View File
@@ -18,6 +18,7 @@
#include "Banner.h"
#include "HighScore.h"
#include "DifficultyIcon.h"
#include "PercentageDisplay.h"
class HighScoreWheelItem : public ActorFrame
@@ -78,13 +79,13 @@ private:
/* Feat display: */
struct FeatDisplay
{
HighScoreWheel m_Wheel;
GradeDisplay m_Grade;
DifficultyIcon m_Difficulty;
BitmapText m_textCategory;
BitmapText m_textScore;
Banner m_sprBanner;
Sprite m_sprBannerFrame;
HighScoreWheel m_Wheel;
GradeDisplay m_Grade;
DifficultyIcon m_Difficulty;
BitmapText m_textCategory;
PercentageDisplay m_textScore;
Banner m_sprBanner;
Sprite m_sprBannerFrame;
};
vector<FeatDisplay> m_FeatDisplay[NUM_PLAYERS];