From 49ffa7b45fd034fe623845934c137dba6ca8f81b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 18 Jan 2003 09:18:30 +0000 Subject: [PATCH] replacing markers in BMT::SetText is too expensive; do it manually --- stepmania/src/BitmapText.cpp | 3 --- stepmania/src/ScreenTextEntry.cpp | 13 ++++++++++--- stepmania/src/ScreenTextEntry.h | 2 ++ stepmania/src/ThemeManager.cpp | 6 ++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index c4f22f85ad..65435f75ab 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -214,9 +214,6 @@ void BitmapText::SetText( CString sText, bool DoSubst ) { ASSERT( m_pFont ); - if(DoSubst) - FontCharAliases::ReplaceMarkers(sText); - if(m_szText == sText) return; diff --git a/stepmania/src/ScreenTextEntry.cpp b/stepmania/src/ScreenTextEntry.cpp index e72ba0067d..f016d23f21 100644 --- a/stepmania/src/ScreenTextEntry.cpp +++ b/stepmania/src/ScreenTextEntry.cpp @@ -65,12 +65,19 @@ ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuesti m_textAnswer.LoadFromFont( THEME->GetPathTo("Fonts","header1") ); m_textAnswer.SetXY( ANSWER_X, ANSWER_Y ); - m_textAnswer.SetText( LStringToCString(m_sAnswer) ); + UpdateText(); this->AddChild( &m_textAnswer ); SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu prompt") ); } +void ScreenTextEntry::UpdateText() +{ + CString txt = LStringToCString(m_sAnswer); + FontCharAliases::ReplaceMarkers(txt); + m_textAnswer.SetText( txt ); +} + void ScreenTextEntry::Update( float fDeltaTime ) { Screen::Update( fDeltaTime ); @@ -101,7 +108,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty case SDLK_BACKSPACE: if(!m_sAnswer.empty()) m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 ); - m_textAnswer.SetText( LStringToCString(m_sAnswer) ); + UpdateText(); break; default: char c; @@ -146,7 +153,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty if( c != '\0' ) { m_sAnswer += c; - m_textAnswer.SetText( LStringToCString(m_sAnswer) ); + UpdateText(); } break; } diff --git a/stepmania/src/ScreenTextEntry.h b/stepmania/src/ScreenTextEntry.h index 2124c2d40d..abb8a5fc36 100644 --- a/stepmania/src/ScreenTextEntry.h +++ b/stepmania/src/ScreenTextEntry.h @@ -35,6 +35,8 @@ protected: virtual void MenuStart( PlayerNumber pn ); virtual void MenuBack( PlayerNumber pn ); + void UpdateText(); + TransitionFade m_Fade; BitmapText m_textQuestion; Quad m_rectAnswerBox; diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 89d4a685a5..d70827f4fa 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -20,6 +20,7 @@ #include "IniFile.h" #include "RageTimer.h" #include "Font.h" +#include "FontCharAliases.h" using namespace std; @@ -369,6 +370,11 @@ try_metric_again: if( m_pIniMetrics->GetValue(sClassName,sValueName,sValue) ) { sValue.Replace("::","\n"); // "::" means newline since you can't use line breaks in an ini file. + + /* XXX: add a parameter to turn this off if there are some metrics where + * we don't want markers */ + FontCharAliases::ReplaceMarkers(sValue); + return sValue; }