From 38f78c4560bfc9143c77e56f96cd0c1e8fd31859 Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Mon, 3 Nov 2003 10:14:13 +0000 Subject: [PATCH] add option to hide name entry screen if course isn't in ranking list --- stepmania/src/Course.cpp | 13 +++++++++++++ stepmania/src/Course.h | 1 + stepmania/src/PrefsManager.cpp | 4 ++++ stepmania/src/PrefsManager.h | 1 + stepmania/src/ScreenNameEntry.cpp | 12 ++++++++++++ stepmania/src/ScreenOptionsMasterPrefs.cpp | 7 +++++++ 6 files changed, 38 insertions(+) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index d040904603..6c16a2ef20 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -992,3 +992,16 @@ void Course::Info::GetAttackArray( AttackArray &out ) const out.insert( out.end(), Attacks.begin(), Attacks.end() ); } + +bool Course::IsRanking() const +{ + CStringArray rankingsongs; + + split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs); + + for(unsigned i=0; i < rankingsongs.size(); i++) + if (rankingsongs[i].CompareNoCase(m_sPath)) + return true; + + return false; +} \ No newline at end of file diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 7f3e6f207e..2aae9e342c 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -196,6 +196,7 @@ public: // sorting values int SortOrder_TotalDifficulty; int SortOrder_Ranking; + bool IsRanking() const; void UpdateCourseStats(); diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index b8f4298982..b8dec901cb 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -133,6 +133,8 @@ PrefsManager::PrefsManager() m_bMoveRandomToEnd = false; m_iScoringType = SCORING_MAX2; + m_iGetRankingName = RANKING_ON; + m_fLongVerSongSeconds = 60*2.5f; // Dynamite Rave is 2:55 m_fMarathonVerSongSeconds = 60*5.f; @@ -298,6 +300,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "LastSeenMemory", m_iLastSeenMemory ); #endif ini.GetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking ); + ini.GetValue( "Options", "GetRankingName", (int&)m_iGetRankingName); ini.GetValue( "Options", "AntiAliasing", m_bAntiAliasing ); ini.GetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds ); ini.GetValue( "Options", "ForceLogFlush", m_bForceLogFlush ); @@ -424,6 +427,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "LastSeenMemory", m_iLastSeenMemory ); #endif ini.SetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking ); + ini.SetValue( "Options", "GetRankingName", m_iGetRankingName); ini.SetValue( "Options", "AntiAliasing", m_bAntiAliasing ); ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds ); ini.SetValue( "Options", "ForceLogFlush", m_bForceLogFlush ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 2acb3115fc..7e47a93375 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -118,6 +118,7 @@ public: // course ranking enum CourseSortOrders { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder; bool m_bMoveRandomToEnd; + enum GetRankingName { RANKING_OFF, RANKING_ON, RANKING_LIST } m_iGetRankingName; // scoring type; SCORING_MAX2 should always be first enum ScoringTypes { SCORING_MAX2, SCORING_5TH } m_iScoringType; diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 5e1d1153c4..63460460e4 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -149,6 +149,18 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName ) return; } + bool IsOnRanking = ( (GAMESTATE->m_PlayMode == PLAY_MODE_NONSTOP || GAMESTATE->m_PlayMode == PLAY_MODE_ONI) + && !(GAMESTATE->m_pCurCourse->IsRanking()) ); + + if (PREFSMAN->m_iGetRankingName == PrefsManager::RANKING_OFF || + (PREFSMAN->m_iGetRankingName == PrefsManager::RANKING_LIST && !IsOnRanking)) + { + // don't collect score due to ranking setting + HandleScreenMessage( SM_GoToNextScreen ); + return; + } + + GAMESTATE->m_bPastHereWeGo = true; // enable the gray arrows m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenNameEntry background") ); diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index 786c58d134..af8af3012c 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -298,6 +298,12 @@ static void ShowSongOptions( int &sel, bool ToSel, const CStringArray &choices ) MoveMap( sel, PREFSMAN->m_ShowSongOptions, ToSel, mapping, ARRAYSIZE(mapping) ); } +static void ShowNameEntry( int &sel, bool ToSel, const CStringArray &choices ) +{ + const PrefsManager::GetRankingName mapping[] = { PrefsManager::RANKING_OFF, PrefsManager::RANKING_ON, PrefsManager::RANKING_LIST }; + MoveMap( sel, PREFSMAN->m_iGetRankingName, ToSel, mapping, ARRAYSIZE(mapping) ); +} + static void DefaultFailType( int &sel, bool ToSel, const CStringArray &choices ) { if( ToSel ) @@ -449,6 +455,7 @@ static const ConfOption g_ConfOptions[] = ConfOption( "Coins Per\nCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8" ), ConfOption( "Joint\nPremium", JointPremium, "OFF","ON" ), ConfOption( "Show Song\nOptions", ShowSongOptions, "HIDE","SHOW","ASK" ), + ConfOption( "Show Name\nEntry", ShowNameEntry, "OFF", "ON", "RANKING SONGS" ), /* Graphic options */ ConfOption( "Display\nMode", DisplayMode, "FULLSCREEN", "WINDOWED" ),