diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 8caf3dbf61..a6ec3bd1e4 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -724,7 +724,9 @@ UseSectionsWithPreferredGroup=false RouletteSwitchSeconds=0.05 RouletteSlowDownSwitches=5 LockedInitialVelocity=15 - +# +HideSections=false +# ScrollBarHeight=300 ScrollBarOnCommand=visible,false # @@ -1764,8 +1766,12 @@ PreviousSongButton="MenuLeft" NextSongButton="MenuRight" # ChangeStepsWithGameButtons=false -PreviousDifficultyButton="MenuUp" -NextDifficultyButton="MenuDown" +;PreviousDifficultyButton="MenuUp" +;NextDifficultyButton="MenuDown" +# +ChangeGroupsWithGameButtoms=false +;PreviousGroupButton="MenuUp" +;NextGroupButton="MenuDown" # TwoPartSelection=false TwoPartConfirmsOnly=false diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index 29ab02ea8f..f80342ac86 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -79,6 +79,7 @@ void MusicWheel::Load( RString sType ) SORT_ORDERS .Load(sType,"SortOrders"); SHOW_EASY_FLAG .Load(sType,"UseEasyMarkerFlag"); USE_SECTIONS_WITH_PREFERRED_GROUP .Load(sType,"UseSectionsWithPreferredGroup"); + HIDE_SECTIONS .Load(sType,"HideSections"); vector vsModeChoiceNames; split( MODE_MENU_CHOICE_NAMES, ",", vsModeChoiceNames ); CHOICE .Load(sType,CHOICE_NAME,vsModeChoiceNames); @@ -615,7 +616,9 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelIt // new section, make a section item RageColor colorSection = (so==SORT_GROUP) ? SONGMAN->GetSongGroupColor(pSong->m_sGroupName) : SECTION_COLORS.GetValue(iSectionColorIndex); iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS; - arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection, iSectionCount) ); + // This restricts to show only one group at time (ever heard about exceed or zero?) + if( !HIDE_SECTIONS ) + arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection, iSectionCount) ); sLastSection = sThisSection; } } @@ -1129,23 +1132,44 @@ void MusicWheel::SetOpenSection( RString group ) // sm-ssc additions: jump to group RString MusicWheel::JumpToNextGroup() { - unsigned int iLastSelection = m_iSelection; - for( unsigned int i = m_iSelection; i < m_CurWheelItemData.size(); ++i ) + //Thanks to Juanelote for this small addition + if(HIDE_SECTIONS) { - if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) + unsigned iNumGroups = SONGMAN->GetNumSongGroups(); + + for(unsigned i = 0 ; i < iNumGroups ; i++) { - m_iSelection = i; - return m_CurWheelItemData[i]->m_sText; + if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(i) ) + { + if ( i < iNumGroups - 1 ) + return SONGMAN->GetSongGroupByIndex(i+1); + else + { + //i = 0; + return SONGMAN->GetSongGroupByIndex(0); + } + } } } - // it should not get down here, but it might happen... only search up to - // the previous selection. - for( unsigned int i = 0; i < iLastSelection; ++i ) - { - if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) + else{ + unsigned int iLastSelection = m_iSelection; + for( unsigned int i = m_iSelection; i < m_CurWheelItemData.size(); ++i ) { - m_iSelection = i; - return m_CurWheelItemData[i]->m_sText; + if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) + { + m_iSelection = i; + return m_CurWheelItemData[i]->m_sText; + } + } + // it should not get down here, but it might happen... only search up to + // the previous selection. + for( unsigned int i = 0; i < iLastSelection; ++i ) + { + if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) + { + m_iSelection = i; + return m_CurWheelItemData[i]->m_sText; + } } } // and this would be el bad: @@ -1154,23 +1178,44 @@ RString MusicWheel::JumpToNextGroup() RString MusicWheel::JumpToPrevGroup() { - for( unsigned int i = m_iSelection; i > 0; --i ) + if(HIDE_SECTIONS) { - if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) + unsigned iNumGroups = SONGMAN->GetNumSongGroups(); + + for(unsigned i = 0 ; i < iNumGroups ; i++) { - m_iSelection = i; - return m_CurWheelItemData[i]->m_sText; + if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(i) ) + { + if ( i > 0 ) + return SONGMAN->GetSongGroupByIndex(i-1); + else + { + //i = iNumGroups - 1; + return SONGMAN->GetSongGroupByIndex(iNumGroups - 1); + } + } } } - // in case it wasn't found above: - for( unsigned int i = m_CurWheelItemData.size()-1; i > 0; --i ) + else { - LOG->Trace( ssprintf("JumpToPrevGroup iteration 2 | i = %u",i) ); - if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION ) + for( unsigned int i = m_iSelection; i > 0; --i ) { - m_iSelection = i; - LOG->Trace( ssprintf("finding it in #2 | i = %u | text = %s",i, m_CurWheelItemData[i]->m_sText.c_str()) ); - return m_CurWheelItemData[i]->m_sText; + if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) + { + m_iSelection = i; + return m_CurWheelItemData[i]->m_sText; + } + } + // in case it wasn't found above: + for( unsigned int i = m_CurWheelItemData.size()-1; i > 0; --i ) + { + LOG->Trace( ssprintf("JumpToPrevGroup iteration 2 | i = %u",i) ); + if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION ) + { + m_iSelection = i; + LOG->Trace( ssprintf("finding it in #2 | i = %u | text = %s",i, m_CurWheelItemData[i]->m_sText.c_str()) ); + return m_CurWheelItemData[i]->m_sText; + } } } // and this would be el bad: diff --git a/src/MusicWheel.h b/src/MusicWheel.h index 64aa989b4f..a59c400bec 100644 --- a/src/MusicWheel.h +++ b/src/MusicWheel.h @@ -85,6 +85,8 @@ protected: ThemeMetric SORT_ORDERS; ThemeMetric SHOW_EASY_FLAG; ThemeMetric USE_SECTIONS_WITH_PREFERRED_GROUP; + //sm-ssc additions -DaisuMaster + ThemeMetric HIDE_SECTIONS; }; #endif diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index b9b73b7aca..ceb1faf3b2 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -92,6 +92,7 @@ void ScreenSelectMusic::Init() WRAP_CHANGE_STEPS.Load( m_sName, "WrapChangeSteps" ); //To allow changing steps with gamebuttons -DaisuMaster CHANGE_STEPS_WITH_GAME_BUTTONS.Load( m_sName, "ChangeStepsWithGameButtons" ); + CHANGE_GROUPS_WITH_GAME_BUTTONS.Load( m_sName, "ChangeGroupsWithGameButtoms" ); m_GameButtonPreviousSong = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"PreviousSongButton") ); m_GameButtonNextSong = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"NextSongButton") ); @@ -102,6 +103,12 @@ void ScreenSelectMusic::Init() m_GameButtonPreviousDifficulty = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"PreviousDifficultyButton") ); m_GameButtonNextDifficulty = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"NextDifficultyButton") ); } + //same here but for groups -DaisuMaster + if( CHANGE_GROUPS_WITH_GAME_BUTTONS ) + { + m_GameButtonPreviousGroup = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"PreviousGroupButton") ); + m_GameButtonNextGroup = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"NextGroupButton") ); + } FOREACH_ENUM( PlayerNumber, p ) { @@ -634,13 +641,55 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) if( m_SelectionState == SelectionState_SelectingSong ) { - if (input.MenuI == m_GameButtonPreviousDifficulty ) + if ( input.MenuI == m_GameButtonPreviousDifficulty ) { - ChangeSteps( input.pn, -1 ); + // Oh! I forgot to restrict to switch if the selection is locked... -DaisuMaster + if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) + m_soundLocked.Play(); + else + ChangeSteps( input.pn, -1 ); } else if( input.MenuI == m_GameButtonNextDifficulty ) { - ChangeSteps( input.pn, +1 ); + if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) + m_soundLocked.Play(); + else + ChangeSteps( input.pn, +1 ); + } + } + } + // Most likely a copypasta of the previous addition -DaisuMaster + if( CHANGE_GROUPS_WITH_GAME_BUTTONS ) + { + if( input.type != IET_FIRST_PRESS) + return; + + if( m_SelectionState == SelectionState_SelectingSong ) + { + if(input.MenuI == m_GameButtonPreviousGroup ) + { + if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) + m_soundLocked.Play(); + else + { + //for real: copypasta + RString sNewGroup = m_MusicWheel.JumpToPrevGroup(); + m_MusicWheel.SelectSection(sNewGroup); + m_MusicWheel.SetOpenSection(sNewGroup); + AfterMusicChange(); + } + } + if(input.MenuI == m_GameButtonNextGroup ) + { + if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) + m_soundLocked.Play(); + else + { + RString sNewGroup = m_MusicWheel.JumpToNextGroup(); + m_MusicWheel.SelectSection(sNewGroup); + m_MusicWheel.SetOpenSection(sNewGroup); + AfterMusicChange(); + } } } } @@ -770,7 +819,7 @@ bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input ) MESSAGEMAN->Broadcast( "SongOptionsChanged" ); } - else if( CodeDetector::EnteredNextGroup(input.GameI.controller) ) + else if( CodeDetector::EnteredNextGroup(input.GameI.controller) && !CHANGE_GROUPS_WITH_GAME_BUTTONS ) { if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) m_soundLocked.Play(); @@ -782,7 +831,7 @@ bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input ) AfterMusicChange(); } } - else if( CodeDetector::EnteredPrevGroup(input.GameI.controller) ) + else if( CodeDetector::EnteredPrevGroup(input.GameI.controller) && !CHANGE_GROUPS_WITH_GAME_BUTTONS ) { if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) m_soundLocked.Play(); diff --git a/src/ScreenSelectMusic.h b/src/ScreenSelectMusic.h index e0b6163534..c69425bc9e 100644 --- a/src/ScreenSelectMusic.h +++ b/src/ScreenSelectMusic.h @@ -89,6 +89,7 @@ protected: ThemeMetric TWO_PART_TIMER_SECONDS; ThemeMetric WRAP_CHANGE_STEPS; ThemeMetric CHANGE_STEPS_WITH_GAME_BUTTONS; + ThemeMetric CHANGE_GROUPS_WITH_GAME_BUTTONS; bool CanChangeSong() const { return m_SelectionState == SelectionState_SelectingSong; } bool CanChangeSteps() const { return TWO_PART_SELECTION ? m_SelectionState == SelectionState_SelectingSteps : m_SelectionState == SelectionState_SelectingSong; } @@ -108,6 +109,8 @@ protected: GameButton m_GameButtonNextSong; GameButton m_GameButtonPreviousDifficulty; GameButton m_GameButtonNextDifficulty; + GameButton m_GameButtonPreviousGroup; + GameButton m_GameButtonNextGroup; RString m_sSectionMusicPath; RString m_sSortMusicPath; diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 3f02d1f041..2a649d349b 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -706,6 +706,11 @@ int SongManager::GetNumCourseGroups() const return m_mapCourseGroupToInfo.size(); } +RString SongManager::GetSongGroupByIndex(unsigned index) +{ + return m_sSongGroupNames[index]; +} + RString SongManager::ShortenGroupName( RString sLongGroupName ) { static TitleSubst tsub("Groups"); diff --git a/src/SongManager.h b/src/SongManager.h index 689cde35d3..e7b1ac3f37 100644 --- a/src/SongManager.h +++ b/src/SongManager.h @@ -98,6 +98,7 @@ public: int GetNumCourses() const; int GetNumAdditionalCourses() const; int GetNumCourseGroups() const; + RString GetSongGroupByIndex(unsigned index); Song* GetRandomSong(); Course* GetRandomCourse();