Don't write empty tags.

This commit is contained in:
Glenn Maynard
2002-09-09 02:33:57 +00:00
parent c5a1844fc2
commit 583a9690fd
+11 -2
View File
@@ -180,13 +180,18 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out )
if( fp == NULL ) if( fp == NULL )
throw RageException( "Error opening song file '%s' for writing.", sPath ); throw RageException( "Error opening song file '%s' for writing.", sPath );
if(out.GetFullTitle().GetLength() != 0)
fprintf( fp, "#TITLE:%s;\n", out.GetFullTitle() ); fprintf( fp, "#TITLE:%s;\n", out.GetFullTitle() );
if(out.m_sArtist.GetLength() != 0)
fprintf( fp, "#ARTIST:%s;\n", out.m_sArtist ); fprintf( fp, "#ARTIST:%s;\n", out.m_sArtist );
ASSERT( out.m_BPMSegments[0].m_fStartBeat == 0 ); ASSERT( out.m_BPMSegments[0].m_fStartBeat == 0 );
fprintf( fp, "#BPM:%.2f;\n", out.m_BPMSegments[0].m_fBPM ); fprintf( fp, "#BPM:%.2f;\n", out.m_BPMSegments[0].m_fBPM );
fprintf( fp, "#GAP:%d;\n", -roundf( out.m_fBeat0OffsetInSeconds*1000 ) ); fprintf( fp, "#GAP:%d;\n", -roundf( out.m_fBeat0OffsetInSeconds*1000 ) );
if( out.m_StopSegments.GetSize() )
{
fprintf( fp, "#FREEZE:" ); fprintf( fp, "#FREEZE:" );
for( int i=0; i<out.m_StopSegments.GetSize(); i++ ) for( int i=0; i<out.m_StopSegments.GetSize(); i++ )
{ {
const StopSegment &fs = out.m_StopSegments[i]; const StopSegment &fs = out.m_StopSegments[i];
@@ -195,9 +200,12 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out )
fprintf( fp, "," ); fprintf( fp, "," );
} }
fprintf( fp, ";\n" ); fprintf( fp, ";\n" );
}
if( out.m_BPMSegments.GetSize() > 1)
{
fprintf( fp, "#CHANGEBPM:" ); fprintf( fp, "#CHANGEBPM:" );
for( i=1; i<out.m_BPMSegments.GetSize(); i++ ) for( int i=1; i<out.m_BPMSegments.GetSize(); i++ )
{ {
const BPMSegment &bs = out.m_BPMSegments[i]; const BPMSegment &bs = out.m_BPMSegments[i];
fprintf( fp, "%.2f=%.2f", BeatToNoteRow( bs.m_fStartBeat ) / ROWS_PER_BEAT * 4.0f, bs.m_fBPM ); fprintf( fp, "%.2f=%.2f", BeatToNoteRow( bs.m_fStartBeat ) / ROWS_PER_BEAT * 4.0f, bs.m_fBPM );
@@ -205,6 +213,7 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out )
fprintf( fp, "," ); fprintf( fp, "," );
} }
fprintf( fp, ";\n" ); fprintf( fp, ";\n" );
}
/* Save all Notes for this file. /* Save all Notes for this file.
* *
@@ -225,7 +234,7 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out )
Notes *c[NUM_DIFFICULTY_CLASSES][2]; Notes *c[NUM_DIFFICULTY_CLASSES][2];
memset(c, 0, sizeof(c)); memset(c, 0, sizeof(c));
for( i=0; i<out.m_apNotes.GetSize(); i++ ) for( int i=0; i<out.m_apNotes.GetSize(); i++ )
{ {
if(out.m_apNotes[i]->m_NotesType == NOTES_TYPE_DANCE_COUPLE_1) { if(out.m_apNotes[i]->m_NotesType == NOTES_TYPE_DANCE_COUPLE_1) {
c[out.m_apNotes[i]->m_DifficultyClass][0] = out.m_apNotes[i]; c[out.m_apNotes[i]->m_DifficultyClass][0] = out.m_apNotes[i];