From ca2222990cf560aa5623161b773aacb49635223d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 6 Mar 2007 10:05:51 +0000 Subject: [PATCH] rename: AllStepsTypeInOneList -> AutoSetStyle set m_pCurStyle based on the chosen Steps --- stepmania/src/CommonMetrics.cpp | 2 +- stepmania/src/CommonMetrics.h | 2 +- stepmania/src/ScreenSelectMusic.cpp | 27 +++++++++++++++++++++------ stepmania/src/SongUtil.cpp | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/stepmania/src/CommonMetrics.cpp b/stepmania/src/CommonMetrics.cpp index 78f89eb3ce..81adb87dc4 100644 --- a/stepmania/src/CommonMetrics.cpp +++ b/stepmania/src/CommonMetrics.cpp @@ -23,7 +23,7 @@ ThemeMetric CommonMetrics::DEFAULT_NOTESKIN_NAME ("Common","DefaultN ThemeMetricDifficultiesToShow CommonMetrics::DIFFICULTIES_TO_SHOW ("Common","DifficultiesToShow"); ThemeMetricCourseDifficultiesToShow CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW ("Common","CourseDifficultiesToShow"); ThemeMetricStepsTypesToShow CommonMetrics::STEPS_TYPES_TO_SHOW ("Common","StepsTypesToHide"); // This metric takes a list of StepsTypes to hide and returns a list of StepsTypes to show -ThemeMetric CommonMetrics::ALL_STEPS_TYPES_IN_ONE_LIST ("Common","AllStepsTypeInOneList"); +ThemeMetric CommonMetrics::AUTO_SET_STYLE ("Common","AutoSetStyle"); ThemeMetricDifficultiesToShow::ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ) : diff --git a/stepmania/src/CommonMetrics.h b/stepmania/src/CommonMetrics.h index 71bdd29d48..3835495fd9 100644 --- a/stepmania/src/CommonMetrics.h +++ b/stepmania/src/CommonMetrics.h @@ -62,7 +62,7 @@ namespace CommonMetrics extern ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW; extern ThemeMetricCourseDifficultiesToShow COURSE_DIFFICULTIES_TO_SHOW; extern ThemeMetricStepsTypesToShow STEPS_TYPES_TO_SHOW; - extern ThemeMetric ALL_STEPS_TYPES_IN_ONE_LIST; + extern ThemeMetric AUTO_SET_STYLE; RString LocalizeOptionItem( const RString &s, bool bOptional ); }; diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 3239e64491..1b04fad14e 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -106,7 +106,7 @@ void ScreenSelectMusic::Init() m_TexturePreload.Load( Banner::SongBannerTexture(THEME->GetPathG("Banner","mode")) ); } - if( CommonMetrics::ALL_STEPS_TYPES_IN_ONE_LIST ) + if( CommonMetrics::AUTO_SET_STYLE ) { vector vst; GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vst ); @@ -810,10 +810,6 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input ) return; } - m_SelectionState = GetNextSelectionState(); - - m_soundStart.Play(); - MESSAGEMAN->Broadcast("SongChosen"); break; @@ -821,9 +817,28 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input ) case SelectionState_SelectingSteps: break; } - + + m_SelectionState = GetNextSelectionState(); + m_soundStart.Play(); + + if( m_SelectionState == SelectionState_Finalized ) { + if( CommonMetrics::AUTO_SET_STYLE ) + { + /* Now that Steps have been chosen, set a Style that can play them. */ + StepsType stCurrent; + PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber; + if( GAMESTATE->IsCourseMode() ) + stCurrent = GAMESTATE->m_pCurTrail[pn]->m_StepsType; + else + stCurrent = GAMESTATE->m_pCurSteps[pn]->m_StepsType; + vector vst; + const Style *pStyle = GAMEMAN->GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined(), stCurrent ); + GAMESTATE->m_pCurStyle.Set( pStyle ); + } + + /* If we're currently waiting on song assets, abort all except the music and * start the music, so if we make a choice quickly before background requests * come through, the music will still start. */ diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index ef5b50094c..7e1c548c20 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -815,7 +815,7 @@ void SongUtil::FilterSongs( const SongCriteria &sc, const vector &in, vec static void GetPlayableStepsTypes( set &vOut ) { vector vpPossibleStyles; - if( CommonMetrics::ALL_STEPS_TYPES_IN_ONE_LIST ) + if( CommonMetrics::AUTO_SET_STYLE ) GAMEMAN->GetCompatibleStyles( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), vpPossibleStyles ); else vpPossibleStyles.push_back( GAMESTATE->m_pCurStyle );