From e3e16ee2e038683d1d7b329c62dbf83da9eb8182 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Tue, 17 May 2011 16:00:05 -0400 Subject: [PATCH] [splittiming] Warps to Negs to Gone again. We're almost ready to bring this branch to default. --- src/NotesWriterSM.cpp | 27 +++++++++++++++++++++++++-- src/NotesWriterSM.h | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index af224d0a2b..55bbeeb65c 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -48,7 +48,7 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc ) * @brief Write out the common tags for .SM files. * @param f the file in question. * @param out the Song in question. */ -static void WriteGlobalTags( RageFile &f, const Song &out ) +static void WriteGlobalTags( RageFile &f, Song &out ) { f.PutLine( ssprintf( "#TITLE:%s;", SmEscape(out.m_sMainTitle).c_str() ) ); f.PutLine( ssprintf( "#SUBTITLE:%s;", SmEscape(out.m_sSubTitle).c_str() ) ); @@ -107,6 +107,22 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) f.Write( "," ); } f.PutLine( ";" ); + + unsigned wSize = out.m_SongTiming.m_WarpSegments.size(); + if( wSize > 0 ) + { + for( unsigned i=0; i < wSize; i++ ) + { + int iRow = out.m_SongTiming.m_WarpSegments[i].m_iStartRow; + float fBPS = 60 / out.m_SongTiming.GetBPMAtRow(iRow); + float fSkip = fBPS * out.m_SongTiming.m_WarpSegments[i].m_fLengthBeats; + StopSegment ss; + ss.m_iStartRow = iRow; + ss.m_fStopSeconds = -fSkip; + ss.m_bDelay = false; // Best to be sure. + out.m_SongTiming.AddStopSegment( ss ); + } + } f.Write( "#STOPS:" ); for( unsigned i=0; i& vpStepsToSave ) +bool NotesWriterSM::Write( RString sPath, Song &out, const vector& vpStepsToSave ) { int flags = RageFile::WRITE; diff --git a/src/NotesWriterSM.h b/src/NotesWriterSM.h index ee0ed26441..580953cdac 100644 --- a/src/NotesWriterSM.h +++ b/src/NotesWriterSM.h @@ -11,7 +11,7 @@ namespace NotesWriterSM * @param sPath the path to write the file. * @param out the Song to be written out. * @return its success or failure. */ - bool Write( RString sPath, const Song &out, const vector& vpStepsToSave ); + bool Write( RString sPath, Song &out, const vector& vpStepsToSave ); /** * @brief Get some contents about the edit file first. * @param pSong the Song in question.