ref: a8e1c601bc4807f64e716d5813c7f2c26fa92e71
parent: 6ebcafd7003cce44d1edd1115e737f1aa826ba1c
author: Simon Howard <[email protected]>
date: Thu Sep 25 14:17:29 EDT 2008
Add mouse grab callback for Heretic. Subversion-branch: /branches/raven-branch Subversion-revision: 1282
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -188,6 +188,24 @@
I_FinishUpdate();
}
+//
+// D_GrabMouseCallback
+//
+// Called to determine whether to grab the mouse pointer
+//
+
+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;
+}
+
//---------------------------------------------------------------------------
//
// PROC D_DoomLoop
@@ -203,6 +221,8 @@
debugfile = fopen(filename, "w");
}
I_InitGraphics();
+ I_SetGrabMouseCallback(D_GrabMouseCallback);
+
while (1)
{
// Frame syncronous IO operations
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -891,6 +891,8 @@
// MENU (MN_menu.c)
//-----------------
+extern boolean MenuActive;
+
void MN_Init(void);
void MN_ActivateMenu(void);
void MN_DeactivateMenu(void);