This commit is contained in:
Steve Checkoway
2003-09-26 00:43:44 +00:00
parent 02b39c51c0
commit 5ab83410aa
+182 -183
View File
@@ -1,14 +1,14 @@
#include "global.h" #include "global.h"
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: ScoreKeeperMAX2 Class: ScoreKeeperMAX2
Desc: Desc:
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "ScoreKeeperMAX2.h" #include "ScoreKeeperMAX2.h"
#include "GameState.h" #include "GameState.h"
#include "PrefsManager.h" #include "PrefsManager.h"
@@ -26,11 +26,11 @@
ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Steps*>& apNotes_, const CStringArray &asModifiers, PlayerNumber pn_ ): ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Steps*>& apNotes_, const CStringArray &asModifiers, PlayerNumber pn_ ):
ScoreKeeper(pn_), apNotes(apNotes_) ScoreKeeper(pn_), apNotes(apNotes_)
{ {
// //
// Fill in m_CurStageStats, calculate multiplier // Fill in m_CurStageStats, calculate multiplier
// //
int iTotalPossibleDancePoints = 0; int iTotalPossibleDancePoints = 0;
for( unsigned i=0; i<apNotes.size(); i++ ) for( unsigned i=0; i<apNotes.size(); i++ )
{ {
@@ -56,7 +56,7 @@ ScoreKeeper(pn_), apNotes(apNotes_)
ModsForThisSong.FromString( asModifiers[i] ); ModsForThisSong.FromString( asModifiers[i] );
NoteData playerNoteDataPostModifiers(playerNoteData); NoteData playerNoteDataPostModifiers(playerNoteData);
NoteDataUtil::TransformNoteData( playerNoteDataPostModifiers, ModsForThisSong, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); NoteDataUtil::TransformNoteData( playerNoteDataPostModifiers, ModsForThisSong, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( playerNoteData, playerNoteDataPostModifiers ); iTotalPossibleDancePoints += this->GetPossibleDancePoints( playerNoteData, playerNoteDataPostModifiers );
} }
@@ -73,43 +73,43 @@ ScoreKeeper(pn_), apNotes(apNotes_)
memset( m_ComboBonusFactor, 0, sizeof(m_ComboBonusFactor) ); memset( m_ComboBonusFactor, 0, sizeof(m_ComboBonusFactor) );
switch( PREFSMAN->m_iScoringType ) switch( PREFSMAN->m_iScoringType )
{ {
case PrefsManager::SCORING_MAX2: case PrefsManager::SCORING_MAX2:
m_iRoundTo = 1; m_iRoundTo = 1;
break; break;
case PrefsManager::SCORING_5TH: case PrefsManager::SCORING_5TH:
m_iRoundTo = 5; m_iRoundTo = 5;
if (!GAMESTATE->IsCourseMode()) if (!GAMESTATE->IsCourseMode())
{ {
m_ComboBonusFactor[TNS_MARVELOUS] = 55; m_ComboBonusFactor[TNS_MARVELOUS] = 55;
m_ComboBonusFactor[TNS_PERFECT] = 55; m_ComboBonusFactor[TNS_PERFECT] = 55;
m_ComboBonusFactor[TNS_GREAT] = 33; m_ComboBonusFactor[TNS_GREAT] = 33;
} }
break; break;
default: default:
ASSERT(0); ASSERT(0);
} }
} }
void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Steps* pNotes, NoteData* pNoteData ) void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Steps* pNotes, NoteData* pNoteData )
{ {
/* /*
http://www.aaroninjapan.com/ddr2.html http://www.aaroninjapan.com/ddr2.html
Note on NONSTOP Mode scoring Note on NONSTOP Mode scoring
Nonstop mode requires the player to play 4 songs in succession, with the total maximum possible score for the four song set being 100,000,000. This comes from the sum of the four stages' maximum possible scores, which, regardless of song or difficulty is: Nonstop mode requires the player to play 4 songs in succession, with the total maximum possible score for the four song set being 100,000,000. This comes from the sum of the four stages' maximum possible scores, which, regardless of song or difficulty is:
10,000,000 for the first song 10,000,000 for the first song
20,000,000 for the second song 20,000,000 for the second song
30,000,000 for the third song 30,000,000 for the third song
40,000,000 for the fourth song 40,000,000 for the fourth song
We extend this to work with nonstop courses of any length. We extend this to work with nonstop courses of any length.
We also keep track of this scoring type in endless, with 100mil per iteration We also keep track of this scoring type in endless, with 100mil per iteration
of all songs, though this score isn't actually seen anywhere right now. of all songs, though this score isn't actually seen anywhere right now.
*/ */
// //
// Calculate the score multiplier // Calculate the score multiplier
// //
@@ -147,14 +147,14 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Steps* pNotes, NoteDat
int iLengthMultiplier = SongManager::GetNumStagesForSong( GAMESTATE->m_pCurSong ); int iLengthMultiplier = SongManager::GetNumStagesForSong( GAMESTATE->m_pCurSong );
switch( PREFSMAN->m_iScoringType ) switch( PREFSMAN->m_iScoringType )
{ {
case PrefsManager::SCORING_MAX2: case PrefsManager::SCORING_MAX2:
m_iMaxPossiblePoints = iMeter * 10000000 * iLengthMultiplier; m_iMaxPossiblePoints = iMeter * 10000000 * iLengthMultiplier;
break; break;
case PrefsManager::SCORING_5TH: case PrefsManager::SCORING_5TH:
m_iMaxPossiblePoints = (iMeter + 1) * 5000000 * iLengthMultiplier; m_iMaxPossiblePoints = (iMeter + 1) * 5000000 * iLengthMultiplier;
break; break;
default: default:
ASSERT(0); ASSERT(0);
} }
} }
ASSERT( m_iMaxPossiblePoints >= 0 ); ASSERT( m_iMaxPossiblePoints >= 0 );
@@ -198,26 +198,26 @@ static int GetScore(int p, int B, int S, int n)
void ScoreKeeperMAX2::AddScore( TapNoteScore score ) void ScoreKeeperMAX2::AddScore( TapNoteScore score )
{ {
int &iScore = GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]; int &iScore = GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber];
/* /*
http://www.aaroninjapan.com/ddr2.html http://www.aaroninjapan.com/ddr2.html
Regular scoring: Regular scoring:
Let p = score multiplier (Perfect = 10, Great = 5, other = 0) Let p = score multiplier (Perfect = 10, Great = 5, other = 0)
Note on NONSTOP Mode scoring Note on NONSTOP Mode scoring
Let p = score multiplier (Marvelous = 10, Perfect = 9, Great = 5, other = 0) Let p = score multiplier (Marvelous = 10, Perfect = 9, Great = 5, other = 0)
*/ */
int p = 0; // score multiplier int p = 0; // score multiplier
switch( score ) switch( score )
{ {
case TNS_MARVELOUS: p = 10; break; case TNS_MARVELOUS: p = 10; break;
case TNS_PERFECT: p = GAMESTATE->ShowMarvelous()? 9:10; break; case TNS_PERFECT: p = GAMESTATE->ShowMarvelous()? 9:10; break;
case TNS_GREAT: p = 5; break; case TNS_GREAT: p = 5; break;
default: p = 0; break; default: p = 0; break;
} }
m_iTapNotesHit++; m_iTapNotesHit++;
@@ -293,26 +293,26 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
// Regular combo // Regular combo
// //
/* /*
http://www.aaroninjapan.com/ddr2.html http://www.aaroninjapan.com/ddr2.html
Note on ONI Mode scoring Note on ONI Mode scoring
Your combo counter only increased with a "Marvelous/Perfect", and double Marvelous/Perfect steps (left and right, etc.) Your combo counter only increased with a "Marvelous/Perfect", and double Marvelous/Perfect steps (left and right, etc.)
only add 1 to your combo instead of 2. The combo counter thus becomes a "Marvelous/Perfect" counter. only add 1 to your combo instead of 2. The combo counter thus becomes a "Marvelous/Perfect" counter.
*/ */
/* True if a jump is one to combo, false if combo is purely based on tap count. */ /* True if a jump is one to combo, false if combo is purely based on tap count. */
bool ComboIsPerRow = true; bool ComboIsPerRow = true;
switch( PREFSMAN->m_iScoringType ) switch( PREFSMAN->m_iScoringType )
{ {
case PrefsManager::SCORING_MAX2: case PrefsManager::SCORING_MAX2:
ComboIsPerRow = (GAMESTATE->m_PlayMode == PLAY_MODE_ONI); ComboIsPerRow = (GAMESTATE->m_PlayMode == PLAY_MODE_ONI);
break; break;
case PrefsManager::SCORING_5TH: case PrefsManager::SCORING_5TH:
ComboIsPerRow = true; ComboIsPerRow = true;
break; break;
default: default:
ASSERT(0); ASSERT(0);
} }
const int ComboCountIfHit = ComboIsPerRow? 1: iNumTapsInRow; const int ComboCountIfHit = ComboIsPerRow? 1: iNumTapsInRow;
TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT; TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT;
@@ -320,43 +320,43 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
if( scoreOfLastTap >= MinScoreToContinueCombo ) if( scoreOfLastTap >= MinScoreToContinueCombo )
GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber] += ComboCountIfHit; GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber] += ComboCountIfHit;
/* /*
http://www.aaroninjapan.com/ddr2.html http://www.aaroninjapan.com/ddr2.html
A single step's points are calculated as follows: A single step's points are calculated as follows:
p = score multiplier (Perfect = 10, Great = 5, other = 0) p = score multiplier (Perfect = 10, Great = 5, other = 0)
N = total number of steps and freeze steps N = total number of steps and freeze steps
S = The sum of all integers from 1 to N (the total number of steps/freeze steps) S = The sum of all integers from 1 to N (the total number of steps/freeze steps)
n = number of the current step or freeze step (varies from 1 to N) n = number of the current step or freeze step (varies from 1 to N)
B = Base value of the song (1,000,000 X the number of feet difficulty) - All edit data is rated as 5 feet B = Base value of the song (1,000,000 X the number of feet difficulty) - All edit data is rated as 5 feet
So, the score for one step is: So, the score for one step is:
one_step_score = p * (B/S) * n one_step_score = p * (B/S) * n
*IMPORTANT* : Double steps (U+L, D+R, etc.) count as two steps instead of one *for your combo count only*, *IMPORTANT* : Double steps (U+L, D+R, etc.) count as two steps instead of one *for your combo count only*,
so if you get a double L+R on the 112th step of a song, you score is calculated for only one step, not two, so if you get a double L+R on the 112th step of a song, you score is calculated for only one step, not two,
as the combo counter might otherwise imply. as the combo counter might otherwise imply.
Now, through simple algebraic manipulation: Now, through simple algebraic manipulation:
S = 1+...+N = (1+N)*N/2 (1 through N added together) S = 1+...+N = (1+N)*N/2 (1 through N added together)
Okay, time for an example. Suppose we wanted to calculate the step score of a "Great" on the 57th step of Okay, time for an example. Suppose we wanted to calculate the step score of a "Great" on the 57th step of
a 441 step, 8-foot difficulty song (I'm just making this one up): a 441 step, 8-foot difficulty song (I'm just making this one up):
S = (1 + 441)*441 / 2 S = (1 + 441)*441 / 2
= 194,222 / 2 = 194,222 / 2
= 97,461 = 97,461
StepScore = p * (B/S) * n StepScore = p * (B/S) * n
= 5 * (8,000,000 / 97,461) * 57 = 5 * (8,000,000 / 97,461) * 57
= 5 * (82) * 57 (The 82 is rounded down from 82.08411...) = 5 * (82) * 57 (The 82 is rounded down from 82.08411...)
= 23,370 = 23,370
Remember this is just the score for the step, not the cumulative score up to the 57th step. Also, please note that Remember this is just the score for the step, not the cumulative score up to the 57th step. Also, please note that
I am currently checking into rounding errors with the system and if there are any, how they are resolved in the system. I am currently checking into rounding errors with the system and if there are any, how they are resolved in the system.
Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible
score for any song is the number of feet difficulty X 10,000,000. score for any song is the number of feet difficulty X 10,000,000.
*/ */
AddScore( scoreOfLastTap ); // only score once per row AddScore( scoreOfLastTap ); // only score once per row
@@ -376,19 +376,19 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
// //
switch( scoreOfLastTap ) switch( scoreOfLastTap )
{ {
case TNS_MARVELOUS: case TNS_MARVELOUS:
case TNS_PERFECT: case TNS_PERFECT:
m_iCurToastyCombo += iNumTapsInRow; m_iCurToastyCombo += iNumTapsInRow;
if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox ) if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox )
{ {
SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 ); SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 );
UNLOCKSYS->UnlockToasty(); UNLOCKSYS->UnlockToasty();
} }
break; break;
default: default:
m_iCurToastyCombo = 0; m_iCurToastyCombo = 0;
break; break;
} }
} }
@@ -416,7 +416,7 @@ int ScoreKeeperMAX2::GetPossibleDancePoints( const NoteData &preNoteData, const
int NumTaps = max( preNoteData.GetNumRowsWithTaps(), postNoteData.GetNumRowsWithTaps() ); int NumTaps = max( preNoteData.GetNumRowsWithTaps(), postNoteData.GetNumRowsWithTaps() );
int NumHolds = max( preNoteData.GetNumHoldNotes(), postNoteData.GetNumHoldNotes() ); int NumHolds = max( preNoteData.GetNumHoldNotes(), postNoteData.GetNumHoldNotes() );
return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+ return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+
NumHolds*HoldNoteScoreToDancePoints(HNS_OK); NumHolds*HoldNoteScoreToDancePoints(HNS_OK);
} }
@@ -425,68 +425,68 @@ int ScoreKeeperMAX2::TapNoteScoreToDancePoints( TapNoteScore tns )
if( !GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS ) if( !GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS )
tns = TNS_PERFECT; tns = TNS_PERFECT;
/* /*
http://www.aaroninjapan.com/ddr2.html http://www.aaroninjapan.com/ddr2.html
Regular play scoring Regular play scoring
A "Perfect" is worth 2 points A "Perfect" is worth 2 points
A "Great" is worth 1 points A "Great" is worth 1 points
A "Good" is worth 0 points A "Good" is worth 0 points
A "Boo" will subtract 4 points A "Boo" will subtract 4 points
A "Miss" will subtract 8 points A "Miss" will subtract 8 points
An "OK" (Successful Freeze step) will add 6 points An "OK" (Successful Freeze step) will add 6 points
A "NG" (Unsuccessful Freeze step) is worth 0 points A "NG" (Unsuccessful Freeze step) is worth 0 points
Note on ONI Mode scoring Note on ONI Mode scoring
The total number of Dance Points is calculated with Marvelous steps being worth 3 points, Perfects getting The total number of Dance Points is calculated with Marvelous steps being worth 3 points, Perfects getting
2 points, OKs getting 3 points, Greats getting 1 point, and everything else is worth 0 points. (Note: The 2 points, OKs getting 3 points, Greats getting 1 point, and everything else is worth 0 points. (Note: The
"Marvelous" step rating is a new rating to DDR Extreme only used in Oni and Nonstop modes. They are rated "Marvelous" step rating is a new rating to DDR Extreme only used in Oni and Nonstop modes. They are rated
higher than "Perfect" steps). higher than "Perfect" steps).
Note on NONSTOP Mode scoring Note on NONSTOP Mode scoring
A "Marvelous" is worth 2 points A "Marvelous" is worth 2 points
A "Perfect" is also worth 2 points A "Perfect" is also worth 2 points
A "Great" is worth 1 points A "Great" is worth 1 points
A "Good" is worth 0 points A "Good" is worth 0 points
A "Boo" will subtract 4 points A "Boo" will subtract 4 points
A "Miss" will subtract 8 points A "Miss" will subtract 8 points
An "OK" (Successful Freeze step) will add 6 points An "OK" (Successful Freeze step) will add 6 points
A "NG" (Unsuccessful Freeze step) is worth 0 points A "NG" (Unsuccessful Freeze step) is worth 0 points
*/ */
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_ARCADE: case PLAY_MODE_ARCADE:
case PLAY_MODE_BATTLE: case PLAY_MODE_BATTLE:
case PLAY_MODE_RAVE: case PLAY_MODE_RAVE:
case PLAY_MODE_ENDLESS: case PLAY_MODE_ENDLESS:
case PLAY_MODE_NONSTOP: case PLAY_MODE_NONSTOP:
switch( tns ) switch( tns )
{ {
case TNS_MARVELOUS: return +2; case TNS_MARVELOUS: return +2;
case TNS_PERFECT: return +2; case TNS_PERFECT: return +2;
case TNS_GREAT: return +1; case TNS_GREAT: return +1;
case TNS_GOOD: return +0; case TNS_GOOD: return +0;
case TNS_BOO: return -4; case TNS_BOO: return -4;
case TNS_MISS: return -8; case TNS_MISS: return -8;
} }
break; break;
case PLAY_MODE_ONI: case PLAY_MODE_ONI:
switch( tns ) switch( tns )
{ {
case TNS_MARVELOUS: return +3; case TNS_MARVELOUS: return +3;
case TNS_PERFECT: return +2; case TNS_PERFECT: return +2;
case TNS_GREAT: return +1; case TNS_GREAT: return +1;
case TNS_GOOD: return +0; case TNS_GOOD: return +0;
case TNS_BOO: return +0; case TNS_BOO: return +0;
case TNS_MISS: return +0; case TNS_MISS: return +0;
} }
break; break;
default: default:
ASSERT(0); ASSERT(0);
} }
return +0; return +0;
} }
@@ -495,27 +495,26 @@ int ScoreKeeperMAX2::HoldNoteScoreToDancePoints( HoldNoteScore hns )
{ {
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_ARCADE: case PLAY_MODE_ARCADE:
case PLAY_MODE_BATTLE: case PLAY_MODE_BATTLE:
case PLAY_MODE_RAVE: case PLAY_MODE_RAVE:
case PLAY_MODE_ENDLESS: case PLAY_MODE_ENDLESS:
case PLAY_MODE_NONSTOP: case PLAY_MODE_NONSTOP:
switch( hns ) switch( hns )
{ {
case HNS_OK: return +6; case HNS_OK: return +6;
case HNS_NG: return +0; case HNS_NG: return +0;
} }
break; break;
case PLAY_MODE_ONI: case PLAY_MODE_ONI:
switch( hns ) switch( hns )
{ {
case HNS_OK: return GAMESTATE->ShowMarvelous()? +3:+2; case HNS_OK: return GAMESTATE->ShowMarvelous()? +3:+2;
case HNS_NG: return +0; case HNS_NG: return +0;
} }
break; break;
default: default:
ASSERT(0); ASSERT(0);
} }
return +0; return +0;
} }