foxygit / doom Log in
commit 6cf2d4cc8cfec2037ac55535ef69fe5b7bb39cb8
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Oct 12 03:22:10 2013 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Oct 12 03:22:10 2013 +0000

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

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2699
---
 src/doom/d_main.c    | 4 ++--
 src/heretic/d_main.c | 8 ++++----
 src/hexen/h2_main.c  | 8 ++++----
 src/i_video.c        | 5 -----
 4 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index eb36f4bb..931c50a8 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -409,7 +409,7 @@ boolean D_GrabMouseCallback(void)

     // only grab mouse when playing levels (but not demos)

-    return (gamestate == GS_LEVEL) && !demoplayback;
+    return (gamestate == GS_LEVEL) && !demoplayback && !advancedemo;
 }

 //
@@ -426,9 +426,9 @@ void D_DoomLoop (void)

     I_SetWindowTitle(gamedescription);
     I_GraphicsCheckCommandLine();
+    I_SetGrabMouseCallback(D_GrabMouseCallback);
     I_InitGraphics();
     I_EnableLoadingDisk();
-    I_SetGrabMouseCallback(D_GrabMouseCallback);

     V_RestoreBuffer();
     R_ExecuteSetViewSize();
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index 5d9def79..d43c4994 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -226,14 +226,14 @@ void D_Display(void)

 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 @@ void D_DoomLoop(void)
         debugfile = fopen(filename, "w");
     }
     I_GraphicsCheckCommandLine();
-    I_InitGraphics();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
+    I_InitGraphics();

     main_loop_started = true;

diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 33d345e8..f1a22cd7 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -202,14 +202,14 @@ static void D_SetDefaultSavePath(void)

 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 @@ void H2_GameLoop(void)
     }
     I_SetWindowTitle("Hexen");
     I_GraphicsCheckCommandLine();
-    I_InitGraphics();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
+    I_InitGraphics();

     while (1)
     {
diff --git a/src/i_video.c b/src/i_video.c
index 46264fdf..07c5b3b7 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -2203,11 +2203,6 @@ void I_InitGraphics(void)

     while (SDL_PollEvent(&dummy));

-    if (usemouse && !nomouse && (fullscreen || grabmouse))
-    {
-        CenterMouse();
-    }
-
     initialized = true;

     // Call I_ShutdownGraphics on quit