Show banners while MusicWheel is moving fast.

Broke SORT_GROUP into SORT_PREFERRED/SORT_GROUP (like DDREX)
This commit is contained in:
Chris Danford
2003-04-19 18:51:13 +00:00
parent c939d40ae5
commit 1b38fe101c
20 changed files with 197 additions and 86 deletions
+6 -1
View File
@@ -15,6 +15,8 @@
#include "RageBitmapTexture.h" #include "RageBitmapTexture.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "Song.h"
#include "RageTextureManager.h"
Banner::Banner() Banner::Banner()
@@ -22,7 +24,10 @@ Banner::Banner()
m_bScrolling = false; m_bScrolling = false;
m_fPercentScrolling = 0; m_fPercentScrolling = 0;
// LoadFallback(); TEXTUREMAN->CacheTexture( THEME->GetPathToG("Banner all music") );
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Common fallback banner") );
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Banner roulette") );
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Banner random") );
} }
bool Banner::Load( RageTextureID ID ) bool Banner::Load( RageTextureID ID )
+1 -1
View File
@@ -12,7 +12,7 @@
*/ */
#include "CroppedSprite.h" #include "CroppedSprite.h"
#include "song.h" class Song;
class Course; class Course;
+5
View File
@@ -730,3 +730,8 @@ void SortCoursePointerArrayByDifficulty( vector<Course*> &apCourses )
{ {
sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByDifficulty ); sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByDifficulty );
} }
bool Course::HasBanner() const
{
return m_sBannerPath != "" && IsAFile(m_sBannerPath);
}
+3
View File
@@ -47,6 +47,9 @@ public:
bool m_bIsAutogen; // was this created by AutoGen? bool m_bIsAutogen; // was this created by AutoGen?
CString m_sPath; CString m_sPath;
CString m_sName; CString m_sName;
bool HasBanner() const;
CString m_sBannerPath; CString m_sBannerPath;
CString m_sCDTitlePath; CString m_sCDTitlePath;
+1
View File
@@ -17,6 +17,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "GameManager.h" #include "GameManager.h"
#include "Notes.h" #include "Notes.h"
#include "Song.h"
// //
// Defines specific to EditMenu // Defines specific to EditMenu
+62 -22
View File
@@ -13,47 +13,87 @@
#include "FadingBanner.h" #include "FadingBanner.h"
FadingBanner::FadingBanner()
{
m_iIndexFront = 0;
}
void FadingBanner::SetCroppedSize( float fWidth, float fHeight ) void FadingBanner::SetCroppedSize( float fWidth, float fHeight )
{ {
m_FrontBanner.SetCroppedSize( fWidth, fHeight ); for( int i=0; i<2; i++ )
Banner::SetCroppedSize( fWidth, fHeight ); m_Banner[i].SetCroppedSize( fWidth, fHeight );
} }
void FadingBanner::Update( float fDeltaTime ) void FadingBanner::Update( float fDeltaTime )
{ {
m_FrontBanner.Update(fDeltaTime); Actor::Update( fDeltaTime );
Banner::Update( fDeltaTime ); for( int i=0; i<2; i++ )
m_Banner[i].Update( fDeltaTime );
} }
void FadingBanner::DrawPrimitives() void FadingBanner::DrawPrimitives()
{ {
Banner::DrawPrimitives(); Actor::DrawPrimitives();
m_FrontBanner.Draw(); m_Banner[GetBackIndex()].Draw();
m_Banner[m_iIndexFront].Draw();
} }
bool FadingBanner::Load( RageTextureID ID ) bool FadingBanner::Load( RageTextureID ID )
{ {
BeforeChange(); BeforeChange();
return m_Banner[m_iIndexFront].Load(ID);
if(!Banner::Load(ID))
return false;
Update(0);
return true;
} }
void FadingBanner::BeforeChange() void FadingBanner::BeforeChange()
{ {
// move the back banner to the front in preparation for a cross fade m_Banner[m_iIndexFront].SetDiffuse( RageColor(1,1,1,1) );
if( this->GetTexture() )
{
m_FrontBanner.Load( this->GetTexture()->GetID() );
m_FrontBanner.SetScrolling( this->IsScrolling(), this->ScrollingPercent() );
}
m_FrontBanner.SetDiffuse( RageColor(1,1,1,1) ); m_iIndexFront = GetBackIndex();
m_FrontBanner.StopTweening();
m_FrontBanner.BeginTweening( 0.25f ); // fade out m_Banner[m_iIndexFront].SetDiffuse( RageColor(1,1,1,1) );
m_FrontBanner.SetDiffuse( RageColor(1,1,1,0) ); m_Banner[m_iIndexFront].StopTweening();
m_Banner[m_iIndexFront].BeginTweening( 0.25f ); // fade out
m_Banner[m_iIndexFront].SetDiffuse( RageColor(1,1,1,0) );
} }
void FadingBanner::LoadFromSong( Song* pSong )
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFromSong( pSong );
}
void FadingBanner::LoadAllMusic()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadAllMusic();
}
void FadingBanner::LoadFromGroup( CString sGroupName )
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFromGroup( sGroupName );
}
void FadingBanner::LoadFromCourse( Course* pCourse )
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFromCourse( pCourse );
}
void FadingBanner::LoadRoulette()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadRoulette();
}
void FadingBanner::LoadRandom()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadRandom();
}
void FadingBanner::LoadFallback()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFallback();
}
+14 -3
View File
@@ -13,20 +13,31 @@
#include "Banner.h" #include "Banner.h"
class FadingBanner : public Banner class FadingBanner : public Actor
{ {
public: public:
virtual ~FadingBanner() { } FadingBanner();
virtual bool Load( RageTextureID ID ); virtual bool Load( RageTextureID ID );
void SetCroppedSize( float fWidth, float fHeight ); void SetCroppedSize( float fWidth, float fHeight );
void LoadFromSong( Song* pSong ); // NULL means no song
void LoadAllMusic();
void LoadFromGroup( CString sGroupName );
void LoadFromCourse( Course* pCourse );
void LoadRoulette();
void LoadRandom();
void LoadFallback();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void DrawPrimitives(); virtual void DrawPrimitives();
protected: protected:
void BeforeChange(); void BeforeChange();
Banner m_FrontBanner; Banner m_Banner[2];
int m_iIndexFront;
int GetBackIndex() { return m_iIndexFront==0 ? 1 : 0; }
}; };
#endif #endif
+1
View File
@@ -101,6 +101,7 @@ PlayMode StringToPlayMode( CString s );
enum SongSortOrder { enum SongSortOrder {
SORT_PREFERRED,
SORT_GROUP, SORT_GROUP,
SORT_TITLE, SORT_TITLE,
SORT_BPM, SORT_BPM,
+1 -1
View File
@@ -58,7 +58,7 @@ void GameState::Reset()
m_sPreferredGroup = GROUP_ALL_MUSIC; m_sPreferredGroup = GROUP_ALL_MUSIC;
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficulty[p] = DIFFICULTY_INVALID; m_PreferredDifficulty[p] = DIFFICULTY_INVALID;
m_SongSortOrder = SORT_GROUP; m_SongSortOrder = SORT_PREFERRED;
m_PlayMode = PLAY_MODE_INVALID; m_PlayMode = PLAY_MODE_INVALID;
m_bEditing = false; m_bEditing = false;
m_bDemonstrationOrJukebox = false; m_bDemonstrationOrJukebox = false;
+1
View File
@@ -18,6 +18,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageSoundManager.h" #include "RageSoundManager.h"
#include "StyleDef.h" #include "StyleDef.h"
#include "Song.h"
#define BANNERSPACING 200 #define BANNERSPACING 200
#define MAXSONGSINBUFFER 5 #define MAXSONGSINBUFFER 5
+2 -1
View File
@@ -21,7 +21,7 @@
MusicSortDisplay::MusicSortDisplay() MusicSortDisplay::MusicSortDisplay()
{ {
Load( THEME->GetPathToG("MusicSortDisplay icons 1x4") ); Load( THEME->GetPathToG("MusicSortDisplay icons 1x5") );
StopAnimating(); StopAnimating();
} }
@@ -29,6 +29,7 @@ void MusicSortDisplay::Set( SongSortOrder so )
{ {
switch( so ) switch( so )
{ {
case SORT_PREFERRED:
case SORT_GROUP: case SORT_GROUP:
case SORT_TITLE: case SORT_TITLE:
case SORT_BPM: case SORT_BPM:
+45 -23
View File
@@ -27,6 +27,7 @@
#include "song.h" #include "song.h"
#include "Course.h" #include "Course.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageTextureManager.h"
#define NUM_WHEEL_ITEMS min( MAX_WHEEL_ITEMS, THEME->GetMetricI("MusicWheel","NumWheelItems") ) #define NUM_WHEEL_ITEMS min( MAX_WHEEL_ITEMS, THEME->GetMetricI("MusicWheel","NumWheelItems") )
@@ -99,12 +100,6 @@ MusicWheel::MusicWheel()
m_soundLocked.Load( THEME->GetPathToS("MusicWheel locked") ); m_soundLocked.Load( THEME->GetPathToS("MusicWheel locked") );
// init m_mapGroupNameToBannerColor
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs, GAMESTATE->GetNumStagesLeft() );
SortSongPointerArrayByGroup( arraySongs );
m_iSelection = 0; m_iSelection = 0;
m_WheelState = STATE_SELECTING_MUSIC; m_WheelState = STATE_SELECTING_MUSIC;
@@ -247,9 +242,12 @@ bool MusicWheel::SelectCourse( const Course *p )
return true; return true;
} }
void MusicWheel::GetSongList(vector<Song*> &arraySongs, bool bRoulette ) void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup )
{ {
vector<Song*> apAllSongs; vector<Song*> apAllSongs;
if( so==SORT_PREFERRED && GAMESTATE->m_sPreferredGroup!=GROUP_ALL_MUSIC)
SONGMAN->GetSongs( apAllSongs, GAMESTATE->m_sPreferredGroup, GAMESTATE->GetNumStagesLeft() );
else
SONGMAN->GetSongs( apAllSongs, GAMESTATE->GetNumStagesLeft() ); SONGMAN->GetSongs( apAllSongs, GAMESTATE->GetNumStagesLeft() );
// copy only songs that have at least one Notes for the current GameMode // copy only songs that have at least one Notes for the current GameMode
@@ -262,9 +260,9 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, bool bRoulette )
if( pSong != GAMESTATE->m_pCurSong || if( pSong != GAMESTATE->m_pCurSong ||
(!GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2()) ) { (!GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2()) ) {
/* Hide songs that asked to be hidden via #SELECTABLE. */ /* Hide songs that asked to be hidden via #SELECTABLE. */
if( !bRoulette && !pSong->NormallyDisplayed() ) if( so!=SORT_ROULETTE && !pSong->NormallyDisplayed() )
continue; continue;
if( bRoulette && !pSong->RouletteDisplayed() ) if( so==SORT_ROULETTE && !pSong->RouletteDisplayed() )
continue; continue;
} }
@@ -327,14 +325,17 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
/////////////////////////////////// ///////////////////////////////////
vector<Song*> arraySongs; vector<Song*> arraySongs;
GetSongList(arraySongs, so == SORT_ROULETTE); GetSongList(arraySongs, so, GAMESTATE->m_sPreferredGroup );
// sort the songs // sort the songs
switch( so ) switch( so )
{ {
case SORT_GROUP: case SORT_PREFERRED:
case SORT_ROULETTE: case SORT_ROULETTE:
SortSongPointerArrayByGroup( arraySongs ); SortSongPointerArrayByGroupAndDifficulty( arraySongs );
break;
case SORT_GROUP:
SortSongPointerArrayByGroupAndTitle( arraySongs );
break; break;
case SORT_TITLE: case SORT_TITLE:
SortSongPointerArrayByTitle( arraySongs ); SortSongPointerArrayByTitle( arraySongs );
@@ -342,9 +343,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
case SORT_BPM: case SORT_BPM:
SortSongPointerArrayByBPM( arraySongs ); SortSongPointerArrayByBPM( arraySongs );
break; break;
// case SORT_ARTIST:
// SortSongPointerArrayByArtist( arraySongs );
// break;
case SORT_MOST_PLAYED: case SORT_MOST_PLAYED:
SortSongPointerArrayByMostPlayed( arraySongs ); SortSongPointerArrayByMostPlayed( arraySongs );
if( arraySongs.size() > 30 ) if( arraySongs.size() > 30 )
@@ -355,7 +353,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
} }
/////////////////////////////////// ///////////////////////////////////
// Build an array of WheelItemDatas from the sorted list of Song*'s // Build an array of WheelItemDatas from the sorted list of Song*'s
/////////////////////////////////// ///////////////////////////////////
@@ -364,9 +361,10 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
bool bUseSections = false; bool bUseSections = false;
switch( so ) switch( so )
{ {
case SORT_PREFERRED: bUseSections = false; break;
case SORT_MOST_PLAYED: bUseSections = false; break; case SORT_MOST_PLAYED: bUseSections = false; break;
case SORT_BPM: bUseSections = false; break; case SORT_BPM: bUseSections = false; break;
case SORT_GROUP: bUseSections = GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC; break; case SORT_GROUP: bUseSections = true; break;
case SORT_TITLE: bUseSections = true; break; case SORT_TITLE: bUseSections = true; break;
case SORT_ROULETTE: bUseSections = false; break; case SORT_ROULETTE: bUseSections = false; break;
default: ASSERT( 0 ); default: ASSERT( 0 );
@@ -377,7 +375,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
if( bUseSections ) if( bUseSections )
{ {
/* We're using sections, so use the section name as the top-levle /* We're using sections, so use the section name as the top-level
* sort. */ * sort. */
stable_sort(arraySongs.begin(), arraySongs.end(), stable_sort(arraySongs.begin(), arraySongs.end(),
CompareSongPointerArrayBySectionName(so)); CompareSongPointerArrayBySectionName(so));
@@ -391,9 +389,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
CString sThisSection = GetSectionNameFromSongAndSort( pSong, so ); CString sThisSection = GetSectionNameFromSongAndSort( pSong, so );
int iSectionColorIndex = 0; int iSectionColorIndex = 0;
if( GAMESTATE->m_sPreferredGroup != GROUP_ALL_MUSIC && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup )
continue;
if( sThisSection != sLastSection) // new section, make a section item if( sThisSection != sLastSection) // new section, make a section item
{ {
colorSection = (so==SORT_GROUP) ? SONGMAN->GetGroupColor(pSong->m_sGroupName) : SECTION_COLORS(iSectionColorIndex); colorSection = (so==SORT_GROUP) ? SONGMAN->GetGroupColor(pSong->m_sGroupName) : SECTION_COLORS(iSectionColorIndex);
@@ -410,8 +405,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
for( unsigned i=0; i<arraySongs.size(); i++ ) for( unsigned i=0; i<arraySongs.size(); i++ )
{ {
Song* pSong = arraySongs[i]; Song* pSong = arraySongs[i];
if( GAMESTATE->m_sPreferredGroup != GROUP_ALL_MUSIC && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup )
continue; // skip
arrayWheelItemDatas.push_back( WheelItemData(TYPE_SONG, pSong, "", NULL, SONGMAN->GetSongColor(pSong)) ); arrayWheelItemDatas.push_back( WheelItemData(TYPE_SONG, pSong, "", NULL, SONGMAN->GetSongColor(pSong)) );
} }
} }
@@ -1051,6 +1044,35 @@ void MusicWheel::SetOpenGroup(CString group, SongSortOrder so)
continue; continue;
m_CurWheelItemData.push_back(&from[i]); m_CurWheelItemData.push_back(&from[i]);
//
// cache banners
//
switch( from[i].m_Type )
{
case TYPE_SONG:
{
Song* pSong = from[i].m_pSong;
if( pSong->HasBanner() )
TEXTUREMAN->CacheTexture( pSong->GetBannerPath() );
}
break;
case TYPE_COURSE:
{
Course* pCourse = from[i].m_pCourse;
if( pCourse->HasBanner() )
TEXTUREMAN->CacheTexture( pCourse->m_sBannerPath );
}
break;
case TYPE_SECTION:
{
CString sPath = SONGMAN->GetGroupBannerPath( from[i].m_sSectionName );
if( !sPath.empty() )
TEXTUREMAN->CacheTexture( sPath );
}
break;
default:
break;
}
} }
m_iSelection = 0; m_iSelection = 0;
+1 -4
View File
@@ -28,13 +28,10 @@ class Song;
const int MAX_WHEEL_ITEMS = 15; const int MAX_WHEEL_ITEMS = 15;
const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique! const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique!
const ScreenMessage SM_SortOrderChanged = ScreenMessage(SM_User+48); const ScreenMessage SM_SortOrderChanged = ScreenMessage(SM_User+48);
struct CompareSongPointerArrayBySectionName; struct CompareSongPointerArrayBySectionName;
class MusicWheel : public ActorFrame class MusicWheel : public ActorFrame
@@ -76,7 +73,7 @@ public:
void RebuildMusicWheelItems(); void RebuildMusicWheelItems();
protected: protected:
void GetSongList(vector<Song*> &arraySongs, bool bRoulette ); void GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup );
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SongSortOrder so ); void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SongSortOrder so );
void SetOpenGroup(CString group, SongSortOrder so = NUM_SORT_ORDERS); void SetOpenGroup(CString group, SongSortOrder so = NUM_SORT_ORDERS);
bool SelectSong(const Song *p); bool SelectSong(const Song *p);
+1 -1
View File
@@ -93,7 +93,7 @@ RageTexture* RageTextureManager::LoadTexture( RageTextureID ID )
else else
pTexture = new RageBitmapTexture( ID ); pTexture = new RageBitmapTexture( ID );
// LOG->Trace( "RageTextureManager: Loaded '%s'.", ID.filename.GetString() ); LOG->Trace( "RageTextureManager: Loaded '%s'.", ID.filename.GetString() );
m_mapPathToTexture[ID] = pTexture; m_mapPathToTexture[ID] = pTexture;
+4
View File
@@ -38,6 +38,7 @@ ScreenSelectGroup::ScreenSelectGroup() : Screen("ScreenSelectGroup")
if( !PREFSMAN->m_bShowSelectGroup ) if( !PREFSMAN->m_bShowSelectGroup )
{ {
GAMESTATE->m_sPreferredGroup = GROUP_ALL_MUSIC; GAMESTATE->m_sPreferredGroup = GROUP_ALL_MUSIC;
GAMESTATE->m_SongSortOrder = SORT_GROUP;
HandleScreenMessage( SM_GoToNextScreen ); HandleScreenMessage( SM_GoToNextScreen );
return; return;
} }
@@ -255,6 +256,9 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn )
GAMESTATE->m_pCurSong = NULL; GAMESTATE->m_pCurSong = NULL;
GAMESTATE->m_sPreferredGroup = (m_GroupList.GetSelectionName()=="ALL MUSIC" ? GROUP_ALL_MUSIC : m_GroupList.GetSelectionName() ); GAMESTATE->m_sPreferredGroup = (m_GroupList.GetSelectionName()=="ALL MUSIC" ? GROUP_ALL_MUSIC : m_GroupList.GetSelectionName() );
if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC )
GAMESTATE->m_SongSortOrder = SORT_GROUP;
if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC ) if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC )
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select group comment all music") ); SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select group comment all music") );
else else
+1 -1
View File
@@ -46,7 +46,7 @@ private:
Sprite m_sprExplanation; Sprite m_sprExplanation;
Sprite m_sprFrame; Sprite m_sprFrame;
Banner m_Banner; FadingBanner m_Banner;
BitmapText m_textNumber; BitmapText m_textNumber;
Sprite m_sprContents; Sprite m_sprContents;
+12 -12
View File
@@ -734,18 +734,18 @@ void ScreenSelectMusic::AfterMusicChange()
/* If we're rouletting, and we're moving fast, don't touch the banner. */ /* If we're rouletting, and we're moving fast, don't touch the banner. */
bool no_banner_change = false; bool no_banner_change = false;
if(m_MusicWheel.IsMoving()) // if(m_MusicWheel.IsMoving())
{ // {
/* We're moving fast. Don't change banners if we're rouletting, or if // /* We're moving fast. Don't change banners if we're rouletting, or if
* we've been told to never change banners when moving fast. // * we've been told to never change banners when moving fast.
* // *
* XXX: When we're not changing banners and not rouletting, show some // * XXX: When we're not changing banners and not rouletting, show some
* kind of "moving fast" fallback banner. (When rouletting, just keep // * kind of "moving fast" fallback banner. (When rouletting, just keep
* showing the roulette banner.) */ // * showing the roulette banner.) */
if(m_MusicWheel.IsRouletting() || // if(m_MusicWheel.IsRouletting() ||
(m_MusicWheel.IsMoving() && !PREFSMAN->m_bChangeBannersWhenFast)) // (m_MusicWheel.IsMoving() && !PREFSMAN->m_bChangeBannersWhenFast))
no_banner_change = true; // no_banner_change = true;
} // }
m_sprMarathonBalloon.StopTweening(); m_sprMarathonBalloon.StopTweening();
OFF_COMMAND( m_sprMarathonBalloon ); OFF_COMMAND( m_sprMarathonBalloon );
+23 -4
View File
@@ -11,12 +11,12 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "song.h"
#include "Notes.h" #include "Notes.h"
#include "RageUtil.h" #include "RageUtil.h"
#include <math.h> // for fmod #include <math.h> // for fmod
#include "RageLog.h" #include "RageLog.h"
#include "IniFile.h" #include "IniFile.h"
#include "song.h"
#include "NoteData.h" #include "NoteData.h"
#include "MsdFile.h" #include "MsdFile.h"
#include "RageSound.h" #include "RageSound.h"
@@ -1071,7 +1071,7 @@ void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers )
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByArtist ); sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByArtist );
} }
int CompareSongPointersByGroup(const Song *pSong1, const Song *pSong2) int CompareSongPointersByGroupAndDifficulty(const Song *pSong1, const Song *pSong2)
{ {
const CString &sGroup1 = pSong1->m_sGroupName; const CString &sGroup1 = pSong1->m_sGroupName;
const CString &sGroup2 = pSong2->m_sGroupName; const CString &sGroup2 = pSong2->m_sGroupName;
@@ -1085,9 +1085,28 @@ int CompareSongPointersByGroup(const Song *pSong1, const Song *pSong2)
return CompareSongPointersByDifficulty( pSong1, pSong2 ); return CompareSongPointersByDifficulty( pSong1, pSong2 );
} }
void SortSongPointerArrayByGroup( vector<Song*> &arraySongPointers ) void SortSongPointerArrayByGroupAndDifficulty( vector<Song*> &arraySongPointers )
{ {
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByGroup ); sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByGroupAndDifficulty );
}
int CompareSongPointersByGroupAndTitle(const Song *pSong1, const Song *pSong2)
{
const CString &sGroup1 = pSong1->m_sGroupName;
const CString &sGroup2 = pSong2->m_sGroupName;
if( sGroup1 < sGroup2 )
return true;
if( sGroup1 > sGroup2 )
return false;
/* Same group; compare by name. */
return CompareSongPointersByTitle( pSong1, pSong2 );
}
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &arraySongPointers )
{
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByGroupAndTitle );
} }
bool CompareSongPointersByMostPlayed(const Song *pSong1, const Song *pSong2) bool CompareSongPointersByMostPlayed(const Song *pSong1, const Song *pSong2)
+8 -8
View File
@@ -1040,6 +1040,14 @@ SOURCE=.\CroppedSprite.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\FadingBanner.cpp
# End Source File
# Begin Source File
SOURCE=.\FadingBanner.h
# End Source File
# Begin Source File
SOURCE=.\Transition.cpp SOURCE=.\Transition.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -1328,14 +1336,6 @@ SOURCE=.\EditMenu.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\FadingBanner.cpp
# End Source File
# Begin Source File
SOURCE=.\FadingBanner.h
# End Source File
# Begin Source File
SOURCE=.\GradeDisplay.cpp SOURCE=.\GradeDisplay.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+2 -1
View File
@@ -250,7 +250,8 @@ void SortSongPointerArrayByDifficulty( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByTitle( vector<Song*> &arraySongPointers ); void SortSongPointerArrayByTitle( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByBPM( vector<Song*> &arraySongPointers ); void SortSongPointerArrayByBPM( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers ); void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByGroup( vector<Song*> &arraySongPointers ); void SortSongPointerArrayByGroupAndDifficulty( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers ); void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers );