song: update .ssc version to v0.51

.ssc v0.51: make version the very first tag, limit it to two decimal places.
This commit is contained in:
AJ Kelly
2011-02-13 11:06:34 -06:00
parent 39aa06f306
commit 0c756e1e75
3 changed files with 185 additions and 202 deletions
+28 -32
View File
@@ -39,14 +39,13 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc )
static void WriteGlobalTags( RageFile &f, const Song &out )
{
//f.PutLine( ssprintf( "#SMVERSION:;", SmEscape(RString("ssc-v1.0")).c_str() ) );
f.PutLine( ssprintf( "#VERSION:%.2f;", out.m_fVersion ) );
f.PutLine( ssprintf( "#TITLE:%s;", SmEscape(out.m_sMainTitle).c_str() ) );
f.PutLine( ssprintf( "#SUBTITLE:%s;", SmEscape(out.m_sSubTitle).c_str() ) );
f.PutLine( ssprintf( "#ARTIST:%s;", SmEscape(out.m_sArtist).c_str() ) );
f.PutLine( ssprintf( "#TITLETRANSLIT:%s;", SmEscape(out.m_sMainTitleTranslit).c_str() ) );
f.PutLine( ssprintf( "#SUBTITLETRANSLIT:%s;", SmEscape(out.m_sSubTitleTranslit).c_str() ) );
f.PutLine( ssprintf( "#ARTISTTRANSLIT:%s;", SmEscape(out.m_sArtistTranslit).c_str() ) );
f.PutLine( ssprintf( "#VERSION:%f;", out.m_fVersion ) );
f.PutLine( ssprintf( "#GENRE:%s;", SmEscape(out.m_sGenre).c_str() ) );
f.PutLine( ssprintf( "#CREDIT:%s;", SmEscape(out.m_sCredit).c_str() ) );
f.PutLine( ssprintf( "#BANNER:%s;", SmEscape(out.m_sBannerFile).c_str() ) );
@@ -54,7 +53,7 @@ static void WriteGlobalTags( RageFile &f, const 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() ) );
{
vector<RString> vs;
FOREACH_ENUM( InstrumentTrack, it )
@@ -98,7 +97,6 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
break;
}
f.Write( "#BPMS:" );
for( unsigned i=0; i<out.m_Timing.m_BPMSegments.size(); i++ )
{
@@ -168,20 +166,20 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
for( unsigned i=0; i<out.m_Timing.m_TickcountSegments.size(); i++ )
{
const TickcountSegment &ts = out.m_Timing.m_TickcountSegments[i];
f.PutLine( ssprintf( "%.6f=%d", NoteRowToBeat(ts.m_iStartRow), ts.m_iTicks ) );
if( i != out.m_Timing.m_TickcountSegments.size()-1 )
f.Write( "," );
}
f.PutLine( ";" );
/*
ASSERT( !out.m_Timing.m_ComboSegments.empty() );
f.Write( "#COMBOS:" );
for( unsigned i=0; i<out.m_Timing.m_ComboSegments.size(); i++ )
{
const ComboSegment &cs = out.m_Timing.m_ComboSegments[i];
f.PutLine( ssprintf( "%.6f=%d", NoteRowToBeat(cs.m_iStartRow), cs.m_iComboFactor ) );
if( i != out.m_Timing.m_ComboSegments.size()-1 )
f.Write( "," );
@@ -200,10 +198,10 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
FOREACH_CONST( BackgroundChange, out.GetBackgroundChanges(b), bgc )
f.PutLine( BackgroundChangeToString(*bgc)+"," );
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to indicate that
* this file doesn't want a song BG entry added at the end. See SSCLoader::TidyUpData.
* This tag will be removed on load. Add it at a very high beat, so it won't cause
* problems if loaded in older versions. */
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to
* indicate that this file doesn't want a song BG entry added at the end.
* See SSCLoader::TidyUpData. This tag will be removed on load. Add it
* at a very high beat, so it won't cause problems if loaded in older versions. */
if( b==0 && !out.GetBackgroundChanges(b).empty() )
f.PutLine( "99999=-nosongbg-=1.000=0=0=0 // don't automatically add -songbackground-" );
f.PutLine( ";" );
@@ -235,7 +233,7 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
f.Write( ssprintf( "%s", sData.c_str() ) );
if( a != (out.m_sAttackString.size() - 1) )
f.Write( ":" ); // Not the end, so write a divider ':'
f.Write( ":" ); // Not the end, so write a divider ':'
}
f.PutLine( ";" );
}
@@ -245,7 +243,7 @@ static RString JoinLineList( vector<RString> &lines )
for( unsigned i = 0; i < lines.size(); ++i )
TrimRight( lines[i] );
/* Skip leading blanks. */
// Skip leading blanks.
unsigned j = 0;
while( j < lines.size() && lines.size() == 0 )
++j;
@@ -266,7 +264,7 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( ssprintf( "#DESCRIPTION:%s;", SmEscape(in.GetDescription()).c_str() ) );
lines.push_back( ssprintf( "#DIFFICULTY:%s;", DifficultyToString(in.GetDifficulty()).c_str() ) );
lines.push_back( ssprintf( "#METER:%d;", in.GetMeter() ) );
vector<RString> asRadarValues;
FOREACH_PlayerNumber( pn )
{
@@ -277,15 +275,15 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( ssprintf( "#RADARVALUES:%s:", join(",",asRadarValues).c_str() ) );
lines.push_back( ssprintf( "#CREDIT:%s;", SmEscape(in.GetCredit()).c_str() ) );
// TODO: Remove this block, uncommon below block for Split Timing. -Wolfman2000
// TODO: Remove this block, uncomment below block for Split Timing. -Wolfman2000
lines.push_back( "#BPMS:;" );
lines.push_back( "#STOPS:;" );
lines.push_back( "#DELAYS:;" );
lines.push_back( "#TIMESIGNATURES:;" );
lines.push_back( "#TICKCOUNTS:;" );
// lines.push_back( "#COMBOS:;" );
/*
vector<RString> asBPMValues;
for( unsigned i=0; i<in.m_Timing.m_BPMSegments.size(); i++ )
@@ -294,32 +292,31 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
asBPMValues.push_back( ssprintf("%.6f=%.6f", NoteRowToBeat(bs.m_iStartRow), bs.GetBPM() ) );
}
lines.push_back( ssprintf( "#BPMS:%s;", join("\n,", asBPMValues).c_str() ) );
vector<RString> asStopValues;
for( unsigned i=0; i<in.m_Timing.m_StopSegments.size(); i++ )
{
const StopSegment &fs = in.m_Timing.m_StopSegments[i];
if(!fs.m_bDelay)
{
asStopValues.push_back( ssprintf( "%.6f=%.6f", NoteRowToBeat(fs.m_iStartRow), fs.m_fStopSeconds ) );
}
}
lines.push_back( ssprintf( "#STOPS:%s;", join("\n,", asStopValues).c_str() ) );
vector<RString> asDelayValues;
for( unsigned i=0; i<in.m_Timing.m_StopSegments.size(); i++ )
{
const StopSegment &fs = in.m_Timing.m_StopSegments[i];
if( fs.m_bDelay )
{
asDelayValues.push_back( ssprintf( "%.6f=%.6f", NoteRowToBeat(fs.m_iStartRow), fs.m_fStopSeconds ) );
}
}
lines.push_back( ssprintf( "#DELAYS:%s;", join("\n,", asDelayValues).c_str() ) );
ASSERT( !in.m_Timing.m_vTimeSignatureSegments.empty() );
vector<RString> asTimeSigValues;
FOREACH_CONST( TimeSignatureSegment, in.m_Timing.m_vTimeSignatureSegments, iter )
@@ -329,36 +326,35 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
iter2++;
}
lines.push_back( ssprintf( "#TIMESIGNATURES:%s;", join("\n,", asTimeSigValues).c_str() ) );
ASSERT( !in.m_Timing.m_TickcountSegments.empty() );
vector<RString> asTickValues;
for( unsigned i=0; i<in.m_Timing.m_TickcountSegments.size(); i++ )
{
const TickcountSegment &ts = in.m_Timing.m_TickcountSegments[i];
asTickValues.push_back( ssprintf( "%.6f=%d", NoteRowToBeat(ts.m_iStartRow), ts.m_iTicks ) );
}
lines.push_back( ssprintf( "#TICKCOUNTS:%s;", join("\n,", asTickValues).c_str() ) );
ASSERT( !in.m_Timing.m_ComboSegments.empty() );
vector<RString> asComboValues;
for( unsigned i=0; i<in.m_Timing.m_ComboSegments.size(); i++ )
{
const ComboSegment &cs = in.m_Timing.m_ComboSegments[i];
asComboValues.push_back( ssprintf( "%.6f=%d", NoteRowToBeat(cs.m_iStartRow), cs.m_iComboFactor ) );
}
lines.push_back( ssprintf( "#COMBOS:%s;", join("\n,", asComboValues).c_str() ) );
lines.push_back( ssprintf( "#OFFSET:%.6f;", in.m_Timing.m_fBeat0OffsetInSeconds ) );
*/
RString sNoteData;
in.GetSMNoteData( sNoteData );
lines.push_back( song.m_vsKeysoundFile.empty() ? "#NOTES:" : "#NOTES2:" );
split( sNoteData, "\n", lines, true );
lines.push_back( ";" );
@@ -370,7 +366,7 @@ bool NotesWriterSSC::Write( RString sPath, const Song &out, const vector<Steps*>
int flags = RageFile::WRITE;
/* If we're not saving cache, we're saving real data, so enable SLOW_FLUSH
* to prevent data loss. If we're saving cache, this will slow things down
* to prevent data loss. If we're saving cache, this will slow things down
* too much. */
if( !bSavingCache )
flags |= RageFile::SLOW_FLUSH;