improve planted, twister
This commit is contained in:
@@ -163,6 +163,13 @@ int NoteData::GetNumTapNonEmptyTracks( int index ) const
|
|||||||
return iNum;
|
return iNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NoteData::GetTapNonEmptyTracks( int index, set<int>& addTo ) const
|
||||||
|
{
|
||||||
|
for( int t=0; t<m_iNumTracks; t++ )
|
||||||
|
if( GetTapNote(t, index) != TAP_EMPTY )
|
||||||
|
addTo.insert(t);
|
||||||
|
}
|
||||||
|
|
||||||
int NoteData::GetFirstNonEmptyTrack( int index ) const
|
int NoteData::GetFirstNonEmptyTrack( int index ) const
|
||||||
{
|
{
|
||||||
/* If this is out of range, we don't have any notes there, so all tracks are empty. */
|
/* If this is out of range, we don't have any notes there, so all tracks are empty. */
|
||||||
@@ -939,20 +946,19 @@ void NoteData::EliminateAllButOneTap(int row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteData::GetTracksHeldAtRow( int row, vector<int>& viTracksOut )
|
void NoteData::GetTracksHeldAtRow( int row, set<int>& addTo )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_HoldNotes.size(); i++ )
|
for( unsigned i=0; i<m_HoldNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
const HoldNote& hn = m_HoldNotes[i];
|
const HoldNote& hn = m_HoldNotes[i];
|
||||||
|
|
||||||
if( hn.RowIsInRange(row) )
|
if( hn.RowIsInRange(row) )
|
||||||
viTracksOut.push_back( hn.iTrack );
|
addTo.insert( hn.iTrack );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int NoteData::GetNumTracksHeldAtRow( int row )
|
int NoteData::GetNumTracksHeldAtRow( int row )
|
||||||
{
|
{
|
||||||
static vector<int> viTracks;
|
static set<int> viTracks;
|
||||||
viTracks.clear();
|
viTracks.clear();
|
||||||
GetTracksHeldAtRow( row, viTracks );
|
GetTracksHeldAtRow( row, viTracks );
|
||||||
return viTracks.size();
|
return viTracks.size();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "NoteTypes.h"
|
#include "NoteTypes.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include "Attack.h"
|
#include "Attack.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ public:
|
|||||||
bool IsRowEmpty( int index ) const;
|
bool IsRowEmpty( int index ) const;
|
||||||
bool IsRangeEmpty( int track, int iIndexBegin, int iIndexEnd ) const;
|
bool IsRangeEmpty( int track, int iIndexBegin, int iIndexEnd ) const;
|
||||||
int GetNumTapNonEmptyTracks( int index ) const;
|
int GetNumTapNonEmptyTracks( int index ) const;
|
||||||
|
void GetTapNonEmptyTracks( int index, set<int>& addTo ) const;
|
||||||
int GetFirstNonEmptyTrack( int index ) const;
|
int GetFirstNonEmptyTrack( int index ) const;
|
||||||
int GetNumTracksWithTap( int index ) const;
|
int GetNumTracksWithTap( int index ) const;
|
||||||
int GetNumTracksWithTapOrHoldHead( int index ) const;
|
int GetNumTracksWithTapOrHoldHead( int index ) const;
|
||||||
@@ -91,7 +93,7 @@ public:
|
|||||||
{
|
{
|
||||||
return GetFirstTrackWithTapOrHoldHead( index ) != -1;
|
return GetFirstTrackWithTapOrHoldHead( index ) != -1;
|
||||||
}
|
}
|
||||||
void GetTracksHeldAtRow( int row, vector<int>& viTracksOut );
|
void GetTracksHeldAtRow( int row, set<int>& addTo );
|
||||||
int GetNumTracksHeldAtRow( int row );
|
int GetNumTracksHeldAtRow( int row );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ void NoteDataUtil::RemoveSimultaneousNotes(NoteData &in, int iMaxSimultaneous, f
|
|||||||
if( in.IsRowEmpty(r) )
|
if( in.IsRowEmpty(r) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
vector<int> viTracksHeld;
|
set<int> viTracksHeld;
|
||||||
in.GetTracksHeldAtRow( r, viTracksHeld );
|
in.GetTracksHeldAtRow( r, viTracksHeld );
|
||||||
|
|
||||||
// remove the first tap note or the first hold note that starts on this row
|
// remove the first tap note or the first hold note that starts on this row
|
||||||
@@ -993,7 +993,7 @@ void NoteDataUtil::Echo( NoteData &in, float fStartBeat, float fEndBeat )
|
|||||||
|
|
||||||
const int iRowEcho = r + rows_per_interval;
|
const int iRowEcho = r + rows_per_interval;
|
||||||
{
|
{
|
||||||
vector<int> viTracks;
|
set<int> viTracks;
|
||||||
in.GetTracksHeldAtRow( iRowEcho, viTracks );
|
in.GetTracksHeldAtRow( iRowEcho, viTracks );
|
||||||
|
|
||||||
// don't lay if holding 2 already
|
// don't lay if holding 2 already
|
||||||
@@ -1024,38 +1024,54 @@ void NoteDataUtil::ConvertTapsToHolds( NoteData &in, int iSimultaneousHolds, flo
|
|||||||
const int last_row = min( BeatToNoteRow(fEndBeat), in.GetLastRow() );
|
const int last_row = min( BeatToNoteRow(fEndBeat), in.GetLastRow() );
|
||||||
for( int r=first_row; r<=last_row; r++ )
|
for( int r=first_row; r<=last_row; r++ )
|
||||||
{
|
{
|
||||||
|
int iTrackAddedThisRow = 0;
|
||||||
for( int t=0; t<in.GetNumTracks(); t++ )
|
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
|
if( iTrackAddedThisRow > iSimultaneousHolds )
|
||||||
|
break;
|
||||||
|
|
||||||
if( in.GetTapNote(t,r) == TAP_TAP )
|
if( in.GetTapNote(t,r) == TAP_TAP )
|
||||||
{
|
{
|
||||||
// search for row of next TAP_TAP
|
// Find the ending row for this hold
|
||||||
int iTapsLeft = iSimultaneousHolds;
|
int iTapsLeft = iSimultaneousHolds;
|
||||||
int r2;
|
|
||||||
for( r2=r+1; r2<=last_row; r2++ )
|
int r2 = r+1;
|
||||||
{
|
for( ; r2<=last_row; r2++ )
|
||||||
if( !in.IsRowEmpty(r2) )
|
|
||||||
{
|
{
|
||||||
|
// quick test
|
||||||
|
if( in.IsRowEmpty(r2) )
|
||||||
|
continue;
|
||||||
|
|
||||||
// If there are two taps in a row on the same track,
|
// If there are two taps in a row on the same track,
|
||||||
// don't convert the earlier one to a hold.
|
// don't convert the earlier one to a hold.
|
||||||
if( in.GetFirstTrackWithTapOrHoldHead(r2) == t )
|
if( in.GetTapNote(t,r2) != TAP_EMPTY )
|
||||||
goto dont_add_hold;
|
goto dont_add_hold;
|
||||||
iTapsLeft--;
|
|
||||||
|
set<int> tracksDown;
|
||||||
|
in.GetTracksHeldAtRow( r2, tracksDown );
|
||||||
|
in.GetTapNonEmptyTracks( r2, tracksDown );
|
||||||
|
iTapsLeft -= tracksDown.size();
|
||||||
if( iTapsLeft == 0 )
|
if( iTapsLeft == 0 )
|
||||||
break; // stop searching
|
break; // we found the ending row for this hold
|
||||||
}
|
else if( iTapsLeft < 0 )
|
||||||
|
goto dont_add_hold;
|
||||||
}
|
}
|
||||||
float fStartBeat = NoteRowToBeat(r);
|
float fStartBeat = NoteRowToBeat(r);
|
||||||
float fEndBeat = NoteRowToBeat(r2);
|
float fEndBeat = NoteRowToBeat(r2);
|
||||||
|
|
||||||
// If the steps end in a tap, convert that tap
|
// If the steps end in a tap, convert that tap
|
||||||
// to a hold that lasts for at least one beat.
|
// to a hold that lasts for at least one beat.
|
||||||
if( r2==r+1 )
|
if( r2==r+1 )
|
||||||
fEndBeat = fStartBeat+1;
|
fEndBeat = fStartBeat+1;
|
||||||
|
|
||||||
in.AddHoldNote( HoldNote(t,BeatToNoteRow(fStartBeat),BeatToNoteRow(fEndBeat)) );
|
in.AddHoldNote( HoldNote(t,BeatToNoteRow(fStartBeat),BeatToNoteRow(fEndBeat)) );
|
||||||
|
iTrackAddedThisRow++;
|
||||||
}
|
}
|
||||||
dont_add_hold:
|
dont_add_hold:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Stomp( NoteData &in, StepsType st, float fStartBeat, float fEndBeat )
|
void NoteDataUtil::Stomp( NoteData &in, StepsType st, float fStartBeat, float fEndBeat )
|
||||||
|
|||||||
Reference in New Issue
Block a user