cache common metrics
This commit is contained in:
@@ -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<CString> DIFFICULTIES_TO_SHOW ("Common","DifficultiesToShow");
|
||||
ThemeMetric<CString> INITIAL_SCREEN ("Common","InitialScreen");
|
||||
ThemeMetric<CString> FIRST_RUN_INITIAL_SCREEN ("Common","FirstRunInitialScreen");
|
||||
ThemeMetric<CString> DEFAULT_MODIFIERS ("Common","DefaultModifiers" );
|
||||
ThemeMetric<CString> DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" );
|
||||
ThemeMetric<CString> COURSE_DIFFICULTIES_TO_SHOW ("Common","CourseDifficultiesToShow");
|
||||
ThemeMetric1D<RageColor,NUM_PLAYERS> PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS);
|
||||
ThemeMetric<float> JOIN_PAUSE_SECONDS ("Common","JoinPauseSeconds");
|
||||
ThemeMetric<CString> 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.
|
||||
*/
|
||||
@@ -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<CString> DIFFICULTIES_TO_SHOW;
|
||||
extern ThemeMetric<CString> INITIAL_SCREEN;
|
||||
extern ThemeMetric<CString> FIRST_RUN_INITIAL_SCREEN;
|
||||
extern ThemeMetric<CString> DEFAULT_MODIFIERS;
|
||||
extern ThemeMetric<CString> DEFAULT_CPU_MODIFIERS;
|
||||
extern ThemeMetric<CString> COURSE_DIFFICULTIES_TO_SHOW;
|
||||
extern ThemeMetric1D<RageColor,NUM_PLAYERS> PLAYER_COLOR;
|
||||
extern ThemeMetric<float> JOIN_PAUSE_SECONDS;
|
||||
extern ThemeMetric<CString> WINDOW_TITLE;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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; i<asDiff.size(); i++ )
|
||||
{
|
||||
Difficulty d = StringToDifficulty( asDiff[i] );
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "RageDisplay.h"
|
||||
#include "RageMath.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "CommonMetrics.h"
|
||||
|
||||
#define LABEL_OFFSET_X( i ) THEME->GetMetricF("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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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); p<NUM_PLAYERS; ((int&)p)++ )
|
||||
|
||||
@@ -29,8 +29,6 @@ PlayerNumber GetNextPotentialCpuPlayer( PlayerNumber pn );
|
||||
|
||||
const PlayerNumber OPPOSITE_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 };
|
||||
|
||||
RageColor PlayerToColor( PlayerNumber pn );
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "ThemeManager.h"
|
||||
#include "PlayerState.h"
|
||||
#include "StageStats.h"
|
||||
#include "CommonMetrics.h"
|
||||
|
||||
|
||||
const float SCORE_TWEEN_TIME = 0.2f;
|
||||
@@ -43,7 +44,7 @@ void ScoreDisplayNormal::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) );
|
||||
}
|
||||
|
||||
void ScoreDisplayNormal::SetScore( int iNewScore )
|
||||
|
||||
@@ -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) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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) );
|
||||
|
||||
@@ -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] );
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -611,6 +611,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="Command.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CommonMetrics.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CommonMetrics.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Course.cpp">
|
||||
</File>
|
||||
|
||||
Reference in New Issue
Block a user