fix bogus initial calorie number
This commit is contained in:
@@ -37,11 +37,19 @@ void ScoreDisplayCalories::LoadFromNode( const CString& sDir, const XNode* pNode
|
|||||||
|
|
||||||
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
|
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
|
||||||
|
|
||||||
UpdateNumber();
|
|
||||||
|
|
||||||
MESSAGEMAN->Subscribe( this, m_sMessageOnStep );
|
MESSAGEMAN->Subscribe( this, m_sMessageOnStep );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScoreDisplayCalories::Update( float fDelta )
|
||||||
|
{
|
||||||
|
// We have to set the initial text after StatsManager::CalcAccumStageStats
|
||||||
|
// is called.
|
||||||
|
if( IsFirstUpdate() )
|
||||||
|
UpdateNumber();
|
||||||
|
|
||||||
|
RollingNumbers::Update( fDelta );
|
||||||
|
}
|
||||||
|
|
||||||
void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
|
void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
|
||||||
{
|
{
|
||||||
if( sCommandName == m_sMessageOnStep )
|
if( sCommandName == m_sMessageOnStep )
|
||||||
@@ -54,8 +62,10 @@ void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
|
|||||||
|
|
||||||
void ScoreDisplayCalories::UpdateNumber()
|
void ScoreDisplayCalories::UpdateNumber()
|
||||||
{
|
{
|
||||||
float fCals = STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned;
|
float fCals =
|
||||||
fCals += STATSMAN->GetAccumStageStats().m_player[m_PlayerNumber].fCaloriesBurned;
|
STATSMAN->GetAccumStageStats().m_player[m_PlayerNumber].fCaloriesBurned +
|
||||||
|
STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned;
|
||||||
|
|
||||||
SetTargetNumber( fCals );
|
SetTargetNumber( fCals );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ public:
|
|||||||
ScoreDisplayCalories();
|
ScoreDisplayCalories();
|
||||||
~ScoreDisplayCalories();
|
~ScoreDisplayCalories();
|
||||||
|
|
||||||
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||||
|
|
||||||
void PlayCommand( const CString &sCommandName );
|
void PlayCommand( const CString &sCommandName );
|
||||||
|
|||||||
Reference in New Issue
Block a user