Add #SELECTABLE:YES, NO and ROULETTE.

Add an option for this.  It's off by default.
This commit is contained in:
Glenn Maynard
2002-08-30 04:28:12 +00:00
parent 92ccf96768
commit 441541a16c
6 changed files with 60 additions and 2 deletions
+5
View File
@@ -436,6 +436,11 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
{
Song* pSong = SONGMAN->m_pSongs[i];
if( !bRoulette && !pSong->NormallyDisplayed() )
continue;
if( bRoulette && !pSong->RouletteDisplayed() )
continue;
CArray<Notes*, Notes*> arraySteps;
pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, arraySteps );
+5
View File
@@ -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) );
+1
View File
@@ -36,6 +36,7 @@ public:
float m_fBGBrightness;
int m_iMovieDecodeMS;
bool m_bUseBGIfNoBanner;
bool m_bHiddenSongs;
bool m_bIgnoreJoyAxes;
bool m_bOnlyDedicatedMenuButtons;
+5 -2
View File
@@ -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 );
}
}
+37
View File
@@ -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<m_BPMSegments.GetSize(); i++ )
@@ -1584,3 +1609,15 @@ void SortSongPointerArrayByMostPlayed( CArray<Song*, Song*> &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;
}
+7
View File
@@ -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;
};