port: move menuAlt functions to menu.c and make them global

This commit is contained in:
fgsfds committed 2025-04-27 15:54:39 +02:00
1 parent f96a03e60f
commit 4b8e1d52b5
3 files changed
+32 -28

No files matched your search

+27
View File
@@ -147,6 +147,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;
+1 -28
View File
@@ -43,33 +43,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) {
@@ -2594,7 +2567,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;
}
+4
View File
@@ -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[];