mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
port: move menuAlt functions to menu.c and make them global
This commit is contained in:
1 parent
f96a03e60f
commit
4b8e1d52b5
3 files changed
+32
-28
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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[];
|
||||
|
||||
Reference in new issue
Block a user