From 62ac849c959ea65be6f37af1c5e3a0b6073b5715 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Wed, 27 Jul 2011 22:56:00 -0400 Subject: [PATCH] [timing] Better implementation of stop stuff. --- src/NotesWriterSM.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index a33fc0a241..bc7e769b03 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -102,24 +102,36 @@ static void WriteGlobalTags( RageFile &f, Song &out ) } // TODO: make Delays into Stops that start one row before. - - f.Write( "#STOPS:" ); vector &stops = timing.allTimingSegments[SEGMENT_STOP]; + vector &delays = timing.allTimingSegments[SEGMENT_DELAY]; + + map allPauses; for( unsigned i=0; i(stops[i]); - float fBeat = fs->GetBeat(); - // if (fs->GetDelay()) fBeat--; - - f.PutLine( ssprintf( "%.3f=%.3f", fBeat, fs->GetPause() ) ); - if( i != stops.size()-1 ) - f.Write( "," ); + allPauses.insert(pair(fs->GetBeat(), + fs->GetPause())); if( fs->GetPause() < 0 ) { stops.erase(stops.begin()+i,stops.begin()+i+1 ); i--; } } + // Delays can't be negative: thus, no effect. + FOREACH(TimingSegment *, delays, ss) + { + allPauses.insert(pair(NoteRowToBeat((*ss)->GetRow() - 1), + static_cast(*ss)->GetPause())); + } + + f.Write( "#STOPS:" ); + vector stopLines; + FOREACHM(float, float, allPauses, ap) + { + stopLines.push_back(ssprintf("%.3f=%.3f", ap->first, ap->second)); + } + f.PutLine(join(",\n", stopLines)); + f.PutLine( ";" ); FOREACH_BackgroundLayer( b )