fix up DQ; CurStageStats changes didn't interact well with it

This commit is contained in:
Glenn Maynard
2007-04-25 20:00:18 +00:00
parent 9ed7cf25f3
commit 643cadbbe0
6 changed files with 23 additions and 22 deletions
+5 -17
View File
@@ -613,10 +613,12 @@ void GameState::BeginStage()
STATSMAN->m_CurStageStats.m_fMusicRate = m_SongOptions.GetSong().m_fMusicRate;
m_iNumStagesOfThisSong = GetNumStagesForCurrentSongAndStepsOrCourse();
ASSERT( m_iNumStagesOfThisSong != -1 );
LOG->Trace( "BeginStage: sub %i (%i) (ex %i)",
m_iNumStagesOfThisSong, m_iPlayerStageTokens[0], m_iAwardedExtraStages[0] );
FOREACH_EnabledPlayer( p )
m_iPlayerStageTokens[p] -= m_iNumStagesOfThisSong;
FOREACH_HumanPlayer( pn )
if( CurrentOptionsDisqualifyPlayer(pn) )
STATSMAN->m_CurStageStats.m_player[pn].m_bDisqualified = true;
}
void GameState::CancelStage()
@@ -1231,7 +1233,7 @@ void GameState::ResetOptions()
m_bDidModeChangeNoteSkin = false;
}
bool GameState::IsDisqualified( PlayerNumber pn )
bool GameState::CurrentOptionsDisqualifyPlayer( PlayerNumber pn )
{
if( !PREFSMAN->m_bDisqualification )
return false;
@@ -1239,14 +1241,6 @@ bool GameState::IsDisqualified( PlayerNumber pn )
if( !IsHumanPlayer(pn) )
return false;
if( STATSMAN->m_CurStageStats.m_bGaveUp )
return true;
#ifndef DEBUG
if( STATSMAN->m_CurStageStats.m_bUsedAutoplay )
return true;
#endif //DEBUG
const PlayerOptions &po = m_pPlayerState[pn]->m_PlayerOptions.GetPreferred();
// Check the stored player options for disqualify. Don't disqualify because
@@ -2118,11 +2112,6 @@ public:
{
lua_pushboolean(L, p->GetStageResult(PLAYER_1)==RESULT_DRAW); return 1;
}
static int IsDisqualified( T* p, lua_State *L )
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
lua_pushboolean(L, p->IsDisqualified(pn)); return 1;
}
static int GetCurrentGame( T* p, lua_State *L ) { const_cast<Game*>(p->GetCurrentGame())->PushSelf( L ); return 1; }
DEFINE_METHOD( GetEditCourseEntryIndex, m_iEditCourseEntryIndex )
DEFINE_METHOD( GetEditLocalProfileID, m_sEditLocalProfileID.Get() )
@@ -2272,7 +2261,6 @@ public:
ADD_METHOD( GetSongOptionsString );
ADD_METHOD( IsWinner );
ADD_METHOD( IsDraw );
ADD_METHOD( IsDisqualified );
ADD_METHOD( GetCurrentGame );
ADD_METHOD( GetEditCourseEntryIndex );
ADD_METHOD( GetEditLocalProfileID );
+1 -1
View File
@@ -225,7 +225,7 @@ public:
void ApplyStageModifiers( PlayerNumber pn, RString sModifiers );
void ResetOptions();
bool IsDisqualified( PlayerNumber pn );
bool CurrentOptionsDisqualifyPlayer( PlayerNumber pn );
bool PlayerIsUsingModifier( PlayerNumber pn, const RString &sModifier );
SongOptions::FailType GetPlayerFailType( const PlayerState *pPlayerState ) const;
+11 -1
View File
@@ -58,6 +58,7 @@ void PlayerStageStats::Init()
m_pcaToShow = PeakComboAward_Invalid;
m_iPersonalHighScoreIndex = -1;
m_iMachineHighScoreIndex = -1;
m_bDisqualified = false;
m_rc = RankingCategory_Invalid;
m_HighScore = HighScore();
}
@@ -92,6 +93,7 @@ void PlayerStageStats::AddStats( const PlayerStageStats& other )
m_iSongsPlayed += other.m_iSongsPlayed;
m_fCaloriesBurned += other.m_fCaloriesBurned;
m_fLifeRemainingSeconds = other.m_fLifeRemainingSeconds; // don't accumulate
m_bDisqualified |= other.m_bDisqualified;
const float fOtherFirstSecond = other.m_fFirstSecond + m_fLastSecond;
const float fOtherLastSecond = other.m_fLastSecond + m_fLastSecond;
@@ -563,7 +565,7 @@ void PlayerStageStats::CalcAwards( PlayerNumber p, bool bGaveUp, bool bUsedAutop
// per-difficulty awards
// don't give per-difficutly awards if using easy mods
if( !GAMESTATE->IsDisqualified(p) )
if( !IsDisqualified() )
{
if( FullComboOfScore( TNS_W3 ) )
vPdas.push_back( AWARD_FULL_COMBO_W3 );
@@ -623,6 +625,12 @@ void PlayerStageStats::CalcAwards( PlayerNumber p, bool bGaveUp, bool bUsedAutop
}
bool PlayerStageStats::IsDisqualified() const
{
if( !PREFSMAN->m_bDisqualification )
return false;
return m_bDisqualified;
}
LuaFunction( GetGradeFromPercent, GetGradeFromPercent( FArg(1), false ) )
@@ -654,6 +662,7 @@ public:
DEFINE_METHOD( GetMachineHighScoreIndex, m_iMachineHighScoreIndex )
DEFINE_METHOD( GetPerDifficultyAward, m_pdaToShow )
DEFINE_METHOD( GetPeakComboAward, m_pcaToShow )
DEFINE_METHOD( IsDisqualified, IsDisqualified() )
static int GetPlayedSteps( T* p, lua_State *L )
{
@@ -699,6 +708,7 @@ public:
ADD_METHOD( GetMachineHighScoreIndex );
ADD_METHOD( GetPerDifficultyAward );
ADD_METHOD( GetPeakComboAward );
ADD_METHOD( IsDisqualified );
ADD_METHOD( GetPlayedSteps );
ADD_METHOD( GetPossibleSteps );
}
+3
View File
@@ -109,6 +109,9 @@ public:
int m_iPersonalHighScoreIndex;
int m_iMachineHighScoreIndex;
bool m_bDisqualified;
bool IsDisqualified() const;
RankingCategory m_rc;
HighScore m_HighScore;
+2 -2
View File
@@ -122,13 +122,13 @@ void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
// save original player options
PlayerOptions poOrig = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred();
// Find out if the current row when exprorted causes disqualification.
// Find out if the current row when exported causes disqualification.
// Exporting the row will fill GAMESTATE->m_PlayerOptions.
PO_GROUP_CALL( GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions, ModsLevel_Preferred, Init );
vector<PlayerNumber> v;
v.push_back( pn );
ExportOptions( row, v );
bool bRowCausesDisqualified = GAMESTATE->IsDisqualified( pn );
bool bRowCausesDisqualified = GAMESTATE->CurrentOptionsDisqualifyPlayer( pn );
m_bRowCausesDisqualified[pn][row] = bRowCausesDisqualified;
// Update disqualified graphic
+1 -1
View File
@@ -155,7 +155,7 @@ void StageStats::CommitScores( bool bSummary )
FOREACH_HumanPlayer( p )
{
// don't save scores if the player is disqualified
if( GAMESTATE->IsDisqualified(p) )
if( this->m_player[p].IsDisqualified() )
continue;
// whether or not to save scores when the stage was failed