FOREACH_ENUM cleanup
This commit is contained in:
@@ -14,7 +14,6 @@ enum GameController
|
|||||||
NUM_GameController, // leave this at the end
|
NUM_GameController, // leave this at the end
|
||||||
GameController_Invalid,
|
GameController_Invalid,
|
||||||
};
|
};
|
||||||
#define FOREACH_GameController( gc ) FOREACH_ENUM( GameController, gc )
|
|
||||||
|
|
||||||
enum GameButton
|
enum GameButton
|
||||||
{
|
{
|
||||||
@@ -57,7 +56,6 @@ RString GameButtonToString( const InputScheme* pInputs, GameButton i );
|
|||||||
RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i );
|
RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i );
|
||||||
GameButton StringToGameButton( const InputScheme* pInputs, const RString& s );
|
GameButton StringToGameButton( const InputScheme* pInputs, const RString& s );
|
||||||
|
|
||||||
#define FOREACH_GameButton( gb ) FOREACH_ENUM( GameButton, gb )
|
|
||||||
#define FOREACH_GameButton_Custom( gb ) for( GameButton gb=GAME_BUTTON_CUSTOM_01; gb<NUM_GameButton; enum_add(gb, +1) )
|
#define FOREACH_GameButton_Custom( gb ) for( GameButton gb=GAME_BUTTON_CUSTOM_01; gb<NUM_GameButton; enum_add(gb, +1) )
|
||||||
|
|
||||||
#define GAME_BUTTON_NEXT GAME_BUTTON_CUSTOM_01
|
#define GAME_BUTTON_NEXT GAME_BUTTON_CUSTOM_01
|
||||||
|
|||||||
@@ -2670,10 +2670,10 @@ RString GameManager::StyleToLocalizedString( const Style* style )
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Game* GameManager::StringToGameType( RString sGameType )
|
const Game* GameManager::StringToGame( RString sGame )
|
||||||
{
|
{
|
||||||
for( size_t i=0; i<ARRAYLEN(g_Games); ++i )
|
for( size_t i=0; i<ARRAYLEN(g_Games); ++i )
|
||||||
if( !sGameType.CompareNoCase(g_Games[i]->m_szName) )
|
if( !sGame.CompareNoCase(g_Games[i]->m_szName) )
|
||||||
return g_Games[i];
|
return g_Games[i];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace GameManager
|
|||||||
|
|
||||||
const StepsTypeInfo &GetStepsTypeInfo( StepsType st );
|
const StepsTypeInfo &GetStepsTypeInfo( StepsType st );
|
||||||
StepsType StringToStepsType( RString sStepsType );
|
StepsType StringToStepsType( RString sStepsType );
|
||||||
const Game* StringToGameType( RString sGameType );
|
const Game* StringToGame( RString sGame );
|
||||||
const Style* GameAndStringToStyle( const Game* pGame, RString sStyle );
|
const Style* GameAndStringToStyle( const Game* pGame, RString sStyle );
|
||||||
RString StyleToLocalizedString( const Style* s );
|
RString StyleToLocalizedString( const Style* s );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ InputMapper::~InputMapper()
|
|||||||
|
|
||||||
void InputMapper::ClearAllMappings()
|
void InputMapper::ClearAllMappings()
|
||||||
{
|
{
|
||||||
FOREACH_GameController( i )
|
FOREACH_ENUM( GameController, i )
|
||||||
FOREACH_GameButton(j)
|
FOREACH_ENUM( GameButton, j)
|
||||||
for( int k=0; k<NUM_GAME_TO_DEVICE_SLOTS; k++ )
|
for( int k=0; k<NUM_GAME_TO_DEVICE_SLOTS; k++ )
|
||||||
m_GItoDI[i][j][k].MakeInvalid();
|
m_GItoDI[i][j][k].MakeInvalid();
|
||||||
UpdateTempDItoGI();
|
UpdateTempDItoGI();
|
||||||
@@ -79,8 +79,8 @@ const InputMapping g_DefaultKeyMappings[] =
|
|||||||
void InputMapper::AddDefaultMappingsForCurrentGameIfUnmapped()
|
void InputMapper::AddDefaultMappingsForCurrentGameIfUnmapped()
|
||||||
{
|
{
|
||||||
// Clear default mappings. Default mappings are in the third slot.
|
// Clear default mappings. Default mappings are in the third slot.
|
||||||
FOREACH_GameController( i )
|
FOREACH_ENUM( GameController, i )
|
||||||
FOREACH_GameButton(j)
|
FOREACH_ENUM( GameButton, j)
|
||||||
ClearFromInputMap( GameInput(i, j), 2 );
|
ClearFromInputMap( GameInput(i, j), 2 );
|
||||||
|
|
||||||
vector<InputMapping> aMaps;
|
vector<InputMapping> aMaps;
|
||||||
@@ -595,9 +595,9 @@ const AutoJoyMapping g_AutoJoyMappings[] =
|
|||||||
|
|
||||||
void InputMapper::Unmap( InputDevice id )
|
void InputMapper::Unmap( InputDevice id )
|
||||||
{
|
{
|
||||||
FOREACH_GameController( i )
|
FOREACH_ENUM( GameController, i )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton(j)
|
FOREACH_ENUM( GameButton, j)
|
||||||
{
|
{
|
||||||
for( int k=0; k<NUM_USER_GAME_TO_DEVICE_SLOTS; k++ )
|
for( int k=0; k<NUM_USER_GAME_TO_DEVICE_SLOTS; k++ )
|
||||||
{
|
{
|
||||||
@@ -744,7 +744,7 @@ void InputMapper::SaveMappingsToDisk()
|
|||||||
pKey = ini.AppendChild( m_pInputScheme->m_szName );
|
pKey = ini.AppendChild( m_pInputScheme->m_szName );
|
||||||
|
|
||||||
// iterate over our input map and write all mappings to the ini file
|
// iterate over our input map and write all mappings to the ini file
|
||||||
FOREACH_GameController( i )
|
FOREACH_ENUM( GameController, i )
|
||||||
{
|
{
|
||||||
FOREACH_GameButtonInScheme( m_pInputScheme, j )
|
FOREACH_GameButtonInScheme( m_pInputScheme, j )
|
||||||
{
|
{
|
||||||
@@ -851,9 +851,9 @@ void InputMapper::ClearFromInputMap( const DeviceInput &DeviceI )
|
|||||||
{
|
{
|
||||||
// search for where this DeviceI maps to
|
// search for where this DeviceI maps to
|
||||||
|
|
||||||
FOREACH_GameController( p )
|
FOREACH_ENUM( GameController, p )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton(b)
|
FOREACH_ENUM( GameButton, b)
|
||||||
{
|
{
|
||||||
for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ )
|
for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ )
|
||||||
{
|
{
|
||||||
@@ -889,9 +889,9 @@ void InputMapper::UpdateTempDItoGI()
|
|||||||
{
|
{
|
||||||
// repopulate g_tempDItoGI
|
// repopulate g_tempDItoGI
|
||||||
g_tempDItoGI.clear();
|
g_tempDItoGI.clear();
|
||||||
FOREACH_GameController( n )
|
FOREACH_ENUM( GameController, n )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( b )
|
FOREACH_ENUM( GameButton, b )
|
||||||
{
|
{
|
||||||
for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ )
|
for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ )
|
||||||
{
|
{
|
||||||
@@ -1121,7 +1121,7 @@ void InputScheme::MenuButtonToGameButtons( GameButton MenuI, vector<GameButton>
|
|||||||
if( MenuI == GameButton_Invalid )
|
if( MenuI == GameButton_Invalid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FOREACH_GameButton(gb)
|
FOREACH_ENUM( GameButton, gb)
|
||||||
{
|
{
|
||||||
if( PREFSMAN->m_bOnlyDedicatedMenuButtons && gb >= GAME_BUTTON_NEXT )
|
if( PREFSMAN->m_bOnlyDedicatedMenuButtons && gb >= GAME_BUTTON_NEXT )
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const unsigned MAX_INPUT_QUEUE_LENGTH = 32;
|
|||||||
|
|
||||||
InputQueue::InputQueue()
|
InputQueue::InputQueue()
|
||||||
{
|
{
|
||||||
FOREACH_GameController ( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
m_aQueue[gc].resize( MAX_INPUT_QUEUE_LENGTH );
|
m_aQueue[gc].resize( MAX_INPUT_QUEUE_LENGTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static void GetUsedGameInputs( vector<GameInput> &vGameInputsOut )
|
|||||||
|
|
||||||
vector<RString> asGameButtons;
|
vector<RString> asGameButtons;
|
||||||
split( GAME_BUTTONS_TO_SHOW.GetValue(), ",", asGameButtons );
|
split( GAME_BUTTONS_TO_SHOW.GetValue(), ",", asGameButtons );
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_CONST( RString, asGameButtons, button )
|
FOREACH_CONST( RString, asGameButtons, button )
|
||||||
{
|
{
|
||||||
@@ -168,8 +168,8 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
FOREACH_CabinetLight( cl )
|
FOREACH_CabinetLight( cl )
|
||||||
fapproach( m_fSecsLeftInCabinetLightBlink[cl], 0, fDeltaTime );
|
fapproach( m_fSecsLeftInCabinetLightBlink[cl], 0, fDeltaTime );
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
fapproach( m_fSecsLeftInGameButtonBlink[gc][gb], 0, fDeltaTime );
|
fapproach( m_fSecsLeftInGameButtonBlink[gc][gb], 0, fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,11 +306,11 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
case LIGHTSMODE_STAGE:
|
case LIGHTSMODE_STAGE:
|
||||||
case LIGHTSMODE_JOINING:
|
case LIGHTSMODE_JOINING:
|
||||||
{
|
{
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
bool bOn = GAMESTATE->m_bSideIsJoined[gc];
|
bool bOn = GAMESTATE->m_bSideIsJoined[gc];
|
||||||
|
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
m_LightsState.m_bGameButtonLights[gc][gb] = bOn;
|
m_LightsState.m_bGameButtonLights[gc][gb] = bOn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,9 +323,9 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
// Blink on notes.
|
// Blink on notes.
|
||||||
//
|
//
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
{
|
{
|
||||||
m_LightsState.m_bGameButtonLights[gc][gb] = m_fSecsLeftInGameButtonBlink[gc][gb] > 0 ;
|
m_LightsState.m_bGameButtonLights[gc][gb] = m_fSecsLeftInGameButtonBlink[gc][gb] > 0 ;
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
// Blink on button presses.
|
// Blink on button presses.
|
||||||
//
|
//
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton_Custom( gb )
|
FOREACH_GameButton_Custom( gb )
|
||||||
{
|
{
|
||||||
@@ -452,9 +452,9 @@ CabinetLight LightsManager::GetFirstLitCabinetLight()
|
|||||||
|
|
||||||
GameInput LightsManager::GetFirstLitGameButtonLight()
|
GameInput LightsManager::GetFirstLitGameButtonLight()
|
||||||
{
|
{
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
{
|
{
|
||||||
if( m_LightsState.m_bGameButtonLights[gc][gb] )
|
if( m_LightsState.m_bGameButtonLights[gc][gb] )
|
||||||
return GameInput( gc, gb );
|
return GameInput( gc, gb );
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ void NetworkSyncManager::ProcessInput()
|
|||||||
GameName = m_packet.ReadNT();
|
GameName = m_packet.ReadNT();
|
||||||
StyleName = m_packet.ReadNT();
|
StyleName = m_packet.ReadNT();
|
||||||
|
|
||||||
GAMESTATE->SetCurGame( GameManager::StringToGameType(GameName) );
|
GAMESTATE->SetCurGame( GameManager::StringToGame(GameName) );
|
||||||
GAMESTATE->SetCurrentStyle( GameManager::GameAndStringToStyle(GAMESTATE->m_pCurGame,StyleName) );
|
GAMESTATE->SetCurrentStyle( GameManager::GameAndStringToStyle(GAMESTATE->m_pCurGame,StyleName) );
|
||||||
|
|
||||||
SCREENMAN->SetNewScreen( "ScreenNetSelectMusic" ); //Should this be metric'd out?
|
SCREENMAN->SetNewScreen( "ScreenNetSelectMusic" ); //Should this be metric'd out?
|
||||||
|
|||||||
@@ -1973,9 +1973,9 @@ void ScreenGameplay::UpdateLights()
|
|||||||
LIGHTSMAN->BlinkCabinetLight( cl );
|
LIGHTSMAN->BlinkCabinetLight( cl );
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
{
|
{
|
||||||
if( bBlinkGameButton[gc][gb] )
|
if( bBlinkGameButton[gc][gb] )
|
||||||
LIGHTSMAN->BlinkGameButton( GameInput(gc,gb) );
|
LIGHTSMAN->BlinkGameButton( GameInput(gc,gb) );
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void ScreenMapControllers::Init()
|
|||||||
|
|
||||||
// header row
|
// header row
|
||||||
{
|
{
|
||||||
FOREACH_GameController( c )
|
FOREACH_ENUM( GameController, c )
|
||||||
{
|
{
|
||||||
BitmapText &text = m_textLabel[c];
|
BitmapText &text = m_textLabel[c];
|
||||||
text.LoadFromFont( THEME->GetPathF("Common","title") );
|
text.LoadFromFont( THEME->GetPathF("Common","title") );
|
||||||
@@ -111,7 +111,7 @@ void ScreenMapControllers::Init()
|
|||||||
m_Line[iRow].AddChild( pSecondary );
|
m_Line[iRow].AddChild( pSecondary );
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_GameController( c )
|
FOREACH_ENUM( GameController, c )
|
||||||
{
|
{
|
||||||
for( int s=0; s<NUM_SHOWN_GAME_TO_DEVICE_SLOTS; s++ )
|
for( int s=0; s<NUM_SHOWN_GAME_TO_DEVICE_SLOTS; s++ )
|
||||||
{
|
{
|
||||||
@@ -435,7 +435,7 @@ void ScreenMapControllers::AfterChangeFocus()
|
|||||||
|
|
||||||
void ScreenMapControllers::Refresh()
|
void ScreenMapControllers::Refresh()
|
||||||
{
|
{
|
||||||
FOREACH_GameController( p )
|
FOREACH_ENUM( GameController, p )
|
||||||
{
|
{
|
||||||
for( unsigned b=0; b<m_KeysToMap.size(); b++ )
|
for( unsigned b=0; b<m_KeysToMap.size(); b++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -751,7 +751,7 @@ RageDisplay *CreateDisplay()
|
|||||||
|
|
||||||
static void SwitchToLastPlayedGame()
|
static void SwitchToLastPlayedGame()
|
||||||
{
|
{
|
||||||
const Game *pGame = GameManager::StringToGameType( PREFSMAN->GetCurrentGame() );
|
const Game *pGame = GameManager::StringToGame( PREFSMAN->GetCurrentGame() );
|
||||||
|
|
||||||
/* If the active game type isn't actually available, revert to the default. */
|
/* If the active game type isn't actually available, revert to the default. */
|
||||||
if( pGame == NULL )
|
if( pGame == NULL )
|
||||||
@@ -1408,7 +1408,7 @@ void HandleInputEvents(float fDeltaTime)
|
|||||||
/* When a GameButton is pressed, stop repeating other keys on the same controller. */
|
/* When a GameButton is pressed, stop repeating other keys on the same controller. */
|
||||||
if( input.type == IET_FIRST_PRESS && input.MenuI != GameButton_Invalid )
|
if( input.type == IET_FIRST_PRESS && input.MenuI != GameButton_Invalid )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( m )
|
FOREACH_ENUM( GameButton, m )
|
||||||
{
|
{
|
||||||
if( input.MenuI != m )
|
if( input.MenuI != m )
|
||||||
INPUTMAPPER->RepeatStopKey( m, input.pn );
|
INPUTMAPPER->RepeatStopKey( m, input.pn );
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ GameInput Style::StyleInputToGameInput( int iCol, PlayerNumber pn ) const
|
|||||||
ssprintf("P%i C%i", pn, iCol) );
|
ssprintf("P%i C%i", pn, iCol) );
|
||||||
bool bUsingOneSide = m_StyleType != StyleType_OnePlayerTwoSides && m_StyleType != StyleType_TwoPlayersSharedSides;
|
bool bUsingOneSide = m_StyleType != StyleType_OnePlayerTwoSides && m_StyleType != StyleType_TwoPlayersSharedSides;
|
||||||
|
|
||||||
FOREACH_GameController(gc)
|
FOREACH_ENUM( GameController, gc)
|
||||||
{
|
{
|
||||||
if( bUsingOneSide && gc != (int) pn )
|
if( bUsingOneSide && gc != (int) pn )
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void StyleID::FromStyle( const Style *p )
|
|||||||
|
|
||||||
const Style *StyleID::ToStyle() const
|
const Style *StyleID::ToStyle() const
|
||||||
{
|
{
|
||||||
const Game* pGame = GameManager::StringToGameType( sGame );
|
const Game* pGame = GameManager::StringToGame( sGame );
|
||||||
if( pGame == NULL )
|
if( pGame == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void LightsDriver_LinuxParallel::Set( const LightsState *ls )
|
|||||||
int iNumGameButtonsToShow = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( "Start" );
|
int iNumGameButtonsToShow = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( "Start" );
|
||||||
if( iNumGameButtonsToShow == GameButton_Invalid )
|
if( iNumGameButtonsToShow == GameButton_Invalid )
|
||||||
iNumGameButtonsToShow = INPUTMAPPER->GetInputScheme()->m_iButtonsPerController;
|
iNumGameButtonsToShow = INPUTMAPPER->GetInputScheme()->m_iButtonsPerController;
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
s += ssprintf("Controller%d Bits: ",gc+1);
|
s += ssprintf("Controller%d Bits: ",gc+1);
|
||||||
for( int gb=0; gb<iNumGameButtonsToShow; gb++ )
|
for( int gb=0; gb<iNumGameButtonsToShow; gb++ )
|
||||||
|
|||||||
@@ -166,9 +166,9 @@ void LightsDriver_LinuxWeedTech::Set(const LightsState *ls)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
{
|
{
|
||||||
// Only send the command if the light has changed states (on/off)
|
// Only send the command if the light has changed states (on/off)
|
||||||
bool bOn = ls->m_bGameButtonLights[gc][gb];
|
bool bOn = ls->m_bGameButtonLights[gc][gb];
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ void LightsDriver_SystemMessage::Set( const LightsState *ls )
|
|||||||
}
|
}
|
||||||
s += "\n";
|
s += "\n";
|
||||||
|
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
s += ssprintf("Controller%d: ",gc+1);
|
s += ssprintf("Controller%d: ",gc+1);
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
{
|
{
|
||||||
s += ls->m_bGameButtonLights[gc][gb] ? '1' : '0';
|
s += ls->m_bGameButtonLights[gc][gb] ? '1' : '0';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ void LightsDriver_Win32Parallel::Set( const LightsState *ls )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_GameController( gc )
|
FOREACH_ENUM( GameController, gc )
|
||||||
{
|
{
|
||||||
FOREACH_GameButton( gb )
|
FOREACH_ENUM( GameButton, gb )
|
||||||
{
|
{
|
||||||
bool bOn = ls->m_bGameButtonLights[gc][gb];
|
bool bOn = ls->m_bGameButtonLights[gc][gb];
|
||||||
int index = GameControllerAndGameButtonToIndex( gc, gb );
|
int index = GameControllerAndGameButtonToIndex( gc, gb );
|
||||||
|
|||||||
Reference in New Issue
Block a user