1 /* Clock events, demons, actors for DUNGEON. */
2
3 /* COPYRIGHT 1980, 1990, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. */
4 /* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
5 /* WRITTEN BY R. M. SUPNIK */
6 /* Translated from Fortran to C by Andrew Plotkin <erkyrath@netcom.com>
7 on 10/4/98. */
8
9 /* 27-Sep-94 RMS Fixed bugs in thief demon, fight demon, master actor, */
10 /* robot actor, dead player, balloon, bell. */
11 /* 30-Jan-94 RMS Fixed bugs from MS DOS port. */
12 /* 18-Jan-94 RMS Fixed bug in dead player recovery. */
13 /* 01-Jul-92 RMS Removed extraneous function from CEVAPP. */
14 /* 30-Jun-92 RMS Changed file names to lower case. */
15
16 #include "glk.h"
17 #include "miscfort.h"
18 #include "funcs.h"
19 #include "commons.h"
20
21 /* CLOCKD- Intermove clock events demon */
22
23 /* Declarations */
24
clockd_(integer * x)25 logical clockd_(integer *x)
26 {
27 /* System generated locals */
28 integer i__1;
29 logical ret_val;
30
31 /* Local variables */
32 integer i__;
33
34
35 ret_val = FALSE_;
36 /* assume no action. */
37 i__1 = cevent_1.clnt;
38 for (i__ = 1; i__ <= i__1; ++i__) {
39 if (! cevent_1.cflag[i__ - 1] || cevent_1.ctick[i__ - 1] == 0) {
40 goto L100;
41 }
42 if (cevent_1.ctick[i__ - 1] < 0) {
43 goto L50;
44 }
45 /* permanent entry? */
46 --cevent_1.ctick[i__ - 1];
47 if (cevent_1.ctick[i__ - 1] != 0) {
48 goto L100;
49 }
50 /* timer expired? */
51 L50:
52 ret_val = TRUE_;
53 cevapp_(&cevent_1.cactio[i__ - 1]);
54 /* do action. */
55 L100:
56 ;
57 }
58 return ret_val;
59
60 } /* clockd_ */
61
62
63
64 /* CEVAPP- Clock event applicables */
65
66 /* Declarations */
67
cevapp_(integer * ri)68 /* Subroutine */ int cevapp_(integer *ri)
69 {
70 /* Initialized data */
71
72 static integer cndtck[10] = { 50,20,10,5,0,156,156,156,157,0 };
73 static integer lmptck[12] = { 50,30,20,10,4,0,154,154,154,154,155,0 };
74
75 /* System generated locals */
76 integer i__1, i__2;
77
78 /* Local variables */
79 logical f;
80 logical waslit;
81 integer i__;
82 integer br, bc;
83 integer j;
84
85
86 /* Functions and data */
87
88
89 if (*ri == 0) {
90 return 0;
91 }
92 /* ignore disabled. */
93 waslit = lit_(&play_1.here);
94 switch (*ri) {
95 case 1: goto L1000;
96 case 2: goto L2000;
97 case 3: goto L3000;
98 case 4: goto L4000;
99 case 5: goto L5000;
100 case 6: goto L6000;
101 case 7: goto L7000;
102 case 8: goto L8000;
103 case 9: goto L9000;
104 case 10: goto L10000;
105 case 11: goto L11000;
106 case 12: goto L12000;
107 case 13: goto L13000;
108 case 14: goto L14000;
109 case 15: goto L15000;
110 case 16: goto L16000;
111 case 17: goto L17000;
112 case 18: goto L18000;
113 case 19: goto L19000;
114 case 20: goto L20000;
115 case 21: goto L21000;
116 case 22: goto L22000;
117 case 23: goto L23000;
118 case 24: goto L24000;
119 case 25: goto L25000;
120 case 26: goto L26000;
121 case 27: goto L27000;
122 case 28: goto L28000;
123 case 29: goto L29000;
124 case 30: goto L30000;
125 }
126 bug_(&c__3, ri);
127
128 /* Return here to test for change in light. */
129
130 L50:
131 if (waslit && ! lit_(&play_1.here)) {
132 rspeak_(&c__406);
133 }
134 return 0;
135 /* CEVAPP, PAGE 2 */
136
137 /* CEV1-- Cure clock. Let player slowly recover. */
138
139 L1000:
140 /* Computing MIN */
141 i__1 = 0, i__2 = advs_1.astren[0] + 1;
142 advs_1.astren[0] = min(i__1,i__2);
143 /* recover. */
144 if (advs_1.astren[0] >= 0) {
145 return 0;
146 }
147 /* fully recovered? */
148 cevent_1.cflag[0] = TRUE_;
149 cevent_1.ctick[0] = 30;
150 /* no, wait some more. */
151 return 0;
152
153 /* CEV2-- Maint-room with leak. Raise the water level. */
154
155 L2000:
156 if (play_1.here == 100) {
157 i__1 = findex_1.rvmnt / 2 + 71;
158 rspeak_(&i__1);
159 }
160 /* describe. */
161 ++findex_1.rvmnt;
162 /* raise water level. */
163 if (findex_1.rvmnt <= 16) {
164 return 0;
165 }
166 /* if not full, exit. */
167 cevent_1.ctick[1] = 0;
168 /* full, disable clock. */
169 rooms_1.rflag[99] = rooms_1.rflag[99] | 256;
170 /* mung room. */
171 rooms_1.rdesc1[99] = 80;
172 /* say it is full of wate */
173 if (play_1.here == 100) {
174 jigsup_(&c__81);
175 }
176 /* drown him if present. */
177 return 0;
178
179 /* CEV3-- Lantern. Describe growing dimness. */
180
181 L3000:
182 litint_(&c__15, &findex_1.orlamp, &c__3, lmptck, &c__12);
183 /* do light interrupt. */
184 goto L50;
185
186 /* CEV4-- Match. Out it goes. */
187
188 /* go see if now dark. */
189 L4000:
190 rspeak_(&c__153);
191 /* match is out. */
192 objcts_1.oflag1[50] = objcts_1.oflag1[50] & -74;
193 goto L50;
194
195 /* CEV5-- Candle. Describe growing dimness. */
196
197 /* go see if now dark. */
198 L5000:
199 litint_(&c__48, &findex_1.orcand, &c__5, cndtck, &c__10);
200 /* do candle interrupt. */
201 goto L50;
202 /* CEVAPP, PAGE 3 */
203
204 /* CEV6-- Balloon. */
205
206 /* go see if now dark. */
207 L6000:
208 cevent_1.cflag[5] = TRUE_;
209 cevent_1.ctick[5] = 3;
210 /* reschedule interrupt. */
211 f = advs_1.avehic[play_1.winner - 1] == 98;
212 /* see if in balloon. */
213 if (play_1.bloc == 126) {
214 goto L6800;
215 }
216 /* at bottom? */
217 if (play_1.bloc == 131 || play_1.bloc == 132 || play_1.bloc == 133) {
218 goto L6700;
219 }
220 /* on ledge? */
221 if ((objcts_1.oflag2[c__99 - 1] & 8) != 0 && findex_1.binff != 0) {
222 goto L6500;
223 }
224
225 /* Balloon is in midair and is deflated (or has receptacle closed). */
226 /* Fall to next room. */
227
228 /* inflated and recep ope */
229 if (play_1.bloc != 127) {
230 goto L6300;
231 }
232 /* in vair1? */
233 play_1.bloc = 126;
234 /* yes, now at vlbot. */
235 newsta_(&c__98, &c__0, &play_1.bloc, &c__0, &c__0);
236 if (f) {
237 goto L6200;
238 }
239 /* in balloon? */
240 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133 ||
241 play_1.here == 126) {
242 rspeak_(&c__530);
243 }
244 /* if can see, describe. */
245 return 0;
246
247 L6200:
248 f = moveto_(&play_1.bloc, &play_1.winner);
249 /* move him. */
250 if (findex_1.binff == 0) {
251 goto L6250;
252 }
253 /* in balloon. inflated? */
254 rspeak_(&c__531);
255 /* yes, landed. */
256 f = rmdesc_(&c__0);
257 /* describe. */
258 return 0;
259
260 L6250:
261 newsta_(&c__98, &c__532, &c__0, &c__0, &c__0);
262 /* no, balloon & contents */
263 newsta_(&c__113, &c__0, &play_1.bloc, &c__0, &c__0);
264 /* insert dead balloon. */
265 if (prssta_1.lastit == 98) {
266 prssta_1.lastit = 113;
267 }
268 /* fix last it reference. */
269 advs_1.avehic[play_1.winner - 1] = 0;
270 /* not in vehicle. */
271 cevent_1.cflag[5] = FALSE_;
272 /* disable interrupts. */
273 cevent_1.cflag[6] = FALSE_;
274 return 0;
275
276 L6300:
277 --play_1.bloc;
278 /* not in vair1, descend. */
279 newsta_(&c__98, &c__0, &play_1.bloc, &c__0, &c__0);
280 if (f) {
281 goto L6400;
282 }
283 /* is he in balloon? */
284 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133 ||
285 play_1.here == 126) {
286 rspeak_(&c__533);
287 }
288 /* if can see, describe. */
289 return 0;
290
291 L6400:
292 f = moveto_(&play_1.bloc, &play_1.winner);
293 /* in balloon, move him. */
294 rspeak_(&c__534);
295 /* describe. */
296 f = rmdesc_(&c__0);
297 return 0;
298
299 /* Balloon is in midair and is inflated, up-up-and-away! */
300
301 L6500:
302 if (play_1.bloc != 130) {
303 goto L6600;
304 }
305 /* at vair4? */
306 cevent_1.cflag[6] = FALSE_;
307 /* disable interrupts. */
308 cevent_1.cflag[5] = FALSE_;
309 findex_1.binff = 0;
310 play_1.bloc = 126;
311 /* fall to bottom. */
312 newsta_(&c__98, &c__0, &c__0, &c__0, &c__0);
313 /* balloon & contents die */
314 newsta_(&c__113, &c__0, &play_1.bloc, &c__0, &c__0);
315 /* substitute dead balloo */
316 if (prssta_1.lastit == 98) {
317 prssta_1.lastit = 113;
318 }
319 /* fix last it reference. */
320 if (f) {
321 goto L6550;
322 }
323 /* was he in it? */
324 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133) {
325 rspeak_(&c__535);
326 }
327 /* if can see, describe. */
328 if (play_1.here == 126) {
329 rspeak_(&c__925);
330 }
331 /* if at bottom, describe */
332 return 0;
333
334 L6550:
335 jigsup_(&c__536);
336 /* in balloon at crash, d */
337 return 0;
338
339 L6600:
340 ++play_1.bloc;
341 /* not at vair4, go up. */
342 newsta_(&c__98, &c__0, &play_1.bloc, &c__0, &c__0);
343 if (f) {
344 goto L6650;
345 }
346 /* in balloon? */
347 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133 ||
348 play_1.here == 126) {
349 rspeak_(&c__537);
350 }
351 /* if can see, describe. */
352 return 0;
353
354 L6650:
355 f = moveto_(&play_1.bloc, &play_1.winner);
356 /* move player. */
357 rspeak_(&c__538);
358 /* describe. */
359 f = rmdesc_(&c__0);
360 return 0;
361
362 /* On ledge, goes to midair room whether inflated or not. */
363
364 L6700:
365 play_1.bloc += -3;
366 /* move to midair. */
367 newsta_(&c__98, &c__0, &play_1.bloc, &c__0, &c__0);
368 if (f) {
369 goto L6750;
370 }
371 /* in balloon? */
372 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133 ||
373 play_1.here == 126) {
374 rspeak_(&c__539);
375 }
376 /* if can see, describe. */
377 cevent_1.cflag[10] = TRUE_;
378 /* stranded. */
379 cevent_1.ctick[10] = 10;
380 /* materialize gnome. */
381 return 0;
382
383 L6750:
384 f = moveto_(&play_1.bloc, &play_1.winner);
385 /* move to new room. */
386 rspeak_(&c__540);
387 /* describe. */
388 f = rmdesc_(&c__0);
389 return 0;
390
391 /* At bottom, go up if inflated, do nothing if deflated. */
392
393 L6800:
394 if (findex_1.binff == 0 || ! ((objcts_1.oflag2[c__99 - 1] & 8) != 0)) {
395 return 0;
396 }
397 play_1.bloc = 127;
398 /* inflated and open, */
399 newsta_(&c__98, &c__0, &play_1.bloc, &c__0, &c__0);
400 /* go up to vair1. */
401 if (f) {
402 goto L6850;
403 }
404 /* in balloon? */
405 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133 ||
406 play_1.here == 126) {
407 rspeak_(&c__541);
408 }
409 /* if can see, describe. */
410 return 0;
411
412 L6850:
413 f = moveto_(&play_1.bloc, &play_1.winner);
414 /* move player. */
415 rspeak_(&c__542);
416 f = rmdesc_(&c__0);
417 return 0;
418 /* CEVAPP, PAGE 4 */
419
420 /* CEV7-- Balloon burnup. */
421
422 L7000:
423 i__1 = objcts_1.olnt;
424 for (i__ = 1; i__ <= i__1; ++i__) {
425 /* find burning object */
426 if (99 == objcts_1.ocan[i__ - 1] && (objcts_1.oflag1[i__ - 1] & 8) !=
427 0) {
428 goto L7200;
429 }
430 /* in receptacle. */
431 /* L7100: */
432 }
433 bug_(&c__4, &c__0);
434
435 L7200:
436 newsta_(&i__, &c__0, &c__0, &c__0, &c__0);
437 /* vanish object. */
438 findex_1.binff = 0;
439 /* uninflated. */
440 if (play_1.here == play_1.bloc) {
441 rspsub_(&c__292, &objcts_1.odesc2[i__ - 1]);
442 }
443 /* describe. */
444 return 0;
445
446 /* CEV8-- Fuse function. */
447
448 L8000:
449 if (objcts_1.ocan[109] != 109) {
450 goto L8500;
451 }
452 /* ignited brick? */
453 br = objcts_1.oroom[108];
454 /* get brick room. */
455 bc = objcts_1.ocan[108];
456 /* get container. */
457 if (br == 0 && bc != 0) {
458 br = objcts_1.oroom[bc - 1];
459 }
460 if (br == 0) {
461 br = play_1.here;
462 }
463 /* it's here... */
464 newsta_(&c__110, &c__0, &c__0, &c__0, &c__0);
465 /* kill fuse. */
466 newsta_(&c__109, &c__0, &c__0, &c__0, &c__0);
467 /* kill brick. */
468 if (br != play_1.here) {
469 goto L8100;
470 }
471
472 /* brick elsewhere? */
473 rooms_1.rflag[play_1.here - 1] = rooms_1.rflag[play_1.here - 1] | 256;
474 /* blew self. */
475 rooms_1.rdesc1[play_1.here - 1] = 114;
476 /* mung room. */
477 jigsup_(&c__150);
478 /* dead. */
479 return 0;
480
481 L8100:
482 rspeak_(&c__151);
483 /* boom. */
484 play_1.mungrm = br;
485 /* save room that blew. */
486 cevent_1.cflag[9] = TRUE_;
487 cevent_1.ctick[9] = 5;
488 /* set safe interrupt. */
489 if (br != 135) {
490 goto L8200;
491 }
492 /* blew safe room? */
493 if (bc != 107) {
494 return 0;
495 }
496 /* was brick in safe? */
497 newsta_(&c__107, &c__0, &c__0, &c__0, &c__0);
498 /* kill slot. */
499 objcts_1.oflag2[104] = objcts_1.oflag2[104] | 8;
500 /* open safe. */
501 findex_1.safef = TRUE_;
502 /* indicate safe blown. */
503 return 0;
504
505 L8200:
506 i__1 = objcts_1.olnt;
507 for (i__ = 1; i__ <= i__1; ++i__) {
508 /* blew wrong room. */
509 if (qhere_(&i__, &br) && (objcts_1.oflag1[i__ - 1] & 8192) != 0) {
510 newsta_(&i__, &c__0, &c__0, &c__0, &c__0);
511 }
512 /* vanish contents. */
513 /* L8250: */
514 }
515 if (br != 8) {
516 return 0;
517 }
518 /* blew living room? */
519 i__1 = objcts_1.olnt;
520 for (i__ = 1; i__ <= i__1; ++i__) {
521 if (objcts_1.ocan[i__ - 1] == 9) {
522 newsta_(&i__, &c__0, &c__0, &c__0, &c__0);
523 }
524 /* kill trophy case. */
525 /* L8300: */
526 }
527 return 0;
528
529 L8500:
530 if (qhere_(&c__110, &play_1.here) || objcts_1.oadv[109] == play_1.winner)
531 {
532 rspeak_(&c__152);
533 }
534 newsta_(&c__110, &c__0, &c__0, &c__0, &c__0);
535 /* kill fuse. */
536 return 0;
537 /* CEVAPP, PAGE 5 */
538
539 /* CEV9-- Ledge munge. */
540
541 L9000:
542 rooms_1.rflag[132] = rooms_1.rflag[132] | 256;
543 /* ledge collapses. */
544 rooms_1.rdesc1[132] = 109;
545 if (play_1.here == 133) {
546 goto L9100;
547 }
548 /* was he there? */
549 rspeak_(&c__110);
550 /* no, narrow escape. */
551 return 0;
552
553 L9100:
554 if (advs_1.avehic[play_1.winner - 1] != 0) {
555 goto L9200;
556 }
557 /* in vehicle? */
558 jigsup_(&c__111);
559 /* no, dead. */
560 return 0;
561
562 L9200:
563 if (findex_1.btief != 0) {
564 goto L9300;
565 }
566 /* tied to ledge? */
567 rspeak_(&c__112);
568 /* no, no place to land. */
569 return 0;
570
571 L9300:
572 play_1.bloc = 126;
573 /* yes, crash balloon. */
574 newsta_(&c__98, &c__0, &c__0, &c__0, &c__0);
575 /* balloon & contents die */
576 newsta_(&c__113, &c__0, &play_1.bloc, &c__0, &c__0);
577 /* insert dead balloon. */
578 if (prssta_1.lastit == 98) {
579 prssta_1.lastit = 113;
580 }
581 /* fix last it reference. */
582 objcts_1.odesc1[findex_1.btief - 1] = 1073;
583 /* restore description. */
584 findex_1.btief = 0;
585 findex_1.binff = 0;
586 cevent_1.cflag[5] = FALSE_;
587 cevent_1.cflag[6] = FALSE_;
588 jigsup_(&c__113);
589 /* dead. */
590 return 0;
591
592 /* CEV10-- Safe munge. */
593
594 L10000:
595 rooms_1.rflag[play_1.mungrm - 1] = rooms_1.rflag[play_1.mungrm - 1] | 256;
596 /* mung target. */
597 rooms_1.rdesc1[play_1.mungrm - 1] = 114;
598 if (play_1.here == play_1.mungrm) {
599 goto L10100;
600 }
601 /* is he present? */
602 rspeak_(&c__115);
603 /* let him know. */
604 if (play_1.mungrm != 135) {
605 return 0;
606 }
607 cevent_1.cflag[8] = TRUE_;
608 cevent_1.ctick[8] = 8;
609 /* start ledge clock. */
610 return 0;
611
612 L10100:
613 i__ = 116;
614 /* he's dead, */
615 if ((rooms_1.rflag[play_1.here - 1] & 64) != 0) {
616 i__ = 117;
617 }
618 /* one way or another. */
619 jigsup_(&i__);
620 /* let him know. */
621 return 0;
622 /* CEVAPP, PAGE 6 */
623
624 /* CEV11-- Volcano gnome entrance. */
625
626 L11000:
627 if (play_1.here == 131 || play_1.here == 132 || play_1.here == 133) {
628 goto L11100;
629 }
630 /* is he on ledge? */
631 cevent_1.cflag[10] = TRUE_;
632 cevent_1.ctick[10] = 1;
633 /* no, wait a while. */
634 return 0;
635
636 L11100:
637 newsta_(&c__111, &c__118, &play_1.here, &c__0, &c__0);
638 /* yes, materialize gnome */
639 return 0;
640
641 /* CEV12-- Volcano gnome exit. */
642
643 L12000:
644 if (objcts_1.oroom[110] == play_1.here) {
645 rspeak_(&c__149);
646 }
647 /* player here to hear? */
648 newsta_(&c__111, &c__0, &c__0, &c__0, &c__0);
649 /* disappear the gnome. */
650 return 0;
651
652 /* CEV13-- Bucket. */
653
654 L13000:
655 if (objcts_1.ocan[10] == 137) {
656 newsta_(&c__11, &c__0, &c__0, &c__0, &c__0);
657 }
658 /* water leaks out. */
659 return 0;
660
661 /* CEV14-- Sphere. If expires, he's trapped. */
662
663 L14000:
664 rooms_1.rflag[139] = rooms_1.rflag[139] | 256;
665 /* mung room. */
666 rooms_1.rdesc1[139] = 147;
667 play_1.winner = 1;
668 /* kill player, not robot */
669 jigsup_(&c__148);
670 /* mung player. */
671 return 0;
672
673 /* CEV15-- END GAME HERALD. */
674
675 L15000:
676 findex_1.endgmf = TRUE_;
677 /* we're in endgame. */
678 rspeak_(&c__119);
679 /* inform of endgame. */
680 return 0;
681 /* CEVAPP, PAGE 7 */
682
683 /* CEV16-- Forest murmurs. */
684
685 L16000:
686 cevent_1.cflag[15] = play_1.here == 147 || (play_1.here >= 31 &&
687 play_1.here < 36);
688 if (cevent_1.cflag[15] && prob_(&c__10, &c__10)) {
689 rspeak_(&c__635);
690 }
691 return 0;
692
693 /* CEV17-- Scol alarm. */
694
695 L17000:
696 if (play_1.here == 154) {
697 jigsup_(&c__636);
698 }
699 /* if in vau, dead. */
700 if (findex_1.zgnomf || play_1.here != 153) {
701 return 0;
702 }
703 /* if not in twi, nothing */
704 findex_1.zgnomf = TRUE_;
705 /* gnome only comes once */
706 cevent_1.cflag[17] = TRUE_;
707 /* turn on gnome timer */
708 cevent_1.ctick[17] = 5;
709 return 0;
710
711 /* CEV18-- Gnome of Zurich entrance. */
712
713 L18000:
714 if (play_1.here != 153) {
715 return 0;
716 }
717 /* player here? */
718 cevent_1.cflag[18] = TRUE_;
719 /* exits, too. */
720 cevent_1.ctick[18] = 12;
721 newsta_(&c__152, &c__637, &c__153, &c__0, &c__0);
722 /* place in twi. */
723 return 0;
724
725 /* CEV19-- Gnome of Zurich exits. */
726
727 L19000:
728 newsta_(&c__152, &c__0, &c__0, &c__0, &c__0);
729 /* vanish. */
730 if (play_1.here == 153) {
731 rspeak_(&c__638);
732 }
733 /* announce. */
734 return 0;
735 /* CEVAPP, PAGE 8 */
736
737 /* CEV20-- Start of endgame. */
738
739 L20000:
740 if (findex_1.spellf) {
741 goto L20200;
742 }
743 /* spell his way in? */
744 if (play_1.here != 157) {
745 return 0;
746 }
747 /* no, still in tomb? */
748 if (! lit_(&play_1.here)) {
749 goto L20100;
750 }
751 /* lights off? */
752 cevent_1.cflag[19] = TRUE_;
753 cevent_1.ctick[19] = 3;
754 /* reschedule. */
755 return 0;
756
757 L20100:
758 rspeak_(&c__727);
759 /* announce. */
760 L20200:
761 i__1 = objcts_1.olnt;
762 for (i__ = 1; i__ <= i__1; ++i__) {
763 /* strip him of objs. */
764 newsta_(&i__, &c__0, &objcts_1.oroom[i__ - 1], &objcts_1.ocan[i__ - 1]
765 , &c__0);
766 /* L20300: */
767 }
768 newsta_(&c__15, &c__0, &c__0, &c__0, &c__1);
769 /* give him lamp. */
770 newsta_(&c__14, &c__0, &c__0, &c__0, &c__1);
771
772 /* give him sword. */
773 objcts_1.oflag1[14] = (objcts_1.oflag1[14] | 64) & -2;
774 objcts_1.oflag2[14] = objcts_1.oflag2[14] | 4;
775 cevent_1.cflag[2] = FALSE_;
776 /* lamp is good as new. */
777 cevent_1.ctick[2] = 350;
778 findex_1.orlamp = 0;
779 objcts_1.oflag2[13] = objcts_1.oflag2[13] | 4;
780 /* recreate sword. */
781 hack_1.swdact = TRUE_;
782 hack_1.swdsta = 0;
783
784 hack_1.thfact = FALSE_;
785 /* thief gone. */
786 findex_1.endgmf = TRUE_;
787 /* endgame running. */
788 cevent_1.cflag[14] = FALSE_;
789 /* herald gone, */
790 cevent_1.cflag[3] = FALSE_;
791 /* matches gone, */
792 cevent_1.cflag[4] = FALSE_;
793
794 /* candles gone. */
795 scrupd_(&rooms_1.rval[156]);
796 /* score crypt, */
797 rooms_1.rval[156] = 0;
798 /* but only once. */
799 f = moveto_(&c__158, &play_1.winner);
800 /* to top of stairs, */
801 f = rmdesc_(&c__3);
802 /* and describe. */
803 return 0;
804
805 /* CEV21-- Mirror closes. */
806
807 /* bam! */
808 L21000:
809 findex_1.mrpshf = FALSE_;
810 /* button is out. */
811 findex_1.mropnf = FALSE_;
812 /* mirror is closed. */
813 if (play_1.here == 159) {
814 rspeak_(&c__728);
815 }
816 /* describe button. */
817 if (play_1.here == 177 || mrhere_(&play_1.here) == 1) {
818 rspeak_(&c__729);
819 }
820 /* describe mirror. */
821 return 0;
822 /* CEVAPP, PAGE 9 */
823
824 /* CEV22-- Door closes. */
825
826 L22000:
827 if (findex_1.wdopnf) {
828 rspeak_(&c__730);
829 }
830 /* describe. */
831 findex_1.wdopnf = FALSE_;
832 /* closed. */
833 return 0;
834
835 /* CEV23-- Inquisitor's question. */
836
837 L23000:
838 if (advs_1.aroom[0] != 166) {
839 return 0;
840 }
841 /* if player left, die. */
842 rspeak_(&c__769);
843 i__1 = findex_1.quesno + 770;
844 rspeak_(&i__1);
845 cevent_1.cflag[22] = TRUE_;
846 cevent_1.ctick[22] = 2;
847 return 0;
848
849 /* CEV24-- Master follows. */
850
851 L24000:
852 if (advs_1.aroom[2] == play_1.here) {
853 return 0;
854 }
855 /* no movement, done. */
856 if (play_1.here != 184 && play_1.here != 185) {
857 goto L24100;
858 }
859 if (findex_1.follwf) {
860 rspeak_(&c__811);
861 }
862 /* wont go to cells. */
863 findex_1.follwf = FALSE_;
864 return 0;
865
866 L24100:
867 findex_1.follwf = TRUE_;
868 /* following. */
869 i__ = 812;
870 /* assume catches up. */
871 for (j = 1024; j <= 16384; j += 1024) {
872 if (findxt_(&j, &advs_1.aroom[2]) && curxt_1.xroom1 == play_1.here) {
873 i__ = 813;
874 }
875 /* assume follows. */
876 /* L24200: */
877 }
878 rspeak_(&i__);
879 newsta_(&c__279, &c__0, &play_1.here, &c__0, &c__0);
880 /* move master object. */
881 advs_1.aroom[2] = play_1.here;
882 /* move master actor. */
883 return 0;
884
885 /* CEV25-- Brochure arrives. */
886
887 L25000:
888 newsta_(&c__195, &c__948, &c__0, &c__53, &c__0);
889 /* put brochure in mailbo */
890 findex_1.broc2f = TRUE_;
891 /* flag arrival */
892 return 0;
893 /* CEVAPP, PAGE 10 */
894
895 /* CEV26-- Cyclops. */
896
897 L26000:
898 if (play_1.here != 101 || findex_1.magicf) {
899 goto L26500;
900 }
901 /* player or cyclops gone */
902 if (findex_1.cyclof) {
903 return 0;
904 }
905 /* if asleep, check later */
906 if (abs(findex_1.rvcyc) <= 5) {
907 goto L26200;
908 }
909 /* cyclops overly annoyed */
910 cevent_1.cflag[25] = FALSE_;
911 /* disable cyclops timer */
912 jigsup_(&c__188);
913 /* player munched for lun */
914 return 0;
915
916 L26200:
917 if (findex_1.rvcyc < 0) {
918 --findex_1.rvcyc;
919 }
920 /* cyclops gets more anno */
921 if (findex_1.rvcyc >= 0) {
922 ++findex_1.rvcyc;
923 }
924 i__1 = abs(findex_1.rvcyc) + 193;
925 rspeak_(&i__1);
926 /* report cyclops state */
927 return 0;
928
929 L26500:
930 cevent_1.cflag[25] = FALSE_;
931 /* disable cyclops timer */
932 return 0;
933
934 /* CEV27-- Slippery slide. */
935
936 L27000:
937 if (play_1.here < 194 || play_1.here >= 197) {
938 return 0;
939 }
940 /* in slide? */
941 rspeak_(&c__1034);
942 /* slide to cellar */
943 f = moveto_(&c__9, &play_1.winner);
944 /* into cellar */
945 f = rmdesc_(&c__3);
946 /* describe */
947 return 0;
948
949 /* CEV28-- Exorcism bell. */
950
951 L28000:
952 if (! findex_1.exorcf && play_1.here == 93) {
953 rspeak_(&c__970);
954 }
955 findex_1.exorbf = FALSE_;
956 /* spell broken */
957 return 0;
958
959 /* CEV29-- Exorcism candles. */
960
961 L29000:
962 findex_1.exorcf = FALSE_;
963 /* spell broken */
964 goto L28000;
965
966 /* CEV30-- Hot bell cools down. */
967
968 L30000:
969 newsta_(&c__190, &c__0, &c__0, &c__0, &c__0);
970 /* banish hot bell */
971 newsta_(&c__46, &c__0, &c__93, &c__0, &c__0);
972 /* get normal bell */
973 if (prssta_1.lastit == 190) {
974 prssta_1.lastit = 46;
975 }
976 /* fix last it reference. */
977 if (play_1.here == 93) {
978 rspeak_(&c__971);
979 }
980 /* tell player if here */
981 return 0;
982
983 } /* cevapp_ */
984
985
986
987 /* LITINT- Light interrupt processor */
988
989 /* Declarations */
990
litint_(integer * obj,integer * ctr,integer * cev,integer * ticks,integer * tickln)991 /* Subroutine */ int litint_(integer *obj, integer *ctr, integer *cev,
992 integer *ticks, integer *tickln)
993 {
994 /* Local variables */
995
996
997 /* Parameter adjustments */
998 --ticks;
999
1000 /* Function Body */
1001 ++(*ctr);
1002 /* advance state cntr. */
1003 cevent_1.ctick[*cev - 1] = ticks[*ctr];
1004 /* reset interrupt. */
1005 if (cevent_1.ctick[*cev - 1] != 0) {
1006 goto L100;
1007 }
1008 /* expired? */
1009 objcts_1.oflag1[*obj - 1] = objcts_1.oflag1[*obj - 1] & -74;
1010 if (objcts_1.oroom[*obj - 1] == play_1.here || objcts_1.oadv[*obj - 1] ==
1011 play_1.winner) {
1012 rspsub_(&c__293, &objcts_1.odesc2[*obj - 1]);
1013 }
1014 return 0;
1015
1016 L100:
1017 cevent_1.cflag[*cev - 1] = TRUE_;
1018 if (objcts_1.oroom[*obj - 1] == play_1.here || objcts_1.oadv[*obj - 1] ==
1019 play_1.winner) {
1020 rspeak_(&ticks[*ctr + *tickln / 2]);
1021 }
1022 return 0;
1023
1024 } /* litint_ */
1025
1026
1027
1028 /* FIGHTD- Intermove fight demon */
1029
1030 /* Declarations */
1031
fightd_(void)1032 /* Subroutine */ int fightd_(void)
1033 {
1034 /* Initialized data */
1035
1036 static integer rout = 1;
1037
1038 /* System generated locals */
1039 integer i__1, i__2;
1040
1041 /* Local variables */
1042 logical f;
1043 integer i__, ra, j;
1044 integer obj;
1045 integer res, out;
1046
1047
1048 /* Functions and data */
1049
1050 /* FIGHTD, PAGE 2 */
1051
1052 i__1 = vill_1.vlnt;
1053 for (i__ = 1; i__ <= i__1; ++i__) {
1054 /* loop thru villains. */
1055 vill_1.vopps[i__ - 1] = 0;
1056 /* clear opponent slot. */
1057 obj = vill_1.villns[i__ - 1];
1058 /* get object no. */
1059 ra = objcts_1.oactio[obj - 1];
1060 /* get his action. */
1061 if (play_1.here != objcts_1.oroom[obj - 1]) {
1062 goto L2200;
1063 }
1064 /* adventurer still here? */
1065 if (obj != 61 || ! findex_1.thfenf) {
1066 goto L2010;
1067 }
1068 /* thief engrossed? */
1069 findex_1.thfenf = FALSE_;
1070 /* yes, not anymore. */
1071 goto L2400;
1072
1073 L2010:
1074 if (objcts_1.ocapac[obj - 1] >= 0) {
1075 goto L2050;
1076 }
1077 /* no, vill awake? */
1078 i__2 = (vill_1.vprob[i__ - 1] + 100) / 2;
1079 if (vill_1.vprob[i__ - 1] == 0 || ! prob_(&vill_1.vprob[i__ - 1], &
1080 i__2)) {
1081 goto L2025;
1082 }
1083 /* no, see if wakes up. */
1084 objcts_1.ocapac[obj - 1] = (i__2 = objcts_1.ocapac[obj - 1], abs(i__2)
1085 );
1086 vill_1.vprob[i__ - 1] = 0;
1087 if (ra == 0) {
1088 goto L2400;
1089 }
1090 /* anything to do? */
1091 prsvec_1.prsa = 4;
1092 /* yes, wake him up. */
1093 f = oappli_(&ra, &c__0);
1094 goto L2400;
1095
1096 /* nothing else happens. */
1097 L2025:
1098 vill_1.vprob[i__ - 1] += 10;
1099 /* increase wakeup prob. */
1100 goto L2400;
1101
1102 /* nothing else. */
1103 L2050:
1104 if ((objcts_1.oflag2[obj - 1] & 256) == 0) {
1105 goto L2100;
1106 }
1107 vill_1.vopps[i__ - 1] = obj;
1108 /* fighting, set up opp. */
1109 goto L2400;
1110
1111 L2100:
1112 if (ra == 0) {
1113 goto L2400;
1114 }
1115 /* not fighting, */
1116 prsvec_1.prsa = 3;
1117 /* set up probability */
1118 if (! oappli_(&ra, &c__0)) {
1119 goto L2400;
1120 }
1121 /* of fighting. */
1122 objcts_1.oflag2[obj - 1] = objcts_1.oflag2[obj - 1] | 256;
1123 vill_1.vopps[i__ - 1] = obj;
1124 /* set up opp. */
1125 prsvec_1.prscon = 0;
1126 /* stop cmd stream. */
1127 goto L2400;
1128
1129 L2200:
1130 if ((objcts_1.oflag2[obj - 1] & 256) == 0 || ra == 0) {
1131 goto L2300;
1132 }
1133 /* nothing to do. */
1134 prsvec_1.prsa = 7;
1135 /* have a fight. */
1136 f = oappli_(&ra, &c__0);
1137 L2300:
1138 if (obj == 61) {
1139 findex_1.thfenf = FALSE_;
1140 }
1141 /* turn off engrossed. */
1142 advs_1.aflag[0] = advs_1.aflag[0] & -32769;
1143 objcts_1.oflag2[obj - 1] = objcts_1.oflag2[obj - 1] & -321;
1144 if (objcts_1.ocapac[obj - 1] >= 0 || ra == 0) {
1145 goto L2400;
1146 }
1147 prsvec_1.prsa = 4;
1148 /* wake him up. */
1149 f = oappli_(&ra, &c__0);
1150 objcts_1.ocapac[obj - 1] = (i__2 = objcts_1.ocapac[obj - 1], abs(i__2)
1151 );
1152 L2400:
1153 ;
1154 }
1155 /* FIGHTD, PAGE 3 */
1156
1157 /* Now do actual counterblows. */
1158
1159 out = 0;
1160 /* assume hero ok. */
1161 L2600:
1162 i__1 = vill_1.vlnt;
1163 for (i__ = 1; i__ <= i__1; ++i__) {
1164 /* loop thru opps. */
1165 j = vill_1.vopps[i__ - 1];
1166 if (j == 0) {
1167 goto L2700;
1168 }
1169 /* slot empty? */
1170 prsvec_1.prscon = 0;
1171 /* stop cmd stream. */
1172 ra = objcts_1.oactio[j - 1];
1173 if (ra == 0) {
1174 goto L2650;
1175 }
1176 /* villain action? */
1177 prsvec_1.prsa = 7;
1178 /* see if */
1179 if (oappli_(&ra, &c__0)) {
1180 goto L2700;
1181 }
1182 /* special action. */
1183 L2650:
1184 res = blow_(&c__1, &j, &vill_1.vmelee[i__ - 1], &c_false, &out);
1185 /* strike blow. */
1186 if (res < 0) {
1187 return 0;
1188 }
1189 /* if hero dead, exit. */
1190 if (res == rout) {
1191 out = rnd_(&c__3) + 2;
1192 }
1193 /* if hero out, set flg. */
1194 L2700:
1195 ;
1196 }
1197 --out;
1198 /* decrement out count. */
1199 if (out > 0) {
1200 goto L2600;
1201 }
1202 /* if still out, go again */
1203 return 0;
1204
1205 } /* fightd_ */
1206
1207
1208
1209 /* BLOW- Strike blow */
1210
1211 /* Declarations */
1212
blow_(integer * h__,integer * v,integer * rmk,logical * hflg,integer * out)1213 integer blow_(integer *h__, integer *v, integer *rmk, logical *hflg, integer *
1214 out)
1215 {
1216 /* Initialized data */
1217
1218 static integer rmiss = 0;
1219 static integer rout = 1;
1220 static integer rkill = 2;
1221 static integer rstag = 5;
1222 static integer rlose = 6;
1223 static integer rhes = 7;
1224 static integer rsit = 8;
1225 static integer def1r[3] = { 1,2,3 };
1226 static integer def2r[4] = { 13,23,24,25 };
1227 static integer def3r[5] = { 35,36,46,47,57 };
1228 static integer rvectr[66] = { 0,0,0,0,5,5,1,1,2,2,2,2,0,0,0,0,0,5,5,3,3,1,
1229 0,0,0,5,5,3,3,3,1,2,2,2,0,0,0,0,0,5,5,3,3,4,4,0,0,0,5,5,3,3,3,4,4,
1230 4,0,5,5,3,3,3,3,4,4,4 };
1231 static integer rstate[45] = { 5000,3005,3008,4011,3015,3018,1021,0,0,5022,
1232 3027,3030,4033,3037,3040,1043,0,0,4044,2048,4050,4054,5058,4063,
1233 4067,3071,1074,4075,1079,4080,4084,4088,4092,4096,4100,1104,4105,
1234 2109,4111,4115,4119,4123,4127,3131,3134 };
1235
1236 /* System generated locals */
1237 integer ret_val, i__1, i__2;
1238
1239 /* Local variables */
1240 logical f;
1241 integer ra, dv, pblose;
1242 integer oa, def;
1243 integer od, dweap, i__;
1244 integer mi, j, tbl;
1245 integer att, res;
1246
1247
1248 /* Functions and data */
1249
1250
1251 /* BLOW, PAGE 2 */
1252
1253 ra = objcts_1.oactio[*v - 1];
1254 /* get villain action, */
1255 dv = objcts_1.odesc2[*v - 1];
1256 /* description. */
1257 ret_val = rmiss;
1258 /* D PRINT 10,H,V,RMK,HFLG,OUT */
1259 /* D10 FORMAT(' BLOW 10-- ',3I7,L7,I7) */
1260 /* assume no result. */
1261 if (! (*hflg)) {
1262 goto L1000;
1263 }
1264
1265 /* Hero is attacker, villain is defender. */
1266
1267 /* hero striking blow? */
1268 pblose = 10;
1269 /* bad lk prob. */
1270 objcts_1.oflag2[*v - 1] = objcts_1.oflag2[*v - 1] | 256;
1271 /* yes, villain gets mad. */
1272 if ((advs_1.aflag[*h__ - 1] & 32768) == 0) {
1273 goto L100;
1274 }
1275 /* hero stag? */
1276 rspeak_(&c__591);
1277 /* yes, cant fight. */
1278 advs_1.aflag[*h__ - 1] = advs_1.aflag[*h__ - 1] & -32769;
1279 return ret_val;
1280
1281 L100:
1282 /* Computing MAX */
1283 i__1 = 1, i__2 = fights_(h__, &c_true);
1284 att = max(i__1,i__2);
1285 /* get his strength. */
1286 oa = att;
1287 def = vilstr_(v);
1288 /* get vill strength. */
1289 od = def;
1290 dweap = 0;
1291 /* assume no weapon. */
1292 i__1 = objcts_1.olnt;
1293 for (i__ = 1; i__ <= i__1; ++i__) {
1294 /* search villain. */
1295 if (objcts_1.ocan[i__ - 1] == *v && (objcts_1.oflag2[i__ - 1] & 512)
1296 != 0) {
1297 dweap = i__;
1298 }
1299 /* L200: */
1300 }
1301 if (*v == advs_1.aobj[0]) {
1302 goto L300;
1303 }
1304 /* killing self? */
1305 if (def != 0) {
1306 goto L2000;
1307 }
1308 /* defender alive? */
1309 rspsub_(&c__592, &dv);
1310 /* villain dead. */
1311 return ret_val;
1312
1313 L300:
1314 jigsup_(&c__593);
1315 /* killing self. */
1316 return ret_val;
1317
1318 /* Villain is attacker, hero is defender. */
1319
1320 L1000:
1321 prsvec_1.prscon = 0;
1322 /* stop cmd stream. */
1323 pblose = 50;
1324 /* bad lk prob. */
1325 advs_1.aflag[*h__ - 1] = advs_1.aflag[*h__ - 1] & -32769;
1326 /* vill striking. */
1327 if ((objcts_1.oflag2[*v - 1] & 64) == 0) {
1328 goto L1200;
1329 }
1330 /* vill staggered? */
1331 objcts_1.oflag2[*v - 1] = objcts_1.oflag2[*v - 1] & -65;
1332 /* make him ok. */
1333 rspsub_(&c__594, &dv);
1334 /* describe. */
1335 return ret_val;
1336
1337 L1200:
1338 att = vilstr_(v);
1339 /* set up att, def. */
1340 oa = att;
1341 def = fights_(h__, &c_true);
1342 if (def <= 0) {
1343 return ret_val;
1344 }
1345 /* dont allow dead def. */
1346 od = fights_(h__, &c_false);
1347 dweap = (i__1 = fwim_(&c__0, &c__512, &c__0, &c__0, h__, &c_true), abs(
1348 i__1));
1349 /* BLOW, PAGE 3 */
1350
1351 /* Parties are now equipped. DEF cannot be zero. */
1352 /* ATT must be > 0. */
1353
1354 /* find a weapon. */
1355 L2000:
1356 /* D PRINT 2050,ATT,OA,DEF,OD,DWEAP */
1357 /* D2050 FORMAT(' BLOW 2050-- ',5I7) */
1358 if (def > 0) {
1359 goto L2100;
1360 }
1361 /* def alive? */
1362 res = rkill;
1363 if (*hflg) {
1364 rspsub_(&c__595, &dv);
1365 }
1366 /* deader. */
1367 goto L3000;
1368
1369 L2100:
1370 if ((i__1 = def - 2) < 0) {
1371 goto L2200;
1372 } else if (i__1 == 0) {
1373 goto L2300;
1374 } else {
1375 goto L2400;
1376 }
1377 /* def <2,=2,>2 */
1378 L2200:
1379 att = min(att,3);
1380 /* scale att. */
1381 tbl = def1r[att - 1];
1382 /* choose table. */
1383 goto L2500;
1384
1385 L2300:
1386 att = min(att,4);
1387 /* scale att. */
1388 tbl = def2r[att - 1];
1389 /* choose table. */
1390 goto L2500;
1391
1392 L2400:
1393 att -= def;
1394 /* scale att. */
1395 /* Computing MIN */
1396 i__1 = 2, i__2 = max(-2,att);
1397 att = min(i__1,i__2) + 3;
1398 tbl = def3r[att - 1];
1399
1400 L2500:
1401 res = rvectr[tbl + rnd_(&c__10) - 1];
1402 /* get result. */
1403 if (*out == 0) {
1404 goto L2600;
1405 }
1406 /* was he out? */
1407 if (res == rstag) {
1408 goto L2550;
1409 }
1410 /* yes, stag--> hes. */
1411 res = rsit;
1412 /* otherwise, sitting. */
1413 goto L2600;
1414 L2550:
1415 res = rhes;
1416 L2600:
1417 if (res == rstag && dweap != 0 && prob_(&c__25, &pblose)) {
1418 res = rlose;
1419 }
1420
1421 /* lose weapon. */
1422 mi = rstate[(*rmk - 1) * 9 + res];
1423 /* choose table entry. */
1424 if (mi == 0) {
1425 goto L3000;
1426 }
1427 i__1 = mi / 1000;
1428 i__ = mi % 1000 + rnd_(&i__1) + misc_1.mbase + 1;
1429 j = dv;
1430 if (! (*hflg) && dweap != 0) {
1431 j = objcts_1.odesc2[dweap - 1];
1432 }
1433 /* D PRINT 2650,RES,MI,I,J,MBASE */
1434 /* D2650 FORMAT(' BLOW 2650-- ',5I7) */
1435 rspsub_(&i__, &j);
1436 /* BLOW, PAGE 4 */
1437
1438 /* Now apply result. */
1439
1440 /* present result. */
1441 L3000:
1442 switch (res + 1) {
1443 case 1: goto L4000;
1444 case 2: goto L3100;
1445 case 3: goto L3200;
1446 case 4: goto L3300;
1447 case 5: goto L3400;
1448 case 6: goto L3500;
1449 case 7: goto L3600;
1450 case 8: goto L4000;
1451 case 9: goto L3200;
1452 }
1453 /* miss, out,kill,lght,svre,stag,lose, hes, sit */
1454
1455 L3100:
1456 if (*hflg) {
1457 def = -def;
1458 }
1459 /* unconscious. */
1460 goto L4000;
1461
1462 L3200:
1463 def = 0;
1464 /* killed or sitting duck */
1465 goto L4000;
1466
1467 L3300:
1468 /* Computing MAX */
1469 i__1 = 0, i__2 = def - 1;
1470 def = max(i__1,i__2);
1471 /* light wound. */
1472 goto L4000;
1473
1474 L3400:
1475 /* Computing MAX */
1476 i__1 = 0, i__2 = def - 2;
1477 def = max(i__1,i__2);
1478 /* serious wound. */
1479 goto L4000;
1480
1481 L3500:
1482 if (*hflg) {
1483 goto L3550;
1484 }
1485 /* staggered. */
1486 advs_1.aflag[*h__ - 1] = advs_1.aflag[*h__ - 1] | 32768;
1487 goto L4000;
1488
1489 L3550:
1490 objcts_1.oflag2[*v - 1] = objcts_1.oflag2[*v - 1] | 64;
1491 goto L4000;
1492
1493 L3600:
1494 newsta_(&dweap, &c__0, &play_1.here, &c__0, &c__0);
1495 /* lose weapon. */
1496 dweap = 0;
1497 if (*hflg) {
1498 goto L4000;
1499 }
1500 /* if hero, done. */
1501 dweap = (i__1 = fwim_(&c__0, &c__512, &c__0, &c__0, h__, &c_true), abs(
1502 i__1));
1503 /* get new. */
1504 if (dweap != 0) {
1505 rspsub_(&c__605, &objcts_1.odesc2[dweap - 1]);
1506 }
1507 /* BLOW, PAGE 5 */
1508
1509 L4000:
1510 ret_val = res;
1511 /* return result. */
1512 if (! (*hflg)) {
1513 goto L4500;
1514 }
1515 /* hero? */
1516 objcts_1.ocapac[*v - 1] = def;
1517 /* store new capacity. */
1518 if (def != 0) {
1519 goto L4100;
1520 }
1521 /* dead? */
1522 objcts_1.oflag2[*v - 1] = objcts_1.oflag2[*v - 1] & -257;
1523 /* yes, not fighting. */
1524 rspsub_(&c__572, &dv);
1525 /* he dies. */
1526 newsta_(v, &c__0, &c__0, &c__0, &c__0);
1527 /* make him disappear. */
1528 if (ra == 0) {
1529 return ret_val;
1530 }
1531 /* if nx to do, exit. */
1532 prsvec_1.prsa = 2;
1533 /* let him know. */
1534 f = oappli_(&ra, &c__0);
1535 return ret_val;
1536
1537 L4100:
1538 if (res != rout || ra == 0) {
1539 return ret_val;
1540 }
1541 prsvec_1.prsa = 5;
1542 /* let him be out. */
1543 f = oappli_(&ra, &c__0);
1544 return ret_val;
1545
1546 L4500:
1547 advs_1.astren[*h__ - 1] = -10000;
1548 /* assume dead. */
1549 if (def != 0) {
1550 advs_1.astren[*h__ - 1] = def - od;
1551 }
1552 if (def >= od) {
1553 goto L4600;
1554 }
1555 cevent_1.ctick[0] = 30;
1556 cevent_1.cflag[0] = TRUE_;
1557 L4600:
1558 if (fights_(h__, &c_true) > 0) {
1559 return ret_val;
1560 }
1561 advs_1.astren[*h__ - 1] = 1 - fights_(h__, &c_false);
1562 /* he's dead. */
1563 jigsup_(&c__596);
1564 ret_val = -1;
1565 return ret_val;
1566
1567 } /* blow_ */
1568
1569
1570
1571 /* SWORDD- Intermove sword demon */
1572
1573 /* Declarations */
1574
swordd_(void)1575 /* Subroutine */ int swordd_(void)
1576 {
1577 /* System generated locals */
1578 integer i__1;
1579
1580 /* Local variables */
1581 integer ng, i__;
1582
1583
1584 if (objcts_1.oadv[13] != 1) {
1585 goto L500;
1586 }
1587 /* holding sword? */
1588 ng = 2;
1589 /* assume vill close. */
1590 if (infest_(&play_1.here)) {
1591 goto L300;
1592 }
1593 /* vill here? */
1594 ng = 1;
1595 for (i__ = 1024; i__ <= 16384; i__ += 1024) {
1596 /* no, search rooms. */
1597 if (! findxt_(&i__, &play_1.here)) {
1598 goto L200;
1599 }
1600 /* room that way? */
1601 switch (curxt_1.xtype) {
1602 case 1: goto L50;
1603 case 2: goto L200;
1604 case 3: goto L50;
1605 case 4: goto L50;
1606 }
1607 /* see if room at all. */
1608 L50:
1609 if (infest_(&curxt_1.xroom1)) {
1610 goto L300;
1611 }
1612 /* check room. */
1613 L200:
1614 ;
1615 }
1616 ng = 0;
1617
1618 /* no glow. */
1619 L300:
1620 if (ng == hack_1.swdsta) {
1621 return 0;
1622 }
1623 /* any state change? */
1624 i__1 = ng + 495;
1625 rspeak_(&i__1);
1626 /* yes, tell new state. */
1627 hack_1.swdsta = ng;
1628 return 0;
1629
1630 L500:
1631 hack_1.swdact = FALSE_;
1632 /* dropped sword, */
1633 return 0;
1634 /* disable demon. */
1635 } /* swordd_ */
1636
1637
1638
1639 /* INFEST- Subroutine to test for infested room */
1640
1641 /* Declarations */
1642
infest_(integer * r__)1643 logical infest_(integer *r__)
1644 {
1645 /* System generated locals */
1646 logical ret_val;
1647
1648 /* Local variables */
1649
1650
1651 if (! findex_1.endgmf) {
1652 ret_val = objcts_1.oroom[57] == *r__ || objcts_1.oroom[18] == *r__ ||
1653 (objcts_1.oroom[60] == *r__ && hack_1.thfact);
1654 }
1655 if (findex_1.endgmf) {
1656 ret_val = *r__ == 164 || *r__ == 173 || *r__ == 174 || (*r__ == 177 &&
1657 findex_1.mloc == 164);
1658 }
1659 return ret_val;
1660 } /* infest_ */
1661
1662
1663
1664 /* AAPPLI- Applicables for adventurers */
1665
1666 /* Declarations */
1667
aappli_(integer * ri)1668 logical aappli_(integer *ri)
1669 {
1670 /* System generated locals */
1671 integer i__1;
1672 logical ret_val;
1673
1674 /* Local variables */
1675 logical f;
1676 integer i__, j;
1677
1678
1679 if (*ri == 0) {
1680 goto L10;
1681 }
1682 /* if zero, no app. */
1683 ret_val = TRUE_;
1684 /* assume wins. */
1685 switch (*ri) {
1686 case 1: goto L1000;
1687 case 2: goto L2000;
1688 case 3: goto L3000;
1689 }
1690 /* branch on adv. */
1691 bug_(&c__11, ri);
1692
1693 /* Common false return. */
1694
1695 L10:
1696 ret_val = FALSE_;
1697 return ret_val;
1698 /* AAPPLI, PAGE 2 */
1699
1700 /* A1-- Dead player. */
1701
1702 L1000:
1703 if (prsvec_1.prsa != 141 && prsvec_1.prsa != 138 && prsvec_1.prsa != 139
1704 && prsvec_1.prsa != 140 && prsvec_1.prsa != 107 && prsvec_1.prsa
1705 != 82) {
1706 goto L1050;
1707 }
1708 rspeak_(&c__949);
1709 /* dead can't attack. */
1710 return ret_val;
1711
1712 L1050:
1713 if (prsvec_1.prsa != 125 && prsvec_1.prsa != 126 && prsvec_1.prsa != 135
1714 && prsvec_1.prsa != 136 && prsvec_1.prsa != 102 && prsvec_1.prsa
1715 != 103 && prsvec_1.prsa != 116 && prsvec_1.prsa != 114 &&
1716 prsvec_1.prsa != 111 && prsvec_1.prsa != 97 && prsvec_1.prsa !=
1717 137 && prsvec_1.prsa != 113) {
1718 goto L1100;
1719 }
1720 rspeak_(&c__950);
1721 /* dead can't do simple a */
1722 return ret_val;
1723
1724 L1100:
1725 if (prsvec_1.prsa != 123) {
1726 goto L1150;
1727 }
1728 rspeak_(&c__951);
1729 /* dead don't need lights */
1730 return ret_val;
1731
1732 L1150:
1733 if (prsvec_1.prsa != 83) {
1734 goto L1200;
1735 }
1736 rspeak_(&c__952);
1737 /* dead can't score. */
1738 return ret_val;
1739
1740 L1200:
1741 if (prsvec_1.prsa != 143) {
1742 goto L1250;
1743 }
1744 rspeak_(&c__953);
1745 /* dead can't give orders */
1746 return ret_val;
1747
1748 L1250:
1749 if (prsvec_1.prsa != 132) {
1750 goto L1300;
1751 }
1752 rspeak_(&c__954);
1753 /* dead can't take. */
1754 return ret_val;
1755
1756 L1300:
1757 if (prsvec_1.prsa != 145 && prsvec_1.prsa != 148 && prsvec_1.prsa != 133)
1758 {
1759 goto L1350;
1760 }
1761 rspeak_(&c__955);
1762 /* dead have no possesion */
1763 return ret_val;
1764
1765 L1350:
1766 if (prsvec_1.prsa != 94) {
1767 goto L1400;
1768 }
1769 rspeak_(&c__956);
1770 /* dead as a doornail */
1771 return ret_val;
1772
1773 L1400:
1774 if (prsvec_1.prsa != 119) {
1775 goto L1500;
1776 }
1777 i__ = 957;
1778 /* assume nothing here */
1779 i__1 = objcts_1.olnt;
1780 for (j = 1; j <= i__1; ++j) {
1781 /* loop through objects */
1782 if (qhere_(&j, &play_1.here)) {
1783 i__ = 958;
1784 }
1785 /* found something */
1786 /* L1450: */
1787 }
1788 rspeak_(&i__);
1789 /* describe objects */
1790 if ((rooms_1.rflag[play_1.here - 1] & 16384) == 0) {
1791 rspeak_(&c__959);
1792 }
1793 goto L10;
1794
1795 /* don't handle */
1796 L1500:
1797 if (prsvec_1.prsa != 79) {
1798 goto L1600;
1799 }
1800 if (play_1.here == 97) {
1801 goto L1550;
1802 }
1803 /* praying in temple? */
1804 rspeak_(&c__960);
1805 /* prayers are not answer */
1806 return ret_val;
1807
1808 L1550:
1809 objcts_1.oflag1[14] = objcts_1.oflag1[14] | 32768;
1810 /* back to life, restore */
1811 advs_1.aactio[0] = 0;
1812 /* disable dead player */
1813 findex_1.deadf = FALSE_;
1814 /* clear dead flag */
1815 f = moveto_(&c__31, &play_1.winner);
1816 /* move to forest */
1817 rspeak_(&c__9);
1818 /* describe */
1819 return ret_val;
1820
1821 L1600:
1822 if (prsvec_1.prsa != 142) {
1823 goto L1700;
1824 }
1825 if (! findxt_(&prsvec_1.prso, &play_1.here)) {
1826 goto L10;
1827 }
1828 /* if no exits, don't han */
1829 if (curxt_1.xroom1 != 76) {
1830 goto L10;
1831 }
1832 /* if not bshaft, don't h */
1833 rspeak_(&c__962);
1834 /* can't go and score poi */
1835 return ret_val;
1836
1837 L1700:
1838 if (prsvec_1.prsa == 84 || prsvec_1.prsa == 150) {
1839 goto L10;
1840 }
1841 /* if quit or restore, don't handle (I added the restore. --Z) */
1842 rspeak_(&c__963);
1843 /* can't do it */
1844 return ret_val;
1845
1846 /* A2-- Robot. Process most commands given to robot. */
1847
1848 L2000:
1849 if (prsvec_1.prsa != 109 || prsvec_1.prso != 125) {
1850 goto L2200;
1851 }
1852 cevent_1.cflag[13] = FALSE_;
1853 /* robot raised cage. */
1854 play_1.winner = 1;
1855 /* reset for player. */
1856 f = moveto_(&c__140, &play_1.winner);
1857 /* move to new room. */
1858 newsta_(&c__124, &c__567, &c__140, &c__0, &c__0);
1859 /* install cage in room. */
1860 newsta_(&c__142, &c__0, &c__140, &c__0, &c__0);
1861 /* install robot in room. */
1862 advs_1.aroom[1] = 140;
1863 /* also move robot/adv. */
1864 findex_1.cagesf = TRUE_;
1865 /* cage solved. */
1866 objcts_1.oflag1[141] = objcts_1.oflag1[141] & -513;
1867 objcts_1.oflag1[125] = objcts_1.oflag1[125] | 8192;
1868 /* reset flags. */
1869 prsvec_1.prscon = 0;
1870 /* stop cmd stream. */
1871 return ret_val;
1872
1873 L2200:
1874 if (prsvec_1.prsa != 136 && prsvec_1.prsa != 135) {
1875 goto L2300;
1876 }
1877 rspeak_(&c__568);
1878 /* eat or drink, joke. */
1879 return ret_val;
1880
1881 L2300:
1882 if (prsvec_1.prsa != 100) {
1883 goto L2400;
1884 }
1885 /* read, */
1886 rspeak_(&c__569);
1887 /* joke. */
1888 return ret_val;
1889
1890 L2400:
1891 if (prsvec_1.prsa == 142 || prsvec_1.prsa == 132 || prsvec_1.prsa == 145
1892 || prsvec_1.prsa == 144 || prsvec_1.prsa == 112 || prsvec_1.prsa
1893 == 91 || prsvec_1.prsa == 116) {
1894 goto L2500;
1895 }
1896 /* test for robot verb. */
1897 rspeak_(&c__570);
1898 /* joke. */
1899 return ret_val;
1900
1901 L2500:
1902 rspeak_(&c__930);
1903 /* buzz, whirr, click! */
1904 goto L10;
1905 /* AAPPLI, PAGE 3 */
1906
1907 /* A3-- Master. Process most commands given to master. */
1908
1909 /* don't handle here. */
1910 L3000:
1911 if ((objcts_1.oflag2[172] & 8) != 0) {
1912 goto L3100;
1913 }
1914 rspeak_(&c__783);
1915 /* no master yet. */
1916 return ret_val;
1917
1918 L3100:
1919 if (prsvec_1.prsa != 142) {
1920 goto L3200;
1921 }
1922 /* walk? */
1923 i__ = 784;
1924 /* assume wont. */
1925 if ((play_1.here == 179 && (prsvec_1.prso == 1024 || prsvec_1.prso ==
1926 13312)) || (play_1.here == 182 && (prsvec_1.prso == 5120 ||
1927 prsvec_1.prso == 13312))) {
1928 i__ = 785;
1929 }
1930 /* if prison, cant. */
1931 rspeak_(&i__);
1932 return ret_val;
1933
1934 L3200:
1935 if (prsvec_1.prsa == 73 || prsvec_1.prsa == 85 || prsvec_1.prsa == 139 ||
1936 prsvec_1.prsa == 138 || prsvec_1.prsa == 141) {
1937 goto L10;
1938 }
1939 if (prsvec_1.prsa == 132 || prsvec_1.prsa == 145 || prsvec_1.prsa == 144
1940 || prsvec_1.prsa == 148 || prsvec_1.prsa == 112 || prsvec_1.prsa
1941 == 116 || prsvec_1.prsa == 129 || prsvec_1.prsa == 159 ||
1942 prsvec_1.prsa == 125 || prsvec_1.prsa == 126) {
1943 goto L3300;
1944 }
1945 /* master can, politely. */
1946 rspeak_(&c__786);
1947 /* master can't. */
1948 return ret_val;
1949
1950 L3300:
1951 rspeak_(&c__1057);
1952 /* polite reply. */
1953 goto L10;
1954
1955 } /* aappli_ */
1956
1957
1958
1959 /* THIEFD- Intermove thief demon */
1960
1961 /* Declarations */
1962
1963 /* This routine details on bit 6 of PRSFLG */
1964
thiefd_(void)1965 /* Subroutine */ int thiefd_(void)
1966 {
1967 /* System generated locals */
1968 integer i__1;
1969
1970 /* Local variables */
1971 logical dflag, once;
1972 logical waslit;
1973 integer rhere;
1974 integer i__;
1975 integer nr;
1976 integer j;
1977 integer rmk;
1978
1979 /* Functions AND DATA */
1980
1981 /* THIEFD, PAGE 2 */
1982
1983 dflag = (misc_1.prsflg & 64) != 0;
1984 /* set up detail flag. */
1985 once = FALSE_;
1986 /* init flag. */
1987 L1025:
1988 waslit = lit_(&play_1.here);
1989 /* record if lit. */
1990 rhere = objcts_1.oroom[60];
1991 /* visible pos. */
1992 if (rhere != 0) {
1993 hack_1.thfpos = rhere;
1994 }
1995
1996 if (hack_1.thfpos == play_1.here && ! findex_1.deadf) {
1997 goto L1100;
1998 }
1999 /* thief in live win */
2000 if (hack_1.thfpos != 103) {
2001 goto L1400;
2002 }
2003
2004 /* Thief is in treasure room, and winner is not. */
2005
2006 /* thief not in treas? */
2007 if (dflag) {
2008 glk_put_string("THIEFD-- IN TREASURE ROOM\n");
2009 }
2010 if (rhere == 0) {
2011 goto L1050;
2012 }
2013 /* visible? */
2014 newsta_(&c__61, &c__0, &c__0, &c__0, &c__0);
2015 /* yes, vanish. */
2016 rhere = 0;
2017 if (qhere_(&c__62, &c__103) || objcts_1.oadv[61] == -61) {
2018 newsta_(&c__62, &c__0, &c__0, &c__61, &c__0);
2019 }
2020 i__1 = objcts_1.olnt;
2021 for (i__ = 1; i__ <= i__1; ++i__) {
2022 /* loop through objects. */
2023 if (qhere_(&i__, &hack_1.thfpos)) {
2024 objcts_1.oflag1[i__ - 1] = objcts_1.oflag1[i__ - 1] | 32768;
2025 }
2026 /* make objects visible */
2027 /* L1040: */
2028 }
2029 L1050:
2030 i__ = robadv_(&c_n61, &hack_1.thfpos, &c__0, &c__0);
2031 /* drop valuables. */
2032 if (qhere_(&c__154, &hack_1.thfpos)) {
2033 objcts_1.oflag2[153] = objcts_1.oflag2[153] | 8;
2034 }
2035 goto L1700;
2036 /* THIEFD, PAGE 3 */
2037
2038 /* Thief and (live) winner in same room. */
2039
2040 L1100:
2041 if (hack_1.thfpos == 103) {
2042 goto L1700;
2043 }
2044 /* if treas room, nothing */
2045 if ((rooms_1.rflag[hack_1.thfpos - 1] & 16384) != 0) {
2046 goto L1400;
2047 }
2048 /* not if light. */
2049 if (dflag) {
2050 glk_put_string("THIEFD-- IN ADV ROOM\n");
2051 }
2052 if (hack_1.thfflg) {
2053 goto L1300;
2054 }
2055 /* thief announced? */
2056 if (rhere != 0 || prob_(&c__70, &c__70)) {
2057 goto L1150;
2058 }
2059 /* if invis and 30%. */
2060 if (objcts_1.ocan[61] != 61) {
2061 goto L1700;
2062 }
2063 /* abort if no stilletto. */
2064 newsta_(&c__61, &c__583, &hack_1.thfpos, &c__0, &c__0);
2065 /* insert thief into room */
2066 hack_1.thfflg = TRUE_;
2067 /* thief is announced. */
2068 return 0;
2069
2070 L1150:
2071 if (rhere == 0 || (objcts_1.oflag2[60] & 256) == 0) {
2072 goto L1200;
2073 }
2074 /* if visible and fight. */
2075 if (winnin_(&c__61, &c__1)) {
2076 goto L1175;
2077 }
2078 /* winning? */
2079 newsta_(&c__61, &c__584, &c__0, &c__0, &c__0);
2080 /* no, vanish thief. */
2081 objcts_1.oflag2[60] = objcts_1.oflag2[60] & -257;
2082 if (qhere_(&c__62, &hack_1.thfpos) || objcts_1.oadv[61] == -61) {
2083 newsta_(&c__62, &c__0, &c__0, &c__61, &c__0);
2084 }
2085 return 0;
2086
2087 L1175:
2088 if (prob_(&c__90, &c__90)) {
2089 goto L1700;
2090 }
2091
2092 /* 90% chance to stay. */
2093 L1200:
2094 if (rhere == 0 || prob_(&c__70, &c__70)) {
2095 goto L1250;
2096 }
2097 /* if visible and 30% */
2098 newsta_(&c__61, &c__585, &c__0, &c__0, &c__0);
2099 /* vanish thief. */
2100 if (qhere_(&c__62, &hack_1.thfpos) || objcts_1.oadv[61] == -61) {
2101 newsta_(&c__62, &c__0, &c__0, &c__61, &c__0);
2102 }
2103 return 0;
2104
2105 L1300:
2106 if (rhere == 0) {
2107 goto L1700;
2108 }
2109 /* announced. visible? */
2110 L1250:
2111 if (prob_(&c__70, &c__70)) {
2112 return 0;
2113 }
2114 /* 70% chance to do nothi */
2115 hack_1.thfflg = TRUE_;
2116 nr = robrm_(&hack_1.thfpos, &c__100, &c__0, &c__0, &c_n61) + robadv_(&
2117 c__1, &c__0, &c__0, &c_n61);
2118 i__ = 586;
2119 /* robbed em. */
2120 if (rhere != 0) {
2121 i__ = 588;
2122 }
2123 /* was he visible? */
2124 i__1 = i__ + min(1,nr);
2125 newsta_(&c__61, &i__1, &c__0, &c__0, &c__0);
2126 /* vanish thief, give res */
2127 if (qhere_(&c__62, &hack_1.thfpos) || objcts_1.oadv[61] == -61) {
2128 newsta_(&c__62, &c__0, &c__0, &c__61, &c__0);
2129 }
2130 /* reclaim stilletto. */
2131 if (waslit && ! lit_(&play_1.here) && play_1.here == advs_1.aroom[0]) {
2132 rspeak_(&c__915);
2133 }
2134 /* leave player in dark? */
2135 rhere = 0;
2136 goto L1700;
2137 /* THIEFD, PAGE 4 */
2138
2139 /* Not in adventurers room, or adventurer dead, or room lit. */
2140
2141 /* onward. */
2142 L1400:
2143 newsta_(&c__61, &c__0, &c__0, &c__0, &c__0);
2144 /* vanish. */
2145 rhere = 0;
2146 if (dflag) {
2147 weeprintf("THIEFD-- IN ROOM %d\n", hack_1.thfpos);
2148 }
2149 if (qhere_(&c__62, &hack_1.thfpos) || objcts_1.oadv[61] == -61) {
2150 newsta_(&c__62, &c__0, &c__0, &c__61, &c__0);
2151 }
2152 if ((rooms_1.rflag[hack_1.thfpos - 1] & 32768) == 0) {
2153 goto L1700;
2154 }
2155 /* cant rob unseen. */
2156 rmk = 1045;
2157 /* first object to vanish */
2158 i__ = robrm_(&hack_1.thfpos, &c__75, &c__0, &c__0, &c_n5555);
2159 /* rob room 75% to hypers */
2160 i__1 = objcts_1.olnt;
2161 for (i__ = 1; i__ <= i__1; ++i__) {
2162 /* loop through objects. */
2163 if (objcts_1.oadv[i__ - 1] != -5555) {
2164 goto L1410;
2165 }
2166 /* in hyperspace? */
2167 newsta_(&i__, &c__0, &c__0, &c__0, &c_n61);
2168 /* move to thief. */
2169 if (hack_1.thfpos == play_1.here && ! findex_1.deadf) {
2170 rspsub_(&rmk, &objcts_1.odesc2[i__ - 1]);
2171 }
2172 /* thief's remarks. */
2173 rmk = 1083;
2174 /* for next object. */
2175 L1410:
2176 ;
2177 }
2178
2179 if (hack_1.thfpos < 11 || hack_1.thfpos > 30 || play_1.here < 11 ||
2180 play_1.here > 30) {
2181 goto L1500;
2182 }
2183 i__1 = objcts_1.olnt;
2184 for (i__ = 1; i__ <= i__1; ++i__) {
2185 /* both in maze. */
2186 if (! qhere_(&i__, &hack_1.thfpos) || prob_(&c__60, &c__60) || i__ ==
2187 11 || (objcts_1.oflag1[i__ - 1] & 40960) != 40960) {
2188 goto L1450;
2189 }
2190 if (! findex_1.deadf) {
2191 rspsub_(&c__590, &objcts_1.odesc2[i__ - 1]);
2192 }
2193 /* thief's remarks. */
2194 if (prob_(&c__40, &c__20)) {
2195 goto L1700;
2196 }
2197 newsta_(&i__, &c__0, &c__0, &c__0, &c_n61);
2198 /* steal it. */
2199 objcts_1.oflag2[i__ - 1] = objcts_1.oflag2[i__ - 1] | 4;
2200 goto L1700;
2201 L1450:
2202 ;
2203 }
2204 goto L1700;
2205
2206 L1500:
2207 i__1 = objcts_1.olnt;
2208 for (i__ = 1; i__ <= i__1; ++i__) {
2209 /* not in maze. */
2210 if (! qhere_(&i__, &hack_1.thfpos) || objcts_1.otval[i__ - 1] != 0 ||
2211 prob_(&c__80, &c__60) || i__ == 11 || (objcts_1.oflag1[i__ -
2212 1] & 40960) != 40960) {
2213 goto L1550;
2214 }
2215 newsta_(&i__, &c__0, &c__0, &c__0, &c_n61);
2216 objcts_1.oflag2[i__ - 1] = objcts_1.oflag2[i__ - 1] | 4;
2217 if (hack_1.thfpos == play_1.here && ! findex_1.deadf) {
2218 rspsub_(&rmk, &objcts_1.odesc2[i__ - 1]);
2219 }
2220 /* vanishes before you. */
2221 goto L1700;
2222 L1550:
2223 ;
2224 }
2225 /* THIEFD, PAGE 5 */
2226
2227 /* Now move to new room. */
2228
2229 L1700:
2230 if (objcts_1.oadv[11] != -61) {
2231 goto L1725;
2232 }
2233 /* did he steal rope? */
2234 findex_1.domef = FALSE_;
2235 findex_1.ttie = 0;
2236 L1725:
2237 if (once) {
2238 goto L1800;
2239 }
2240 once = ! once;
2241 L1750:
2242 --hack_1.thfpos;
2243 /* next room. */
2244 if (hack_1.thfpos <= 0) {
2245 hack_1.thfpos = rooms_1.rlnt;
2246 }
2247 if ((rooms_1.rflag[hack_1.thfpos - 1] & 9232) != 8192) {
2248 goto L1750;
2249 }
2250 /* must be land, profane. */
2251 hack_1.thfflg = FALSE_;
2252 /* not announced. */
2253 goto L1025;
2254
2255 /* All done. */
2256
2257 /* once more. */
2258 L1800:
2259 if (hack_1.thfpos == 103) {
2260 return 0;
2261 }
2262 /* in treasure room? */
2263 j = 1055;
2264 /* no, drop junky stuff. */
2265 if (hack_1.thfpos != play_1.here) {
2266 j = 0;
2267 }
2268 i__1 = objcts_1.olnt;
2269 for (i__ = 1; i__ <= i__1; ++i__) {
2270 if (objcts_1.oadv[i__ - 1] != -61 || prob_(&c__70, &c__30) ||
2271 objcts_1.otval[i__ - 1] > 0) {
2272 goto L1850;
2273 }
2274 newsta_(&i__, &j, &hack_1.thfpos, &c__0, &c__0);
2275 j = 0;
2276 L1850:
2277 ;
2278 }
2279 return 0;
2280
2281 } /* thiefd_ */
2282
2283
2284
2285