shithub: choc

Download patch

ref: 2532daf4e1e8cf58274c0c845ec9b297cde369c7
parent: d36dafa3fc3457333f1c49ce133c1e2587e778d4
author: Simon Howard <fraggle@soulsphere.org>
date: Sat Jun 4 16:15:57 EDT 2016

video: Remove useless command line arguments.

The -grabmouse, -novert and -nonovert command line arguments were added
in the early days of the project, before the setup tool existed. With
hindsight there do not appear to be clear use cases for them and it's
better that these are just configured through the config files.

The -nograbmouse argument is the one exception, which is useful for
debugging purposes as a temporary override. Change this to only be a
temporary override that does not have any permanent effect on the
config option, making it consistent with arguments found in vanilla
Doom (-nomouse, -noblit, -nosound, etc.).

This fixes #212.

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -426,7 +426,6 @@
 
     I_SetWindowTitle(gamedescription);
     I_GraphicsCheckCommandLine();
-    I_InputCheckCommandLine();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
     I_InitGraphics();
     V_EnableLoadingDisk(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H);
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -243,7 +243,6 @@
         debugfile = fopen(filename, "w");
     }
     I_GraphicsCheckCommandLine();
-    I_InputCheckCommandLine();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
     I_InitGraphics();
 
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -739,7 +739,6 @@
     }
     I_SetWindowTitle(gamedescription);
     I_GraphicsCheckCommandLine();
-    I_InputCheckCommandLine();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
     I_InitGraphics();
 
--- a/src/i_input.c
+++ b/src/i_input.c
@@ -418,31 +418,6 @@
     }
 }
 
-void I_InputCheckCommandLine(void)
-{
-    //!
-    // @category video
-    //
-    // Disable vertical mouse movement.
-    //
-
-    if (M_CheckParm("-novert"))
-    {
-        novert = true;
-    }
-
-    //!
-    // @category video
-    //
-    // Enable vertical mouse movement.
-    //
-
-    if (M_CheckParm("-nonovert"))
-    {
-        novert = false;
-    }
-}
-
 // Bind all variables controlling input options.
 void I_BindInputVariables(void)
 {
--- a/src/i_input.h
+++ b/src/i_input.h
@@ -29,7 +29,6 @@
 
 void I_BindInputVariables(void);
 void I_ReadMouse(void);
-void I_InputCheckCommandLine(void);
 
 // I_StartTextInput begins text input, activating the on-screen keyboard
 // (if one is used). The caller indicates that any entered text will be
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -129,9 +129,11 @@
 
 static int startup_delay = 1000;
 
-// Grab the mouse? (int type for config code)
+// Grab the mouse? (int type for config code). nograbmouse_override allows
+// this to be temporarily disabled via the command line.
 
 static int grabmouse = true;
+static boolean nograbmouse_override = false;
 
 // The screen buffer; this is modified to draw things to the screen
 
@@ -198,7 +200,7 @@
 
     // if we specify not to grab the mouse, never grab
 
-    if (!grabmouse)
+    if (nograbmouse_override || !grabmouse)
         return false;
 
     // Invoke the grabmouse callback function to determine whether
@@ -820,24 +822,10 @@
     //!
     // @category video 
     //
-    // Grab the mouse when running in windowed mode.
-    //
-
-    if (M_CheckParm("-grabmouse"))
-    {
-        grabmouse = true;
-    }
-
-    //!
-    // @category video 
-    //
     // Don't grab the mouse when running in windowed mode.
     //
 
-    if (M_CheckParm("-nograbmouse"))
-    {
-        grabmouse = false;
-    }
+    nograbmouse_override = M_ParmExists("-nograbmouse");
 
     // default to fullscreen mode, allow override with command line
     // nofullscreen because we love prboom
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -1675,7 +1675,6 @@
     M_CreateSaveDirs(savegamedir);
 
     I_GraphicsCheckCommandLine();
-    I_InputCheckCommandLine();
 
     // haleyjd 20110206 [STRIFE] Startup the introduction sequence
     D_InitIntroSequence();