summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/doom/m_menu.c5
-rw-r--r--src/heretic/mn_menu.c11
-rw-r--r--src/hexen/mn_menu.c11
-rw-r--r--src/m_config.c6
-rw-r--r--src/m_controls.c50
-rw-r--r--src/m_controls.h2
-rw-r--r--src/setup/joystick.c3
-rw-r--r--src/strife/m_menu.c5
8 files changed, 69 insertions, 24 deletions
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index a0581579..271a100a 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1524,6 +1524,11 @@ boolean M_Responder (event_t* ev)
key = key_menu_back;
joywait = I_GetTime() + 5;
}
+ if (joybmenu >= 0 && (ev->data1 & (1 << joybmenu)) != 0)
+ {
+ key = key_menu_activate;
+ joywait = I_GetTime() + 5;
+ }
}
else
{
diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c
index 3057261f..a72f2455 100644
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -1080,6 +1080,17 @@ boolean MN_Responder(event_t * event)
return true;
}
+ // Allow the menu to be activated from a joystick button if a button
+ // is bound for joybmenu.
+ if (event->type == ev_joystick)
+ {
+ if (joybmenu >= 0 && (event->data1 & (1 << joybmenu)) != 0)
+ {
+ MN_ActivateMenu();
+ return true;
+ }
+ }
+
if (event->type != ev_keydown)
{
return false;
diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c
index 75433306..c418ce82 100644
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -1175,6 +1175,17 @@ boolean MN_Responder(event_t * event)
return true;
}
+ // Allow the menu to be activated from a joystick button if a button
+ // is bound for joybmenu.
+ if (event->type == ev_joystick)
+ {
+ if (joybmenu >= 0 && (event->data1 & (1 << joybmenu)) != 0)
+ {
+ MN_ActivateMenu();
+ return true;
+ }
+ }
+
// Only care about keypresses beyond this point.
if (event->type != ev_keydown)
diff --git a/src/m_config.c b/src/m_config.c
index ac4eb304..898c9368 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -951,6 +951,12 @@ static default_t extra_defaults_list[] =
CONFIG_VARIABLE_INT(joyb_straferight),
//!
+ // Joystick button to activate the game menu.
+ //
+
+ CONFIG_VARIABLE_INT(joyb_menu_activate),
+
+ //!
// Joystick button to cycle to the previous weapon.
//
diff --git a/src/m_controls.c b/src/m_controls.c
index 73e81b1b..a71209a0 100644
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -186,10 +186,10 @@ int key_menu_screenshot = 0;
// Joystick controls
//
-int joybfire = 0;
-int joybstrafe = 1;
-int joybuse = 3;
-int joybspeed = 2;
+int joybfire = 0;
+int joybstrafe = 1;
+int joybuse = 3;
+int joybspeed = 2;
int joybstrafeleft = -1;
int joybstraferight = -1;
@@ -199,6 +199,8 @@ int joybjump = -1;
int joybprevweapon = -1;
int joybnextweapon = -1;
+int joybmenu = -1;
+
// Control whether if a mouse button is double clicked, it acts like
// "use" has been pressed
@@ -210,25 +212,27 @@ int dclick_use = 1;
void M_BindBaseControls(void)
{
- M_BindVariable("key_right", &key_right),
- M_BindVariable("key_left", &key_left),
- M_BindVariable("key_up", &key_up),
- M_BindVariable("key_down", &key_down),
- M_BindVariable("key_strafeleft", &key_strafeleft),
- M_BindVariable("key_straferight", &key_straferight),
- M_BindVariable("key_fire", &key_fire),
- M_BindVariable("key_use", &key_use),
- M_BindVariable("key_strafe", &key_strafe),
- M_BindVariable("key_speed", &key_speed),
-
- M_BindVariable("mouseb_fire", &mousebfire),
- M_BindVariable("mouseb_strafe", &mousebstrafe),
- M_BindVariable("mouseb_forward", &mousebforward),
-
- M_BindVariable("joyb_fire", &joybfire),
- M_BindVariable("joyb_strafe", &joybstrafe),
- M_BindVariable("joyb_use", &joybuse),
- M_BindVariable("joyb_speed", &joybspeed),
+ M_BindVariable("key_right", &key_right);
+ M_BindVariable("key_left", &key_left);
+ M_BindVariable("key_up", &key_up);
+ M_BindVariable("key_down", &key_down);
+ M_BindVariable("key_strafeleft", &key_strafeleft);
+ M_BindVariable("key_straferight", &key_straferight);
+ M_BindVariable("key_fire", &key_fire);
+ M_BindVariable("key_use", &key_use);
+ M_BindVariable("key_strafe", &key_strafe);
+ M_BindVariable("key_speed", &key_speed);
+
+ M_BindVariable("mouseb_fire", &mousebfire);
+ M_BindVariable("mouseb_strafe", &mousebstrafe);
+ M_BindVariable("mouseb_forward", &mousebforward);
+
+ M_BindVariable("joyb_fire", &joybfire);
+ M_BindVariable("joyb_strafe", &joybstrafe);
+ M_BindVariable("joyb_use", &joybuse);
+ M_BindVariable("joyb_speed", &joybspeed);
+
+ M_BindVariable("joyb_menu_activate", &joybmenu);
// Extra controls that are not in the Vanilla versions:
diff --git a/src/m_controls.h b/src/m_controls.h
index ff3f7774..5b2f34d6 100644
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -157,6 +157,8 @@ extern int joybstraferight;
extern int joybprevweapon;
extern int joybnextweapon;
+extern int joybmenu;
+
extern int dclick_use;
void M_BindBaseControls(void);
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index 9e04ba0b..23cbaa4a 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -72,7 +72,8 @@ static txt_button_t *joystick_button;
static int *all_joystick_buttons[] = {
&joybstraferight, &joybstrafeleft, &joybfire, &joybspeed,
- &joybuse, &joybstrafe, &joybprevweapon, &joybnextweapon, &joybjump
+ &joybuse, &joybstrafe, &joybprevweapon, &joybnextweapon, &joybjump,
+ &joybmenu,
};
//
diff --git a/src/strife/m_menu.c b/src/strife/m_menu.c
index 7f4f18fc..bc365453 100644
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -1778,6 +1778,11 @@ boolean M_Responder (event_t* ev)
key = key_menu_back;
joywait = I_GetTime() + 5;
}
+ if (joybmenu >= 0 && (ev->data1 & (1 << joybmenu)) != 0)
+ {
+ key = key_menu_activate;
+ joywait = I_GetTime() + 5;
+ }
}
else
{