shithub: choc

Download patch

ref: ccb1b27acc35859fe35c909c9bd005b9148ebc89
parent: 053bcdff05fc4f2919d177dbb5129ece44042083
author: Simon Howard <fraggle@gmail.com>
date: Sun Sep 4 11:59:45 EDT 2005

'novert' command line option to disable vertical mouse movement

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 69

--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: d_main.c 62 2005-08-31 21:50:57Z fraggle $
+// $Id: d_main.c 69 2005-09-04 15:59:45Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.11  2005/09/04 15:59:45  fraggle
+// 'novert' command line option to disable vertical mouse movement
+//
 // Revision 1.10  2005/08/31 21:50:57  fraggle
 // Nicer banner showing the game type (once we know).  Remove dead code.
 // Find the config file properly.
@@ -68,7 +71,7 @@
 //-----------------------------------------------------------------------------
 
 
-static const char rcsid[] = "$Id: d_main.c 62 2005-08-31 21:50:57Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 69 2005-09-04 15:59:45Z fraggle $";
 
 #define	BGCOLOR		7
 #define	FGCOLOR		8
@@ -924,6 +927,9 @@
 	deathmatch = 2;
     else if (M_CheckParm ("-deathmatch"))
 	deathmatch = 1;
+
+    if (M_CheckParm("-novert"))
+        novert = 1;
 
     // set the location for default.cfg
 
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: doomstat.h 66 2005-09-04 14:51:19Z fraggle $
+// $Id: doomstat.h 69 2005-09-04 15:59:45Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -85,6 +85,9 @@
 extern  int		gameepisode;
 extern  int		gamemap;
 
+// vertical movement from mouse/joystick disabled
+extern  boolean         novert;
+
 // Nightmare mode flag, single player.
 extern  boolean         respawnmonsters;
 
@@ -292,6 +295,9 @@
 //-----------------------------------------------------------------------------
 //
 // $Log$
+// Revision 1.6  2005/09/04 15:59:45  fraggle
+// 'novert' command line option to disable vertical mouse movement
+//
 // Revision 1.5  2005/09/04 14:51:19  fraggle
 // Display the correct quit messages according to which game is being played.
 // Remove "language" variable (do this through gettext, if ever)
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: g_game.c 68 2005-09-04 15:23:29Z fraggle $
+// $Id: g_game.c 69 2005-09-04 15:59:45Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/09/04 15:59:45  fraggle
+// 'novert' command line option to disable vertical mouse movement
+//
 // Revision 1.5  2005/09/04 15:23:29  fraggle
 // Support the old "joyb_speed 31" hack to allow autorun
 //
@@ -46,7 +49,7 @@
 
 
 static const char
-rcsid[] = "$Id: g_game.c 68 2005-09-04 15:23:29Z fraggle $";
+rcsid[] = "$Id: g_game.c 69 2005-09-04 15:59:45Z fraggle $";
 
 #include <string.h>
 #include <stdlib.h>
@@ -189,6 +192,11 @@
 int             joybstrafe; 
 int             joybuse; 
 int             joybspeed; 
+
+// fraggle: Disallow mouse and joystick movement to cause forward/backward
+// motion.  Specified with the '-novert' command line parameter.
+
+boolean         novert;
  
  
  
@@ -282,6 +290,7 @@
 
     // fraggle: support the old "joyb_speed = 31" hack which
     // allowed an autorun effect
+
     speed = key_speed >= NUMKEYS
          || joybspeed >= 4
          || gamekeydown[key_speed] 
@@ -345,10 +354,15 @@
 	// fprintf(stderr, "down\n");
 	forward -= forwardmove[speed]; 
     }
-    if (joyymove < 0) 
-	forward += forwardmove[speed]; 
-    if (joyymove > 0) 
-	forward -= forwardmove[speed]; 
+
+    // fraggle: allow disabling joystick y movement
+    if (!novert)
+    {
+        if (joyymove < 0) 
+            forward += forwardmove[speed]; 
+        if (joyymove > 0) 
+            forward -= forwardmove[speed]; 
+    }
     if (gamekeydown[key_straferight]) 
 	side += sidemove[speed]; 
     if (gamekeydown[key_strafeleft]) 
@@ -432,7 +446,13 @@
 	} 
     } 
  
-    forward += mousey; 
+    // fraggle: allow disabling mouse y movement
+ 
+    if (!novert) 
+    {
+        forward += mousey; 
+    }
+
     if (strafe) 
 	side += mousex*2; 
     else