summaryrefslogtreecommitdiff
path: root/sys/src/games
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-03-31 03:44:08 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-03-31 03:44:08 +0200
commitcf112fae1b3da89e79852f55347226e8ecf692d2 (patch)
tree1b564c5760cd79b3f17667a888bd32fec2a68dfd /sys/src/games
parent9c844d90e117c9cb7b7fc16e4b0741a0df88456c (diff)
doom: disable mouse grab on crash, prevent some crashed
Diffstat (limited to 'sys/src/games')
-rw-r--r--sys/src/games/doom/i_video.c11
-rw-r--r--sys/src/games/doom/p_enemy.c7
2 files changed, 17 insertions, 1 deletions
diff --git a/sys/src/games/doom/i_video.c b/sys/src/games/doom/i_video.c
index 4a715ef83..9db2b4797 100644
--- a/sys/src/games/doom/i_video.c
+++ b/sys/src/games/doom/i_video.c
@@ -23,10 +23,21 @@ static uchar cmap[3*256];
static int kbdpid = -1;
static int mousepid = -1;
+static void
+catch(void *, char *msg)
+{
+ /* in case we crash, disable mouse grab */
+ if(strncmp(msg, "sys:", 4) == 0)
+ mouseactive = 0;
+ noted(NDFLT);
+}
+
void I_InitGraphics(void)
{
int pid;
+ notify(catch);
+
if(initdraw(nil, nil, "doom") < 0)
I_Error("I_InitGraphics failed");
diff --git a/sys/src/games/doom/p_enemy.c b/sys/src/games/doom/p_enemy.c
index 1f320f816..7f621c97c 100644
--- a/sys/src/games/doom/p_enemy.c
+++ b/sys/src/games/doom/p_enemy.c
@@ -1938,7 +1938,10 @@ void A_BrainSpit (void *_mo, void*)
easy ^= 1;
if (gameskill <= sk_easy && (!easy))
return;
-
+
+ if (numbraintargets <= 0)
+ return;
+
// shoot a cube at current target
targ = braintargets[braintargeton];
braintargeton = (braintargeton+1)%numbraintargets;
@@ -1977,6 +1980,8 @@ void A_SpawnFly (void *_mo, void*)
return; // still flying
targ = mo->target;
+ if (targ == 0)
+ return;
// First spawn teleport fog.
fog = P_SpawnMobj (targ->x, targ->y, targ->z, MT_SPAWNFIRE);