foxygit / doom Log in
commit 32cdd54be55325983a087e3bd9461c1069b3a43c
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Sep 28 16:38:17 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sun Sep 28 16:38:17 2008 +0000

    Move novert support into common i_video.c code.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1302
---
 src/doom/d_main.c   | 18 ------------------
 src/doom/doomstat.h |  3 ---
 src/doom/g_game.c   |  7 +------
 src/i_video.c       | 39 ++++++++++++++++++++++++++++++++++++++-
 src/m_controls.c    |  7 -------
 src/m_controls.h    |  1 -
 6 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 3bc5bfe7..1a778730 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1424,24 +1424,6 @@ void D_DoomMain (void)
         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)
     {
diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h
index eb0f8b5d..40147833 100644
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -94,9 +94,6 @@ extern  int		gamemap;
 // 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;

diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index d2a33e1c..c430a870 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -527,12 +527,7 @@ void G_BuildTiccmd (ticcmd_t* cmd)
         }
     }

-    // fraggle: allow disabling mouse y movement
-
-    if (!novert)
-    {
-        forward += mousey;
-    }
+    forward += mousey;

     if (strafe)
 	side += mousex*2;
diff --git a/src/i_video.c b/src/i_video.c
index bcfbf270..7fab7731 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -101,6 +101,12 @@ static boolean initialised = false;
 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 @@ static void I_ReadMouse(void)
         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 @@ static void CheckCommandLine(void)
     {
         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 @@ void I_BindVideoVariables(void)
     M_BindVariable("video_driver",              &video_driver);
     M_BindVariable("usegamma",                  &usegamma);
     M_BindVariable("vanilla_keyboard_mapping",  &vanilla_keyboard_mapping);
+    M_BindVariable("novert",                    &novert);
 }

diff --git a/src/m_controls.c b/src/m_controls.c
index 1d57c4cc..62cad830 100644
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -88,12 +88,6 @@ int joybstraferight = -1;

 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 @@ void M_BindBaseControls(void)
     M_BindVariable("mouseb_use",         &mousebuse);
     M_BindVariable("mouseb_backward",    &mousebbackward);
     M_BindVariable("dclick_use",         &dclick_use);
-    M_BindVariable("novert",             &novert);
 }

 void M_BindHereticControls(void)
diff --git a/src/m_controls.h b/src/m_controls.h
index 18e07db8..a4f19685 100644
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -63,7 +63,6 @@ extern int joybstrafeleft;
 extern int joybstraferight;

 extern int dclick_use;
-extern int novert;

 void M_BindBaseControls(void);
 void M_BindHereticControls(void);