Move WriteSMNotesTag into the SM writer.

This commit is contained in:
Glenn Maynard
2002-12-14 21:36:52 +00:00
parent a3477d477d
commit b05c176e28
4 changed files with 25 additions and 21 deletions
-18
View File
@@ -56,24 +56,6 @@ Notes::~Notes()
{ {
} }
void Notes::WriteSMNotesTag( FILE* fp )
{
fprintf( fp, "\n//---------------%s - %s----------------\n",
GameManager::NotesTypeToString(m_NotesType).GetString(), m_sDescription.GetString() );
fprintf( fp, "#NOTES:\n" );
fprintf( fp, " %s:\n", GameManager::NotesTypeToString(m_NotesType).GetString() );
fprintf( fp, " %s:\n", m_sDescription.GetString() );
fprintf( fp, " %s:\n", DifficultyToString(m_Difficulty).GetString() );
fprintf( fp, " %d:\n", m_iMeter );
CStringArray asRadarValues;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
asRadarValues.push_back( ssprintf("%.3f", m_fRadarValues[r]) );
fprintf( fp, " %s:\n", join(",",asRadarValues).GetString() );
fprintf( fp, "%s;\n", m_sSMNoteData.GetString() );
}
void Notes::SetNoteData( NoteData* pNewNoteData ) void Notes::SetNoteData( NoteData* pNewNoteData )
{ {
ASSERT( pNewNoteData->m_iNumTracks == GameManager::NotesTypeToNumTracks(m_NotesType) ); ASSERT( pNewNoteData->m_iNumTracks == GameManager::NotesTypeToNumTracks(m_NotesType) );
-1
View File
@@ -35,7 +35,6 @@ public:
// Loading // Loading
bool LoadFromNotesFile( const CString &sPath ); bool LoadFromNotesFile( const CString &sPath );
void WriteSMNotesTag( FILE* fp );
public: public:
NotesType m_NotesType; NotesType m_NotesType;
+24 -2
View File
@@ -1,6 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "NotesWriterSM.h" #include "NotesWriterSM.h"
#include "Notes.h" #include "Notes.h"
#include "RageUtil.h"
#include "GameManager.h"
void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out) void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out)
{ {
@@ -69,6 +71,24 @@ void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out)
} }
void NotesWriterSM::WriteSMNotesTag( const Notes &in, FILE* fp )
{
fprintf( fp, "\n//---------------%s - %s----------------\n",
GameManager::NotesTypeToString(in.m_NotesType).GetString(), in.m_sDescription.GetString() );
fprintf( fp, "#NOTES:\n" );
fprintf( fp, " %s:\n", GameManager::NotesTypeToString(in.m_NotesType).GetString() );
fprintf( fp, " %s:\n", in.m_sDescription.GetString() );
fprintf( fp, " %s:\n", DifficultyToString(in.m_Difficulty).GetString() );
fprintf( fp, " %d:\n", in.m_iMeter );
CStringArray asRadarValues;
for( int r=0; r < NUM_RADAR_VALUES; r++ )
asRadarValues.push_back( ssprintf("%.3f", in.m_fRadarValues[r]) );
fprintf( fp, " %s:\n", join(",",asRadarValues).GetString() );
fprintf( fp, "%s;\n", in.GetSMNoteData().GetString() );
}
bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache) bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache)
{ {
unsigned i; unsigned i;
@@ -89,8 +109,10 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache)
for( i=0; i<out.m_apNotes.size(); i++ ) for( i=0; i<out.m_apNotes.size(); i++ )
{ {
Notes* pNotes = out.m_apNotes[i]; Notes* pNotes = out.m_apNotes[i];
if( bSavingCache || !pNotes->m_bAutoGen ) // If notes aren't autogen if( !bSavingCache && pNotes->m_bAutoGen )
out.m_apNotes[i]->WriteSMNotesTag( fp ); continue; /* only write autogen notes to cache */
WriteSMNotesTag( *out.m_apNotes[i], fp );
} }
fclose( fp ); fclose( fp );
+1
View File
@@ -6,6 +6,7 @@
class NotesWriterSM class NotesWriterSM
{ {
void WriteGlobalTags(FILE *fp, const Song &out); void WriteGlobalTags(FILE *fp, const Song &out);
void WriteSMNotesTag( const Notes &in, FILE* fp );
public: public:
bool Write( CString sPath, const Song &out, bool bSavingCache ); bool Write( CString sPath, const Song &out, bool bSavingCache );