From 4f75f0e174b6de5232697ed812d5a0e86a3e5952 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 10 Dec 2003 11:49:44 +0000 Subject: [PATCH] add PREFSMAN->m_fMinPercentageForHighScore fix fPercentDP not saved when new high score added --- stepmania/src/PrefsManager.cpp | 3 +++ stepmania/src/PrefsManager.h | 1 + stepmania/src/ScreenEvaluation.cpp | 19 +++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 00c9280cce..a7ccba3956 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -106,6 +106,7 @@ PrefsManager::PrefsManager() m_ShowSongOptions = YES; m_bDancePointsForOni = false; m_bPercentageScoring = false; + m_fMinPercentageForHighScore = 0.5f; m_bShowLyrics = true; m_bAutogenMissingTypes = true; m_bAutogenGroupCourses = true; @@ -315,6 +316,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "SoloSingle", m_bSoloSingle ); ini.GetValue( "Options", "DancePointsForOni", m_bDancePointsForOni ); ini.GetValue( "Options", "PercentageScoring", m_bPercentageScoring ); + ini.GetValue( "Options", "MinPercentageForHighScore", m_fMinPercentageForHighScore ); ini.GetValue( "Options", "ShowLyrics", m_bShowLyrics ); ini.GetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes ); ini.GetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses ); @@ -473,6 +475,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "SoloSingle", m_bSoloSingle ); ini.SetValue( "Options", "DancePointsForOni", m_bDancePointsForOni ); ini.SetValue( "Options", "PercentageScoring", m_bPercentageScoring ); + ini.SetValue( "Options", "MinPercentageForHighScore", m_fMinPercentageForHighScore ); ini.SetValue( "Options", "ShowLyrics", m_bShowLyrics ); ini.SetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes ); ini.SetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index f9131c6bc8..56f62b6d45 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -100,6 +100,7 @@ public: bool m_bSoloSingle; bool m_bDancePointsForOni; //DDR-Extreme style dance points instead of max2 percent bool m_bPercentageScoring; + float m_fMinPercentageForHighScore; bool m_bShowLyrics; bool m_bAutogenMissingTypes; bool m_bAutogenGroupCourses; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index a5829f36eb..d2fe0ce2c6 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -221,7 +221,8 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) hs.grade = grade[p]; hs.iScore = stageStats.iScore[p] + stageStats.iBonus[p]; hs.fPercentDP = stageStats.GetPercentDancePoints( (PlayerNumber)p ); - GAMESTATE->m_pCurNotes[p]->AddHighScore( (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); + if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore ) + GAMESTATE->m_pCurNotes[p]->AddHighScore( (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); // update unlock data if unlocks are on if ( PREFSMAN->m_bUseUnlockSystem ) @@ -253,7 +254,9 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) ProfileManager::CategoryData::HighScore hs; hs.iScore = stageStats.iScore[p]; - PROFILEMAN->AddHighScore( nt, rc[p], (PlayerNumber)p, hs, iMachineHighScoreIndex[p] ); + hs.fPercentDP = stageStats.GetPercentDancePoints( (PlayerNumber)p ); + if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore ) + PROFILEMAN->AddHighScore( nt, rc[p], (PlayerNumber)p, hs, iMachineHighScoreIndex[p] ); // If unlocking is enabled, save the dance points if( PREFSMAN->m_bUseUnlockSystem ) @@ -270,17 +273,13 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) // DO save scores for a failed Oni/Endless if( m_bFailed && pCourse->IsNonstop() ) continue; - int score; - if( pCourse->IsOni() ) - score = stageStats.iActualDancePoints[p]; - else - score = stageStats.iScore[p]; - StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType; Course::MemCardData::HighScore hs; - hs.iScore = score; + hs.iScore = stageStats.iScore[p]; + hs.fPercentDP = stageStats.GetPercentDancePoints( (PlayerNumber)p ); hs.fSurviveTime = stageStats.fAliveSeconds[p]; - pCourse->AddHighScore( nt, (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); + if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore ) + pCourse->AddHighScore( nt, (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] ); } // If unlocking is enabled, save the dance points