Previously, each GameButton had a SecondaryFunction; MenuButtons
mapped to each corresponding GameButton, and to each GameButton
with a matching SecondaryFunction.
Simplify. Now, MenuButtons map to each GameButton with a matching
SecondaryFunction. Merged GetMenuButtonSecondaryFunction and
GameButtonToMenuButton.
("MenuButtons" and "SecondaryFunction" are confusing legacy
terminology now. Changing it once I figure out what to change
it to ...)
This commit is contained in:
@@ -956,17 +956,6 @@ GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
|||||||
return GameButton_Invalid;
|
return GameButton_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameButton InputScheme::GameButtonToMenuButton( GameButton gb ) const
|
|
||||||
{
|
|
||||||
if( gb < GAME_BUTTON_NEXT )
|
|
||||||
return gb;
|
|
||||||
|
|
||||||
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
|
||||||
return GetMenuButtonSecondaryFunction( gb );
|
|
||||||
|
|
||||||
return GameButton_Invalid; // no GameButton for this GameButton
|
|
||||||
}
|
|
||||||
|
|
||||||
void InputScheme::MenuButtonToGameInputs( GameButton MenuI, PlayerNumber pn, vector<GameInput> &GameIout ) const
|
void InputScheme::MenuButtonToGameInputs( GameButton MenuI, PlayerNumber pn, vector<GameInput> &GameIout ) const
|
||||||
{
|
{
|
||||||
ASSERT( MenuI != GameButton_Invalid );
|
ASSERT( MenuI != GameButton_Invalid );
|
||||||
@@ -994,13 +983,11 @@ void InputScheme::MenuButtonToGameButtons( GameButton MenuI, vector<GameButton>
|
|||||||
if( MenuI == GameButton_Invalid )
|
if( MenuI == GameButton_Invalid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aGameButtons.push_back( MenuI );
|
FOREACH_GameButton(gb)
|
||||||
|
|
||||||
if( PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
|
||||||
return;
|
|
||||||
|
|
||||||
for( GameButton gb=GAME_BUTTON_NEXT; gb<m_iButtonsPerController; enum_add(gb, +1) )
|
|
||||||
{
|
{
|
||||||
|
if( PREFSMAN->m_bOnlyDedicatedMenuButtons && gb >= GAME_BUTTON_NEXT )
|
||||||
|
break;
|
||||||
|
|
||||||
const GameButtonInfo *pGameButtonInfo = GetGameButtonInfo( gb );
|
const GameButtonInfo *pGameButtonInfo = GetGameButtonInfo( gb );
|
||||||
if( pGameButtonInfo->m_SecondaryMenuButton != MenuI )
|
if( pGameButtonInfo->m_SecondaryMenuButton != MenuI )
|
||||||
continue;
|
continue;
|
||||||
@@ -1008,22 +995,26 @@ void InputScheme::MenuButtonToGameButtons( GameButton MenuI, vector<GameButton>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GameButton InputScheme::GetMenuButtonSecondaryFunction( GameButton gb ) const
|
GameButton InputScheme::GameButtonToMenuButton( GameButton gb ) const
|
||||||
{
|
{
|
||||||
|
if( gb == GameButton_Invalid )
|
||||||
|
return GameButton_Invalid;
|
||||||
|
if( gb >= GAME_BUTTON_NEXT && PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
||||||
|
return GameButton_Invalid;
|
||||||
return GetGameButtonInfo(gb)->m_SecondaryMenuButton;
|
return GetGameButtonInfo(gb)->m_SecondaryMenuButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const InputScheme::GameButtonInfo g_CommonGameButtonInfo[] =
|
static const InputScheme::GameButtonInfo g_CommonGameButtonInfo[] =
|
||||||
{
|
{
|
||||||
{ "MenuLeft", GameButton_Invalid },
|
{ "MenuLeft", GAME_BUTTON_MENULEFT },
|
||||||
{ "MenuRight", GameButton_Invalid },
|
{ "MenuRight", GAME_BUTTON_MENURIGHT },
|
||||||
{ "MenuUp", GameButton_Invalid },
|
{ "MenuUp", GAME_BUTTON_MENUUP },
|
||||||
{ "MenuDown", GameButton_Invalid },
|
{ "MenuDown", GAME_BUTTON_MENUDOWN },
|
||||||
{ "Start", GameButton_Invalid },
|
{ "Start", GAME_BUTTON_START },
|
||||||
{ "Select", GameButton_Invalid },
|
{ "Select", GAME_BUTTON_SELECT },
|
||||||
{ "Back", GameButton_Invalid },
|
{ "Back", GAME_BUTTON_BACK },
|
||||||
{ "Coin", GameButton_Invalid },
|
{ "Coin", GAME_BUTTON_COIN },
|
||||||
{ "Operator", GameButton_Invalid },
|
{ "Operator", GAME_BUTTON_OPERATOR },
|
||||||
};
|
};
|
||||||
|
|
||||||
const InputScheme::GameButtonInfo *InputScheme::GetGameButtonInfo( GameButton gb ) const
|
const InputScheme::GameButtonInfo *InputScheme::GetGameButtonInfo( GameButton gb ) const
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public:
|
|||||||
GameButton GameButtonToMenuButton( GameButton gb ) const;
|
GameButton GameButtonToMenuButton( GameButton gb ) const;
|
||||||
void MenuButtonToGameInputs( GameButton MenuI, PlayerNumber pn, vector<GameInput> &GameIout ) const;
|
void MenuButtonToGameInputs( GameButton MenuI, PlayerNumber pn, vector<GameInput> &GameIout ) const;
|
||||||
void MenuButtonToGameButtons( GameButton MenuI, vector<GameButton> &aGameButtons ) const;
|
void MenuButtonToGameButtons( GameButton MenuI, vector<GameButton> &aGameButtons ) const;
|
||||||
GameButton GetMenuButtonSecondaryFunction( GameButton gb ) const;
|
|
||||||
const GameButtonInfo *GetGameButtonInfo( GameButton gb ) const;
|
const GameButtonInfo *GetGameButtonInfo( GameButton gb ) const;
|
||||||
const char *GetGameButtonName( GameButton gb ) const;
|
const char *GetGameButtonName( GameButton gb ) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ void ScreenMapControllers::Init()
|
|||||||
BitmapText *pSecondary = new BitmapText;
|
BitmapText *pSecondary = new BitmapText;
|
||||||
pSecondary->SetName( "Secondary" );
|
pSecondary->SetName( "Secondary" );
|
||||||
pSecondary->LoadFromFont( THEME->GetPathF("Common","title") );
|
pSecondary->LoadFromFont( THEME->GetPathF("Common","title") );
|
||||||
GameButton mb = INPUTMAPPER->GetInputScheme()->GetMenuButtonSecondaryFunction( pKey->m_GameButton );
|
GameButton mb = INPUTMAPPER->GetInputScheme()->GameButtonToMenuButton( pKey->m_GameButton );
|
||||||
RString sText;
|
RString sText;
|
||||||
if( mb != GameButton_Invalid )
|
if( mb != GameButton_Invalid && mb != pKey->m_GameButton )
|
||||||
sText = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), mb );
|
sText = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), mb );
|
||||||
ActorUtil::LoadAllCommands( *pSecondary, m_sName );
|
ActorUtil::LoadAllCommands( *pSecondary, m_sName );
|
||||||
pSecondary->SetText( sText );
|
pSecondary->SetText( sText );
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ class InputList: public BitmapText
|
|||||||
|
|
||||||
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
||||||
{
|
{
|
||||||
GameButton mb = INPUTMAPPER->GetInputScheme()->GetMenuButtonSecondaryFunction( gi.button );
|
GameButton mb = INPUTMAPPER->GetInputScheme()->GameButtonToMenuButton( gi.button );
|
||||||
if( mb != GameButton_Invalid )
|
if( mb != GameButton_Invalid && mb != gi.button )
|
||||||
{
|
{
|
||||||
RString sGameButtonString = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), mb );
|
RString sGameButtonString = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), mb );
|
||||||
sTemp += ssprintf( " - (%s %s)", sGameButtonString.c_str(), SECONDARY.GetValue().c_str() );
|
sTemp += ssprintf( " - (%s %s)", sGameButtonString.c_str(), SECONDARY.GetValue().c_str() );
|
||||||
|
|||||||
Reference in New Issue
Block a user