ref: 3e7ad6ef67711cbf73c61d1ab2d77c82a2ff7b3c
parent: f625579b77aef33d8ef75b68a6b77655abd2b9f7
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Mar 30 23:44:08 EDT 2012
doom: disable mouse grab on crash, prevent some crashed
--- a/sys/src/games/doom/i_video.c
+++ b/sys/src/games/doom/i_video.c
@@ -23,9 +23,20 @@
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");--- a/sys/src/games/doom/p_enemy.c
+++ b/sys/src/games/doom/p_enemy.c
@@ -1938,7 +1938,10 @@
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 @@
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);
--
⑨