quantize rows when reading from BMSs so that we don't end up with 2MB cache files

This commit is contained in:
Chris Danford
2004-10-24 17:36:13 +00:00
parent fe3af94ea9
commit bb0da6a289
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -1290,7 +1290,7 @@ void NoteDataUtil::SnapToNearestNoteType( NoteData &inout, NoteType nt1, NoteTyp
case NOTE_TYPE_32ND: fSnapInterval2 = 1/8.0f; break;
case NOTE_TYPE_48TH: fSnapInterval2 = 1/12.0f; break;
case NOTE_TYPE_64TH: fSnapInterval2 = 1/16.0f; break;
case -1: fSnapInterval2 = 10000; break; // nothing will ever snap to this. That's what we want!
case NOTE_TYPE_INVALID: fSnapInterval2 = 10000; break; // nothing will ever snap to this. That's what we want!
default: ASSERT( false ); return;
}
+4 -1
View File
@@ -78,7 +78,10 @@ namespace NoteDataUtil
void SnapToNearestNoteType( NoteData &inout, NoteType nt1, NoteType nt2, float fBeginBeat, float fEndBeat );
inline void SnapToNearestNoteType( NoteData &inout, NoteType nt, float fBeginBeat, float fEndBeat ) { SnapToNearestNoteType( inout, nt, (NoteType)-1, fBeginBeat, fEndBeat ); }
inline void SnapToNearestNoteType( NoteData &inout, NoteType nt, float fBeginBeat, float fEndBeat )
{
SnapToNearestNoteType( inout, nt, NOTE_TYPE_INVALID, fBeginBeat, fEndBeat );
}
void FixImpossibleRows( NoteData &inout, StepsType st );
+7 -2
View File
@@ -310,8 +310,13 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out, const map<CSt
{
float fPercentThroughMeasure = (float)j/(float)uNumNotesInThisMeasure;
const int row = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_PER_MEASURE * ROWS_PER_BEAT );
int row = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_PER_MEASURE * ROWS_PER_BEAT );
// some BMS files seem to have funky alignment, causing us to write gigantic cache files.
// Try to correct for this by quantizing.
row = froundf( row, ROWS_PER_MEASURE/64 );
BmsTrack bmsTrack;
bool bIsHold;
if( ConvertRawTrackToTapNote(iRawTrackNum, bmsTrack, bIsHold) )