Initial sort order now sorts by meter of Easy notes, ala MAX.

This commit is contained in:
Chris Danford
2002-09-29 23:29:01 +00:00
parent 182b9cb0e6
commit 3bf1c81a48
5 changed files with 41 additions and 8 deletions
+1
View File
@@ -1,4 +1,5 @@
------------------------CVS after 3.00 beta 6---------------- ------------------------CVS after 3.00 beta 6----------------
CHANGE: Initial sort order now sorts by meter of Easy notes, ala MAX.
BUG FIX: DWI music sample info now read correctly - again. BUG FIX: DWI music sample info now read correctly - again.
NEW FEATURE: Precise adjustment of timing window for each grade via the NEW FEATURE: Precise adjustment of timing window for each grade via the
stepmania.ini file (see JudgeWindowPerfectPercent, JudgeWindowGreatPercent, stepmania.ini file (see JudgeWindowPerfectPercent, JudgeWindowGreatPercent,
-2
View File
@@ -215,8 +215,6 @@ void ScreenSelectMode::RefreshModeChoices()
m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName, sChoiceName)) ); m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName, sChoiceName)) );
} }
} }
} }
+35 -2
View File
@@ -25,6 +25,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "StyleDef.h" #include "StyleDef.h"
#include "Notes.h" #include "Notes.h"
#include "GameState.h"
#include "NotesLoaderSM.h" #include "NotesLoaderSM.h"
#include "NotesLoaderDWI.h" #include "NotesLoaderDWI.h"
@@ -795,6 +796,38 @@ bool Song::IsEasy( NotesType nt ) const
// Sorting // 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) int CompareSongPointersByTitle(const void *arg1, const void *arg2)
{ {
const Song* pSong1 = *(const Song**)arg1; const Song* pSong1 = *(const Song**)arg1;
@@ -877,8 +910,8 @@ int CompareSongPointersByGroup(const void *arg1, const void *arg2)
else if( sGroup1 > sGroup2 ) else if( sGroup1 > sGroup2 )
return 1; return 1;
/* Same group; compare by title. */ /* Same group; compare by difficulty. */
return CompareSongPointersByTitle( arg1, arg2 ); return CompareSongPointersByDifficulty( arg1, arg2 );
} }
void SortSongPointerArrayByGroup( CArray<Song*, Song*> &arraySongPointers ) void SortSongPointerArrayByGroup( CArray<Song*, Song*> &arraySongPointers )
+4 -4
View File
@@ -414,7 +414,7 @@ void SongManager::GetSongsInGroup( const CString sGroupName, CArray<Song*, Song*
if( sGroupName == m_pSongs[i]->m_sGroupName ) if( sGroupName == m_pSongs[i]->m_sGroupName )
AddTo.Add( pSong ); AddTo.Add( pSong );
} }
SortSongPointerArrayByGroup( AddTo ); // SortSongPointerArrayByGroup( AddTo );
} }
CString SongManager::ShortenGroupName( const CString &sOrigGroupName ) 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( "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", "PIU" );
sShortName.Replace( "pump it up", "pump" ); sShortName.Replace( "pump it up", "PIU" );
sShortName.Replace( "PUMP IT UP", "PUMP" ); sShortName.Replace( "PUMP IT UP", "PIU" );
return sShortName; return sShortName;
} }
+1
View File
@@ -198,6 +198,7 @@ public:
}; };
void SortSongPointerArrayByDifficulty( CArray<Song*, Song*> &arraySongPointers );
void SortSongPointerArrayByTitle( CArray<Song*, Song*> &arraySongPointers ); void SortSongPointerArrayByTitle( CArray<Song*, Song*> &arraySongPointers );
void SortSongPointerArrayByBPM( CArray<Song*, Song*> &arraySongPointers ); void SortSongPointerArrayByBPM( CArray<Song*, Song*> &arraySongPointers );
void SortSongPointerArrayByArtist( CArray<Song*, Song*> &arraySongPointers ); void SortSongPointerArrayByArtist( CArray<Song*, Song*> &arraySongPointers );