continue refactoring: split out StageResults::CalcAwards, split loop
This commit is contained in:
@@ -818,9 +818,6 @@ void ScreenEvaluation::CommitScores(
|
|||||||
if( GAMESTATE->IsDisqualified(p) )
|
if( GAMESTATE->IsDisqualified(p) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Song* pSong = GAMESTATE->m_pCurSong;
|
|
||||||
Steps* pSteps = GAMESTATE->m_pCurSteps[p];
|
|
||||||
|
|
||||||
// whether or not to save scores when the stage was failed
|
// whether or not to save scores when the stage was failed
|
||||||
// depends on if this is a course or not ... it's handled
|
// depends on if this is a course or not ... it's handled
|
||||||
// below in the switch
|
// below in the switch
|
||||||
@@ -842,10 +839,16 @@ void ScreenEvaluation::CommitScores(
|
|||||||
hs.SetHoldNoteScore( hns, m_StageStats.m_player[p].iHoldNoteScores[hns] );
|
hs.SetHoldNoteScore( hns, m_StageStats.m_player[p].iHoldNoteScores[hns] );
|
||||||
hs.SetRadarValues( m_StageStats.m_player[p].radarActual );
|
hs.SetRadarValues( m_StageStats.m_player[p].radarActual );
|
||||||
hs.SetLifeRemainingSeconds( m_StageStats.m_player[p].fLifeRemainingSeconds );
|
hs.SetLifeRemainingSeconds( m_StageStats.m_player[p].fLifeRemainingSeconds );
|
||||||
|
}
|
||||||
|
|
||||||
|
FOREACH_HumanPlayer( p )
|
||||||
|
{
|
||||||
|
const HighScore &hs = out[p].m_HighScore;
|
||||||
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
|
||||||
|
const Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
|
const Steps* pSteps = GAMESTATE->m_pCurSteps[p];
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case stage:
|
case stage:
|
||||||
@@ -939,40 +942,39 @@ void ScreenEvaluation::CommitScores(
|
|||||||
out[p].m_iMachineHighScoreIndex = iter - pHSL->vHighScores.begin();
|
out[p].m_iMachineHighScoreIndex = iter - pHSL->vHighScores.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FOREACH_HumanPlayer( p )
|
||||||
|
out[p].CalcAwards( m_StageStats.m_player[p], p );
|
||||||
|
}
|
||||||
|
|
||||||
|
void StageResults::CalcAwards( const PlayerStageStats &m_PlayerStageStats, PlayerNumber p )
|
||||||
|
{
|
||||||
LOG->Trace( "hand out awards" );
|
LOG->Trace( "hand out awards" );
|
||||||
|
|
||||||
FOREACH_HumanPlayer( p )
|
|
||||||
{
|
|
||||||
deque<PerDifficultyAward> &vPdas = GAMESTATE->m_vLastPerDifficultyAwards[p];
|
deque<PerDifficultyAward> &vPdas = GAMESTATE->m_vLastPerDifficultyAwards[p];
|
||||||
|
|
||||||
LOG->Trace( "per difficulty awards" );
|
LOG->Trace( "per difficulty awards" );
|
||||||
|
|
||||||
// per-difficulty awards
|
// per-difficulty awards
|
||||||
switch( type )
|
|
||||||
{
|
|
||||||
case stage:
|
|
||||||
case course:
|
|
||||||
// don't give per-difficutly awards if using easy mods
|
// don't give per-difficutly awards if using easy mods
|
||||||
if( !GAMESTATE->IsDisqualified(p) )
|
if( !GAMESTATE->IsDisqualified(p) )
|
||||||
{
|
{
|
||||||
if( m_StageStats.m_player[p].FullComboOfScore( TNS_GREAT ) )
|
if( m_PlayerStageStats.FullComboOfScore( TNS_GREAT ) )
|
||||||
vPdas.push_back( AWARD_FULL_COMBO_GREATS );
|
vPdas.push_back( AWARD_FULL_COMBO_GREATS );
|
||||||
if( m_StageStats.m_player[p].SingleDigitsOfScore( TNS_GREAT ) )
|
if( m_PlayerStageStats.SingleDigitsOfScore( TNS_GREAT ) )
|
||||||
vPdas.push_back( AWARD_SINGLE_DIGIT_GREATS );
|
vPdas.push_back( AWARD_SINGLE_DIGIT_GREATS );
|
||||||
if( m_StageStats.m_player[p].FullComboOfScore( TNS_PERFECT ) )
|
if( m_PlayerStageStats.FullComboOfScore( TNS_PERFECT ) )
|
||||||
vPdas.push_back( AWARD_FULL_COMBO_PERFECTS );
|
vPdas.push_back( AWARD_FULL_COMBO_PERFECTS );
|
||||||
if( m_StageStats.m_player[p].SingleDigitsOfScore( TNS_PERFECT ) )
|
if( m_PlayerStageStats.SingleDigitsOfScore( TNS_PERFECT ) )
|
||||||
vPdas.push_back( AWARD_SINGLE_DIGIT_PERFECTS );
|
vPdas.push_back( AWARD_SINGLE_DIGIT_PERFECTS );
|
||||||
if( m_StageStats.m_player[p].FullComboOfScore( TNS_MARVELOUS ) )
|
if( m_PlayerStageStats.FullComboOfScore( TNS_MARVELOUS ) )
|
||||||
vPdas.push_back( AWARD_FULL_COMBO_MARVELOUSES );
|
vPdas.push_back( AWARD_FULL_COMBO_MARVELOUSES );
|
||||||
|
|
||||||
if( m_StageStats.m_player[p].OneOfScore( TNS_GREAT ) )
|
if( m_PlayerStageStats.OneOfScore( TNS_GREAT ) )
|
||||||
vPdas.push_back( AWARD_ONE_GREAT );
|
vPdas.push_back( AWARD_ONE_GREAT );
|
||||||
if( m_StageStats.m_player[p].OneOfScore( TNS_PERFECT ) )
|
if( m_PlayerStageStats.OneOfScore( TNS_PERFECT ) )
|
||||||
vPdas.push_back( AWARD_ONE_PERFECT );
|
vPdas.push_back( AWARD_ONE_PERFECT );
|
||||||
|
|
||||||
float fPercentGreats = m_StageStats.m_player[p].GetPercentageOfTaps( TNS_GREAT );
|
float fPercentGreats = m_PlayerStageStats.GetPercentageOfTaps( 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 )
|
||||||
@@ -980,20 +982,19 @@ void ScreenEvaluation::CommitScores(
|
|||||||
if( fPercentGreats >= 1.f )
|
if( fPercentGreats >= 1.f )
|
||||||
vPdas.push_back( AWARD_GREATS_100_PERCENT );
|
vPdas.push_back( AWARD_GREATS_100_PERCENT );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Max one PDA per stage
|
// Max one PDA per stage
|
||||||
if( !vPdas.empty() )
|
if( !vPdas.empty() )
|
||||||
vPdas.erase( vPdas.begin(), vPdas.end()-1 );
|
vPdas.erase( vPdas.begin(), vPdas.end()-1 );
|
||||||
|
|
||||||
if( !vPdas.empty() )
|
if( !vPdas.empty() )
|
||||||
out[p].m_pdaToShow = vPdas.back();
|
m_pdaToShow = vPdas.back();
|
||||||
|
|
||||||
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 = m_StageStats.m_player[p].GetComboAtStartOfStage();
|
int iComboAtStartOfStage = m_PlayerStageStats.GetComboAtStartOfStage();
|
||||||
int iPeakCombo = m_StageStats.m_player[p].GetMaxCombo().cnt;
|
int iPeakCombo = m_PlayerStageStats.GetMaxCombo().cnt;
|
||||||
|
|
||||||
FOREACH_PeakComboAward( pca )
|
FOREACH_PeakComboAward( pca )
|
||||||
{
|
{
|
||||||
@@ -1001,18 +1002,13 @@ void ScreenEvaluation::CommitScores(
|
|||||||
bool bCrossedLevel = iComboAtStartOfStage < iLevel && iPeakCombo >= iLevel;
|
bool bCrossedLevel = iComboAtStartOfStage < iLevel && iPeakCombo >= iLevel;
|
||||||
LOG->Trace( "pca = %d, iLevel = %d, bCrossedLevel = %d", pca, iLevel, bCrossedLevel );
|
LOG->Trace( "pca = %d, iLevel = %d, bCrossedLevel = %d", pca, iLevel, bCrossedLevel );
|
||||||
if( bCrossedLevel )
|
if( bCrossedLevel )
|
||||||
{
|
|
||||||
GAMESTATE->m_vLastPeakComboAwards[p].push_back( pca );
|
GAMESTATE->m_vLastPeakComboAwards[p].push_back( pca );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( !GAMESTATE->m_vLastPeakComboAwards[p].empty() )
|
if( !GAMESTATE->m_vLastPeakComboAwards[p].empty() )
|
||||||
out[p].m_pcaToShow = GAMESTATE->m_vLastPeakComboAwards[p].back();
|
m_pcaToShow = GAMESTATE->m_vLastPeakComboAwards[p].back();
|
||||||
|
|
||||||
LOG->Trace( "done with per combo awards" );
|
LOG->Trace( "done with per combo awards" );
|
||||||
}
|
|
||||||
|
|
||||||
LOG->Trace( "done handing out awards." );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public:
|
|||||||
PerDifficultyAward m_pdaToShow;
|
PerDifficultyAward m_pdaToShow;
|
||||||
PeakComboAward m_pcaToShow;
|
PeakComboAward m_pcaToShow;
|
||||||
HighScore m_HighScore;
|
HighScore m_HighScore;
|
||||||
|
|
||||||
|
void CalcAwards( const PlayerStageStats &m_PlayerStageStats, PlayerNumber p );
|
||||||
};
|
};
|
||||||
|
|
||||||
const int MAX_SONGS_TO_SHOW = 5; // In summary, we show last 3 stages, plus extra stages if passed
|
const int MAX_SONGS_TO_SHOW = 5; // In summary, we show last 3 stages, plus extra stages if passed
|
||||||
|
|||||||
Reference in New Issue
Block a user