From d0356d78fa25f4282e9f21b9d6a155fab71a0bf9 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 9 Mar 2004 08:19:55 +0000 Subject: [PATCH] if using a handicap option, don't add a high score and show "disqualify" on the eval screen --- .../ScreenEvaluation disqualified.redir | 1 + stepmania/Themes/default/metrics.ini | 9 + stepmania/src/ActorUtil.h | 8 +- stepmania/src/GameState.cpp | 8 + stepmania/src/GameState.h | 2 + stepmania/src/ScreenEvaluation.cpp | 178 +++++++++++------- stepmania/src/ScreenEvaluation.h | 1 + stepmania/src/ScreenPlayerOptions.cpp | 4 +- 8 files changed, 133 insertions(+), 78 deletions(-) create mode 100644 stepmania/Themes/default/Graphics/ScreenEvaluation disqualified.redir diff --git a/stepmania/Themes/default/Graphics/ScreenEvaluation disqualified.redir b/stepmania/Themes/default/Graphics/ScreenEvaluation disqualified.redir new file mode 100644 index 0000000000..04b2ead777 --- /dev/null +++ b/stepmania/Themes/default/Graphics/ScreenEvaluation disqualified.redir @@ -0,0 +1 @@ +_blank \ No newline at end of file diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 29be5c7661..e4738f3399 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1149,6 +1149,15 @@ PassedSoundTime=0 NumSequenceSounds=0 PeakComboAwardCommand= +DisqualifiedP1X=0 +DisqualifiedP1Y=0 +DisqualifiedP1OffCommand= +DisqualifiedP1OnCommand= +DisqualifiedP2X=0 +DisqualifiedP2Y=0 +DisqualifiedP2OffCommand= +DisqualifiedP2OnCommand= + [ScreenEvaluationStage] Fallback=ScreenEvaluation NextScreen=ScreenSelectMusic diff --git a/stepmania/src/ActorUtil.h b/stepmania/src/ActorUtil.h index e27c04b1c9..e8c5b2e05e 100644 --- a/stepmania/src/ActorUtil.h +++ b/stepmania/src/ActorUtil.h @@ -37,10 +37,10 @@ inline void UtilSetXYAndOnCommand( Actor& actor, CString sClassName ) } /* convenience */ -inline void UtilCommand( Actor* pActor, CString sClassName, CString sCommandName ) { UtilCommand( *pActor, sClassName, sCommandName ); } -inline void UtilOnCommand( Actor* pActor, CString sClassName ) { UtilOnCommand( *pActor, sClassName ); } -inline void UtilOffCommand( Actor* pActor, CString sClassName ) { UtilOffCommand( *pActor, sClassName ); } -inline void UtilSetXYAndOnCommand( Actor* pActor, CString sClassName ) { UtilSetXYAndOnCommand( *pActor, sClassName ); } +inline void UtilCommand( Actor* pActor, CString sClassName, CString sCommandName ) { if(pActor) UtilCommand( *pActor, sClassName, sCommandName ); } +inline void UtilOnCommand( Actor* pActor, CString sClassName ) { if(pActor) UtilOnCommand( *pActor, sClassName ); } +inline void UtilOffCommand( Actor* pActor, CString sClassName ) { if(pActor) UtilOffCommand( *pActor, sClassName ); } +inline void UtilSetXYAndOnCommand( Actor* pActor, CString sClassName ) { if(pActor) UtilSetXYAndOnCommand( *pActor, sClassName ); } // Return a Sprite, BitmapText, or Model depending on the file type Actor* LoadFromActorFile( CString sIniPath, CString sLayer = "Actor" ); diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 9687e78c0e..5205dcdfb3 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -829,6 +829,14 @@ void GameState::RestoreSelectedOptions() m_SongOptions = m_StoredSongOptions; } +bool GameState::IsDisqualified( PlayerNumber pn ) +{ + if( GAMESTATE->IsCourseMode() ) + return GAMESTATE->m_PlayerOptions[pn].IsHandicapForCourse( GAMESTATE->m_pCurCourse ); + else + return GAMESTATE->m_PlayerOptions[pn].IsHandicapForSong( GAMESTATE->m_pCurSong ); +} + void GameState::ResetNoteSkins() { for( int pn = 0; pn < NUM_PLAYERS; ++pn ) diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index ade8098d6b..796d92b5c2 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -211,6 +211,8 @@ public: void StoreSelectedOptions(); void RestoreSelectedOptions(); + bool IsDisqualified( PlayerNumber pn ); + void AdjustFailType(); // character stuff diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index a960984b9c..335e87c73e 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -319,6 +319,14 @@ void ScreenEvaluation::Init() SET_XY_AND_ON_COMMAND( m_textPlayerOptions[p] ); m_textPlayerOptions[p].SetText( sPO ); this->AddChild( &m_textPlayerOptions[p] ); + + if( GAMESTATE->IsDisqualified((PlayerNumber)p) ) + { + m_sprDisqualified[p].Load( THEME->GetPathToG("ScreenEvaluation disqualified") ); + m_sprDisqualified[p]->SetName( ssprintf("DisqualifiedP%d",p+1) ); + SET_XY_AND_ON_COMMAND( m_sprDisqualified[p] ); + this->AddChild( m_sprDisqualified[p] ); + } } } break; @@ -840,6 +848,10 @@ void ScreenEvaluation::CommitScores( const StageStats &stageStats, int iPersonal if( !GAMESTATE->IsHumanPlayer(p) ) continue; + // don't save scores if the player is disqualified + if( GAMESTATE->IsDisqualified((PlayerNumber)p) ) + continue; + // // Add step totals // @@ -877,68 +889,6 @@ void ScreenEvaluation::CommitScores( const StageStats &stageStats, int iPersonal if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForHighScore ) PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); - - if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) - { - // check for awards - Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p); - - if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_GREAT ) ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_FULL_COMBO_GREATS ); - if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_PERFECT ) ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_FULL_COMBO_PERFECTS ); - if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_MARVELOUS ) ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_FULL_COMBO_MARVELOUSES ); - - if( stageStats.SingleDigitsOfScore( (PlayerNumber)p, TNS_GREAT ) ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_SINGLE_DIGIT_GREATS ); - if( stageStats.SingleDigitsOfScore( (PlayerNumber)p, TNS_PERFECT ) ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_SINGLE_DIGIT_PERFECTS ); - - float fPercentGreats = stageStats.GetPercentageOfTaps((PlayerNumber)p, TNS_GREAT); - if( fPercentGreats >= 0.8f ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_GREATS_80_PERCENT ); - if( fPercentGreats >= 0.9f ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_GREATS_90_PERCENT ); - if( fPercentGreats >= 1.f ) - GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_GREATS_100_PERCENT ); - - int iComboAtStartOfStage = stageStats.GetComboAtStartOfStage( (PlayerNumber)p ); - int iPeakCombo = stageStats.GetMaxCombo((PlayerNumber)p).cnt; - - FOREACH_PeakComboAward( pca ) - { - int iLevel = 100/*0*/ * (pca+1); - bool bCrossedLevel = iComboAtStartOfStage < iLevel && iPeakCombo >= iLevel; - if( bCrossedLevel ) - { - GAMESTATE->m_vLastPeakComboAwards[p].push_back( pca ); - m_textJudgeNumbers[max_combo][p].Command( PEAK_COMBO_AWARD_COMMAND ); - } - } - - { - for( int i=GAMESTATE->m_vLastPerDifficultyAwards[p].size()-1; i>=0; i-- ) - { - PerDifficultyAward pda = GAMESTATE->m_vLastPerDifficultyAwards[p][i]; - Steps* pSteps = stageStats.pSteps[p]; - bool bAlreadyHad = pProfile->HasPerDifficultyAward( pSteps->m_StepsType, pSteps->GetDifficulty(), pda ); - pProfile->AddPerDifficultyAward( pSteps->m_StepsType, pSteps->GetDifficulty(), pda ); - if( bAlreadyHad ) - GAMESTATE->m_vLastPerDifficultyAwards[p].erase( GAMESTATE->m_vLastPerDifficultyAwards[p].begin()+i ); - } - } - { - for( int i=GAMESTATE->m_vLastPeakComboAwards[p].size()-1; i>=0; i-- ) - { - PeakComboAward pca = GAMESTATE->m_vLastPeakComboAwards[p][i]; - bool bAlreadyHad = pProfile->HasPeakComboAward( pca ); - pProfile->AddPeakComboAward( pca ); - if( bAlreadyHad ) - GAMESTATE->m_vLastPeakComboAwards[p].erase( GAMESTATE->m_vLastPeakComboAwards[p].begin()+i ); - } - } - } } break; @@ -963,16 +913,15 @@ void ScreenEvaluation::CommitScores( const StageStats &stageStats, int iPersonal { Course* pCourse = GAMESTATE->m_pCurCourse; CourseDifficulty cd = GAMESTATE->m_CourseDifficulty[p]; - if( pCourse ) - { - // don't save scores for a failed Nonstop - // DO save scores for a failed Oni/Endless - if( stageStats.bFailed[p] && pCourse->IsNonstop() ) - continue; + ASSERT( pCourse ); - if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore ) - PROFILEMAN->AddCourseHighScore( pCourse, nt, cd, (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); - } + // don't save scores for a failed Nonstop + // DO save scores for a failed Oni/Endless + if( stageStats.bFailed[p] && pCourse->IsNonstop() ) + continue; + + if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore ) + PROFILEMAN->AddCourseHighScore( pCourse, nt, cd, (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); } break; default: @@ -980,6 +929,7 @@ void ScreenEvaluation::CommitScores( const StageStats &stageStats, int iPersonal } } + // If both players get a machine high score, a player whose score is added later // may bump the players who were added earlier. Adjust for this. for( p=0; pIsHumanPlayer(p) ) + continue; + + // must be using a profile to receive awards + if( !PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) + continue; + + Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p); + + + // per-difficulty awards + switch( m_Type ) + { + case stage: + // don't give per-difficutly awards if using easy mods + if( !GAMESTATE->IsDisqualified((PlayerNumber)p) ) + { + if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_GREAT ) ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_FULL_COMBO_GREATS ); + if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_PERFECT ) ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_FULL_COMBO_PERFECTS ); + if( stageStats.FullComboOfScore( (PlayerNumber)p, TNS_MARVELOUS ) ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_FULL_COMBO_MARVELOUSES ); + + if( stageStats.SingleDigitsOfScore( (PlayerNumber)p, TNS_GREAT ) ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_SINGLE_DIGIT_GREATS ); + if( stageStats.SingleDigitsOfScore( (PlayerNumber)p, TNS_PERFECT ) ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_SINGLE_DIGIT_PERFECTS ); + + float fPercentGreats = stageStats.GetPercentageOfTaps((PlayerNumber)p, TNS_GREAT); + if( fPercentGreats >= 0.8f ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_GREATS_80_PERCENT ); + if( fPercentGreats >= 0.9f ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_GREATS_90_PERCENT ); + if( fPercentGreats >= 1.f ) + GAMESTATE->m_vLastPerDifficultyAwards[p].push_back( AWARD_GREATS_100_PERCENT ); + } + } + + // DO give peak combo awards if using easy mods + int iComboAtStartOfStage = stageStats.GetComboAtStartOfStage( (PlayerNumber)p ); + int iPeakCombo = stageStats.GetMaxCombo((PlayerNumber)p).cnt; + + FOREACH_PeakComboAward( pca ) + { + int iLevel = 100/*0*/ * (pca+1); + bool bCrossedLevel = iComboAtStartOfStage < iLevel && iPeakCombo >= iLevel; + if( bCrossedLevel ) + { + GAMESTATE->m_vLastPeakComboAwards[p].push_back( pca ); + m_textJudgeNumbers[max_combo][p].Command( PEAK_COMBO_AWARD_COMMAND ); + } + } + + // erase awards from the Last list that have been received so that we + // won't show them again. + { + for( int i=GAMESTATE->m_vLastPerDifficultyAwards[p].size()-1; i>=0; i-- ) + { + PerDifficultyAward pda = GAMESTATE->m_vLastPerDifficultyAwards[p][i]; + Steps* pSteps = stageStats.pSteps[p]; + bool bAlreadyHad = pProfile->HasPerDifficultyAward( pSteps->m_StepsType, pSteps->GetDifficulty(), pda ); + pProfile->AddPerDifficultyAward( pSteps->m_StepsType, pSteps->GetDifficulty(), pda ); + if( bAlreadyHad ) + GAMESTATE->m_vLastPerDifficultyAwards[p].erase( GAMESTATE->m_vLastPerDifficultyAwards[p].begin()+i ); + } + } + { + for( int i=GAMESTATE->m_vLastPeakComboAwards[p].size()-1; i>=0; i-- ) + { + PeakComboAward pca = GAMESTATE->m_vLastPeakComboAwards[p][i]; + bool bAlreadyHad = pProfile->HasPeakComboAward( pca ); + pProfile->AddPeakComboAward( pca ); + if( bAlreadyHad ) + GAMESTATE->m_vLastPeakComboAwards[p].erase( GAMESTATE->m_vLastPeakComboAwards[p].begin()+i ); + } + } + } } @@ -1037,6 +1072,7 @@ void ScreenEvaluation::TweenOffScreen() continue; OFF_COMMAND( m_DifficultyIcon[p] ); OFF_COMMAND( m_textPlayerOptions[p] ); + OFF_COMMAND( m_sprDisqualified[p] ); } // small banner area diff --git a/stepmania/src/ScreenEvaluation.h b/stepmania/src/ScreenEvaluation.h index 993d1752cd..21f219c6e0 100644 --- a/stepmania/src/ScreenEvaluation.h +++ b/stepmania/src/ScreenEvaluation.h @@ -78,6 +78,7 @@ protected: Sprite m_sprStage; DifficultyIcon m_DifficultyIcon[NUM_PLAYERS]; BitmapText m_textPlayerOptions[NUM_PLAYERS]; + AutoActor m_sprDisqualified[NUM_PLAYERS]; Banner m_SmallBanner[MAX_SONGS_TO_SHOW]; Sprite m_sprSmallBannerFrame[MAX_SONGS_TO_SHOW]; diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 87c0e7a9d2..ed782e049b 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -188,9 +188,7 @@ void ScreenPlayerOptions::UpdateDisqualified() { for( int p=0; pIsCourseMode() ? - GAMESTATE->m_PlayerOptions[p].IsHandicapForCourse( GAMESTATE->m_pCurCourse ) : - GAMESTATE->m_PlayerOptions[p].IsHandicapForSong( GAMESTATE->m_pCurSong ); + bool bIsHandicap = GAMESTATE->IsDisqualified((PlayerNumber)p); m_sprDisqualify[p]->SetHidden( !bIsHandicap );