From ada0c3cdd0adaad271243bbf9d44bab15b852b71 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 6 Jan 2013 21:15:36 -0500 Subject: [PATCH] Restore storing to 6 decimals. --- src/NotesWriterSM.cpp | 18 +++++++++--------- src/NotesWriterSSC.cpp | 34 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index 9beb8d9328..8f131b9210 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -39,12 +39,12 @@ static void WriteGlobalTags( RageFile &f, Song &out ) f.PutLine( ssprintf( "#LYRICSPATH:%s;", SmEscape(out.m_sLyricsFile).c_str() ) ); f.PutLine( ssprintf( "#CDTITLE:%s;", SmEscape(out.m_sCDTitleFile).c_str() ) ); f.PutLine( ssprintf( "#MUSIC:%s;", SmEscape(out.m_sMusicFile).c_str() ) ); - f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) ); - f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) ); - f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) ); + f.PutLine( ssprintf( "#OFFSET:%.6f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) ); + f.PutLine( ssprintf( "#SAMPLESTART:%.6f;", out.m_fMusicSampleStartSeconds ) ); + f.PutLine( ssprintf( "#SAMPLELENGTH:%.6f;", out.m_fMusicSampleLengthSeconds ) ); float specBeat = out.GetSpecifiedLastBeat(); if( specBeat > 0 ) - f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", specBeat) ); + f.PutLine( ssprintf("#LASTBEATHINT:%.6f;", specBeat) ); f.Write( "#SELECTABLE:" ); switch(out.m_SelectionDisplay) @@ -64,9 +64,9 @@ static void WriteGlobalTags( RageFile &f, Song &out ) break; case DISPLAY_BPM_SPECIFIED: if( out.m_fSpecifiedBPMMin == out.m_fSpecifiedBPMMax ) - f.PutLine( ssprintf( "#DISPLAYBPM:%.3f;", out.m_fSpecifiedBPMMin ) ); + f.PutLine( ssprintf( "#DISPLAYBPM:%.6f;", out.m_fSpecifiedBPMMin ) ); else - f.PutLine( ssprintf( "#DISPLAYBPM:%.3f:%.3f;", + f.PutLine( ssprintf( "#DISPLAYBPM:%.6f:%.6f;", out.m_fSpecifiedBPMMin, out.m_fSpecifiedBPMMax ) ); break; case DISPLAY_BPM_RANDOM: @@ -81,7 +81,7 @@ static void WriteGlobalTags( RageFile &f, Song &out ) { const BPMSegment *bs = ToBPM(bpms[i]); - f.PutLine( ssprintf( "%.3f=%.3f", bs->GetBeat(), bs->GetBPM() ) ); + f.PutLine( ssprintf( "%.6f=%.6f", bs->GetBeat(), bs->GetBPM() ) ); if( i != bpms.size()-1 ) f.Write( "," ); } @@ -128,7 +128,7 @@ static void WriteGlobalTags( RageFile &f, Song &out ) vector stopLines; FOREACHM(float, float, allPauses, ap) { - stopLines.push_back(ssprintf("%.3f=%.3f", ap->first, ap->second)); + stopLines.push_back(ssprintf("%.6f=%.6f", ap->first, ap->second)); } f.PutLine(join(",\n", stopLines)); @@ -224,7 +224,7 @@ static RString GetSMNotesTag( const Song &song, const Steps &in ) for( RadarCategory rc = (RadarCategory)0; rc < categories; enum_add( rc, 1 ) ) { - asRadarValues.push_back( ssprintf("%.3f", rv[rc]) ); + asRadarValues.push_back( ssprintf("%.6f", rv[rc]) ); } } lines.push_back( ssprintf( " %s:", join(",",asRadarValues).c_str() ) ); diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index c6dc65a714..17db0285a4 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -44,16 +44,16 @@ struct TimingTagWriter { void Write( const int row, const char *value ) { - m_pvsLines->push_back( m_sNext + ssprintf( "%.3f=%s", NoteRowToBeat(row), value ) ); + m_pvsLines->push_back( m_sNext + ssprintf( "%.6f=%s", NoteRowToBeat(row), value ) ); m_sNext = ","; } - void Write( const int row, const float value ) { Write( row, ssprintf( "%.3f", value ) ); } + void Write( const int row, const float value ) { Write( row, ssprintf( "%.6f", value ) ); } void Write( const int row, const int value ) { Write( row, ssprintf( "%d", value ) ); } void Write( const int row, const int a, const int b ) { Write( row, ssprintf( "%d=%d", a, b ) ); } - void Write( const int row, const float a, const float b ) { Write( row, ssprintf( "%.3f=%.3f", a, b) ); } + void Write( const int row, const float a, const float b ) { Write( row, ssprintf( "%.6f=%.6f", a, b) ); } void Write( const int row, const float a, const float b, const unsigned short c ) - { Write( row, ssprintf( "%.3f=%.3f=%hd", a, b, c) ); } + { Write( row, ssprintf( "%.6f=%.6f=%hd", a, b, c) ); } void Init( const RString sTag ) { m_sNext = "#" + sTag + ":"; } void Finish( ) { m_pvsLines->push_back( ( m_sNext != "," ? m_sNext : "" ) + ";" ); } @@ -239,9 +239,9 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) f.PutLine( "#INSTRUMENTTRACK:" + s + ";\n" ); } } - f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) ); - f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) ); - f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) ); + f.PutLine( ssprintf( "#OFFSET:%.6f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) ); + f.PutLine( ssprintf( "#SAMPLESTART:%.6f;", out.m_fMusicSampleStartSeconds ) ); + f.PutLine( ssprintf( "#SAMPLELENGTH:%.6f;", out.m_fMusicSampleLengthSeconds ) ); f.Write( "#SELECTABLE:" ); switch(out.m_SelectionDisplay) @@ -260,9 +260,9 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) break; case DISPLAY_BPM_SPECIFIED: if( out.m_fSpecifiedBPMMin == out.m_fSpecifiedBPMMax ) - f.PutLine( ssprintf( "#DISPLAYBPM:%.3f;", out.m_fSpecifiedBPMMin ) ); + f.PutLine( ssprintf( "#DISPLAYBPM:%.6f;", out.m_fSpecifiedBPMMin ) ); else - f.PutLine( ssprintf( "#DISPLAYBPM:%.3f:%.3f;", out.m_fSpecifiedBPMMin, out.m_fSpecifiedBPMMax ) ); + f.PutLine( ssprintf( "#DISPLAYBPM:%.6f:%.6f;", out.m_fSpecifiedBPMMin, out.m_fSpecifiedBPMMax ) ); break; case DISPLAY_BPM_RANDOM: f.PutLine( ssprintf( "#DISPLAYBPM:*;" ) ); @@ -272,7 +272,7 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) WriteTimingTags( f, out.m_SongTiming, true ); if( out.GetSpecifiedLastSecond() > 0 ) - f.PutLine( ssprintf("#LASTSECONDHINT:%.3f;", out.GetSpecifiedLastSecond()) ); + f.PutLine( ssprintf("#LASTSECONDHINT:%.6f;", out.GetSpecifiedLastSecond()) ); FOREACH_BackgroundLayer( b ) { @@ -363,7 +363,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa { const RadarValues &rv = in.GetRadarValues( pn ); FOREACH_ENUM( RadarCategory, rc ) - asRadarValues.push_back( ssprintf("%.3f", rv[rc]) ); + asRadarValues.push_back( ssprintf("%.6f", rv[rc]) ); } lines.push_back( ssprintf( "#RADARVALUES:%s;", join(",",asRadarValues).c_str() ) ); @@ -372,7 +372,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa // XXX: Is there a better way to write this? if (const_cast(song.m_SongTiming) != in.m_Timing) { - lines.push_back( ssprintf( "#OFFSET:%.3f;", in.m_Timing.m_fBeat0OffsetInSeconds ) ); + lines.push_back( ssprintf( "#OFFSET:%.f;", in.m_Timing.m_fBeat0OffsetInSeconds ) ); GetTimingTags( lines, in.m_Timing ); } @@ -390,9 +390,9 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa float small = in.GetMinBPM(); float big = in.GetMaxBPM(); if (small == big) - lines.push_back( ssprintf( "#DISPLAYBPM:%.3f;", small ) ); + lines.push_back( ssprintf( "#DISPLAYBPM:%.6f;", small ) ); else - lines.push_back( ssprintf( "#DISPLAYBPM:%.3f:%.3f;", small, big ) ); + lines.push_back( ssprintf( "#DISPLAYBPM:%.6f:%.6f;", small, big ) ); break; } case DISPLAY_BPM_RANDOM: @@ -439,12 +439,12 @@ bool NotesWriterSSC::Write( RString sPath, const Song &out, const vector if( bSavingCache ) { f.PutLine( ssprintf( "// cache tags:" ) ); - f.PutLine( ssprintf( "#FIRSTSECOND:%.3f;", out.GetFirstSecond() ) ); - f.PutLine( ssprintf( "#LASTSECOND:%.3f;", out.GetLastSecond() ) ); + f.PutLine( ssprintf( "#FIRSTSECOND:%.6f;", out.GetFirstSecond() ) ); + f.PutLine( ssprintf( "#LASTSECOND:%.6f;", out.GetLastSecond() ) ); f.PutLine( ssprintf( "#SONGFILENAME:%s;", out.m_sSongFileName.c_str() ) ); f.PutLine( ssprintf( "#HASMUSIC:%i;", out.m_bHasMusic ) ); f.PutLine( ssprintf( "#HASBANNER:%i;", out.m_bHasBanner ) ); - f.PutLine( ssprintf( "#MUSICLENGTH:%.3f;", out.m_fMusicLengthSeconds ) ); + f.PutLine( ssprintf( "#MUSICLENGTH:%.6f;", out.m_fMusicLengthSeconds ) ); f.PutLine( ssprintf( "// end cache tags" ) ); }