Don't write empty tags.

This commit is contained in:
Glenn Maynard
2002-09-09 02:33:57 +00:00
parent c5a1844fc2
commit 583a9690fd
+27 -18
View File
@@ -180,31 +180,40 @@ 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 );
fprintf( fp, "#TITLE:%s;\n", out.GetFullTitle() ); if(out.GetFullTitle().GetLength() != 0)
fprintf( fp, "#ARTIST:%s;\n", out.m_sArtist ); fprintf( fp, "#TITLE:%s;\n", out.GetFullTitle() );
if(out.m_sArtist.GetLength() != 0)
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 ) );
fprintf( fp, "#FREEZE:" ); if( out.m_StopSegments.GetSize() )
for( int i=0; i<out.m_StopSegments.GetSize(); i++ )
{ {
const StopSegment &fs = out.m_StopSegments[i]; fprintf( fp, "#FREEZE:" );
fprintf( fp, "%.2f=%.2f", BeatToNoteRow( fs.m_fStartBeat ) / ROWS_PER_BEAT * 4.0f, roundf(fs.m_fStopSeconds*1000) );
if( i != out.m_StopSegments.GetSize()-1 )
fprintf( fp, "," );
}
fprintf( fp, ";\n" );
fprintf( fp, "#CHANGEBPM:" ); for( int i=0; i<out.m_StopSegments.GetSize(); i++ )
for( i=1; i<out.m_BPMSegments.GetSize(); i++ ) {
const StopSegment &fs = out.m_StopSegments[i];
fprintf( fp, "%.2f=%.2f", BeatToNoteRow( fs.m_fStartBeat ) / ROWS_PER_BEAT * 4.0f, roundf(fs.m_fStopSeconds*1000) );
if( i != out.m_StopSegments.GetSize()-1 )
fprintf( fp, "," );
}
fprintf( fp, ";\n" );
}
if( out.m_BPMSegments.GetSize() > 1)
{ {
const BPMSegment &bs = out.m_BPMSegments[i]; fprintf( fp, "#CHANGEBPM:" );
fprintf( fp, "%.2f=%.2f", BeatToNoteRow( bs.m_fStartBeat ) / ROWS_PER_BEAT * 4.0f, bs.m_fBPM ); for( int i=1; i<out.m_BPMSegments.GetSize(); i++ )
if( i != out.m_BPMSegments.GetSize()-1 ) {
fprintf( fp, "," ); const BPMSegment &bs = out.m_BPMSegments[i];
fprintf( fp, "%.2f=%.2f", BeatToNoteRow( bs.m_fStartBeat ) / ROWS_PER_BEAT * 4.0f, bs.m_fBPM );
if( i != out.m_BPMSegments.GetSize()-1 )
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];