From 59da84966fd4d7827cf840092cc7a9de3858acd2 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 11 Jan 2007 06:31:48 +0000 Subject: [PATCH] merge code for common GameButtons --- stepmania/src/GameManager.cpp | 110 ---------------------------------- stepmania/src/InputMapper.cpp | 17 +++++- stepmania/src/InputMapper.h | 1 - 3 files changed, 15 insertions(+), 113 deletions(-) diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 9d859d1a97..b59b2aa197 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -136,17 +136,6 @@ static Game g_Games[NUM_GAMES] = { "UpLeft", GameButtonType_Step, NO_DEFAULT_KEY, KEY_KP_C7 }, { "UpRight", GameButtonType_Step, NO_DEFAULT_KEY, KEY_KP_C9 }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton DANCE_BUTTON_LEFT, // MENU_BUTTON_LEFT DANCE_BUTTON_RIGHT, // MENU_BUTTON_RIGHT @@ -188,17 +177,6 @@ static Game g_Games[NUM_GAMES] = { "DownLeft", GameButtonType_Step, KEY_Cz, KEY_KP_C1 }, { "DownRight", GameButtonType_Step, KEY_Cc, KEY_KP_C3 }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton PUMP_BUTTON_DOWNLEFT, // MENU_BUTTON_LEFT PUMP_BUTTON_DOWNRIGHT, // MENU_BUTTON_RIGHT @@ -242,17 +220,6 @@ static Game g_Games[NUM_GAMES] = { "HandLrLeft", GameButtonType_Step, KEY_Cs, NO_DEFAULT_KEY }, { "HandLrRight", GameButtonType_Step, KEY_Cf, NO_DEFAULT_KEY }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton EZ2_BUTTON_HANDUPLEFT, // MENU_BUTTON_LEFT EZ2_BUTTON_HANDUPRIGHT, // MENU_BUTTON_RIGHT @@ -294,17 +261,6 @@ static Game g_Games[NUM_GAMES] = { "UpRight", GameButtonType_Step, KEY_Cv, NO_DEFAULT_KEY }, { "Right", GameButtonType_Step, KEY_Cb, NO_DEFAULT_KEY }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton PARA_BUTTON_LEFT, // MENU_BUTTON_LEFT PARA_BUTTON_RIGHT, // MENU_BUTTON_RIGHT @@ -349,17 +305,6 @@ static Game g_Games[NUM_GAMES] = { "FootDownRight", GameButtonType_Step, KEY_Cc, NO_DEFAULT_KEY }, { "HandRight", GameButtonType_Step, KEY_Cd, NO_DEFAULT_KEY }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton DS3DDX_BUTTON_HANDLEFT, // MENU_BUTTON_LEFT DS3DDX_BUTTON_HANDRIGHT, // MENU_BUTTON_RIGHT @@ -405,17 +350,6 @@ static Game g_Games[NUM_GAMES] = { "Scratch up", GameButtonType_Step, KEY_LSHIFT, NO_DEFAULT_KEY }, { "Scratch down", GameButtonType_Step, NO_DEFAULT_KEY, NO_DEFAULT_KEY }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton BEAT_BUTTON_KEY1, // MENU_BUTTON_LEFT BEAT_BUTTON_KEY3, // MENU_BUTTON_RIGHT @@ -456,17 +390,6 @@ static Game g_Games[NUM_GAMES] = { "HandLrLeft", GameButtonType_Step, KEY_Cz, KEY_KP_C1 }, { "HandLrRight", GameButtonType_Step, KEY_Cx, KEY_KP_C2 }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton MANIAX_BUTTON_HANDUPLEFT, // MENU_BUTTON_LEFT MANIAX_BUTTON_HANDUPRIGHT, // MENU_BUTTON_RIGHT @@ -512,17 +435,6 @@ static Game g_Games[NUM_GAMES] = { "DownLeft", GameButtonType_Step, KEY_Cz, KEY_KP_C1 }, { "DownRight", GameButtonType_Step, KEY_Cc, KEY_KP_C3 }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton TECHNO_BUTTON_LEFT, // MENU_BUTTON_LEFT TECHNO_BUTTON_RIGHT, // MENU_BUTTON_RIGHT @@ -568,17 +480,6 @@ static Game g_Games[NUM_GAMES] = { "Right Yellow", GameButtonType_Step, KEY_Cg, NO_DEFAULT_KEY }, { "Right White", GameButtonType_Step, KEY_Cb, NO_DEFAULT_KEY }, }, - { // m_DedicatedMenuButton - 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_START - GAME_BUTTON_COIN, // MENU_BUTTON_COIN - GAME_BUTTON_OPERATOR // MENU_BUTTON_OPERATOR - }, { // m_SecondaryMenuButton POPN_BUTTON_LEFT_BLUE, // MENU_BUTTON_LEFT POPN_BUTTON_RIGHT_BLUE, // MENU_BUTTON_RIGHT @@ -623,17 +524,6 @@ static Game g_Games[NUM_GAMES] = { "BassLeft", GameButtonType_Step, KEY_Cu, NO_DEFAULT_KEY }, { "BassRight", GameButtonType_Step, KEY_Ci, NO_DEFAULT_KEY }, }, - { // m_DedicatedMenuButton - 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 - }, { // m_SecondaryMenuButton LIGHTS_BUTTON_MARQUEE_UP_LEFT, // MENU_BUTTON_LEFT LIGHTS_BUTTON_MARQUEE_UP_RIGHT, // MENU_BUTTON_RIGHT diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index efccae52b0..5e7d1bf6b1 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -24,6 +24,19 @@ 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; @@ -927,7 +940,7 @@ GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const MenuButton InputScheme::GameInputToMenuButton( GameInput GameI ) const { FOREACH_MenuButton(i) - if( m_DedicatedMenuButton[i] == GameI.button ) + if( g_DedicatedMenuButtons[i] == GameI.button ) return i; if( !PREFSMAN->m_bOnlyDedicatedMenuButtons ) @@ -960,7 +973,7 @@ void InputScheme::MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, Gam controller.push_back( (GameController)pn ); } - GameButton button[2] = { m_DedicatedMenuButton[MenuI], m_SecondaryMenuButton[MenuI] }; + GameButton button[2] = { g_DedicatedMenuButtons[MenuI], m_SecondaryMenuButton[MenuI] }; int iNumButtonsUsing = PREFSMAN->m_bOnlyDedicatedMenuButtons ? 1 : 2; int iOut = 0; diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index 7a5af9787f..80afe3bb5b 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -25,7 +25,6 @@ public: DeviceButton m_iDefaultKeyboardKey[NUM_GameController]; // default keyboard keys only effect the current game is this game }; GameButtonInfo m_GameButtonInfo[NUM_GameButton]; - GameButton m_DedicatedMenuButton[NUM_MenuButton]; GameButton m_SecondaryMenuButton[NUM_MenuButton]; GameButton ButtonNameToIndex( const RString &sButtonName ) const;