added score display options

This commit is contained in:
Steven Towle
2005-01-09 07:47:38 +00:00
parent e4799d5b0e
commit 19ac29c9af
7 changed files with 72 additions and 5 deletions
+8 -2
View File
@@ -3607,8 +3607,9 @@ Line9=list,Holds
Line10=list,Mines
Line11=list,Hide
Line12=list,Persp
Line13=Steps
Line14=Characters
Line13=list,ScoreDisplay
Line14=Steps
Line15=Characters
CancelAllP1X=
CancelAllP1Y=
CancelAllP1OnCommand=
@@ -3833,6 +3834,11 @@ Persp,2=mod,overhead;name,Overhead
Persp,3=mod,space;name,Space
Persp,4=mod,hallway;name,Hallway
Persp,5=mod,distant;name,Distant
ScoreDisplay=3
ScoreDisplayDefault=mod,addscore
ScoreDisplay,1=mod,addscore;name,Add
ScoreDisplay,2=mod,subtractscore;name,Subtract
ScoreDisplay,3=mod,averagescore;name,Average
# Song options
LifeType=2,together
+10 -1
View File
@@ -33,6 +33,7 @@ void PlayerOptions::Init()
ZERO( m_bTurns );
ZERO( m_bTransforms );
m_bProTiming = false;
m_fScoreDisplay = SCORING_ADD;
m_sPositioning = ""; // "null"
m_sNoteSkin = "default";
}
@@ -313,7 +314,14 @@ void PlayerOptions::FromString( CString sOptions )
m_sNoteSkin = sBit;
else if( sBit == "noteskin" && !on ) /* "no noteskin" */
m_sNoteSkin = "default";
else if ( sBit == "randomspeed" ) SET_FLOAT( fRandomSpeed )
else if ( sBit == "randomspeed" )
SET_FLOAT( fRandomSpeed )
else if ( sBit == "addscore" )
m_fScoreDisplay = SCORING_ADD;
else if ( sBit == "subtractscore" )
m_fScoreDisplay = SCORING_SUBTRACT;
else if ( sBit == "averagescore" )
m_fScoreDisplay = SCORING_AVERAGE;
}
}
@@ -516,6 +524,7 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const
COMPARE(m_fScrollSpeed);
COMPARE(m_fScrollBPM);
COMPARE(m_fRandomSpeed);
COMPARE(m_fScoreDisplay);
COMPARE(m_fDark);
COMPARE(m_fBlind);
COMPARE(m_fCover);
+10 -1
View File
@@ -92,6 +92,13 @@ struct PlayerOptions
SCROLL_CENTERED,
NUM_SCROLLS
};
enum ScoreDisplay {
SCORING_ADD=0,
SCORING_SUBTRACT,
SCORING_AVERAGE,
NUM_SCOREDISPLAYS
};
float GetReversePercentForColumn( int iCol ) const; // accounts for all Directions
/* All floats have a corresponding speed setting, which determines how fast
@@ -114,10 +121,12 @@ struct PlayerOptions
/* If this is > 0, then the player must have life above this value at the end of
* the song to pass. This is independent of SongOptions::m_FailType. */
float m_fPassmark, m_SpeedfPassmark;
bool m_bTurns[NUM_TURNS];
bool m_bTransforms[NUM_TRANSFORMS];
bool m_bProTiming;
float m_fScoreDisplay;
CString m_sPositioning; /* The current positioning mode, or empty to use the normal positions. */
CString m_sNoteSkin;
+31
View File
@@ -6,6 +6,7 @@
#include "GameState.h"
#include "ThemeManager.h"
#include "PlayerState.h"
#include "StageStats.h"
const float SCORE_TWEEN_TIME = 0.2f;
@@ -24,6 +25,7 @@ ScoreDisplayNormal::ScoreDisplayNormal()
m_text.SetShadowLength( 0 );
m_iScore = 0;
m_iTrailingScore = 0;
m_iScoreVelocity = 0;
@@ -48,6 +50,35 @@ void ScoreDisplayNormal::SetScore( int iNewScore )
{
m_iScore = iNewScore;
// play some games to display the correct score -- the actual internal score does not change at all
// but the displayed one can (ie: displayed score for subtracrive is MaxScore - score)
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if ( m_pPlayerState->m_CurrentPlayerOptions.m_fScoreDisplay == PlayerOptions::SCORING_SUBTRACT )
{
if ( iNewScore == 0 && g_CurStageStats.m_player[pn].iMaxScoreToNow == 0 )
{
m_iScore = g_CurStageStats.m_player[pn].iMaxScore;
}
else
{
m_iScore = g_CurStageStats.m_player[pn].iMaxScore - ( g_CurStageStats.m_player[pn].iMaxScoreToNow - iNewScore );
}
}
else if ( m_pPlayerState->m_CurrentPlayerOptions.m_fScoreDisplay == PlayerOptions::SCORING_AVERAGE )
{
if ( g_CurStageStats.m_player[pn].iMaxScoreToNow == 0 ) // don't divide by zero fats
m_iScore = 0;
else
{
float scoreRatio = ( (float) iNewScore / (float) g_CurStageStats.m_player[pn].iMaxScoreToNow );
m_iScore = (int) ( scoreRatio * g_CurStageStats.m_player[pn].iMaxScore );
}
}
int iDelta = m_iScore - m_iTrailingScore;
m_iScoreVelocity = int(float(iDelta) / SCORE_TWEEN_TIME); // in score units per second
+8
View File
@@ -171,6 +171,7 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, c
m_iNumTapsAndHolds = pNoteData->GetNumRowsWithTapOrHoldHead() + pNoteData->GetNumHoldNotes();
m_iPointBonus = m_iMaxPossiblePoints;
m_pPlayerStageStats->iMaxScore = m_iMaxScoreSoFar;
ASSERT( m_iPointBonus >= 0 );
@@ -206,6 +207,7 @@ static int GetScore(int p, int B, int S, int n)
void ScoreKeeperMAX2::AddScore( TapNoteScore score )
{
int &iScore = m_pPlayerStageStats->iScore;
int &iMaxScoreToNow = m_pPlayerStageStats->iMaxScoreToNow;
/*
http://www.aaroninjapan.com/ddr2.html
@@ -284,6 +286,8 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
/* Subtract the maximum this step could have been worth from the bonus. */
m_iPointBonus -= GetScore(10, B, sum, m_iTapNotesHit);
/* And add the maximum this step could have been worth to the max score up to now. */
iMaxScoreToNow += GetScore(10, B, sum, m_iTapNotesHit);
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
{
@@ -292,11 +296,13 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
if ( m_bIsLastSongInCourse )
{
iScore += 100000000 - m_iMaxScoreSoFar;
iMaxScoreToNow += 100000000 - m_iMaxScoreSoFar;
/* If we're in Endless mode, we'll come around here again, so reset
* the bonus counter. */
m_iMaxScoreSoFar = 0;
}
iMaxScoreToNow += m_iPointBonus;
}
ASSERT( iScore >= 0 );
@@ -421,6 +427,8 @@ void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tap
if( holdScore == HNS_OK )
AddScore( TNS_MARVELOUS );
else if ( holdScore == HNS_NG )
AddScore( TNS_GOOD ); // required for subtractive score display to work properly
// TODO: Remove indexing with PlayerNumber
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
+3 -1
View File
@@ -18,7 +18,7 @@ void PlayerStageStats::Init()
fAliveSeconds = 0;
bFailed = bFailedEarlier = false;
iPossibleDancePoints = iActualDancePoints = 0;
iCurCombo = iMaxCombo = iCurMissCombo = iScore = iBonus = 0;
iCurCombo = iMaxCombo = iCurMissCombo = iScore = iBonus = iMaxScore = iMaxScoreToNow = 0;
fSecondsBeforeFail = 0;
iSongsPassed = iSongsPlayed = 0;
iTotalError = 0;
@@ -50,6 +50,8 @@ void PlayerStageStats::AddStats( const PlayerStageStats& other )
iMaxCombo += other.iMaxCombo;
iCurMissCombo += other.iCurMissCombo;
iScore += other.iScore;
iMaxScore += other.iMaxScore;
iMaxScoreToNow += other.iMaxScoreToNow;
radarPossible += other.radarPossible;
radarActual += other.radarActual;
fSecondsBeforeFail += other.fSecondsBeforeFail;
+2
View File
@@ -40,6 +40,8 @@ struct PlayerStageStats
int iMaxCombo;
int iCurMissCombo;
int iScore;
int iMaxScoreToNow;
int iMaxScore;
int iBonus; // bonus to be added on screeneval
RadarValues radarPossible; // filled in by ScreenGameplay on start of notes
RadarValues radarActual;