diff --git a/stepmania/src/CommonMetrics.cpp b/stepmania/src/CommonMetrics.cpp new file mode 100644 index 0000000000..709f9a7e50 --- /dev/null +++ b/stepmania/src/CommonMetrics.cpp @@ -0,0 +1,42 @@ +#include "global.h" +#include "CommonMetrics.h" +#include "RageUtil.h" + + +CString PLAYER_COLOR_NAME( size_t p ) { return ssprintf("ColorP%d",p+1); } + +ThemeMetric DIFFICULTIES_TO_SHOW ("Common","DifficultiesToShow"); +ThemeMetric INITIAL_SCREEN ("Common","InitialScreen"); +ThemeMetric FIRST_RUN_INITIAL_SCREEN ("Common","FirstRunInitialScreen"); +ThemeMetric DEFAULT_MODIFIERS ("Common","DefaultModifiers" ); +ThemeMetric DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" ); +ThemeMetric COURSE_DIFFICULTIES_TO_SHOW ("Common","CourseDifficultiesToShow"); +ThemeMetric1D PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS); +ThemeMetric JOIN_PAUSE_SECONDS ("Common","JoinPauseSeconds"); +ThemeMetric WINDOW_TITLE ("Common","WindowTitle"); + + +/* + * (c) 2001-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/CommonMetrics.h b/stepmania/src/CommonMetrics.h index f7606fa8b7..b1fc87b058 100644 --- a/stepmania/src/CommonMetrics.h +++ b/stepmania/src/CommonMetrics.h @@ -3,17 +3,18 @@ #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") +#include "ThemeMetric.h" +#include "PlayerNumber.h" + +extern ThemeMetric DIFFICULTIES_TO_SHOW; +extern ThemeMetric INITIAL_SCREEN; +extern ThemeMetric FIRST_RUN_INITIAL_SCREEN; +extern ThemeMetric DEFAULT_MODIFIERS; +extern ThemeMetric DEFAULT_CPU_MODIFIERS; +extern ThemeMetric COURSE_DIFFICULTIES_TO_SHOW; +extern ThemeMetric1D PLAYER_COLOR; +extern ThemeMetric JOIN_PAUSE_SECONDS; +extern ThemeMetric WINDOW_TITLE; #endif diff --git a/stepmania/src/DifficultyList.cpp b/stepmania/src/DifficultyList.cpp index 8cb15262be..d6bc72f001 100644 --- a/stepmania/src/DifficultyList.cpp +++ b/stepmania/src/DifficultyList.cpp @@ -284,7 +284,7 @@ void DifficultyList::SetFromGameState() // it really should round to the nearest difficulty that's in // DIFFICULTIES_TO_SHOW. CStringArray asDiff; - split( DIFFICULTIES_TO_SHOW, ",", asDiff ); + split( DIFFICULTIES_TO_SHOW.GetValue(), ",", asDiff ); for( unsigned i=0; iGetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1)) #define LABEL_OFFSET_Y( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetY",i+1)) @@ -132,7 +133,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() // // use a fan to draw the volume // - RageColor color = PlayerToColor( p ); + RageColor color = PLAYER_COLOR.GetValue(p); color.a = 0.5f; v[0].p = RageVector3( 0, 0, 0 ); v[0].c = color; @@ -165,7 +166,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fY = -sinf(fRotation) * fDistFromCenter; v[i].p = RageVector3( fX, fY, 0 ); - v[i].c = PlayerToColor( p ); + v[i].c = PLAYER_COLOR.GetValue( p ); } // TODO: Add this back in. -Chris diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index 1fc1bffbd1..80d92b2b2f 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -61,7 +61,9 @@ ActorCommands.cpp ActorCommands.h Attack.cpp Attack.h AutoKeysounds.cpp AutoKeys BannerCache.cpp BannerCache.h CatalogXml.cpp CatalogXml.h \ Character.cpp Character.h CharacterHead.cpp CharacterHead.h \ CodeDetector.cpp CodeDetector.h \ -Command.cpp Command.h Difficulty.cpp Difficulty.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h \ +Command.cpp Command.h \ +CommonMetrics.cpp CommonMetrics.h \ +Difficulty.cpp Difficulty.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h \ CourseUtil.cpp CourseUtil.h DateTime.cpp DateTime.h Font.cpp Font.h FontCharAliases.cpp FontCharAliases.h \ FontCharmaps.cpp FontCharmaps.h Game.cpp Game.h GameCommand.cpp GameCommand.h \ GameConstantsAndTypes.cpp GameConstantsAndTypes.h \ diff --git a/stepmania/src/PlayerNumber.cpp b/stepmania/src/PlayerNumber.cpp index 5f4d4a07cd..c317c98def 100644 --- a/stepmania/src/PlayerNumber.cpp +++ b/stepmania/src/PlayerNumber.cpp @@ -5,16 +5,6 @@ #include "CommonMetrics.h" -RageColor PlayerToColor( PlayerNumber pn ) -{ - switch( pn ) - { - case PLAYER_1: return COLOR_P1; - case PLAYER_2: return COLOR_P2; - default: ASSERT(0); return RageColor(0.5f,0.5f,0.5f,1); - } -}; - PlayerNumber GetNextHumanPlayer( PlayerNumber pn ) { for( PlayerNumber p=(PlayerNumber)(pn+1); pm_PlayerNumber; - m_text.SetDiffuse( PlayerToColor(pn) ); + m_text.SetDiffuse( PLAYER_COLOR.GetValue(pn) ); } void ScoreDisplayNormal::SetScore( int iNewScore ) diff --git a/stepmania/src/ScoreDisplayOni.cpp b/stepmania/src/ScoreDisplayOni.cpp index 70575d1266..c6eac36ec5 100644 --- a/stepmania/src/ScoreDisplayOni.cpp +++ b/stepmania/src/ScoreDisplayOni.cpp @@ -8,6 +8,7 @@ #include "ThemeManager.h" #include "StageStats.h" #include "PlayerState.h" +#include "CommonMetrics.h" ScoreDisplayOni::ScoreDisplayOni() @@ -30,7 +31,7 @@ void ScoreDisplayOni::Init( const PlayerState* pPlayerState ) // TODO: Remove use of PlayerNumber. PlayerNumber pn = pPlayerState->m_PlayerNumber; - m_text.SetDiffuse( PlayerToColor(pn) ); + m_text.SetDiffuse( PLAYER_COLOR.GetValue(pn) ); } diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index 9cc3408a6b..18f4a6ef93 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -27,7 +27,7 @@ ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : Screen( sN LOG->Trace( "ScreenAttract::ScreenAttract(%s)", m_sName.c_str() ); // increment times through attract count - if( m_sName == INITIAL_SCREEN ) + if( m_sName == INITIAL_SCREEN.GetValue() ) GAMESTATE->m_iNumTimesThroughAttract++; if( bResetGameState ) diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index f54916ff9f..379b084185 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -30,6 +30,7 @@ #include "MemoryCardManager.h" #include "PlayerState.h" #include "Command.h" +#include "CommonMetrics.h" const int NUM_SCORE_DIGITS = 9; @@ -624,7 +625,7 @@ void ScreenEvaluation::Init() { m_textJudgeNumbers[l][p].LoadFromFont( THEME->GetPathF(m_sName, "judge") ); m_textJudgeNumbers[l][p].SetShadowLength( 0 ); - m_textJudgeNumbers[l][p].SetDiffuse( PlayerToColor(p) ); + m_textJudgeNumbers[l][p].SetDiffuse( PLAYER_COLOR.GetValue(p) ); m_textJudgeNumbers[l][p].SetName( ssprintf("%sNumberP%d",JUDGE_STRING[l],p+1) ); SET_XY_AND_ON_COMMAND( m_textJudgeNumbers[l][p] ); this->AddChild( &m_textJudgeNumbers[l][p] ); @@ -665,7 +666,7 @@ void ScreenEvaluation::Init() FOREACH_EnabledPlayer( p ) { m_textStatsText[l][p].LoadFromFont( THEME->GetPathF("ScreenEvaluation","stats") ); - m_textStatsText[l][p].SetDiffuse( PlayerToColor(p) ); + m_textStatsText[l][p].SetDiffuse( PLAYER_COLOR.GetValue(p) ); m_textStatsText[l][p].SetName( ssprintf("%sTextP%d",STATS_STRING[l],p+1) ); SET_XY_AND_ON_COMMAND( m_textStatsText[l][p] ); this->AddChild( &m_textStatsText[l][p] ); @@ -696,7 +697,7 @@ void ScreenEvaluation::Init() { m_textScore[p].LoadFromFont( THEME->GetPathF(m_sName, "score") ); m_textScore[p].SetShadowLength( 0 ); - m_textScore[p].SetDiffuse( PlayerToColor(p) ); + m_textScore[p].SetDiffuse( PLAYER_COLOR.GetValue(p) ); m_textScore[p].SetName( ssprintf("ScoreNumberP%d",p+1) ); SET_XY_AND_ON_COMMAND( m_textScore[p] ); m_textScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, stageStats.m_player[p].iScore) ); @@ -721,7 +722,7 @@ void ScreenEvaluation::Init() m_textTotalScore[p].LoadFromFont( THEME->GetPathF(m_sName, "totalscore") ); m_textTotalScore[p].SetShadowLength( 0 ); - m_textTotalScore[p].SetDiffuse( PlayerToColor(p) ); + m_textTotalScore[p].SetDiffuse( PLAYER_COLOR.GetValue(p) ); m_textTotalScore[p].SetName( ssprintf("TotalScoreNumberP%d",p+1) ); m_textTotalScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS+2, iTotalScore) ); SET_XY_AND_ON_COMMAND( m_textTotalScore[p] ); @@ -744,7 +745,7 @@ void ScreenEvaluation::Init() { m_textTime[p].LoadFromFont( THEME->GetPathF(m_sName, "time") ); m_textTime[p].SetShadowLength( 0 ); - m_textTime[p].SetDiffuse( PlayerToColor(p) ); + m_textTime[p].SetDiffuse( PLAYER_COLOR.GetValue(p) ); m_textTime[p].SetName( ssprintf("TimeNumberP%d",p+1) ); SET_XY_AND_ON_COMMAND( m_textTime[p] ); m_textTime[p].SetText( SecondsToMMSSMsMs(stageStats.m_player[p].fAliveSeconds) ); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 0b28b37e5f..3530fb4bb8 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -26,6 +26,7 @@ #include "Style.h" #include "PlayerState.h" #include "Command.h" +#include "CommonMetrics.h" const int NUM_SCORE_DIGITS = 9; @@ -273,7 +274,7 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuEleme m_textHighScore[p].SetName( ssprintf("ScoreP%d",p+1) ); m_textHighScore[p].LoadFromFont( THEME->GetPathF(m_sName,"score") ); m_textHighScore[p].SetShadowLength( 0 ); - m_textHighScore[p].SetDiffuse( PlayerToColor(p) ); + m_textHighScore[p].SetDiffuse( PLAYER_COLOR.GetValue(p) ); SET_XY( m_textHighScore[p] ); this->AddChild( &m_textHighScore[p] ); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index a0f3ec05ef..0fff06647e 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -62,7 +62,7 @@ IntDir=.\../Debug6 TargetDir=\stepmania\stepmania\Program TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -99,7 +99,7 @@ IntDir=.\../Release6 TargetDir=\stepmania\stepmania\Program TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -724,6 +724,14 @@ SOURCE=.\Command.h # End Source File # Begin Source File +SOURCE=.\CommonMetrics.cpp +# End Source File +# Begin Source File + +SOURCE=.\CommonMetrics.h +# End Source File +# Begin Source File + SOURCE=.\Course.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 547329362c..3722464c7e 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -611,6 +611,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + +