From 674dfe3a8a23004fe39d5becf6d1c8d6df378e65 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 4 Jul 2008 23:48:06 +0000 Subject: [PATCH] fix -stroke pages showing up in .ini --- .../Texture Font GeneratorDlg.cpp | 23 ++--------- .../Texture Font Generator/TextureFont.cpp | 41 +++++++++++++------ .../src/Texture Font Generator/TextureFont.h | 2 +- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp b/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp index 171ff90540..42449b8df9 100644 --- a/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp +++ b/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp @@ -172,22 +172,6 @@ void CTextureFontGeneratorDlg::UpdateFont( bool bSavingDoubleRes ) g_pTextureFont->m_PagesToGenerate.push_back( desc ); - // - // Save duplicate imnages of each page with "-stroke" appended to the page name. - // - bool bExportStrokeTemplates = !!( pMenu->GetMenuState(ID_OPTIONS_EXPORTSTROKETEMPLATES, 0) & MF_CHECKED ); - if( bExportStrokeTemplates ) - { - int iNumPages = (int)g_pTextureFont->m_PagesToGenerate.size(); - for( int i=0; im_PagesToGenerate[i]; - desc.name += "-stroke"; - g_pTextureFont->m_PagesToGenerate.push_back( desc ); - } - } - - /* Go: */ g_pTextureFont->FormatFontPages(); @@ -609,12 +593,13 @@ void CTextureFontGeneratorDlg::OnFileSave() */ CMenu *pMenu = GetMenu(); + bool bExportStrokeTemplates = !!( pMenu->GetMenuState(ID_OPTIONS_EXPORTSTROKETEMPLATES, 0) & MF_CHECKED ); bool bDoubleRes = !!( pMenu->GetMenuState(ID_OPTIONS_DOUBLERES, 0) & MF_CHECKED ); if( bDoubleRes ) { - g_pTextureFont->Save( szFile, "", true, false ); // save metrics + g_pTextureFont->Save( szFile, "", true, false, bExportStrokeTemplates ); // save metrics UpdateFont( true ); // generate DoubleRes bitmaps - g_pTextureFont->Save( szFile, " (doubleres)", false, true ); // save bitmaps + g_pTextureFont->Save( szFile, " (doubleres)", false, true, bExportStrokeTemplates ); // save bitmaps // reset to normal, non-DoubleRes font m_bUpdateFontNeeded = true; Invalidate( FALSE ); @@ -622,7 +607,7 @@ void CTextureFontGeneratorDlg::OnFileSave() } else // normal res { - g_pTextureFont->Save( szFile, "", true, true ); // save metrics and bitmaps + g_pTextureFont->Save( szFile, "", true, true, bExportStrokeTemplates ); // save metrics and bitmaps } } diff --git a/stepmania/src/Texture Font Generator/TextureFont.cpp b/stepmania/src/Texture Font Generator/TextureFont.cpp index cd840066e0..8c4418cd4b 100644 --- a/stepmania/src/Texture Font Generator/TextureFont.cpp +++ b/stepmania/src/Texture Font Generator/TextureFont.cpp @@ -371,7 +371,7 @@ void wchar_to_utf8( wchar_t ch, string &out ) #include -void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps ) +void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps, bool bExportStrokeTemplates ) { if( m_sError != "" ) return; @@ -447,18 +447,35 @@ void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension, GrayScaleToAlpha( &surf ); - CString sFile; - sFile.Format( "%s [%s] %ix%i%s.png", - sBasePath.GetString(), - m_PagesToGenerate[i].name.GetString(), - m_apPages[i]->m_iNumFramesX, - m_apPages[i]->m_iNumFramesY, - sBitmapAppendBeforeExtension.GetString() ); + for( int j=0; j<2; j++ ) + { + CString sPageName = m_PagesToGenerate[i].name.GetString(); + switch( j ) + { + case 0: + break; + case 1: + if( !bExportStrokeTemplates ) + continue; + sPageName += "-stroke"; + break; + default: + ASSERT(0); + } - FILE *f = fopen( sFile, "w+b" ); - char szErrorbuf[1024]; - SavePNG( f, szErrorbuf, &surf ); - fclose( f ); + CString sFile; + sFile.Format( "%s [%s] %ix%i%s.png", + sBasePath.GetString(), + sPageName.GetString(), + m_apPages[i]->m_iNumFramesX, + m_apPages[i]->m_iNumFramesY, + sBitmapAppendBeforeExtension.GetString() ); + + FILE *f = fopen( sFile, "w+b" ); + char szErrorbuf[1024]; + SavePNG( f, szErrorbuf, &surf ); + fclose( f ); + } } } } diff --git a/stepmania/src/Texture Font Generator/TextureFont.h b/stepmania/src/Texture Font Generator/TextureFont.h index c17bf9f87b..1b5c28d0a1 100644 --- a/stepmania/src/Texture Font Generator/TextureFont.h +++ b/stepmania/src/Texture Font Generator/TextureFont.h @@ -37,7 +37,7 @@ public: vector m_PagesToGenerate; void FormatFontPage( int iPage, HDC hDC ); void FormatFontPages(); - void Save( CString sPath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps ); + void Save( CString sPath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps, bool bExportStrokeTemplates ); map m_Characters;