Don't duplicate the data for common GameButtons.
InputScheme separates the generic, low-level engine data from the Game*-specific high-level data. GameButtonType is a high-level distinction; in fact, it's only needed for custom GameButtons (eg. DANCE_BUTTON_*), since the function of generic GameButtons (GAME_BUTTON_*) can simply be identified by their value--that's why, for example, we don't have GameButtonType for GAME_BUTTON_COIN.
This commit is contained in:
@@ -964,7 +964,7 @@ MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id )
|
||||
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
||||
{
|
||||
for( int i=0; i<m_iButtonsPerController; i++ )
|
||||
if( stricmp(m_GameButtonInfo[i].m_szName, sButtonName) == 0 )
|
||||
if( stricmp(GetGameButtonName(i), sButtonName) == 0 )
|
||||
return i;
|
||||
|
||||
return GameButton_Invalid;
|
||||
@@ -1032,6 +1032,28 @@ MenuButton InputScheme::GetMenuButtonSecondaryFunction( GameButton gb ) const
|
||||
return MenuButton_Invalid;
|
||||
}
|
||||
|
||||
static const char *g_szCommonGameButtonNames[] =
|
||||
{
|
||||
"MenuLeft",
|
||||
"MenuRight",
|
||||
"MenuUp",
|
||||
"MenuDown",
|
||||
"Start",
|
||||
"Select",
|
||||
"Back",
|
||||
"Coin",
|
||||
"Operator",
|
||||
};
|
||||
|
||||
const char *InputScheme::GetGameButtonName( GameButton gb ) const
|
||||
{
|
||||
COMPILE_ASSERT( GAME_BUTTON_NEXT == ARRAYLEN(g_szCommonGameButtonNames) );
|
||||
if( gb < GAME_BUTTON_NEXT )
|
||||
return g_szCommonGameButtonNames[gb];
|
||||
else
|
||||
return m_szGameButtonNames[gb-GAME_BUTTON_NEXT];
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2003 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user