reduce use of 4s
This commit is contained in:
+39
-16
@@ -267,16 +267,38 @@ void NoteData::RemoveHoldNote( int iHoldIndex )
|
|||||||
m_HoldNotes.erase(m_HoldNotes.begin()+iHoldIndex, m_HoldNotes.begin()+iHoldIndex+1);
|
m_HoldNotes.erase(m_HoldNotes.begin()+iHoldIndex, m_HoldNotes.begin()+iHoldIndex+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a hold note with the same track and end row as hn. */
|
/* Return true if a hold note lies on the given spot. Must be in 2sAnd3s. */
|
||||||
int NoteData::GetMatchingHoldNote( const HoldNote &hn ) const
|
bool NoteData::IsHoldNoteAtBeat( int iTrack, int iRow ) const
|
||||||
{
|
{
|
||||||
for( int i=0; i<GetNumHoldNotes(); i++ ) // for each HoldNote
|
/* Starting at iRow, search upwards. If we find a TapNote::hold_head, we're within
|
||||||
|
* a hold. If we find a tap, mine or attack, we're not--those never lie within hold
|
||||||
|
* notes. Ignore autoKeysound. */
|
||||||
|
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE_REVERSE( *this, iTrack, r, iRow, 0 )
|
||||||
{
|
{
|
||||||
const HoldNote &ret = GetHoldNote(i);
|
const TapNote &tn = GetTapNote( iTrack, r );
|
||||||
if( ret.iTrack == hn.iTrack && ret.iEndRow == hn.iEndRow )
|
switch( tn.type )
|
||||||
return i;
|
{
|
||||||
|
case TapNote::hold_head:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case TapNote::tap:
|
||||||
|
case TapNote::mine:
|
||||||
|
case TapNote::attack:
|
||||||
|
case TapNote::hold_tail:
|
||||||
|
return false;
|
||||||
|
case TapNote::empty:
|
||||||
|
case TapNote::autoKeysound:
|
||||||
|
/* ignore */
|
||||||
|
continue;
|
||||||
|
case TapNote::hold:
|
||||||
|
/* Don't call this function when in 4s mode! */
|
||||||
|
FAIL_M("hold");
|
||||||
|
default:
|
||||||
|
FAIL_M( ssprintf("%i", tn.type) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FAIL_M( ssprintf("%i..%i, %i", hn.iStartRow, hn.iEndRow, hn.iTrack) );
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NoteData::GetFirstRow() const
|
int NoteData::GetFirstRow() const
|
||||||
@@ -581,30 +603,31 @@ void NoteData::ConvertHoldNotesTo4s()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -1 for iOriginalTracksToTakeFrom means no track
|
// -1 for iOriginalTracksToTakeFrom means no track
|
||||||
void NoteData::LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
|
void NoteData::LoadTransformed( const NoteData& in, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
|
||||||
{
|
{
|
||||||
// reset all notes
|
// reset all notes
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
NoteData Original;
|
|
||||||
Original.To4s( original );
|
|
||||||
|
|
||||||
Config( Original );
|
|
||||||
SetNumTracks( iNewNumTracks );
|
SetNumTracks( iNewNumTracks );
|
||||||
|
|
||||||
// copy tracks
|
// copy tracks
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
const int iOriginalTrack = iOriginalTrackToTakeFrom[t];
|
const int iOriginalTrack = iOriginalTrackToTakeFrom[t];
|
||||||
ASSERT_M( iOriginalTrack < Original.GetNumTracks(), ssprintf("from %i >= %i (to %i)",
|
ASSERT_M( iOriginalTrack < in.GetNumTracks(), ssprintf("from %i >= %i (to %i)",
|
||||||
iOriginalTrack, Original.GetNumTracks(), iOriginalTrackToTakeFrom[t]));
|
iOriginalTrack, in.GetNumTracks(), iOriginalTrackToTakeFrom[t]));
|
||||||
|
|
||||||
if( iOriginalTrack == -1 )
|
if( iOriginalTrack == -1 )
|
||||||
continue;
|
continue;
|
||||||
m_TapNotes[t] = Original.m_TapNotes[iOriginalTrack];
|
m_TapNotes[t] = in.m_TapNotes[iOriginalTrack];
|
||||||
}
|
}
|
||||||
|
|
||||||
Convert4sToHoldNotes();
|
// copy holds
|
||||||
|
for( int i=0; i<in.GetNumHoldNotes(); i++ ) // for each HoldNote
|
||||||
|
{
|
||||||
|
const HoldNote &hn = in.GetHoldNote(i);
|
||||||
|
this->AddHoldNote( hn );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteData::MoveTapNoteTrack( int dest, int src )
|
void NoteData::MoveTapNoteTrack( int dest, int src )
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
void RemoveHoldNote( int index );
|
void RemoveHoldNote( int index );
|
||||||
HoldNote &GetHoldNote( int index ) { ASSERT( index < (int) m_HoldNotes.size() ); return m_HoldNotes[index]; }
|
HoldNote &GetHoldNote( int index ) { ASSERT( index < (int) m_HoldNotes.size() ); return m_HoldNotes[index]; }
|
||||||
const HoldNote &GetHoldNote( int index ) const { ASSERT( index < (int) m_HoldNotes.size() ); return m_HoldNotes[index]; }
|
const HoldNote &GetHoldNote( int index ) const { ASSERT( index < (int) m_HoldNotes.size() ); return m_HoldNotes[index]; }
|
||||||
int GetMatchingHoldNote( const HoldNote &hn ) const;
|
bool IsHoldNoteAtBeat( int iTrack, int iRow ) const; /* must be in 2sAnd3s */
|
||||||
|
|
||||||
//
|
//
|
||||||
// statistics
|
// statistics
|
||||||
|
|||||||
@@ -387,13 +387,11 @@ void NoteDataUtil::LoadTransformedLights( const NoteData &in, NoteData &out, int
|
|||||||
out.Init();
|
out.Init();
|
||||||
|
|
||||||
NoteData Original;
|
NoteData Original;
|
||||||
Original.To4s( in );
|
Original.To2sAnd3s( in );
|
||||||
|
|
||||||
out.Config(in);
|
|
||||||
out.SetNumTracks( iNewNumTracks );
|
out.SetNumTracks( iNewNumTracks );
|
||||||
|
|
||||||
int iLastRow = Original.GetLastRow();
|
FOREACH_NONEMPTY_ROW_ALL_TRACKS( in, r )
|
||||||
for( int r=0; r <= iLastRow; ++r )
|
|
||||||
{
|
{
|
||||||
if( Original.IsRowEmpty( r ) )
|
if( Original.IsRowEmpty( r ) )
|
||||||
continue;
|
continue;
|
||||||
@@ -404,7 +402,7 @@ void NoteDataUtil::LoadTransformedLights( const NoteData &in, NoteData &out, int
|
|||||||
* don't write huge streams of tap notes. */
|
* don't write huge streams of tap notes. */
|
||||||
bool bHoldNoteOnThisRow = false;
|
bool bHoldNoteOnThisRow = false;
|
||||||
for( int t=0; t<Original.GetNumTracks(); t++ )
|
for( int t=0; t<Original.GetNumTracks(); t++ )
|
||||||
if( Original.GetTapNote(t,r).type == TapNote::hold )
|
if( Original.IsHoldNoteAtBeat(t,r) )
|
||||||
bHoldNoteOnThisRow = true;
|
bHoldNoteOnThisRow = true;
|
||||||
|
|
||||||
for( int t=0; t<out.GetNumTracks(); t++ )
|
for( int t=0; t<out.GetNumTracks(); t++ )
|
||||||
@@ -414,7 +412,7 @@ void NoteDataUtil::LoadTransformedLights( const NoteData &in, NoteData &out, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out.Convert4sToHoldNotes();
|
out.Convert2sAnd3sToHoldNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::GetRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out )
|
void NoteDataUtil::GetRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out )
|
||||||
|
|||||||
Reference in New Issue
Block a user