xref: /csrg-svn/games/adventure/main.c (revision 37005)
16737Srrh /*      Re-coding of advent in C: main program                          */
26737Srrh 
3*37005Sbostic #include <sys/file.h>
4*37005Sbostic #include <stdio.h>
56737Srrh #include "hdr.h"
6*37005Sbostic #include "pathnames.h"
76737Srrh 
8*37005Sbostic static char sccsid[] = "	main.c	4.2	89/03/05	";
96737Srrh 
106737Srrh int	datfd = -1;
116737Srrh main(argc,argv)
126737Srrh int argc;
136737Srrh char **argv;
14*37005Sbostic {
15*37005Sbostic 	extern int errno;
16*37005Sbostic 	register int i;
176737Srrh 	int rval,ll;
186737Srrh 	struct text *kk;
196737Srrh 	extern trapdel();
20*37005Sbostic 	char *strerror();
216737Srrh 	static reenter;
22*37005Sbostic 
236737Srrh 	reenter++;
246737Srrh 	switch (setup) {
256737Srrh 	case 0:
26*37005Sbostic 		if ((datfd = open(*argv, O_RDONLY, 0)) < 0) {
27*37005Sbostic 			fprintf(stderr, "adventure: can't init\n");
28*37005Sbostic 			exit(1);
29*37005Sbostic 		}
30*37005Sbostic 		init(*argv);
316737Srrh 		/* NOTREACHED */
326737Srrh 	case 1:
33*37005Sbostic 		if ((datfd = open(_PATH_ADVENTURE, O_RDONLY, 0)) < 0) {
34*37005Sbostic 			fprintf(stderr, "adventure: %s: %s\n", _PATH_ADVENTURE,
35*37005Sbostic 			    strerror(errno));
36*37005Sbostic 			exit(1);
37*37005Sbostic 		}
386737Srrh 		startup();		/* prepare for a user           */
396737Srrh 		signal(2,trapdel);
406737Srrh 		break;
416737Srrh 	case -1:	                /* restarting game : 8305       */
426737Srrh 		yea=start(0);
436737Srrh 		setup=3;
446737Srrh 		k=null;
456737Srrh 		goto l8;
466737Srrh 	default:
476737Srrh 		printf("Your forged file dissappears in a puff of greasy black smoke! (poof)\n");
486737Srrh 		unlink(argv[0]);
496737Srrh 		exit(1);
506737Srrh 	}
516737Srrh 
526737Srrh 	for (;;)                        /* main command loop (label 2)  */
536737Srrh 	{       if (newloc<9 && newloc!=0 && closng)
546737Srrh 		{       rspeak(130);    /* if closing leave only by     */
556737Srrh 			newloc=loc;     /*      main office             */
566737Srrh 			if (!panic) clock2=15;
576737Srrh 			panic=TRUE;
586737Srrh 		}
596737Srrh 
606737Srrh 		rval=fdwarf();          /* dwarf stuff                  */
616737Srrh 		if (rval==99) die(99);
626737Srrh 
636737Srrh 	l2000:  if (loc==0) die(99);    /* label 2000                   */
646737Srrh 		kk = &stext[loc];
656737Srrh 		if ((abb[loc]%abbnum)==0 || kk->seekadr==0)
666737Srrh 			kk = &ltext[loc];
676737Srrh 		if (!forced(loc) && dark(0))
686737Srrh 		{       if (wzdark && pct(35))
696737Srrh 			{       die(90);
706737Srrh 				goto l2000;
716737Srrh 			}
726737Srrh 			kk = &rtext[16];
736737Srrh 		}
746737Srrh 	l2001:  if (toting(bear)) rspeak(141);  /* 2001                 */
756737Srrh 		speak(kk);
766737Srrh 		k=1;
776737Srrh 		if (forced(loc))
786737Srrh 			goto l8;
796737Srrh 		if (loc==33 && pct(25)&&!closng) rspeak(8);
806737Srrh 		if (!dark(0))
816737Srrh 		{       abb[loc]++;
826737Srrh 			for (i=atloc[loc]; i!=0; i=link[i])     /*2004  */
836737Srrh 			{       obj=i;
846737Srrh 				if (obj>100) obj -= 100;
856737Srrh 				if (obj==steps && toting(nugget)) continue;
866737Srrh 				if (prop[obj]<0)
876737Srrh 				{       if (closed) continue;
886737Srrh 					prop[obj]=0;
896737Srrh 					if (obj==rug||obj==chain)
906737Srrh 						prop[obj]=1;
916737Srrh 					tally--;
926737Srrh 					if (tally==tally2 && tally != 0)
936737Srrh 						if (limit>35) limit=35;
946737Srrh 				}
956737Srrh 				kk=(struct text *) prop[obj];	/* 2006		*/
966737Srrh 				if (obj==steps && loc==fixed[steps])kk=(struct text *)1;
976737Srrh 				pspeak(obj,kk);
986737Srrh 			}                                       /* 2008 */
996737Srrh 			goto l2012;
1006737Srrh 	l2009:          k=54;                   /* 2009                 */
1016737Srrh 	l2010:          spk=k;
1026737Srrh 	l2011:          rspeak(spk);
1036737Srrh 		}
1046737Srrh 	l2012:  verb=0;                         /* 2012                 */
1056737Srrh 		obj=0;
1066737Srrh 	l2600:	checkhints();                   /* to 2600-2602         */
1076737Srrh 		if (closed)
1086737Srrh 		{       if (prop[oyster]<0 && toting(oyster))
1096737Srrh 				pspeak(oyster,1);
1106737Srrh 			for (i=1; i<100; i++)
1116737Srrh 				if (toting(i)&&prop[i]<0)       /*2604  */
1126737Srrh 					prop[i] = -1-prop[i];
1136737Srrh 		}
1146737Srrh 		wzdark=dark(0);                 /* 2605                 */
1156737Srrh 		if (knfloc>0 && knfloc!=loc) knfloc=1;
1166737Srrh 		getin(&wd1,&wd2);
1176737Srrh 		if (delhit)                     /* user typed a DEL     */
1186737Srrh 		{       delhit=0;               /* reset counter        */
1196737Srrh 			copystr("quit",wd1);    /* pretend he's quitting*/
1206737Srrh 			*wd2=0;
1216737Srrh 		}
1226737Srrh 	l2608:  if ((foobar = -foobar)>0) foobar=0;     /* 2608         */
1236737Srrh 		/* should check here for "magic mode"                   */
1246737Srrh 		turns++;
1256737Srrh 		if (demo && turns>=SHORT) done(1);      /* to 13000     */
1266737Srrh 
1276737Srrh 		if (verb==say && *wd2!=0) verb=0;
1286737Srrh 		if (verb==say)
1296737Srrh 			goto l4090;
1306737Srrh 		if (tally==0 && loc>=15 && loc!=33) clock1--;
1316737Srrh 		if (clock1==0)
1326737Srrh 		{       closing();                      /* to 10000     */
1336737Srrh 			goto l19999;
1346737Srrh 		}
1356737Srrh 		if (clock1<0) clock2--;
1366737Srrh 		if (clock2==0)
1376737Srrh 		{       caveclose();            /* to 11000             */
1386737Srrh 			continue;               /* back to 2            */
1396737Srrh 		}
1406737Srrh 		if (prop[lamp]==1) limit--;
1416737Srrh 		if (limit<=30 && here(batter) && prop[batter]==0
1426737Srrh 			&& here(lamp))
1436737Srrh 		{       rspeak(188);            /* 12000                */
1446737Srrh 			prop[batter]=1;
1456737Srrh 			if (toting(batter)) drop(batter,loc);
1466737Srrh 			limit=limit+2500;
1476737Srrh 			lmwarn=FALSE;
1486737Srrh 			goto l19999;
1496737Srrh 		}
1506737Srrh 		if (limit==0)
1516737Srrh 		{       limit = -1;             /* 12400                */
1526737Srrh 			prop[lamp]=0;
1536737Srrh 			rspeak(184);
1546737Srrh 			goto l19999;
1556737Srrh 		}
1566737Srrh 		if (limit<0&&loc<=8)
1576737Srrh 		{       rspeak(185);            /* 12600                */
1586737Srrh 			gaveup=TRUE;
1596737Srrh 			done(2);                /* to 20000             */
1606737Srrh 		}
1616737Srrh 		if (limit<=30)
1626737Srrh 		{       if (lmwarn|| !here(lamp)) goto l19999;  /*12200*/
1636737Srrh 			lmwarn=TRUE;
1646737Srrh 			spk=187;
1656737Srrh 			if (place[batter]==0) spk=183;
1666737Srrh 			if (prop[batter]==1) spk=189;
1676737Srrh 			rspeak(spk);
1686737Srrh 		}
1696737Srrh 	l19999: k=43;
1706737Srrh 		if (liqloc(loc)==water) k=70;
1716737Srrh 		if (weq(wd1,"enter") &&
1726737Srrh 		    (weq(wd2,"strea")||weq(wd2,"water")))
1736737Srrh 			goto l2010;
1746737Srrh 		if (weq(wd1,"enter") && *wd2!=0) goto l2800;
1756737Srrh 		if ((!weq(wd1,"water")&&!weq(wd1,"oil"))
1766737Srrh 		    || (!weq(wd2,"plant")&&!weq(wd2,"door")))
1776737Srrh 			goto l2610;
1786737Srrh 		if (at(vocab(wd2,1))) copystr("pour",wd2);
1796737Srrh 	l2610:  if (weq(wd1,"west"))
1806737Srrh 			if (++iwest==10) rspeak(17);
1816737Srrh 	l2630:  i=vocab(wd1,-1);
1826737Srrh 		if (i== -1)
1836737Srrh 		{       spk=60;                 /* 3000         */
1846737Srrh 			if (pct(20)) spk=61;
1856737Srrh 			if (pct(20)) spk=13;
1866737Srrh 			rspeak(spk);
1876737Srrh 			goto l2600;
1886737Srrh 		}
1896737Srrh 		k=i%1000;
1906737Srrh 		kq=i/1000+1;
1916737Srrh 		switch(kq)
1926737Srrh 		{   case 1: goto l8;
1936737Srrh 		    case 2: goto l5000;
1946737Srrh 		    case 3: goto l4000;
1956737Srrh 		    case 4: goto l2010;
1966737Srrh 		    default:
1976737Srrh 			printf("Error 22\n");
1986737Srrh 			exit(0);
1996737Srrh 		}
2006737Srrh 
2016737Srrh 	l8:
2026737Srrh 		switch(march())
2036737Srrh 		{   case 2: continue;           /* i.e. goto l2         */
2046737Srrh 		    case 99:
2056737Srrh 			switch(die(99))
2066737Srrh 			{   case 2000: goto l2000;
2076737Srrh 			    default: bug(111);
2086737Srrh 			}
2096737Srrh 		    default: bug(110);
2106737Srrh 		}
2116737Srrh 
2126737Srrh 	l2800:  copystr(wd2,wd1);
2136737Srrh 		*wd2=0;
2146737Srrh 		goto l2610;
2156737Srrh 
2166737Srrh 	l4000:  verb=k;
2176737Srrh 		spk=actspk[verb];
2186737Srrh 		if (*wd2!=0 && verb!=say) goto l2800;
2196737Srrh 		if (verb==say) obj= *wd2;
2206737Srrh 		if (obj!=0) goto l4090;
2216737Srrh 	l4080:
2226737Srrh 		switch(verb)
2236737Srrh 		{   case 1:                     /* take = 8010          */
2246737Srrh 			if (atloc[loc]==0||link[atloc[loc]]!=0) goto l8000;
2256737Srrh 			for (i=1; i<=5; i++)
2266737Srrh 				if (dloc[i]==loc&&dflag>=2) goto l8000;
2276737Srrh 			obj=atloc[loc];
2286737Srrh 			goto l9010;
2296737Srrh 		    case 2: case 3: case 9:     /* 8000 : drop,say,wave */
2306737Srrh 		    case 10: case 16: case 17:  /* calm,rub,toss        */
2316737Srrh 		    case 19: case 21: case 28:  /* find,feed,break      */
2326737Srrh 		    case 29:                    /* wake                 */
2336737Srrh 		l8000:  printf("%s what?\n",wd1);
2346737Srrh 			obj=0;
2356737Srrh 			goto l2600;
2366737Srrh 		    case 4: case 6:             /* 8040 open,lock       */
2376737Srrh 			spk=28;
2386737Srrh 			if (here(clam)) obj=clam;
2396737Srrh 			if (here(oyster)) obj=oyster;
2406737Srrh 			if (at(door)) obj=door;
2416737Srrh 			if (at(grate)) obj=grate;
2426737Srrh 			if (obj!=0 && here(chain)) goto l8000;
2436737Srrh 			if (here(chain)) obj=chain;
2446737Srrh 			if (obj==0) goto l2011;
2456737Srrh 			goto l9040;
2466737Srrh 		    case 5: goto l2009;         /* nothing              */
2476737Srrh 		    case 7: goto l9070;         /* on                   */
2486737Srrh 		    case 8: goto l9080;         /* off                  */
2496737Srrh 		    case 11: goto l8000;        /* walk                 */
2506737Srrh 		    case 12: goto l9120;        /* kill                 */
2516737Srrh 		    case 13: goto l9130;        /* pour                 */
2526737Srrh 		    case 14:                    /* eat: 8140            */
2536737Srrh 			if (!here(food)) goto l8000;
2546737Srrh 		l8142:  dstroy(food);
2556737Srrh 			spk=72;
2566737Srrh 			goto l2011;
2576737Srrh 		    case 15: goto l9150;        /* drink                */
2586737Srrh 		    case 18:                    /* quit: 8180           */
2596737Srrh 			gaveup=yes(22,54,54);
2606737Srrh 			if (gaveup) done(2);    /* 8185                 */
2616737Srrh 			goto l2012;
2626737Srrh 		    case 20:                    /* invent=8200          */
2636737Srrh 			spk=98;
2646737Srrh 			for (i=1; i<=100; i++)
2656737Srrh 			{       if (i!=bear && toting(i))
2666737Srrh 				{       if (spk==98) rspeak(99);
2676737Srrh 					blklin=FALSE;
2686737Srrh 					pspeak(i,-1);
2696737Srrh 					blklin=TRUE;
2706737Srrh 					spk=0;
2716737Srrh 				}
2726737Srrh 			}
2736737Srrh 			if (toting(bear)) spk=141;
2746737Srrh 			goto l2011;
2756737Srrh 		    case 22: goto l9220;        /* fill                 */
2766737Srrh 		    case 23: goto l9230;        /* blast                */
2776737Srrh 		    case 24:                    /* score: 8240          */
2786737Srrh 			scorng=TRUE;
2796737Srrh 			printf("If you were to quit now, you would score");
2806737Srrh 			printf(" %d out of a possible ",score());
2816737Srrh 			printf("%d.",mxscor);
2826737Srrh 			scorng=FALSE;
2836737Srrh 			gaveup=yes(143,54,54);
2846737Srrh 			if (gaveup) done(2);
2856737Srrh 			goto l2012;
2866737Srrh 		    case 25:                    /* foo: 8250            */
2876737Srrh 			k=vocab(wd1,3);
2886737Srrh 			spk=42;
2896737Srrh 			if (foobar==1-k) goto l8252;
2906737Srrh 			if (foobar!=0) spk=151;
2916737Srrh 			goto l2011;
2926737Srrh 		l8252:  foobar=k;
2936737Srrh 			if (k!=4) goto l2009;
2946737Srrh 			foobar=0;
2956737Srrh 			if (place[eggs]==plac[eggs]
2966737Srrh 				||(toting(eggs)&&loc==plac[eggs])) goto l2011;
2976737Srrh 			if (place[eggs]==0&&place[troll]==0&&prop[troll]==0)
2986737Srrh 				prop[troll]=1;
2996737Srrh 			k=2;
3006737Srrh 			if (here(eggs)) k=1;
3016737Srrh 			if (loc==plac[eggs]) k=0;
3026737Srrh 			move(eggs,plac[eggs]);
3036737Srrh 			pspeak(eggs,k);
3046737Srrh 			goto l2012;
3056737Srrh 		    case 26:                    /* brief=8260           */
3066737Srrh 			spk=156;
3076737Srrh 			abbnum=10000;
3086737Srrh 			detail=3;
3096737Srrh 			goto l2011;
3106737Srrh 		    case 27:                    /* read=8270            */
3116737Srrh 			if (here(magzin)) obj=magzin;
3126737Srrh 			if (here(tablet)) obj=obj*100+tablet;
3136737Srrh 			if (here(messag)) obj=obj*100+messag;
3146737Srrh 			if (closed&&toting(oyster)) obj=oyster;
3156737Srrh 			if (obj>100||obj==0||dark(0)) goto l8000;
3166737Srrh 			goto l9270;
3176737Srrh 		    case 30:                    /* suspend=8300         */
3186737Srrh 			spk=201;
3196737Srrh 			if (demo) goto l2011;
3206737Srrh 			printf("I can suspend your adventure for you so");
3216737Srrh 			printf(" you can resume later, but\n");
3226737Srrh 			printf("you will have to wait at least");
3236737Srrh 			printf(" %d minutes before continuing.",latncy);
3246737Srrh 			if (!yes(200,54,54)) goto l2012;
3256737Srrh 			datime(&saved,&savet);
3266737Srrh 			setup = -1;
3276737Srrh 			ciao(argv[0]);
3286737Srrh 			continue;
3296737Srrh 		    case 31:                    /* hours=8310           */
3306737Srrh 			printf("Colossal cave is closed 9am-5pm Mon ");
3316737Srrh 			printf("through Fri except holidays.\n");
3326737Srrh 			goto l2012;
3336737Srrh 		    default: bug(23);
3346737Srrh 		}
3356737Srrh 
3366737Srrh 	l4090:
3376737Srrh 		switch(verb)
3386737Srrh 		{   case 1:                     /* take = 9010          */
3396737Srrh 	l9010:          switch(trtake())
3406737Srrh 			{   case 2011: goto l2011;
3416737Srrh 			    case 9220: goto l9220;
3426737Srrh 			    case 2009: goto l2009;
3436737Srrh 			    case 2012: goto l2012;
3446737Srrh 			    default: bug(102);
3456737Srrh 			}
3466737Srrh 	l9020:      case 2:                     /* drop = 9020          */
3476737Srrh 			switch(trdrop())
3486737Srrh 			{   case 2011: goto l2011;
3496737Srrh 			    case 19000: done(3);
3506737Srrh 			    case 2012: goto l2012;
3516737Srrh 			    default: bug(105);
3526737Srrh 			}
3536737Srrh 	l9030:      case 3:
3546737Srrh 			switch(trsay())
3556737Srrh 			{   case 2012: goto l2012;
3566737Srrh 			    case 2630: goto l2630;
3576737Srrh 			    default: bug(107);
3586737Srrh 			}
3596737Srrh 	l9040:      case 4:  case 6:            /* open, close          */
3606737Srrh 			switch(tropen())
3616737Srrh 			{   case 2011: goto l2011;
3626737Srrh 			    case 2010: goto l2010;
3636737Srrh 			    default: bug(106);
3646737Srrh 			}
3656737Srrh 		    case 5: goto l2009;         /* nothing              */
3666737Srrh 		    case 7:                     /* on   9070            */
3676737Srrh 	l9070:          if (!here(lamp))  goto l2011;
3686737Srrh 			spk=184;
3696737Srrh 			if (limit<0) goto l2011;
3706737Srrh 			prop[lamp]=1;
3716737Srrh 			rspeak(39);
3726737Srrh 			if (wzdark) goto l2000;
3736737Srrh 			goto l2012;
3746737Srrh 
3756737Srrh 		    case 8:                     /* off                  */
3766737Srrh 	l9080:          if (!here(lamp)) goto l2011;
3776737Srrh 			prop[lamp]=0;
3786737Srrh 			rspeak(40);
3796737Srrh 			if (dark(0)) rspeak(16);
3806737Srrh 			goto l2012;
3816737Srrh 
3826737Srrh 		    case 9:                     /* wave                 */
3836737Srrh 			if ((!toting(obj))&&(obj!=rod||!toting(rod2)))
3846737Srrh 				spk=29;
3856737Srrh 			if (obj!=rod||!at(fissur)||!toting(obj)||closng)
3866737Srrh 				goto l2011;
3876737Srrh 			prop[fissur]=1-prop[fissur];
3886737Srrh 			pspeak(fissur,2-prop[fissur]);
3896737Srrh 			goto l2012;
3906737Srrh 		    case 10: case 11: case 18:  /* calm, walk, quit     */
3916737Srrh 		    case 24: case 25: case 26:  /* score, foo, brief    */
3926737Srrh 		    case 30: case 31:           /* suspend, hours       */
3936737Srrh 			     goto l2011;
3946737Srrh 	l9120:      case 12:                    /* kill                 */
3956737Srrh 			switch(trkill())
3966737Srrh 			{   case 8000: goto l8000;
3976737Srrh 			    case 8: goto l8;
3986737Srrh 			    case 2011: goto l2011;
3996737Srrh 			    case 2608: goto l2608;
4006737Srrh 			    case 19000: done(3);
4016737Srrh 			    default: bug(112);
4026737Srrh 			}
4036737Srrh 	l9130:      case 13:                    /* pour                 */
4046737Srrh 			if (obj==bottle||obj==0) obj=liq(0);
4056737Srrh 			if (obj==0) goto l8000;
4066737Srrh 			if (!toting(obj)) goto l2011;
4076737Srrh 			spk=78;
4086737Srrh 			if (obj!=oil&&obj!=water) goto l2011;
4096737Srrh 			prop[bottle]=1;
4106737Srrh 			place[obj]=0;
4116737Srrh 			spk=77;
4126737Srrh 			if (!(at(plant)||at(door))) goto l2011;
4136737Srrh 			if (at(door))
4146737Srrh 			{       prop[door]=0;   /* 9132                 */
4156737Srrh 				if (obj==oil) prop[door]=1;
4166737Srrh 				spk=113+prop[door];
4176737Srrh 				goto l2011;
4186737Srrh 			}
4196737Srrh 			spk=112;
4206737Srrh 			if (obj!=water) goto l2011;
4216737Srrh 			pspeak(plant,prop[plant]+1);
4226737Srrh 			prop[plant]=(prop[plant]+2)% 6;
4236737Srrh 			prop[plant2]=prop[plant]/2;
4246737Srrh 			k=null;
4256737Srrh 			goto l8;
4266737Srrh 		    case 14:                    /* 9140 - eat           */
4276737Srrh 			if (obj==food) goto l8142;
4286737Srrh 			if (obj==bird||obj==snake||obj==clam||obj==oyster
4296737Srrh 			    ||obj==dwarf||obj==dragon||obj==troll
4306737Srrh 			    ||obj==bear) spk=71;
4316737Srrh 			goto l2011;
4326737Srrh 	l9150:      case 15:                    /* 9150 - drink         */
4336737Srrh 			if (obj==0&&liqloc(loc)!=water&&(liq(0)!=water
4346737Srrh 				||!here(bottle))) goto l8000;
4356737Srrh 			if (obj!=0&&obj!=water) spk=110;
4366737Srrh 			if (spk==110||liq(0)!=water||!here(bottle))
4376737Srrh 				goto l2011;
4386737Srrh 			prop[bottle]=1;
4396737Srrh 			place[water]=0;
4406737Srrh 			spk=74;
4416737Srrh 			goto l2011;
4426737Srrh 		    case 16:                    /* 9160: rub            */
4436737Srrh 			if (obj!=lamp) spk=76;
4446737Srrh 			goto l2011;
4456737Srrh 		    case 17:                    /* 9170: throw          */
4466737Srrh 			switch(trtoss())
4476737Srrh 			{   case 2011: goto l2011;
4486737Srrh 			    case 9020: goto l9020;
4496737Srrh 			    case 9120: goto l9120;
4506737Srrh 			    case 8: goto l8;
4516737Srrh 			    case 9210: goto l9210;
4526737Srrh 			    default: bug(113);
4536737Srrh 			}
4546737Srrh 		    case 19: case 20:           /* 9190: find, invent   */
4556737Srrh 			if (at(obj)||(liq(0)==obj&&at(bottle))
4566737Srrh 				||k==liqloc(loc)) spk=94;
4576737Srrh 			for (i=1; i<=5; i++)
4586737Srrh 				if (dloc[i]==loc&&dflag>=2&&obj==dwarf)
4596737Srrh 					spk=94;
4606737Srrh 			if (closed) spk=138;
4616737Srrh 			if (toting(obj)) spk=24;
4626737Srrh 			goto l2011;
4636737Srrh 	l9210:      case 21:                    /* feed                 */
4646737Srrh 			switch(trfeed())
4656737Srrh 			{   case 2011: goto l2011;
4666737Srrh 			    default: bug(114);
4676737Srrh 			}
4686737Srrh 	l9220:      case 22:                    /* fill                 */
4696737Srrh 			switch(trfill())
4706737Srrh 			{   case 2011: goto l2011;
4716737Srrh 			    case 8000: goto l8000;
4726737Srrh 			    case 9020: goto l9020;
4736737Srrh 			    default: bug(115);
4746737Srrh 			}
4756737Srrh 	l9230:      case 23:                    /* blast                */
4766737Srrh 			if (prop[rod2]<0||!closed) goto l2011;
4776737Srrh 			bonus=133;
4786737Srrh 			if (loc==115) bonus=134;
4796737Srrh 			if (here(rod2)) bonus=135;
4806737Srrh 			rspeak(bonus);
4816737Srrh 			done(2);
4826737Srrh 	l9270:      case 27:                    /* read                 */
4836737Srrh 			if (dark(0)) goto l5190;
4846737Srrh 			if (obj==magzin) spk=190;
4856737Srrh 			if (obj==tablet) spk=196;
4866737Srrh 			if (obj==messag) spk=191;
4876737Srrh 			if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194;
4886737Srrh 			if (obj!=oyster||hinted[2]||!toting(oyster)
4896737Srrh 				||!closed) goto l2011;
4906737Srrh 			hinted[2]=yes(192,193,54);
4916737Srrh 			goto l2012;
4926737Srrh 	l9280:      case 28:                    /* break                */
4936737Srrh 			if (obj==mirror) spk=148;
4946737Srrh 			if (obj==vase&&prop[vase]==0)
4956737Srrh 			{       spk=198;
4966737Srrh 				if (toting(vase)) drop(vase,loc);
4976737Srrh 				prop[vase]=2;
4986737Srrh 				fixed[vase]= -1;
4996737Srrh 				goto l2011;
5006737Srrh 			}
5016737Srrh 			if (obj!=mirror||!closed) goto l2011;
5026737Srrh 			rspeak(197);
5036737Srrh 			done(3);
5046737Srrh 
5056737Srrh 	l9290:      case 29:                    /* wake                 */
5066737Srrh 			if (obj!=dwarf||!closed) goto l2011;
5076737Srrh 			rspeak(199);
5086737Srrh 			done(3);
5096737Srrh 
5106737Srrh 		    default: bug(24);
5116737Srrh 		}
5126737Srrh 
5136737Srrh 	l5000:
5146737Srrh 		obj=k;
5156737Srrh 		if (fixed[k]!=loc && !here(k)) goto l5100;
5166737Srrh 	l5010:  if (*wd2!=0) goto l2800;
5176737Srrh 		if (verb!=0) goto l4090;
5186737Srrh 		printf("What do you want to do with the %s?\n",wd1);
5196737Srrh 		goto l2600;
5206737Srrh 	l5100:  if (k!=grate) goto l5110;
5216737Srrh 		if (loc==1||loc==4||loc==7) k=dprssn;
5226737Srrh 		if (loc>9&&loc<15) k=entrnc;
5236737Srrh 		if (k!=grate) goto l8;
5246737Srrh 	l5110:  if (k!=dwarf) goto l5120;
5256737Srrh 		for (i=1; i<=5; i++)
5266737Srrh 			if (dloc[i]==loc&&dflag>=2) goto l5010;
5276737Srrh 	l5120:  if ((liq(0)==k&&here(bottle))||k==liqloc(loc)) goto l5010;
5286737Srrh 		if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130;
5296737Srrh 		obj=plant2;
5306737Srrh 		goto l5010;
5316737Srrh 	l5130:  if (obj!=knife||knfloc!=loc) goto l5140;
5326737Srrh 		knfloc = -1;
5336737Srrh 		spk=116;
5346737Srrh 		goto l2011;
5356737Srrh 	l5140:  if (obj!=rod||!here(rod2)) goto l5190;
5366737Srrh 		obj=rod2;
5376737Srrh 		goto l5010;
5386737Srrh 	l5190:  if ((verb==find||verb==invent)&&*wd2==0) goto l5010;
5396737Srrh 		printf("I see no %s here\n",wd1);
5406737Srrh 		goto l2012;
5416737Srrh 	}
5426737Srrh }
5436737Srrh 
544