code cleanup

This commit is contained in:
Chris Danford
2002-02-24 01:43:11 +00:00
parent f2a7f50634
commit 54f442350a
36 changed files with 1019 additions and 1568 deletions
+50 -1
View File
@@ -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 );
}