merge m_SecondaryMenuButton into GameButtonInfo

This commit is contained in:
Glenn Maynard
2007-01-13 00:12:08 +00:00
parent 59e880e760
commit f8e9574f1e
3 changed files with 96 additions and 183 deletions
+70 -160
View File
@@ -127,20 +127,12 @@ static const Game g_Game_Dance =
"dance", // m_szName "dance", // m_szName
NUM_DANCE_BUTTONS, // m_iButtonsPerController NUM_DANCE_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"Left", { "Left", MENU_BUTTON_LEFT },
"Right", { "Right", MENU_BUTTON_RIGHT },
"Up", { "Up", MENU_BUTTON_UP },
"Down", { "Down", MENU_BUTTON_DOWN },
"UpLeft", { "UpLeft", MenuButton_Invalid },
"UpRight", { "UpRight", MenuButton_Invalid },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // DANCE_BUTTON_LEFT
MENU_BUTTON_RIGHT, // DANCE_BUTTON_RIGHT
MENU_BUTTON_UP, // DANCE_BUTTON_UP
MENU_BUTTON_DOWN, // DANCE_BUTTON_DOWN
MenuButton_Invalid, // DANCE_BUTTON_UPLEFT
MenuButton_Invalid, // DANCE_BUTTON_UPRIGHT
}, },
g_AutoKeyMappings_Dance g_AutoKeyMappings_Dance
}, },
@@ -190,18 +182,11 @@ static const Game g_Game_Pump =
"pump", // m_szName "pump", // m_szName
NUM_PUMP_BUTTONS, // m_iButtonsPerController NUM_PUMP_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"UpLeft", { "UpLeft", MENU_BUTTON_UP },
"UpRight", { "UpRight", MENU_BUTTON_DOWN },
"Center", { "Center", MENU_BUTTON_START },
"DownLeft", { "DownLeft", MENU_BUTTON_LEFT },
"DownRight", { "DownRight", MENU_BUTTON_RIGHT },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_UP, // PUMP_BUTTON_UPLEFT
MENU_BUTTON_DOWN, // PUMP_BUTTON_UPRIGHT
MENU_BUTTON_START, // PUMP_BUTTON_CENTER
MENU_BUTTON_LEFT, // PUMP_BUTTON_DOWNLEFT
MENU_BUTTON_RIGHT, // PUMP_BUTTON_DOWNRIGHT
}, },
g_AutoKeyMappings_Pump g_AutoKeyMappings_Pump
}, },
@@ -240,22 +225,13 @@ static const Game g_Game_Ez2 =
"ez2", // m_szName "ez2", // m_szName
NUM_EZ2_BUTTONS, // m_iButtonsPerController NUM_EZ2_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"FootUpLeft", { "FootUpLeft", MENU_BUTTON_UP },
"FootUpRight", { "FootUpRight", MENU_BUTTON_DOWN },
"FootDown", { "FootDown", MENU_BUTTON_START },
"HandUpLeft", { "HandUpLeft", MENU_BUTTON_LEFT },
"HandUpRight", { "HandUpRight", MENU_BUTTON_RIGHT },
"HandLrLeft", { "HandLrLeft", MenuButton_Invalid },
"HandLrRight", { "HandLrRight", MenuButton_Invalid },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_UP, // EZ2_BUTTON_FOOTUPLEFT
MENU_BUTTON_DOWN, // EZ2_BUTTON_FOOTUPRIGHT
MENU_BUTTON_START, // EZ2_BUTTON_FOOTDOWN
MENU_BUTTON_LEFT, // EZ2_BUTTON_HANDUPLEFT
MENU_BUTTON_RIGHT, // EZ2_BUTTON_HANDUPRIGHT
MenuButton_Invalid, // EZ2_BUTTON_HANDLRLEFT
MenuButton_Invalid, // EZ2_BUTTON_HANDLRRIGHT
}, },
g_AutoKeyMappings_Ez2 g_AutoKeyMappings_Ez2
}, },
@@ -294,18 +270,11 @@ static const Game g_Game_Para =
"para", // m_szName "para", // m_szName
NUM_PARA_BUTTONS, // m_iButtonsPerController NUM_PARA_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"Left", { "Left", MENU_BUTTON_LEFT },
"UpLeft", { "UpLeft", MENU_BUTTON_DOWN },
"Up", { "Up", MenuButton_Invalid },
"UpRight", { "UpRight", MENU_BUTTON_UP },
"Right", { "Right", MENU_BUTTON_RIGHT },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // PARA_BUTTON_LEFT
MENU_BUTTON_DOWN, // PARA_BUTTON_UPLEFT
MenuButton_Invalid, // PARA_BUTTON_UP
MENU_BUTTON_UP, // PARA_BUTTON_UPRIGHT
MENU_BUTTON_RIGHT, // PARA_BUTTON_RIGHT
}, },
g_AutoKeyMappings_Para g_AutoKeyMappings_Para
}, },
@@ -345,24 +314,14 @@ static const Game g_Game_DS3DDX =
"ds3ddx", // m_szName "ds3ddx", // m_szName
NUM_DS3DDX_BUTTONS, // m_iButtonsPerController NUM_DS3DDX_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"HandLeft", { "HandLeft", MENU_BUTTON_LEFT },
"FootDownLeft", { "FootDownLeft", MenuButton_Invalid },
"FootUpLeft", { "FootUpLeft", MenuButton_Invalid },
"HandUp", { "HandUp", MENU_BUTTON_UP },
"HandDown", { "HandDown", MENU_BUTTON_DOWN },
"FootUpRight", { "FootUpRight", MenuButton_Invalid },
"FootDownRight", { "FootDownRight", MenuButton_Invalid },
"HandRight", { "HandRight", MENU_BUTTON_RIGHT },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // DS3DDX_BUTTON_HANDLEFT
MenuButton_Invalid, // DS3DDX_BUTTON_FOOTDOWNLEFT
MenuButton_Invalid, // DS3DDX_BUTTON_FOOTUPLEFT
MENU_BUTTON_UP, // DS3DDX_BUTTON_HANDUP
MENU_BUTTON_DOWN, // DS3DDX_BUTTON_HANDDOWN
MenuButton_Invalid, // DS3DDX_BUTTON_FOOTUPRIGHT
MenuButton_Invalid, // DS3DDX_BUTTON_FOOTDOWNRIGHT
MENU_BUTTON_RIGHT, // DS3DDX_BUTTON_HANDRIGHT
}, },
g_AutoKeyMappings_DS3DDX g_AutoKeyMappings_DS3DDX
}, },
@@ -405,26 +364,15 @@ static const Game g_Game_Beat =
"beat", // m_szName "beat", // m_szName
NUM_BEAT_BUTTONS, // m_iButtonsPerController NUM_BEAT_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"Key1", { "Key1", MENU_BUTTON_LEFT },
"Key2", { "Key2", MenuButton_Invalid },
"Key3", { "Key3", MENU_BUTTON_RIGHT },
"Key4", { "Key4", MenuButton_Invalid },
"Key5", { "Key5", MenuButton_Invalid },
"Key6", { "Key6", MenuButton_Invalid },
"Key7", { "Key7", MenuButton_Invalid },
"Scratch up", { "Scratch up", MENU_BUTTON_UP },
"Scratch down", { "Scratch down", MENU_BUTTON_DOWN },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // BEAT_BUTTON_KEY1
MenuButton_Invalid, // BEAT_BUTTON_KEY2
MENU_BUTTON_RIGHT, // BEAT_BUTTON_KEY3
MenuButton_Invalid, // BEAT_BUTTON_KEY4
MenuButton_Invalid, // BEAT_BUTTON_KEY5
MenuButton_Invalid, // BEAT_BUTTON_KEY6
MenuButton_Invalid, // BEAT_BUTTON_KEY7
MENU_BUTTON_UP, // BEAT_BUTTON_SCRATCHUP
MENU_BUTTON_DOWN, // BEAT_BUTTON_SCRATCHDOWN
}, },
g_AutoKeyMappings_Beat g_AutoKeyMappings_Beat
}, },
@@ -468,16 +416,10 @@ static const Game g_Game_Maniax =
"maniax", // m_szName "maniax", // m_szName
NUM_MANIAX_BUTTONS, // m_iButtonsPerController NUM_MANIAX_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"HandUpLeft", { "HandUpLeft", MENU_BUTTON_LEFT },
"HandUpRight", { "HandUpRight", MENU_BUTTON_RIGHT },
"HandLrLeft", { "HandLrLeft", MENU_BUTTON_DOWN },
"HandLrRight", { "HandLrRight", MENU_BUTTON_UP },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // MANIAX_BUTTON_HANDUPLEFT
MENU_BUTTON_RIGHT, // MANIAX_BUTTON_HANDUPRIGHT
MENU_BUTTON_DOWN, // MANIAX_BUTTON_HANDLRLEFT
MENU_BUTTON_UP, // MANIAX_BUTTON_HANDLRRIGHT
}, },
g_AutoKeyMappings_Maniax g_AutoKeyMappings_Maniax
}, },
@@ -526,26 +468,15 @@ static const Game g_Game_Techno =
"techno", // m_szName "techno", // m_szName
NUM_TECHNO_BUTTONS, // m_iButtonsPerController NUM_TECHNO_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"Left", { "Left", MENU_BUTTON_LEFT },
"Right", { "Right", MENU_BUTTON_RIGHT },
"Up", { "Up", MENU_BUTTON_UP },
"Down", { "Down", MENU_BUTTON_DOWN },
"UpLeft", { "UpLeft", MenuButton_Invalid },
"UpRight", { "UpRight", MenuButton_Invalid },
"Center", { "Center", MenuButton_Invalid },
"DownLeft", { "DownLeft", MenuButton_Invalid },
"DownRight", { "DownRight", MenuButton_Invalid },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // TECHNO_BUTTON_LEFT
MENU_BUTTON_RIGHT, // TECHNO_BUTTON_RIGHT
MENU_BUTTON_UP, // TECHNO_BUTTON_UP
MENU_BUTTON_DOWN, // TECHNO_BUTTON_DOWN
MenuButton_Invalid, // TECHNO_BUTTON_UPLEFT
MenuButton_Invalid, // TECHNO_BUTTON_UPRIGHT
MenuButton_Invalid, // TECHNO_BUTTON_CENTER
MenuButton_Invalid, // TECHNO_BUTTON_DOWNLEFT
MenuButton_Invalid, // TECHNO_BUTTON_DOWNRIGHT
}, },
g_AutoKeyMappings_Techno g_AutoKeyMappings_Techno
}, },
@@ -590,26 +521,15 @@ static const Game g_Game_Popn =
"popn", // m_szName "popn", // m_szName
NUM_POPN_BUTTONS, // m_iButtonsPerController NUM_POPN_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"Left White", { "Left White", MenuButton_Invalid },
"Left Yellow", { "Left Yellow", MENU_BUTTON_UP },
"Left Green", { "Left Green", MenuButton_Invalid },
"Left Blue", { "Left Blue", MENU_BUTTON_LEFT },
"Red", { "Red", MENU_BUTTON_START },
"Right Blue", { "Right Blue", MENU_BUTTON_RIGHT },
"Right Green", { "Right Green", MenuButton_Invalid },
"Right Yellow", { "Right Yellow", MENU_BUTTON_DOWN },
"Right White", { "Right White", MenuButton_Invalid },
},
{ // m_SecondaryMenuButton
MenuButton_Invalid, // POPN_BUTTON_LEFT_WHITE
MENU_BUTTON_UP, // POPN_BUTTON_LEFT_YELLOW
MenuButton_Invalid, // POPN_BUTTON_LEFT_GREEN
MENU_BUTTON_LEFT, // POPN_BUTTON_LEFT_BLUE
MENU_BUTTON_START, // POPN_BUTTON_RED
MENU_BUTTON_RIGHT, // POPN_BUTTON_RIGHT_BLUE
MenuButton_Invalid, // POPN_BUTTON_RIGHT_GREEN
MENU_BUTTON_DOWN, // POPN_BUTTON_RIGHT_YELLOW
MenuButton_Invalid, // POPN_BUTTON_RIGHT_WHITE
}, },
g_AutoKeyMappings_Popn g_AutoKeyMappings_Popn
}, },
@@ -653,24 +573,14 @@ static const Game g_Game_Lights =
"lights", // m_szName "lights", // m_szName
NUM_LIGHTS_BUTTONS, // m_iButtonsPerController NUM_LIGHTS_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames { // m_szButtonNames
"MarqueeUpLeft", { "MarqueeUpLeft", MENU_BUTTON_LEFT },
"MarqueeUpRight", { "MarqueeUpRight", MENU_BUTTON_RIGHT },
"MarqueeLrLeft", { "MarqueeLrLeft", MENU_BUTTON_UP },
"MarqueeLrRight", { "MarqueeLrRight", MENU_BUTTON_DOWN },
"ButtonsLeft", { "ButtonsLeft", MenuButton_Invalid },
"ButtonsRight", { "ButtonsRight", MenuButton_Invalid },
"BassLeft", { "BassLeft", MenuButton_Invalid },
"BassRight", { "BassRight", MenuButton_Invalid },
},
{ // m_SecondaryMenuButton
MENU_BUTTON_LEFT, // LIGHTS_BUTTON_MARQUEE_UP_LEFT
MENU_BUTTON_RIGHT, // LIGHTS_BUTTON_MARQUEE_UP_RIGHT
MENU_BUTTON_UP, // LIGHTS_BUTTON_MARQUEE_LR_LEFT
MENU_BUTTON_DOWN, // LIGHTS_BUTTON_MARQUEE_LR_RIGHT
MenuButton_Invalid, // LIGHTS_BUTTON_BUTTONS_LEFT
MenuButton_Invalid, // LIGHTS_BUTTON_BUTTONS_RIGHT
MenuButton_Invalid, // LIGHTS_BUTTON_BASS_LEFT
MenuButton_Invalid, // LIGHTS_BUTTON_BASS_RIGHT
}, },
g_AutoKeyMappings_Lights g_AutoKeyMappings_Lights
}, },
+22 -20
View File
@@ -1005,7 +1005,7 @@ void InputScheme::MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, Gam
GameButton SecondaryGameButton = GameButton_Invalid; GameButton SecondaryGameButton = GameButton_Invalid;
for( int i = GAME_BUTTON_NEXT; i < m_iButtonsPerController; ++i ) for( int i = GAME_BUTTON_NEXT; i < m_iButtonsPerController; ++i )
{ {
if( m_SecondaryMenuButton[i-GAME_BUTTON_NEXT] == MenuI ) if( m_GameButtonInfo[i-GAME_BUTTON_NEXT].m_SecondaryMenuButton == MenuI )
{ {
SecondaryGameButton = i; SecondaryGameButton = i;
break; break;
@@ -1031,32 +1031,34 @@ void InputScheme::MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, Gam
MenuButton InputScheme::GetMenuButtonSecondaryFunction( GameButton gb ) const MenuButton InputScheme::GetMenuButtonSecondaryFunction( GameButton gb ) const
{ {
if( gb < GAME_BUTTON_NEXT ) return GetGameButtonInfo(gb)->m_SecondaryMenuButton;
return MenuButton_Invalid;
return m_SecondaryMenuButton[gb - GAME_BUTTON_NEXT];
} }
static const char *g_szCommonGameButtonNames[] = static const InputScheme::GameButtonInfo g_CommonGameButtonInfo[] =
{ {
"MenuLeft", { "MenuLeft", MenuButton_Invalid },
"MenuRight", { "MenuRight", MenuButton_Invalid },
"MenuUp", { "MenuUp", MenuButton_Invalid },
"MenuDown", { "MenuDown", MenuButton_Invalid },
"Start", { "Start", MenuButton_Invalid },
"Select", { "Select", MenuButton_Invalid },
"Back", { "Back", MenuButton_Invalid },
"Coin", { "Coin", MenuButton_Invalid },
"Operator", { "Operator", MenuButton_Invalid },
}; };
const InputScheme::GameButtonInfo *InputScheme::GetGameButtonInfo( GameButton gb ) const
{
COMPILE_ASSERT( GAME_BUTTON_NEXT == ARRAYLEN(g_CommonGameButtonInfo) );
if( gb < GAME_BUTTON_NEXT )
return &g_CommonGameButtonInfo[gb];
else
return &m_GameButtonInfo[gb-GAME_BUTTON_NEXT];
}
const char *InputScheme::GetGameButtonName( GameButton gb ) const const char *InputScheme::GetGameButtonName( GameButton gb ) const
{ {
COMPILE_ASSERT( GAME_BUTTON_NEXT == ARRAYLEN(g_szCommonGameButtonNames) ); return GetGameButtonInfo(gb)->m_szName;
if( gb < GAME_BUTTON_NEXT )
return g_szCommonGameButtonNames[gb];
else
return m_szGameButtonNames[gb-GAME_BUTTON_NEXT];
} }
/* /*
+4 -3
View File
@@ -40,17 +40,18 @@ public:
int m_iButtonsPerController; int m_iButtonsPerController;
struct GameButtonInfo struct GameButtonInfo
{ {
char m_szName[60]; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare" const char *m_szName; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare"
MenuButton m_SecondaryMenuButton;
}; };
/* Data for each Game-specific GameButton. This starts at GAME_BUTTON_NEXT. */ /* Data for each Game-specific GameButton. This starts at GAME_BUTTON_NEXT. */
const char *m_szGameButtonNames[NUM_GameButton]; GameButtonInfo m_GameButtonInfo[NUM_GameButton];
MenuButton m_SecondaryMenuButton[NUM_GameButton];
const InputMapping *m_Maps; const InputMapping *m_Maps;
GameButton ButtonNameToIndex( const RString &sButtonName ) const; GameButton ButtonNameToIndex( const RString &sButtonName ) const;
MenuButton GameInputToMenuButton( GameInput GameI ) const; MenuButton GameInputToMenuButton( GameInput GameI ) const;
void MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, GameInput GameIout[4] ) const; void MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, GameInput GameIout[4] ) const;
MenuButton GetMenuButtonSecondaryFunction( GameButton gb ) const; MenuButton GetMenuButtonSecondaryFunction( GameButton gb ) const;
const GameButtonInfo *GetGameButtonInfo( GameButton gb ) const;
const char *GetGameButtonName( GameButton gb ) const; const char *GetGameButtonName( GameButton gb ) const;
}; };
#define FOREACH_GameButtonInScheme( s, var ) for( GameButton var=(GameButton)0; var<s->m_iButtonsPerController; enum_add<GameButton>( var, +1 ) ) #define FOREACH_GameButtonInScheme( s, var ) for( GameButton var=(GameButton)0; var<s->m_iButtonsPerController; enum_add<GameButton>( var, +1 ) )