From b05c176e280009ee19187d2d6d457b288b0889dc Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 14 Dec 2002 21:36:52 +0000 Subject: [PATCH] Move WriteSMNotesTag into the SM writer. --- stepmania/src/Notes.cpp | 18 ------------------ stepmania/src/Notes.h | 1 - stepmania/src/NotesWriterSM.cpp | 26 ++++++++++++++++++++++++-- stepmania/src/NotesWriterSM.h | 1 + 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/stepmania/src/Notes.cpp b/stepmania/src/Notes.cpp index 1157eb8897..10f9d7124c 100644 --- a/stepmania/src/Notes.cpp +++ b/stepmania/src/Notes.cpp @@ -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; rm_iNumTracks == GameManager::NotesTypeToNumTracks(m_NotesType) ); diff --git a/stepmania/src/Notes.h b/stepmania/src/Notes.h index 2b13641184..2b1d6ae79d 100644 --- a/stepmania/src/Notes.h +++ b/stepmania/src/Notes.h @@ -35,7 +35,6 @@ public: // Loading bool LoadFromNotesFile( const CString &sPath ); - void WriteSMNotesTag( FILE* fp ); public: NotesType m_NotesType; diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index 061c221b68..005ed5c72b 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "NotesWriterSM.h" #include "Notes.h" +#include "RageUtil.h" +#include "GameManager.h" 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) { unsigned i; @@ -89,8 +109,10 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache) for( i=0; im_bAutoGen ) // If notes aren't autogen - out.m_apNotes[i]->WriteSMNotesTag( fp ); + if( !bSavingCache && pNotes->m_bAutoGen ) + continue; /* only write autogen notes to cache */ + + WriteSMNotesTag( *out.m_apNotes[i], fp ); } fclose( fp ); diff --git a/stepmania/src/NotesWriterSM.h b/stepmania/src/NotesWriterSM.h index 3aee1bb1cf..b5fd10cff2 100644 --- a/stepmania/src/NotesWriterSM.h +++ b/stepmania/src/NotesWriterSM.h @@ -6,6 +6,7 @@ class NotesWriterSM { void WriteGlobalTags(FILE *fp, const Song &out); + void WriteSMNotesTag( const Notes &in, FILE* fp ); public: bool Write( CString sPath, const Song &out, bool bSavingCache );