1 /*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * The game adventure was originally written in Fortran by Will Crowther
6 * and Don Woods. It was later translated to C and enhanced by Jim
7 * Gillogly. This code is derived from software contributed to Berkeley
8 * by Jim Gillogly at The Rand Corporation.
9 *
10 * %sccs.include.redist.c%
11 */
12
13 #ifndef lint
14 static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 05/31/93";
15 #endif /* not lint */
16
17 /* Re-coding of advent in C: subroutines from main */
18
19 # include "hdr.h"
20
21 /* Statement functions */
toting(objj)22 toting(objj)
23 int objj;
24 { if (place[objj] == -1) return(TRUE);
25 else return(FALSE);
26 }
27
here(objj)28 here(objj)
29 int objj;
30 { if (place[objj]==loc || toting(objj)) return(TRUE);
31 else return(FALSE);
32 }
33
at(objj)34 at(objj)
35 int objj;
36 { if (place[objj]==loc || fixed[objj]==loc) return(TRUE);
37 else return (FALSE);
38 }
39
liq2(pbotl)40 liq2(pbotl)
41 int pbotl;
42 { return((1-pbotl)*water+(pbotl/2)*(water+oil));
43 }
44
liq(foo)45 liq(foo)
46 { register int i;
47 i=prop[bottle];
48 if (i>-1-i) return(liq2(i));
49 else return(liq2(-1-i));
50 }
51
liqloc(locc)52 liqloc(locc) /* may want to clean this one up a bit */
53 int locc;
54 { register int i,j,l;
55 i=cond[locc]/2;
56 j=((i*2)%8)-5;
57 l=cond[locc]/4;
58 l=l%2;
59 return(liq2(j*l+1));
60 }
61
bitset(l,n)62 bitset(l,n)
63 int l,n;
64 { if (cond[l] & setbit[n]) return(TRUE);
65 return(FALSE);
66 }
67
forced(locc)68 forced(locc)
69 int locc;
70 { if (cond[locc]==2) return(TRUE);
71 return(FALSE);
72 }
73
dark(foo)74 dark(foo)
75 { if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp)))
76 return(TRUE);
77 return(FALSE);
78 }
79
pct(n)80 pct(n)
81 int n;
82 { if (ran(100)<n) return(TRUE);
83 return(FALSE);
84 }
85
86
fdwarf()87 fdwarf() /* 71 */
88 { register int i,j;
89 register struct travlist *kk;
90
91 if (newloc!=loc&&!forced(loc)&&!bitset(loc,3))
92 { for (i=1; i<=5; i++)
93 { if (odloc[i]!=newloc||!dseen[i]) continue;
94 newloc=loc;
95 rspeak(2);
96 break;
97 }
98 }
99 loc=newloc; /* 74 */
100 if (loc==0||forced(loc)||bitset(newloc,3)) return(2000);
101 if (dflag==0)
102 { if (loc>=15) dflag=1;
103 return(2000);
104 }
105 if (dflag==1) /* 6000 */
106 { if (loc<15||pct(95)) return(2000);
107 dflag=2;
108 for (i=1; i<=2; i++)
109 { j=1+ran(5);
110 if (pct(50)&&saved== -1) dloc[j]=0; /* 6001 */
111 }
112 for (i=1; i<=5; i++)
113 { if (dloc[i]==loc) dloc[i]=daltlc;
114 odloc[i]=dloc[i]; /* 6002 */
115 }
116 rspeak(3);
117 drop(axe,loc);
118 return(2000);
119 }
120 dtotal=attack=stick=0; /* 6010 */
121 for (i=1; i<=6; i++) /* loop to 6030 */
122 { if (dloc[i]==0) continue;
123 j=1;
124 for (kk=travel[dloc[i]]; kk!=0; kk=kk->next)
125 { newloc=kk->tloc;
126 if (newloc>300||newloc<15||newloc==odloc[i]
127 ||(j>1&&newloc==tk[j-1])||j>=20
128 ||newloc==dloc[i]||forced(newloc)
129 ||(i==6&&bitset(newloc,3))
130 ||kk->conditions==100) continue;
131 tk[j++]=newloc;
132 }
133 tk[j]=odloc[i]; /* 6016 */
134 if (j>=2) j--;
135 j=1+ran(j);
136 odloc[i]=dloc[i];
137 dloc[i]=tk[j];
138 dseen[i]=(dseen[i]&&loc>=15)||(dloc[i]==loc||odloc[i]==loc);
139 if (!dseen[i]) continue; /* i.e. goto 6030 */
140 dloc[i]=loc;
141 if (i==6) /* pirate's spotted him */
142 { if (loc==chloc||prop[chest]>=0) continue;
143 k=0;
144 for (j=50; j<=maxtrs; j++) /* loop to 6020 */
145 { if (j==pyram&&(loc==plac[pyram]
146 || loc==plac[emrald])) goto l6020;
147 if (toting(j)) goto l6022;
148 l6020: if (here(j)) k=1;
149 } /* 6020 */
150 if (tally==tally2+1 && k==0 && place[chest]==0
151 &&here(lamp) && prop[lamp]==1) goto l6025;
152 if (odloc[6]!=dloc[6]&&pct(20))
153 rspeak(127);
154 continue; /* to 6030 */
155 l6022: rspeak(128);
156 if (place[messag]==0) move(chest,chloc);
157 move(messag,chloc2);
158 for (j=50; j<=maxtrs; j++) /* loop to 6023 */
159 { if (j==pyram && (loc==plac[pyram]
160 || loc==plac[emrald])) continue;
161 if (at(j)&&fixed[j]==0) carry(j,loc);
162 if (toting(j)) drop(j,chloc);
163 }
164 l6024: dloc[6]=odloc[6]=chloc;
165 dseen[6]=FALSE;
166 continue;
167 l6025: rspeak(186);
168 move(chest,chloc);
169 move(messag,chloc2);
170 goto l6024;
171 }
172 dtotal++; /* 6027 */
173 if (odloc[i]!=dloc[i]) continue;
174 attack++;
175 if (knfloc>=0) knfloc=loc;
176 if (ran(1000)<95*(dflag-2)) stick++;
177 } /* 6030 */
178 if (dtotal==0) return(2000);
179 if (dtotal!=1)
180 { printf("There are %d threatening little dwarves ",dtotal);
181 printf("in the room with you.\n");
182 }
183 else rspeak(4);
184 if (attack==0) return(2000);
185 if (dflag==2) dflag=3;
186 if (saved!= -1) dflag=20;
187 if (attack!=1)
188 { printf("%d of them throw knives at you!\n",attack);
189 k=6;
190 l82: if (stick<=1) /* 82 */
191 { rspeak(k+stick);
192 if (stick==0) return(2000);
193 }
194 else
195 printf("%d of them get you!\n",stick); /* 83 */
196 oldlc2=loc;
197 return(99);
198 }
199 rspeak(5);
200 k=52;
201 goto l82;
202 }
203
204
march()205 march() /* label 8 */
206 { register int ll1,ll2;
207
208 if ((tkk=travel[newloc=loc])==0) bug(26);
209 if (k==null) return(2);
210 if (k==cave) /* 40 */
211 { if (loc<8) rspeak(57);
212 if (loc>=8) rspeak(58);
213 return(2);
214 }
215 if (k==look) /* 30 */
216 { if (detail++<3) rspeak(15);
217 wzdark=FALSE;
218 abb[loc]=0;
219 return(2);
220 }
221 if (k==back) /* 20 */
222 { switch(mback())
223 { case 2: return(2);
224 case 9: goto l9;
225 default: bug(100);
226 }
227 }
228 oldlc2=oldloc;
229 oldloc=loc;
230 l9:
231 for (; tkk!=0; tkk=tkk->next)
232 if (tkk->tverb==1 || tkk->tverb==k) break;
233 if (tkk==0)
234 { badmove();
235 return(2);
236 }
237 l11: ll1=tkk->conditions; /* 11 */
238 ll2=tkk->tloc;
239 newloc=ll1; /* newloc=conditions */
240 k=newloc%100; /* k used for prob */
241 if (newloc<=300)
242 { if (newloc<=100) /* 13 */
243 { if (newloc!=0&&!pct(newloc)) goto l12; /* 14 */
244 l16: newloc=ll2; /* newloc=location */
245 if (newloc<=300) return(2);
246 if (newloc<=500)
247 switch(specials())/* to 30000 */
248 { case 2: return(2);
249 case 12: goto l12;
250 case 99: return(99);
251 default: bug(101);
252 }
253 rspeak(newloc-500);
254 newloc=loc;
255 return(2);
256 }
257 if (toting(k)||(newloc>200&&at(k))) goto l16;
258 goto l12;
259 }
260 if (prop[k]!=(newloc/100)-3) goto l16; /* newloc still conditions*/
261 l12: /* alternative to probability move */
262 for (; tkk!=0; tkk=tkk->next)
263 if (tkk->tloc!=ll2 || tkk->conditions!=ll1) break;
264 if (tkk==0) bug(25);
265 goto l11;
266 }
267
268
269
mback()270 mback() /* 20 */
271 { register struct travlist *tk2,*j;
272 register int ll;
273 if (forced(k=oldloc)) k=oldlc2; /* k=location */
274 oldlc2=oldloc;
275 oldloc=loc;
276 tk2=0;
277 if (k==loc)
278 { rspeak(91);
279 return(2);
280 }
281 for (; tkk!=0; tkk=tkk->next) /* 21 */
282 { ll=tkk->tloc;
283 if (ll==k)
284 { k=tkk->tverb; /* k back to verb */
285 tkk=travel[loc];
286 return(9);
287 }
288 if (ll<=300)
289 { j=travel[loc];
290 if (forced(ll) && k==j->tloc) tk2=tkk;
291 }
292 }
293 tkk=tk2; /* 23 */
294 if (tkk!=0)
295 { k=tkk->tverb;
296 tkk=travel[loc];
297 return(9);
298 }
299 rspeak(140);
300 return(2);
301 }
302
303
specials()304 specials() /* 30000 */
305 { switch(newloc -= 300)
306 { case 1: /* 30100 */
307 newloc = 99+100-loc;
308 if (holdng==0||(holdng==1&&toting(emrald))) return(2);
309 newloc=loc;
310 rspeak(117);
311 return(2);
312 case 2: /* 30200 */
313 drop(emrald,loc);
314 return(12);
315 case 3: /* to 30300 */
316 return(trbridge());
317 default: bug(29);
318 }
319 }
320
321
trbridge()322 trbridge() /* 30300 */
323 { if (prop[troll]==1)
324 { pspeak(troll,1);
325 prop[troll]=0;
326 move(troll2,0);
327 move(troll2+100,0);
328 move(troll,plac[troll]);
329 move(troll+100,fixd[troll]);
330 juggle(chasm);
331 newloc=loc;
332 return(2);
333 }
334 newloc=plac[troll]+fixd[troll]-loc; /* 30310 */
335 if (prop[troll]==0) prop[troll]=1;
336 if (!toting(bear)) return(2);
337 rspeak(162);
338 prop[chasm]=1;
339 prop[troll]=2;
340 drop(bear,newloc);
341 fixed[bear] = -1;
342 prop[bear]=3;
343 if (prop[spices]<0) tally2++;
344 oldlc2=newloc;
345 return(99);
346 }
347
348
badmove()349 badmove() /* 20 */
350 { spk=12;
351 if (k>=43 && k<=50) spk=9;
352 if (k==29||k==30) spk=9;
353 if (k==7||k==36||k==37) spk=10;
354 if (k==11||k==19) spk=11;
355 if (verb==find||verb==invent) spk=59;
356 if (k==62||k==65) spk=42;
357 if (k==17) spk=80;
358 rspeak(spk);
359 return(2);
360 }
361
bug(n)362 bug(n)
363 int n;
364 { printf("Please tell jim@rand.org that fatal bug %d happened.\n",n);
365 exit(0);
366 }
367
368
checkhints()369 checkhints() /* 2600 &c */
370 { register int hint;
371 for (hint=4; hint<=hntmax; hint++)
372 { if (hinted[hint]) continue;
373 if (!bitset(loc,hint)) hintlc[hint]= -1;
374 hintlc[hint]++;
375 if (hintlc[hint]<hints[hint][1]) continue;
376 switch(hint)
377 { case 4: /* 40400 */
378 if (prop[grate]==0&&!here(keys)) goto l40010;
379 goto l40020;
380 case 5: /* 40500 */
381 if (here(bird)&&toting(rod)&&obj==bird) goto l40010;
382 continue; /* i.e. goto l40030 */
383 case 6: /* 40600 */
384 if (here(snake)&&!here(bird)) goto l40010;
385 goto l40020;
386 case 7: /* 40700 */
387 if (atloc[loc]==0&&atloc[oldloc]==0
388 && atloc[oldlc2]==0&&holdng>1) goto l40010;
389 goto l40020;
390 case 8: /* 40800 */
391 if (prop[emrald]!= -1&&prop[pyram]== -1) goto l40010;
392 goto l40020;
393 case 9:
394 goto l40010; /* 40900 */
395 default: bug(27);
396 }
397 l40010: hintlc[hint]=0;
398 if (!yes(hints[hint][3],0,54)) continue;
399 printf("I am prepared to give you a hint, but it will ");
400 printf("cost you %d points.\n",hints[hint][2]);
401 hinted[hint]=yes(175,hints[hint][4],54);
402 l40020: hintlc[hint]=0;
403 }
404 }
405
406
trsay()407 trsay() /* 9030 */
408 { register int i;
409 if (*wd2!=0) copystr(wd2,wd1);
410 i=vocab(wd1,-1);
411 if (i==62||i==65||i==71||i==2025)
412 { *wd2=0;
413 obj=0;
414 return(2630);
415 }
416 printf("\nOkay, \"%s\".\n",wd2);
417 return(2012);
418 }
419
420
trtake()421 trtake() /* 9010 */
422 { register int i;
423 if (toting(obj)) return(2011); /* 9010 */
424 spk=25;
425 if (obj==plant&&prop[plant]<=0) spk=115;
426 if (obj==bear&&prop[bear]==1) spk=169;
427 if (obj==chain&&prop[bear]!=0) spk=170;
428 if (fixed[obj]!=0) return(2011);
429 if (obj==water||obj==oil)
430 { if (here(bottle)&&liq(0)==obj)
431 { obj=bottle;
432 goto l9017;
433 }
434 obj=bottle;
435 if (toting(bottle)&&prop[bottle]==1)
436 return(9220);
437 if (prop[bottle]!=1) spk=105;
438 if (!toting(bottle)) spk=104;
439 return(2011);
440 }
441 l9017: if (holdng>=7)
442 { rspeak(92);
443 return(2012);
444 }
445 if (obj==bird)
446 { if (prop[bird]!=0) goto l9014;
447 if (toting(rod))
448 { rspeak(26);
449 return(2012);
450 }
451 if (!toting(cage)) /* 9013 */
452 { rspeak(27);
453 return(2012);
454 }
455 prop[bird]=1; /* 9015 */
456 }
457 l9014: if ((obj==bird||obj==cage)&&prop[bird]!=0)
458 carry(bird+cage-obj,loc);
459 carry(obj,loc);
460 k=liq(0);
461 if (obj==bottle && k!=0) place[k] = -1;
462 return(2009);
463 }
464
465
dropper()466 dropper() /* 9021 */
467 { k=liq(0);
468 if (k==obj) obj=bottle;
469 if (obj==bottle&&k!=0) place[k]=0;
470 if (obj==cage&&prop[bird]!=0) drop(bird,loc);
471 if (obj==bird) prop[bird]=0;
472 drop(obj,loc);
473 return(2012);
474 }
475
trdrop()476 trdrop() /* 9020 */
477 {
478 if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
479 if (!toting(obj)) return(2011);
480 if (obj==bird&&here(snake))
481 { rspeak(30);
482 if (closed) return(19000);
483 dstroy(snake);
484 prop[snake]=1;
485 return(dropper());
486 }
487 if (obj==coins&&here(vend)) /* 9024 */
488 { dstroy(coins);
489 drop(batter,loc);
490 pspeak(batter,0);
491 return(2012);
492 }
493 if (obj==bird&&at(dragon)&&prop[dragon]==0) /* 9025 */
494 { rspeak(154);
495 dstroy(bird);
496 prop[bird]=0;
497 if (place[snake]==plac[snake]) tally2--;
498 return(2012);
499 }
500 if (obj==bear&&at(troll)) /* 9026 */
501 { rspeak(163);
502 move(troll,0);
503 move(troll+100,0);
504 move(troll2,plac[troll]);
505 move(troll2+100,fixd[troll]);
506 juggle(chasm);
507 prop[troll]=2;
508 return(dropper());
509 }
510 if (obj!=vase||loc==plac[pillow]) /* 9027 */
511 { rspeak(54);
512 return(dropper());
513 }
514 prop[vase]=2; /* 9028 */
515 if (at(pillow)) prop[vase]=0;
516 pspeak(vase,prop[vase]+1);
517 if (prop[vase]!=0) fixed[vase] = -1;
518 return(dropper());
519 }
520
521
tropen()522 tropen() /* 9040 */
523 { if (obj==clam||obj==oyster)
524 { k=0; /* 9046 */
525 if (obj==oyster) k=1;
526 spk=124+k;
527 if (toting(obj)) spk=120+k;
528 if (!toting(tridnt)) spk=122+k;
529 if (verb==lock) spk=61;
530 if (spk!=124) return(2011);
531 dstroy(clam);
532 drop(oyster,loc);
533 drop(pearl,105);
534 return(2011);
535 }
536 if (obj==door) spk=111;
537 if (obj==door&&prop[door]==1) spk=54;
538 if (obj==cage) spk=32;
539 if (obj==keys) spk=55;
540 if (obj==grate||obj==chain) spk=31;
541 if (spk!=31||!here(keys)) return(2011);
542 if (obj==chain)
543 { if (verb==lock)
544 { spk=172; /* 9049: lock */
545 if (prop[chain]!=0) spk=34;
546 if (loc!=plac[chain]) spk=173;
547 if (spk!=172) return(2011);
548 prop[chain]=2;
549 if (toting(chain)) drop(chain,loc);
550 fixed[chain]= -1;
551 return(2011);
552 }
553 spk=171;
554 if (prop[bear]==0) spk=41;
555 if (prop[chain]==0) spk=37;
556 if (spk!=171) return(2011);
557 prop[chain]=0;
558 fixed[chain]=0;
559 if (prop[bear]!=3) prop[bear]=2;
560 fixed[bear]=2-prop[bear];
561 return(2011);
562 }
563 if (closng)
564 { k=130;
565 if (!panic) clock2=15;
566 panic=TRUE;
567 return(2010);
568 }
569 k=34+prop[grate]; /* 9043 */
570 prop[grate]=1;
571 if (verb==lock) prop[grate]=0;
572 k=k+2*prop[grate];
573 return(2010);
574 }
575
576
trkill()577 trkill() /* 9120 */
578 { register int i;
579 for (i=1; i<=5; i++)
580 if (dloc[i]==loc&&dflag>=2) break;
581 if (i==6) i=0;
582 if (obj==0) /* 9122 */
583 { if (i!=0) obj=dwarf;
584 if (here(snake)) obj=obj*100+snake;
585 if (at(dragon)&&prop[dragon]==0) obj=obj*100+dragon;
586 if (at(troll)) obj=obj*100+troll;
587 if (here(bear)&&prop[bear]==0) obj=obj*100+bear;
588 if (obj>100) return(8000);
589 if (obj==0)
590 { if (here(bird)&&verb!=throw) obj=bird;
591 if (here(clam)||here(oyster)) obj=100*obj+clam;
592 if (obj>100) return(8000);
593 }
594 }
595 if (obj==bird) /* 9124 */
596 { spk=137;
597 if (closed) return(2011);
598 dstroy(bird);
599 prop[bird]=0;
600 if (place[snake]==plac[snake]) tally2++;
601 spk=45;
602 }
603 if (obj==0) spk=44; /* 9125 */
604 if (obj==clam||obj==oyster) spk=150;
605 if (obj==snake) spk=46;
606 if (obj==dwarf) spk=49;
607 if (obj==dwarf&&closed) return(19000);
608 if (obj==dragon) spk=147;
609 if (obj==troll) spk=157;
610 if (obj==bear) spk=165+(prop[bear]+1)/2;
611 if (obj!=dragon||prop[dragon]!=0) return(2011);
612 rspeak(49);
613 verb=0;
614 obj=0;
615 getin(&wd1,&wd2);
616 if (!weq(wd1,"y")&&!weq(wd1,"yes")) return(2608);
617 pspeak(dragon,1);
618 prop[dragon]=2;
619 prop[rug]=0;
620 k=(plac[dragon]+fixd[dragon])/2;
621 move(dragon+100,-1);
622 move(rug+100,0);
623 move(dragon,k);
624 move(rug,k);
625 for (obj=1; obj<=100; obj++)
626 if (place[obj]==plac[dragon]||place[obj]==fixd[dragon])
627 move(obj,k);
628 loc=k;
629 k=null;
630 return(8);
631 }
632
633
trtoss()634 trtoss() /* 9170: throw */
635 { register int i;
636 if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
637 if (!toting(obj)) return(2011);
638 if (obj>=50&&obj<=maxtrs&&at(troll))
639 { spk=159; /* 9178 */
640 drop(obj,0);
641 move(troll,0);
642 move(troll+100,0);
643 drop(troll2,plac[troll]);
644 drop(troll2+100,fixd[troll]);
645 juggle(chasm);
646 return(2011);
647 }
648 if (obj==food&&here(bear))
649 { obj=bear; /* 9177 */
650 return(9210);
651 }
652 if (obj!=axe) return(9020);
653 for (i=1; i<=5; i++)
654 { if (dloc[i]==loc)
655 { spk=48; /* 9172 */
656 if (ran(3)==0||saved!= -1)
657 l9175: { rspeak(spk);
658 drop(axe,loc);
659 k=null;
660 return(8);
661 }
662 dseen[i]=FALSE;
663 dloc[i]=0;
664 spk=47;
665 dkill++;
666 if (dkill==1) spk=149;
667 goto l9175;
668 }
669 }
670 spk=152;
671 if (at(dragon)&&prop[dragon]==0)
672 goto l9175;
673 spk=158;
674 if (at(troll)) goto l9175;
675 if (here(bear)&&prop[bear]==0)
676 { spk=164;
677 drop(axe,loc);
678 fixed[axe]= -1;
679 prop[axe]=1;
680 juggle(bear);
681 return(2011);
682 }
683 obj=0;
684 return(9120);
685 }
686
687
trfeed()688 trfeed() /* 9210 */
689 { if (obj==bird)
690 { spk=100;
691 return(2011);
692 }
693 if (obj==snake||obj==dragon||obj==troll)
694 { spk=102;
695 if (obj==dragon&&prop[dragon]!=0) spk=110;
696 if (obj==troll) spk=182;
697 if (obj!=snake||closed||!here(bird)) return(2011);
698 spk=101;
699 dstroy(bird);
700 prop[bird]=0;
701 tally2++;
702 return(2011);
703 }
704 if (obj==dwarf)
705 { if (!here(food)) return(2011);
706 spk=103;
707 dflag++;
708 return(2011);
709 }
710 if (obj==bear)
711 { if (prop[bear]==0) spk=102;
712 if (prop[bear]==3) spk=110;
713 if (!here(food)) return(2011);
714 dstroy(food);
715 prop[bear]=1;
716 fixed[axe]=0;
717 prop[axe]=0;
718 spk=168;
719 return(2011);
720 }
721 spk=14;
722 return(2011);
723 }
724
725
trfill()726 trfill() /* 9220 */
727 { if (obj==vase)
728 { spk=29;
729 if (liqloc(loc)==0) spk=144;
730 if (liqloc(loc)==0||!toting(vase)) return(2011);
731 rspeak(145);
732 prop[vase]=2;
733 fixed[vase]= -1;
734 return(9020); /* advent/10 goes to 9024 */
735 }
736 if (obj!=0&&obj!=bottle) return(2011);
737 if (obj==0&&!here(bottle)) return(8000);
738 spk=107;
739 if (liqloc(loc)==0) spk=106;
740 if (liq(0)!=0) spk=105;
741 if (spk!=107) return(2011);
742 prop[bottle]=((cond[loc]%4)/2)*2;
743 k=liq(0);
744 if (toting(bottle)) place[k]= -1;
745 if (k==oil) spk=108;
746 return(2011);
747 }
748
749
closing()750 closing() /* 10000 */
751 { register int i;
752
753 prop[grate]=prop[fissur]=0;
754 for (i=1; i<=6; i++)
755 { dseen[i]=FALSE;
756 dloc[i]=0;
757 }
758 move(troll,0);
759 move(troll+100,0);
760 move(troll2,plac[troll]);
761 move(troll2+100,fixd[troll]);
762 juggle(chasm);
763 if(prop[bear]!=3) dstroy(bear);
764 prop[chain]=0;
765 fixed[chain]=0;
766 prop[axe]=0;
767 fixed[axe]=0;
768 rspeak(129);
769 clock1 = -1;
770 closng=TRUE;
771 return(19999);
772 }
773
774
caveclose()775 caveclose() /* 11000 */
776 { register int i;
777 prop[bottle]=put(bottle,115,1);
778 prop[plant]=put(plant,115,0);
779 prop[oyster]=put(oyster,115,0);
780 prop[lamp]=put(lamp,115,0);
781 prop[rod]=put(rod,115,0);
782 prop[dwarf]=put(dwarf,115,0);
783 loc=115;
784 oldloc=115;
785 newloc=115;
786
787 put(grate,116,0);
788 prop[snake]=put(snake,116,1);
789 prop[bird]=put(bird,116,1);
790 prop[cage]=put(cage,116,0);
791 prop[rod2]=put(rod2,116,0);
792 prop[pillow]=put(pillow,116,0);
793
794 prop[mirror]=put(mirror,115,0);
795 fixed[mirror]=116;
796
797 for (i=1; i<=100; i++)
798 if (toting(i)) dstroy(i);
799 rspeak(132);
800 closed=TRUE;
801 return(2);
802 }
803