fix "impossible" dance-double patterns produced by autogen

This commit is contained in:
Chris Danford
2003-08-07 07:18:43 +00:00
parent 1873e70c89
commit ce28877677
4 changed files with 53 additions and 4 deletions
-1
View File
@@ -520,4 +520,3 @@ void NoteData::SetTapNote(int track, int row, TapNote t)
PadTapNotes(row);
m_TapNotes[track][row]=t;
}
+7 -1
View File
@@ -7,7 +7,7 @@
Desc: Holds data about the notes that the player is supposed to hit. NoteData
is organized by:
track - corresponds to different columns of notes on the screen
index - corresponds to subdivisions of beats
row/index - corresponds to subdivisions of beats
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
@@ -133,6 +133,12 @@ public:
void Convert4sToHoldNotes();
void ConvertHoldNotesTo4s();
// True if no notes in row that aren't true in the mask
bool RowPassesValidMask( int row, bool bValidMask[] );
// Remove all tap notes that fail this mask
void EliminateNonPassingTaps( int row, bool bValidMask[] );
};
+40 -2
View File
@@ -823,9 +823,47 @@ void NoteDataUtil::ShiftRight( NoteData &in )
}
//NUM_STEPS_TYPES
struct ValidRow
{
StepsType st;
bool bValidMask[MAX_NOTE_TRACKS];
};
#define T true
#define f false
const ValidRow g_ValidRows[] =
{
{ STEPS_TYPE_DANCE_DOUBLE, { T,T,T,T,f,f,f,f } },
{ STEPS_TYPE_DANCE_DOUBLE, { f,T,T,T,T,f,f,f } },
{ STEPS_TYPE_DANCE_DOUBLE, { f,f,f,T,T,T,T,f } },
{ STEPS_TYPE_DANCE_DOUBLE, { f,f,f,f,T,T,T,T } },
};
void NoteDataUtil::FixImpossibleRows( NoteData &in, StepsType st )
{
for( int i=0; i<ARRAYSIZE(g_ValidRows); i++ )
{
const ValidRow vr = g_ValidRows[i];
if( vr.st != st )
continue; // skip
for( int r=0; r<=in.GetLastRow(); r++ )
if( !NoteDataUtil::RowPassesValidMask(in,r,vr.bValidMask) ) // failed mask
NoteDataUtil::EliminateNonPassingTaps(in,r,vr.bValidMask);
}
}
bool NoteDataUtil::RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] )
{
for( int t=0; t<in.GetNumTracks(); t++ )
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY )
return false;
return true;
}
void NoteDataUtil::EliminateNonPassingTaps( NoteData &in, int row, const bool bValidMask[] )
{
for( int t=0; t<in.GetNumTracks(); t++ )
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY )
in.SetTapNote(t,row,TAP_EMPTY);
}
+6
View File
@@ -64,6 +64,12 @@ namespace NoteDataUtil
inline void SnapToNearestNoteType( NoteData &in, NoteType nt, float fBeginBeat, float fEndBeat ) { SnapToNearestNoteType( in, nt, (NoteType)-1, fBeginBeat, fEndBeat ); }
void FixImpossibleRows( NoteData &in, StepsType st );
// True if no notes in row that aren't true in the mask
bool RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] );
// Remove all tap notes that fail this mask
void EliminateNonPassingTaps( NoteData &in, int row, const bool bValidMask[] );
};
#endif