Binding button behavior to the controller
This commit is contained in:
+12
-13
@@ -103,12 +103,11 @@ int GetOptionCount(int screen)
|
||||
#ifdef TRIANGLE_BACK_BUTTON
|
||||
#define GetBackJustUp GetTriangleJustUp
|
||||
#define GetBackJustDown GetTriangleJustDown
|
||||
#elif defined(CIRCLE_BACK_BUTTON)
|
||||
#define GetBackJustUp GetCrossJustUp
|
||||
#define GetBackJustDown GetCrossJustDown
|
||||
#else
|
||||
#define GetBackJustUp GetSquareJustUp
|
||||
#define GetBackJustDown GetSquareJustDown
|
||||
// Menu cancel/back follows the selected controller type (see CPad::GetMenuCancel*).
|
||||
// This supersedes the old CIRCLE_BACK_BUTTON mapping.
|
||||
#define GetBackJustUp GetMenuCancelJustUp
|
||||
#define GetBackJustDown GetMenuCancelJustDown
|
||||
#endif
|
||||
|
||||
#ifdef MENU_MAP
|
||||
@@ -542,7 +541,7 @@ CMenuManager::ProcessList(bool &goBack, bool &optionSelected)
|
||||
}
|
||||
|
||||
#ifndef TIDY_UP_PBP
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCircleJustDown()) {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetMenuConfirmJustDown()) {
|
||||
m_bShowMouse = 0;
|
||||
optionSelected = true;
|
||||
}
|
||||
@@ -4348,7 +4347,7 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
|
||||
} else if (isPlainTextScreen(m_nCurrScreen)) {
|
||||
#ifndef TIDY_UP_PBP
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCircleJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetMenuConfirmJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
|
||||
optionSelected = true;
|
||||
}
|
||||
if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
|
||||
@@ -4375,12 +4374,12 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
|
||||
#ifndef TIDY_UP_PBP
|
||||
if ((m_nCurrOption == 0) && (m_nCurrScreen == MENUPAGE_PAUSE_MENU)) {
|
||||
if (CPad::GetPad(0)->GetEnterJustUp() || CPad::GetPad(0)->GetCircleJustUp()) {
|
||||
if (CPad::GetPad(0)->GetEnterJustUp() || CPad::GetPad(0)->GetMenuConfirmJustUp()) {
|
||||
m_bShowMouse = false;
|
||||
optionSelected = true;
|
||||
}
|
||||
} else {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCircleJustDown()) {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetMenuConfirmJustDown()) {
|
||||
m_bShowMouse = false;
|
||||
optionSelected = true;
|
||||
}
|
||||
@@ -4685,7 +4684,7 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
// Centralized enter/back (except some conditions)
|
||||
#ifdef TIDY_UP_PBP
|
||||
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCircleJustDown() ||
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetMenuConfirmJustDown() ||
|
||||
(isPlainTextScreen(m_nCurrScreen) && CPad::GetPad(0)->GetLeftMouseJustDown())) {
|
||||
|
||||
if (!isPlainTextScreen(m_nCurrScreen))
|
||||
@@ -4694,7 +4693,7 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
optionSelected = true;
|
||||
}
|
||||
} else {
|
||||
if (CPad::GetPad(0)->GetEnterJustUp() || CPad::GetPad(0)->GetCircleJustUp()) {
|
||||
if (CPad::GetPad(0)->GetEnterJustUp() || CPad::GetPad(0)->GetMenuConfirmJustUp()) {
|
||||
m_bShowMouse = false;
|
||||
optionSelected = true;
|
||||
}
|
||||
@@ -4726,7 +4725,7 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE);
|
||||
return;
|
||||
} else if (bottomBarActive) {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCircleJustDown()) {
|
||||
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetMenuConfirmJustDown()) {
|
||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
|
||||
bottomBarActive = false;
|
||||
|
||||
@@ -6479,7 +6478,7 @@ CMenuManager::PrintMap(void)
|
||||
|
||||
// Adding marker
|
||||
if (m_nMenuFadeAlpha >= 255) {
|
||||
if (CPad::GetPad(0)->GetRightMouseJustDown() || CPad::GetPad(0)->GetCircleJustDown()) {
|
||||
if (CPad::GetPad(0)->GetRightMouseJustDown() || CPad::GetPad(0)->GetMenuConfirmJustDown()) {
|
||||
if (mapCrosshair.y > fMapCenterY - fMapSize && mapCrosshair.y < fMapCenterY + fMapSize &&
|
||||
mapCrosshair.x > fMapCenterX - fMapSize && mapCrosshair.x < fMapCenterX + fMapSize) {
|
||||
|
||||
|
||||
@@ -765,6 +765,24 @@ void CPad::StartShake_Train(float fX, float fY)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GAMEPAD_MENU
|
||||
static bool MenuUsesNintendoLayout()
|
||||
{
|
||||
return CMenuManager::m_PrefsControllerType == CMenuManager::CONTROLLER_NINTENDO_SWITCH
|
||||
|| CMenuManager::m_PrefsControllerType == CMenuManager::CONTROLLER_DUALSHOCK2;
|
||||
}
|
||||
|
||||
bool CPad::GetMenuConfirmJustDown() { return MenuUsesNintendoLayout() ? GetCircleJustDown() : GetCrossJustDown(); }
|
||||
bool CPad::GetMenuConfirmJustUp() { return MenuUsesNintendoLayout() ? GetCircleJustUp() : GetCrossJustUp(); }
|
||||
bool CPad::GetMenuCancelJustDown() { return MenuUsesNintendoLayout() ? GetCrossJustDown() : GetCircleJustDown(); }
|
||||
bool CPad::GetMenuCancelJustUp() { return MenuUsesNintendoLayout() ? GetCrossJustUp() : GetCircleJustUp(); }
|
||||
#else
|
||||
bool CPad::GetMenuConfirmJustDown() { return GetCrossJustDown(); }
|
||||
bool CPad::GetMenuConfirmJustUp() { return GetCrossJustUp(); }
|
||||
bool CPad::GetMenuCancelJustDown() { return GetCircleJustDown(); }
|
||||
bool CPad::GetMenuCancelJustUp() { return GetCircleJustUp(); }
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PS2_STUFF
|
||||
void CPad::AddToCheatString(char c)
|
||||
{
|
||||
|
||||
@@ -414,6 +414,8 @@ public:
|
||||
bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); }
|
||||
bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); }
|
||||
bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); }
|
||||
bool GetMenuConfirmJustDown();
|
||||
bool GetMenuCancelJustDown();
|
||||
bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); }
|
||||
bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); }
|
||||
bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); }
|
||||
@@ -432,6 +434,8 @@ public:
|
||||
bool GetCircleJustUp() { return !!(!NewState.Circle && OldState.Circle); }
|
||||
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
|
||||
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
|
||||
bool GetMenuConfirmJustUp();
|
||||
bool GetMenuCancelJustUp();
|
||||
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
|
||||
bool GetDPadDownJustUp() { return !!(!NewState.DPadDown && OldState.DPadDown); }
|
||||
bool GetDPadLeftJustUp() { return !!(!NewState.DPadLeft && OldState.DPadLeft); }
|
||||
|
||||
@@ -1858,11 +1858,12 @@ WinMain(HINSTANCE instance,
|
||||
#endif
|
||||
|
||||
#else
|
||||
// True if the player pressed a button to skip an intro movie (controller A /
|
||||
// Start, or Enter on a keyboard).
|
||||
// True if the player pressed a button to skip an intro movie. Uses the menu
|
||||
// confirm button so it follows the selected controller type (Nintendo layout:
|
||||
// A/east; PlayStation/Xbox: Cross/south), plus Start or Enter on a keyboard.
|
||||
static bool SkipMovieButtonJustDown()
|
||||
{
|
||||
return CPad::GetPad(0)->GetCrossJustDown()
|
||||
return CPad::GetPad(0)->GetMenuConfirmJustDown()
|
||||
|| CPad::GetPad(0)->GetStartJustDown()
|
||||
|| CPad::GetPad(0)->GetEnterJustDown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user