code cleanup
This commit is contained in:
@@ -35,6 +35,8 @@ ScoreDisplayRolling::ScoreDisplayRolling()
|
||||
|
||||
void ScoreDisplayRolling::SetScore( float fNewScore )
|
||||
{
|
||||
m_fScore = fNewScore;
|
||||
|
||||
// super inefficient (but isn't called very often)
|
||||
CString sFormatString = ssprintf( "%%%d.0f", NUM_SCORE_DIGITS );
|
||||
CString sScore = ssprintf( sFormatString, fNewScore );
|
||||
@@ -47,6 +49,12 @@ void ScoreDisplayRolling::SetScore( float fNewScore )
|
||||
}
|
||||
|
||||
|
||||
float ScoreDisplayRolling::GetScore()
|
||||
{
|
||||
return m_fScore;
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayRolling::Update( float fDeltaTime )
|
||||
{
|
||||
BitmapText::Update( fDeltaTime );
|
||||
@@ -81,4 +89,45 @@ void ScoreDisplayRolling::Draw()
|
||||
SetText( ssprintf(sFormat, iCurScore) );
|
||||
|
||||
BitmapText::Draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ScoreDisplayRolling::AddToScore( TapStepScore stepscore, int iCurCombo )
|
||||
{
|
||||
// The scoring system for DDR versions 1 and 2 (including the Plus remixes) is as follows:
|
||||
// For every step:
|
||||
//
|
||||
// Multiplier (M) = (# of steps in your current combo / 4) rounded down
|
||||
// "Good" step = M * 100 (and this ends your combo)
|
||||
// "Great" step = M * M * 100
|
||||
// "Perfect" step = M * M * 300
|
||||
//
|
||||
// e.g. When you get a 259 combo, the 260th step will earn you:
|
||||
//
|
||||
// M = (260 / 4) rounded down
|
||||
// = 65
|
||||
// step = M x M X 100
|
||||
// = 65 x 65 x 100
|
||||
// = 422,500
|
||||
// Perfect step = Great step score x 3
|
||||
// = 422,500 x 3
|
||||
// = 1,267,500
|
||||
|
||||
float M = iCurCombo/4.0f;
|
||||
|
||||
float fScoreToAdd = 0;
|
||||
switch( stepscore )
|
||||
{
|
||||
case TSS_MISS: break;
|
||||
case TSS_BOO: break;
|
||||
case TSS_GOOD: fScoreToAdd = M * 100 + 100; break;
|
||||
case TSS_GREAT: fScoreToAdd = M * M * 100 + 300; break;
|
||||
case TSS_PERFECT: fScoreToAdd = M * M * 300 + 500; break;
|
||||
}
|
||||
m_fScore += fScoreToAdd;
|
||||
ASSERT( m_fScore >= 0 );
|
||||
|
||||
|
||||
this->SetScore( m_fScore );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user