diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 5bb5ce4a79..cb333a3549 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -25,19 +25,6 @@ namespace InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program -static GameButton g_DedicatedMenuButtons[NUM_MenuButton] = -{ - GAME_BUTTON_MENULEFT, // MENU_BUTTON_LEFT - GAME_BUTTON_MENURIGHT, // MENU_BUTTON_RIGHT - GAME_BUTTON_MENUUP, // MENU_BUTTON_UP - GAME_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN - GAME_BUTTON_START, // MENU_BUTTON_START - GAME_BUTTON_SELECT, // MENU_BUTTON_SELECT - GAME_BUTTON_BACK, // MENU_BUTTON_BACK - GAME_BUTTON_COIN, // MENU_BUTTON_COIN - GAME_BUTTON_OPERATOR // MENU_BUTTON_OPERATOR -}; - InputMapper::InputMapper() { g_JoinControllers = PLAYER_INVALID; @@ -819,7 +806,9 @@ bool InputMapper::GameToDevice( const GameInput &GameI, int iSlotNum, DeviceInpu PlayerNumber InputMapper::ControllerToPlayerNumber( GameController controller ) { - if( g_JoinControllers != PLAYER_INVALID ) + if( controller == GameController_Invalid ) + return PLAYER_INVALID; + else if( g_JoinControllers != PLAYER_INVALID ) return g_JoinControllers; else return (PlayerNumber) controller; @@ -972,9 +961,8 @@ GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const MenuButton InputScheme::GameButtonToMenuButton( GameButton gb ) const { - FOREACH_MenuButton(i) - if( g_DedicatedMenuButtons[i] == gb ) - return i; + if( gb < GAME_BUTTON_NEXT ) + return gb; if( !PREFSMAN->m_bOnlyDedicatedMenuButtons ) return GetMenuButtonSecondaryFunction( gb ); @@ -1012,7 +1000,7 @@ void InputScheme::MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, Gam } } - GameButton button[2] = { g_DedicatedMenuButtons[MenuI], SecondaryGameButton }; + GameButton button[2] = { MenuI, SecondaryGameButton }; int iNumButtonsUsing = PREFSMAN->m_bOnlyDedicatedMenuButtons ? 1 : 2; int iOut = 0; diff --git a/stepmania/src/MenuInput.cpp b/stepmania/src/MenuInput.cpp index 9c801554b0..7486dc718d 100644 --- a/stepmania/src/MenuInput.cpp +++ b/stepmania/src/MenuInput.cpp @@ -4,21 +4,6 @@ #include "RageUtil.h" #include "LocalizedString.h" -static const char *MenuButtonNames[] = -{ - "MenuLeft", - "MenuRight", - "MenuUp", - "MenuDown", - "MenuStart", - "MenuSelect", - "MenuBack", - "Coin", - "Operator" -}; -XToString( MenuButton ); -XToLocalizedString( MenuButton ); - /* * (c) 2006 Chris Danford diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index a12b30b646..e12584f2cd 100644 --- a/stepmania/src/MenuInput.h +++ b/stepmania/src/MenuInput.h @@ -3,25 +3,21 @@ #ifndef MENU_INPUT_H #define MENU_INPUT_H -enum MenuButton -{ - MENU_BUTTON_LEFT = 0, - MENU_BUTTON_RIGHT, - MENU_BUTTON_UP, - MENU_BUTTON_DOWN, - MENU_BUTTON_START, - MENU_BUTTON_SELECT, - MENU_BUTTON_BACK, - MENU_BUTTON_COIN, - MENU_BUTTON_OPERATOR, - NUM_MenuButton, // leave this at the end - MenuButton_Invalid -}; +#include "GameInput.h" +typedef GameButton MenuButton; +#define MENU_BUTTON_LEFT GAME_BUTTON_MENULEFT +#define MENU_BUTTON_RIGHT GAME_BUTTON_MENURIGHT +#define MENU_BUTTON_UP GAME_BUTTON_MENUUP +#define MENU_BUTTON_DOWN GAME_BUTTON_MENUDOWN +#define MENU_BUTTON_START GAME_BUTTON_START +#define MENU_BUTTON_SELECT GAME_BUTTON_SELECT +#define MENU_BUTTON_BACK GAME_BUTTON_BACK +#define MENU_BUTTON_COIN GAME_BUTTON_COIN +#define MENU_BUTTON_OPERATOR GAME_BUTTON_OPERATOR +#define MenuButton_Invalid GameButton_Invalid +#define NUM_MenuButton NUM_GameButton #define FOREACH_MenuButton( m ) FOREACH_ENUM( MenuButton, m ) -const RString &MenuButtonToString( MenuButton mb ); -const RString &MenuButtonToLocalizedString( MenuButton mb ); - #endif /* diff --git a/stepmania/src/ScreenMapControllers.cpp b/stepmania/src/ScreenMapControllers.cpp index bce54d2b45..2703998066 100644 --- a/stepmania/src/ScreenMapControllers.cpp +++ b/stepmania/src/ScreenMapControllers.cpp @@ -105,7 +105,7 @@ void ScreenMapControllers::Init() MenuButton mb = INPUTMAPPER->GetInputScheme()->GetMenuButtonSecondaryFunction( pKey->m_GameButton ); RString sText; if( mb != MenuButton_Invalid ) - sText = MenuButtonToLocalizedString( mb ); + sText = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), mb ); ActorUtil::LoadAllCommands( *pSecondary, m_sName ); pSecondary->SetText( sText ); m_Line[iRow].AddChild( pSecondary ); diff --git a/stepmania/src/ScreenTestInput.cpp b/stepmania/src/ScreenTestInput.cpp index e7a067511c..b1f65c960d 100644 --- a/stepmania/src/ScreenTestInput.cpp +++ b/stepmania/src/ScreenTestInput.cpp @@ -61,7 +61,10 @@ class InputList: public BitmapText { MenuButton mb = INPUTMAPPER->GetInputScheme()->GetMenuButtonSecondaryFunction( gi.button ); if( mb != MenuButton_Invalid ) - sTemp += ssprintf( " - (%s %s)", MenuButtonToLocalizedString(mb).c_str(), SECONDARY.GetValue().c_str() ); + { + RString sGameButtonString = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), mb ); + sTemp += ssprintf( " - (%s %s)", sGameButtonString.c_str(), SECONDARY.GetValue().c_str() ); + } } } else