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
+11 -23
View File
@@ -138,7 +138,12 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{ {
case GETTING_SONG_INFO: case GETTING_SONG_INFO:
{ {
if( sValueName=="TITLE" ) if( sValueName=="VERSION" )
{
out.m_fVersion = StringToFloat( sParams[1] );
}
else if( sValueName=="TITLE" )
{ {
out.m_sMainTitle = sParams[1]; out.m_sMainTitle = sParams[1];
} }
@@ -168,11 +173,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
out.m_sArtistTranslit = sParams[1]; out.m_sArtistTranslit = sParams[1];
} }
else if( sValueName=="VERSION" )
{
out.m_fVersion = StringToFloat( sParams[1] );
}
else if( sValueName=="GENRE" ) else if( sValueName=="GENRE" )
{ {
out.m_sGenre = sParams[1]; out.m_sGenre = sParams[1];
@@ -239,7 +239,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="MUSICBYTES" ) else if( sValueName=="MUSICBYTES" )
{ {
; /* ignore */ ; // ignore
} }
else if( sValueName=="SAMPLESTART" ) else if( sValueName=="SAMPLESTART" )
@@ -380,11 +380,8 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{ {
out.m_Timing.m_fBeat0OffsetInSeconds = StringToFloat( sParams[1] ); out.m_Timing.m_fBeat0OffsetInSeconds = StringToFloat( sParams[1] );
} }
/* /* Below are the song based timings that should only be used
* Below are the song based timings that * if the steps do not have their own timing. */
* should only be used if the steps do
* not have their own timing.
*/
else if( sValueName=="STOPS" ) else if( sValueName=="STOPS" )
{ {
vector<RString> arrayFreezeExpressions; vector<RString> arrayFreezeExpressions;
@@ -475,8 +472,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
const float fBeat = StringToFloat( arrayBPMChangeValues[0] ); const float fBeat = StringToFloat( arrayBPMChangeValues[0] );
const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] ); const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] );
if(fNewBPM > 0.0f) if(fNewBPM > 0.0f)
out.m_Timing.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) ); out.m_Timing.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
else else
@@ -592,11 +587,8 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
*/ */
} }
/* /* The following are cache tags. Never fill their values
* The following are cache tags. * directly: only from the cached version. */
* Never fill their values directly:
* only from the cached version.
*/
else if( sValueName=="FIRSTBEAT" ) else if( sValueName=="FIRSTBEAT" )
{ {
if( bFromCache ) if( bFromCache )
@@ -707,8 +699,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
const float fBeat = StringToFloat( arrayBPMChangeValues[0] ); const float fBeat = StringToFloat( arrayBPMChangeValues[0] );
const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] ); const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] );
if(fNewBPM > 0.0f) if(fNewBPM > 0.0f)
pNewNotes->m_Timing.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) ); pNewNotes->m_Timing.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
else else
@@ -881,7 +871,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
} }
*/ */
} }
else if( sValueName=="COMBOS" ) else if( sValueName=="COMBOS" )
{ {
/* /*
@@ -913,7 +902,6 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="NOTES" ) else if( sValueName=="NOTES" )
{ {
state = GETTING_SONG_INFO; state = GETTING_SONG_INFO;
// pNewNotes->m_Timing.m_fBeat0OffsetInSeconds = out.m_Timing.m_fBeat0OffsetInSeconds; // pNewNotes->m_Timing.m_fBeat0OffsetInSeconds = out.m_Timing.m_fBeat0OffsetInSeconds;
pNewNotes->SetSMNoteData( sParams[1] ); pNewNotes->SetSMNoteData( sParams[1] );
+7 -11
View File
@@ -39,14 +39,13 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc )
static void WriteGlobalTags( RageFile &f, const Song &out ) 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( "#TITLE:%s;", SmEscape(out.m_sMainTitle).c_str() ) );
f.PutLine( ssprintf( "#SUBTITLE:%s;", SmEscape(out.m_sSubTitle).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( "#ARTIST:%s;", SmEscape(out.m_sArtist).c_str() ) );
f.PutLine( ssprintf( "#TITLETRANSLIT:%s;", SmEscape(out.m_sMainTitleTranslit).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( "#SUBTITLETRANSLIT:%s;", SmEscape(out.m_sSubTitleTranslit).c_str() ) );
f.PutLine( ssprintf( "#ARTISTTRANSLIT:%s;", SmEscape(out.m_sArtistTranslit).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( "#GENRE:%s;", SmEscape(out.m_sGenre).c_str() ) );
f.PutLine( ssprintf( "#CREDIT:%s;", SmEscape(out.m_sCredit).c_str() ) ); f.PutLine( ssprintf( "#CREDIT:%s;", SmEscape(out.m_sCredit).c_str() ) );
f.PutLine( ssprintf( "#BANNER:%s;", SmEscape(out.m_sBannerFile).c_str() ) ); f.PutLine( ssprintf( "#BANNER:%s;", SmEscape(out.m_sBannerFile).c_str() ) );
@@ -98,7 +97,6 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
break; break;
} }
f.Write( "#BPMS:" ); f.Write( "#BPMS:" );
for( unsigned i=0; i<out.m_Timing.m_BPMSegments.size(); i++ ) for( unsigned i=0; i<out.m_Timing.m_BPMSegments.size(); i++ )
{ {
@@ -200,10 +198,10 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
FOREACH_CONST( BackgroundChange, out.GetBackgroundChanges(b), bgc ) FOREACH_CONST( BackgroundChange, out.GetBackgroundChanges(b), bgc )
f.PutLine( BackgroundChangeToString(*bgc)+"," ); f.PutLine( BackgroundChangeToString(*bgc)+"," );
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to indicate that /* If there's an animation plan at all, add a dummy "-nosongbg-" tag to
* this file doesn't want a song BG entry added at the end. See SSCLoader::TidyUpData. * indicate that this file doesn't want a song BG entry added at the end.
* This tag will be removed on load. Add it at a very high beat, so it won't cause * See SSCLoader::TidyUpData. This tag will be removed on load. Add it
* problems if loaded in older versions. */ * at a very high beat, so it won't cause problems if loaded in older versions. */
if( b==0 && !out.GetBackgroundChanges(b).empty() ) if( b==0 && !out.GetBackgroundChanges(b).empty() )
f.PutLine( "99999=-nosongbg-=1.000=0=0=0 // don't automatically add -songbackground-" ); f.PutLine( "99999=-nosongbg-=1.000=0=0=0 // don't automatically add -songbackground-" );
f.PutLine( ";" ); f.PutLine( ";" );
@@ -245,7 +243,7 @@ static RString JoinLineList( vector<RString> &lines )
for( unsigned i = 0; i < lines.size(); ++i ) for( unsigned i = 0; i < lines.size(); ++i )
TrimRight( lines[i] ); TrimRight( lines[i] );
/* Skip leading blanks. */ // Skip leading blanks.
unsigned j = 0; unsigned j = 0;
while( j < lines.size() && lines.size() == 0 ) while( j < lines.size() && lines.size() == 0 )
++j; ++j;
@@ -278,7 +276,7 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( ssprintf( "#CREDIT:%s;", SmEscape(in.GetCredit()).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( "#BPMS:;" );
lines.push_back( "#STOPS:;" ); lines.push_back( "#STOPS:;" );
lines.push_back( "#DELAYS:;" ); lines.push_back( "#DELAYS:;" );
@@ -319,7 +317,6 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
} }
lines.push_back( ssprintf( "#DELAYS:%s;", join("\n,", asDelayValues).c_str() ) ); lines.push_back( ssprintf( "#DELAYS:%s;", join("\n,", asDelayValues).c_str() ) );
ASSERT( !in.m_Timing.m_vTimeSignatureSegments.empty() ); ASSERT( !in.m_Timing.m_vTimeSignatureSegments.empty() );
vector<RString> asTimeSigValues; vector<RString> asTimeSigValues;
FOREACH_CONST( TimeSignatureSegment, in.m_Timing.m_vTimeSignatureSegments, iter ) FOREACH_CONST( TimeSignatureSegment, in.m_Timing.m_vTimeSignatureSegments, iter )
@@ -358,7 +355,6 @@ static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( song.m_vsKeysoundFile.empty() ? "#NOTES:" : "#NOTES2:" ); lines.push_back( song.m_vsKeysoundFile.empty() ? "#NOTES:" : "#NOTES2:" );
split( sNoteData, "\n", lines, true ); split( sNoteData, "\n", lines, true );
lines.push_back( ";" ); lines.push_back( ";" );
+1 -2
View File
@@ -36,6 +36,7 @@
#include <set> #include <set>
#include <float.h> #include <float.h>
const static float VERSION_NUMBER = 0.51f;
const int FILE_CACHE_VERSION = 163; // increment this to invalidate cache const int FILE_CACHE_VERSION = 163; // increment this to invalidate cache
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
@@ -52,8 +53,6 @@ static const char *InstrumentTrackNames[] = {
XToString( InstrumentTrack ); XToString( InstrumentTrack );
StringToX( InstrumentTrack ); StringToX( InstrumentTrack );
const static float VERSION_NUMBER = 0.5f;
Song::Song() Song::Song()
{ {
FOREACH_BackgroundLayer( i ) FOREACH_BackgroundLayer( i )