From 7c2ab0d0a26524426efe5a8fe5210901dba62a12 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 9 May 2005 01:26:30 +0000 Subject: [PATCH] add RANDOM_PICKS_LOCKED_SONGS --- stepmania/src/MusicWheel.cpp | 20 ++++++++++++++------ stepmania/src/MusicWheel.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 1a70ebed8a..cdc080bfc6 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -230,6 +230,7 @@ void MusicWheel::LoadFromMetrics( CString sType ) SHOW_ROULETTE .Load(sType,"ShowRoulette"); SHOW_RANDOM .Load(sType,"ShowRandom"); SHOW_PORTAL .Load(sType,"ShowPortal"); + RANDOM_PICKS_LOCKED_SONGS .Load(sType,"RandomPicksLockedSongs"); MOST_PLAYED_SONGS_TO_SHOW .Load(sType,"MostPlayedSongsToShow"); MODE_MENU_CHOICE_NAMES .Load(sType,"ModeMenuChoiceNames"); vector vsModeChoiceNames; @@ -407,8 +408,9 @@ void MusicWheel::GetSongList(vector &arraySongs, SortOrder so, CString sP continue; } - // If we're using unlocks, check it here to prevent from being shown - if( so!=SORT_ROULETTE && UNLOCKMAN->SongIsLocked(pSong) ) + /* Hide locked songs. If RANDOM_PICKS_LOCKED_SONGS, hide in Roulette and Random, + * too. */ + if( (so!=SORT_ROULETTE || !RANDOM_PICKS_LOCKED_SONGS) && UNLOCKMAN->SongIsLocked(pSong) ) continue; // If the song has at least one steps, add it. @@ -1152,11 +1154,17 @@ void MusicWheel::StartRoulette() void MusicWheel::StartRandom() { - /* Shuffle the roulette wheel. */ - RandomGen rnd; - random_shuffle( m_WheelItemDatas[SORT_ROULETTE].begin(), m_WheelItemDatas[SORT_ROULETTE].end(), rnd ); + /* If RANDOM_PICKS_LOCKED_SONGS is disabled, pick a song from the active sort and + * section. If enabled, picking from the section makes it too easy to trick the + * game into picking a locked song, so pick from SORT_ROULETTE. */ + if( RANDOM_PICKS_LOCKED_SONGS ) + { + /* Shuffle and use the roulette wheel. */ + RandomGen rnd; + random_shuffle( m_WheelItemDatas[SORT_ROULETTE].begin(), m_WheelItemDatas[SORT_ROULETTE].end(), rnd ); - SetOpenGroup("", SortOrder(SORT_ROULETTE)); + SetOpenGroup( "", SortOrder(SORT_ROULETTE) ); + } m_Moving = -1; m_TimeBeforeMovingBegins = 0; diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 7a935be4d4..7bee189f46 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -95,6 +95,7 @@ protected: ThemeMetric SHOW_ROULETTE; ThemeMetric SHOW_RANDOM; ThemeMetric SHOW_PORTAL; + ThemeMetric RANDOM_PICKS_LOCKED_SONGS; ThemeMetric MOST_PLAYED_SONGS_TO_SHOW; ThemeMetric MODE_MENU_CHOICE_NAMES; ThemeMetricMap CHOICE;