1 /* CEVAPP- CLOCK EVENT APPLICABLES */
2 
3 /*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
4 /* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
5 /* WRITTEN BY R. M. SUPNIK */
6 
7 #include "funcs.h"
8 #include "vars.h"
9 
10 static void litint_ P((integer, integer *, integer, const integer *,
11 		       integer));
12 
cevapp_(ri)13 void cevapp_(ri)
14 integer ri;
15 {
16     /* Initialized data */
17 
18     static const integer cndtck[10] = { 50,20,10,5,0,156,156,156,157,0 };
19     static const integer lmptck[12] = { 50,30,20,10,4,0,154,154,154,154,155,0 };
20 
21     /* System generated locals */
22     integer i__1, i__2;
23 
24     /* Local variables */
25     logical f;
26     integer i, j, bc, br;
27 
28     if (ri == 0) {
29 	return;
30     }
31 /* 						!IGNORE DISABLED. */
32     switch (ri) {
33 	case 1:  goto L1000;
34 	case 2:  goto L2000;
35 	case 3:  goto L3000;
36 	case 4:  goto L4000;
37 	case 5:  goto L5000;
38 	case 6:  goto L6000;
39 	case 7:  goto L7000;
40 	case 8:  goto L8000;
41 	case 9:  goto L9000;
42 	case 10:  goto L10000;
43 	case 11:  goto L11000;
44 	case 12:  goto L12000;
45 	case 13:  goto L13000;
46 	case 14:  goto L14000;
47 	case 15:  goto L15000;
48 	case 16:  goto L16000;
49 	case 17:  goto L17000;
50 	case 18:  goto L18000;
51 	case 19:  goto L19000;
52 	case 20:  goto L20000;
53 	case 21:  goto L21000;
54 	case 22:  goto L22000;
55 	case 23:  goto L23000;
56 	case 24:  goto L24000;
57     }
58     bug_(3, ri);
59 
60 /* CEV1--	CURE CLOCK.  LET PLAYER SLOWLY RECOVER. */
61 
62 L1000:
63 /* Computing MIN */
64     i__1 = 0, i__2 = advs_1.astren[aindex_1.player - 1] + 1;
65     advs_1.astren[aindex_1.player - 1] = min(i__1,i__2);
66 /* 						!RECOVER. */
67     if (advs_1.astren[aindex_1.player - 1] >= 0) {
68 	return;
69     }
70 /* 						!FULLY RECOVERED? */
71     cevent_1.ctick[cindex_1.cevcur - 1] = 30;
72 /* 						!NO, WAIT SOME MORE. */
73     return;
74 
75 /* CEV2--	MAINT-ROOM WITH LEAK.  RAISE THE WATER LEVEL. */
76 
77 L2000:
78     if (play_1.here == rindex_1.maint) {
79 	i__1 = findex_1.rvmnt / 2 + 71;
80 	rspeak_(i__1);
81     }
82 /* 						!DESCRIBE. */
83     ++findex_1.rvmnt;
84 /* 						!RAISE WATER LEVEL. */
85     if (findex_1.rvmnt <= 16) {
86 	return;
87     }
88 /* 						!IF NOT FULL, EXIT. */
89     cevent_1.ctick[cindex_1.cevmnt - 1] = 0;
90 /* 						!FULL, DISABLE CLOCK. */
91     rooms_1.rflag[rindex_1.maint - 1] |= RMUNG;
92     rrand[rindex_1.maint - 1] = 80;
93 /* 						!SAY IT IS FULL OF WATER. */
94     if (play_1.here == rindex_1.maint) {
95 	jigsup_(81);
96     }
97 /* 						!DROWN HIM IF PRESENT. */
98     return;
99 
100 /* CEV3--	LANTERN.  DESCRIBE GROWING DIMNESS. */
101 
102 L3000:
103     litint_(oindex_1.lamp, &findex_1.orlamp, cindex_1.cevlnt, lmptck, 12);
104 /* 						!DO LIGHT INTERRUPT. */
105     return;
106 
107 /* CEV4--	MATCH.  OUT IT GOES. */
108 
109 L4000:
110     rspeak_(153);
111 /* 						!MATCH IS OUT. */
112     objcts_1.oflag1[oindex_1.match - 1] &= ~ ONBT;
113     return;
114 
115 /* CEV5--	CANDLE.  DESCRIBE GROWING DIMNESS. */
116 
117 L5000:
118     litint_(oindex_1.candl, &findex_1.orcand, cindex_1.cevcnd, cndtck, 10);
119 /* 						!DO CANDLE INTERRUPT. */
120     return;
121 /* CEVAPP, PAGE 3 */
122 
123 /* CEV6--	BALLOON */
124 
125 L6000:
126     cevent_1.ctick[cindex_1.cevbal - 1] = 3;
127 /* 						!RESCHEDULE INTERRUPT. */
128     f = advs_1.avehic[play_1.winner - 1] == oindex_1.ballo;
129 /* 						!SEE IF IN BALLOON. */
130     if (state_1.bloc == rindex_1.vlbot) {
131 	goto L6800;
132     }
133 /* 						!AT BOTTOM? */
134     if (state_1.bloc == rindex_1.ledg2 || state_1.bloc == rindex_1.ledg3 ||
135 	    state_1.bloc == rindex_1.ledg4 || state_1.bloc == rindex_1.vlbot)
136 	    {
137 	goto L6700;
138     }
139 /* 						!ON LEDGE? */
140     if ((objcts_1.oflag2[oindex_1.recep - 1] & OPENBT) != 0 &&
141 	    findex_1.binff != 0) {
142 	goto L6500;
143     }
144 
145 /* BALLOON IS IN MIDAIR AND IS DEFLATED (OR HAS RECEPTACLE CLOSED). */
146 /* FALL TO NEXT ROOM. */
147 
148     if (state_1.bloc != rindex_1.vair1) {
149 	goto L6300;
150     }
151 /* 						!IN VAIR1? */
152     state_1.bloc = rindex_1.vlbot;
153 /* 						!YES, NOW AT VLBOT. */
154     newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
155     if (f) {
156 	goto L6200;
157     }
158 /* 						!IN BALLOON? */
159     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
160 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
161 	rspeak_(530);
162     }
163 /* 						!ON LEDGE, DESCRIBE. */
164     return;
165 
166 L6200:
167     f = moveto_(state_1.bloc, play_1.winner);
168 /* 						!MOVE HIM. */
169     if (findex_1.binff == 0) {
170 	goto L6250;
171     }
172 /* 						!IN BALLOON.  INFLATED? */
173     rspeak_(531);
174 /* 						!YES, LANDED. */
175     f = rmdesc_(0);
176 /* 						!DESCRIBE. */
177     return;
178 
179 L6250:
180     newsta_(oindex_1.ballo, 532, 0, 0, 0);
181 /* 						!NO, BALLOON & CONTENTS DIE. */
182     newsta_(oindex_1.dball, 0, state_1.bloc, 0, 0);
183 /* 						!INSERT DEAD BALLOON. */
184     advs_1.avehic[play_1.winner - 1] = 0;
185 /* 						!NOT IN VEHICLE. */
186     cevent_1.cflag[cindex_1.cevbal - 1] = FALSE_;
187 /* 						!DISABLE INTERRUPTS. */
188     cevent_1.cflag[cindex_1.cevbrn - 1] = FALSE_;
189     findex_1.binff = 0;
190     findex_1.btief = 0;
191     return;
192 
193 L6300:
194     --state_1.bloc;
195 /* 						!NOT IN VAIR1, DESCEND. */
196     newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
197     if (f) {
198 	goto L6400;
199     }
200 /* 						!IS HE IN BALLOON? */
201     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
202 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
203 	rspeak_(533);
204     }
205 /* 						!IF ON LEDGE, DESCRIBE. */
206     return;
207 
208 L6400:
209     f = moveto_(state_1.bloc, play_1.winner);
210 /* 						!IN BALLOON, MOVE HIM. */
211     rspeak_(534);
212 /* 						!DESCRIBE. */
213     f = rmdesc_(0);
214     return;
215 
216 /* BALLOON IS IN MIDAIR AND IS INFLATED, UP-UP-AND-AWAY */
217 /* 						! */
218 
219 L6500:
220     if (state_1.bloc != rindex_1.vair4) {
221 	goto L6600;
222     }
223 /* 						!AT VAIR4? */
224     cevent_1.ctick[cindex_1.cevbrn - 1] = 0;
225     cevent_1.ctick[cindex_1.cevbal - 1] = 0;
226     findex_1.binff = 0;
227     findex_1.btief = 0;
228     state_1.bloc = rindex_1.vlbot;
229 /* 						!FALL TO BOTTOM. */
230     newsta_(oindex_1.ballo, 0, 0, 0, 0);
231 /* 						!BALLOON & CONTENTS DIE. */
232     newsta_(oindex_1.dball, 0, state_1.bloc, 0, 0);
233 /* 						!SUBSTITUTE DEAD BALLOON. */
234     if (f) {
235 	goto L6550;
236     }
237 /* 						!WAS HE IN IT? */
238     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
239 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
240 	rspeak_(535);
241     }
242 /* 						!IF HE CAN SEE, DESCRIBE. */
243     return;
244 
245 L6550:
246     jigsup_(536);
247 /* 						!IN BALLOON AT CRASH, DIE. */
248     return;
249 
250 L6600:
251     ++state_1.bloc;
252 /* 						!NOT AT VAIR4, GO UP. */
253     newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
254     if (f) {
255 	goto L6650;
256     }
257 /* 						!IN BALLOON? */
258     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
259 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
260 	rspeak_(537);
261     }
262 /* 						!CAN HE SEE IT? */
263     return;
264 
265 L6650:
266     f = moveto_(state_1.bloc, play_1.winner);
267 /* 						!MOVE PLAYER. */
268     rspeak_(538);
269 /* 						!DESCRIBE. */
270     f = rmdesc_(0);
271     return;
272 
273 /* ON LEDGE, GOES TO MIDAIR ROOM WHETHER INFLATED OR NOT. */
274 
275 L6700:
276     state_1.bloc += rindex_1.vair2 - rindex_1.ledg2;
277 /* 						!MOVE TO MIDAIR. */
278     newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
279     if (f) {
280 	goto L6750;
281     }
282 /* 						!IN BALLOON? */
283     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
284 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
285 	rspeak_(539);
286     }
287 /* 						!NO, STRANDED. */
288     cevent_1.ctick[cindex_1.cevvlg - 1] = 10;
289 /* 						!MATERIALIZE GNOME. */
290     return;
291 
292 L6750:
293     f = moveto_(state_1.bloc, play_1.winner);
294 /* 						!MOVE TO NEW ROOM. */
295     rspeak_(540);
296 /* 						!DESCRIBE. */
297     f = rmdesc_(0);
298     return;
299 
300 /* AT BOTTOM, GO UP IF INFLATED, DO NOTHING IF DEFLATED. */
301 
302 L6800:
303     if (findex_1.binff == 0 || ! ((objcts_1.oflag2[oindex_1.recep - 1] &
304 	    OPENBT) != 0)) {
305 	return;
306     }
307     state_1.bloc = rindex_1.vair1;
308 /* 						!INFLATED AND OPEN, */
309     newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
310 /* 						!GO UP TO VAIR1. */
311     if (f) {
312 	goto L6850;
313     }
314 /* 						!IN BALLOON? */
315     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
316 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
317 	rspeak_(541);
318     }
319 /* 						!IF CAN SEE, DESCRIBE. */
320     return;
321 
322 L6850:
323     f = moveto_(state_1.bloc, play_1.winner);
324 /* 						!MOVE PLAYER. */
325     rspeak_(542);
326     f = rmdesc_(0);
327     return;
328 /* CEVAPP, PAGE 4 */
329 
330 /* CEV7--	BALLOON BURNUP */
331 
332 L7000:
333     i__1 = objcts_1.olnt;
334     for (i = 1; i <= i__1; ++i) {
335 /* 						!FIND BURNING OBJECT */
336 	if (oindex_1.recep == objcts_1.ocan[i - 1] && (objcts_1.oflag1[i - 1]
337 		& FLAMBT) != 0) {
338 	    goto L7200;
339 	}
340 /* L7100: */
341     }
342     bug_(4, 0);
343 
344 L7200:
345     newsta_(i, 0, 0, 0, 0);
346 /* 						!VANISH OBJECT. */
347     findex_1.binff = 0;
348 /* 						!UNINFLATED. */
349     if (play_1.here == state_1.bloc) {
350 	rspsub_(292, objcts_1.odesc2[i - 1]);
351     }
352 /* 						!DESCRIBE. */
353     return;
354 
355 /* CEV8--	FUSE FUNCTION */
356 
357 L8000:
358     if (objcts_1.ocan[oindex_1.fuse - 1] != oindex_1.brick) {
359 	goto L8500;
360     }
361 /* 						!IGNITED BRICK? */
362     br = objcts_1.oroom[oindex_1.brick - 1];
363 /* 						!GET BRICK ROOM. */
364     bc = objcts_1.ocan[oindex_1.brick - 1];
365 /* 						!GET CONTAINER. */
366     if (br == 0 && bc != 0) {
367 	br = objcts_1.oroom[bc - 1];
368     }
369     newsta_(oindex_1.fuse, 0, 0, 0, 0);
370 /* 						!KILL FUSE. */
371     newsta_(oindex_1.brick, 0, 0, 0, 0);
372 /* 						!KILL BRICK. */
373     if (br != 0 && br != play_1.here) {
374 	goto L8100;
375     }
376 /* 						!BRICK ELSEWHERE? */
377 
378     rooms_1.rflag[play_1.here - 1] |= RMUNG;
379     rrand[play_1.here - 1] = 114;
380 /* 						!MUNG ROOM. */
381     jigsup_(150);
382 /* 						!DEAD. */
383     return;
384 
385 L8100:
386     rspeak_(151);
387 /* 						!BOOM. */
388     state_1.mungrm = br;
389 /* 						!SAVE ROOM THAT BLEW. */
390     cevent_1.ctick[cindex_1.cevsaf - 1] = 5;
391 /* 						!SET SAFE INTERRUPT. */
392     if (br != rindex_1.msafe) {
393 	goto L8200;
394     }
395 /* 						!BLEW SAFE ROOM? */
396     if (bc != oindex_1.sslot) {
397 	return;
398     }
399 /* 						!WAS BRICK IN SAFE? */
400     newsta_(oindex_1.sslot, 0, 0, 0, 0);
401 /* 						!KILL SLOT. */
402     objcts_1.oflag2[oindex_1.safe - 1] |= OPENBT;
403     findex_1.safef = TRUE_;
404 /* 						!INDICATE SAFE BLOWN. */
405     return;
406 
407 L8200:
408     i__1 = objcts_1.olnt;
409     for (i = 1; i <= i__1; ++i) {
410 /* 						!BLEW WRONG ROOM. */
411 	if (qhere_(i, br) && (objcts_1.oflag1[i - 1] & TAKEBT) !=
412 		0) {
413 	    newsta_(i, 0, 0, 0, 0);
414 	}
415 /* L8250: */
416     }
417     if (br != rindex_1.lroom) {
418 	return;
419     }
420 /* 						!BLEW LIVING ROOM? */
421     i__1 = objcts_1.olnt;
422     for (i = 1; i <= i__1; ++i) {
423 	if (objcts_1.ocan[i - 1] == oindex_1.tcase) {
424 	    newsta_(i, 0, 0, 0, 0);
425 	}
426 /* 						!KILL TROPHY CASE. */
427 /* L8300: */
428     }
429     return;
430 
431 L8500:
432     if (qhere_(oindex_1.fuse, play_1.here) || objcts_1.oadv[oindex_1.fuse -
433 	    1] == play_1.winner) {
434 	rspeak_(152);
435     }
436     newsta_(oindex_1.fuse, 0, 0, 0, 0);
437 /* 						!KILL FUSE. */
438     return;
439 /* CEVAPP, PAGE 5 */
440 
441 /* CEV9--	LEDGE MUNGE. */
442 
443 L9000:
444     rooms_1.rflag[rindex_1.ledg4 - 1] |= RMUNG;
445     rrand[rindex_1.ledg4 - 1] = 109;
446     if (play_1.here == rindex_1.ledg4) {
447 	goto L9100;
448     }
449 /* 						!WAS HE THERE? */
450     rspeak_(110);
451 /* 						!NO, NARROW ESCAPE. */
452     return;
453 
454 L9100:
455     if (advs_1.avehic[play_1.winner - 1] != 0) {
456 	goto L9200;
457     }
458 /* 						!IN VEHICLE? */
459     jigsup_(111);
460 /* 						!NO, DEAD. */
461     return;
462 
463 L9200:
464     if (findex_1.btief != 0) {
465 	goto L9300;
466     }
467 /* 						!TIED TO LEDGE? */
468     rspeak_(112);
469 /* 						!NO, NO PLACE TO LAND. */
470     return;
471 
472 L9300:
473     state_1.bloc = rindex_1.vlbot;
474 /* 						!YES, CRASH BALLOON. */
475     newsta_(oindex_1.ballo, 0, 0, 0, 0);
476 /* 						!BALLOON & CONTENTS DIE. */
477     newsta_(oindex_1.dball, 0, state_1.bloc, 0, 0);
478 /* 						!INSERT DEAD BALLOON. */
479     findex_1.btief = 0;
480     findex_1.binff = 0;
481     cevent_1.cflag[cindex_1.cevbal - 1] = FALSE_;
482     cevent_1.cflag[cindex_1.cevbrn - 1] = FALSE_;
483     jigsup_(113);
484 /* 						!DEAD */
485     return;
486 
487 /* CEV10--	SAFE MUNG. */
488 
489 L10000:
490     rooms_1.rflag[state_1.mungrm - 1] |= RMUNG;
491     rrand[state_1.mungrm - 1] = 114;
492     if (play_1.here == state_1.mungrm) {
493 	goto L10100;
494     }
495 /* 						!IS HE PRESENT? */
496     rspeak_(115);
497 /* 						!LET HIM KNOW. */
498     if (state_1.mungrm == rindex_1.msafe) {
499 	cevent_1.ctick[cindex_1.cevled - 1] = 8;
500     }
501 /* 						!START LEDGE CLOCK. */
502     return;
503 
504 L10100:
505     i = 116;
506 /* 						!HE'S DEAD, */
507     if ((rooms_1.rflag[play_1.here - 1] & RHOUSE) != 0) {
508 	i = 117;
509     }
510     jigsup_(i);
511 /* 						!LET HIM KNOW. */
512     return;
513 /* CEVAPP, PAGE 6 */
514 
515 /* CEV11--	VOLCANO GNOME */
516 
517 L11000:
518     if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
519 	    play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
520 	goto L11100;
521     }
522 /* 						!IS HE ON LEDGE? */
523     cevent_1.ctick[cindex_1.cevvlg - 1] = 1;
524 /* 						!NO, WAIT A WHILE. */
525     return;
526 
527 L11100:
528     newsta_(oindex_1.gnome, 118, play_1.here, 0, 0);
529 /* 						!YES, MATERIALIZE GNOME. */
530     return;
531 
532 /* CEV12--	VOLCANO GNOME DISAPPEARS */
533 
534 L12000:
535     newsta_(oindex_1.gnome, 149, 0, 0, 0);
536 /* 						!DISAPPEAR THE GNOME. */
537     return;
538 
539 /* CEV13--	BUCKET. */
540 
541 L13000:
542     if (objcts_1.ocan[oindex_1.water - 1] == oindex_1.bucke) {
543 	newsta_(oindex_1.water, 0, 0, 0, 0);
544     }
545     return;
546 
547 /* CEV14--	SPHERE.  IF EXPIRES, HE'S TRAPPED. */
548 
549 L14000:
550     rooms_1.rflag[rindex_1.cager - 1] |= RMUNG;
551     rrand[rindex_1.cager - 1] = 147;
552     jigsup_(148);
553 /* 						!MUNG PLAYER. */
554     return;
555 
556 /* CEV15--	END GAME HERALD. */
557 
558 L15000:
559     findex_1.endgmf = TRUE_;
560 /* 						!WE'RE IN ENDGAME. */
561     rspeak_(119);
562 /* 						!INFORM OF ENDGAME. */
563     return;
564 /* CEVAPP, PAGE 7 */
565 
566 /* CEV16--	FOREST MURMURS */
567 
568 L16000:
569     cevent_1.cflag[cindex_1.cevfor - 1] = play_1.here == rindex_1.mtree ||
570 	    play_1.here >= rindex_1.fore1 && play_1.here < rindex_1.clear;
571     if (cevent_1.cflag[cindex_1.cevfor - 1] && prob_(10, 10)) {
572 	rspeak_(635);
573     }
574     return;
575 
576 /* CEV17--	SCOL ALARM */
577 
578 L17000:
579     if (play_1.here == rindex_1.bktwi) {
580 	cevent_1.cflag[cindex_1.cevzgi - 1] = TRUE_;
581     }
582 /* 						!IF IN TWI, GNOME. */
583     if (play_1.here == rindex_1.bkvau) {
584 	jigsup_(636);
585     }
586 /* 						!IF IN VAU, DEAD. */
587     return;
588 
589 /* CEV18--	ENTER GNOME OF ZURICH */
590 
591 L18000:
592     cevent_1.cflag[cindex_1.cevzgo - 1] = TRUE_;
593 /* 						!EXITS, TOO. */
594     newsta_(oindex_1.zgnom, 0, rindex_1.bktwi, 0, 0);
595 /* 						!PLACE IN TWI. */
596     if (play_1.here == rindex_1.bktwi) {
597 	rspeak_(637);
598     }
599 /* 						!ANNOUNCE. */
600     return;
601 
602 /* CEV19--	EXIT GNOME */
603 
604 L19000:
605     newsta_(oindex_1.zgnom, 0, 0, 0, 0);
606 /* 						!VANISH. */
607     if (play_1.here == rindex_1.bktwi) {
608 	rspeak_(638);
609     }
610 /* 						!ANNOUNCE. */
611     return;
612 /* CEVAPP, PAGE 8 */
613 
614 /* CEV20--	START OF ENDGAME */
615 
616 L20000:
617     if (findex_1.spellf) {
618 	goto L20200;
619     }
620 /* 						!SPELL HIS WAY IN? */
621     if (play_1.here != rindex_1.crypt) {
622 	return;
623     }
624 /* 						!NO, STILL IN TOMB? */
625     if (! lit_(play_1.here)) {
626 	goto L20100;
627     }
628 /* 						!LIGHTS OFF? */
629     cevent_1.ctick[cindex_1.cevste - 1] = 3;
630 /* 						!RESCHEDULE. */
631     return;
632 
633 L20100:
634     rspeak_(727);
635 /* 						!ANNOUNCE. */
636 L20200:
637     i__1 = objcts_1.olnt;
638     for (i = 1; i <= i__1; ++i) {
639 /* 						!STRIP HIM OF OBJS. */
640 	newsta_(i, 0, objcts_1.oroom[i - 1], objcts_1.ocan[i - 1],
641 		0);
642 /* L20300: */
643     }
644     newsta_(oindex_1.lamp, 0, 0, 0, aindex_1.player);
645 /* 						!GIVE HIM LAMP. */
646     newsta_(oindex_1.sword, 0, 0, 0, aindex_1.player);
647 /* 						!GIVE HIM SWORD. */
648 
649     objcts_1.oflag1[oindex_1.lamp - 1] = (objcts_1.oflag1[oindex_1.lamp - 1] |
650 	     LITEBT) & ~ ONBT;
651     objcts_1.oflag2[oindex_1.lamp - 1] |= TCHBT;
652     cevent_1.cflag[cindex_1.cevlnt - 1] = FALSE_;
653 /* 						!LAMP IS GOOD AS NEW. */
654     cevent_1.ctick[cindex_1.cevlnt - 1] = 350;
655     findex_1.orlamp = 0;
656     objcts_1.oflag2[oindex_1.sword - 1] |= TCHBT;
657     hack_1.swdact = TRUE_;
658     hack_1.swdsta = 0;
659 
660     hack_1.thfact = FALSE_;
661 /* 						!THIEF GONE. */
662     findex_1.endgmf = TRUE_;
663 /* 						!ENDGAME RUNNING. */
664     cevent_1.cflag[cindex_1.cevmat - 1] = FALSE_;
665 /* 						!MATCHES GONE, */
666     cevent_1.cflag[cindex_1.cevcnd - 1] = FALSE_;
667 /* 						!CANDLES GONE. */
668 
669     scrupd_(rooms_1.rval[rindex_1.crypt - 1]);
670 /* 						!SCORE CRYPT, */
671     rooms_1.rval[rindex_1.crypt - 1] = 0;
672 /* 						!BUT ONLY ONCE. */
673     f = moveto_(rindex_1.tstrs, play_1.winner);
674 /* 						!TO TOP OF STAIRS, */
675     f = rmdesc_(3);
676 /* 						!AND DESCRIBE. */
677     return;
678 /* 						!BAM */
679 /* 						! */
680 
681 /* CEV21--	MIRROR CLOSES. */
682 
683 L21000:
684     findex_1.mrpshf = FALSE_;
685 /* 						!BUTTON IS OUT. */
686     findex_1.mropnf = FALSE_;
687 /* 						!MIRROR IS CLOSED. */
688     if (play_1.here == rindex_1.mrant) {
689 	rspeak_(728);
690     }
691 /* 						!DESCRIBE BUTTON. */
692     if (play_1.here == rindex_1.inmir || mrhere_(play_1.here) == 1) {
693 	rspeak_(729);
694     }
695     return;
696 /* CEVAPP, PAGE 9 */
697 
698 /* CEV22--	DOOR CLOSES. */
699 
700 L22000:
701     if (findex_1.wdopnf) {
702 	rspeak_(730);
703     }
704 /* 						!DESCRIBE. */
705     findex_1.wdopnf = FALSE_;
706 /* 						!CLOSED. */
707     return;
708 
709 /* CEV23--	INQUISITOR'S QUESTION */
710 
711 L23000:
712     if (advs_1.aroom[aindex_1.player - 1] != rindex_1.fdoor) {
713 	return;
714     }
715 /* 						!IF PLAYER LEFT, DIE. */
716     rspeak_(769);
717     i__1 = findex_1.quesno + 770;
718     rspeak_(i__1);
719     cevent_1.ctick[cindex_1.cevinq - 1] = 2;
720     return;
721 
722 /* CEV24--	MASTER FOLLOWS */
723 
724 L24000:
725     if (advs_1.aroom[aindex_1.amastr - 1] == play_1.here) {
726 	return;
727     }
728 /* 						!NO MOVEMENT, DONE. */
729     if (play_1.here != rindex_1.cell && play_1.here != rindex_1.pcell) {
730 	goto L24100;
731     }
732     if (findex_1.follwf) {
733 	rspeak_(811);
734     }
735 /* 						!WONT GO TO CELLS. */
736     findex_1.follwf = FALSE_;
737     return;
738 
739 L24100:
740     findex_1.follwf = TRUE_;
741 /* 						!FOLLOWING. */
742     i = 812;
743 /* 						!ASSUME CATCHES UP. */
744     i__1 = xsrch_1.xmax;
745     i__2 = xsrch_1.xmin;
746     for (j = xsrch_1.xmin; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
747 	if (findxt_(j, advs_1.aroom[aindex_1.amastr - 1]) && curxt_1.xroom1
748 		== play_1.here) {
749 	    i = 813;
750 	}
751 /* L24200: */
752     }
753     rspeak_(i);
754     newsta_(oindex_1.master, 0, play_1.here, 0, 0);
755 /* 						!MOVE MASTER OBJECT. */
756     advs_1.aroom[aindex_1.amastr - 1] = play_1.here;
757 /* 						!MOVE MASTER PLAYER. */
758     return;
759 
760 } /* cevapp_ */
761 
762 /* LITINT-	LIGHT INTERRUPT PROCESSOR */
763 
764 /* DECLARATIONS */
765 
litint_(obj,ctr,cev,ticks,tickln)766 static void litint_(obj, ctr, cev, ticks, tickln)
767 integer obj;
768 integer *ctr;
769 integer cev;
770 const integer *ticks;
771 integer tickln;
772 {
773     /* Parameter adjustments */
774     --ticks;
775 
776     /* Function Body */
777     ++(*ctr);
778 /* 						!ADVANCE STATE CNTR. */
779     cevent_1.ctick[cev - 1] = ticks[*ctr];
780 /* 						!RESET INTERRUPT. */
781     if (cevent_1.ctick[cev - 1] != 0) {
782 	goto L100;
783     }
784 /* 						!EXPIRED? */
785     objcts_1.oflag1[obj - 1] &= ~ (LITEBT + FLAMBT +
786 	    ONBT);
787     if (objcts_1.oroom[obj - 1] == play_1.here || objcts_1.oadv[obj - 1] ==
788 	    play_1.winner) {
789 	rspsub_(293, objcts_1.odesc2[obj - 1]);
790     }
791     return;
792 
793 L100:
794     if (objcts_1.oroom[obj - 1] == play_1.here || objcts_1.oadv[obj - 1] ==
795 	    play_1.winner) {
796 	rspeak_(ticks[*ctr + tickln / 2]);
797     }
798     return;
799 
800 } /* litint_ */
801