clean up ScreenTestLights
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
#ifndef EnumHelper_H
|
||||||
|
#define EnumHelper_H
|
||||||
|
|
||||||
|
#define FOREACH_ENUM( e, max, var ) for( e var=(e)0; var<max; ((int&)var)++ )
|
||||||
|
|
||||||
|
|
||||||
|
static const CString EMPTY_STRING;
|
||||||
|
|
||||||
|
#define XToString(X) \
|
||||||
|
const CString& X##ToString( X x ) \
|
||||||
|
{ \
|
||||||
|
if( x == ARRAYSIZE(X##Names)+1 ) \
|
||||||
|
return EMPTY_STRING; \
|
||||||
|
ASSERT(unsigned(x) < ARRAYSIZE(X##Names)); \
|
||||||
|
return X##Names[x]; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define XToThemedString(X) \
|
||||||
|
CString X##ToThemedString( X x ) \
|
||||||
|
{ \
|
||||||
|
return THEME->GetMetric( #X, X##ToString(x) ); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define StringToX(X) \
|
||||||
|
X StringTo##X( const CString& s ) \
|
||||||
|
{ \
|
||||||
|
CString s2 = s; \
|
||||||
|
s2.MakeLower(); \
|
||||||
|
unsigned i; \
|
||||||
|
for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \
|
||||||
|
if( !s2.CompareNoCase(X##Names[i]) ) \
|
||||||
|
return (X)i; \
|
||||||
|
return (X)(i+1); /*invalid*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#ifndef FOREACHENUM_H
|
|
||||||
#define FOREACHENUM_H
|
|
||||||
|
|
||||||
#define FOREACH_ENUM( e, max, var ) for( e var=(e)0; var<max; ((int&)var)++ )
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -14,35 +14,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "EnumHelper.h"
|
||||||
static const CString EMPTY_STRING;
|
|
||||||
|
|
||||||
#define XToString(X) \
|
|
||||||
const CString& X##ToString( X x ) \
|
|
||||||
{ \
|
|
||||||
if( x == ARRAYSIZE(X##Names)+1 ) \
|
|
||||||
return EMPTY_STRING; \
|
|
||||||
ASSERT(unsigned(x) < ARRAYSIZE(X##Names)); \
|
|
||||||
return X##Names[x]; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define XToThemedString(X) \
|
|
||||||
CString X##ToThemedString( X x ) \
|
|
||||||
{ \
|
|
||||||
return THEME->GetMetric( #X, X##ToString(x) ); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define StringToX(X) \
|
|
||||||
X StringTo##X( const CString& s ) \
|
|
||||||
{ \
|
|
||||||
CString s2 = s; \
|
|
||||||
s2.MakeLower(); \
|
|
||||||
unsigned i; \
|
|
||||||
for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \
|
|
||||||
if( !s2.CompareNoCase(X##Names[i]) ) \
|
|
||||||
return (X)i; \
|
|
||||||
return (X)(i+1); /*invalid*/ \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
|
static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PlayerNumber.h" // TODO: Get rid of this dependency. -Chris
|
#include "PlayerNumber.h" // TODO: Get rid of this dependency. -Chris
|
||||||
#include "ForeachEnum.h"
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Screen Dimensions
|
// Screen Dimensions
|
||||||
@@ -59,7 +59,6 @@ enum RadarCategory
|
|||||||
NUM_RADAR_CATEGORIES // leave this at the end
|
NUM_RADAR_CATEGORIES // leave this at the end
|
||||||
};
|
};
|
||||||
#define FOREACH_RadarCategory( rc ) FOREACH_ENUM( RadarCategory, NUM_RADAR_CATEGORIES, rc )
|
#define FOREACH_RadarCategory( rc ) FOREACH_ENUM( RadarCategory, NUM_RADAR_CATEGORIES, rc )
|
||||||
|
|
||||||
const CString& RadarCategoryToString( RadarCategory cat );
|
const CString& RadarCategoryToString( RadarCategory cat );
|
||||||
|
|
||||||
struct RadarValues
|
struct RadarValues
|
||||||
@@ -96,7 +95,6 @@ enum Difficulty
|
|||||||
DIFFICULTY_INVALID
|
DIFFICULTY_INVALID
|
||||||
};
|
};
|
||||||
#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_DIFFICULTIES, dc )
|
#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_DIFFICULTIES, dc )
|
||||||
|
|
||||||
const CString& DifficultyToString( Difficulty dc );
|
const CString& DifficultyToString( Difficulty dc );
|
||||||
CString DifficultyToThemedString( Difficulty dc );
|
CString DifficultyToThemedString( Difficulty dc );
|
||||||
Difficulty StringToDifficulty( const CString& sDC );
|
Difficulty StringToDifficulty( const CString& sDC );
|
||||||
@@ -110,7 +108,6 @@ enum CourseDifficulty
|
|||||||
COURSE_DIFFICULTY_INVALID
|
COURSE_DIFFICULTY_INVALID
|
||||||
};
|
};
|
||||||
#define FOREACH_CourseDifficulty( cd ) FOREACH_ENUM( CourseDifficulty, NUM_COURSE_DIFFICULTIES, cd )
|
#define FOREACH_CourseDifficulty( cd ) FOREACH_ENUM( CourseDifficulty, NUM_COURSE_DIFFICULTIES, cd )
|
||||||
|
|
||||||
const CString& CourseDifficultyToString( CourseDifficulty dc );
|
const CString& CourseDifficultyToString( CourseDifficulty dc );
|
||||||
CString CourseDifficultyToThemedString( CourseDifficulty dc );
|
CString CourseDifficultyToThemedString( CourseDifficulty dc );
|
||||||
CourseDifficulty StringToCourseDifficulty( const CString& sDC );
|
CourseDifficulty StringToCourseDifficulty( const CString& sDC );
|
||||||
@@ -165,7 +162,6 @@ enum PlayMode
|
|||||||
PLAY_MODE_INVALID
|
PLAY_MODE_INVALID
|
||||||
};
|
};
|
||||||
#define FOREACH_PlayMode( pm ) FOREACH_ENUM( PlayMode, NUM_PLAY_MODES, pm )
|
#define FOREACH_PlayMode( pm ) FOREACH_ENUM( PlayMode, NUM_PLAY_MODES, pm )
|
||||||
|
|
||||||
const CString& PlayModeToString( PlayMode pm );
|
const CString& PlayModeToString( PlayMode pm );
|
||||||
PlayMode StringToPlayMode( const CString& s );
|
PlayMode StringToPlayMode( const CString& s );
|
||||||
|
|
||||||
@@ -195,9 +191,7 @@ enum SortOrder {
|
|||||||
SORT_INVALID
|
SORT_INVALID
|
||||||
};
|
};
|
||||||
const SortOrder MAX_SELECTABLE_SORT = (SortOrder)(SORT_ROULETTE-1);
|
const SortOrder MAX_SELECTABLE_SORT = (SortOrder)(SORT_ROULETTE-1);
|
||||||
|
|
||||||
#define FOREACH_SortOrder( so ) FOREACH_ENUM( SortOrder, NUM_SORT_ORDERS, so )
|
#define FOREACH_SortOrder( so ) FOREACH_ENUM( SortOrder, NUM_SORT_ORDERS, so )
|
||||||
|
|
||||||
const CString& SortOrderToString( SortOrder so );
|
const CString& SortOrderToString( SortOrder so );
|
||||||
SortOrder StringToSortOrder( const CString& str );
|
SortOrder StringToSortOrder( const CString& str );
|
||||||
|
|
||||||
@@ -219,7 +213,6 @@ enum TapNoteScore {
|
|||||||
NUM_TAP_NOTE_SCORES
|
NUM_TAP_NOTE_SCORES
|
||||||
};
|
};
|
||||||
#define FOREACH_TapNoteScore( tns ) FOREACH_ENUM( TapNoteScore, NUM_TAP_NOTE_SCORES, tns )
|
#define FOREACH_TapNoteScore( tns ) FOREACH_ENUM( TapNoteScore, NUM_TAP_NOTE_SCORES, tns )
|
||||||
|
|
||||||
const CString& TapNoteScoreToString( TapNoteScore tns );
|
const CString& TapNoteScoreToString( TapNoteScore tns );
|
||||||
|
|
||||||
//enum TapNoteTiming {
|
//enum TapNoteTiming {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ForeachEnum.h"
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
enum GameController
|
enum GameController
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,19 @@
|
|||||||
#include "InputMapper.h"
|
#include "InputMapper.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const CString CabinetLightNames[NUM_CABINET_LIGHTS] = {
|
||||||
|
"MarqueeUpLeft",
|
||||||
|
"MarqueeUpRight",
|
||||||
|
"MarqueeLrLeft",
|
||||||
|
"MarqueeLrRight",
|
||||||
|
"ButtonsLeft",
|
||||||
|
"ButtonsRight",
|
||||||
|
"BassLeft",
|
||||||
|
"BassRight",
|
||||||
|
};
|
||||||
|
XToString( CabinetLight );
|
||||||
|
|
||||||
|
|
||||||
LightsManager* LIGHTSMAN = NULL; // global and accessable from anywhere in our program
|
LightsManager* LIGHTSMAN = NULL; // global and accessable from anywhere in our program
|
||||||
|
|
||||||
LightsManager::LightsManager(CString sDriver)
|
LightsManager::LightsManager(CString sDriver)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "GameInput.h"
|
#include "GameInput.h"
|
||||||
#include "ForeachEnum.h"
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
enum CabinetLight
|
enum CabinetLight
|
||||||
{
|
{
|
||||||
@@ -28,6 +28,7 @@ enum CabinetLight
|
|||||||
NUM_CABINET_LIGHTS
|
NUM_CABINET_LIGHTS
|
||||||
};
|
};
|
||||||
#define FOREACH_CabinetLight( i ) FOREACH_ENUM( CabinetLight, NUM_CABINET_LIGHTS, i )
|
#define FOREACH_CabinetLight( i ) FOREACH_ENUM( CabinetLight, NUM_CABINET_LIGHTS, i )
|
||||||
|
const CString& CabinetLightToString( CabinetLight cl );
|
||||||
|
|
||||||
enum LightsMode
|
enum LightsMode
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "RageTypes.h" // for RageColor
|
#include "RageTypes.h" // for RageColor
|
||||||
#include "ForeachEnum.h"
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -249,7 +249,8 @@ void PlayerOptions::FromString( CString sOptions )
|
|||||||
#define SET_FLOAT( opt ) \
|
#define SET_FLOAT( opt ) \
|
||||||
{ m_ ## opt = level; m_Speed ## opt = speed; }
|
{ m_ ## opt = level; m_Speed ## opt = speed; }
|
||||||
const bool on = (level > 0.5f);
|
const bool on = (level > 0.5f);
|
||||||
if( sBit == "boost" ) SET_FLOAT( fAccels[ACCEL_BOOST] )
|
if( sBit == "clearall" ) Init();
|
||||||
|
else if( sBit == "boost" ) SET_FLOAT( fAccels[ACCEL_BOOST] )
|
||||||
else if( sBit == "brake" || sBit == "land" ) SET_FLOAT( fAccels[ACCEL_BRAKE] )
|
else if( sBit == "brake" || sBit == "land" ) SET_FLOAT( fAccels[ACCEL_BRAKE] )
|
||||||
else if( sBit == "wave" ) SET_FLOAT( fAccels[ACCEL_WAVE] )
|
else if( sBit == "wave" ) SET_FLOAT( fAccels[ACCEL_WAVE] )
|
||||||
else if( sBit == "expand" ) SET_FLOAT( fAccels[ACCEL_EXPAND] )
|
else if( sBit == "expand" ) SET_FLOAT( fAccels[ACCEL_EXPAND] )
|
||||||
|
|||||||
@@ -59,10 +59,16 @@ void ScreenTestLights::Update( float fDeltaTime )
|
|||||||
|
|
||||||
int iSec = (int)RageTimer::GetTimeSinceStart();
|
int iSec = (int)RageTimer::GetTimeSinceStart();
|
||||||
|
|
||||||
|
CabinetLight cl = (CabinetLight)(iSec%NUM_CABINET_LIGHTS);
|
||||||
|
int iNumGameButtons = GAMESTATE->GetCurrentGameDef()->m_iButtonsPerController;
|
||||||
|
GameButton gb = (GameButton)(iSec%iNumGameButtons);
|
||||||
|
CString sCabLight = CabinetLightToString(cl);
|
||||||
|
CString sGameButton = GAMESTATE->GetCurrentGameDef()->m_szButtonNames[gb];
|
||||||
|
|
||||||
CString s;
|
CString s;
|
||||||
s += ssprintf("cabinet light %d\n", iSec%NUM_CABINET_LIGHTS);
|
s += ssprintf("cabinet light %d: %s\n", cl, sCabLight.c_str());
|
||||||
FOREACH_GameController( gc )
|
FOREACH_GameController( gc )
|
||||||
s += ssprintf("controller %d light %d\n", gc+1, iSec%MAX_GAME_BUTTONS);
|
s += ssprintf("controller %d light %d: %s\n", gc+1, gb, sGameButton.c_str());
|
||||||
|
|
||||||
m_textInputs.SetText( s );
|
m_textInputs.SetText( s );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user