diff --git a/stepmania/src/GameInput.h b/stepmania/src/GameInput.h index 628b44d6e4..e473efaa0a 100644 --- a/stepmania/src/GameInput.h +++ b/stepmania/src/GameInput.h @@ -14,7 +14,6 @@ enum GameController NUM_GameController, // leave this at the end GameController_Invalid, }; -#define FOREACH_GameController( gc ) FOREACH_ENUM( GameController, gc ) enum GameButton { @@ -57,7 +56,6 @@ RString GameButtonToString( const InputScheme* pInputs, GameButton i ); RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i ); 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; gbm_szName) ) + if( !sGame.CompareNoCase(g_Games[i]->m_szName) ) return g_Games[i]; return NULL; diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index f8c67df81f..04bf6a626c 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -38,7 +38,7 @@ namespace GameManager const StepsTypeInfo &GetStepsTypeInfo( StepsType st ); StepsType StringToStepsType( RString sStepsType ); - const Game* StringToGameType( RString sGameType ); + const Game* StringToGame( RString sGame ); const Style* GameAndStringToStyle( const Game* pGame, RString sStyle ); RString StyleToLocalizedString( const Style* s ); } diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 51016e1fad..8bc3cd321f 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -40,8 +40,8 @@ InputMapper::~InputMapper() void InputMapper::ClearAllMappings() { - FOREACH_GameController( i ) - FOREACH_GameButton(j) + FOREACH_ENUM( GameController, i ) + FOREACH_ENUM( GameButton, j) for( int k=0; k aMaps; @@ -595,9 +595,9 @@ const AutoJoyMapping g_AutoJoyMappings[] = void InputMapper::Unmap( InputDevice id ) { - FOREACH_GameController( i ) + FOREACH_ENUM( GameController, i ) { - FOREACH_GameButton(j) + FOREACH_ENUM( GameButton, j) { for( int k=0; km_szName ); // 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 ) { @@ -851,9 +851,9 @@ void InputMapper::ClearFromInputMap( const DeviceInput &DeviceI ) { // 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 if( MenuI == GameButton_Invalid ) return; - FOREACH_GameButton(gb) + FOREACH_ENUM( GameButton, gb) { if( PREFSMAN->m_bOnlyDedicatedMenuButtons && gb >= GAME_BUTTON_NEXT ) break; diff --git a/stepmania/src/InputQueue.cpp b/stepmania/src/InputQueue.cpp index 8e3d845479..9c4b6102e7 100644 --- a/stepmania/src/InputQueue.cpp +++ b/stepmania/src/InputQueue.cpp @@ -13,7 +13,7 @@ const unsigned MAX_INPUT_QUEUE_LENGTH = 32; InputQueue::InputQueue() { - FOREACH_GameController ( gc ) + FOREACH_ENUM( GameController, gc ) m_aQueue[gc].resize( MAX_INPUT_QUEUE_LENGTH ); } diff --git a/stepmania/src/LightsManager.cpp b/stepmania/src/LightsManager.cpp index 22b17e6d17..8dfe33add2 100644 --- a/stepmania/src/LightsManager.cpp +++ b/stepmania/src/LightsManager.cpp @@ -54,7 +54,7 @@ static void GetUsedGameInputs( vector &vGameInputsOut ) vector asGameButtons; split( GAME_BUTTONS_TO_SHOW.GetValue(), ",", asGameButtons ); - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { FOREACH_CONST( RString, asGameButtons, button ) { @@ -168,8 +168,8 @@ void LightsManager::Update( float fDeltaTime ) { FOREACH_CabinetLight( cl ) fapproach( m_fSecsLeftInCabinetLightBlink[cl], 0, fDeltaTime ); - FOREACH_GameController( gc ) - FOREACH_GameButton( gb ) + FOREACH_ENUM( GameController, gc ) + FOREACH_ENUM( GameButton, gb ) fapproach( m_fSecsLeftInGameButtonBlink[gc][gb], 0, fDeltaTime ); } @@ -306,11 +306,11 @@ void LightsManager::Update( float fDeltaTime ) case LIGHTSMODE_STAGE: case LIGHTSMODE_JOINING: { - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { bool bOn = GAMESTATE->m_bSideIsJoined[gc]; - FOREACH_GameButton( gb ) + FOREACH_ENUM( GameButton, gb ) m_LightsState.m_bGameButtonLights[gc][gb] = bOn; } } @@ -323,9 +323,9 @@ void LightsManager::Update( float fDeltaTime ) // // 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 ; } @@ -336,7 +336,7 @@ void LightsManager::Update( float fDeltaTime ) // // Blink on button presses. // - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { FOREACH_GameButton_Custom( gb ) { @@ -452,9 +452,9 @@ CabinetLight LightsManager::GetFirstLitCabinetLight() GameInput LightsManager::GetFirstLitGameButtonLight() { - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { - FOREACH_GameButton( gb ) + FOREACH_ENUM( GameButton, gb ) { if( m_LightsState.m_bGameButtonLights[gc][gb] ) return GameInput( gc, gb ); diff --git a/stepmania/src/NetworkSyncManager.cpp b/stepmania/src/NetworkSyncManager.cpp index 2796d63894..9ae346d1ca 100644 --- a/stepmania/src/NetworkSyncManager.cpp +++ b/stepmania/src/NetworkSyncManager.cpp @@ -662,7 +662,7 @@ void NetworkSyncManager::ProcessInput() GameName = 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) ); SCREENMAN->SetNewScreen( "ScreenNetSelectMusic" ); //Should this be metric'd out? diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index ad3a9bb7dd..ba4f9ec7fb 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1973,9 +1973,9 @@ void ScreenGameplay::UpdateLights() LIGHTSMAN->BlinkCabinetLight( cl ); } - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { - FOREACH_GameButton( gb ) + FOREACH_ENUM( GameButton, gb ) { if( bBlinkGameButton[gc][gb] ) LIGHTSMAN->BlinkGameButton( GameInput(gc,gb) ); diff --git a/stepmania/src/ScreenMapControllers.cpp b/stepmania/src/ScreenMapControllers.cpp index 05a1db3ae7..aa17c36148 100644 --- a/stepmania/src/ScreenMapControllers.cpp +++ b/stepmania/src/ScreenMapControllers.cpp @@ -68,7 +68,7 @@ void ScreenMapControllers::Init() // header row { - FOREACH_GameController( c ) + FOREACH_ENUM( GameController, c ) { BitmapText &text = m_textLabel[c]; text.LoadFromFont( THEME->GetPathF("Common","title") ); @@ -111,7 +111,7 @@ void ScreenMapControllers::Init() m_Line[iRow].AddChild( pSecondary ); } - FOREACH_GameController( c ) + FOREACH_ENUM( GameController, c ) { for( int s=0; sGetCurrentGame() ); + const Game *pGame = GameManager::StringToGame( PREFSMAN->GetCurrentGame() ); /* If the active game type isn't actually available, revert to the default. */ if( pGame == NULL ) @@ -1408,7 +1408,7 @@ void HandleInputEvents(float fDeltaTime) /* When a GameButton is pressed, stop repeating other keys on the same controller. */ if( input.type == IET_FIRST_PRESS && input.MenuI != GameButton_Invalid ) { - FOREACH_GameButton( m ) + FOREACH_ENUM( GameButton, m ) { if( input.MenuI != m ) INPUTMAPPER->RepeatStopKey( m, input.pn ); diff --git a/stepmania/src/Style.cpp b/stepmania/src/Style.cpp index 069a310656..7cce40a56b 100644 --- a/stepmania/src/Style.cpp +++ b/stepmania/src/Style.cpp @@ -41,7 +41,7 @@ GameInput Style::StyleInputToGameInput( int iCol, PlayerNumber pn ) const ssprintf("P%i C%i", pn, iCol) ); bool bUsingOneSide = m_StyleType != StyleType_OnePlayerTwoSides && m_StyleType != StyleType_TwoPlayersSharedSides; - FOREACH_GameController(gc) + FOREACH_ENUM( GameController, gc) { if( bUsingOneSide && gc != (int) pn ) continue; diff --git a/stepmania/src/StyleUtil.cpp b/stepmania/src/StyleUtil.cpp index 6194603220..b9d602e257 100644 --- a/stepmania/src/StyleUtil.cpp +++ b/stepmania/src/StyleUtil.cpp @@ -22,7 +22,7 @@ void StyleID::FromStyle( const Style *p ) const Style *StyleID::ToStyle() const { - const Game* pGame = GameManager::StringToGameType( sGame ); + const Game* pGame = GameManager::StringToGame( sGame ); if( pGame == NULL ) return NULL; diff --git a/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.cpp b/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.cpp index ec0a27beff..270585480c 100644 --- a/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.cpp +++ b/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.cpp @@ -56,7 +56,7 @@ void LightsDriver_LinuxParallel::Set( const LightsState *ls ) int iNumGameButtonsToShow = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( "Start" ); if( iNumGameButtonsToShow == GameButton_Invalid ) iNumGameButtonsToShow = INPUTMAPPER->GetInputScheme()->m_iButtonsPerController; - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { s += ssprintf("Controller%d Bits: ",gc+1); for( int gb=0; gbm_bGameButtonLights[gc][gb]; diff --git a/stepmania/src/arch/Lights/LightsDriver_SystemMessage.cpp b/stepmania/src/arch/Lights/LightsDriver_SystemMessage.cpp index c9f7cbee4d..e9335b7617 100644 --- a/stepmania/src/arch/Lights/LightsDriver_SystemMessage.cpp +++ b/stepmania/src/arch/Lights/LightsDriver_SystemMessage.cpp @@ -30,10 +30,10 @@ void LightsDriver_SystemMessage::Set( const LightsState *ls ) } s += "\n"; - FOREACH_GameController( gc ) + FOREACH_ENUM( GameController, gc ) { s += ssprintf("Controller%d: ",gc+1); - FOREACH_GameButton( gb ) + FOREACH_ENUM( GameButton, gb ) { s += ls->m_bGameButtonLights[gc][gb] ? '1' : '0'; } diff --git a/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.cpp b/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.cpp index 7114c12335..69f2bf09f7 100644 --- a/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.cpp +++ b/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.cpp @@ -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]; int index = GameControllerAndGameButtonToIndex( gc, gb );