From 47bfebf266b012dc5d916c6469383ff7df44264c Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 24 Apr 2005 05:58:58 +0000 Subject: [PATCH] cache metrics --- stepmania/src/MenuTimer.cpp | 18 ++++++++++-------- stepmania/src/MenuTimer.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index 5d8e9c21b3..c4ad59251f 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -10,15 +10,17 @@ #include "GameSoundManager.h" #include "ThemeMetric.h" -static const ThemeMetric WARNING_START ("MenuTimer","WarningStart"); -static const ThemeMetric WARNING_BEEP_START ("MenuTimer","WarningBeepStart"); -static const ThemeMetric MAX_STALL_SECONDS ("MenuTimer","MaxStallSeconds"); -#define WARNING_COMMAND(i) THEME->GetMetricA ("MenuTimer", ssprintf("WarningCommand%i",i)) -static const ThemeMetric ON_COMMAND ("MenuTimer","OnCommand"); +CString WARNING_COMMAND_NAME( size_t i ) { return ssprintf("WarningCommand%d",i); } + +static const ThemeMetric WARNING_START ("MenuTimer","WarningStart"); +static const ThemeMetric WARNING_BEEP_START ("MenuTimer","WarningBeepStart"); +static const ThemeMetric MAX_STALL_SECONDS ("MenuTimer","MaxStallSeconds"); +static const ThemeMetric ON_COMMAND ("MenuTimer","OnCommand"); static const float TIMER_PAUSE_SECONDS = 99; -MenuTimer::MenuTimer() +MenuTimer::MenuTimer() : + WARNING_COMMAND("MenuTimer", WARNING_COMMAND_NAME, WARNING_START+1) { m_fStallSeconds = 0; m_fStallSecondsLeft = MAX_STALL_SECONDS; @@ -80,8 +82,8 @@ void MenuTimer::Update( float fDeltaTime ) if( iNewDisplay <= WARNING_START ) { - m_textDigit1.RunCommands( WARNING_COMMAND(iNewDisplay) ); - m_textDigit2.RunCommands( WARNING_COMMAND(iNewDisplay) ); + m_textDigit1.RunCommands( WARNING_COMMAND.GetValue(iNewDisplay) ); + m_textDigit2.RunCommands( WARNING_COMMAND.GetValue(iNewDisplay) ); } if( iNewDisplay == 0 ) diff --git a/stepmania/src/MenuTimer.h b/stepmania/src/MenuTimer.h index d83f9b6ce4..d6b112cb26 100644 --- a/stepmania/src/MenuTimer.h +++ b/stepmania/src/MenuTimer.h @@ -8,6 +8,7 @@ #include "ActorFrame.h" #include "BitmapText.h" #include "RageSound.h" +#include "ThemeMetric.h" class MenuTimer : public ActorFrame @@ -36,6 +37,8 @@ protected: BitmapText m_textDigit2; RageSound m_soundBeep; + + ThemeMetric1D WARNING_COMMAND; }; #endif