shithub: patch

ref: fdba1b8611216cb077271b465bf65a4e333ec413
dir: /doom-nodclick/

View raw version
doom: remove mouse double click and don't move forward with button 3

diff -r bd0ff7078273 sys/src/games/doom/g_game.c
--- a/sys/src/games/doom/g_game.c	Mon Aug 28 19:45:49 2017 +0200
+++ b/sys/src/games/doom/g_game.c	Wed Aug 30 10:20:53 2017 +0200
@@ -187,13 +187,6 @@
 int             mousex;
 int		mousey;         
 
-int             dclicktime;
-int		dclickstate;
-int		dclicks; 
-int             dclicktime2;
-int		dclickstate2;
-int		dclicks2;
-
 // joystick values are repeated 
 int             joyxmove;
 int		joyymove;
@@ -235,7 +228,6 @@
 { 
     int		i; 
     boolean	strafe;
-    boolean	bstrafe; 
     int		speed;
     int		tspeed; 
     int		forward;
@@ -329,11 +321,7 @@
 	cmd->buttons |= BT_ATTACK; 
  
     if (gamekeydown[key_use] || joybuttons[joybuse] ) 
-    { 
 	cmd->buttons |= BT_USE;
-	// clear double clicks if hit use button 
-	dclicks = 0;                   
-    } 
 
     // chainsaw overrides 
     for (i=0 ; i<NUMWEAPONS-1 ; i++)        
@@ -346,58 +334,7 @@
     
     // mouse
     if (mousebuttons[mousebforward]) 
-	forward += forwardmove[speed];
-    
-    // forward double click
-    if (mousebuttons[mousebforward] != dclickstate && dclicktime > 1 ) 
-    { 
-	dclickstate = mousebuttons[mousebforward]; 
-	if (dclickstate) 
-	    dclicks++; 
-	if (dclicks == 2) 
-	{ 
-	    cmd->buttons |= BT_USE; 
-	    dclicks = 0; 
-	} 
-	else 
-	    dclicktime = 0; 
-    } 
-    else 
-    { 
-	dclicktime += ticdup; 
-	if (dclicktime > 20) 
-	{ 
-	    dclicks = 0; 
-	    dclickstate = 0; 
-	} 
-    }
-    
-    // strafe double click
-    bstrafe =
-	mousebuttons[mousebstrafe] 
-	|| joybuttons[joybstrafe]; 
-    if (bstrafe != dclickstate2 && dclicktime2 > 1 ) 
-    { 
-	dclickstate2 = bstrafe; 
-	if (dclickstate2) 
-	    dclicks2++; 
-	if (dclicks2 == 2) 
-	{ 
-	    cmd->buttons |= BT_USE; 
-	    dclicks2 = 0; 
-	} 
-	else 
-	    dclicktime2 = 0; 
-    } 
-    else 
-    { 
-	dclicktime2 += ticdup; 
-	if (dclicktime2 > 20) 
-	{ 
-	    dclicks2 = 0; 
-	    dclickstate2 = 0; 
-	} 
-    } 
+	cmd->buttons |= BT_USE; 
  
     forward += mousey; 
     if (strafe)