shithub: choc

Download patch

ref: 6cf2d4cc8cfec2037ac55535ef69fe5b7bb39cb8
parent: 6e09cdf285c5f7526138c905130d17c7248eef63
author: Simon Howard <[email protected]>
date: Fri Oct 11 23:22:10 EDT 2013

Tweak mouse grab behavior: don't arbitrarily warp the mouse at game
startup.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2699

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -409,7 +409,7 @@
 
     // only grab mouse when playing levels (but not demos)
 
-    return (gamestate == GS_LEVEL) && !demoplayback;
+    return (gamestate == GS_LEVEL) && !demoplayback && !advancedemo;
 }
 
 //
@@ -426,9 +426,9 @@
 
     I_SetWindowTitle(gamedescription);
     I_GraphicsCheckCommandLine();
+    I_SetGrabMouseCallback(D_GrabMouseCallback);
     I_InitGraphics();
     I_EnableLoadingDisk();
-    I_SetGrabMouseCallback(D_GrabMouseCallback);
 
     V_RestoreBuffer();
     R_ExecuteSetViewSize();
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -226,14 +226,14 @@
 
 boolean D_GrabMouseCallback(void)
 {
-    // when menu is active or game is paused, release the mouse 
- 
+    // when menu is active or game is paused, release the mouse
+
     if (MenuActive || paused)
         return false;
 
     // only grab mouse when playing levels (but not demos)
 
-    return (gamestate == GS_LEVEL) && !demoplayback;
+    return (gamestate == GS_LEVEL) && !demoplayback && !advancedemo;
 }
 
 //---------------------------------------------------------------------------
@@ -251,8 +251,8 @@
         debugfile = fopen(filename, "w");
     }
     I_GraphicsCheckCommandLine();
-    I_InitGraphics();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
+    I_InitGraphics();
 
     main_loop_started = true;
 
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -202,14 +202,14 @@
 
 static boolean D_GrabMouseCallback(void)
 {
-    // when menu is active or game is paused, release the mouse 
- 
+    // when menu is active or game is paused, release the mouse
+
     if (MenuActive || paused)
         return false;
 
     // only grab mouse when playing levels (but not demos)
 
-    return (gamestate == GS_LEVEL) && !demoplayback;
+    return (gamestate == GS_LEVEL) && !advancedemo && !demoplayback;
 }
 
 // Message displayed when quitting Hexen
@@ -620,8 +620,8 @@
     }
     I_SetWindowTitle("Hexen");
     I_GraphicsCheckCommandLine();
-    I_InitGraphics();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
+    I_InitGraphics();
 
     while (1)
     {
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -2203,11 +2203,6 @@
   
     while (SDL_PollEvent(&dummy));
 
-    if (usemouse && !nomouse && (fullscreen || grabmouse))
-    {
-        CenterMouse();
-    }
-
     initialized = true;
 
     // Call I_ShutdownGraphics on quit