From fa2a5bddc387625c069fdaea5049dfaf6a52aea3 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 1 Oct 2005 00:18:13 +0000 Subject: [PATCH] Don't give awards if GaveUp or UsedAutoplay Move bGaveUp into StageStats. It's not really a per-player value. --- stepmania/src/GraphDisplay.cpp | 2 +- stepmania/src/Player.cpp | 3 +++ stepmania/src/PlayerStageStats.cpp | 9 ++++++--- stepmania/src/PlayerStageStats.h | 3 +-- stepmania/src/ScreenEvaluation.cpp | 2 +- stepmania/src/ScreenGameplay.cpp | 2 +- stepmania/src/StageStats.cpp | 9 +++++++-- stepmania/src/StageStats.h | 3 +++ 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/stepmania/src/GraphDisplay.cpp b/stepmania/src/GraphDisplay.cpp index b6bf0bd9be..dc88e50881 100644 --- a/stepmania/src/GraphDisplay.cpp +++ b/stepmania/src/GraphDisplay.cpp @@ -214,7 +214,7 @@ void GraphDisplay::LoadFromStageStats( const StageStats &ss, const PlayerStageSt UpdateVerts(); - if( !pss.bFailed && !pss.bGaveUp ) + if( !pss.bFailed ) { // // Search for the min life record to show "Just Barely!" diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index c259a04b75..1b8f1d06ce 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1567,7 +1567,10 @@ void Player::CrossedRow( int iNoteRow ) { TapNote tn = m_NoteData.GetTapNote(t, iNoteRow); if( tn.type != TapNote::empty && tn.result.tns == TNS_NONE ) + { Step( t, now ); + STATSMAN->m_CurStageStats.bUsedAutoplay = true; + } } } } diff --git a/stepmania/src/PlayerStageStats.cpp b/stepmania/src/PlayerStageStats.cpp index 7ceae20042..21af24f326 100644 --- a/stepmania/src/PlayerStageStats.cpp +++ b/stepmania/src/PlayerStageStats.cpp @@ -24,7 +24,6 @@ void PlayerStageStats::Init() fAliveSeconds = 0; bFailed = false; bFailedEarlier = false; - bGaveUp = false; iPossibleDancePoints = iCurPossibleDancePoints = iActualDancePoints = 0; iPossibleGradePoints = 0; iCurCombo = iMaxCombo = iCurMissCombo = iScore = iBonus = iMaxScore = iCurMaxScore = 0; @@ -59,7 +58,6 @@ void PlayerStageStats::AddStats( const PlayerStageStats& other ) fAliveSeconds += other.fAliveSeconds; bFailed |= other.bFailed; bFailedEarlier |= other.bFailedEarlier; - bGaveUp |= other.bGaveUp; iPossibleDancePoints += other.iPossibleDancePoints; iActualDancePoints += other.iActualDancePoints; iCurPossibleDancePoints += other.iCurPossibleDancePoints; @@ -511,10 +509,15 @@ float PlayerStageStats::GetPercentageOfTaps( TapNoteScore tns ) const return iTapNoteScores[tns] / (float)iTotalTaps; } -void PlayerStageStats::CalcAwards( PlayerNumber p ) +void PlayerStageStats::CalcAwards( PlayerNumber p, bool bGaveUp, bool bUsedAutoplay ) { LOG->Trace( "hand out awards" ); + m_pcaToShow = PEAK_COMBO_AWARD_INVALID; + + if( bGaveUp || bUsedAutoplay ) + return; + deque &vPdas = GAMESTATE->m_vLastPerDifficultyAwards[p]; LOG->Trace( "per difficulty awards" ); diff --git a/stepmania/src/PlayerStageStats.h b/stepmania/src/PlayerStageStats.h index 0a51327660..6f3a5a698d 100644 --- a/stepmania/src/PlayerStageStats.h +++ b/stepmania/src/PlayerStageStats.h @@ -39,7 +39,6 @@ public: /* This indicates whether the player bottomed out his bar/ran out of lives at some * point during the song. It's set in all fail modes. */ bool bFailedEarlier; - bool bGaveUp; // exited gameplay by giving up int iPossibleDancePoints; int iCurPossibleDancePoints; int iActualDancePoints; @@ -106,7 +105,7 @@ public: float GetSurvivalSeconds() { return fAliveSeconds + fLifeRemainingSeconds; } // Final results: - void CalcAwards( PlayerNumber p ); + void CalcAwards( PlayerNumber p, bool bGaveUp, bool bUsedAutoplay ); PerDifficultyAward m_pdaToShow; PeakComboAward m_pcaToShow; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 012959b4f9..b2221cf803 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -231,7 +231,7 @@ void ScreenEvaluation::Init() STATSMAN->m_CurStageStats.CommitScores( SUMMARY ); FOREACH_HumanPlayer( p ) - STATSMAN->m_CurStageStats.m_player[p].CalcAwards( p ); + STATSMAN->m_CurStageStats.m_player[p].CalcAwards( p, STATSMAN->m_CurStageStats.bGaveUp, STATSMAN->m_CurStageStats.bUsedAutoplay ); // Run this here, so STATSMAN->m_CurStageStats is available to overlays. ScreenWithMenuElements::Init(); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 0ff908679e..a34d850932 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1831,9 +1831,9 @@ void ScreenGameplay::Update( float fDeltaTime ) { // Give up + STATSMAN->m_CurStageStats.bGaveUp = true; FOREACH_EnabledPlayerNumberInfo( m_vPlayerInfo, pi ) { - pi->GetPlayerStageStats()->bGaveUp = true; pi->GetPlayerStageStats()->bFailed |= GAMESTATE->AllHumanHaveComboOf30OrMoreMisses(); } diff --git a/stepmania/src/StageStats.cpp b/stepmania/src/StageStats.cpp index c3ecb067b7..1578a61184 100644 --- a/stepmania/src/StageStats.cpp +++ b/stepmania/src/StageStats.cpp @@ -23,6 +23,8 @@ StageStats::StageStats() vpPlayedSongs.clear(); vpPossibleSongs.clear(); StageType = STAGE_INVALID; + bGaveUp = false; + bUsedAutoplay = false; fGameplaySeconds = 0; fStepsSeconds = 0; } @@ -87,6 +89,9 @@ void StageStats::AddStats( const StageStats& other ) FOREACH_CONST( Song*, other.vpPossibleSongs, s ) vpPossibleSongs.push_back( *s ); StageType = STAGE_INVALID; // meaningless + + bGaveUp |= other.bGaveUp; + bUsedAutoplay |= other.bUsedAutoplay; fGameplaySeconds += other.fGameplaySeconds; fStepsSeconds += other.fStepsSeconds; @@ -105,8 +110,8 @@ bool StageStats::OnePassed() const bool StageStats::AllFailed() const { - FOREACH_EnabledPlayer( pn ) - if( !m_player[pn].bFailed ) + FOREACH_EnabledPlayer( p ) + if( !m_player[p].bFailed ) return false; return true; } diff --git a/stepmania/src/StageStats.h b/stepmania/src/StageStats.h index a965d6f57b..2102039f2f 100644 --- a/stepmania/src/StageStats.h +++ b/stepmania/src/StageStats.h @@ -33,6 +33,9 @@ public: vector vpPossibleSongs; enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType; + bool bGaveUp; // exited gameplay by giving up + bool bUsedAutoplay; // used autoplay at any point during gameplay + // TODO: These are updated in ScreenGameplay::Update based on fDelta. // They should be made more accurate. float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.