shithub: choc

Download patch

ref: 88dd6235bcf78c545796795ac6a1f0732e4fab9e
parent: bb9ceef0a9b9af7ef83a72bf8a69293227d2db53
author: Simon Howard <fraggle@gmail.com>
date: Thu Oct 9 15:23:50 EDT 2008

Add mouse grab callback for Hexen.

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

--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -180,6 +180,24 @@
     }
 }
 
+//
+// D_GrabMouseCallback
+//
+// Called to determine whether to grab the mouse pointer
+//
+
+static boolean D_GrabMouseCallback(void)
+{
+    // 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;
+}
+
 //==========================================================================
 //
 // H2_Main
@@ -518,6 +536,8 @@
         debugfile = fopen(filename, "w");
     }
     I_InitGraphics();
+    I_SetGrabMouseCallback(D_GrabMouseCallback);
+
     while (1)
     {
         // Frame syncronous IO operations