main.c revision 1.6 1 1.6 christos /* $NetBSD: main.c,v 1.6 1997/08/11 14:06:16 christos Exp $ */
2 1.2 cgd
3 1.1 jtc /*-
4 1.1 jtc * Copyright (c) 1991, 1993
5 1.1 jtc * The Regents of the University of California. All rights reserved.
6 1.1 jtc *
7 1.1 jtc * The game adventure was originally written in Fortran by Will Crowther
8 1.1 jtc * and Don Woods. It was later translated to C and enhanced by Jim
9 1.1 jtc * Gillogly. This code is derived from software contributed to Berkeley
10 1.1 jtc * by Jim Gillogly at The Rand Corporation.
11 1.1 jtc *
12 1.1 jtc * Redistribution and use in source and binary forms, with or without
13 1.1 jtc * modification, are permitted provided that the following conditions
14 1.1 jtc * are met:
15 1.1 jtc * 1. Redistributions of source code must retain the above copyright
16 1.1 jtc * notice, this list of conditions and the following disclaimer.
17 1.1 jtc * 2. Redistributions in binary form must reproduce the above copyright
18 1.1 jtc * notice, this list of conditions and the following disclaimer in the
19 1.1 jtc * documentation and/or other materials provided with the distribution.
20 1.1 jtc * 3. All advertising materials mentioning features or use of this software
21 1.1 jtc * must display the following acknowledgement:
22 1.1 jtc * This product includes software developed by the University of
23 1.1 jtc * California, Berkeley and its contributors.
24 1.1 jtc * 4. Neither the name of the University nor the names of its contributors
25 1.1 jtc * may be used to endorse or promote products derived from this software
26 1.1 jtc * without specific prior written permission.
27 1.1 jtc *
28 1.1 jtc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 1.1 jtc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 1.1 jtc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 1.1 jtc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 1.1 jtc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 1.1 jtc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 1.1 jtc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 1.1 jtc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 1.1 jtc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 1.1 jtc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 1.1 jtc * SUCH DAMAGE.
39 1.1 jtc */
40 1.1 jtc
41 1.6 christos #include <sys/cdefs.h>
42 1.1 jtc #ifndef lint
43 1.6 christos __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
44 1.6 christos The Regents of the University of California. All rights reserved.\n");
45 1.1 jtc #endif /* not lint */
46 1.1 jtc
47 1.1 jtc #ifndef lint
48 1.2 cgd #if 0
49 1.1 jtc static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
50 1.2 cgd #else
51 1.6 christos __RCSID("$NetBSD: main.c,v 1.6 1997/08/11 14:06:16 christos Exp $");
52 1.2 cgd #endif
53 1.1 jtc #endif /* not lint */
54 1.1 jtc
55 1.1 jtc /* Re-coding of advent in C: main program */
56 1.1 jtc
57 1.1 jtc #include <sys/file.h>
58 1.5 mrg #include <signal.h>
59 1.1 jtc #include <stdio.h>
60 1.6 christos #include <unistd.h>
61 1.1 jtc #include "hdr.h"
62 1.6 christos #include "extern.h"
63 1.1 jtc
64 1.6 christos int
65 1.1 jtc main(argc,argv)
66 1.1 jtc int argc;
67 1.1 jtc char **argv;
68 1.1 jtc {
69 1.1 jtc register int i;
70 1.1 jtc int rval,ll;
71 1.1 jtc struct text *kk;
72 1.1 jtc
73 1.4 mrg /* adventure doesn't need setuid-ness, so, just get rid of it */
74 1.4 mrg if (setuid(getuid()) < 0)
75 1.4 mrg perror("setuid");
76 1.4 mrg
77 1.6 christos init(NULL); /* Initialize everything */
78 1.4 mrg signal(SIGINT,trapdel);
79 1.1 jtc
80 1.1 jtc if (argc > 1) /* Restore file specified */
81 1.1 jtc { /* Restart is label 8305 (Fortran) */
82 1.1 jtc i = restore(argv[1]); /* See what we've got */
83 1.1 jtc switch(i)
84 1.1 jtc {
85 1.1 jtc case 0: /* The restore worked fine */
86 1.1 jtc yea=Start(0);
87 1.1 jtc k=null;
88 1.1 jtc unlink(argv[1]);/* Don't re-use the save */
89 1.1 jtc goto l8; /* Get where we're going */
90 1.1 jtc case 1: /* Couldn't open it */
91 1.1 jtc exit(0); /* So give up */
92 1.1 jtc case 2: /* Oops -- file was altered */
93 1.1 jtc rspeak(202); /* You dissolve */
94 1.1 jtc exit(0); /* File could be non-adventure */
95 1.1 jtc } /* So don't unlink it. */
96 1.1 jtc }
97 1.1 jtc
98 1.1 jtc startup(); /* prepare for a user */
99 1.1 jtc
100 1.1 jtc for (;;) /* main command loop (label 2) */
101 1.1 jtc { if (newloc<9 && newloc!=0 && closng)
102 1.1 jtc { rspeak(130); /* if closing leave only by */
103 1.1 jtc newloc=loc; /* main office */
104 1.1 jtc if (!panic) clock2=15;
105 1.1 jtc panic=TRUE;
106 1.1 jtc }
107 1.1 jtc
108 1.1 jtc rval=fdwarf(); /* dwarf stuff */
109 1.1 jtc if (rval==99) die(99);
110 1.1 jtc
111 1.1 jtc l2000: if (loc==0) die(99); /* label 2000 */
112 1.1 jtc kk = &stext[loc];
113 1.1 jtc if ((abb[loc]%abbnum)==0 || kk->seekadr==0)
114 1.1 jtc kk = <ext[loc];
115 1.1 jtc if (!forced(loc) && dark(0))
116 1.1 jtc { if (wzdark && pct(35))
117 1.1 jtc { die(90);
118 1.1 jtc goto l2000;
119 1.1 jtc }
120 1.1 jtc kk = &rtext[16];
121 1.1 jtc }
122 1.6 christos #if 0
123 1.6 christos l2001:
124 1.6 christos #endif
125 1.6 christos if (toting(bear)) rspeak(141); /* 2001 */
126 1.1 jtc speak(kk);
127 1.1 jtc k=1;
128 1.1 jtc if (forced(loc))
129 1.1 jtc goto l8;
130 1.1 jtc if (loc==33 && pct(25)&&!closng) rspeak(8);
131 1.1 jtc if (!dark(0))
132 1.1 jtc { abb[loc]++;
133 1.6 christos for (i=atloc[loc]; i!=0; i=links[i]) /*2004 */
134 1.1 jtc { obj=i;
135 1.1 jtc if (obj>100) obj -= 100;
136 1.1 jtc if (obj==steps && toting(nugget)) continue;
137 1.1 jtc if (prop[obj]<0)
138 1.1 jtc { if (closed) continue;
139 1.1 jtc prop[obj]=0;
140 1.1 jtc if (obj==rug||obj==chain)
141 1.1 jtc prop[obj]=1;
142 1.1 jtc tally--;
143 1.1 jtc if (tally==tally2 && tally != 0)
144 1.1 jtc if (limit>35) limit=35;
145 1.1 jtc }
146 1.1 jtc ll = prop[obj]; /* 2006 */
147 1.1 jtc if (obj==steps && loc==fixed[steps])
148 1.1 jtc ll = 1;
149 1.1 jtc pspeak(obj, ll);
150 1.1 jtc } /* 2008 */
151 1.1 jtc goto l2012;
152 1.1 jtc l2009: k=54; /* 2009 */
153 1.1 jtc l2010: spk=k;
154 1.1 jtc l2011: rspeak(spk);
155 1.1 jtc }
156 1.1 jtc l2012: verb=0; /* 2012 */
157 1.1 jtc obj=0;
158 1.1 jtc l2600: checkhints(); /* to 2600-2602 */
159 1.1 jtc if (closed)
160 1.1 jtc { if (prop[oyster]<0 && toting(oyster))
161 1.1 jtc pspeak(oyster,1);
162 1.1 jtc for (i=1; i<100; i++)
163 1.1 jtc if (toting(i)&&prop[i]<0) /*2604 */
164 1.1 jtc prop[i] = -1-prop[i];
165 1.1 jtc }
166 1.1 jtc wzdark=dark(0); /* 2605 */
167 1.1 jtc if (knfloc>0 && knfloc!=loc) knfloc=1;
168 1.1 jtc getin(&wd1,&wd2);
169 1.1 jtc if (delhit) /* user typed a DEL */
170 1.1 jtc { delhit=0; /* reset counter */
171 1.1 jtc copystr("quit",wd1); /* pretend he's quitting*/
172 1.1 jtc *wd2=0;
173 1.1 jtc }
174 1.1 jtc l2608: if ((foobar = -foobar)>0) foobar=0; /* 2608 */
175 1.1 jtc /* should check here for "magic mode" */
176 1.1 jtc turns++;
177 1.1 jtc if (demo && turns>=SHORT) done(1); /* to 13000 */
178 1.1 jtc
179 1.1 jtc if (verb==say && *wd2!=0) verb=0;
180 1.1 jtc if (verb==say)
181 1.1 jtc goto l4090;
182 1.1 jtc if (tally==0 && loc>=15 && loc!=33) clock1--;
183 1.1 jtc if (clock1==0)
184 1.1 jtc { closing(); /* to 10000 */
185 1.1 jtc goto l19999;
186 1.1 jtc }
187 1.1 jtc if (clock1<0) clock2--;
188 1.1 jtc if (clock2==0)
189 1.1 jtc { caveclose(); /* to 11000 */
190 1.1 jtc continue; /* back to 2 */
191 1.1 jtc }
192 1.1 jtc if (prop[lamp]==1) limit--;
193 1.1 jtc if (limit<=30 && here(batter) && prop[batter]==0
194 1.1 jtc && here(lamp))
195 1.1 jtc { rspeak(188); /* 12000 */
196 1.1 jtc prop[batter]=1;
197 1.1 jtc if (toting(batter)) drop(batter,loc);
198 1.1 jtc limit=limit+2500;
199 1.1 jtc lmwarn=FALSE;
200 1.1 jtc goto l19999;
201 1.1 jtc }
202 1.1 jtc if (limit==0)
203 1.1 jtc { limit = -1; /* 12400 */
204 1.1 jtc prop[lamp]=0;
205 1.1 jtc rspeak(184);
206 1.1 jtc goto l19999;
207 1.1 jtc }
208 1.1 jtc if (limit<0&&loc<=8)
209 1.1 jtc { rspeak(185); /* 12600 */
210 1.1 jtc gaveup=TRUE;
211 1.1 jtc done(2); /* to 20000 */
212 1.1 jtc }
213 1.1 jtc if (limit<=30)
214 1.1 jtc { if (lmwarn|| !here(lamp)) goto l19999; /*12200*/
215 1.1 jtc lmwarn=TRUE;
216 1.1 jtc spk=187;
217 1.1 jtc if (place[batter]==0) spk=183;
218 1.1 jtc if (prop[batter]==1) spk=189;
219 1.1 jtc rspeak(spk);
220 1.1 jtc }
221 1.1 jtc l19999: k=43;
222 1.1 jtc if (liqloc(loc)==water) k=70;
223 1.1 jtc if (weq(wd1,"enter") &&
224 1.1 jtc (weq(wd2,"strea")||weq(wd2,"water")))
225 1.1 jtc goto l2010;
226 1.1 jtc if (weq(wd1,"enter") && *wd2!=0) goto l2800;
227 1.1 jtc if ((!weq(wd1,"water")&&!weq(wd1,"oil"))
228 1.1 jtc || (!weq(wd2,"plant")&&!weq(wd2,"door")))
229 1.1 jtc goto l2610;
230 1.6 christos if (at(vocab(wd2,1,0))) copystr("pour",wd2);
231 1.1 jtc
232 1.1 jtc l2610: if (weq(wd1,"west"))
233 1.1 jtc if (++iwest==10) rspeak(17);
234 1.6 christos l2630: i=vocab(wd1,-1,0);
235 1.1 jtc if (i== -1)
236 1.1 jtc { spk=60; /* 3000 */
237 1.1 jtc if (pct(20)) spk=61;
238 1.1 jtc if (pct(20)) spk=13;
239 1.1 jtc rspeak(spk);
240 1.1 jtc goto l2600;
241 1.1 jtc }
242 1.1 jtc k=i%1000;
243 1.1 jtc kq=i/1000+1;
244 1.1 jtc switch(kq)
245 1.1 jtc { case 1: goto l8;
246 1.1 jtc case 2: goto l5000;
247 1.1 jtc case 3: goto l4000;
248 1.1 jtc case 4: goto l2010;
249 1.1 jtc default:
250 1.1 jtc printf("Error 22\n");
251 1.1 jtc exit(0);
252 1.1 jtc }
253 1.1 jtc
254 1.1 jtc l8:
255 1.1 jtc switch(march())
256 1.1 jtc { case 2: continue; /* i.e. goto l2 */
257 1.1 jtc case 99:
258 1.1 jtc switch(die(99))
259 1.1 jtc { case 2000: goto l2000;
260 1.1 jtc default: bug(111);
261 1.1 jtc }
262 1.1 jtc default: bug(110);
263 1.1 jtc }
264 1.1 jtc
265 1.1 jtc l2800: copystr(wd2,wd1);
266 1.1 jtc *wd2=0;
267 1.1 jtc goto l2610;
268 1.1 jtc
269 1.1 jtc l4000: verb=k;
270 1.1 jtc spk=actspk[verb];
271 1.1 jtc if (*wd2!=0 && verb!=say) goto l2800;
272 1.1 jtc if (verb==say) obj= *wd2;
273 1.1 jtc if (obj!=0) goto l4090;
274 1.6 christos #if 0
275 1.1 jtc l4080:
276 1.6 christos #endif
277 1.1 jtc switch(verb)
278 1.1 jtc { case 1: /* take = 8010 */
279 1.6 christos if (atloc[loc]==0||links[atloc[loc]]!=0) goto l8000;
280 1.1 jtc for (i=1; i<=5; i++)
281 1.1 jtc if (dloc[i]==loc&&dflag>=2) goto l8000;
282 1.1 jtc obj=atloc[loc];
283 1.1 jtc goto l9010;
284 1.1 jtc case 2: case 3: case 9: /* 8000 : drop,say,wave */
285 1.1 jtc case 10: case 16: case 17: /* calm,rub,toss */
286 1.1 jtc case 19: case 21: case 28: /* find,feed,break */
287 1.1 jtc case 29: /* wake */
288 1.1 jtc l8000: printf("%s what?\n",wd1);
289 1.1 jtc obj=0;
290 1.1 jtc goto l2600;
291 1.1 jtc case 4: case 6: /* 8040 open,lock */
292 1.1 jtc spk=28;
293 1.1 jtc if (here(clam)) obj=clam;
294 1.1 jtc if (here(oyster)) obj=oyster;
295 1.1 jtc if (at(door)) obj=door;
296 1.1 jtc if (at(grate)) obj=grate;
297 1.1 jtc if (obj!=0 && here(chain)) goto l8000;
298 1.1 jtc if (here(chain)) obj=chain;
299 1.1 jtc if (obj==0) goto l2011;
300 1.1 jtc goto l9040;
301 1.1 jtc case 5: goto l2009; /* nothing */
302 1.1 jtc case 7: goto l9070; /* on */
303 1.1 jtc case 8: goto l9080; /* off */
304 1.1 jtc case 11: goto l8000; /* walk */
305 1.1 jtc case 12: goto l9120; /* kill */
306 1.1 jtc case 13: goto l9130; /* pour */
307 1.1 jtc case 14: /* eat: 8140 */
308 1.1 jtc if (!here(food)) goto l8000;
309 1.1 jtc l8142: dstroy(food);
310 1.1 jtc spk=72;
311 1.1 jtc goto l2011;
312 1.1 jtc case 15: goto l9150; /* drink */
313 1.1 jtc case 18: /* quit: 8180 */
314 1.1 jtc gaveup=yes(22,54,54);
315 1.1 jtc if (gaveup) done(2); /* 8185 */
316 1.1 jtc goto l2012;
317 1.1 jtc case 20: /* invent=8200 */
318 1.1 jtc spk=98;
319 1.1 jtc for (i=1; i<=100; i++)
320 1.1 jtc { if (i!=bear && toting(i))
321 1.1 jtc { if (spk==98) rspeak(99);
322 1.1 jtc blklin=FALSE;
323 1.1 jtc pspeak(i,-1);
324 1.1 jtc blklin=TRUE;
325 1.1 jtc spk=0;
326 1.1 jtc }
327 1.1 jtc }
328 1.1 jtc if (toting(bear)) spk=141;
329 1.1 jtc goto l2011;
330 1.1 jtc case 22: goto l9220; /* fill */
331 1.1 jtc case 23: goto l9230; /* blast */
332 1.1 jtc case 24: /* score: 8240 */
333 1.1 jtc scorng=TRUE;
334 1.1 jtc printf("If you were to quit now, you would score");
335 1.1 jtc printf(" %d out of a possible ",score());
336 1.1 jtc printf("%d.",mxscor);
337 1.1 jtc scorng=FALSE;
338 1.1 jtc gaveup=yes(143,54,54);
339 1.1 jtc if (gaveup) done(2);
340 1.1 jtc goto l2012;
341 1.1 jtc case 25: /* foo: 8250 */
342 1.6 christos k=vocab(wd1,3,0);
343 1.1 jtc spk=42;
344 1.1 jtc if (foobar==1-k) goto l8252;
345 1.1 jtc if (foobar!=0) spk=151;
346 1.1 jtc goto l2011;
347 1.1 jtc l8252: foobar=k;
348 1.1 jtc if (k!=4) goto l2009;
349 1.1 jtc foobar=0;
350 1.1 jtc if (place[eggs]==plac[eggs]
351 1.1 jtc ||(toting(eggs)&&loc==plac[eggs])) goto l2011;
352 1.1 jtc if (place[eggs]==0&&place[troll]==0&&prop[troll]==0)
353 1.1 jtc prop[troll]=1;
354 1.1 jtc k=2;
355 1.1 jtc if (here(eggs)) k=1;
356 1.1 jtc if (loc==plac[eggs]) k=0;
357 1.1 jtc move(eggs,plac[eggs]);
358 1.1 jtc pspeak(eggs,k);
359 1.1 jtc goto l2012;
360 1.1 jtc case 26: /* brief=8260 */
361 1.1 jtc spk=156;
362 1.1 jtc abbnum=10000;
363 1.1 jtc detail=3;
364 1.1 jtc goto l2011;
365 1.1 jtc case 27: /* read=8270 */
366 1.1 jtc if (here(magzin)) obj=magzin;
367 1.1 jtc if (here(tablet)) obj=obj*100+tablet;
368 1.1 jtc if (here(messag)) obj=obj*100+messag;
369 1.1 jtc if (closed&&toting(oyster)) obj=oyster;
370 1.1 jtc if (obj>100||obj==0||dark(0)) goto l8000;
371 1.1 jtc goto l9270;
372 1.1 jtc case 30: /* suspend=8300 */
373 1.1 jtc spk=201;
374 1.1 jtc if (demo) goto l2011;
375 1.1 jtc printf("I can suspend your adventure for you so");
376 1.1 jtc printf(" you can resume later, but\n");
377 1.1 jtc printf("you will have to wait at least");
378 1.1 jtc printf(" %d minutes before continuing.",latncy);
379 1.1 jtc if (!yes(200,54,54)) goto l2012;
380 1.1 jtc datime(&saved,&savet);
381 1.1 jtc ciao(argv[0]); /* Do we quit? */
382 1.1 jtc continue; /* Maybe not */
383 1.1 jtc case 31: /* hours=8310 */
384 1.1 jtc printf("Colossal cave is closed 9am-5pm Mon ");
385 1.1 jtc printf("through Fri except holidays.\n");
386 1.1 jtc goto l2012;
387 1.1 jtc default: bug(23);
388 1.1 jtc }
389 1.1 jtc
390 1.1 jtc l4090:
391 1.1 jtc switch(verb)
392 1.1 jtc { case 1: /* take = 9010 */
393 1.1 jtc l9010: switch(trtake())
394 1.1 jtc { case 2011: goto l2011;
395 1.1 jtc case 9220: goto l9220;
396 1.1 jtc case 2009: goto l2009;
397 1.1 jtc case 2012: goto l2012;
398 1.1 jtc default: bug(102);
399 1.1 jtc }
400 1.1 jtc l9020: case 2: /* drop = 9020 */
401 1.1 jtc switch(trdrop())
402 1.1 jtc { case 2011: goto l2011;
403 1.1 jtc case 19000: done(3);
404 1.1 jtc case 2012: goto l2012;
405 1.1 jtc default: bug(105);
406 1.1 jtc }
407 1.6 christos #if 0
408 1.6 christos l9030:
409 1.6 christos #endif
410 1.6 christos case 3:
411 1.1 jtc switch(trsay())
412 1.1 jtc { case 2012: goto l2012;
413 1.1 jtc case 2630: goto l2630;
414 1.1 jtc default: bug(107);
415 1.1 jtc }
416 1.1 jtc l9040: case 4: case 6: /* open, close */
417 1.1 jtc switch(tropen())
418 1.1 jtc { case 2011: goto l2011;
419 1.1 jtc case 2010: goto l2010;
420 1.1 jtc default: bug(106);
421 1.1 jtc }
422 1.1 jtc case 5: goto l2009; /* nothing */
423 1.1 jtc case 7: /* on 9070 */
424 1.1 jtc l9070: if (!here(lamp)) goto l2011;
425 1.1 jtc spk=184;
426 1.1 jtc if (limit<0) goto l2011;
427 1.1 jtc prop[lamp]=1;
428 1.1 jtc rspeak(39);
429 1.1 jtc if (wzdark) goto l2000;
430 1.1 jtc goto l2012;
431 1.1 jtc
432 1.1 jtc case 8: /* off */
433 1.1 jtc l9080: if (!here(lamp)) goto l2011;
434 1.1 jtc prop[lamp]=0;
435 1.1 jtc rspeak(40);
436 1.1 jtc if (dark(0)) rspeak(16);
437 1.1 jtc goto l2012;
438 1.1 jtc
439 1.1 jtc case 9: /* wave */
440 1.1 jtc if ((!toting(obj))&&(obj!=rod||!toting(rod2)))
441 1.1 jtc spk=29;
442 1.1 jtc if (obj!=rod||!at(fissur)||!toting(obj)||closng)
443 1.1 jtc goto l2011;
444 1.1 jtc prop[fissur]=1-prop[fissur];
445 1.1 jtc pspeak(fissur,2-prop[fissur]);
446 1.1 jtc goto l2012;
447 1.1 jtc case 10: case 11: case 18: /* calm, walk, quit */
448 1.1 jtc case 24: case 25: case 26: /* score, foo, brief */
449 1.1 jtc case 30: case 31: /* suspend, hours */
450 1.1 jtc goto l2011;
451 1.1 jtc l9120: case 12: /* kill */
452 1.1 jtc switch(trkill())
453 1.1 jtc { case 8000: goto l8000;
454 1.1 jtc case 8: goto l8;
455 1.1 jtc case 2011: goto l2011;
456 1.1 jtc case 2608: goto l2608;
457 1.1 jtc case 19000: done(3);
458 1.1 jtc default: bug(112);
459 1.1 jtc }
460 1.1 jtc l9130: case 13: /* pour */
461 1.1 jtc if (obj==bottle||obj==0) obj=liq(0);
462 1.1 jtc if (obj==0) goto l8000;
463 1.1 jtc if (!toting(obj)) goto l2011;
464 1.1 jtc spk=78;
465 1.1 jtc if (obj!=oil&&obj!=water) goto l2011;
466 1.1 jtc prop[bottle]=1;
467 1.1 jtc place[obj]=0;
468 1.1 jtc spk=77;
469 1.1 jtc if (!(at(plant)||at(door))) goto l2011;
470 1.1 jtc if (at(door))
471 1.1 jtc { prop[door]=0; /* 9132 */
472 1.1 jtc if (obj==oil) prop[door]=1;
473 1.1 jtc spk=113+prop[door];
474 1.1 jtc goto l2011;
475 1.1 jtc }
476 1.1 jtc spk=112;
477 1.1 jtc if (obj!=water) goto l2011;
478 1.1 jtc pspeak(plant,prop[plant]+1);
479 1.1 jtc prop[plant]=(prop[plant]+2)% 6;
480 1.1 jtc prop[plant2]=prop[plant]/2;
481 1.1 jtc k=null;
482 1.1 jtc goto l8;
483 1.1 jtc case 14: /* 9140 - eat */
484 1.1 jtc if (obj==food) goto l8142;
485 1.1 jtc if (obj==bird||obj==snake||obj==clam||obj==oyster
486 1.1 jtc ||obj==dwarf||obj==dragon||obj==troll
487 1.1 jtc ||obj==bear) spk=71;
488 1.1 jtc goto l2011;
489 1.1 jtc l9150: case 15: /* 9150 - drink */
490 1.1 jtc if (obj==0&&liqloc(loc)!=water&&(liq(0)!=water
491 1.1 jtc ||!here(bottle))) goto l8000;
492 1.1 jtc if (obj!=0&&obj!=water) spk=110;
493 1.1 jtc if (spk==110||liq(0)!=water||!here(bottle))
494 1.1 jtc goto l2011;
495 1.1 jtc prop[bottle]=1;
496 1.1 jtc place[water]=0;
497 1.1 jtc spk=74;
498 1.1 jtc goto l2011;
499 1.1 jtc case 16: /* 9160: rub */
500 1.1 jtc if (obj!=lamp) spk=76;
501 1.1 jtc goto l2011;
502 1.1 jtc case 17: /* 9170: throw */
503 1.1 jtc switch(trtoss())
504 1.1 jtc { case 2011: goto l2011;
505 1.1 jtc case 9020: goto l9020;
506 1.1 jtc case 9120: goto l9120;
507 1.1 jtc case 8: goto l8;
508 1.1 jtc case 9210: goto l9210;
509 1.1 jtc default: bug(113);
510 1.1 jtc }
511 1.1 jtc case 19: case 20: /* 9190: find, invent */
512 1.1 jtc if (at(obj)||(liq(0)==obj&&at(bottle))
513 1.1 jtc ||k==liqloc(loc)) spk=94;
514 1.1 jtc for (i=1; i<=5; i++)
515 1.1 jtc if (dloc[i]==loc&&dflag>=2&&obj==dwarf)
516 1.1 jtc spk=94;
517 1.1 jtc if (closed) spk=138;
518 1.1 jtc if (toting(obj)) spk=24;
519 1.1 jtc goto l2011;
520 1.1 jtc l9210: case 21: /* feed */
521 1.1 jtc switch(trfeed())
522 1.1 jtc { case 2011: goto l2011;
523 1.1 jtc default: bug(114);
524 1.1 jtc }
525 1.1 jtc l9220: case 22: /* fill */
526 1.1 jtc switch(trfill())
527 1.1 jtc { case 2011: goto l2011;
528 1.1 jtc case 8000: goto l8000;
529 1.1 jtc case 9020: goto l9020;
530 1.1 jtc default: bug(115);
531 1.1 jtc }
532 1.1 jtc l9230: case 23: /* blast */
533 1.1 jtc if (prop[rod2]<0||!closed) goto l2011;
534 1.1 jtc bonus=133;
535 1.1 jtc if (loc==115) bonus=134;
536 1.1 jtc if (here(rod2)) bonus=135;
537 1.1 jtc rspeak(bonus);
538 1.1 jtc done(2);
539 1.1 jtc l9270: case 27: /* read */
540 1.1 jtc if (dark(0)) goto l5190;
541 1.1 jtc if (obj==magzin) spk=190;
542 1.1 jtc if (obj==tablet) spk=196;
543 1.1 jtc if (obj==messag) spk=191;
544 1.1 jtc if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194;
545 1.1 jtc if (obj!=oyster||hinted[2]||!toting(oyster)
546 1.1 jtc ||!closed) goto l2011;
547 1.1 jtc hinted[2]=yes(192,193,54);
548 1.1 jtc goto l2012;
549 1.6 christos #if 0
550 1.6 christos l9280:
551 1.6 christos #endif
552 1.6 christos case 28: /* break */
553 1.1 jtc if (obj==mirror) spk=148;
554 1.1 jtc if (obj==vase&&prop[vase]==0)
555 1.1 jtc { spk=198;
556 1.1 jtc if (toting(vase)) drop(vase,loc);
557 1.1 jtc prop[vase]=2;
558 1.1 jtc fixed[vase]= -1;
559 1.1 jtc goto l2011;
560 1.1 jtc }
561 1.1 jtc if (obj!=mirror||!closed) goto l2011;
562 1.1 jtc rspeak(197);
563 1.1 jtc done(3);
564 1.6 christos #if 0
565 1.6 christos l9290:
566 1.6 christos #endif
567 1.6 christos case 29: /* wake */
568 1.1 jtc if (obj!=dwarf||!closed) goto l2011;
569 1.1 jtc rspeak(199);
570 1.1 jtc done(3);
571 1.1 jtc
572 1.1 jtc default: bug(24);
573 1.1 jtc }
574 1.1 jtc
575 1.1 jtc l5000:
576 1.1 jtc obj=k;
577 1.1 jtc if (fixed[k]!=loc && !here(k)) goto l5100;
578 1.1 jtc l5010: if (*wd2!=0) goto l2800;
579 1.1 jtc if (verb!=0) goto l4090;
580 1.1 jtc printf("What do you want to do with the %s?\n",wd1);
581 1.1 jtc goto l2600;
582 1.1 jtc l5100: if (k!=grate) goto l5110;
583 1.1 jtc if (loc==1||loc==4||loc==7) k=dprssn;
584 1.1 jtc if (loc>9&&loc<15) k=entrnc;
585 1.1 jtc if (k!=grate) goto l8;
586 1.1 jtc l5110: if (k!=dwarf) goto l5120;
587 1.1 jtc for (i=1; i<=5; i++)
588 1.1 jtc if (dloc[i]==loc&&dflag>=2) goto l5010;
589 1.1 jtc l5120: if ((liq(0)==k&&here(bottle))||k==liqloc(loc)) goto l5010;
590 1.1 jtc if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130;
591 1.1 jtc obj=plant2;
592 1.1 jtc goto l5010;
593 1.1 jtc l5130: if (obj!=knife||knfloc!=loc) goto l5140;
594 1.1 jtc knfloc = -1;
595 1.1 jtc spk=116;
596 1.1 jtc goto l2011;
597 1.1 jtc l5140: if (obj!=rod||!here(rod2)) goto l5190;
598 1.1 jtc obj=rod2;
599 1.1 jtc goto l5010;
600 1.1 jtc l5190: if ((verb==find||verb==invent)&&*wd2==0) goto l5010;
601 1.1 jtc printf("I see no %s here\n",wd1);
602 1.1 jtc goto l2012;
603 1.1 jtc }
604 1.1 jtc }
605