simplify/optimize

This commit is contained in:
Glenn Maynard
2003-10-27 04:23:08 +00:00
parent 0eaa9aa178
commit d7e040923c
2 changed files with 18 additions and 33 deletions
+10 -25
View File
@@ -510,14 +510,9 @@ void NoteDataUtil::Wide( NoteData &in, float fStartBeat, float fEndBeat )
/* Start on an even beat. */
fStartBeat = froundf( fStartBeat, 2 );
int first_row = 0;
if( fStartBeat != -1 )
first_row = BeatToNoteRow(fStartBeat);
const int first_row = BeatToNoteRow( fStartBeat );
const int last_row = min( BeatToNoteRow(fEndBeat), in.GetLastRow() );
int last_row = in.GetLastRow();
if( fEndBeat != -1 )
last_row = BeatToNoteRow(fEndBeat);
for( int i=first_row; i<last_row; i+=ROWS_PER_BEAT*2 ) // every even beat
{
if( in.GetNumTapNonEmptyTracks(i) != 1 )
@@ -580,21 +575,16 @@ void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, flo
in.ConvertHoldNotesTo4s();
/* Start on an integral beat. */
fStartBeat = roundf( fStartBeat );
/* Start on a multiple of fBeatInterval. */
fStartBeat = froundf( fStartBeat, fBeatInterval );
// Insert a beat in the middle of every fBeatInterval.
const int first_row = BeatToNoteRow( fStartBeat );
const int last_row = min( BeatToNoteRow(fEndBeat), in.GetLastRow() );
int first_row = 0;
if( fStartBeat != -1 )
first_row = BeatToNoteRow(fStartBeat);
const int rows_per_interval = BeatToNoteRow( fBeatInterval );
const int insert_row_offset = BeatToNoteRow( fInsertBeatOffset );
int last_row = in.GetLastRow();
if( fEndBeat != -1 )
last_row = BeatToNoteRow(fEndBeat);
int rows_per_interval = BeatToNoteRow( fBeatInterval );
int insert_row_offset = BeatToNoteRow( fInsertBeatOffset );
for( int i=first_row; i<last_row; i+=rows_per_interval )
{
int iRowEarlier = i;
@@ -651,13 +641,8 @@ void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, flo
void NoteDataUtil::Mines( NoteData &in, float fStartBeat, float fEndBeat )
{
int first_row = 0;
if( fStartBeat != -1 )
first_row = BeatToNoteRow(fStartBeat);
int last_row = in.GetLastRow();
if( fEndBeat != -1 )
last_row = BeatToNoteRow(fEndBeat);
const int first_row = BeatToNoteRow( fStartBeat );
const int last_row = min( BeatToNoteRow(fEndBeat), in.GetLastRow() );
//
// Change whole rows at a time to be tap notes. Otherwise, it causes
+8 -8
View File
@@ -42,13 +42,13 @@ namespace NoteDataUtil
void RemoveHoldNotes( NoteData &in );
enum TurnType { left, right, mirror, shuffle, super_shuffle, NUM_TURN_TYPES };
void Turn( NoteData &in, StepsType st, TurnType tt );
void Little( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
void Wide( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
void Big( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
void Quick( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
void Skippy( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
void Mines( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
void InsertIntelligentTaps( NoteData &in, float fBeatInterval, float fInsertBeatOffset, bool bSkippy, float fStartBeat = -1, float fEndBeat = -1 );
void Little( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void Wide( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void Big( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void Quick( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void Skippy( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void Mines( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void InsertIntelligentTaps( NoteData &in, float fBeatInterval, float fInsertBeatOffset, bool bSkippy, float fStartBeat = 0, float fEndBeat = 99999 );
void SuperShuffleTaps( NoteData &in );
// change all TAP_ADDITIONs to TAP_TAPs
@@ -73,7 +73,7 @@ namespace NoteDataUtil
// True if no notes in row that aren't true in the mask
bool RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] );
void TransformNoteData( NoteData &nd, const PlayerOptions &po, StepsType st, float fStartBeat = -1, float fEndBeat = -1 );
void TransformNoteData( NoteData &nd, const PlayerOptions &po, StepsType st, float fStartBeat = 0, float fEndBeat = 99999 );
void Scale( NoteData &nd, float fScale );