shithub: choc

Download patch

ref: 6667c664975d612d6eecf4893b621df624cfc72b
parent: 55d3b7cd205593e3a2bbc8654c291c339ba15cc2
parent: 684a275b88fda485073d867bcea834809886c185
author: Simon Howard <fraggle@soulsphere.org>
date: Sun Jan 23 13:45:14 EST 2022

Merge pull request #1415 from Archenoth/master

Add ability to map mouse buttons to run!

--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -345,7 +345,8 @@
     speed = key_speed >= NUMKEYS
          || joybspeed >= MAX_JOY_BUTTONS
          || gamekeydown[key_speed] 
-         || joybuttons[joybspeed];
+         || joybuttons[joybspeed]
+         || mousebuttons[mousebspeed];
  
     forward = side = 0;
     
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -310,7 +310,8 @@
         || joybuttons[joybstrafe];
     speed = joybspeed >= MAX_JOY_BUTTONS
          || gamekeydown[key_speed]
-         || joybuttons[joybspeed];
+         || joybuttons[joybspeed]
+         || mousebuttons[mousebspeed];
 
     // haleyjd: removed externdriver crap
     
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -229,7 +229,8 @@
     speed = key_speed >= NUMKEYS
         || joybspeed >= MAX_JOY_BUTTONS
         || gamekeydown[key_speed]
-        || joybuttons[joybspeed];
+        || joybuttons[joybspeed]
+        || mousebuttons[mousebspeed];
 
     // haleyjd: removed externdriver crap
     
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -442,6 +442,13 @@
     CONFIG_VARIABLE_INT(mouseb_forward),
 
     //!
+    // Mouse button to turn on running.  When held down, the player
+    // will run while moving.
+    //
+
+    CONFIG_VARIABLE_INT(mouseb_speed),
+
+    //!
     // @game hexen strife
     //
     // Mouse button to jump.
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -107,6 +107,7 @@
 int mousebfire = 0;
 int mousebstrafe = 1;
 int mousebforward = 2;
+int mousebspeed = 3;
 
 int mousebjump = -1;
 
@@ -233,6 +234,7 @@
     M_BindIntVariable("mouseb_fire",        &mousebfire);
     M_BindIntVariable("mouseb_strafe",      &mousebstrafe);
     M_BindIntVariable("mouseb_forward",     &mousebforward);
+    M_BindIntVariable("mouseb_speed",       &mousebspeed);
 
     M_BindIntVariable("joyb_fire",          &joybfire);
     M_BindIntVariable("joyb_strafe",        &joybstrafe);
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -136,6 +136,7 @@
 extern int mousebfire;
 extern int mousebstrafe;
 extern int mousebforward;
+extern int mousebspeed;
 
 extern int mousebjump;
 
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -1063,7 +1063,7 @@
 
     if (joybspeed < 20)
     {
-        AddJoystickControl(window, "Speed", &joybspeed);
+        AddJoystickControl(window, "Run", &joybspeed);
     }
 
     if (gamemission == hexen || gamemission == strife)
--- a/src/setup/keyboard.c
+++ b/src/setup/keyboard.c
@@ -407,7 +407,7 @@
 
     AddKeyControl(window, "Turn Left", &key_left);
     TXT_AddWidget(window, TXT_TABLE_EMPTY);
-    AddKeyControl(window, "Speed On", &key_speed);
+    AddKeyControl(window, "Run", &key_speed);
 
     AddKeyControl(window, "Turn Right", &key_right);
     TXT_AddWidget(window, TXT_TABLE_EMPTY);
--- a/src/setup/mouse.c
+++ b/src/setup/mouse.c
@@ -47,6 +47,7 @@
     &mousebjump,
     &mousebprevweapon,
     &mousebnextweapon,
+    &mousebspeed,
     &mousebinvleft,
     &mousebinvright,
     &mousebturnleft,
@@ -106,6 +107,7 @@
     AddMouseControl(buttons_table, "Previous weapon", &mousebprevweapon);
     AddMouseControl(buttons_table, "Strafe on", &mousebstrafe);
     AddMouseControl(buttons_table, "Next weapon", &mousebnextweapon);
+    AddMouseControl(buttons_table, "Run", &mousebspeed);
     
     if (gamemission == heretic)
     {
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -388,7 +388,8 @@
     speed = key_speed >= NUMKEYS
          || joybspeed >= MAX_JOY_BUTTONS
          || gamekeydown[key_speed] 
-         || joybuttons[joybspeed];
+         || joybuttons[joybspeed]
+         || mousebuttons[mousebspeed];
  
     forward = side = 0;