CombineCompositeNoteData(). This will not let you place a note inside a hold note that already exists. Use this when loading from a string as well.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "NoteDataUtil.h"
|
#include "NoteDataUtil.h"
|
||||||
|
#include "NoteData.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "PlayerOptions.h"
|
#include "PlayerOptions.h"
|
||||||
@@ -90,7 +91,6 @@ static void LoadFromSMNoteDataStringWithPlayer( NoteData& out, const RString &sS
|
|||||||
|
|
||||||
for( unsigned l=0; l<aMeasureLines.size(); l++ )
|
for( unsigned l=0; l<aMeasureLines.size(); l++ )
|
||||||
{
|
{
|
||||||
//RString &sMeasureLine = asMeasureLines[l];
|
|
||||||
const char *p = aMeasureLines[l].first;
|
const char *p = aMeasureLines[l].first;
|
||||||
const char *const beginLine = p;
|
const char *const beginLine = p;
|
||||||
const char *const endLine = aMeasureLines[l].second;
|
const char *const endLine = aMeasureLines[l].second;
|
||||||
@@ -99,7 +99,6 @@ static void LoadFromSMNoteDataStringWithPlayer( NoteData& out, const RString &sS
|
|||||||
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
|
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
|
||||||
const int iIndex = BeatToNoteRow( fBeat );
|
const int iIndex = BeatToNoteRow( fBeat );
|
||||||
|
|
||||||
//const char *p = sMeasureLine;
|
|
||||||
int iTrack = 0;
|
int iTrack = 0;
|
||||||
while( iTrack < iNumTracks && p < endLine )
|
while( iTrack < iNumTracks && p < endLine )
|
||||||
{
|
{
|
||||||
@@ -275,14 +274,20 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNo
|
|||||||
|
|
||||||
int start = 0, size = -1;
|
int start = 0, size = -1;
|
||||||
|
|
||||||
|
vector<NoteData> vParts;
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
{
|
{
|
||||||
// Split in place.
|
// Split in place.
|
||||||
split( sSMNoteData, "&", start, size, false );
|
split( sSMNoteData, "&", start, size, false );
|
||||||
if( unsigned(start) == sSMNoteData.size() )
|
if( unsigned(start) == sSMNoteData.size() )
|
||||||
break;
|
break;
|
||||||
LoadFromSMNoteDataStringWithPlayer( out, sSMNoteData, start, size, pn, iNumTracks );
|
vParts.push_back( NoteData() );
|
||||||
|
NoteData &nd = vParts.back();
|
||||||
|
|
||||||
|
nd.SetNumTracks( iNumTracks );
|
||||||
|
LoadFromSMNoteDataStringWithPlayer( nd, sSMNoteData, start, size, pn, iNumTracks );
|
||||||
}
|
}
|
||||||
|
CombineCompositeNoteData( out, vParts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::InsertHoldTails( NoteData &inout )
|
void NoteDataUtil::InsertHoldTails( NoteData &inout )
|
||||||
@@ -418,6 +423,28 @@ void NoteDataUtil::SplitCompositeNoteData( const NoteData &in, vector<NoteData>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NoteDataUtil::CombineCompositeNoteData( NoteData &out, const vector<NoteData> &in )
|
||||||
|
{
|
||||||
|
FOREACH_CONST( NoteData, in, nd )
|
||||||
|
{
|
||||||
|
const int iMaxTracks = min( out.GetNumTracks(), nd->GetNumTracks() );
|
||||||
|
|
||||||
|
for( int track = 0; track < iMaxTracks; ++track )
|
||||||
|
{
|
||||||
|
for( NoteData::const_iterator i = nd->begin(track); i != nd->end(track); ++i )
|
||||||
|
{
|
||||||
|
int row = i->first;
|
||||||
|
if( out.IsHoldNoteAtRow(track, i->first) )
|
||||||
|
continue;
|
||||||
|
if( i->second.type == TapNote::hold_head )
|
||||||
|
out.AddHoldNote( track, row, row + i->second.iDuration, i->second );
|
||||||
|
else
|
||||||
|
out.SetTapNote( track, row, i->second );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks )
|
void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
#ifndef NOTEDATAUTIL_H
|
#ifndef NOTEDATAUTIL_H
|
||||||
#define NOTEDATAUTIL_H
|
#define NOTEDATAUTIL_H
|
||||||
|
|
||||||
#include "GameConstantsAndTypes.h" // for RadarCategory
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "NoteTypes.h"
|
#include "NoteTypes.h"
|
||||||
#include "NoteData.h"
|
|
||||||
|
|
||||||
class PlayerOptions;
|
class PlayerOptions;
|
||||||
struct RadarValues;
|
struct RadarValues;
|
||||||
|
class NoteData;
|
||||||
|
class Song;
|
||||||
|
struct AttackArray;
|
||||||
|
|
||||||
/* Utils for NoteData. Things should go in here if they can be (cleanly and
|
/* Utils for NoteData. Things should go in here if they can be (cleanly and
|
||||||
* efficiently) implemented using only NoteData's primitives; this improves
|
* efficiently) implemented using only NoteData's primitives; this improves
|
||||||
@@ -20,6 +22,7 @@ namespace NoteDataUtil
|
|||||||
void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData, bool bComposite );
|
void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData, bool bComposite );
|
||||||
void GetSMNoteDataString( const NoteData &in, RString ¬es_out );
|
void GetSMNoteDataString( const NoteData &in, RString ¬es_out );
|
||||||
void SplitCompositeNoteData( const NoteData &in, vector<NoteData> &out );
|
void SplitCompositeNoteData( const NoteData &in, vector<NoteData> &out );
|
||||||
|
void CombineCompositeNoteData( NoteData &out, const vector<NoteData> &in );
|
||||||
void LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks );
|
void LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks );
|
||||||
void LoadOverlapped( const NoteData &in, NoteData &out, int iNewNumTracks );
|
void LoadOverlapped( const NoteData &in, NoteData &out, int iNewNumTracks );
|
||||||
void LoadTransformedLights( const NoteData &in, NoteData &out, int iNewNumTracks );
|
void LoadTransformedLights( const NoteData &in, NoteData &out, int iNewNumTracks );
|
||||||
|
|||||||
Reference in New Issue
Block a user