From dce96a4a3dc34a0597fa48127f043e248a491330 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 18 May 2024 19:32:34 +0200 Subject: [PATCH] port: add separate extra buttons for accept/cancel --- port/include/input.h | 4 ++-- port/src/input.c | 6 ++++-- port/src/optionsmenu.c | 4 ++++ src/game/menu.c | 8 +++----- src/include/constants.h | 6 ++++++ 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/port/include/input.h b/port/include/input.h index fcb9d962c..d09e1dbdf 100644 --- a/port/include/input.h +++ b/port/include/input.h @@ -66,8 +66,8 @@ enum contkey { CK_STICK_XPOS, CK_STICK_YNEG, CK_STICK_YPOS, - CK_0010, - CK_0020, + CK_ACCEPT, + CK_CANCEL, CK_0040, CK_0080, CK_0100, diff --git a/port/src/input.c b/port/src/input.c index 69e28508f..bf0ab413e 100644 --- a/port/src/input.c +++ b/port/src/input.c @@ -103,8 +103,8 @@ static const char *ckNames[CK_TOTAL_COUNT] = { "STICK_XPOS", "STICK_YNEG", "STICK_YPOS", - "CK_0010", - "CK_0020", + "ACCEPT_BUTTON", + "CANCEL_BUTTON", "CK_0040", "CK_0080", "CK_0100", @@ -211,6 +211,8 @@ void inputSetDefaultKeyBinds(s32 cidx, s32 n64mode) { CK_C_U, SDL_CONTROLLER_BUTTON_DPAD_UP }, { CK_C_R, SDL_CONTROLLER_BUTTON_DPAD_RIGHT }, { CK_C_L, SDL_CONTROLLER_BUTTON_DPAD_LEFT }, + { CK_ACCEPT, SDL_CONTROLLER_BUTTON_A }, + { CK_CANCEL, SDL_CONTROLLER_BUTTON_B }, { CK_8000, SDL_CONTROLLER_BUTTON_LEFTSTICK }, }; diff --git a/port/src/optionsmenu.c b/port/src/optionsmenu.c index 8d042de1b..92908711d 100644 --- a/port/src/optionsmenu.c +++ b/port/src/optionsmenu.c @@ -1337,6 +1337,8 @@ static const struct menubind menuBinds[] = { { CK_8000, "Cycle Crouch [+]\n", "N64 Ext 8000\n" }, { CK_4000, "Half Crouch [+]\n", "N64 Ext 4000\n" }, { CK_2000, "Full Crouch [+]\n", "N64 Ext 2000\n" }, + { CK_ACCEPT, "UI Accept [+]\n", "EXT UI Accept\n" }, + { CK_CANCEL, "UI Cancel [+]\n", "EXT UI Cancel\n" }, }; static const char *menutextBind(struct menuitem *item); @@ -1374,6 +1376,8 @@ struct menuitem g_ExtendedBindsMenuItems[] = { DEFINE_MENU_BIND(), DEFINE_MENU_BIND(), DEFINE_MENU_BIND(), + DEFINE_MENU_BIND(), + DEFINE_MENU_BIND(), { MENUITEMTYPE_SEPARATOR, 0, diff --git a/src/game/menu.c b/src/game/menu.c index f45e97cc2..db2a30001 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -4741,14 +4741,12 @@ void menuProcessInput(void) } #ifndef PLATFORM_N64 - // this seems sensible to achieve 1964 parity - if (buttonsnow & BUTTON_RADIAL) { + // separate buttons for UI accept/cancel + if (buttonsnow & BUTTON_UI_ACCEPT) { inputs.select = 1; } - // HACK: don't back out on weapon back when it's bound to wheel - const bool wheel = inputKeyPressed(VK_MOUSE_WHEEL_UP) || inputKeyPressed(VK_MOUSE_WHEEL_DN); - if ((buttonsnow & BUTTON_WPNBACK) && !wheel) { + if (buttonsnow & BUTTON_UI_CANCEL) { inputs.back = 1; } #endif diff --git a/src/include/constants.h b/src/include/constants.h index f6fea0f11..09152e169 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -4708,6 +4708,9 @@ enum weaponnum { #define BUTTON_ACCEPT BUTTON_ACCEPT_WPNFORWARD #define BUTTON_WPNFORWARD BUTTON_ACCEPT_WPNFORWARD +#define BUTTON_UI_ACCEPT BUTTON_ACCEPT_WPNFORWARD +#define BUTTON_UI_CANCEL BUTTON_CANCEL_USE + #else // xbla behavior @@ -4727,6 +4730,9 @@ enum weaponnum { #define BUTTON_HALF_CROUCH CONT_4000 #define BUTTON_FULL_CROUCH CONT_2000 +#define BUTTON_UI_ACCEPT CONT_0010 +#define BUTTON_UI_CANCEL CONT_0020 + #define MOUSEAIM_CLASSIC 0 // crosshair moves around the screen in aim mode #define MOUSEAIM_LOCKED 1 // crosshair locked to the center of the screen in aim mode