shithub: choc

Download patch

ref: bc304548e3e9b7c59e3cc22b383e106507ec701b
parent: 7df5cb8aebb13fb86a17864de78c061b194f133c
author: Fabian Greffrath <fabian@greffrath.com>
date: Tue Apr 6 11:03:28 EDT 2021

let "turn" mouse bindings act as aliases for the respective key bindings

--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -369,12 +369,12 @@
     // let movement keys cancel each other out
     if (strafe) 
     { 
-	if (gamekeydown[key_right]) 
+	if (gamekeydown[key_right] || mousebuttons[mousebturnright])
 	{
 	    // fprintf(stderr, "strafe right\n");
 	    side += sidemove[speed]; 
 	}
-	if (gamekeydown[key_left]) 
+	if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
 	{
 	    //	fprintf(stderr, "strafe left\n");
 	    side -= sidemove[speed]; 
@@ -383,26 +383,18 @@
 	    side += sidemove[speed]; 
 	if (joyxmove < 0) 
 	    side -= sidemove[speed]; 
-	if (mousebuttons[mousebturnright])
-	    side += sidemove[speed];
-	if (mousebuttons[mousebturnleft])
-	    side -= sidemove[speed];
  
     } 
     else 
     { 
-	if (gamekeydown[key_right]) 
+	if (gamekeydown[key_right] || mousebuttons[mousebturnright])
 	    cmd->angleturn -= angleturn[tspeed]; 
-	if (gamekeydown[key_left]) 
+	if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
 	    cmd->angleturn += angleturn[tspeed]; 
 	if (joyxmove > 0) 
 	    cmd->angleturn -= angleturn[tspeed]; 
 	if (joyxmove < 0) 
 	    cmd->angleturn += angleturn[tspeed]; 
-	if (mousebuttons[mousebturnright])
-	    cmd->angleturn -= angleturn[tspeed];
-	if (mousebuttons[mousebturnleft])
-	    cmd->angleturn += angleturn[tspeed];
     } 
  
     if (gamekeydown[key_up]) 
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -352,32 +352,24 @@
 //
     if (strafe)
     {
-        if (gamekeydown[key_right])
+        if (gamekeydown[key_right] || mousebuttons[mousebturnright])
             side += sidemove[speed];
-        if (gamekeydown[key_left])
+        if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
             side -= sidemove[speed];
         if (joyxmove > 0)
             side += sidemove[speed];
         if (joyxmove < 0)
             side -= sidemove[speed];
-        if (mousebuttons[mousebturnright])
-            side += sidemove[speed];
-        if (mousebuttons[mousebturnleft])
-            side -= sidemove[speed];
     }
     else
     {
-        if (gamekeydown[key_right])
+        if (gamekeydown[key_right] || mousebuttons[mousebturnright])
             cmd->angleturn -= angleturn[tspeed];
-        if (gamekeydown[key_left])
+        if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
             cmd->angleturn += angleturn[tspeed];
         if (joyxmove > 0)
             cmd->angleturn -= angleturn[tspeed];
         if (joyxmove < 0)
-            cmd->angleturn += angleturn[tspeed];
-        if (mousebuttons[mousebturnright])
-            cmd->angleturn -= angleturn[tspeed];
-        if (mousebuttons[mousebturnleft])
             cmd->angleturn += angleturn[tspeed];
     }
 
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -270,11 +270,11 @@
 //
     if (strafe)
     {
-        if (gamekeydown[key_right])
+        if (gamekeydown[key_right] || mousebuttons[mousebturnright])
         {
             side += sidemove[pClass][speed];
         }
-        if (gamekeydown[key_left])
+        if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
         {
             side -= sidemove[pClass][speed];
         }
@@ -286,28 +286,16 @@
         {
             side -= sidemove[pClass][speed];
         }
-        if (mousebuttons[mousebturnright])
-        {
-            side += sidemove[pClass][speed];
-        }
-        if (mousebuttons[mousebturnleft])
-        {
-            side -= sidemove[pClass][speed];
-        }
     }
     else
     {
-        if (gamekeydown[key_right])
+        if (gamekeydown[key_right] || mousebuttons[mousebturnright])
             cmd->angleturn -= angleturn[tspeed];
-        if (gamekeydown[key_left])
+        if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
             cmd->angleturn += angleturn[tspeed];
         if (joyxmove > 0)
             cmd->angleturn -= angleturn[tspeed];
         if (joyxmove < 0)
-            cmd->angleturn += angleturn[tspeed];
-        if (mousebuttons[mousebturnright])
-            cmd->angleturn -= angleturn[tspeed];
-        if (mousebuttons[mousebturnleft])
             cmd->angleturn += angleturn[tspeed];
     }
 
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -420,12 +420,12 @@
     // let movement keys cancel each other out
     if (strafe) 
     { 
-        if (gamekeydown[key_right]) 
+        if (gamekeydown[key_right] || mousebuttons[mousebturnright])
         {
             // fprintf(stderr, "strafe right\n");
             side += sidemove[speed]; 
         }
-        if (gamekeydown[key_left]) 
+        if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
         {
             //	fprintf(stderr, "strafe left\n");
             side -= sidemove[speed]; 
@@ -434,26 +434,18 @@
             side += sidemove[speed]; 
         if (joyxmove < 0) 
             side -= sidemove[speed]; 
-        if (mousebuttons[mousebturnright])
-            side += sidemove[speed];
-        if (mousebuttons[mousebturnleft])
-            side -= sidemove[speed];
 
     } 
     else 
     { 
-        if (gamekeydown[key_right]) 
+        if (gamekeydown[key_right] || mousebuttons[mousebturnright])
             cmd->angleturn -= angleturn[tspeed]; 
-        if (gamekeydown[key_left]) 
+        if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
             cmd->angleturn += angleturn[tspeed]; 
         if (joyxmove > 0) 
             cmd->angleturn -= angleturn[tspeed]; 
         if (joyxmove < 0) 
             cmd->angleturn += angleturn[tspeed]; 
-        if (mousebuttons[mousebturnright])
-            cmd->angleturn -= angleturn[tspeed];
-        if (mousebuttons[mousebturnleft])
-            cmd->angleturn += angleturn[tspeed];
     } 
 
     if (gamekeydown[key_up])