foxygit / doom Log in
commit b9835e43a451fe492c9ace050b2cd068c4698e79
Author:     Michael Day <contact@michaelcday.com>
AuthorDate: Tue Apr 26 21:06:46 2022 -0400
Commit:     Michael Day <contact@michaelcday.com>
CommitDate: Tue Apr 26 21:36:12 2022 -0400

    Add "use artifact" mouse button config items
---
 src/m_config.c    | 8 ++++++++
 src/m_controls.c  | 2 ++
 src/m_controls.h  | 1 +
 src/setup/mouse.c | 2 ++
 4 files changed, 13 insertions(+)

diff --git a/src/m_config.c b/src/m_config.c
index 88b10a4c..b5e90791 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1098,6 +1098,14 @@ static default_t extra_defaults_list[] =

     CONFIG_VARIABLE_INT(mouseb_invright),

+    //!
+    // @game heretic hexen
+    //
+    // Mouse button to use artifact.
+    //
+
+    CONFIG_VARIABLE_INT(mouseb_useartifact),
+
     //!
     // If non-zero, double-clicking a mouse button acts like pressing
     // the "use" key to use an object in-game, eg. a door or switch.
diff --git a/src/m_controls.c b/src/m_controls.c
index f6f03768..990298b2 100644
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -122,6 +122,7 @@ int mousebprevweapon = -1;
 int mousebnextweapon = -1;
 int mousebinvleft = -1;
 int mousebinvright = -1;
+int mousebuseartifact = -1;

 int key_message_refresh = KEY_ENTER;
 int key_pause = KEY_PAUSE;
@@ -275,6 +276,7 @@ void M_BindHereticControls(void)

     M_BindIntVariable("mouseb_invleft", &mousebinvleft);
     M_BindIntVariable("mouseb_invright", &mousebinvright);
+    M_BindIntVariable("mouseb_useartifact", &mousebuseartifact);

     M_BindIntVariable("key_arti_quartz",        &key_arti_quartz);
     M_BindIntVariable("key_arti_urn",           &key_arti_urn);
diff --git a/src/m_controls.h b/src/m_controls.h
index e8b030dc..c5cf5ca8 100644
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -151,6 +151,7 @@ extern int mousebprevweapon;
 extern int mousebnextweapon;
 extern int mousebinvleft;
 extern int mousebinvright;
+extern int mousebuseartifact;

 extern int joybfire;
 extern int joybstrafe;
diff --git a/src/setup/mouse.c b/src/setup/mouse.c
index db70c621..95a83320 100644
--- a/src/setup/mouse.c
+++ b/src/setup/mouse.c
@@ -50,6 +50,7 @@ static int *all_mouse_buttons[] = {
     &mousebspeed,
     &mousebinvleft,
     &mousebinvright,
+    &mousebuseartifact,
     &mousebturnleft,
     &mousebturnright,
 };
@@ -113,6 +114,7 @@ static void ConfigExtraButtons(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
     {
       AddMouseControl(buttons_table, "Inventory left", &mousebinvleft);
       AddMouseControl(buttons_table, "Inventory right", &mousebinvright);
+      AddMouseControl(buttons_table, "Use artifact", &mousebuseartifact);
     }

     if (gamemission == hexen || gamemission == strife)