super speed up of song sort switching and expand/collapse

This commit is contained in:
Chris Danford
2002-02-06 05:13:39 +00:00
parent 2949721b40
commit 0ec7b1159d
8 changed files with 147 additions and 95 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ MusicSortDisplay::MusicSortDisplay()
} }
void MusicSortDisplay::Set( MusicSortOrder so ) void MusicSortDisplay::Set( SongSortOrder so )
{ {
switch( so ) switch( so )
+2 -3
View File
@@ -16,16 +16,15 @@ class MusicSortDisplay;
#include "Sprite.h" #include "Sprite.h"
#include "GameTypes.h"
enum MusicSortOrder { SORT_GROUP, SORT_TITLE, SORT_BPM, SORT_ARTIST, SORT_MOST_PLAYED, NUM_SORT_ORDERS };
class MusicSortDisplay : public Sprite class MusicSortDisplay : public Sprite
{ {
public: public:
MusicSortDisplay(); MusicSortDisplay();
void Set( MusicSortOrder so ); void Set( SongSortOrder so );
protected: protected:
+98 -47
View File
@@ -203,12 +203,13 @@ MusicWheel::MusicWheel()
} }
m_SortOrder = GAMEINFO->m_SongSortOrder;
m_MusicSortDisplay.Set( m_SortOrder );
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
m_SortOrder = SORT_GROUP;
m_sExpandedSectionName = ""; m_sExpandedSectionName = "";
RebuildWheelItems();
m_iSelection = 0; m_iSelection = 0;
@@ -218,21 +219,31 @@ MusicWheel::MusicWheel()
// find the previously selected song (if any), and select it // find the previously selected song (if any), and select it
for( i=0; i<m_WheelItems.GetSize(); i++ ) for( i=0; i<GetCurWheelItems().GetSize(); i++ )
{ {
if( m_WheelItems[i].m_pSong != NULL if( GetCurWheelItems()[i].m_pSong != NULL
&& m_WheelItems[i].m_pSong == GAMEINFO->m_pCurSong ) && GetCurWheelItems()[i].m_pSong == GAMEINFO->m_pCurSong )
m_iSelection = i; m_iSelection = i;
} }
for( int so=0; so<NUM_SORT_ORDERS; so++ )
BuildWheelItems( m_WheelItems[so], SongSortOrder(so) );
} }
void MusicWheel::RebuildWheelItems() MusicWheel::~MusicWheel()
{
GAMEINFO->m_SongSortOrder = m_SortOrder;
}
void MusicWheel::BuildWheelItems( CArray<WheelItem, WheelItem&> &arrayWheelItems, SongSortOrder so )
{ {
CArray<Song*, Song*&> arraySongs; CArray<Song*, Song*&> arraySongs;
arraySongs.Copy( GAMEINFO->m_pSongs ); arraySongs.Copy( GAMEINFO->m_pSongs );
// sort the songs // sort the songs
switch( m_SortOrder ) switch( so )
{ {
case SORT_GROUP: case SORT_GROUP:
SortSongPointerArrayByGroup( arraySongs ); SortSongPointerArrayByGroup( arraySongs );
@@ -254,22 +265,29 @@ void MusicWheel::RebuildWheelItems()
} }
m_WheelItems.RemoveAll(); // clear out the previous wheel items... for( int i=0; i<arraySongs.GetSize(); i++ )
{
Song* pSong = arraySongs[i];
int iNumTimesPlayed = pSong->GetNumTimesPlayed();
}
arrayWheelItems.RemoveAll(); // clear out the previous wheel items...
// ...and load new ones // ...and load new ones
switch( m_SortOrder ) switch( so )
{ {
case SORT_GROUP: case SORT_GROUP:
case SORT_MOST_PLAYED: case SORT_MOST_PLAYED:
case SORT_BPM: case SORT_BPM:
// make WheelItems without sections // make WheelItems without sections
m_WheelItems.SetSize( arraySongs.GetSize() ); arrayWheelItems.SetSize( arraySongs.GetSize() );
{ {
for( int i=0; i< arraySongs.GetSize(); i++ ) for( int i=0; i< arraySongs.GetSize(); i++ )
{ {
Song* pSong = arraySongs[i]; Song* pSong = arraySongs[i];
m_WheelItems[i].LoadFromSong( pSong ); WheelItem &WI = arrayWheelItems[i];
m_WheelItems[i].SetTintColor( *m_mapGroupNameToColorPtr[pSong->GetGroupName()] ); WI.LoadFromSong( pSong );
WI.SetTintColor( *m_mapGroupNameToColorPtr[pSong->GetGroupName()] );
WI.m_sSectionName = "";
} }
} }
break; break;
@@ -277,7 +295,7 @@ void MusicWheel::RebuildWheelItems()
case SORT_ARTIST: case SORT_ARTIST:
// make WheelItems with sections // make WheelItems with sections
m_WheelItems.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items arrayWheelItems.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items
{ {
CString sLastSection = ""; CString sLastSection = "";
@@ -286,24 +304,24 @@ void MusicWheel::RebuildWheelItems()
for( int i=0; i< arraySongs.GetSize(); i++ ) for( int i=0; i< arraySongs.GetSize(); i++ )
{ {
Song* pSong = arraySongs[i]; Song* pSong = arraySongs[i];
CString sThisSection = GetSectionNameFromSongAndSort( pSong, m_SortOrder ); CString sThisSection = GetSectionNameFromSongAndSort( pSong, so );
if( sThisSection != sLastSection ) // new section, make a section item if( sThisSection != sLastSection ) // new section, make a section item
{ {
WheelItem &WI = m_WheelItems[iCurWheelItem++]; WheelItem &WI = arrayWheelItems[iCurWheelItem++];
WI.LoadFromSectionName( sThisSection ); WI.LoadFromSectionName( sThisSection );
WI.m_sSectionName = sThisSection;
WI.SetTintColor( COLOR_SECTION_TINTS[iNextSectionTint++] ); WI.SetTintColor( COLOR_SECTION_TINTS[iNextSectionTint++] );
if( iNextSectionTint >= NUM_SECTION_TINTS ) if( iNextSectionTint >= NUM_SECTION_TINTS )
iNextSectionTint = 0; iNextSectionTint = 0;
sLastSection = sThisSection; sLastSection = sThisSection;
} }
if( sThisSection == m_sExpandedSectionName ) // this song is in the expanded section
{ WheelItem &WI = arrayWheelItems[iCurWheelItem++];
WheelItem &WI = m_WheelItems[iCurWheelItem++];
WI.LoadFromSong( pSong ); WI.LoadFromSong( pSong );
WI.m_sSectionName = sThisSection;
WI.SetTintColor( *m_mapGroupNameToColorPtr[pSong->GetGroupName()] ); WI.SetTintColor( *m_mapGroupNameToColorPtr[pSong->GetGroupName()] );
} }
} arrayWheelItems.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items
m_WheelItems.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items
} }
break; break;
default: default:
@@ -311,26 +329,30 @@ void MusicWheel::RebuildWheelItems()
} }
if( m_SortOrder == SORT_MOST_PLAYED ) if( so == SORT_MOST_PLAYED )
{ {
// init crown icons // init crown icons
for( int i=0; i<m_WheelItems.GetSize(); i++ ) for( int i=0; i<arrayWheelItems.GetSize(); i++ )
{ {
m_WheelItems[i].m_MusicStatusDisplay.SetBlinking( true ); arrayWheelItems[i].m_MusicStatusDisplay.SetBlinking( true );
m_WheelItems[i].m_MusicStatusDisplay.SetRank( i+1 ); arrayWheelItems[i].m_MusicStatusDisplay.SetRank( i+1 );
} }
} }
if( m_WheelItems.GetSize() == 0 ) if( arrayWheelItems.GetSize() == 0 )
{ {
m_WheelItems.SetSize( 1 ); arrayWheelItems.SetSize( 1 );
m_WheelItems[0].LoadFromSectionName( "No Songs" ); arrayWheelItems[0].LoadFromSectionName( "No Songs" );
m_WheelItems[0].SetTintColor( D3DXCOLOR(0.5f,0.5f,0.5f,1) ); arrayWheelItems[0].SetTintColor( D3DXCOLOR(0.5f,0.5f,0.5f,1) );
} }
} }
void MusicWheel::SwitchSortOrder()
{
}
float MusicWheel::GetBannerY( float fPosOffsetsFromMiddle ) float MusicWheel::GetBannerY( float fPosOffsetsFromMiddle )
{ {
@@ -402,16 +424,24 @@ void MusicWheel::RenderPrimitives()
// rewind to bottom item to draw; // rewind to bottom item to draw;
int iIndex = m_iSelection; int iIndex = m_iSelection;
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW/2; i++ ) for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW/2; i++ )
{
do
{ {
iIndex--; iIndex--;
if( iIndex < 0 ) if( iIndex < 0 )
iIndex = m_WheelItems.GetSize()-1; iIndex = GetCurWheelItems().GetSize()-1;
}
while( GetCurWheelItems()[iIndex].m_WheelItemType == WheelItem::TYPE_MUSIC
&& GetCurWheelItems()[iIndex].m_sSectionName != ""
&& GetCurWheelItems()[iIndex].m_sSectionName != m_sExpandedSectionName );
} }
// iIndex is now the index of the lowest WheelItem to draw // iIndex is now the index of the lowest WheelItem to draw
for( i=-NUM_WHEEL_ITEMS_TO_DRAW/2; i<NUM_WHEEL_ITEMS_TO_DRAW/2; i++ ) for( i=-NUM_WHEEL_ITEMS_TO_DRAW/2; i<NUM_WHEEL_ITEMS_TO_DRAW/2; i++ )
{ {
WheelItem& WI = m_WheelItems[iIndex]; WheelItem& WI = GetCurWheelItems()[iIndex];
float fThisBannerPositionOffsetFromSelection = m_fPositionOffsetFromSelection + i; float fThisBannerPositionOffsetFromSelection = m_fPositionOffsetFromSelection + i;
@@ -426,10 +456,17 @@ void MusicWheel::RenderPrimitives()
WI.Draw(); WI.Draw();
do
{
iIndex++; iIndex++;
if( iIndex > m_WheelItems.GetSize()-1 ) if( iIndex > GetCurWheelItems().GetSize()-1 )
iIndex = 0; iIndex = 0;
} }
while( GetCurWheelItems()[iIndex].m_WheelItemType == WheelItem::TYPE_MUSIC
&& GetCurWheelItems()[iIndex].m_sSectionName != ""
&& GetCurWheelItems()[iIndex].m_sSectionName != m_sExpandedSectionName );
}
m_sprSelectionOverlay.Draw(); m_sprSelectionOverlay.Draw();
@@ -446,9 +483,9 @@ void MusicWheel::Update( float fDeltaTime )
for( int i=0; i<m_WheelItems.GetSize(); i++ ) for( int i=0; i<GetCurWheelItems().GetSize(); i++ )
{ {
m_WheelItems[i].Update( fDeltaTime ); GetCurWheelItems()[i].Update( fDeltaTime );
} }
@@ -467,14 +504,14 @@ void MusicWheel::Update( float fDeltaTime )
m_WheelState = STATE_FLYING_ON_AFTER_NEXT_SORT; m_WheelState = STATE_FLYING_ON_AFTER_NEXT_SORT;
m_fTimeLeftInState = FADE_TIME; m_fTimeLeftInState = FADE_TIME;
Song* pPrevSelectedSong = m_WheelItems[m_iSelection].m_pSong; Song* pPrevSelectedSong = GetCurWheelItems()[m_iSelection].m_pSong;
// change the sort order // change the sort order
m_SortOrder = MusicSortOrder(m_SortOrder+1); m_SortOrder = SongSortOrder(m_SortOrder+1);
if( m_SortOrder > NUM_SORT_ORDERS-1 ) if( m_SortOrder > NUM_SORT_ORDERS-1 )
m_SortOrder = (MusicSortOrder)0; m_SortOrder = (SongSortOrder)0;
m_sExpandedSectionName = GetSectionNameFromSongAndSort( pPrevSelectedSong, m_SortOrder ); m_sExpandedSectionName = GetSectionNameFromSongAndSort( pPrevSelectedSong, m_SortOrder );
RebuildWheelItems(); //RebuildWheelItems();
m_MusicSortDisplay.Set( m_SortOrder ); m_MusicSortDisplay.Set( m_SortOrder );
m_MusicSortDisplay.BeginTweening( FADE_TIME, TWEEN_BIAS_BEGIN ); m_MusicSortDisplay.BeginTweening( FADE_TIME, TWEEN_BIAS_BEGIN );
@@ -482,9 +519,9 @@ void MusicWheel::Update( float fDeltaTime )
// find the previously selected song, and select it // find the previously selected song, and select it
for( i=0; i<m_WheelItems.GetSize(); i++ ) for( i=0; i<GetCurWheelItems().GetSize(); i++ )
{ {
if( m_WheelItems[i].m_pSong == pPrevSelectedSong ) if( GetCurWheelItems()[i].m_pSong == pPrevSelectedSong )
m_iSelection = i; m_iSelection = i;
} }
} }
@@ -534,9 +571,16 @@ void MusicWheel::PrevMusic()
MUSIC->Stop(); MUSIC->Stop();
do
{
m_iSelection--; m_iSelection--;
if( m_iSelection < 0 ) if( m_iSelection < 0 )
m_iSelection = m_WheelItems.GetSize()-1; m_iSelection = GetCurWheelItems().GetSize()-1;
}
while( GetCurWheelItems()[m_iSelection].m_WheelItemType == WheelItem::TYPE_MUSIC
&& GetCurWheelItems()[m_iSelection].m_sSectionName != ""
&& GetCurWheelItems()[m_iSelection].m_sSectionName != m_sExpandedSectionName );
m_fPositionOffsetFromSelection -= 1; m_fPositionOffsetFromSelection -= 1;
@@ -558,9 +602,16 @@ void MusicWheel::NextMusic()
MUSIC->Stop(); MUSIC->Stop();
do
{
m_iSelection++; m_iSelection++;
if( m_iSelection > m_WheelItems.GetSize()-1 ) if( m_iSelection > GetCurWheelItems().GetSize()-1 )
m_iSelection = 0; m_iSelection = 0;
}
while( GetCurWheelItems()[m_iSelection].m_WheelItemType == WheelItem::TYPE_MUSIC
&& GetCurWheelItems()[m_iSelection].m_sSectionName != ""
&& GetCurWheelItems()[m_iSelection].m_sSectionName != m_sExpandedSectionName );
m_fPositionOffsetFromSelection += 1; m_fPositionOffsetFromSelection += 1;
@@ -593,17 +644,17 @@ void MusicWheel::NextSort()
bool MusicWheel::Select() bool MusicWheel::Select()
{ {
switch( m_WheelItems[m_iSelection].m_WheelItemType ) switch( GetCurWheelItems()[m_iSelection].m_WheelItemType )
{ {
case WheelItem::TYPE_SECTION: case WheelItem::TYPE_SECTION:
{ {
CString sThisItemSectionName = m_WheelItems[m_iSelection].GetSectionName(); CString sThisItemSectionName = GetCurWheelItems()[m_iSelection].GetSectionName();
if( m_sExpandedSectionName == sThisItemSectionName ) // already expanded if( m_sExpandedSectionName == sThisItemSectionName ) // already expanded
m_sExpandedSectionName = ""; // collapse it m_sExpandedSectionName = ""; // collapse it
else // already collapsed else // already collapsed
m_sExpandedSectionName = sThisItemSectionName; // expand it m_sExpandedSectionName = sThisItemSectionName; // expand it
RebuildWheelItems(); //RebuildWheelItems();
m_soundExpand.PlayRandom(); m_soundExpand.PlayRandom();
@@ -611,10 +662,10 @@ bool MusicWheel::Select()
m_iSelection = 0; // reset in case we can't find the last selected song m_iSelection = 0; // reset in case we can't find the last selected song
// find the section header and select it // find the section header and select it
for( int i=0; i<m_WheelItems.GetSize(); i++ ) for( int i=0; i<GetCurWheelItems().GetSize(); i++ )
{ {
if( m_WheelItems[i].m_WheelItemType == WheelItem::TYPE_SECTION if( GetCurWheelItems()[i].m_WheelItemType == WheelItem::TYPE_SECTION
&& m_WheelItems[i].GetSectionName() == sThisItemSectionName ) && GetCurWheelItems()[i].GetSectionName() == sThisItemSectionName )
{ {
m_iSelection = i; m_iSelection = i;
break; break;
+22 -17
View File
@@ -22,6 +22,7 @@
#include "SoundSet.h" #include "SoundSet.h"
#include "GradeDisplay.h" #include "GradeDisplay.h"
#include "RageSoundStream.h" #include "RageSoundStream.h"
#include "GameTypes.h"
#include "MusicSortDisplay.h" #include "MusicSortDisplay.h"
#include "MusicStatusDisplay.h" #include "MusicStatusDisplay.h"
#include "Window.h" // for WindowMessage #include "Window.h" // for WindowMessage
@@ -59,6 +60,7 @@ public:
enum WheelItemType { TYPE_SECTION, TYPE_MUSIC }; enum WheelItemType { TYPE_SECTION, TYPE_MUSIC };
WheelItemType m_WheelItemType; WheelItemType m_WheelItemType;
D3DXCOLOR m_colorTint; D3DXCOLOR m_colorTint;
CString m_sSectionName;
// for a section // for a section
Sprite m_sprSectionBackground; Sprite m_sprSectionBackground;
@@ -77,6 +79,7 @@ class MusicWheel : public ActorFrame
{ {
public: public:
MusicWheel(); MusicWheel();
~MusicWheel();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void RenderPrimitives();
@@ -94,11 +97,12 @@ public:
float GetBannerX( float fPosOffsetsFromMiddle ); float GetBannerX( float fPosOffsetsFromMiddle );
bool Select(); // return true if the selected item is a music, otherwise false bool Select(); // return true if the selected item is a music, otherwise false
Song* GetSelectedSong() { return m_WheelItems[m_iSelection].m_pSong; }; Song* GetSelectedSong() { return GetCurWheelItems()[m_iSelection].m_pSong; };
protected: protected:
void RebuildWheelItems(); void BuildWheelItems( CArray<WheelItem, WheelItem&> &arrayWheelItems, SongSortOrder so );
void SwitchSortOrder();
Sprite m_sprSelectionBackground; Sprite m_sprSelectionBackground;
@@ -108,8 +112,9 @@ protected:
CArray<WheelItem, WheelItem&> m_WheelItems; CArray<WheelItem, WheelItem&> m_WheelItems[NUM_SORT_ORDERS];
MusicSortOrder m_SortOrder; SongSortOrder m_SortOrder;
CArray<WheelItem, WheelItem&> &GetCurWheelItems() { return m_WheelItems[m_SortOrder]; };
int m_iSelection; int m_iSelection;
CString m_sExpandedSectionName; CString m_sExpandedSectionName;
@@ -136,33 +141,33 @@ protected:
CString GetSectionNameFromSongAndSort( Song* pSong, MusicSortOrder order ) CString GetSectionNameFromSongAndSort( Song* pSong, SongSortOrder so )
{ {
CString sTemp; CString sTemp;
switch( m_SortOrder ) switch( so )
{ {
case SORT_GROUP: case SORT_GROUP:
sTemp = pSong->GetGroupName(); sTemp = pSong->GetGroupName();
sTemp.MakeUpper(); sTemp.MakeUpper();
if( sTemp.GetLength() > 0 ) sTemp = (sTemp.GetLength() > 0) ? sTemp : "";
if( IsAnInt(sTemp) )
sTemp = "NUM";
return sTemp; return sTemp;
else
return " ";
case SORT_ARTIST: case SORT_ARTIST:
sTemp = pSong->GetArtist(); sTemp = pSong->GetArtist();
sTemp.MakeUpper(); sTemp.MakeUpper();
if( sTemp.GetLength() > 0 ) sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : "";
return sTemp[0]; if( IsAnInt(sTemp) )
else sTemp = "NUM";
return " "; return sTemp;
case SORT_TITLE: case SORT_TITLE:
sTemp = pSong->GetTitle(); sTemp = pSong->GetTitle();
sTemp.MakeUpper(); sTemp.MakeUpper();
if( sTemp.GetLength() > 0 ) sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : "";
return sTemp[0]; if( IsAnInt(sTemp) )
else sTemp = "NUM";
return " "; return sTemp;
case SORT_BPM: case SORT_BPM:
case SORT_MOST_PLAYED: case SORT_MOST_PLAYED:
default: default:
+5 -4
View File
@@ -1065,23 +1065,24 @@ void Player::DrawColorArrows()
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
float fYPos = GetColorArrowYPos( j, m_fSongBeat ); float fYPos = GetColorArrowYPos( j, m_fSongBeat );
if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK ) if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK )
{ {
if( fYPos < GetGrayArrowYPos() ) if( fYPos < GetGrayArrowYPos() )
continue; // don't draw continue; // don't draw
} }
if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK )
fYPos = max( fYPos, GetGrayArrowYPos() );
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
m_ColorArrow[iColNum].SetY( fYPos ); m_ColorArrow[iColNum].SetY( fYPos );
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].SetAlpha( fAlpha );
m_ColorArrow[iColNum].DrawGrayPart(); m_ColorArrow[iColNum].DrawGrayPart();
if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK )
fYPos = max( fYPos, GetGrayArrowYPos() );
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
m_ColorArrow[iColNum].SetY( fYPos ); m_ColorArrow[iColNum].SetY( fYPos );
m_ColorArrow[iColNum].SetColorPartFromIndexAndBeat( i, m_fSongBeat ); m_ColorArrow[iColNum].SetColorPartFromIndexAndBeat( i, m_fSongBeat );
m_ColorArrow[iColNum].SetGrayPartFromIndexAndBeat( i, m_fSongBeat ); m_ColorArrow[iColNum].SetGrayPartFromIndexAndBeat( i, m_fSongBeat );
+3 -2
View File
@@ -96,8 +96,9 @@ void RageLog( LPCTSTR fmt, ...)
sBuff += "\n"; sBuff += "\n";
fprintf( g_fileLog, sBuff ); fprintf( g_fileLog, sBuff );
fclose( g_fileLog ); fflush( g_fileLog );
g_fileLog = fopen( g_sLogFileName, "w" ); // fclose( g_fileLog );
// g_fileLog = fopen( g_sLogFileName, "w" );
} }
void RageLogHr( HRESULT hr, LPCTSTR fmt, ...) void RageLogHr( HRESULT hr, LPCTSTR fmt, ...)
-5
View File
@@ -111,13 +111,8 @@ void RageLogHr( HRESULT hr, LPCTSTR fmt, ...);
VOID DisplayErrorAndDie( CString sError ); VOID DisplayErrorAndDie( CString sError );
#if defined(DEBUG) | defined(_DEBUG)
#define RageError(str) DisplayErrorAndDie( ssprintf( "%s\n\n%s(%d)", str, __FILE__, (DWORD)__LINE__) ) #define RageError(str) DisplayErrorAndDie( ssprintf( "%s\n\n%s(%d)", str, __FILE__, (DWORD)__LINE__) )
#define RageErrorHr(str,hr) DisplayErrorAndDie( ssprintf("%s (%s)\n\n%s(%d)", str, DXGetErrorString8(hr), __FILE__, (DWORD)__LINE__) ) #define RageErrorHr(str,hr) DisplayErrorAndDie( ssprintf("%s (%s)\n\n%s(%d)", str, DXGetErrorString8(hr), __FILE__, (DWORD)__LINE__) )
#else
#define RageError(str) DisplayErrorAndDie( ssprintf( "%s\n\n%", str ) )
#define RageErrorHr(str,hr) DisplayErrorAndDie( ssprintf("%s (%s)\n\n%", str, DXGetErrorString8(hr) ) )
#endif
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata); LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
+1 -1
View File
@@ -788,7 +788,7 @@ int CompareSongPointersByMostPlayed(const void *arg1, const void *arg2)
CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs
CString sFilePath2 = pSong2->GetSongFilePath(); CString sFilePath2 = pSong2->GetSongFilePath();
if( iNumTimesPlayed1 < iNumTimesPlayed2 ) if( iNumTimesPlayed1 > iNumTimesPlayed2 )
return -1; return -1;
else if( iNumTimesPlayed1 == iNumTimesPlayed2 ) else if( iNumTimesPlayed1 == iNumTimesPlayed2 )
return CompareCStrings( (void*)&sFilePath1, (void*)&sFilePath2 ); return CompareCStrings( (void*)&sFilePath1, (void*)&sFilePath2 );