diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 2895113638..fe1252132c 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -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(L, 1); - lua_pushboolean(L, p->IsDisqualified(pn)); return 1; - } static int GetCurrentGame( T* p, lua_State *L ) { const_cast(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 ); diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 486beaa3ee..3fe1e6b281 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -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; diff --git a/stepmania/src/PlayerStageStats.cpp b/stepmania/src/PlayerStageStats.cpp index f9dead8507..5bb7549d86 100644 --- a/stepmania/src/PlayerStageStats.cpp +++ b/stepmania/src/PlayerStageStats.cpp @@ -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 ); } diff --git a/stepmania/src/PlayerStageStats.h b/stepmania/src/PlayerStageStats.h index d194d3e221..dc9cbf64e1 100644 --- a/stepmania/src/PlayerStageStats.h +++ b/stepmania/src/PlayerStageStats.h @@ -109,6 +109,9 @@ public: int m_iPersonalHighScoreIndex; int m_iMachineHighScoreIndex; + bool m_bDisqualified; + bool IsDisqualified() const; + RankingCategory m_rc; HighScore m_HighScore; diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 2f80085998..b99b93283d 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -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 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 diff --git a/stepmania/src/StageStats.cpp b/stepmania/src/StageStats.cpp index 0fd68833f0..a9f93abfc5 100644 --- a/stepmania/src/StageStats.cpp +++ b/stepmania/src/StageStats.cpp @@ -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