store scores as ints
nonstop scoring fixes
This commit is contained in:
@@ -274,7 +274,7 @@ void Notes::SetRadarValue(int r, float val)
|
||||
m_fRadarValues[r] = val;
|
||||
}
|
||||
|
||||
void Notes::AddScore( PlayerNumber pn, Grade grade, float iScore, bool& bNewRecordOut )
|
||||
void Notes::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut )
|
||||
{
|
||||
bNewRecordOut = false;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
int iScore;
|
||||
} m_MemCardScores[NUM_MEMORY_CARDS];
|
||||
|
||||
void AddScore( PlayerNumber pn, Grade grade, float iScore, bool& bNewRecordOut );
|
||||
void AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut );
|
||||
|
||||
|
||||
void TidyUpData();
|
||||
|
||||
@@ -663,7 +663,7 @@ void Player::HandleTapRowScore( unsigned row )
|
||||
m_pScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, m_pInventory);
|
||||
|
||||
if (m_pScore)
|
||||
m_pScore->SetScore(GAMESTATE->m_CurStageStats.fScore[m_PlayerNumber]);
|
||||
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
|
||||
|
||||
if( m_pLifeMeter ) {
|
||||
m_pLifeMeter->ChangeLife( scoreOfLastTap );
|
||||
@@ -689,7 +689,7 @@ void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
|
||||
m_pScoreKeeper->HandleHoldScore(holdScore, tapScore);
|
||||
|
||||
if (m_pScore)
|
||||
m_pScore->SetScore(GAMESTATE->m_CurStageStats.fScore[m_PlayerNumber]);
|
||||
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
|
||||
|
||||
if( m_pLifeMeter ) {
|
||||
m_pLifeMeter->ChangeLife( holdScore, tapScore );
|
||||
|
||||
@@ -19,7 +19,7 @@ class ScoreDisplay : public ActorFrame
|
||||
public:
|
||||
virtual void Init( PlayerNumber pn ) { m_PlayerNumber = pn; };
|
||||
|
||||
virtual void SetScore( float fNewScore ) {};
|
||||
virtual void SetScore( int iNewScore ) {};
|
||||
|
||||
protected:
|
||||
PlayerNumber m_PlayerNumber; // needed to look up statistics in GAMESTATE
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
#include "ThemeManager.h"
|
||||
|
||||
@@ -34,9 +33,9 @@ ScoreDisplayNormal::ScoreDisplayNormal()
|
||||
m_text.LoadFromNumbers( THEME->GetPathToN("ScoreDisplayNormal") );
|
||||
m_text.EnableShadow( false );
|
||||
|
||||
m_fScore = 0;
|
||||
m_fTrailingScore = 0;
|
||||
m_fScoreVelocity = 0;
|
||||
m_iScore = 0;
|
||||
m_iTrailingScore = 0;
|
||||
m_iScoreVelocity = 0;
|
||||
|
||||
CString s;
|
||||
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
|
||||
@@ -51,13 +50,13 @@ void ScoreDisplayNormal::Init( PlayerNumber pn )
|
||||
m_text.SetDiffuse( PlayerToColor(pn) );
|
||||
}
|
||||
|
||||
void ScoreDisplayNormal::SetScore( float fNewScore )
|
||||
{
|
||||
m_fScore = fNewScore;
|
||||
void ScoreDisplayNormal::SetScore( int iNewScore )
|
||||
{
|
||||
m_iScore = iNewScore;
|
||||
|
||||
float fDelta = (float)m_fScore - m_fTrailingScore;
|
||||
int iDelta = m_iScore - m_iTrailingScore;
|
||||
|
||||
m_fScoreVelocity = fDelta / SCORE_TWEEN_TIME; // in score units per second
|
||||
m_iScoreVelocity = int(float(iDelta) / SCORE_TWEEN_TIME); // in score units per second
|
||||
}
|
||||
|
||||
void ScoreDisplayNormal::SetText( CString s )
|
||||
@@ -69,19 +68,20 @@ void ScoreDisplayNormal::Update( float fDeltaTime )
|
||||
{
|
||||
ScoreDisplay::Update( fDeltaTime );
|
||||
|
||||
if( m_fTrailingScore != m_fScore )
|
||||
if( m_iTrailingScore != m_iScore )
|
||||
{
|
||||
float fDeltaBefore = (float)m_fScore - m_fTrailingScore;
|
||||
m_fTrailingScore += m_fScoreVelocity * fDeltaTime;
|
||||
float fDeltaAfter = (float)m_fScore - m_fTrailingScore;
|
||||
int iDeltaBefore = m_iScore - m_iTrailingScore;
|
||||
m_iTrailingScore += int(m_iScoreVelocity * fDeltaTime);
|
||||
int iDeltaAfter = m_iScore - m_iTrailingScore;
|
||||
|
||||
if( fDeltaBefore * fDeltaAfter < 0 ) // the sign changed
|
||||
if( (iDeltaBefore < 0 && iDeltaAfter > 0) ||
|
||||
(iDeltaBefore > 0 && iDeltaAfter < 0) ) // the sign changed
|
||||
{
|
||||
m_fTrailingScore = (float)m_fScore;
|
||||
m_fScoreVelocity = 0;
|
||||
m_iTrailingScore = m_iScore;
|
||||
m_iScoreVelocity = 0;
|
||||
}
|
||||
|
||||
m_text.SetText( ssprintf("%*.0f", NUM_SCORE_DIGITS, m_fTrailingScore) );
|
||||
m_text.SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, m_iTrailingScore) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,16 +25,16 @@ public:
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
|
||||
virtual void SetScore( float fNewScore );
|
||||
virtual void SetScore( int iNewScore );
|
||||
virtual void SetText( CString s );
|
||||
|
||||
protected:
|
||||
Sprite m_sprFrame;
|
||||
BitmapText m_text;
|
||||
|
||||
float m_fScore; // the actual score
|
||||
float m_fTrailingScore; // what is displayed temporarily
|
||||
float m_fScoreVelocity; // how fast trailing approaches real score
|
||||
int m_iScore; // the actual score
|
||||
int m_iTrailingScore; // what is displayed temporarily
|
||||
int m_iScoreVelocity; // how fast trailing approaches real score
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -95,26 +95,26 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Notes* pNotes )
|
||||
int sum = (N * (N + 1)) / 2;
|
||||
|
||||
int iMaxPossiblePoints = 0;
|
||||
int courseMult = 0;
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
{
|
||||
const int numSongsInCourse = apNotes.size();
|
||||
int courseMult = (numSongsInCourse * (numSongsInCourse + 1)) / 2;
|
||||
courseMult = (numSongsInCourse * (numSongsInCourse + 1)) / 2;
|
||||
|
||||
if ( iSongInCourseIndex == numSongsInCourse - 1 )
|
||||
m_bIsLastSongInCourse = true;
|
||||
|
||||
iMaxPossiblePoints = (10000000 * (iSongInCourseIndex+1)) / courseMult;
|
||||
iMaxPossiblePoints = (100000000 * (iSongInCourseIndex+1)) / courseMult;
|
||||
m_iMaxScoreSoFar += iMaxPossiblePoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
int iMeter = pNotes->GetMeter();
|
||||
CLAMP( iMeter, 1, 10 );
|
||||
iMaxPossiblePoints = iMeter * 1000000;
|
||||
iMaxPossiblePoints = iMeter * 10000000;
|
||||
}
|
||||
|
||||
m_iScoreMultiplier = iMaxPossiblePoints / sum;
|
||||
m_iPointBonus = (iMaxPossiblePoints * 10) - (sum * 10 * m_iScoreMultiplier);
|
||||
m_iScoreMultiplier = iMaxPossiblePoints / (10*sum);
|
||||
m_iPointBonus = iMaxPossiblePoints - (sum * 10 * m_iScoreMultiplier);
|
||||
|
||||
ASSERT( m_iScoreMultiplier >= 0 );
|
||||
ASSERT( m_iPointBonus >= 0 );
|
||||
@@ -182,7 +182,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
||||
|
||||
printf( "score: %i\n", m_iScore );
|
||||
|
||||
GAMESTATE->m_CurStageStats.fScore[m_PlayerNumber] = float(m_iScore);
|
||||
GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber] = m_iScore;
|
||||
}
|
||||
|
||||
void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, Inventory* pInventory )
|
||||
|
||||
@@ -200,7 +200,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
|
||||
{
|
||||
if( GAMESTATE->IsHumanPlayer(p) )
|
||||
{
|
||||
GAMESTATE->m_pCurNotes[p]->AddScore( (PlayerNumber)p, grade[p], stageStats.fScore[p], bNewRecord[p] );
|
||||
GAMESTATE->m_pCurNotes[p]->AddScore( (PlayerNumber)p, grade[p], stageStats.iScore[p], bNewRecord[p] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
|
||||
fTotalDP += stageStats.iActualDancePoints[p];
|
||||
}
|
||||
|
||||
SONGMAN->AddScores( nt, bIsHumanPlayer, cat, stageStats.fScore, iRankingIndex );
|
||||
SONGMAN->AddScores( nt, bIsHumanPlayer, cat, stageStats.iScore, iRankingIndex );
|
||||
|
||||
COPY( GAMESTATE->m_RankingCategory, cat );
|
||||
COPY( GAMESTATE->m_iRankingIndex, iRankingIndex );
|
||||
@@ -591,7 +591,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
|
||||
m_textScore[p].SetDiffuse( PlayerToColor(p) );
|
||||
m_textScore[p].SetName( ssprintf("ScoreNumberP%d",p+1) );
|
||||
UtilSetXYAndOnCommand( m_textScore[p], "ScreenEvaluation" );
|
||||
m_textScore[p].SetText( ssprintf("%*.0f", NUM_SCORE_DIGITS, stageStats.fScore[p]) );
|
||||
m_textScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, stageStats.iScore[p]) );
|
||||
this->AddChild( &m_textScore[p] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,9 +204,9 @@ void ScreenRanking::SetPage( PageToShow pts )
|
||||
{
|
||||
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
|
||||
CString sName = SONGMAN->m_MachineScores[pts.nt][pts.category][l].sName;
|
||||
float fScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].fScore;
|
||||
int iScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].iScore;
|
||||
m_textNames[l].SetText( sName );
|
||||
m_textScores[l].SetText( ssprintf("%09.0f",fScore) );
|
||||
m_textScores[l].SetText( ssprintf("%09i",iScore) );
|
||||
m_textPoints[l].SetText( "" );
|
||||
m_textTime[l].SetText( "" );
|
||||
m_textNames[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
||||
|
||||
@@ -749,7 +749,7 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
|
||||
Notes* m_pNotes = GAMESTATE->m_pCurNotes[pn];
|
||||
|
||||
if( m_pNotes && SONGMAN->IsUsingMemoryCard(pn) )
|
||||
m_textHighScore[pn].SetText( ssprintf("%*.0f", NUM_SCORE_DIGITS, m_pNotes->m_MemCardScores[pn].fScore) );
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, m_pNotes->m_MemCardScores[pn].iScore) );
|
||||
|
||||
m_DifficultyIcon[pn].SetFromNotes( pn, pNotes );
|
||||
if( pNotes && pNotes->IsAutogen() )
|
||||
|
||||
@@ -247,7 +247,7 @@ void SongManager::InitMachineScoresFromDisk()
|
||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||
{
|
||||
m_MachineScores[i][j][k].fScore = 573000;
|
||||
m_MachineScores[i][j][k].iScore = 573000;
|
||||
m_MachineScores[i][j][k].sName = DEFAULT_RANKING_NAME;
|
||||
}
|
||||
}
|
||||
@@ -267,7 +267,7 @@ void SongManager::InitMachineScoresFromDisk()
|
||||
if( fp && !feof(fp) )
|
||||
{
|
||||
char szName[256];
|
||||
fscanf(fp, "%f %[^\n]\n", &m_MachineScores[i][j][k].fScore, szName);
|
||||
fscanf(fp, "%f %[^\n]\n", &m_MachineScores[i][j][k].iScore, szName);
|
||||
m_MachineScores[i][j][k].sName = szName;
|
||||
}
|
||||
}
|
||||
@@ -364,14 +364,14 @@ void SongManager::InitMachineScoresFromDisk()
|
||||
|
||||
int iNumTimesPlayed;
|
||||
Grade grade;
|
||||
float fScore;
|
||||
if( sscanf(line.c_str(), "%d %d %f\n", &iNumTimesPlayed, &grade, &fScore) != 3 )
|
||||
int iScore;
|
||||
if( sscanf(line.c_str(), "%d %d %i\n", &iNumTimesPlayed, &grade, &iScore) != 3 )
|
||||
break;
|
||||
if( pNotes )
|
||||
{
|
||||
pNotes->m_MemCardScores[c].iNumTimesPlayed = iNumTimesPlayed;
|
||||
pNotes->m_MemCardScores[c].grade = grade;
|
||||
pNotes->m_MemCardScores[c].fScore = fScore;
|
||||
pNotes->m_MemCardScores[c].iScore = iScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -434,7 +434,7 @@ void SongManager::SaveMachineScoresToDisk()
|
||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||
if( fp )
|
||||
fprintf(fp, "%f %s\n", m_MachineScores[i][j][k].fScore, m_MachineScores[i][j][k].sName.c_str());
|
||||
fprintf(fp, "%i %s\n", m_MachineScores[i][j][k].iScore, m_MachineScores[i][j][k].sName.c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
@@ -512,10 +512,10 @@ void SongManager::SaveMachineScoresToDisk()
|
||||
pNotes->GetDifficulty(),
|
||||
pNotes->GetDescription().c_str() );
|
||||
|
||||
fprintf(fp, "%d %d %f\n",
|
||||
fprintf(fp, "%d %d %i\n",
|
||||
pNotes->m_MemCardScores[c].iNumTimesPlayed,
|
||||
pNotes->m_MemCardScores[c].grade,
|
||||
pNotes->m_MemCardScores[c].fScore);
|
||||
pNotes->m_MemCardScores[c].iScore);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -998,13 +998,11 @@ struct CategoryScoreToInsert
|
||||
{
|
||||
PlayerNumber pn;
|
||||
RankingCategory cat;
|
||||
float fScore;
|
||||
int iScore;
|
||||
|
||||
static int CompareDescending( const CategoryScoreToInsert &hs1, const CategoryScoreToInsert &hs2 )
|
||||
{
|
||||
if( hs1.fScore > hs2.fScore ) return -1;
|
||||
else if( hs1.fScore == hs2.fScore ) return 0;
|
||||
else return +1;
|
||||
return hs1.iScore > hs2.iScore;
|
||||
}
|
||||
static void SortDescending( vector<CategoryScoreToInsert>& vHSout )
|
||||
{
|
||||
@@ -1015,7 +1013,7 @@ struct CategoryScoreToInsert
|
||||
// set iNewRecordIndex = -1 if not a new record
|
||||
void SongManager::AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS],
|
||||
RankingCategory hsc[NUM_PLAYERS],
|
||||
float fScore[NUM_PLAYERS],
|
||||
int iScore[NUM_PLAYERS],
|
||||
int iNewRecordIndexOut[NUM_PLAYERS] )
|
||||
{
|
||||
vector<CategoryScoreToInsert> vHS;
|
||||
@@ -1029,7 +1027,7 @@ void SongManager::AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS],
|
||||
CategoryScoreToInsert hs;
|
||||
hs.pn = (PlayerNumber)p;
|
||||
hs.cat = hsc[p];
|
||||
hs.fScore = fScore[p];
|
||||
hs.iScore = iScore[p];
|
||||
vHS.push_back( hs );
|
||||
}
|
||||
|
||||
@@ -1043,13 +1041,13 @@ void SongManager::AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS],
|
||||
MachineScore* machineScores = m_MachineScores[nt][newHS.cat];
|
||||
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
||||
{
|
||||
if( newHS.fScore > machineScores[i].fScore )
|
||||
if( newHS.iScore > machineScores[i].iScore )
|
||||
{
|
||||
// We found the insert point. Shift down.
|
||||
for( int j=NUM_RANKING_LINES-1; j>i; j-- )
|
||||
machineScores[j] = machineScores[j-1];
|
||||
// insert
|
||||
machineScores[i].fScore = newHS.fScore;
|
||||
machineScores[i].iScore = newHS.iScore;
|
||||
machineScores[i].sName = DEFAULT_RANKING_NAME;
|
||||
iNewRecordIndexOut[newHS.pn] = i;
|
||||
break;
|
||||
|
||||
@@ -92,10 +92,10 @@ public:
|
||||
|
||||
struct MachineScore
|
||||
{
|
||||
float fScore;
|
||||
int iScore;
|
||||
CString sName;
|
||||
} m_MachineScores[NUM_NOTES_TYPES][NUM_RANKING_CATEGORIES][NUM_RANKING_LINES];
|
||||
void AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], RankingCategory hsc[NUM_PLAYERS], float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
||||
void AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], RankingCategory hsc[NUM_PLAYERS], int iScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
||||
|
||||
protected:
|
||||
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
||||
|
||||
@@ -39,7 +39,7 @@ void StageStats::operator+=( const StageStats& other )
|
||||
iHoldNoteScores[p][h] += other.iHoldNoteScores[p][h];
|
||||
iCurCombo[p] += other.iCurCombo[p];
|
||||
iMaxCombo[p] += other.iMaxCombo[p];
|
||||
fScore[p] += other.fScore[p];
|
||||
iScore[p] += other.iScore[p];
|
||||
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
|
||||
{
|
||||
fRadarPossible[p][r] += other.fRadarPossible[p][r];
|
||||
|
||||
@@ -34,7 +34,7 @@ struct StageStats
|
||||
int iHoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES];
|
||||
int iCurCombo[NUM_PLAYERS];
|
||||
int iMaxCombo[NUM_PLAYERS];
|
||||
float fScore[NUM_PLAYERS];
|
||||
int iScore[NUM_PLAYERS];
|
||||
float fRadarPossible[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
|
||||
float fRadarActual[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
|
||||
float fSecondsBeforeFail[NUM_PLAYERS]; // -1 means didn't/hasn't failed
|
||||
|
||||
Reference in New Issue
Block a user