Initial sort order now sorts by meter of Easy notes, ala MAX.
This commit is contained in:
@@ -215,8 +215,6 @@ void ScreenSelectMode::RefreshModeChoices()
|
||||
m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName, sChoiceName)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+35
-2
@@ -25,6 +25,7 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "StyleDef.h"
|
||||
#include "Notes.h"
|
||||
#include "GameState.h"
|
||||
|
||||
#include "NotesLoaderSM.h"
|
||||
#include "NotesLoaderDWI.h"
|
||||
@@ -795,6 +796,38 @@ bool Song::IsEasy( NotesType nt ) const
|
||||
// Sorting
|
||||
/////////////////////////////////////
|
||||
|
||||
int CompareSongPointersByDifficulty(const void *arg1, const void *arg2)
|
||||
{
|
||||
const Song* pSong1 = *(const Song**)arg1;
|
||||
const Song* pSong2 = *(const Song**)arg2;
|
||||
|
||||
CArray<Notes*,Notes*> aNotes1;
|
||||
CArray<Notes*,Notes*> aNotes2;
|
||||
|
||||
pSong1->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef(), PLAYER_1, aNotes1 );
|
||||
pSong2->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef(), PLAYER_1, aNotes2 );
|
||||
|
||||
int iEasiestMeter1 = 1000; // infinity
|
||||
int iEasiestMeter2 = 1000; // infinity
|
||||
|
||||
for( int i=0; i<aNotes1.GetSize(); i++ )
|
||||
iEasiestMeter1 = min( iEasiestMeter1, aNotes1[i]->m_iMeter );
|
||||
for( int i=0; i<aNotes2.GetSize(); i++ )
|
||||
iEasiestMeter2 = min( iEasiestMeter2, aNotes2[i]->m_iMeter );
|
||||
|
||||
if( iEasiestMeter1 < iEasiestMeter2 )
|
||||
return -1;
|
||||
else if( iEasiestMeter1 == iEasiestMeter2 )
|
||||
return 0;
|
||||
else
|
||||
return +1;
|
||||
}
|
||||
|
||||
void SortSongPointerArrayByDifficulty( CArray<Song*, Song*> &arraySongPointers )
|
||||
{
|
||||
qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByDifficulty );
|
||||
}
|
||||
|
||||
int CompareSongPointersByTitle(const void *arg1, const void *arg2)
|
||||
{
|
||||
const Song* pSong1 = *(const Song**)arg1;
|
||||
@@ -877,8 +910,8 @@ int CompareSongPointersByGroup(const void *arg1, const void *arg2)
|
||||
else if( sGroup1 > sGroup2 )
|
||||
return 1;
|
||||
|
||||
/* Same group; compare by title. */
|
||||
return CompareSongPointersByTitle( arg1, arg2 );
|
||||
/* Same group; compare by difficulty. */
|
||||
return CompareSongPointersByDifficulty( arg1, arg2 );
|
||||
}
|
||||
|
||||
void SortSongPointerArrayByGroup( CArray<Song*, Song*> &arraySongPointers )
|
||||
|
||||
@@ -414,7 +414,7 @@ void SongManager::GetSongsInGroup( const CString sGroupName, CArray<Song*, Song*
|
||||
if( sGroupName == m_pSongs[i]->m_sGroupName )
|
||||
AddTo.Add( pSong );
|
||||
}
|
||||
SortSongPointerArrayByGroup( AddTo );
|
||||
// SortSongPointerArrayByGroup( AddTo );
|
||||
}
|
||||
|
||||
CString SongManager::ShortenGroupName( const CString &sOrigGroupName )
|
||||
@@ -423,9 +423,9 @@ CString SongManager::ShortenGroupName( const CString &sOrigGroupName )
|
||||
sShortName.Replace( "Dance Dance Revolution", "DDR" );
|
||||
sShortName.Replace( "dance dance revolution", "DDR" );
|
||||
sShortName.Replace( "DANCE DANCE REVOLUTION", "DDR" );
|
||||
sShortName.Replace( "Pump It Up", "Pump" );
|
||||
sShortName.Replace( "pump it up", "pump" );
|
||||
sShortName.Replace( "PUMP IT UP", "PUMP" );
|
||||
sShortName.Replace( "Pump It Up", "PIU" );
|
||||
sShortName.Replace( "pump it up", "PIU" );
|
||||
sShortName.Replace( "PUMP IT UP", "PIU" );
|
||||
return sShortName;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void SortSongPointerArrayByDifficulty( CArray<Song*, Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByTitle( CArray<Song*, Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByBPM( CArray<Song*, Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByArtist( CArray<Song*, Song*> &arraySongPointers );
|
||||
|
||||
Reference in New Issue
Block a user