slight cleanup

This commit is contained in:
AJ Kelly
2011-09-10 02:05:12 -05:00
parent 0db3fbac7a
commit ae8bf617a3
+5 -40
View File
@@ -91,8 +91,8 @@ static void SearchForDifficulty( RString sTag, Steps *pOut )
static void SlideDuplicateDifficulties( Song &p ) static void SlideDuplicateDifficulties( Song &p )
{ {
/* BMS files have to guess the Difficulty from the meter; this is inaccurate, /* BMS files have to guess the Difficulty from the meter; this is inaccurate,
* and often leads to duplicates. Slide duplicate difficulties upwards. We * and often leads to duplicates. Slide duplicate difficulties upwards.
* only do this with BMS files, since a very common bug was having *all* * We only do this with BMS files, since a very common bug was having *all*
* difficulties slid upwards due to (for example) having two beginner steps. * difficulties slid upwards due to (for example) having two beginner steps.
* We do a second pass in Song::TidyUpData to eliminate any remaining duplicates * We do a second pass in Song::TidyUpData to eliminate any remaining duplicates
* after this. */ * after this. */
@@ -125,12 +125,7 @@ void BMSLoader::GetApplicableFiles( const RString &sPath, vector<RString> &out )
GetDirListing( sPath + RString("*.bml"), out ); GetDirListing( sPath + RString("*.bml"), out );
} }
/*===========================================================================*/
/*===========================================================================
*===========================================================================
*===========================================================================
*===========================================================================
*/
struct BMSObject struct BMSObject
{ {
@@ -151,16 +146,11 @@ struct BMSObject
} }
}; };
struct BMSMeasure struct BMSMeasure
{ {
float size; float size;
}; };
typedef map<RString, RString> BMSHeaders; typedef map<RString, RString> BMSHeaders;
typedef map<int, BMSMeasure> BMSMeasures; typedef map<int, BMSMeasure> BMSMeasures;
typedef vector<BMSObject> BMSObjects; typedef vector<BMSObject> BMSObjects;
@@ -179,7 +169,6 @@ public:
BMSMeasures measures; BMSMeasures measures;
void TidyUpData(); void TidyUpData();
}; };
BMSChart::BMSChart() BMSChart::BMSChart()
@@ -232,7 +221,7 @@ bool BMSChart::Load( const RString &chartPath )
if( channel == 2 ) if( channel == 2 )
{ {
// special channel: time signature // special channel: time signature
this->measures[measure] = (BMSMeasure){ StringToFloat(data) }; this->measures[measure] = (BMSMeasure)(StringToFloat(data));
} }
else else
{ {
@@ -277,9 +266,6 @@ void BMSChart::TidyUpData()
sort( objects.begin(), objects.end() ); sort( objects.begin(), objects.end() );
} }
class BMSSong { class BMSSong {
map<RString, int> mapKeysoundToIndex; map<RString, int> mapKeysoundToIndex;
@@ -289,7 +275,6 @@ public:
BMSSong( Song *song ); BMSSong( Song *song );
unsigned AllocateKeysound( RString filename, RString path ); unsigned AllocateKeysound( RString filename, RString path );
Song *GetSong(); Song *GetSong();
}; };
BMSSong::BMSSong( Song *song ) BMSSong::BMSSong( Song *song )
@@ -301,7 +286,6 @@ BMSSong::BMSSong( Song *song )
{ {
mapKeysoundToIndex[out->m_vsKeysoundFile[i]] = i; mapKeysoundToIndex[out->m_vsKeysoundFile[i]] = i;
} }
} }
Song *BMSSong::GetSong() Song *BMSSong::GetSong()
@@ -365,23 +349,18 @@ unsigned BMSSong::AllocateKeysound( RString filename, RString path )
mapKeysoundToIndex[filename] = index; mapKeysoundToIndex[filename] = index;
mapKeysoundToIndex[normalizedFilename] = index; mapKeysoundToIndex[normalizedFilename] = index;
return index; return index;
} }
struct BMSChartInfo { struct BMSChartInfo {
RString title; RString title;
RString artist; RString artist;
RString genre; RString genre;
RString backgroundFile; RString backgroundFile;
RString musicFile; RString musicFile;
}; };
class BMSChartReader { class BMSChartReader {
BMSChart *in; BMSChart *in;
Steps *out; Steps *out;
BMSSong *song; BMSSong *song;
@@ -486,7 +465,6 @@ void BMSChartReader::ReadHeaders()
void BMSChartReader::CalculateStepsType() void BMSChartReader::CalculateStepsType()
{ {
for( unsigned i = 0; i < in->objects.size(); i ++ ) for( unsigned i = 0; i < in->objects.size(); i ++ )
{ {
BMSObject &obj = in->objects[i]; BMSObject &obj = in->objects[i];
@@ -499,7 +477,6 @@ void BMSChartReader::CalculateStepsType()
nonEmptyTracksCount = nonEmptyTracks.size(); nonEmptyTracksCount = nonEmptyTracks.size();
out->m_StepsType = DetermineStepsType(); out->m_StepsType = DetermineStepsType();
} }
enum BmsRawChannel enum BmsRawChannel
@@ -758,7 +735,6 @@ bool BMSChartReader::ReadNoteData()
measureAdjust = adjustedMeasureSize / measureSize; measureAdjust = adjustedMeasureSize / measureSize;
td.SetBPMAtRow( BeatToNoteRow(measureStartBeat), measureAdjust * currentBPM ); td.SetBPMAtRow( BeatToNoteRow(measureStartBeat), measureAdjust * currentBPM );
// end measure size adjustment // end measure size adjustment
} }
int row = BeatToNoteRow( measureStartBeat + adjustedMeasureSize * obj.position ); int row = BeatToNoteRow( measureStartBeat + adjustedMeasureSize * obj.position );
@@ -844,7 +820,6 @@ bool BMSChartReader::ReadNoteData()
out->TidyUpData(); out->TidyUpData();
out->SetSavedToDisk( true ); // we're loading from disk, so this is by definintion already saved out->SetSavedToDisk( true ); // we're loading from disk, so this is by definintion already saved
return true; return true;
} }
@@ -853,8 +828,6 @@ Steps *BMSChartReader::GetSteps()
return out; return out;
} }
struct BMSStepsInfo { struct BMSStepsInfo {
Steps *steps; Steps *steps;
BMSChartInfo info; BMSChartInfo info;
@@ -877,7 +850,6 @@ BMSSongLoader::BMSSongLoader( RString songDir, Song *outSong ): song(outSong), d
bool BMSSongLoader::Load( RString fileName ) bool BMSSongLoader::Load( RString fileName )
{ {
// before doing anything else, load the chart first! // before doing anything else, load the chart first!
BMSChart chart; BMSChart chart;
if( !chart.Load( dir + fileName ) ) return false; if( !chart.Load( dir + fileName ) ) return false;
@@ -906,7 +878,6 @@ bool BMSSongLoader::Load( RString fileName )
void BMSSongLoader::AddToSong() void BMSSongLoader::AddToSong()
{ {
RString commonSubstring = ""; RString commonSubstring = "";
{ {
@@ -1044,11 +1015,7 @@ void BMSSongLoader::AddToSong()
} }
/*=========================================================================== /*===========================================================================*/
*===========================================================================
*===========================================================================
*===========================================================================
*/
bool BMSLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps & out ) bool BMSLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps & out )
{ {
@@ -1068,7 +1035,6 @@ bool BMSLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps & out
bool BMSLoader::LoadFromDir( const RString &sDir, Song &out ) bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
{ {
LOG->Trace( "Song::LoadFromBMSDir(%s)", sDir.c_str() ); LOG->Trace( "Song::LoadFromBMSDir(%s)", sDir.c_str() );
ASSERT( out.m_vsKeysoundFile.empty() ); ASSERT( out.m_vsKeysoundFile.empty() );
@@ -1091,7 +1057,6 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
} }
/* /*
* (c) 2001-2004 Chris Danford, Glenn Maynard * (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved. * All rights reserved.