"GroupName" -> "SongGroup" to make room for CourseGroup
replace checks for "cvs" with a call to StripCvs()
m_Rows -> m_pRows
broadcast on preferred group changes
This commit is contained in:
Chris Danford
2005-06-23 08:05:09 +00:00
parent f881b0bf4d
commit 2a6dcba6e8
33 changed files with 212 additions and 190 deletions
+2 -4
View File
@@ -19,11 +19,9 @@ void AnnouncerManager::GetAnnouncerNames( CStringArray& AddTo )
{
GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true );
// strip out the folder called "CVS" and EMPTY_ANNOUNCER_NAME
for( int i=AddTo.size()-1; i>=0; i-- )
if( !stricmp( AddTo[i], "cvs" ) )
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
StripCvs( AddTo );
// strip out the empty announcer folder
for( int i=AddTo.size()-1; i>=0; i-- )
if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) )
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
+2 -2
View File
@@ -100,9 +100,9 @@ void Banner::LoadMode()
m_bScrolling = false;
}
void Banner::LoadFromGroup( CString sGroupName )
void Banner::LoadFromSongGroup( CString sSongGroup )
{
CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
CString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
if( sGroupBannerPath != "" ) Load( sGroupBannerPath );
else LoadFallback();
m_bScrolling = false;
+1 -1
View File
@@ -22,7 +22,7 @@ public:
void LoadFromSong( Song* pSong ); // NULL means no song
void LoadAllMusic();
void LoadMode();
void LoadFromGroup( CString sGroupName );
void LoadFromSongGroup( CString sSongGroup );
void LoadFromCourse( Course* pCourse );
void LoadCardFromCharacter( Character* pCharacter );
void LoadIconFromCharacter( Character* pCharacter );
+1 -1
View File
@@ -60,7 +60,7 @@ void SaveCatalogXml( LoadingWindow *loading_window )
int iTotalSongs = 0;
int iTotalSteps = 0;
vector<CString> vsGroups;
SONGMAN->GetGroupNames( vsGroups );
SONGMAN->GetSongGroupNames( vsGroups );
FOREACH_CONST( CString, vsGroups, sGroup )
{
XNode* p1 = pNumSongsByGroup->AppendChild( "Group" );
+5 -3
View File
@@ -242,7 +242,7 @@ void Course::LoadFromCRSFile( CString sPath )
LOG->Warn( "Course file '%s' contains a random_within_group entry '%s' that is invalid. "
"Song should be in the format '<group>/*'.",
sPath.c_str(), sSong.c_str());
if( !SONGMAN->DoesGroupExist(new_entry.group_name) )
if( !SONGMAN->DoesSongGroupExist(new_entry.group_name) )
{
/* XXX: We need a place to put "user warnings". This is too loud for info.txt--
* it obscures important warnings--and regular users never look there, anyway. */
@@ -545,9 +545,11 @@ void Course::AutogenEndlessFromGroup( CString sGroupName, Difficulty diff )
{
m_sMainTitle = "All Songs";
// m_sBannerPath = ""; // XXX
} else {
}
else
{
m_sMainTitle = SONGMAN->ShortenGroupName( sGroupName );
m_sBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
m_sBannerPath = SONGMAN->GetSongGroupBannerPath( sGroupName );
}
// We want multiple songs, so we can try to prevent repeats during
+1 -1
View File
@@ -57,7 +57,7 @@ EditCoursesSongMenu::EditCoursesSongMenu()
m_soundChangeValue.Load( THEME->GetPathS("EditCoursesSongMenu","value") );
// fill in data structures
SONGMAN->GetGroupNames( m_aGroups );
SONGMAN->GetSongGroupNames( m_aGroups );
m_SelectedRow = (Row)0;
}
+2 -2
View File
@@ -79,7 +79,7 @@ static void GetSongsToShowForGroup( const CString &sGroup, vector<Song*> &vpSong
static void GetGroupsToShow( vector<CString> &vsGroupsOut )
{
vsGroupsOut.clear();
SONGMAN->GetGroupNames( vsGroupsOut );
SONGMAN->GetSongGroupNames( vsGroupsOut );
for( int i = vsGroupsOut.size()-1; i>=0; i-- )
{
const CString &sGroup = vsGroupsOut[i];
@@ -320,7 +320,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
{
case ROW_GROUP:
m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
m_GroupBanner.LoadFromGroup( GetSelectedGroup() );
m_GroupBanner.LoadFromSongGroup( GetSelectedGroup() );
m_GroupBanner.ScaleToClipped( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT );
m_pSongs.clear();
GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs );
+2 -2
View File
@@ -178,9 +178,9 @@ void FadingBanner::LoadMode()
m_Banner[m_iIndexLatest].LoadMode();
}
void FadingBanner::LoadFromGroup( CString sGroupName )
void FadingBanner::LoadFromSongGroup( CString sSongGroup )
{
const CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
const CString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
LoadFromCachedBanner( sGroupBannerPath );
}
+1 -1
View File
@@ -20,7 +20,7 @@ public:
void LoadFromSong( const Song* pSong ); // NULL means no song
void LoadAllMusic();
void LoadMode();
void LoadFromGroup( CString sGroupName );
void LoadFromSongGroup( CString sSongGroup );
void LoadFromCourse( const Course* pCourse );
void LoadRoulette();
void LoadRandom();
+1 -1
View File
@@ -761,7 +761,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
for( map<CString,CString>::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++ )
GAMESTATE->m_mapEnv[ i->first ] = i->second;
if( !m_sSongGroup.empty() )
GAMESTATE->m_sPreferredSongGroup = m_sSongGroup;
GAMESTATE->m_sPreferredSongGroup.Set( m_sSongGroup );
if( m_SortOrder != SORT_INVALID )
GAMESTATE->m_PreferredSortOrder = m_SortOrder;
if( m_iUnlockIndex != -1 )
+8 -6
View File
@@ -64,8 +64,10 @@ Song* GetDefaultSong()
GameState::GameState() :
m_pCurStyle( MESSAGE_CURRENT_STYLE_CHANGED ),
m_PreferredCourseDifficulty( MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P1_CHANGED ),
m_PreferredDifficulty( MESSAGE_EDIT_PREFERRED_DIFFICULTY_P1_CHANGED ),
m_sPreferredSongGroup( MESSAGE_PREFERRED_SONG_GROUP_CHANGED ),
m_sPreferredCourseGroup(MESSAGE_PREFERRED_COURSE_GROUP_CHANGED ),
m_PreferredCourseDifficulty( MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P1_CHANGED ),
m_PreferredDifficulty( MESSAGE_EDIT_PREFERRED_DIFFICULTY_P1_CHANGED ),
m_pCurSong( MESSAGE_CURRENT_SONG_CHANGED ),
m_pCurSteps( MESSAGE_CURRENT_STEPS_P1_CHANGED ),
m_pCurCourse( MESSAGE_CURRENT_COURSE_CHANGED ),
@@ -167,7 +169,8 @@ void GameState::Reset()
// m_iCoins = 0; // don't reset coin count!
m_MasterPlayerNumber = PLAYER_INVALID;
m_mapEnv.clear();
m_sPreferredSongGroup = GROUP_ALL_MUSIC;
m_sPreferredSongGroup.Set( GROUP_ALL_MUSIC );
m_sPreferredCourseGroup.Set( "" );
m_bChangedFailTypeOnScreenSongOptions = false;
FOREACH_PlayerNumber( p )
{
@@ -610,6 +613,8 @@ void GameState::ReloadCharacters()
CStringArray as;
GetDirListing( CHARACTERS_DIR "*", as, true, true );
StripCvs( as );
bool FoundDefault = false;
for( unsigned i=0; i<as.size(); i++ )
{
@@ -617,9 +622,6 @@ void GameState::ReloadCharacters()
splitpath(as[i], sDummy, sCharName, sDummy);
sCharName.MakeLower();
if( sCharName == "cvs" ) // the directory called "CVS"
continue; // ignore it
if( sCharName.CompareNoCase("default")==0 )
FoundDefault = true;
+2 -1
View File
@@ -101,7 +101,8 @@ public:
bool ShowMarvelous() const;
CString m_sLoadingMessage; // used in loading screen
CString m_sPreferredSongGroup; // GROUP_ALL_MUSIC denotes no preferred group
BroadcastOnChange<CString> m_sPreferredSongGroup; // GROUP_ALL_MUSIC denotes no preferred group
BroadcastOnChange<CString> m_sPreferredCourseGroup;
bool m_bChangedFailTypeOnScreenSongOptions; // true if FailType was changed in the song options screen
BroadcastOnChange1D<Difficulty,NUM_PLAYERS> m_PreferredDifficulty;
SortOrder m_SortOrder; // set by MusicWheel
+2
View File
@@ -48,6 +48,8 @@ static const CString MessageNames[] = {
"PlayersFinalized",
"AssistTickChanged",
"AutosyncChanged",
"PreferredSongGroupChanged",
"PreferredCourseGroupChanged",
};
XToString( Message, NUM_MESSAGES );
+5 -1
View File
@@ -56,7 +56,9 @@ enum Message
MESSAGE_PLAYERS_FINALIZED,
MESSAGE_ASSIST_TICK_CHANGED,
MESSAGE_AUTOSYNC_CHANGED,
NUM_MESSAGES,
MESSAGE_PREFERRED_SONG_GROUP_CHANGED,
MESSAGE_PREFERRED_COURSE_GROUP_CHANGED,
NUM_MESSAGES, // leave this at the end
MESSAGE_INVALID
};
const CString& MessageToString( Message m );
@@ -96,6 +98,8 @@ public:
const T Get() const { return val; }
void Set( T t ) { val = t; MESSAGEMAN->Broadcast( MessageToString(mSendWhenChanged) ); }
operator T () const { return val; }
bool operator == ( const T &other ) const { return val == other; }
bool operator != ( const T &other ) const { return val != other; }
};
template<class T, int N>
+2 -2
View File
@@ -114,10 +114,10 @@ void MusicWheel::Load( CString sType )
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
// make the preferred group the group of the last song played.
if( GAMESTATE->m_sPreferredSongGroup==GROUP_ALL_MUSIC && !PREFSMAN->m_bPickExtraStage )
if( GAMESTATE->m_sPreferredSongGroup == GROUP_ALL_MUSIC && !PREFSMAN->m_bPickExtraStage )
{
ASSERT(GAMESTATE->m_pCurSong);
GAMESTATE->m_sPreferredSongGroup = GAMESTATE->m_pCurSong->m_sGroupName;
GAMESTATE->m_sPreferredSongGroup.Set( GAMESTATE->m_pCurSong->m_sGroupName );
}
Song* pSong;
+2 -9
View File
@@ -43,10 +43,7 @@ void NoteSkinManager::RefreshNoteSkinData( const Game* pGame )
CStringArray asNoteSkinNames;
GetDirListing( sBaseSkinFolder + "*", asNoteSkinNames, true );
// strip out "CVS"
for( int i=asNoteSkinNames.size()-1; i>=0; i-- )
if( 0 == stricmp("cvs", asNoteSkinNames[i]) )
asNoteSkinNames.erase( asNoteSkinNames.begin()+i, asNoteSkinNames.begin()+i+1 );
StripCvs( asNoteSkinNames );
m_mapNameToData.clear();
for( unsigned j=0; j<asNoteSkinNames.size(); j++ )
@@ -119,11 +116,7 @@ void NoteSkinManager::GetNoteSkinNames( const Game* pGame, CStringArray &AddTo,
{
CString sBaseSkinFolder = NOTESKINS_DIR + pGame->m_szName + "/";
GetDirListing( sBaseSkinFolder + "*", AddTo, true );
// strip out "CVS"
for( int i=AddTo.size()-1; i>=0; i-- )
if( 0 == stricmp("cvs", AddTo[i]) )
AddTo.erase( AddTo.begin()+i, AddTo.begin()+i+1 );
StripCvs( AddTo );
}
/* Move "default" to the front if it exists. */
+4 -4
View File
@@ -412,9 +412,9 @@ public:
defOut.name = "Group";
Default.m_sSongGroup = GROUP_ALL_MUSIC;
vector<CString> vGroups;
SONGMAN->GetGroupNames( vGroups );
ASSERT( vGroups.size() );
vector<CString> vSongGroups;
SONGMAN->GetSongGroupNames( vSongGroups );
ASSERT( vSongGroups.size() );
{
defOut.choices.push_back( "AllGroups" );
@@ -423,7 +423,7 @@ public:
ListEntries.push_back( mc );
}
FOREACH_CONST( CString, vGroups, g )
FOREACH_CONST( CString, vSongGroups, g )
{
defOut.choices.push_back( *g );
GameCommand mc;
+9
View File
@@ -658,6 +658,15 @@ void StripCrnl(CString &s)
s.erase(s.size()-1);
}
void StripCvs( vector<CString> &vs )
{
for( unsigned i=0; i<vs.size(); i++ )
{
if( vs[i].Right(3).CompareNoCase("CVS") == 0 )
vs.erase( vs.begin()+i );
}
}
/* path is a .redir pathname. Read it and return the real one. */
CString DerefRedir(const CString &_path)
{
+2
View File
@@ -309,6 +309,8 @@ void TrimLeft(CString &str, const char *s = "\r\n\t ");
void TrimRight(CString &str, const char *s = "\r\n\t ");
void StripCrnl(CString &s);
void StripCvs( vector<CString> &vs ); // remove all items that end in "cvs"
CString DerefRedir( const CString &sPath );
bool GetFileContents( const CString &sPath, CString &sOut, bool bOneLine = false );
+5 -5
View File
@@ -92,13 +92,13 @@ void ScreenMiniMenu::OnChange( PlayerNumber pn )
vector<PlayerNumber> vpns;
vpns.push_back( GAMESTATE->m_MasterPlayerNumber );
for( unsigned i=0; i<m_Rows.size(); i++ )
for( unsigned i=0; i<m_pRows.size(); i++ )
ExportOptions( i, vpns );
for( unsigned i=0; i<m_Rows.size(); i++ )
for( unsigned i=0; i<m_pRows.size(); i++ )
{
MenuRow &mr = m_vMenuRows[i];
OptionRow &optrow = *m_Rows[i];
OptionRow &optrow = *m_pRows[i];
if( mr.pfnEnabled )
{
optrow.GetRowDef().m_vEnabledForPlayers.clear();
@@ -111,7 +111,7 @@ void ScreenMiniMenu::OnChange( PlayerNumber pn )
void ScreenMiniMenu::ImportOptions( int r, const vector<PlayerNumber> &vpns )
{
OptionRow &optrow = *m_Rows[r];
OptionRow &optrow = *m_pRows[r];
MenuRow &mr = m_vMenuRows[r];
if( !mr.choices.empty() )
optrow.SetOneSharedSelection( mr.iDefaultChoice );
@@ -122,7 +122,7 @@ void ScreenMiniMenu::ExportOptions( int r, const vector<PlayerNumber> &vpns )
if( r == GetCurrentRow() )
s_iLastRowCode = m_vMenuRows[r].iRowCode;
s_viLastAnswers.resize( m_vMenuRows.size() );
s_viLastAnswers[r] = m_Rows[r]->GetOneSharedSelection( true );
s_viLastAnswers[r] = m_pRows[r]->GetOneSharedSelection( true );
}
void ScreenMiniMenu::GoToNextScreen()
+1 -1
View File
@@ -132,7 +132,7 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
}
break;
case PO_SERVER:
switch (m_Rows[GetCurrentRow()]->GetOneSharedSelection())
switch( m_pRows[GetCurrentRow()]->GetOneSharedSelection() )
{
case NO_START_SERVER:
if (!NSMAN->isLanServer)
+52 -52
View File
@@ -130,7 +130,7 @@ void ScreenOptions::Init()
void ScreenOptions::LoadOptionIcon( PlayerNumber pn, int iRow, CString sText )
{
m_Rows[iRow]->LoadOptionIcon( pn, sText );
m_pRows[iRow]->LoadOptionIcon( pn, sText );
}
void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &vDefs, const vector<OptionRowHandler*> &vHands )
@@ -143,8 +143,8 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
for( unsigned r=0; r<vDefs.size(); r++ ) // foreach row
{
m_Rows.push_back( new OptionRow() );
OptionRow &row = *m_Rows.back();
m_pRows.push_back( new OptionRow() );
OptionRow &row = *m_pRows.back();
const OptionRowDefinition &def = vDefs[r];
OptionRowHandler* hand = vHands[r];
@@ -186,17 +186,17 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
m_framePage.AddChild( &m_Cursor[p] );
}
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
for( unsigned r=0; r<m_pRows.size(); r++ ) // foreach row
{
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
m_framePage.AddChild( &row );
}
if( SHOW_EXIT_ROW )
{
// TRICKY: Add "EXIT" item
m_Rows.push_back( new OptionRow() );
OptionRow &row = *m_Rows.back();
m_pRows.push_back( new OptionRow() );
OptionRow &row = *m_pRows.back();
row.LoadMetrics( m_sName );
row.LoadExit();
m_framePage.AddChild( &row );
@@ -254,7 +254,7 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
}
// poke once at all the explanation metrics so that we catch missing ones early
for( int r=0; r<(int)m_Rows.size(); r++ ) // foreach row
for( int r=0; r<(int)m_pRows.size(); r++ ) // foreach row
{
GetExplanationText( r );
}
@@ -262,9 +262,9 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
// put focus on the first enabled row
FOREACH_PlayerNumber( p )
{
for( unsigned r=0; r<m_Rows.size(); r++ )
for( unsigned r=0; r<m_pRows.size(); r++ )
{
const OptionRow &row = *m_Rows[r];
const OptionRow &row = *m_pRows[r];
if( row.GetRowDef().IsEnabledForPlayer(p) )
{
m_iCurrentRow[p] = r;
@@ -296,9 +296,9 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
/* It's tweening into position, but on the initial tween-in we only want to
* tween in the whole page at once. Since the tweens are nontrivial, it's
* easiest to queue the tweens and then force them to finish. */
for( int r=0; r<(int) m_Rows.size(); r++ ) // foreach options line
for( int r=0; r<(int) m_pRows.size(); r++ ) // foreach options line
{
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
row.FinishTweening();
}
@@ -310,13 +310,13 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
ScreenOptions::~ScreenOptions()
{
LOG->Trace( "ScreenOptions::~ScreenOptions()" );
for( unsigned i=0; i<m_Rows.size(); i++ )
SAFE_DELETE( m_Rows[i] );
for( unsigned i=0; i<m_pRows.size(); i++ )
SAFE_DELETE( m_pRows[i] );
}
CString ScreenOptions::GetExplanationText( int iRow ) const
{
OptionRow &row = *m_Rows[iRow];
OptionRow &row = *m_pRows[iRow];
CString sLineName = row.GetRowDef().name;
ASSERT( !sLineName.empty() );
@@ -325,36 +325,36 @@ CString ScreenOptions::GetExplanationText( int iRow ) const
BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow )
{
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
OptionRow &row = *m_Rows[iRow];
ASSERT_M( iRow < (int)m_pRows.size(), ssprintf("%i < %i", iRow, (int)m_pRows.size() ) );
OptionRow &row = *m_pRows[iRow];
return row.GetTextItemForRow( pn, iChoiceOnRow );
}
void ScreenOptions::GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut )
{
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
OptionRow &row = *m_Rows[iRow];
ASSERT_M( iRow < (int)m_pRows.size(), ssprintf("%i < %i", iRow, (int)m_pRows.size() ) );
OptionRow &row = *m_pRows[iRow];
row.GetWidthXY( pn, iChoiceOnRow, iWidthOut, iXOut, iYOut );
}
void ScreenOptions::PositionUnderlines( int r, PlayerNumber pn )
{
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
row.PositionUnderlines( pn );
}
void ScreenOptions::PositionAllUnderlines()
{
for( unsigned r=0; r<m_Rows.size(); r++ )
for( unsigned r=0; r<m_pRows.size(); r++ )
FOREACH_HumanPlayer( p )
PositionUnderlines( r, p );
}
void ScreenOptions::PositionIcons()
{
for( unsigned i=0; i<m_Rows.size(); i++ ) // foreach options line
for( unsigned i=0; i<m_pRows.size(); i++ ) // foreach options line
{
OptionRow &row = *m_Rows[i];
OptionRow &row = *m_pRows[i];
row.PositionIcons();
continue;
}
@@ -368,7 +368,7 @@ void ScreenOptions::RefreshIcons( int row, PlayerNumber pn )
void ScreenOptions::RefreshAllIcons()
{
FOREACH_HumanPlayer( p )
for( unsigned r=0; r<m_Rows.size(); ++r )
for( unsigned r=0; r<m_pRows.size(); ++r )
this->RefreshIcons( r, p );
}
@@ -382,8 +382,8 @@ void ScreenOptions::PositionCursors()
if( iRow == -1 )
continue;
ASSERT_M( iRow >= 0 && iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
OptionRow &OptionRow = *m_Rows[iRow];
ASSERT_M( iRow >= 0 && iRow < (int)m_pRows.size(), ssprintf("%i < %i", iRow, (int)m_pRows.size() ) );
OptionRow &OptionRow = *m_pRows[iRow];
OptionsCursor &cursor = m_Cursor[pn];
const int iChoiceWithFocus = OptionRow.GetChoiceInRowWithFocus(pn);
@@ -401,9 +401,9 @@ void ScreenOptions::TweenCursor( PlayerNumber pn )
{
// Set the position of the cursor showing the current option the user is changing.
const int iRow = m_iCurrentRow[pn];
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
ASSERT_M( iRow < (int)m_pRows.size(), ssprintf("%i < %i", iRow, (int)m_pRows.size() ) );
const OptionRow &row = *m_Rows[iRow];
const OptionRow &row = *m_pRows[iRow];
const int iChoiceWithFocus = row.GetChoiceInRowWithFocus(pn);
int iWidth, iX, iY;
@@ -436,13 +436,13 @@ void ScreenOptions::TweenCursor( PlayerNumber pn )
* Update the whole row. */
void ScreenOptions::UpdateText( int iRow )
{
OptionRow &row = *m_Rows[iRow];
OptionRow &row = *m_pRows[iRow];
row.UpdateText();
}
void ScreenOptions::UpdateEnabledDisabled( int r )
{
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
bool bRowHasFocus[NUM_PLAYERS];
FOREACH_PlayerNumber( pn )
@@ -454,7 +454,7 @@ void ScreenOptions::UpdateEnabledDisabled( int r )
void ScreenOptions::UpdateEnabledDisabled()
{
for( unsigned r=0; r<m_Rows.size(); r++ )
for( unsigned r=0; r<m_pRows.size(); r++ )
UpdateEnabledDisabled( r );
}
@@ -512,7 +512,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
this->GoToPrevScreen();
break;
case SM_GoToNextScreen:
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
for( unsigned r=0; r<m_pRows.size(); r++ ) // foreach row
{
vector<PlayerNumber> vpns;
FOREACH_HumanPlayer( p )
@@ -551,7 +551,7 @@ void ScreenOptions::PositionItems()
int P1Choice = GAMESTATE->IsHumanPlayer(PLAYER_1)? m_iCurrentRow[PLAYER_1]: m_iCurrentRow[PLAYER_2];
int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? m_iCurrentRow[PLAYER_2]: m_iCurrentRow[PLAYER_1];
vector<OptionRow*> Rows( m_Rows );
vector<OptionRow*> Rows( m_pRows );
OptionRow *ExitRow = NULL;
if( (bool)SEPARATE_EXIT_ROW && Rows.back()->GetRowType() == OptionRow::ROW_EXIT )
@@ -670,14 +670,14 @@ void ScreenOptions::OnChange( PlayerNumber pn )
if( SHOW_SCROLL_BAR )
{
float fPercent = 0;
if( m_Rows.size() > 1 )
fPercent = m_iCurrentRow[pn] / float(m_Rows.size()-1);
if( m_pRows.size() > 1 )
fPercent = m_iCurrentRow[pn] / float(m_pRows.size()-1);
m_ScrollBar.SetPercentage( pn, fPercent );
}
/* If the last row is EXIT, and is hidden, then show MORE. */
const bool ShowMore = m_Rows.back()->GetRowType() == OptionRow::ROW_EXIT && m_Rows.back()->GetRowHidden();
const bool ShowMore = m_pRows.back()->GetRowType() == OptionRow::ROW_EXIT && m_pRows.back()->GetRowHidden();
if( m_bMoreShown != ShowMore )
{
m_bMoreShown = ShowMore;
@@ -691,7 +691,7 @@ void ScreenOptions::OnChange( PlayerNumber pn )
TweenCursor( p );
int iCurrentRow = m_iCurrentRow[pn];
OptionRow &row = *m_Rows[iCurrentRow];
OptionRow &row = *m_pRows[iCurrentRow];
const bool ExitSelected = row.GetRowType() == OptionRow::ROW_EXIT;
if( p == pn || GAMESTATE->GetNumHumanPlayers() == 1 )
{
@@ -740,7 +740,7 @@ void ScreenOptions::MenuBack( PlayerNumber pn )
bool ScreenOptions::IsOnLastRow( PlayerNumber pn ) const
{
int iCurRow = m_iCurrentRow[pn];
return iCurRow == (int)(m_Rows.size()-1);
return iCurRow == (int)(m_pRows.size()-1);
}
bool ScreenOptions::AllAreOnLastRow() const
@@ -769,7 +769,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
}
int iCurRow = m_iCurrentRow[pn];
OptionRow &row = *m_Rows[iCurRow];
OptionRow &row = *m_pRows[iCurRow];
/* If we are in a three-button mode, check to see if MENU_BUTTON_LEFT and
@@ -851,7 +851,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
{
case NAV_THREE_KEY:
// don't wrap
if( iCurRow == (int)m_Rows.size()-1 )
if( iCurRow == (int)m_pRows.size()-1 )
return;
MenuDown( pn, type );
break;
@@ -878,7 +878,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
case NAV_FIVE_KEY:
/* Jump to the exit row. (If everyone's already on the exit row, then
* we'll have already gone to the next screen above.) */
MoveRow( pn, m_Rows.size()-m_iCurrentRow[pn]-1, type != IET_FIRST_PRESS );
MoveRow( pn, m_pRows.size()-m_iCurrentRow[pn]-1, type != IET_FIRST_PRESS );
break;
}
}
@@ -888,7 +888,7 @@ void ScreenOptions::StoreFocus( PlayerNumber pn )
{
/* Long rows always put us in the center, so don't update the focus. */
int iCurrentRow = m_iCurrentRow[pn];
const OptionRow &row = *m_Rows[iCurrentRow];
const OptionRow &row = *m_pRows[iCurrentRow];
if( row.GetRowDef().layoutType == LAYOUT_SHOW_ONE_IN_ROW )
return;
@@ -905,7 +905,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
if( iCurRow == -1 ) // no row selected
return; // don't allow a move
OptionRow &row = *m_Rows[iCurRow];
OptionRow &row = *m_pRows[iCurRow];
const int iNumChoices = row.GetRowDef().choices.size();
@@ -1018,7 +1018,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
{
const int iCurrentRow = m_iCurrentRow[pn];
OptionRow &row = *m_Rows[iCurrentRow];
OptionRow &row = *m_pRows[iCurrentRow];
if( row.GetFirstItemGoesDown() )
{
@@ -1035,19 +1035,19 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
continue; // skip
int r = m_iCurrentRow[p] + dir;
if( Repeat && ( r == -1 || r == (int) m_Rows.size() ) )
if( Repeat && ( r == -1 || r == (int) m_pRows.size() ) )
continue; // don't wrap while repeating
wrap( r, m_Rows.size() );
wrap( r, m_pRows.size() );
const unsigned iOldSelection = row.GetChoiceInRowWithFocus(p);
if( m_iCurrentRow[p] == r )
continue;
m_iCurrentRow[p] = r;
ASSERT( r >= 0 && r < (int)m_Rows.size() );
ASSERT( r >= 0 && r < (int)m_pRows.size() );
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
switch( m_OptionsNavigation )
{
@@ -1123,20 +1123,20 @@ void ScreenOptions::MenuUpDown( PlayerNumber pn, const InputEventType type, int
bool bRepeat = type != IET_FIRST_PRESS;
int iDest = -1;
for( int r=1; r<(int)m_Rows.size(); r++ )
for( int r=1; r<(int)m_pRows.size(); r++ )
{
int iDelta = r*iDir;
iDest = m_iCurrentRow[pn] + iDelta;
int iOldDest = iDest;
ASSERT( m_Rows.size() );
wrap( iDest, m_Rows.size() );
ASSERT( m_pRows.size() );
wrap( iDest, m_pRows.size() );
// Don't wrap on repeating inputs.
bool bWrapped = iOldDest != iDest;
if( bRepeat && bWrapped )
return;
OptionRow &row = *m_Rows[iDest];
OptionRow &row = *m_pRows[iDest];
if( row.GetRowDef().IsEnabledForPlayer(pn) )
{
+1 -1
View File
@@ -83,7 +83,7 @@ protected: // derived classes need access to these
protected:
/* Map menu lines to m_OptionRow entries. */
vector<OptionRow*> m_Rows;
vector<OptionRow*> m_pRows;
Navigation m_OptionsNavigation;
+6 -6
View File
@@ -99,7 +99,7 @@ void ScreenOptionsMaster::Init()
ScreenOptionsMaster::~ScreenOptionsMaster()
{
FOREACH( OptionRow*, m_Rows, r )
FOREACH( OptionRow*, m_pRows, r )
(*r)->DetachHandler();
FOREACH( OptionRowHandler*, OptionRowHandlers, h )
SAFE_DELETE( *h );
@@ -110,13 +110,13 @@ void ScreenOptionsMaster::ImportOptions( int r, const vector<PlayerNumber> &vpns
{
FOREACH_CONST( PlayerNumber, vpns, pn )
ASSERT( GAMESTATE->IsHumanPlayer(*pn) );
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
row.ImportOptions( vpns );
}
void ScreenOptionsMaster::ExportOptions( int r, const vector<PlayerNumber> &vpns )
{
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
bool bRowHasFocus[NUM_PLAYERS];
ZERO( bRowHasFocus );
FOREACH_CONST( PlayerNumber, vpns, p )
@@ -134,8 +134,8 @@ void ScreenOptionsMaster::BeginFadingOut()
m_bExportWillSetANewScreen = false;
int iCurRow = this->GetCurrentRow();
ASSERT( iCurRow >= 0 && iCurRow < (int)m_Rows.size() );
OptionRow &row = *m_Rows[iCurRow];
ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() );
OptionRow &row = *m_pRows[iCurRow];
if( row.GetRowType() != OptionRow::ROW_EXIT )
{
@@ -181,7 +181,7 @@ void ScreenOptionsMaster::GoToPrevScreen()
void ScreenOptionsMaster::RefreshIcons( int r, PlayerNumber pn )
{
OptionRow &row = *m_Rows[r];
OptionRow &row = *m_pRows[r];
if( row.GetRowType() == OptionRow::ROW_EXIT )
return; // skip
+3 -3
View File
@@ -67,8 +67,8 @@ void ScreenPlayerOptions::Init()
FOREACH_HumanPlayer( p )
{
m_bRowCausesDisqualified[p].resize( m_Rows.size(), false );
for( unsigned r=0; r<m_Rows.size(); r++ )
m_bRowCausesDisqualified[p].resize( m_pRows.size(), false );
for( unsigned r=0; r<m_pRows.size(); r++ )
UpdateDisqualified( r, p );
}
}
@@ -146,7 +146,7 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
COMMAND( m_sprCancelAll[pn], "Show" );
for( unsigned r=0; r<m_Rows.size(); r++ )
for( unsigned r=0; r<m_pRows.size(); r++ )
{
vector<PlayerNumber> v;
v.push_back( pn );
+5 -5
View File
@@ -100,7 +100,7 @@ void ScreenProfileOptions::ImportOptions( int row, const vector<PlayerNumber> &v
vsProfiles.end(),
PREFSMAN->GetDefaultLocalProfileID(pn).Get() );
if( iter != vsProfiles.end() )
m_Rows[row]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
m_pRows[row]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
}
break;
}
@@ -117,8 +117,8 @@ void ScreenProfileOptions::ExportOptions( int row, const vector<PlayerNumber> &v
vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
if( m_Rows[row]->GetOneSharedSelection() > 0 )
PREFSMAN->GetDefaultLocalProfileID(pn).Set( vsProfiles[m_Rows[row]->GetOneSharedSelection()-1] );
if( m_pRows[row]->GetOneSharedSelection() > 0 )
PREFSMAN->GetDefaultLocalProfileID(pn).Set( vsProfiles[m_pRows[row]->GetOneSharedSelection()-1] );
else
PREFSMAN->GetDefaultLocalProfileID(pn).Set( "" );
}
@@ -222,7 +222,7 @@ CString ScreenProfileOptions::GetSelectedProfileID()
vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
const OptionRow &row = *m_Rows[GetCurrentRow()];
const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection();
if( !Selection )
return "";
@@ -231,7 +231,7 @@ CString ScreenProfileOptions::GetSelectedProfileID()
CString ScreenProfileOptions::GetSelectedProfileName()
{
const OptionRow &row = *m_Rows[GetCurrentRow()];
const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection();
if( !Selection )
return "";
+5 -5
View File
@@ -52,7 +52,7 @@ void ScreenSMOnlineLogin::Init()
InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions", "music"));
OptionRow &row = *m_Rows.back();
OptionRow &row = *m_pRows.back();
row.SetExitText("Login");
}
}
@@ -72,7 +72,7 @@ void ScreenSMOnlineLogin::ImportOptions( int row, const vector<PlayerNumber> &vp
{
iter = find(vsProfiles.begin(), vsProfiles.end(), PREFSMAN->GetDefaultLocalProfileID(pn).Get() );
if( iter != vsProfiles.end() )
m_Rows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin());
m_pRows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin());
}
}
break;
@@ -89,7 +89,7 @@ void ScreenSMOnlineLogin::ExportOptions( int row, const vector<PlayerNumber> &vp
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
FOREACH_EnabledPlayer( pn )
PREFSMAN->GetDefaultLocalProfileID(pn).Set( vsProfiles[m_Rows[0]->GetOneSelection(pn)] );
PREFSMAN->GetDefaultLocalProfileID(pn).Set( vsProfiles[m_pRows[0]->GetOneSelection(pn)] );
}
break;
}
@@ -104,7 +104,7 @@ void ScreenSMOnlineLogin::GoToNextScreen()
{
vector<PlayerNumber> v;
v.push_back( GAMESTATE->m_MasterPlayerNumber );
for( unsigned r=0; r<m_Rows.size(); r++ )
for( unsigned r=0; r<m_pRows.size(); r++ )
ExportOptions( r, v );
PREFSMAN->SaveGlobalPrefsToDisk();
@@ -172,7 +172,7 @@ CString ScreenSMOnlineLogin::GetSelectedProfileID()
vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
const OptionRow &row = *m_Rows[GetCurrentRow()];
const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection();
if( !Selection )
return "";
+3 -3
View File
@@ -32,7 +32,7 @@ void ScreenSelectGroup::Init()
{
if( !PREFSMAN->m_bShowSelectGroup )
{
GAMESTATE->m_sPreferredSongGroup = GROUP_ALL_MUSIC;
GAMESTATE->m_sPreferredSongGroup.Set( GROUP_ALL_MUSIC );
HandleScreenMessage( SM_GoToNextScreen );
return;
}
@@ -172,7 +172,7 @@ void ScreenSelectGroup::AfterChange()
if( sSelectedGroupName == "ALL MUSIC" )
m_Banner.LoadAllMusic();
else
m_Banner.LoadFromGroup( sSelectedGroupName );
m_Banner.LoadFromSongGroup( sSelectedGroupName );
const int iNumSongs = m_MusicList.GetNumSongs();
m_textNumber.SetText( ssprintf("%d", iNumSongs) );
@@ -224,7 +224,7 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn )
m_bChosen = true;
GAMESTATE->m_pCurSong.Set( NULL );
GAMESTATE->m_sPreferredSongGroup = (m_GroupList.GetSelectionName()=="ALL MUSIC" ? GROUP_ALL_MUSIC : m_GroupList.GetSelectionName() );
GAMESTATE->m_sPreferredSongGroup.Set( m_GroupList.GetSelectionName()=="ALL MUSIC" ? GROUP_ALL_MUSIC : m_GroupList.GetSelectionName() );
if( GAMESTATE->m_sPreferredSongGroup == GROUP_ALL_MUSIC )
SOUND->PlayOnceFromAnnouncer( "select group comment all music" );
+1 -1
View File
@@ -1582,7 +1582,7 @@ void ScreenSelectMusic::AfterMusicChange()
switch( m_MusicWheel.GetSelectedType() )
{
case TYPE_SECTION:
g_sBannerPath = SONGMAN->GetGroupBannerPath( sGroup );
g_sBannerPath = SONGMAN->GetSongGroupBannerPath( sGroup );
m_sSampleMusicToPlay = m_sSectionMusicPath;
break;
case TYPE_SORT:
+1 -1
View File
@@ -70,7 +70,7 @@ void ScreenTitleMenu::Init()
m_textSongs.LoadFromFont( THEME->GetPathF("Common","normal") );
m_textSongs.SetName( "Songs" );
CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() );
CString text = ssprintf("%d songs in %d groups, %d courses in %d groups", SONGMAN->GetNumSongs(), SONGMAN->GetNumSongGroups(), SONGMAN->GetNumCourses(), SONGMAN->GetNumCourseGroups() );
if( PREFSMAN->m_bUseUnlockSystem )
text += ssprintf(", %d unlocks", UNLOCKMAN->GetNumUnlocks() );
m_textSongs.SetText( text );
+64 -51
View File
@@ -171,19 +171,18 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
CStringArray arrayGroupDirs;
GetDirListing( sDir+"*", arrayGroupDirs, true );
SortCStringArray( arrayGroupDirs );
StripCvs( arrayGroupDirs );
for( unsigned i=0; i< arrayGroupDirs.size(); i++ ) // for each dir in /Songs/
FOREACH_CONST( CString, arrayGroupDirs, s ) // foreach dir in /Songs/
{
CString sGroupDirName = arrayGroupDirs[i];
if( 0 == stricmp( sGroupDirName, "cvs" ) ) // the directory called "CVS"
continue; // ignore it
CString sGroupDirName = *s;
SanityCheckGroupDir(sDir+sGroupDirName);
// Find all Song folders in this group directory
CStringArray arraySongDirs;
GetDirListing( sDir+sGroupDirName + "/*", arraySongDirs, true, true );
StripCvs( arraySongDirs );
SortCStringArray( arraySongDirs );
LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()),
@@ -194,9 +193,6 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
{
CString sSongDirName = arraySongDirs[j];
if( 0 == stricmp( Basename(sSongDirName), "cvs" ) ) // the directory called "CVS"
continue; // ignore it
// this is a song directory. Load a new song!
if( ld )
{
@@ -226,7 +222,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
AddGroup(sDir, sGroupDirName);
/* Cache and load the group banner. */
BANNERCACHE->CacheBanner( GetGroupBannerPath(sGroupDirName) );
BANNERCACHE->CacheBanner( GetSongGroupBannerPath(sGroupDirName) );
/* Load the group sym links (if any)*/
LoadGroupSymLinks(sDir, sGroupDirName);
@@ -312,44 +308,38 @@ void SongManager::FreeSongs()
m_pShuffledSongs.clear();
}
CString SongManager::GetGroupBannerPath( CString sGroupName )
CString SongManager::GetSongGroupBannerPath( CString sSongGroup )
{
unsigned i;
for(i = 0; i < m_sSongGroupNames.size(); ++i)
if( sGroupName == m_sSongGroupNames[i] ) break;
for( unsigned i = 0; i < m_sSongGroupNames.size(); ++i )
{
if( sSongGroup == m_sSongGroupNames[i] )
return m_sSongGroupBannerPaths[i];
}
if( i == m_sSongGroupNames.size() )
return "";
return m_sSongGroupBannerPaths[i];
ASSERT_M( 0, ssprintf("requested banner for song group '%s' that doesn't exist",sSongGroup.c_str()) );
return "";
}
void SongManager::GetGroupNames( CStringArray &AddTo )
void SongManager::GetSongGroupNames( CStringArray &AddTo )
{
AddTo.insert(AddTo.end(), m_sSongGroupNames.begin(), m_sSongGroupNames.end() );
}
bool SongManager::DoesGroupExist( CString sGroupName )
bool SongManager::DoesSongGroupExist( CString sSongGroup )
{
for( unsigned i = 0; i < m_sSongGroupNames.size(); ++i )
if( !m_sSongGroupNames[i].CompareNoCase(sGroupName) )
return true;
return false;
return find( m_sSongGroupNames.begin(), m_sSongGroupNames.end(), sSongGroup ) != m_sSongGroupNames.end();
}
RageColor SongManager::GetSongGroupColor( const CString &sSongGroupName )
RageColor SongManager::GetSongGroupColor( const CString &sSongGroup )
{
// search for the group index
unsigned i;
for( i=0; i<m_sSongGroupNames.size(); i++ )
for( unsigned i=0; i<m_sSongGroupNames.size(); i++ )
{
if( m_sSongGroupNames[i] == sSongGroupName )
break;
if( m_sSongGroupNames[i] == sSongGroup )
return SONG_GROUP_COLOR.GetValue( i%NUM_SONG_GROUP_COLORS ); // TODO: Add course group colors?
}
ASSERT_M( i != m_sSongGroupNames.size(), sSongGroupName ); // this is not a valid group
return SONG_GROUP_COLOR.GetValue( i%NUM_SONG_GROUP_COLORS );
ASSERT_M( 0, ssprintf("requested color for song group '%s' that doesn't exist",sSongGroup.c_str()) );
return RageColor(1,1,1,1);
}
RageColor SongManager::GetSongColor( const Song* pSong )
@@ -390,17 +380,38 @@ RageColor SongManager::GetSongColor( const Song* pSong )
return GetSongGroupColor( pSong->m_sGroupName );
}
RageColor SongManager::GetCourseGroupColor( const CString &sCourseGroupName )
CString SongManager::GetCourseGroupBannerPath( CString sCourseGroup )
{
// search for the group index
unsigned i;
for( i=0; i<m_sCourseGroupNames.size(); i++ )
for( unsigned i = 0; i < m_sCourseGroupNames.size(); ++i )
{
if( m_sCourseGroupNames[i] == sCourseGroupName )
break;
if( sCourseGroup == m_sCourseGroupNames[i] )
return m_sCourseGroupBannerPaths[i];
}
ASSERT_M( i != m_sCourseGroupNames.size(), "Course: '" + sCourseGroupName + "' is not a valid group." ); // this is not a valid group
return COURSE_GROUP_COLOR.GetValue( i%NUM_COURSE_GROUP_COLORS.GetValue() );
ASSERT_M( 0, ssprintf("requested banner for course group '%s' that doesn't exist",sCourseGroup.c_str()) );
return "";
}
void SongManager::GetCourseGroupNames( CStringArray &AddTo )
{
AddTo.insert(AddTo.end(), m_sCourseGroupNames.begin(), m_sCourseGroupNames.end() );
}
bool SongManager::DoesCourseGroupExist( CString sCourseGroup )
{
return find( m_sCourseGroupNames.begin(), m_sCourseGroupNames.end(), sCourseGroup ) != m_sCourseGroupNames.end();
}
RageColor SongManager::GetCourseGroupColor( const CString &sCourseGroup )
{
for( unsigned i=0; i<m_sCourseGroupNames.size(); i++ )
{
if( m_sCourseGroupNames[i] == sCourseGroup )
return SONG_GROUP_COLOR.GetValue( i%NUM_SONG_GROUP_COLORS );
}
ASSERT_M( 0, ssprintf("requested color for course group '%s' that doesn't exist",sCourseGroup.c_str()) );
return RageColor(1,1,1,1);
}
RageColor SongManager::GetCourseColor( const Course* pCourse )
@@ -447,7 +458,7 @@ int SongManager::GetNumSongs() const
return m_pSongs.size();
}
int SongManager::GetNumGroups() const
int SongManager::GetNumSongGroups() const
{
return m_sSongGroupNames.size();
}
@@ -457,6 +468,11 @@ int SongManager::GetNumCourses() const
return m_pCourses.size();
}
int SongManager::GetNumCourseGroups() const
{
return m_sCourseGroupNames.size();
}
CString SongManager::ShortenGroupName( CString sLongGroupName )
{
sLongGroupName.Replace( "Dance Dance Revolution", "DDR" );
@@ -529,22 +545,19 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld )
m_sCourseGroupNames.push_back( "" );
}
// TODO: Search for course group banners if any
FOREACH( CString, m_sCourseGroupNames, s )
m_sCourseGroupBannerPaths.push_back( "" );
// Find all group directories in Courses dir
{
GetDirListing( COURSES_DIR+"*", m_sCourseGroupNames, true );
StripCvs( m_sCourseGroupNames );
SortCStringArray( m_sCourseGroupNames );
FOREACH( CString, m_sCourseGroupNames, sCourseGroup ) // for each dir in /Courses/
{
if( 0 == stricmp( *sCourseGroup, "cvs" ) ) // the directory called "CVS"
{
vector<CString>::iterator eraseme = sCourseGroup;
sCourseGroup--;
m_sCourseGroupNames.erase( eraseme );
continue; // ignore it
}
// Find all CRS files in this group directory
CStringArray vsCoursePaths;
GetDirListing( COURSES_DIR + *sCourseGroup + "/*.crs", vsCoursePaths, false, true );
@@ -574,7 +587,7 @@ void SongManager::InitAutogenCourses()
// Create group courses for Endless and Nonstop
//
CStringArray saGroupNames;
this->GetGroupNames( saGroupNames );
this->GetSongGroupNames( saGroupNames );
Course* pCourse;
for( unsigned g=0; g<saGroupNames.size(); g++ ) // foreach Group
{
+10 -6
View File
@@ -49,14 +49,16 @@ public:
void Reload( LoadingWindow *ld=NULL ); // songs, courses, groups - everything.
void PreloadSongImages();
CString GetGroupBannerPath( CString sGroupName );
void GetGroupNames( CStringArray &AddTo );
bool DoesGroupExist( CString sGroupName );
CString GetSongGroupBannerPath( CString sSongGroup );
void GetSongGroupNames( CStringArray &AddTo );
bool DoesSongGroupExist( CString sSongGroup );
RageColor GetSongGroupColor( const CString &sSongGroupName );
RageColor GetSongColor( const Song* pSong );
RageColor GetDifficultyColor( Difficulty dc ) const;
CString GetCourseGroupBannerPath( CString sCourseGroup );
void GetCourseGroupNames( CStringArray &AddTo );
bool DoesCourseGroupExist( CString sCourseGroup );
RageColor GetCourseGroupColor( const CString &sCourseGroupName );
RageColor GetCourseColor( const Course* pCourse );
@@ -75,8 +77,9 @@ public:
Song *FindSong( CString sPath );
Course *FindCourse( CString sName );
int GetNumSongs() const;
int GetNumGroups() const;
int GetNumSongGroups() const;
int GetNumCourses() const;
int GetNumCourseGroups() const;
Song* GetRandomSong();
Course* GetRandomCourse();
@@ -122,6 +125,7 @@ protected:
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS][NUM_COURSE_TYPES];
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
CStringArray m_sCourseGroupNames;
CStringArray m_sCourseGroupBannerPaths; // each song group may have a banner associated with it
ThemeMetric<int> NUM_SONG_GROUP_COLORS;
+1 -9
View File
@@ -141,15 +141,7 @@ ThemeManager::~ThemeManager()
void ThemeManager::GetThemeNames( CStringArray& AddTo )
{
GetDirListing( THEMES_DIR + "*", AddTo, true );
// strip out the folder called "CVS"
for( CStringArray::iterator i=AddTo.begin(); i != AddTo.end(); ++i )
{
if( *i == "CVS" ) {
AddTo.erase(i, i+1);
break;
}
}
StripCvs( AddTo );
}
bool ThemeManager::DoesThemeExist( const CString &sThemeName )