unify GameButton and MenuButton
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+13
-17
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user