From 441541a16c19f044ac0890782c872f5555ada5f5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 30 Aug 2002 04:28:12 +0000 Subject: [PATCH] Add #SELECTABLE:YES, NO and ROULETTE. Add an option for this. It's off by default. --- stepmania/src/MusicWheel.cpp | 5 ++++ stepmania/src/PrefsManager.cpp | 5 ++++ stepmania/src/PrefsManager.h | 1 + stepmania/src/ScreenSelectGroup.cpp | 7 ++++-- stepmania/src/Song.cpp | 37 +++++++++++++++++++++++++++++ stepmania/src/song.h | 7 ++++++ 6 files changed, 60 insertions(+), 2 deletions(-) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index e58f905f71..0c58505d64 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -436,6 +436,11 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr { Song* pSong = SONGMAN->m_pSongs[i]; + if( !bRoulette && !pSong->NormallyDisplayed() ) + continue; + if( bRoulette && !pSong->RouletteDisplayed() ) + continue; + CArray arraySteps; pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, arraySteps ); diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 2bcf1028af..e6ff10898f 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -49,6 +49,9 @@ PrefsManager::PrefsManager() m_iMovieDecodeMS = 2; m_bUseBGIfNoBanner = false; m_bDelayedEscape = true; + /* I'd rather get occasional people asking for support for this even though it's + * already here than lots of people asking why songs aren't being displayed. */ + m_bHiddenSongs = false; ReadGlobalPrefsFromDisk( true ); } @@ -85,6 +88,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueI( "Options", "MovieDecodeMS", m_iMovieDecodeMS ); ini.GetValueB( "Options", "UseBGIfNoBanner", m_bUseBGIfNoBanner ); ini.GetValueB( "Options", "DelayedEscape", m_bDelayedEscape ); + ini.GetValueB( "Options", "HiddenSongs", m_bHiddenSongs ); m_asAdditionalSongFolders.RemoveAll(); CString sAdditionalSongFolders; @@ -124,6 +128,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValueI( "Options", "MovieDecodeMS", m_iMovieDecodeMS ); ini.SetValueB( "Options", "UseBGIfNoBanner", m_bUseBGIfNoBanner ); ini.SetValueB( "Options", "DelayedEscape", m_bDelayedEscape ); + ini.SetValueB( "Options", "HiddenSongs", m_bHiddenSongs ); ini.SetValue( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 4171689c74..06646a9873 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -36,6 +36,7 @@ public: float m_fBGBrightness; int m_iMovieDecodeMS; bool m_bUseBGIfNoBanner; + bool m_bHiddenSongs; bool m_bIgnoreJoyAxes; bool m_bOnlyDedicatedMenuButtons; diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 18af6b86f0..a1d042c099 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -74,8 +74,11 @@ ScreenSelectGroup::ScreenSelectGroup() NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType; for( i=aAllSongs.GetSize()-1; i>=0; i-- ) // foreach Song, back to front { - if( !aAllSongs[i]->SongHasNotesType(nt) ) - aAllSongs.RemoveAt( i ); + if( aAllSongs[i]->SongHasNotesType(nt) && + aAllSongs[i]->NormallyDisplayed() ) + continue; + + aAllSongs.RemoveAt( i ); } } diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index df0acb0b41..1e9e2ae576 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -22,6 +22,7 @@ #include "RageException.h" #include "SongCacheIndex.h" #include "GameManager.h" +#include "PrefsManager.h" const int FILE_CACHE_VERSION = 64; // increment this when Song or Notes changes to invalidate cache @@ -107,6 +108,7 @@ Song::Song() m_fMusicLengthSeconds = 0; m_fFirstBeat = -1; m_fLastBeat = -1; + m_SelectionDisplay = SHOW_ALWAYS; } Song::~Song() @@ -853,6 +855,18 @@ bool Song::LoadFromSMFile( CString sPath ) else if( 0==stricmp(sValueName,"OFFSET") ) m_fBeat0OffsetInSeconds = (float)atof( sParams[1] ); + else if( 0==stricmp(sValueName,"SELECTABLE") ) + { + if(!stricmp(sParams[1],"YES")) + m_SelectionDisplay = SHOW_ALWAYS; + else if(!stricmp(sParams[1],"NO")) + m_SelectionDisplay = SHOW_NEVER; + else if(!stricmp(sParams[1],"ROULETTE")) + m_SelectionDisplay = SHOW_ROULETTE; + else + LOG->Warn( "The song file '%s' has an unknown #SELECTABLE value, \"%s\"; ignored.", sPath, sParams[1]); + } + else if( 0==stricmp(sValueName,"STOPS") || 0==stricmp(sValueName,"FREEZES") ) { CStringArray arrayFreezeExpressions; @@ -1299,6 +1313,17 @@ void Song::SaveToSMFile( CString sPath, bool bSavingCache ) fprintf( fp, "#OFFSET:%.2f;\n", m_fBeat0OffsetInSeconds ); fprintf( fp, "#SAMPLESTART:%.2f;\n", m_fMusicSampleStartSeconds ); fprintf( fp, "#SAMPLELENGTH:%.2f;\n", m_fMusicSampleLengthSeconds ); + fprintf( fp, "#SELECTABLE:" ); + switch(m_SelectionDisplay) { + default: ASSERT(0); /* fallthrough */ + case SHOW_ALWAYS: + fprintf( fp, "YES" ); break; + case SHOW_NEVER: + fprintf( fp, "NO" ); break; + case SHOW_ROULETTE: + fprintf( fp, "ROULETTE" ); break; + } + fprintf( fp, ";\n" ); fprintf( fp, "#BPMS:" ); for( i=0; i &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByMostPlayed ); } + +bool Song::NormallyDisplayed() const +{ + if(!PREFSMAN->m_bHiddenSongs) return true; + return m_SelectionDisplay == SHOW_ALWAYS; +} + +bool Song::RouletteDisplayed() const +{ + if(!PREFSMAN->m_bHiddenSongs) return true; + return m_SelectionDisplay != SHOW_NEVER; +} diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 2c443fb775..3d49dcb086 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -44,6 +44,11 @@ struct BackgroundChange class Song { + /* Set when this song should be displayed in the music wheel: */ + enum { SHOW_ALWAYS, /* all the time */ + SHOW_ROULETTE, /* only when rouletting */ + SHOW_NEVER } /* never (unless song hiding is turned off) */ + m_SelectionDisplay; public: Song(); ~Song(); @@ -184,6 +189,8 @@ public: bool IsNew() const; bool IsEasy( NotesType nt ) const; Grade GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ) const; + bool NormallyDisplayed() const; + bool RouletteDisplayed() const; };