diff --git a/src/game/menu.c b/src/game/menu.c index e3d970506..9134d3c2b 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -148,6 +148,33 @@ s32 g_MouseDimmedMode = false; s32 g_MouseEndDeferredSlider = false; #endif +s32 menuAlt1Pressed(s32 playerNum) +{ + const s32 rshoulderKey = VK_JOY1_RSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS; + + if (playerNum == 0) { + return inputKeyJustPressed(VK_LCTRL) || inputKeyJustPressed(rshoulderKey); + } + + return inputKeyJustPressed(rshoulderKey); +} + +s32 menuAlt2Pressed(s32 playerNum) +{ + const s32 lshoulderKey = VK_JOY1_LSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS; + + if (playerNum == 0) { + return inputKeyJustPressed(VK_LALT) || inputKeyJustPressed(lshoulderKey); + } + + return inputKeyJustPressed(lshoulderKey); +} + +s32 menuAltAnyPressed(s32 playerNum) +{ + return menuAlt1Pressed(playerNum) || menuAlt2Pressed(playerNum); +} + void menuPlaySound(s32 menusound) { s32 sound = -1; diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index 171877469..b76f06fdd 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -46,33 +46,6 @@ extern struct menudialogdef g_FilemgrErrorMenuDialog; extern s32 g_MpWeaponSetNum; #endif -static inline s32 menuAlt1Pressed(s32 playerNum) -{ - const s32 rshoulderKey = VK_JOY1_RSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS; - - if (playerNum == 0) { - return inputKeyJustPressed(VK_LCTRL) || inputKeyJustPressed(rshoulderKey); - } - - return inputKeyJustPressed(rshoulderKey); -} - -static inline s32 menuAlt2Pressed(s32 playerNum) -{ - const s32 lshoulderKey = VK_JOY1_LSHOULDER + playerNum * INPUT_MAX_CONTROLLER_BUTTONS; - - if (playerNum == 0) { - return inputKeyJustPressed(VK_LALT) || inputKeyJustPressed(lshoulderKey); - } - - return inputKeyJustPressed(lshoulderKey); -} - -static inline s32 menuAltPressed(s32 playerNum) -{ - return menuAlt1Pressed(playerNum) || menuAlt2Pressed(playerNum); -} - MenuItemHandlerResult menuhandlerMpDropOut(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { @@ -2606,7 +2579,7 @@ MenuDialogHandlerResult menudialogMpSimulant(s32 operation, struct menudialogdef MenuDialogHandlerResult mpLoadSettingsDialogHandler(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) { if (operation == MENUOP_TICK) { - if (menuAltPressed(g_MpPlayerNum)) { + if (menuAltAnyPressed(g_MpPlayerNum)) { u8 presets = g_Menus[g_MpPlayerNum].mpsetup.showpresets; g_Menus[g_MpPlayerNum].mpsetup.showpresets = 1 - presets; } diff --git a/src/include/game/menu.h b/src/include/game/menu.h index 419fb659e..37bdbc5e5 100644 --- a/src/include/game/menu.h +++ b/src/include/game/menu.h @@ -113,6 +113,10 @@ MenuItemHandlerResult menuhandlerRepairPak(s32 operation, struct menuitem *item, MenuItemHandlerResult menuhandlerRetrySavePak(s32 operation, struct menuitem *item, union handlerdata *data); MenuItemHandlerResult menuhandlerWarnRepairPak(s32 operation, struct menuitem *item, union handlerdata *data); +s32 menuAlt1Pressed(s32 playerNum); +s32 menuAlt2Pressed(s32 playerNum); +s32 menuAltAnyPressed(s32 playerNum); + extern const char var7f1b2658[]; extern const char var7f1b265c[]; extern const char var7f1b2660[];