xref: /csrg-svn/games/adventure/main.c (revision 6737)
1*6737Srrh /*      Re-coding of advent in C: main program                          */
2*6737Srrh 
3*6737Srrh #include "hdr.h"
4*6737Srrh 
5*6737Srrh static char sccsid[] = "	main.c	1.1	82/05/11	";
6*6737Srrh 
7*6737Srrh int	datfd = -1;
8*6737Srrh main(argc,argv)
9*6737Srrh int argc;
10*6737Srrh char **argv;
11*6737Srrh {       register int i;
12*6737Srrh 	int rval,ll;
13*6737Srrh 	struct text *kk;
14*6737Srrh 	extern trapdel();
15*6737Srrh 	static reenter;
16*6737Srrh 	if ((datfd = getcmd(argv[0])) < 0) {
17*6737Srrh 		write(2, "No adventure just now\n", 22);
18*6737Srrh 		exit(1);
19*6737Srrh 	}
20*6737Srrh 	reenter++;
21*6737Srrh 	setuid(getuid());
22*6737Srrh 	switch (setup) {
23*6737Srrh 	case 0:
24*6737Srrh 		init(argv[0]);          /* set up initial variables     */
25*6737Srrh 		/* NOTREACHED */
26*6737Srrh 	case 1:
27*6737Srrh 		startup();		/* prepare for a user           */
28*6737Srrh 		signal(2,trapdel);
29*6737Srrh 		break;
30*6737Srrh 	case -1:	                /* restarting game : 8305       */
31*6737Srrh 		yea=start(0);
32*6737Srrh 		setup=3;
33*6737Srrh 		k=null;
34*6737Srrh 		goto l8;
35*6737Srrh 	default:
36*6737Srrh 		printf("Your forged file dissappears in a puff of greasy black smoke! (poof)\n");
37*6737Srrh 		unlink(argv[0]);
38*6737Srrh 		exit(1);
39*6737Srrh 	}
40*6737Srrh 
41*6737Srrh 	for (;;)                        /* main command loop (label 2)  */
42*6737Srrh 	{       if (newloc<9 && newloc!=0 && closng)
43*6737Srrh 		{       rspeak(130);    /* if closing leave only by     */
44*6737Srrh 			newloc=loc;     /*      main office             */
45*6737Srrh 			if (!panic) clock2=15;
46*6737Srrh 			panic=TRUE;
47*6737Srrh 		}
48*6737Srrh 
49*6737Srrh 		rval=fdwarf();          /* dwarf stuff                  */
50*6737Srrh 		if (rval==99) die(99);
51*6737Srrh 
52*6737Srrh 	l2000:  if (loc==0) die(99);    /* label 2000                   */
53*6737Srrh 		kk = &stext[loc];
54*6737Srrh 		if ((abb[loc]%abbnum)==0 || kk->seekadr==0)
55*6737Srrh 			kk = &ltext[loc];
56*6737Srrh 		if (!forced(loc) && dark(0))
57*6737Srrh 		{       if (wzdark && pct(35))
58*6737Srrh 			{       die(90);
59*6737Srrh 				goto l2000;
60*6737Srrh 			}
61*6737Srrh 			kk = &rtext[16];
62*6737Srrh 		}
63*6737Srrh 	l2001:  if (toting(bear)) rspeak(141);  /* 2001                 */
64*6737Srrh 		speak(kk);
65*6737Srrh 		k=1;
66*6737Srrh 		if (forced(loc))
67*6737Srrh 			goto l8;
68*6737Srrh 		if (loc==33 && pct(25)&&!closng) rspeak(8);
69*6737Srrh 		if (!dark(0))
70*6737Srrh 		{       abb[loc]++;
71*6737Srrh 			for (i=atloc[loc]; i!=0; i=link[i])     /*2004  */
72*6737Srrh 			{       obj=i;
73*6737Srrh 				if (obj>100) obj -= 100;
74*6737Srrh 				if (obj==steps && toting(nugget)) continue;
75*6737Srrh 				if (prop[obj]<0)
76*6737Srrh 				{       if (closed) continue;
77*6737Srrh 					prop[obj]=0;
78*6737Srrh 					if (obj==rug||obj==chain)
79*6737Srrh 						prop[obj]=1;
80*6737Srrh 					tally--;
81*6737Srrh 					if (tally==tally2 && tally != 0)
82*6737Srrh 						if (limit>35) limit=35;
83*6737Srrh 				}
84*6737Srrh 				kk=(struct text *) prop[obj];	/* 2006		*/
85*6737Srrh 				if (obj==steps && loc==fixed[steps])kk=(struct text *)1;
86*6737Srrh 				pspeak(obj,kk);
87*6737Srrh 			}                                       /* 2008 */
88*6737Srrh 			goto l2012;
89*6737Srrh 	l2009:          k=54;                   /* 2009                 */
90*6737Srrh 	l2010:          spk=k;
91*6737Srrh 	l2011:          rspeak(spk);
92*6737Srrh 		}
93*6737Srrh 	l2012:  verb=0;                         /* 2012                 */
94*6737Srrh 		obj=0;
95*6737Srrh 	l2600:	checkhints();                   /* to 2600-2602         */
96*6737Srrh 		if (closed)
97*6737Srrh 		{       if (prop[oyster]<0 && toting(oyster))
98*6737Srrh 				pspeak(oyster,1);
99*6737Srrh 			for (i=1; i<100; i++)
100*6737Srrh 				if (toting(i)&&prop[i]<0)       /*2604  */
101*6737Srrh 					prop[i] = -1-prop[i];
102*6737Srrh 		}
103*6737Srrh 		wzdark=dark(0);                 /* 2605                 */
104*6737Srrh 		if (knfloc>0 && knfloc!=loc) knfloc=1;
105*6737Srrh 		getin(&wd1,&wd2);
106*6737Srrh 		if (delhit)                     /* user typed a DEL     */
107*6737Srrh 		{       delhit=0;               /* reset counter        */
108*6737Srrh 			copystr("quit",wd1);    /* pretend he's quitting*/
109*6737Srrh 			*wd2=0;
110*6737Srrh 		}
111*6737Srrh 	l2608:  if ((foobar = -foobar)>0) foobar=0;     /* 2608         */
112*6737Srrh 		/* should check here for "magic mode"                   */
113*6737Srrh 		turns++;
114*6737Srrh 		if (demo && turns>=SHORT) done(1);      /* to 13000     */
115*6737Srrh 
116*6737Srrh 		if (verb==say && *wd2!=0) verb=0;
117*6737Srrh 		if (verb==say)
118*6737Srrh 			goto l4090;
119*6737Srrh 		if (tally==0 && loc>=15 && loc!=33) clock1--;
120*6737Srrh 		if (clock1==0)
121*6737Srrh 		{       closing();                      /* to 10000     */
122*6737Srrh 			goto l19999;
123*6737Srrh 		}
124*6737Srrh 		if (clock1<0) clock2--;
125*6737Srrh 		if (clock2==0)
126*6737Srrh 		{       caveclose();            /* to 11000             */
127*6737Srrh 			continue;               /* back to 2            */
128*6737Srrh 		}
129*6737Srrh 		if (prop[lamp]==1) limit--;
130*6737Srrh 		if (limit<=30 && here(batter) && prop[batter]==0
131*6737Srrh 			&& here(lamp))
132*6737Srrh 		{       rspeak(188);            /* 12000                */
133*6737Srrh 			prop[batter]=1;
134*6737Srrh 			if (toting(batter)) drop(batter,loc);
135*6737Srrh 			limit=limit+2500;
136*6737Srrh 			lmwarn=FALSE;
137*6737Srrh 			goto l19999;
138*6737Srrh 		}
139*6737Srrh 		if (limit==0)
140*6737Srrh 		{       limit = -1;             /* 12400                */
141*6737Srrh 			prop[lamp]=0;
142*6737Srrh 			rspeak(184);
143*6737Srrh 			goto l19999;
144*6737Srrh 		}
145*6737Srrh 		if (limit<0&&loc<=8)
146*6737Srrh 		{       rspeak(185);            /* 12600                */
147*6737Srrh 			gaveup=TRUE;
148*6737Srrh 			done(2);                /* to 20000             */
149*6737Srrh 		}
150*6737Srrh 		if (limit<=30)
151*6737Srrh 		{       if (lmwarn|| !here(lamp)) goto l19999;  /*12200*/
152*6737Srrh 			lmwarn=TRUE;
153*6737Srrh 			spk=187;
154*6737Srrh 			if (place[batter]==0) spk=183;
155*6737Srrh 			if (prop[batter]==1) spk=189;
156*6737Srrh 			rspeak(spk);
157*6737Srrh 		}
158*6737Srrh 	l19999: k=43;
159*6737Srrh 		if (liqloc(loc)==water) k=70;
160*6737Srrh 		if (weq(wd1,"enter") &&
161*6737Srrh 		    (weq(wd2,"strea")||weq(wd2,"water")))
162*6737Srrh 			goto l2010;
163*6737Srrh 		if (weq(wd1,"enter") && *wd2!=0) goto l2800;
164*6737Srrh 		if ((!weq(wd1,"water")&&!weq(wd1,"oil"))
165*6737Srrh 		    || (!weq(wd2,"plant")&&!weq(wd2,"door")))
166*6737Srrh 			goto l2610;
167*6737Srrh 		if (at(vocab(wd2,1))) copystr("pour",wd2);
168*6737Srrh 	l2610:  if (weq(wd1,"west"))
169*6737Srrh 			if (++iwest==10) rspeak(17);
170*6737Srrh 	l2630:  i=vocab(wd1,-1);
171*6737Srrh 		if (i== -1)
172*6737Srrh 		{       spk=60;                 /* 3000         */
173*6737Srrh 			if (pct(20)) spk=61;
174*6737Srrh 			if (pct(20)) spk=13;
175*6737Srrh 			rspeak(spk);
176*6737Srrh 			goto l2600;
177*6737Srrh 		}
178*6737Srrh 		k=i%1000;
179*6737Srrh 		kq=i/1000+1;
180*6737Srrh 		switch(kq)
181*6737Srrh 		{   case 1: goto l8;
182*6737Srrh 		    case 2: goto l5000;
183*6737Srrh 		    case 3: goto l4000;
184*6737Srrh 		    case 4: goto l2010;
185*6737Srrh 		    default:
186*6737Srrh 			printf("Error 22\n");
187*6737Srrh 			exit(0);
188*6737Srrh 		}
189*6737Srrh 
190*6737Srrh 	l8:
191*6737Srrh 		switch(march())
192*6737Srrh 		{   case 2: continue;           /* i.e. goto l2         */
193*6737Srrh 		    case 99:
194*6737Srrh 			switch(die(99))
195*6737Srrh 			{   case 2000: goto l2000;
196*6737Srrh 			    default: bug(111);
197*6737Srrh 			}
198*6737Srrh 		    default: bug(110);
199*6737Srrh 		}
200*6737Srrh 
201*6737Srrh 	l2800:  copystr(wd2,wd1);
202*6737Srrh 		*wd2=0;
203*6737Srrh 		goto l2610;
204*6737Srrh 
205*6737Srrh 	l4000:  verb=k;
206*6737Srrh 		spk=actspk[verb];
207*6737Srrh 		if (*wd2!=0 && verb!=say) goto l2800;
208*6737Srrh 		if (verb==say) obj= *wd2;
209*6737Srrh 		if (obj!=0) goto l4090;
210*6737Srrh 	l4080:
211*6737Srrh 		switch(verb)
212*6737Srrh 		{   case 1:                     /* take = 8010          */
213*6737Srrh 			if (atloc[loc]==0||link[atloc[loc]]!=0) goto l8000;
214*6737Srrh 			for (i=1; i<=5; i++)
215*6737Srrh 				if (dloc[i]==loc&&dflag>=2) goto l8000;
216*6737Srrh 			obj=atloc[loc];
217*6737Srrh 			goto l9010;
218*6737Srrh 		    case 2: case 3: case 9:     /* 8000 : drop,say,wave */
219*6737Srrh 		    case 10: case 16: case 17:  /* calm,rub,toss        */
220*6737Srrh 		    case 19: case 21: case 28:  /* find,feed,break      */
221*6737Srrh 		    case 29:                    /* wake                 */
222*6737Srrh 		l8000:  printf("%s what?\n",wd1);
223*6737Srrh 			obj=0;
224*6737Srrh 			goto l2600;
225*6737Srrh 		    case 4: case 6:             /* 8040 open,lock       */
226*6737Srrh 			spk=28;
227*6737Srrh 			if (here(clam)) obj=clam;
228*6737Srrh 			if (here(oyster)) obj=oyster;
229*6737Srrh 			if (at(door)) obj=door;
230*6737Srrh 			if (at(grate)) obj=grate;
231*6737Srrh 			if (obj!=0 && here(chain)) goto l8000;
232*6737Srrh 			if (here(chain)) obj=chain;
233*6737Srrh 			if (obj==0) goto l2011;
234*6737Srrh 			goto l9040;
235*6737Srrh 		    case 5: goto l2009;         /* nothing              */
236*6737Srrh 		    case 7: goto l9070;         /* on                   */
237*6737Srrh 		    case 8: goto l9080;         /* off                  */
238*6737Srrh 		    case 11: goto l8000;        /* walk                 */
239*6737Srrh 		    case 12: goto l9120;        /* kill                 */
240*6737Srrh 		    case 13: goto l9130;        /* pour                 */
241*6737Srrh 		    case 14:                    /* eat: 8140            */
242*6737Srrh 			if (!here(food)) goto l8000;
243*6737Srrh 		l8142:  dstroy(food);
244*6737Srrh 			spk=72;
245*6737Srrh 			goto l2011;
246*6737Srrh 		    case 15: goto l9150;        /* drink                */
247*6737Srrh 		    case 18:                    /* quit: 8180           */
248*6737Srrh 			gaveup=yes(22,54,54);
249*6737Srrh 			if (gaveup) done(2);    /* 8185                 */
250*6737Srrh 			goto l2012;
251*6737Srrh 		    case 20:                    /* invent=8200          */
252*6737Srrh 			spk=98;
253*6737Srrh 			for (i=1; i<=100; i++)
254*6737Srrh 			{       if (i!=bear && toting(i))
255*6737Srrh 				{       if (spk==98) rspeak(99);
256*6737Srrh 					blklin=FALSE;
257*6737Srrh 					pspeak(i,-1);
258*6737Srrh 					blklin=TRUE;
259*6737Srrh 					spk=0;
260*6737Srrh 				}
261*6737Srrh 			}
262*6737Srrh 			if (toting(bear)) spk=141;
263*6737Srrh 			goto l2011;
264*6737Srrh 		    case 22: goto l9220;        /* fill                 */
265*6737Srrh 		    case 23: goto l9230;        /* blast                */
266*6737Srrh 		    case 24:                    /* score: 8240          */
267*6737Srrh 			scorng=TRUE;
268*6737Srrh 			printf("If you were to quit now, you would score");
269*6737Srrh 			printf(" %d out of a possible ",score());
270*6737Srrh 			printf("%d.",mxscor);
271*6737Srrh 			scorng=FALSE;
272*6737Srrh 			gaveup=yes(143,54,54);
273*6737Srrh 			if (gaveup) done(2);
274*6737Srrh 			goto l2012;
275*6737Srrh 		    case 25:                    /* foo: 8250            */
276*6737Srrh 			k=vocab(wd1,3);
277*6737Srrh 			spk=42;
278*6737Srrh 			if (foobar==1-k) goto l8252;
279*6737Srrh 			if (foobar!=0) spk=151;
280*6737Srrh 			goto l2011;
281*6737Srrh 		l8252:  foobar=k;
282*6737Srrh 			if (k!=4) goto l2009;
283*6737Srrh 			foobar=0;
284*6737Srrh 			if (place[eggs]==plac[eggs]
285*6737Srrh 				||(toting(eggs)&&loc==plac[eggs])) goto l2011;
286*6737Srrh 			if (place[eggs]==0&&place[troll]==0&&prop[troll]==0)
287*6737Srrh 				prop[troll]=1;
288*6737Srrh 			k=2;
289*6737Srrh 			if (here(eggs)) k=1;
290*6737Srrh 			if (loc==plac[eggs]) k=0;
291*6737Srrh 			move(eggs,plac[eggs]);
292*6737Srrh 			pspeak(eggs,k);
293*6737Srrh 			goto l2012;
294*6737Srrh 		    case 26:                    /* brief=8260           */
295*6737Srrh 			spk=156;
296*6737Srrh 			abbnum=10000;
297*6737Srrh 			detail=3;
298*6737Srrh 			goto l2011;
299*6737Srrh 		    case 27:                    /* read=8270            */
300*6737Srrh 			if (here(magzin)) obj=magzin;
301*6737Srrh 			if (here(tablet)) obj=obj*100+tablet;
302*6737Srrh 			if (here(messag)) obj=obj*100+messag;
303*6737Srrh 			if (closed&&toting(oyster)) obj=oyster;
304*6737Srrh 			if (obj>100||obj==0||dark(0)) goto l8000;
305*6737Srrh 			goto l9270;
306*6737Srrh 		    case 30:                    /* suspend=8300         */
307*6737Srrh 			spk=201;
308*6737Srrh 			if (demo) goto l2011;
309*6737Srrh 			printf("I can suspend your adventure for you so");
310*6737Srrh 			printf(" you can resume later, but\n");
311*6737Srrh 			printf("you will have to wait at least");
312*6737Srrh 			printf(" %d minutes before continuing.",latncy);
313*6737Srrh 			if (!yes(200,54,54)) goto l2012;
314*6737Srrh 			datime(&saved,&savet);
315*6737Srrh 			setup = -1;
316*6737Srrh 			ciao(argv[0]);
317*6737Srrh 			continue;
318*6737Srrh 		    case 31:                    /* hours=8310           */
319*6737Srrh 			printf("Colossal cave is closed 9am-5pm Mon ");
320*6737Srrh 			printf("through Fri except holidays.\n");
321*6737Srrh 			goto l2012;
322*6737Srrh 		    default: bug(23);
323*6737Srrh 		}
324*6737Srrh 
325*6737Srrh 	l4090:
326*6737Srrh 		switch(verb)
327*6737Srrh 		{   case 1:                     /* take = 9010          */
328*6737Srrh 	l9010:          switch(trtake())
329*6737Srrh 			{   case 2011: goto l2011;
330*6737Srrh 			    case 9220: goto l9220;
331*6737Srrh 			    case 2009: goto l2009;
332*6737Srrh 			    case 2012: goto l2012;
333*6737Srrh 			    default: bug(102);
334*6737Srrh 			}
335*6737Srrh 	l9020:      case 2:                     /* drop = 9020          */
336*6737Srrh 			switch(trdrop())
337*6737Srrh 			{   case 2011: goto l2011;
338*6737Srrh 			    case 19000: done(3);
339*6737Srrh 			    case 2012: goto l2012;
340*6737Srrh 			    default: bug(105);
341*6737Srrh 			}
342*6737Srrh 	l9030:      case 3:
343*6737Srrh 			switch(trsay())
344*6737Srrh 			{   case 2012: goto l2012;
345*6737Srrh 			    case 2630: goto l2630;
346*6737Srrh 			    default: bug(107);
347*6737Srrh 			}
348*6737Srrh 	l9040:      case 4:  case 6:            /* open, close          */
349*6737Srrh 			switch(tropen())
350*6737Srrh 			{   case 2011: goto l2011;
351*6737Srrh 			    case 2010: goto l2010;
352*6737Srrh 			    default: bug(106);
353*6737Srrh 			}
354*6737Srrh 		    case 5: goto l2009;         /* nothing              */
355*6737Srrh 		    case 7:                     /* on   9070            */
356*6737Srrh 	l9070:          if (!here(lamp))  goto l2011;
357*6737Srrh 			spk=184;
358*6737Srrh 			if (limit<0) goto l2011;
359*6737Srrh 			prop[lamp]=1;
360*6737Srrh 			rspeak(39);
361*6737Srrh 			if (wzdark) goto l2000;
362*6737Srrh 			goto l2012;
363*6737Srrh 
364*6737Srrh 		    case 8:                     /* off                  */
365*6737Srrh 	l9080:          if (!here(lamp)) goto l2011;
366*6737Srrh 			prop[lamp]=0;
367*6737Srrh 			rspeak(40);
368*6737Srrh 			if (dark(0)) rspeak(16);
369*6737Srrh 			goto l2012;
370*6737Srrh 
371*6737Srrh 		    case 9:                     /* wave                 */
372*6737Srrh 			if ((!toting(obj))&&(obj!=rod||!toting(rod2)))
373*6737Srrh 				spk=29;
374*6737Srrh 			if (obj!=rod||!at(fissur)||!toting(obj)||closng)
375*6737Srrh 				goto l2011;
376*6737Srrh 			prop[fissur]=1-prop[fissur];
377*6737Srrh 			pspeak(fissur,2-prop[fissur]);
378*6737Srrh 			goto l2012;
379*6737Srrh 		    case 10: case 11: case 18:  /* calm, walk, quit     */
380*6737Srrh 		    case 24: case 25: case 26:  /* score, foo, brief    */
381*6737Srrh 		    case 30: case 31:           /* suspend, hours       */
382*6737Srrh 			     goto l2011;
383*6737Srrh 	l9120:      case 12:                    /* kill                 */
384*6737Srrh 			switch(trkill())
385*6737Srrh 			{   case 8000: goto l8000;
386*6737Srrh 			    case 8: goto l8;
387*6737Srrh 			    case 2011: goto l2011;
388*6737Srrh 			    case 2608: goto l2608;
389*6737Srrh 			    case 19000: done(3);
390*6737Srrh 			    default: bug(112);
391*6737Srrh 			}
392*6737Srrh 	l9130:      case 13:                    /* pour                 */
393*6737Srrh 			if (obj==bottle||obj==0) obj=liq(0);
394*6737Srrh 			if (obj==0) goto l8000;
395*6737Srrh 			if (!toting(obj)) goto l2011;
396*6737Srrh 			spk=78;
397*6737Srrh 			if (obj!=oil&&obj!=water) goto l2011;
398*6737Srrh 			prop[bottle]=1;
399*6737Srrh 			place[obj]=0;
400*6737Srrh 			spk=77;
401*6737Srrh 			if (!(at(plant)||at(door))) goto l2011;
402*6737Srrh 			if (at(door))
403*6737Srrh 			{       prop[door]=0;   /* 9132                 */
404*6737Srrh 				if (obj==oil) prop[door]=1;
405*6737Srrh 				spk=113+prop[door];
406*6737Srrh 				goto l2011;
407*6737Srrh 			}
408*6737Srrh 			spk=112;
409*6737Srrh 			if (obj!=water) goto l2011;
410*6737Srrh 			pspeak(plant,prop[plant]+1);
411*6737Srrh 			prop[plant]=(prop[plant]+2)% 6;
412*6737Srrh 			prop[plant2]=prop[plant]/2;
413*6737Srrh 			k=null;
414*6737Srrh 			goto l8;
415*6737Srrh 		    case 14:                    /* 9140 - eat           */
416*6737Srrh 			if (obj==food) goto l8142;
417*6737Srrh 			if (obj==bird||obj==snake||obj==clam||obj==oyster
418*6737Srrh 			    ||obj==dwarf||obj==dragon||obj==troll
419*6737Srrh 			    ||obj==bear) spk=71;
420*6737Srrh 			goto l2011;
421*6737Srrh 	l9150:      case 15:                    /* 9150 - drink         */
422*6737Srrh 			if (obj==0&&liqloc(loc)!=water&&(liq(0)!=water
423*6737Srrh 				||!here(bottle))) goto l8000;
424*6737Srrh 			if (obj!=0&&obj!=water) spk=110;
425*6737Srrh 			if (spk==110||liq(0)!=water||!here(bottle))
426*6737Srrh 				goto l2011;
427*6737Srrh 			prop[bottle]=1;
428*6737Srrh 			place[water]=0;
429*6737Srrh 			spk=74;
430*6737Srrh 			goto l2011;
431*6737Srrh 		    case 16:                    /* 9160: rub            */
432*6737Srrh 			if (obj!=lamp) spk=76;
433*6737Srrh 			goto l2011;
434*6737Srrh 		    case 17:                    /* 9170: throw          */
435*6737Srrh 			switch(trtoss())
436*6737Srrh 			{   case 2011: goto l2011;
437*6737Srrh 			    case 9020: goto l9020;
438*6737Srrh 			    case 9120: goto l9120;
439*6737Srrh 			    case 8: goto l8;
440*6737Srrh 			    case 9210: goto l9210;
441*6737Srrh 			    default: bug(113);
442*6737Srrh 			}
443*6737Srrh 		    case 19: case 20:           /* 9190: find, invent   */
444*6737Srrh 			if (at(obj)||(liq(0)==obj&&at(bottle))
445*6737Srrh 				||k==liqloc(loc)) spk=94;
446*6737Srrh 			for (i=1; i<=5; i++)
447*6737Srrh 				if (dloc[i]==loc&&dflag>=2&&obj==dwarf)
448*6737Srrh 					spk=94;
449*6737Srrh 			if (closed) spk=138;
450*6737Srrh 			if (toting(obj)) spk=24;
451*6737Srrh 			goto l2011;
452*6737Srrh 	l9210:      case 21:                    /* feed                 */
453*6737Srrh 			switch(trfeed())
454*6737Srrh 			{   case 2011: goto l2011;
455*6737Srrh 			    default: bug(114);
456*6737Srrh 			}
457*6737Srrh 	l9220:      case 22:                    /* fill                 */
458*6737Srrh 			switch(trfill())
459*6737Srrh 			{   case 2011: goto l2011;
460*6737Srrh 			    case 8000: goto l8000;
461*6737Srrh 			    case 9020: goto l9020;
462*6737Srrh 			    default: bug(115);
463*6737Srrh 			}
464*6737Srrh 	l9230:      case 23:                    /* blast                */
465*6737Srrh 			if (prop[rod2]<0||!closed) goto l2011;
466*6737Srrh 			bonus=133;
467*6737Srrh 			if (loc==115) bonus=134;
468*6737Srrh 			if (here(rod2)) bonus=135;
469*6737Srrh 			rspeak(bonus);
470*6737Srrh 			done(2);
471*6737Srrh 	l9270:      case 27:                    /* read                 */
472*6737Srrh 			if (dark(0)) goto l5190;
473*6737Srrh 			if (obj==magzin) spk=190;
474*6737Srrh 			if (obj==tablet) spk=196;
475*6737Srrh 			if (obj==messag) spk=191;
476*6737Srrh 			if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194;
477*6737Srrh 			if (obj!=oyster||hinted[2]||!toting(oyster)
478*6737Srrh 				||!closed) goto l2011;
479*6737Srrh 			hinted[2]=yes(192,193,54);
480*6737Srrh 			goto l2012;
481*6737Srrh 	l9280:      case 28:                    /* break                */
482*6737Srrh 			if (obj==mirror) spk=148;
483*6737Srrh 			if (obj==vase&&prop[vase]==0)
484*6737Srrh 			{       spk=198;
485*6737Srrh 				if (toting(vase)) drop(vase,loc);
486*6737Srrh 				prop[vase]=2;
487*6737Srrh 				fixed[vase]= -1;
488*6737Srrh 				goto l2011;
489*6737Srrh 			}
490*6737Srrh 			if (obj!=mirror||!closed) goto l2011;
491*6737Srrh 			rspeak(197);
492*6737Srrh 			done(3);
493*6737Srrh 
494*6737Srrh 	l9290:      case 29:                    /* wake                 */
495*6737Srrh 			if (obj!=dwarf||!closed) goto l2011;
496*6737Srrh 			rspeak(199);
497*6737Srrh 			done(3);
498*6737Srrh 
499*6737Srrh 		    default: bug(24);
500*6737Srrh 		}
501*6737Srrh 
502*6737Srrh 	l5000:
503*6737Srrh 		obj=k;
504*6737Srrh 		if (fixed[k]!=loc && !here(k)) goto l5100;
505*6737Srrh 	l5010:  if (*wd2!=0) goto l2800;
506*6737Srrh 		if (verb!=0) goto l4090;
507*6737Srrh 		printf("What do you want to do with the %s?\n",wd1);
508*6737Srrh 		goto l2600;
509*6737Srrh 	l5100:  if (k!=grate) goto l5110;
510*6737Srrh 		if (loc==1||loc==4||loc==7) k=dprssn;
511*6737Srrh 		if (loc>9&&loc<15) k=entrnc;
512*6737Srrh 		if (k!=grate) goto l8;
513*6737Srrh 	l5110:  if (k!=dwarf) goto l5120;
514*6737Srrh 		for (i=1; i<=5; i++)
515*6737Srrh 			if (dloc[i]==loc&&dflag>=2) goto l5010;
516*6737Srrh 	l5120:  if ((liq(0)==k&&here(bottle))||k==liqloc(loc)) goto l5010;
517*6737Srrh 		if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130;
518*6737Srrh 		obj=plant2;
519*6737Srrh 		goto l5010;
520*6737Srrh 	l5130:  if (obj!=knife||knfloc!=loc) goto l5140;
521*6737Srrh 		knfloc = -1;
522*6737Srrh 		spk=116;
523*6737Srrh 		goto l2011;
524*6737Srrh 	l5140:  if (obj!=rod||!here(rod2)) goto l5190;
525*6737Srrh 		obj=rod2;
526*6737Srrh 		goto l5010;
527*6737Srrh 	l5190:  if ((verb==find||verb==invent)&&*wd2==0) goto l5010;
528*6737Srrh 		printf("I see no %s here\n",wd1);
529*6737Srrh 		goto l2012;
530*6737Srrh 	}
531*6737Srrh }
532*6737Srrh 
533