summaryrefslogtreecommitdiff
path: root/src/heretic
diff options
context:
space:
mode:
authorSimon Howard2008-09-25 18:17:29 +0000
committerSimon Howard2008-09-25 18:17:29 +0000
commita8e1c601bc4807f64e716d5813c7f2c26fa92e71 (patch)
treeb80876a97fdf853d9190c617ca1170a8f4059a05 /src/heretic
parent6ebcafd7003cce44d1edd1115e737f1aa826ba1c (diff)
downloadchocolate-doom-a8e1c601bc4807f64e716d5813c7f2c26fa92e71.tar.gz
chocolate-doom-a8e1c601bc4807f64e716d5813c7f2c26fa92e71.tar.bz2
chocolate-doom-a8e1c601bc4807f64e716d5813c7f2c26fa92e71.zip
Add mouse grab callback for Heretic.
Subversion-branch: /branches/raven-branch Subversion-revision: 1282
Diffstat (limited to 'src/heretic')
-rw-r--r--src/heretic/d_main.c20
-rw-r--r--src/heretic/doomdef.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index cf844e70..94d51851 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -188,6 +188,24 @@ void D_Display(void)
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 @@ void D_DoomLoop(void)
debugfile = fopen(filename, "w");
}
I_InitGraphics();
+ I_SetGrabMouseCallback(D_GrabMouseCallback);
+
while (1)
{
// Frame syncronous IO operations
diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h
index 63ad37f7..4aa4eee2 100644
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -891,6 +891,8 @@ void SB_Drawer(void);
// MENU (MN_menu.c)
//-----------------
+extern boolean MenuActive;
+
void MN_Init(void);
void MN_ActivateMenu(void);
void MN_DeactivateMenu(void);