Skip to content

Commit

Permalink
port: add separate extra buttons for accept/cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed May 18, 2024
1 parent 08b4d78 commit dce96a4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions port/include/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions port/src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 },
};

Expand Down
4 changes: 4 additions & 0 deletions port/src/optionsmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 3 additions & 5 deletions src/game/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit dce96a4

Please sign in to comment.