From da775dbd3ec21fe5205e022a0bbfd76c435db7b1 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 17 Jul 2004 22:15:39 +0000 Subject: [PATCH] move all metrics in the "Common" group into one header file --- stepmania/src/CommonMetrics.h | 43 +++++++++++++++++++++++++++++ stepmania/src/DifficultyList.cpp | 2 +- stepmania/src/GameState.cpp | 5 +--- stepmania/src/PlayerNumber.cpp | 5 +--- stepmania/src/ScreenAttract.cpp | 3 +- stepmania/src/ScreenSelectStyle.cpp | 3 +- stepmania/src/ScreenTitleMenu.cpp | 5 ++-- stepmania/src/StepMania.cpp | 7 +++-- 8 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 stepmania/src/CommonMetrics.h diff --git a/stepmania/src/CommonMetrics.h b/stepmania/src/CommonMetrics.h new file mode 100644 index 0000000000..f7606fa8b7 --- /dev/null +++ b/stepmania/src/CommonMetrics.h @@ -0,0 +1,43 @@ +/* Definitions of metrics that are in the "Common" group */ + +#ifndef COMMON_METRICS_H +#define COMMON_METRICS_H + +#define DIFFICULTIES_TO_SHOW THEME->GetMetric ("Common","DifficultiesToShow") +#define INITIAL_SCREEN THEME->GetMetric ("Common","InitialScreen") +#define FIRST_RUN_INITIAL_SCREEN THEME->GetMetric ("Common","FirstRunInitialScreen") +#define DEFAULT_MODIFIERS THEME->GetMetric ("Common","DefaultModifiers" ) +#define DEFAULT_CPU_MODIFIERS THEME->GetMetric ("Common","DefaultCpuModifiers" ) +#define COURSE_DIFFICULTIES_TO_SHOW THEME->GetMetric ("Common","CourseDifficultiesToShow") +#define COLOR_P1 THEME->GetMetricC("Common","ColorP1") +#define COLOR_P2 THEME->GetMetricC("Common","ColorP2") +#define INITIAL_SCREEN THEME->GetMetric ("Common","InitialScreen") +#define JOIN_PAUSE_SECONDS THEME->GetMetricF("Common","JoinPauseSeconds") +#define WINDOW_TITLE THEME->GetMetric ("Common","WindowTitle") + +#endif + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/DifficultyList.cpp b/stepmania/src/DifficultyList.cpp index 33863fa170..6988bbbca8 100644 --- a/stepmania/src/DifficultyList.cpp +++ b/stepmania/src/DifficultyList.cpp @@ -10,12 +10,12 @@ #include "SongManager.h" #include "ThemeManager.h" #include "StepsUtil.h" +#include "CommonMetrics.h" #define ITEMS_SPACING_Y THEME->GetMetricF(m_sName,"ItemsSpacingY") #define DESCRIPTION_MAX_WIDTH THEME->GetMetricF(m_sName,"DescriptionMaxWidth") #define NUM_SHOWN_ITEMS THEME->GetMetricI(m_sName,"NumShownItems") #define MOVE_COMMAND THEME->GetMetric (m_sName,"MoveCommand") -#define DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","DifficultiesToShow" ) #define CAPITALIZE_DIFFICULTY_NAMES THEME->GetMetric( m_sName,"CapitalizeDifficultyNames" ) #define MAX_METERS NUM_DIFFICULTIES + MAX_EDITS_PER_SONG diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 53199b28c9..5e1b391293 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -26,14 +26,11 @@ #include "StageStats.h" #include "GameConstantsAndTypes.h" #include "StepMania.h" +#include "CommonMetrics.h" #include #include -#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" ) -#define DEFAULT_CPU_MODIFIERS THEME->GetMetric( "Common","DefaultCpuModifiers" ) -#define DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","DifficultiesToShow" ) -#define COURSE_DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","CourseDifficultiesToShow" ) GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program diff --git a/stepmania/src/PlayerNumber.cpp b/stepmania/src/PlayerNumber.cpp index b8d9cd67e8..28867b2b33 100644 --- a/stepmania/src/PlayerNumber.cpp +++ b/stepmania/src/PlayerNumber.cpp @@ -2,10 +2,7 @@ #include "PlayerNumber.h" #include "ThemeManager.h" #include "GameState.h" - - -#define COLOR_P1 THEME->GetMetricC("Common","ColorP1") -#define COLOR_P2 THEME->GetMetricC("Common","ColorP2") +#include "CommonMetrics.h" RageColor PlayerToColor( PlayerNumber pn ) diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index 71a88b64a6..a341614b9b 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -14,10 +14,9 @@ #include "InputMapper.h" #include "ThemeManager.h" #include "GameSoundManager.h" +#include "CommonMetrics.h" #define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen") -#define INITIAL_SCREEN THEME->GetMetric ("Common","InitialScreen") -#define JOIN_PAUSE_SECONDS THEME->GetMetricF("Common","JoinPauseSeconds") ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : Screen( sName ) diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index fb301a0abc..f8f40907e5 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -9,6 +9,7 @@ #include "AnnouncerManager.h" #include "ActorUtil.h" #include "LightsManager.h" +#include "CommonMetrics.h" #define ICON_GAIN_FOCUS_COMMAND THEME->GetMetric (m_sName,"IconGainFocusCommand") @@ -244,7 +245,7 @@ void ScreenSelectStyle::UpdateSelectableChoices() { DEBUG_ASSERT(0); SCREENMAN->SystemMessage( "No Styles are selectable." ); - SCREENMAN->SetNewScreen( THEME->GetMetric("Common","InitialScreen") ); + SCREENMAN->SetNewScreen( INITIAL_SCREEN ); return; } diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 0ce02f7734..e12c4d81c4 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -20,6 +20,7 @@ #include "ProductInfo.h" #include "LightsManager.h" #include "CodeDetector.h" +#include "CommonMetrics.h" #define LOGO_ON_COMMAND THEME->GetMetric("ScreenTitleMenu","LogoOnCommand") @@ -59,7 +60,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam if( PREFSMAN->GetCoinMode() == COIN_PAY && GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) { - SCREENMAN->SetNewScreen( THEME->GetMetric("Common","InitialScreen") ); + SCREENMAN->SetNewScreen( INITIAL_SCREEN ); return; } @@ -349,7 +350,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) m_aModeChoices[m_Choice].ApplyToAllPlayers(); break; case SM_GoToAttractLoop: - SCREENMAN->SetNewScreen( THEME->GetMetric("Common","InitialScreen") ); + SCREENMAN->SetNewScreen( INITIAL_SCREEN ); break; } } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 25711dcbc6..50de6b7d6f 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -28,6 +28,7 @@ #include "Screen.h" #include "CodeDetector.h" +#include "CommonMetrics.h" // // StepMania global classes @@ -98,7 +99,7 @@ static RageDisplay::VideoModeParams GetCurVideoModeParams() PREFSMAN->m_bSmoothLines, PREFSMAN->m_bTrilinearFiltering, PREFSMAN->m_bAnisotropicFiltering, - THEME->GetMetric("Common","WindowTitle"), + WINDOW_TITLE, THEME->GetPathToG("Common window icon"), PREFSMAN->m_bPAL ); @@ -238,9 +239,9 @@ void ResetGame( bool ReturnToFirstScreen ) if( ReturnToFirstScreen ) { if( PREFSMAN->m_bFirstRun ) - SCREENMAN->SetNewScreen( THEME->GetMetric("Common","FirstRunInitialScreen") ); + SCREENMAN->SetNewScreen( FIRST_RUN_INITIAL_SCREEN ); else - SCREENMAN->SetNewScreen( THEME->GetMetric("Common","InitialScreen") ); + SCREENMAN->SetNewScreen( INITIAL_SCREEN ); } PREFSMAN->m_bFirstRun = false;