foxygit / doom Log in
commit ccb1b27acc35859fe35c909c9bd005b9148ebc89
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Sep 4 15:59:45 2005 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sun Sep 4 15:59:45 2005 +0000

    'novert' command line option to disable vertical mouse movement

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 69
---
 src/d_main.c   | 10 ++++++++--
 src/doomstat.h |  8 +++++++-
 src/g_game.c   | 34 +++++++++++++++++++++++++++-------
 3 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/src/d_main.c b/src/d_main.c
index 868b5414..3b031a11 100644
--- 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
@@ -925,6 +928,9 @@ void D_DoomMain (void)
     else if (M_CheckParm ("-deathmatch"))
 	deathmatch = 1;

+    if (M_CheckParm("-novert"))
+        novert = 1;
+
     // set the location for default.cfg

     SetBaseDefault();
diff --git a/src/doomstat.h b/src/doomstat.h
index 9339009d..ad67857f 100644
--- 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  skill_t         gameskill;
 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 @@ extern	int		ticdup;
 //-----------------------------------------------------------------------------
 //
 // $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)
diff --git a/src/g_game.c b/src/g_game.c
index 706f64e4..c35b8540 100644
--- 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             joybfire;
 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 @@ void G_BuildTiccmd (ticcmd_t* cmd)

     // 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 @@ void G_BuildTiccmd (ticcmd_t* cmd)
 	// 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 @@ void G_BuildTiccmd (ticcmd_t* cmd)
 	}
     }

-    forward += mousey;
+    // fraggle: allow disabling mouse y movement
+
+    if (!novert)
+    {
+        forward += mousey;
+    }
+
     if (strafe)
 	side += mousex*2;
     else