fix machine high score index when players both get in the same HighScoreList

This commit is contained in:
Chris Danford
2004-05-02 11:35:13 +00:00
parent 07bc79ed35
commit f12a0e25f3
2 changed files with 131 additions and 165 deletions
+16
View File
@@ -36,12 +36,28 @@ struct HighScore
iScore = 0; iScore = 0;
fPercentDP = 0; fPercentDP = 0;
fSurviveSeconds = 0; fSurviveSeconds = 0;
sModifiers = "";
time = 0; time = 0;
sPlayerGuid = ""; sPlayerGuid = "";
sMachineGuid = ""; sMachineGuid = "";
} }
bool operator>=( const HighScore& other ) const; bool operator>=( const HighScore& other ) const;
bool operator==( const HighScore& other ) const
{
#define COMPARE(x) if( x!=other.x ) return false;
COMPARE( sName );
COMPARE( grade );
COMPARE( iScore );
COMPARE( fPercentDP );
COMPARE( fSurviveSeconds );
COMPARE( sModifiers );
COMPARE( time );
COMPARE( sPlayerGuid );
COMPARE( sMachineGuid );
#undef COMPARE
return true;
}
XNode* CreateNode() const; XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode ); void LoadFromNode( const XNode* pNode );
+89 -139
View File
@@ -217,11 +217,11 @@ void ScreenEvaluation::Init()
// Calculate grades // Calculate grades
// //
Grade grade[NUM_PLAYERS]; Grade grade[NUM_PLAYERS];
int p; {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_PlayerNumber( p )
{ {
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsPlayerEnabled(p) )
grade[p] = stageStats.GetGrade( (PlayerNumber)p ); grade[p] = stageStats.GetGrade( p );
else else
grade[p] = GRADE_FAILED; grade[p] = GRADE_FAILED;
@@ -235,6 +235,7 @@ void ScreenEvaluation::Init()
} }
} }
} }
}
// //
@@ -405,11 +406,8 @@ void ScreenEvaluation::Init()
// //
if( SHOW_GRAPH_AREA ) if( SHOW_GRAPH_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
m_sprGraphFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation graph frame p%d",p+1)) ); m_sprGraphFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation graph frame p%d",p+1)) );
m_sprGraphFrame[p].SetName( ssprintf("GraphFrameP%d",p+1) ); m_sprGraphFrame[p].SetName( ssprintf("GraphFrameP%d",p+1) );
SET_XY_AND_ON_COMMAND( m_sprGraphFrame[p] ); SET_XY_AND_ON_COMMAND( m_sprGraphFrame[p] );
@@ -425,11 +423,8 @@ void ScreenEvaluation::Init()
if( SHOW_COMBO_AREA ) if( SHOW_COMBO_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
m_Combo[p].SetName( m_sName, ssprintf("ComboP%i",p+1) ); m_Combo[p].SetName( m_sName, ssprintf("ComboP%i",p+1) );
m_Combo[p].Load( ssprintf("ScreenEvaluationStage combo p%i", p+1), stageStats, (PlayerNumber)p ); m_Combo[p].Load( ssprintf("ScreenEvaluationStage combo p%i", p+1), stageStats, (PlayerNumber)p );
SET_XY_AND_ON_COMMAND( m_Combo[p] ); SET_XY_AND_ON_COMMAND( m_Combo[p] );
@@ -447,11 +442,8 @@ void ScreenEvaluation::Init()
for( int g=GRADE_TIER_1; g<NUM_GRADES; g++ ) for( int g=GRADE_TIER_1; g<NUM_GRADES; g++ )
THEME->GetPathToG( "ScreenEvaluation grade "+ GradeToString((Grade)g) ); THEME->GetPathToG( "ScreenEvaluation grade "+ GradeToString((Grade)g) );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_sprGradeFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation grade frame p%d",p+1)) ); m_sprGradeFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation grade frame p%d",p+1)) );
m_sprGradeFrame[p].SetName( ssprintf("GradeFrameP%d",p+1) ); m_sprGradeFrame[p].SetName( ssprintf("GradeFrameP%d",p+1) );
SET_XY_AND_ON_COMMAND( m_sprGradeFrame[p] ); SET_XY_AND_ON_COMMAND( m_sprGradeFrame[p] );
@@ -477,11 +469,8 @@ void ScreenEvaluation::Init()
// //
if( SHOW_POINTS_AREA ) if( SHOW_POINTS_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_sprPercentFrame[p].SetName( ssprintf("PercentFrameP%d",p+1) ); m_sprPercentFrame[p].SetName( ssprintf("PercentFrameP%d",p+1) );
m_sprPercentFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation percent frame p%d",p+1)) ); m_sprPercentFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation percent frame p%d",p+1)) );
SET_XY_AND_ON_COMMAND( m_sprPercentFrame[p] ); SET_XY_AND_ON_COMMAND( m_sprPercentFrame[p] );
@@ -503,11 +492,8 @@ void ScreenEvaluation::Init()
// //
if( SHOW_BONUS_AREA ) if( SHOW_BONUS_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_sprBonusFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation bonus frame p%d",p+1)) ); m_sprBonusFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation bonus frame p%d",p+1)) );
m_sprBonusFrame[p].SetName( ssprintf("BonusFrameP%d",p+1) ); m_sprBonusFrame[p].SetName( ssprintf("BonusFrameP%d",p+1) );
SET_XY_AND_ON_COMMAND( m_sprBonusFrame[p] ); SET_XY_AND_ON_COMMAND( m_sprBonusFrame[p] );
@@ -544,11 +530,8 @@ void ScreenEvaluation::Init()
// //
if( SHOW_SURVIVED_AREA ) if( SHOW_SURVIVED_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_sprSurvivedFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation survived frame p%d",p+1)) ); m_sprSurvivedFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation survived frame p%d",p+1)) );
m_sprSurvivedFrame[p].SetName( ssprintf("SurvivedFrameP%d",p+1) ); m_sprSurvivedFrame[p].SetName( ssprintf("SurvivedFrameP%d",p+1) );
SET_XY_AND_ON_COMMAND( m_sprSurvivedFrame[p] ); SET_XY_AND_ON_COMMAND( m_sprSurvivedFrame[p] );
@@ -570,11 +553,8 @@ void ScreenEvaluation::Init()
// //
if( SHOW_WIN_AREA ) if( SHOW_WIN_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_sprWinFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation win frame p%d",p+1)) ); m_sprWinFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation win frame p%d",p+1)) );
m_sprWinFrame[p].SetName( ssprintf("WinFrameP%d",p+1) ); m_sprWinFrame[p].SetName( ssprintf("WinFrameP%d",p+1) );
SET_XY_AND_ON_COMMAND( m_sprWinFrame[p] ); SET_XY_AND_ON_COMMAND( m_sprWinFrame[p] );
@@ -608,11 +588,8 @@ void ScreenEvaluation::Init()
SET_XY_AND_ON_COMMAND( m_sprJudgeLabels[l] ); SET_XY_AND_ON_COMMAND( m_sprJudgeLabels[l] );
this->AddChild( &m_sprJudgeLabels[l] ); this->AddChild( &m_sprJudgeLabels[l] );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_textJudgeNumbers[l][p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation judge") ); m_textJudgeNumbers[l][p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation judge") );
m_textJudgeNumbers[l][p].SetShadowLength( 0 ); m_textJudgeNumbers[l][p].SetShadowLength( 0 );
m_textJudgeNumbers[l][p].SetDiffuse( PlayerToColor(p) ); m_textJudgeNumbers[l][p].SetDiffuse( PlayerToColor(p) );
@@ -645,7 +622,7 @@ void ScreenEvaluation::Init()
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
{ {
if( pcaToShow[pn] != PEAK_COMBO_AWARD_INVALID ) if( pcaToShow[pn] != PEAK_COMBO_AWARD_INVALID )
m_textJudgeNumbers[max_combo][p].Command( PEAK_COMBO_AWARD_COMMAND ); m_textJudgeNumbers[max_combo][pn].Command( PEAK_COMBO_AWARD_COMMAND );
} }
for( l=0; l<NUM_STATS_LINES; l++ ) for( l=0; l<NUM_STATS_LINES; l++ )
@@ -659,11 +636,8 @@ void ScreenEvaluation::Init()
SET_XY_AND_ON_COMMAND( m_sprStatsLabel[l] ); SET_XY_AND_ON_COMMAND( m_sprStatsLabel[l] );
this->AddChild( m_sprStatsLabel[l] ); this->AddChild( m_sprStatsLabel[l] );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_textStatsText[l][p].LoadFromFont( THEME->GetPathToF("ScreenEvaluation stats") ); m_textStatsText[l][p].LoadFromFont( THEME->GetPathToF("ScreenEvaluation stats") );
m_textStatsText[l][p].SetDiffuse( PlayerToColor(p) ); m_textStatsText[l][p].SetDiffuse( PlayerToColor(p) );
m_textStatsText[l][p].SetName( ssprintf("%sTextP%d",STATS_STRING[l],p+1) ); m_textStatsText[l][p].SetName( ssprintf("%sTextP%d",STATS_STRING[l],p+1) );
@@ -692,11 +666,8 @@ void ScreenEvaluation::Init()
SET_XY_AND_ON_COMMAND( m_sprScoreLabel ); SET_XY_AND_ON_COMMAND( m_sprScoreLabel );
this->AddChild( &m_sprScoreLabel ); this->AddChild( &m_sprScoreLabel );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_textScore[p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation score") ); m_textScore[p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation score") );
m_textScore[p].SetShadowLength( 0 ); m_textScore[p].SetShadowLength( 0 );
m_textScore[p].SetDiffuse( PlayerToColor(p) ); m_textScore[p].SetDiffuse( PlayerToColor(p) );
@@ -714,11 +685,8 @@ void ScreenEvaluation::Init()
SET_XY_AND_ON_COMMAND( m_sprTotalScoreLabel ); SET_XY_AND_ON_COMMAND( m_sprTotalScoreLabel );
this->AddChild( &m_sprTotalScoreLabel ); this->AddChild( &m_sprTotalScoreLabel );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
int iTotalScore=0; int iTotalScore=0;
for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ ) for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ )
iTotalScore += g_vPlayedStageStats[i].iScore[p]; iTotalScore += g_vPlayedStageStats[i].iScore[p];
@@ -746,11 +714,8 @@ void ScreenEvaluation::Init()
SET_XY_AND_ON_COMMAND( m_sprTimeLabel ); SET_XY_AND_ON_COMMAND( m_sprTimeLabel );
this->AddChild( &m_sprTimeLabel ); this->AddChild( &m_sprTimeLabel );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
m_textTime[p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation time") ); m_textTime[p].LoadFromNumbers( THEME->GetPathToN("ScreenEvaluation time") );
m_textTime[p].SetShadowLength( 0 ); m_textTime[p].SetShadowLength( 0 );
m_textTime[p].SetDiffuse( PlayerToColor(p) ); m_textTime[p].SetDiffuse( PlayerToColor(p) );
@@ -765,7 +730,7 @@ void ScreenEvaluation::Init()
// //
// init extra area // init extra area
// //
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_PlayerNumber( p )
{ {
if( iMachineHighScoreIndex[p] != -1 ) if( iMachineHighScoreIndex[p] != -1 )
{ {
@@ -796,13 +761,17 @@ void ScreenEvaluation::Init()
} }
bool bOneHasNewTopRecord = false; bool bOneHasNewTopRecord = false;
for( p=0; p<NUM_PLAYERS; p++ ) {
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) && (iMachineHighScoreIndex[p] != -1 || iPersonalHighScoreIndex[p] != -1) ) if( GAMESTATE->IsPlayerEnabled(p) && (iMachineHighScoreIndex[p] != -1 || iPersonalHighScoreIndex[p] != -1) )
bOneHasNewTopRecord = true; bOneHasNewTopRecord = true;
}
Grade best_grade = GRADE_NO_DATA; Grade best_grade = GRADE_NO_DATA;
for( p=0; p<NUM_PLAYERS; p++ ) {
FOREACH_PlayerNumber( p )
best_grade = min( best_grade, grade[p] ); best_grade = min( best_grade, grade[p] );
}
if( PREFSMAN->m_bAllowExtraStage && m_bTryExtraStage ) if( PREFSMAN->m_bAllowExtraStage && m_bTryExtraStage )
{ {
@@ -877,6 +846,7 @@ void ScreenEvaluation::CommitScores(
PerDifficultyAward pdaToShowOut[NUM_PLAYERS], PerDifficultyAward pdaToShowOut[NUM_PLAYERS],
PeakComboAward pcaToShowOut[NUM_PLAYERS] ) PeakComboAward pcaToShowOut[NUM_PLAYERS] )
{ {
{
FOREACH_PlayerNumber( pn ) FOREACH_PlayerNumber( pn )
{ {
iPersonalHighScoreIndexOut[pn] = -1; iPersonalHighScoreIndexOut[pn] = -1;
@@ -885,6 +855,7 @@ void ScreenEvaluation::CommitScores(
pdaToShowOut[pn] = PER_DIFFICULTY_AWARD_INVALID; pdaToShowOut[pn] = PER_DIFFICULTY_AWARD_INVALID;
pcaToShowOut[pn] = PEAK_COMBO_AWARD_INVALID; pcaToShowOut[pn] = PEAK_COMBO_AWARD_INVALID;
} }
}
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
@@ -912,7 +883,7 @@ void ScreenEvaluation::CommitScores(
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
// don't save scores if the player is disqualified // don't save scores if the player is disqualified
if( GAMESTATE->IsDisqualified((PlayerNumber)p) ) if( GAMESTATE->IsDisqualified(p) )
continue; continue;
Song* pSong = GAMESTATE->m_pCurSong; Song* pSong = GAMESTATE->m_pCurSong;
@@ -927,7 +898,7 @@ void ScreenEvaluation::CommitScores(
int iNumMines = (int) stageStats.fRadarPossible[p][RADAR_NUM_MINES]; int iNumMines = (int) stageStats.fRadarPossible[p][RADAR_NUM_MINES];
int iNumHands = (int) stageStats.fRadarPossible[p][RADAR_NUM_HANDS]; int iNumHands = (int) stageStats.fRadarPossible[p][RADAR_NUM_HANDS];
PROFILEMAN->AddStepTotals( (PlayerNumber)p, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands ); PROFILEMAN->AddStepTotals( p, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands );
// whether or not to save scores when the stage was failed // whether or not to save scores when the stage was failed
@@ -935,9 +906,10 @@ void ScreenEvaluation::CommitScores(
// below in the switch // below in the switch
HighScore &hs = m_HighScore[p]; HighScore &hs = m_HighScore[p];
hs.grade = stageStats.GetGrade( (PlayerNumber)p ); hs.sName = RANKING_TO_FILL_IN_MARKER[p];
hs.grade = stageStats.GetGrade( p );
hs.iScore = stageStats.iScore[p]; hs.iScore = stageStats.iScore[p];
hs.fPercentDP = stageStats.GetPercentDancePoints( (PlayerNumber)p ); hs.fPercentDP = stageStats.GetPercentDancePoints( p );
hs.fSurviveSeconds = stageStats.fAliveSeconds[p]; hs.fSurviveSeconds = stageStats.fAliveSeconds[p];
hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString(); hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString();
hs.time = time(NULL); hs.time = time(NULL);
@@ -956,7 +928,7 @@ void ScreenEvaluation::CommitScores(
ASSERT( pSteps ); ASSERT( pSteps );
PROFILEMAN->AddStepsScore( pSong, pSteps, (PlayerNumber)p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] ); PROFILEMAN->AddStepsScore( pSong, pSteps, p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] );
} }
break; break;
@@ -969,10 +941,10 @@ void ScreenEvaluation::CommitScores(
float fAverageMeter = stageStats.iMeter[p] / (float)PREFSMAN->m_iNumArcadeStages; float fAverageMeter = stageStats.iMeter[p] / (float)PREFSMAN->m_iNumArcadeStages;
rcOut[p] = AverageMeterToRankingCategory( fAverageMeter ); rcOut[p] = AverageMeterToRankingCategory( fAverageMeter );
PROFILEMAN->AddCategoryScore( nt, rcOut[p], (PlayerNumber)p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] ); PROFILEMAN->AddCategoryScore( nt, rcOut[p], p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] );
// TRICKY: Increment play count here, and not on ScreenGameplay like the others. // TRICKY: Increment play count here, and not on ScreenGameplay like the others.
PROFILEMAN->IncrementCategoryPlayCount( nt, rcOut[p], (PlayerNumber)p ); PROFILEMAN->IncrementCategoryPlayCount( nt, rcOut[p], p );
} }
break; break;
@@ -987,7 +959,7 @@ void ScreenEvaluation::CommitScores(
if( stageStats.bFailed[p] && pCourse->IsNonstop() ) if( stageStats.bFailed[p] && pCourse->IsNonstop() )
continue; continue;
PROFILEMAN->AddCourseScore( pCourse, nt, cd, (PlayerNumber)p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] ); PROFILEMAN->AddCourseScore( pCourse, nt, cd, p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] );
} }
break; break;
default: default:
@@ -998,44 +970,51 @@ void ScreenEvaluation::CommitScores(
LOG->Trace( "done saving stats and high scores" ); LOG->Trace( "done saving stats and high scores" );
// If both players get a machine high score, a player whose score is added later // If both players get a machine high score in the same HighScoreList,
// may bump the players who were added earlier. Adjust for this. // then one player's score may have bumped the other player. Look in
// the HighScoreList and re-get the high score index.
{ {
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
if( iMachineHighScoreIndexOut[p] == -1 ) // no record if( iMachineHighScoreIndexOut[p] == -1 ) // no record
continue; // skip continue; // skip
/* If we aren't saving scores on fail, it'll be handled above; m_bFailed is only
* meaningful in stage and course eval. */
// if( m_bFailed ) // both players failed
// continue; // skip
for( int p2=0; p2<p; p2++ ) HighScore &hs = m_HighScore[p];
{ Profile* pProfile = PROFILEMAN->GetMachineProfile();
if( !GAMESTATE->IsHumanPlayer(p2) ) StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
continue; // skip
if( iMachineHighScoreIndexOut[p2] == -1 ) // no record const HighScoreList *pHSL = NULL;
continue; // skip
bool bPlayedSameSteps;
switch( m_Type ) switch( m_Type )
{ {
case stage: case stage:
bPlayedSameSteps = GAMESTATE->m_pCurNotes[p]==GAMESTATE->m_pCurNotes[p2]; {
Song* pSong = GAMESTATE->m_pCurSong;
Steps* pSteps = GAMESTATE->m_pCurNotes[p];
pHSL = &pProfile->GetStepsHighScoreList( pSong, pSteps );
}
break; break;
case summary: case summary:
bPlayedSameSteps = rcOut[p] == rcOut[p2]; {
pHSL = &pProfile->GetCategoryHighScoreList( nt, rcOut[p] );
}
break; break;
case course: case course:
bPlayedSameSteps = true;
break;
}
if( iMachineHighScoreIndexOut[p] >= iMachineHighScoreIndexOut[p2] )
{ {
iMachineHighScoreIndexOut[p2]++; Course* pCourse = GAMESTATE->m_pCurCourse;
if( iMachineHighScoreIndexOut[p2] >= NUM_RANKING_LINES ) CourseDifficulty cd = GAMESTATE->m_PreferredCourseDifficulty[p];
iMachineHighScoreIndexOut[p2] = -1; ASSERT( pCourse );
pHSL = &pProfile->GetCourseHighScoreList( pCourse, nt, cd );
} }
break;
default:
ASSERT(0);
} }
vector<HighScore>::const_iterator iter = find( pHSL->vHighScores.begin(), pHSL->vHighScores.end(), hs );
if( iter == pHSL->vHighScores.end() )
iMachineHighScoreIndexOut[p] = -1;
else
iMachineHighScoreIndexOut[p] = iter - pHSL->vHighScores.begin();
} }
} }
@@ -1046,10 +1025,10 @@ void ScreenEvaluation::CommitScores(
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
// must be using a profile to receive awards // must be using a profile to receive awards
if( !PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) if( !PROFILEMAN->IsUsingProfile(p) )
continue; continue;
Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p); Profile* pProfile = PROFILEMAN->GetProfile(p);
deque<PerDifficultyAward> &vPdas = GAMESTATE->m_vLastPerDifficultyAwards[p]; deque<PerDifficultyAward> &vPdas = GAMESTATE->m_vLastPerDifficultyAwards[p];
@@ -1060,25 +1039,25 @@ void ScreenEvaluation::CommitScores(
{ {
case stage: case stage:
// don't give per-difficutly awards if using easy mods // don't give per-difficutly awards if using easy mods
if( !GAMESTATE->IsDisqualified((PlayerNumber)p) ) if( !GAMESTATE->IsDisqualified(p) )
{ {
if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_GREAT ) ) if( stageStats.FullComboOfScore( p, TNS_GREAT ) )
vPdas.push_back( AWARD_FULL_COMBO_GREATS ); vPdas.push_back( AWARD_FULL_COMBO_GREATS );
if( stageStats.SingleDigitsOfScore( (PlayerNumber)p, TNS_GREAT ) ) if( stageStats.SingleDigitsOfScore( p, TNS_GREAT ) )
vPdas.push_back( AWARD_SINGLE_DIGIT_GREATS ); vPdas.push_back( AWARD_SINGLE_DIGIT_GREATS );
if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_PERFECT ) ) if( stageStats.FullComboOfScore( p, TNS_PERFECT ) )
vPdas.push_back( AWARD_FULL_COMBO_PERFECTS ); vPdas.push_back( AWARD_FULL_COMBO_PERFECTS );
if( stageStats.SingleDigitsOfScore( (PlayerNumber)p, TNS_PERFECT ) ) if( stageStats.SingleDigitsOfScore( p, TNS_PERFECT ) )
vPdas.push_back( AWARD_SINGLE_DIGIT_PERFECTS ); vPdas.push_back( AWARD_SINGLE_DIGIT_PERFECTS );
if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_MARVELOUS ) ) if( stageStats.FullComboOfScore( p, TNS_MARVELOUS ) )
vPdas.push_back( AWARD_FULL_COMBO_MARVELOUSES ); vPdas.push_back( AWARD_FULL_COMBO_MARVELOUSES );
if( stageStats.OneOfScore( (PlayerNumber)p, TNS_GREAT ) ) if( stageStats.OneOfScore( p, TNS_GREAT ) )
vPdas.push_back( AWARD_ONE_GREAT ); vPdas.push_back( AWARD_ONE_GREAT );
if( stageStats.OneOfScore( (PlayerNumber)p, TNS_PERFECT ) ) if( stageStats.OneOfScore( p, TNS_PERFECT ) )
vPdas.push_back( AWARD_ONE_PERFECT ); vPdas.push_back( AWARD_ONE_PERFECT );
float fPercentGreats = stageStats.GetPercentageOfTaps((PlayerNumber)p, TNS_GREAT); float fPercentGreats = stageStats.GetPercentageOfTaps(p, TNS_GREAT);
if( fPercentGreats >= 0.8f ) if( fPercentGreats >= 0.8f )
vPdas.push_back( AWARD_GREATS_80_PERCENT ); vPdas.push_back( AWARD_GREATS_80_PERCENT );
if( fPercentGreats >= 0.9f ) if( fPercentGreats >= 0.9f )
@@ -1094,8 +1073,8 @@ void ScreenEvaluation::CommitScores(
LOG->Trace( "done with per difficulty awards" ); LOG->Trace( "done with per difficulty awards" );
// DO give peak combo awards if using easy mods // DO give peak combo awards if using easy mods
int iComboAtStartOfStage = stageStats.GetComboAtStartOfStage( (PlayerNumber)p ); int iComboAtStartOfStage = stageStats.GetComboAtStartOfStage( p );
int iPeakCombo = stageStats.GetMaxCombo((PlayerNumber)p).cnt; int iPeakCombo = stageStats.GetMaxCombo(p).cnt;
FOREACH_PeakComboAward( pca ) FOREACH_PeakComboAward( pca )
{ {
@@ -1214,11 +1193,8 @@ void ScreenEvaluation::TweenOffScreen()
// points area // points area
if( SHOW_POINTS_AREA ) if( SHOW_POINTS_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
OFF_COMMAND( m_sprPercentFrame[p] ); OFF_COMMAND( m_sprPercentFrame[p] );
m_Percent[p].Command( THEME->GetMetric(m_sName,ssprintf("PercentP%dOffCommand",p+1)) ); m_Percent[p].Command( THEME->GetMetric(m_sName,ssprintf("PercentP%dOffCommand",p+1)) );
m_Percent[p].TweenOffScreen(); m_Percent[p].TweenOffScreen();
@@ -1228,10 +1204,8 @@ void ScreenEvaluation::TweenOffScreen()
// bonus area // bonus area
if( SHOW_BONUS_AREA ) if( SHOW_BONUS_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_sprBonusFrame[p] ); OFF_COMMAND( m_sprBonusFrame[p] );
for( int r=0; r<NUM_SHOWN_RADAR_CATEGORIES; r++ ) // foreach line for( int r=0; r<NUM_SHOWN_RADAR_CATEGORIES; r++ ) // foreach line
{ {
@@ -1244,10 +1218,8 @@ void ScreenEvaluation::TweenOffScreen()
// survived area // survived area
if( SHOW_SURVIVED_AREA ) if( SHOW_SURVIVED_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_sprSurvivedFrame[p] ); OFF_COMMAND( m_sprSurvivedFrame[p] );
OFF_COMMAND( m_textSurvivedNumber[p] ); OFF_COMMAND( m_textSurvivedNumber[p] );
} }
@@ -1256,10 +1228,8 @@ void ScreenEvaluation::TweenOffScreen()
// win area // win area
if( SHOW_WIN_AREA ) if( SHOW_WIN_AREA )
{ {
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_sprWinFrame[p] ); OFF_COMMAND( m_sprWinFrame[p] );
OFF_COMMAND( m_sprWin[p] ); OFF_COMMAND( m_sprWin[p] );
} }
@@ -1274,13 +1244,9 @@ void ScreenEvaluation::TweenOffScreen()
OFF_COMMAND( m_sprJudgeLabels[l] ); OFF_COMMAND( m_sprJudgeLabels[l] );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_textJudgeNumbers[l][p] ); OFF_COMMAND( m_textJudgeNumbers[l][p] );
} }
}
// stats area // stats area
for( l=0; l<NUM_STATS_LINES; l++ ) for( l=0; l<NUM_STATS_LINES; l++ )
@@ -1290,60 +1256,44 @@ void ScreenEvaluation::TweenOffScreen()
OFF_COMMAND( m_sprStatsLabel[l] ); OFF_COMMAND( m_sprStatsLabel[l] );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_textStatsText[l][p] ); OFF_COMMAND( m_textStatsText[l][p] );
} }
}
// score area // score area
if( SHOW_SCORE_AREA ) if( SHOW_SCORE_AREA )
{ {
OFF_COMMAND( m_sprScoreLabel ); OFF_COMMAND( m_sprScoreLabel );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_textScore[p] ); OFF_COMMAND( m_textScore[p] );
} }
}
// total score area // total score area
if( SHOW_TOTAL_SCORE_AREA ) if( SHOW_TOTAL_SCORE_AREA )
{ {
OFF_COMMAND( m_sprTotalScoreLabel ); OFF_COMMAND( m_sprTotalScoreLabel );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_textTotalScore[p] ); OFF_COMMAND( m_textTotalScore[p] );
} }
}
// time area // time area
if( SHOW_TIME_AREA ) if( SHOW_TIME_AREA )
{ {
OFF_COMMAND( m_sprTimeLabel ); OFF_COMMAND( m_sprTimeLabel );
for( p=0; p<NUM_PLAYERS; p++ ) FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
OFF_COMMAND( m_textTime[p] ); OFF_COMMAND( m_textTime[p] );
} }
}
// extra area // extra area
for( p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) ) FOREACH_EnabledPlayer( p )
continue; {
OFF_COMMAND( m_sprMachineRecord[p] ); OFF_COMMAND( m_sprMachineRecord[p] );
OFF_COMMAND( m_sprPersonalRecord[p] ); OFF_COMMAND( m_sprPersonalRecord[p] );
if( m_PerDifficultyAward[p].IsLoaded() ) if( m_PerDifficultyAward[p].IsLoaded() )
OFF_COMMAND( m_PerDifficultyAward[p] ); OFF_COMMAND( m_PerDifficultyAward[p] );
} }
}
OFF_COMMAND( m_sprTryExtraStage ); OFF_COMMAND( m_sprTryExtraStage );
} }