no message

This commit is contained in:
Chris Danford
2002-05-19 01:59:48 +00:00
parent 62f3f01a05
commit 2f80235590
141 changed files with 2540 additions and 2058 deletions
+30 -28
View File
@@ -5,7 +5,7 @@
Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -16,15 +16,15 @@
#include "RageLog.h"
#include "ErrorCatcher/ErrorCatcher.h"
SongManager* SONG = NULL; // global and accessable from anywhere in our program
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
const CString g_sStatisticsFileName = "statistics.ini";
D3DXCOLOR GROUP_COLORS[] = {
D3DXCOLOR( 0.9f, 0.0f, 0.2f, 1 ), // red
D3DXCOLOR( 0.6f, 0.0f, 0.4f, 1 ), // pink
D3DXCOLOR( 0.2f, 0.1f, 0.3f, 1 ), // purple
D3DXCOLOR( 0.7f, 0.0f, 0.5f, 1 ), // pink
D3DXCOLOR( 0.4f, 0.2f, 0.6f, 1 ), // purple
D3DXCOLOR( 0.0f, 0.4f, 0.8f, 1 ), // sky blue
D3DXCOLOR( 0.0f, 0.6f, 0.6f, 1 ), // sea green
D3DXCOLOR( 0.0f, 0.6f, 0.2f, 1 ), // green
@@ -37,7 +37,7 @@ SongManager::SongManager()
{
m_pCurSong = NULL;
for( int p=0; p<NUM_PLAYERS; p++ )
m_pCurNoteMetadata[p] = NULL;
m_pCurNotes[p] = NULL;
InitSongArrayFromDisk();
ReadStatisticsFromDisk();
@@ -55,7 +55,7 @@ SongManager::~SongManager()
void SongManager::InitSongArrayFromDisk()
{
LoadStepManiaSongDir( "Songs" );
LoadDWISongDir( "DWI Support" );
//LoadDWISongDir( "DWI Support" );
// computer group names
CArray<Song*, Song*> arraySongs;
@@ -94,6 +94,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir )
// Check to see if they put a song directly inside of the group folder
CStringArray arrayFiles;
GetDirListing( ssprintf("%s\\%s\\*.mp3", sDir, sGroupDirName), arrayFiles );
GetDirListing( ssprintf("%s\\%s\\*.ogg", sDir, sGroupDirName), arrayFiles );
GetDirListing( ssprintf("%s\\%s\\*.wav", sDir, sGroupDirName), arrayFiles );
if( arrayFiles.GetSize() > 0 )
FatalError(
@@ -135,6 +136,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir )
}
/*
void SongManager::LoadDWISongDir( CString DWIHome )
{
// trim off the trailing slash if any
@@ -185,7 +187,7 @@ void SongManager::LoadDWISongDir( CString DWIHome )
}
}
}
*/
void SongManager::CleanUpSongArray()
@@ -235,7 +237,7 @@ void SongManager::ReadStatisticsFromDisk()
int iRetVal;
int i;
// Parse for Song name and NoteMetadata name
// Parse for Song name and Notes name
iRetVal = sscanf( name_string, "%[^:]::%[^\n]", szSongName, szStepsName );
if( iRetVal != 2 )
continue; // this line doesn't match what is expected
@@ -255,35 +257,35 @@ void SongManager::ReadStatisticsFromDisk()
continue; // skip this entry
// Search for the corresponding NoteMetadata pointer.
NoteMetadata* pNoteMetadata = NULL;
for( i=0; i<pSong->m_arrayNoteMetadatas.GetSize(); i++ )
// Search for the corresponding Notes pointer.
Notes* pNotes = NULL;
for( i=0; i<pSong->m_arrayNotes.GetSize(); i++ )
{
if( pSong->m_arrayNoteMetadatas[i].m_sDescription == szStepsName ) // match!
if( pSong->m_arrayNotes[i].m_sDescription == szStepsName ) // match!
{
pNoteMetadata = &pSong->m_arrayNoteMetadatas[i];
pNotes = &pSong->m_arrayNotes[i];
break;
}
}
if( pNoteMetadata == NULL ) // didn't find a match
if( pNotes == NULL ) // didn't find a match
continue; // skip this entry
// Parse the NoteMetadata statistics.
// Parse the Notes statistics.
char szGradeLetters[10]; // longest possible string is "AAA"
iRetVal = sscanf(
value_string,
"%d::%[^:]::%d::%d",
&pNoteMetadata->m_iNumTimesPlayed,
&pNotes->m_iNumTimesPlayed,
szGradeLetters,
&pNoteMetadata->m_iTopScore,
&pNoteMetadata->m_iMaxCombo
&pNotes->m_iTopScore,
&pNotes->m_iMaxCombo
);
if( iRetVal != 4 )
continue;
pNoteMetadata->m_TopGrade = StringToGrade( szGradeLetters );
pNotes->m_TopGrade = StringToGrade( szGradeLetters );
}
}
}
@@ -298,22 +300,22 @@ void SongManager::SaveStatisticsToDisk()
{
Song* pSong = m_pSongs[i];
for( int j=0; j<pSong->m_arrayNoteMetadatas.GetSize(); j++ ) // for each NoteMetadata
for( int j=0; j<pSong->m_arrayNotes.GetSize(); j++ ) // for each Notes
{
NoteMetadata* pNoteMetadata = &pSong->m_arrayNoteMetadatas[j];
Notes* pNotes = &pSong->m_arrayNotes[j];
if( pNoteMetadata->m_TopGrade == GRADE_NO_DATA )
if( pNotes->m_TopGrade == GRADE_NO_DATA )
continue; // skip
// Each value has the format "SongName::NoteMetadataName=TimesPlayed::TopGrade::TopScore::MaxCombo".
// Each value has the format "SongName::NotesName=TimesPlayed::TopGrade::TopScore::MaxCombo".
CString sName = ssprintf( "%s::%s", pSong->GetMainTitle(), pNoteMetadata->m_sDescription );
CString sName = ssprintf( "%s::%s", pSong->GetMainTitle(), pNotes->m_sDescription );
CString sValue = ssprintf(
"%d::%s::%d::%d",
pNoteMetadata->m_iNumTimesPlayed,
GradeToString( pNoteMetadata->m_TopGrade ),
pNoteMetadata->m_iTopScore,
pNoteMetadata->m_iMaxCombo
pNotes->m_iNumTimesPlayed,
GradeToString( pNotes->m_TopGrade ),
pNotes->m_iTopScore,
pNotes->m_iMaxCombo
);
ini.SetValue( "Statistics", sName, sValue );