shithub: choc

Download patch

ref: 32cdd54be55325983a087e3bd9461c1069b3a43c
parent: bde39eee6442e697fdc37bd7ee1334551c86af8c
author: Simon Howard <[email protected]>
date: Sun Sep 28 12:38:17 EDT 2008

Move novert support into common i_video.c code.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1302

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1424,24 +1424,6 @@
         startloadgame = -1;
     }
 
-    //!
-    // @category video
-    //
-    // Disable vertical mouse movement.
-    //
-
-    if (M_CheckParm("-novert"))
-        novert = true;
-
-    //!
-    // @category video
-    //
-    // Enable vertical mouse movement.
-    //
-
-    if (M_CheckParm("-nonovert"))
-        novert = false;
-
     if (W_CheckNumForName("SS_START") >= 0
      || W_CheckNumForName("FF_END") >= 0)
     {
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -94,9 +94,6 @@
 // If non-zero, exit the level after this number of minutes
 extern  int             timelimit;
 
-// vertical movement from mouse/joystick disabled
-extern  int             novert;
-
 // Nightmare mode flag, single player.
 extern  boolean         respawnmonsters;
 
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -527,12 +527,7 @@
         } 
     }
 
-    // fraggle: allow disabling mouse y movement
- 
-    if (!novert) 
-    {
-        forward += mousey; 
-    }
+    forward += mousey; 
 
     if (strafe) 
 	side += mousex*2; 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -101,6 +101,12 @@
 static boolean nomouse = false;
 int usemouse = 1;
 
+// Disallow mouse and joystick movement to cause forward/backward
+// motion.  Specified with the '-novert' command line parameter.
+// This is an int to allow saving to config file
+
+int novert = 0;
+
 // if true, I_VideoBuffer is screen->pixels
 
 static boolean native_surface;
@@ -607,7 +613,15 @@
         ev.type = ev_mouse;
         ev.data1 = MouseButtonState();
         ev.data2 = AccelerateMouse(x);
-        ev.data3 = -AccelerateMouse(y);
+
+        if (!novert)
+        {
+            ev.data3 = -AccelerateMouse(y);
+        }
+        else
+        {
+            ev.data3 = 0;
+        }
         
         D_PostEvent(&ev);
     }
@@ -1344,6 +1358,28 @@
     {
         SetScaleFactor(3);
     }
+
+    //!
+    // @category video
+    //
+    // Disable vertical mouse movement.
+    //
+
+    if (M_CheckParm("-novert"))
+    {
+        novert = true;
+    }
+
+    //!
+    // @category video
+    //
+    // Enable vertical mouse movement.
+    //
+
+    if (M_CheckParm("-nonovert"))
+    {
+        novert = false;
+    }
 }
 
 // Check if we have been invoked as a screensaver by xscreensaver.
@@ -1667,5 +1703,6 @@
     M_BindVariable("video_driver",              &video_driver);
     M_BindVariable("usegamma",                  &usegamma);
     M_BindVariable("vanilla_keyboard_mapping",  &vanilla_keyboard_mapping);
+    M_BindVariable("novert",                    &novert);
 }
 
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -88,12 +88,6 @@
 
 int dclick_use = 1;
  
-// Disallow mouse and joystick movement to cause forward/backward
-// motion.  Specified with the '-novert' command line parameter.
-// This is an int to allow saving to config file
-
-int novert = 0;
- 
 // 
 // Bind all of the common controls used by Doom and all other games.
 //
@@ -129,7 +123,6 @@
     M_BindVariable("mouseb_use",         &mousebuse);
     M_BindVariable("mouseb_backward",    &mousebbackward);
     M_BindVariable("dclick_use",         &dclick_use);
-    M_BindVariable("novert",             &novert);
 }
 
 void M_BindHereticControls(void)
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -63,7 +63,6 @@
 extern int joybstraferight;
 
 extern int dclick_use;
-extern int novert;
  
 void M_BindBaseControls(void);
 void M_BindHereticControls(void);