main.c revision 1.13 1 1.13 hubertf /* $NetBSD: main.c,v 1.13 1999/02/10 00:29:21 hubertf 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.13 hubertf __RCSID("$NetBSD: main.c,v 1.13 1999/02/10 00:29:21 hubertf Exp $");
52 1.2 cgd #endif
53 1.1 jtc #endif /* not lint */
54 1.1 jtc
55 1.8 lukem /* Re-coding of advent in C: main program */
56 1.1 jtc
57 1.1 jtc #include <sys/file.h>
58 1.8 lukem #include <err.h>
59 1.5 mrg #include <signal.h>
60 1.1 jtc #include <stdio.h>
61 1.6 christos #include <unistd.h>
62 1.1 jtc #include "hdr.h"
63 1.6 christos #include "extern.h"
64 1.10 hubertf
65 1.10 hubertf int main __P((int, char **));
66 1.1 jtc
67 1.6 christos int
68 1.8 lukem main(argc, argv)
69 1.8 lukem int argc;
70 1.8 lukem char **argv;
71 1.1 jtc {
72 1.8 lukem int i;
73 1.8 lukem int rval, ll;
74 1.1 jtc struct text *kk;
75 1.1 jtc
76 1.13 hubertf /* revoke setgid privileges from dm */
77 1.13 hubertf setregid(getgid(), getgid());
78 1.4 mrg
79 1.9 hubertf init(); /* Initialize everything */
80 1.8 lukem signal(SIGINT, trapdel);
81 1.1 jtc
82 1.8 lukem if (argc > 1) { /* Restore file specified */
83 1.8 lukem /* Restart is label 8305 (Fortran) */
84 1.8 lukem i = restore(argv[1]); /* See what we've got */
85 1.8 lukem switch (i) {
86 1.8 lukem case 0: /* The restore worked fine */
87 1.9 hubertf yea = Start();
88 1.8 lukem k = null;
89 1.8 lukem unlink(argv[1]); /* Don't re-use the save */
90 1.8 lukem goto l8; /* Get where we're going */
91 1.8 lukem case 1: /* Couldn't open it */
92 1.12 hubertf errx(1,"can't open file"); /* So give up */
93 1.8 lukem case 2: /* Oops -- file was altered */
94 1.8 lukem rspeak(202); /* You dissolve */
95 1.12 hubertf exit(1); /* File could be non-adventure */
96 1.8 lukem } /* So don't unlink it. */
97 1.1 jtc }
98 1.8 lukem startup(); /* prepare for a user */
99 1.1 jtc
100 1.8 lukem for (;;) { /* main command loop (label 2) */
101 1.8 lukem if (newloc < 9 && newloc != 0 && closng) {
102 1.8 lukem rspeak(130); /* if closing leave only by */
103 1.8 lukem newloc = loc; /* main office */
104 1.8 lukem if (!panic)
105 1.8 lukem clock2 = 15;
106 1.8 lukem panic = TRUE;
107 1.8 lukem }
108 1.8 lukem rval = fdwarf(); /* dwarf stuff */
109 1.8 lukem if (rval == 99)
110 1.8 lukem die(99);
111 1.1 jtc
112 1.8 lukem l2000: if (loc == 0)
113 1.8 lukem die(99); /* label 2000 */
114 1.1 jtc kk = &stext[loc];
115 1.8 lukem if ((abb[loc] % abbnum) == 0 || kk->seekadr == 0)
116 1.1 jtc kk = <ext[loc];
117 1.9 hubertf if (!forced(loc) && dark()) {
118 1.8 lukem if (wzdark && pct(35)) {
119 1.8 lukem die(90);
120 1.1 jtc goto l2000;
121 1.1 jtc }
122 1.1 jtc kk = &rtext[16];
123 1.1 jtc }
124 1.6 christos #if 0
125 1.8 lukem l2001:
126 1.6 christos #endif
127 1.8 lukem if (toting(bear))
128 1.8 lukem rspeak(141); /* 2001 */
129 1.1 jtc speak(kk);
130 1.8 lukem k = 1;
131 1.1 jtc if (forced(loc))
132 1.1 jtc goto l8;
133 1.8 lukem if (loc == 33 && pct(25) && !closng)
134 1.8 lukem rspeak(8);
135 1.9 hubertf if (!dark()) {
136 1.8 lukem abb[loc]++;
137 1.8 lukem for (i = atloc[loc]; i != 0; i = links[i]) { /* 2004 */
138 1.8 lukem obj = i;
139 1.8 lukem if (obj > 100)
140 1.8 lukem obj -= 100;
141 1.8 lukem if (obj == steps && toting(nugget))
142 1.8 lukem continue;
143 1.8 lukem if (prop[obj] < 0) {
144 1.8 lukem if (closed)
145 1.8 lukem continue;
146 1.8 lukem prop[obj] = 0;
147 1.8 lukem if (obj == rug || obj == chain)
148 1.8 lukem prop[obj] = 1;
149 1.1 jtc tally--;
150 1.8 lukem if (tally == tally2 && tally != 0)
151 1.8 lukem if (limit > 35)
152 1.8 lukem limit = 35;
153 1.1 jtc }
154 1.8 lukem ll = prop[obj]; /* 2006 */
155 1.8 lukem if (obj == steps && loc == fixed[steps])
156 1.1 jtc ll = 1;
157 1.1 jtc pspeak(obj, ll);
158 1.8 lukem } /* 2008 */
159 1.1 jtc goto l2012;
160 1.8 lukem l2009: k = 54; /* 2009 */
161 1.8 lukem l2010: spk = k;
162 1.8 lukem l2011: rspeak(spk);
163 1.8 lukem }
164 1.8 lukem l2012: verb = 0; /* 2012 */
165 1.8 lukem obj = 0;
166 1.8 lukem l2600: checkhints(); /* to 2600-2602 */
167 1.8 lukem if (closed) {
168 1.8 lukem if (prop[oyster] < 0 && toting(oyster))
169 1.8 lukem pspeak(oyster, 1);
170 1.8 lukem for (i = 1; i < 100; i++)
171 1.8 lukem if (toting(i) && prop[i] < 0) /* 2604 */
172 1.8 lukem prop[i] = -1 - prop[i];
173 1.8 lukem }
174 1.9 hubertf wzdark = dark(); /* 2605 */
175 1.8 lukem if (knfloc > 0 && knfloc != loc)
176 1.8 lukem knfloc = 1;
177 1.8 lukem getin(&wd1, &wd2);
178 1.8 lukem if (delhit) { /* user typed a DEL */
179 1.8 lukem delhit = 0; /* reset counter */
180 1.8 lukem copystr("quit", wd1); /* pretend he's quitting */
181 1.8 lukem *wd2 = 0;
182 1.8 lukem }
183 1.8 lukem l2608: if ((foobar = -foobar) > 0)
184 1.8 lukem foobar = 0; /* 2608 */
185 1.8 lukem /* should check here for "magic mode" */
186 1.1 jtc turns++;
187 1.8 lukem if (demo && turns >= SHORT)
188 1.8 lukem done(1); /* to 13000 */
189 1.1 jtc
190 1.8 lukem if (verb == say && *wd2 != 0)
191 1.8 lukem verb = 0;
192 1.8 lukem if (verb == say)
193 1.1 jtc goto l4090;
194 1.8 lukem if (tally == 0 && loc >= 15 && loc != 33)
195 1.8 lukem clock1--;
196 1.8 lukem if (clock1 == 0) {
197 1.8 lukem closing(); /* to 10000 */
198 1.1 jtc goto l19999;
199 1.1 jtc }
200 1.8 lukem if (clock1 < 0)
201 1.8 lukem clock2--;
202 1.8 lukem if (clock2 == 0) {
203 1.8 lukem caveclose(); /* to 11000 */
204 1.8 lukem continue; /* back to 2 */
205 1.8 lukem }
206 1.8 lukem if (prop[lamp] == 1)
207 1.8 lukem limit--;
208 1.8 lukem if (limit <= 30 && here(batter) && prop[batter] == 0
209 1.8 lukem && here(lamp)) {
210 1.8 lukem rspeak(188); /* 12000 */
211 1.8 lukem prop[batter] = 1;
212 1.8 lukem if (toting(batter))
213 1.8 lukem drop(batter, loc);
214 1.8 lukem limit = limit + 2500;
215 1.8 lukem lmwarn = FALSE;
216 1.1 jtc goto l19999;
217 1.1 jtc }
218 1.8 lukem if (limit == 0) {
219 1.8 lukem limit = -1; /* 12400 */
220 1.8 lukem prop[lamp] = 0;
221 1.1 jtc rspeak(184);
222 1.1 jtc goto l19999;
223 1.1 jtc }
224 1.8 lukem if (limit < 0 && loc <= 8) {
225 1.8 lukem rspeak(185); /* 12600 */
226 1.8 lukem gaveup = TRUE;
227 1.8 lukem done(2); /* to 20000 */
228 1.8 lukem }
229 1.8 lukem if (limit <= 30) {
230 1.8 lukem if (lmwarn || !here(lamp))
231 1.8 lukem goto l19999; /* 12200 */
232 1.8 lukem lmwarn = TRUE;
233 1.8 lukem spk = 187;
234 1.8 lukem if (place[batter] == 0)
235 1.8 lukem spk = 183;
236 1.8 lukem if (prop[batter] == 1)
237 1.8 lukem spk = 189;
238 1.1 jtc rspeak(spk);
239 1.1 jtc }
240 1.8 lukem l19999: k = 43;
241 1.8 lukem if (liqloc(loc) == water)
242 1.8 lukem k = 70;
243 1.8 lukem if (weq(wd1, "enter") &&
244 1.8 lukem (weq(wd2, "strea") || weq(wd2, "water")))
245 1.1 jtc goto l2010;
246 1.8 lukem if (weq(wd1, "enter") && *wd2 != 0)
247 1.8 lukem goto l2800;
248 1.8 lukem if ((!weq(wd1, "water") && !weq(wd1, "oil"))
249 1.8 lukem || (!weq(wd2, "plant") && !weq(wd2, "door")))
250 1.1 jtc goto l2610;
251 1.8 lukem if (at(vocab(wd2, 1, 0)))
252 1.8 lukem copystr("pour", wd2);
253 1.1 jtc
254 1.8 lukem l2610: if (weq(wd1, "west"))
255 1.8 lukem if (++iwest == 10)
256 1.8 lukem rspeak(17);
257 1.8 lukem l2630: i = vocab(wd1, -1, 0);
258 1.8 lukem if (i == -1) {
259 1.8 lukem spk = 60; /* 3000 */
260 1.8 lukem if (pct(20))
261 1.8 lukem spk = 61;
262 1.8 lukem if (pct(20))
263 1.8 lukem spk = 13;
264 1.1 jtc rspeak(spk);
265 1.1 jtc goto l2600;
266 1.1 jtc }
267 1.8 lukem k = i % 1000;
268 1.8 lukem kq = i / 1000 + 1;
269 1.8 lukem switch (kq) {
270 1.8 lukem case 1:
271 1.8 lukem goto l8;
272 1.8 lukem case 2:
273 1.8 lukem goto l5000;
274 1.8 lukem case 3:
275 1.8 lukem goto l4000;
276 1.8 lukem case 4:
277 1.8 lukem goto l2010;
278 1.8 lukem default:
279 1.12 hubertf bug(22);
280 1.1 jtc }
281 1.1 jtc
282 1.8 lukem l8:
283 1.8 lukem switch (march()) {
284 1.8 lukem case 2:
285 1.8 lukem continue; /* i.e. goto l2 */
286 1.8 lukem case 99:
287 1.11 hubertf die(99);
288 1.11 hubertf goto l2000;
289 1.8 lukem default:
290 1.8 lukem bug(110);
291 1.1 jtc }
292 1.1 jtc
293 1.8 lukem l2800: copystr(wd2, wd1);
294 1.8 lukem *wd2 = 0;
295 1.1 jtc goto l2610;
296 1.1 jtc
297 1.8 lukem l4000: verb = k;
298 1.8 lukem spk = actspk[verb];
299 1.8 lukem if (*wd2 != 0 && verb != say)
300 1.8 lukem goto l2800;
301 1.8 lukem if (verb == say)
302 1.8 lukem obj = *wd2;
303 1.8 lukem if (obj != 0)
304 1.8 lukem goto l4090;
305 1.6 christos #if 0
306 1.8 lukem l4080:
307 1.6 christos #endif
308 1.8 lukem switch (verb) {
309 1.8 lukem case 1: /* take = 8010 */
310 1.8 lukem if (atloc[loc] == 0 || links[atloc[loc]] != 0)
311 1.8 lukem goto l8000;
312 1.8 lukem for (i = 1; i <= 5; i++)
313 1.8 lukem if (dloc[i] == loc && dflag >= 2)
314 1.8 lukem goto l8000;
315 1.8 lukem obj = atloc[loc];
316 1.1 jtc goto l9010;
317 1.8 lukem case 2:
318 1.8 lukem case 3:
319 1.8 lukem case 9: /* 8000 : drop,say,wave */
320 1.8 lukem case 10:
321 1.8 lukem case 16:
322 1.8 lukem case 17: /* calm,rub,toss */
323 1.8 lukem case 19:
324 1.8 lukem case 21:
325 1.8 lukem case 28: /* find,feed,break */
326 1.8 lukem case 29: /* wake */
327 1.8 lukem l8000: printf("%s what?\n", wd1);
328 1.8 lukem obj = 0;
329 1.1 jtc goto l2600;
330 1.8 lukem case 4:
331 1.8 lukem case 6: /* 8040 open,lock */
332 1.8 lukem spk = 28;
333 1.8 lukem if (here(clam))
334 1.8 lukem obj = clam;
335 1.8 lukem if (here(oyster))
336 1.8 lukem obj = oyster;
337 1.8 lukem if (at(door))
338 1.8 lukem obj = door;
339 1.8 lukem if (at(grate))
340 1.8 lukem obj = grate;
341 1.8 lukem if (obj != 0 && here(chain))
342 1.8 lukem goto l8000;
343 1.8 lukem if (here(chain))
344 1.8 lukem obj = chain;
345 1.8 lukem if (obj == 0)
346 1.8 lukem goto l2011;
347 1.1 jtc goto l9040;
348 1.8 lukem case 5:
349 1.8 lukem goto l2009; /* nothing */
350 1.8 lukem case 7:
351 1.8 lukem goto l9070; /* on */
352 1.8 lukem case 8:
353 1.8 lukem goto l9080; /* off */
354 1.8 lukem case 11:
355 1.8 lukem goto l8000; /* walk */
356 1.8 lukem case 12:
357 1.8 lukem goto l9120; /* kill */
358 1.8 lukem case 13:
359 1.8 lukem goto l9130; /* pour */
360 1.8 lukem case 14: /* eat: 8140 */
361 1.8 lukem if (!here(food))
362 1.8 lukem goto l8000;
363 1.8 lukem l8142: dstroy(food);
364 1.8 lukem spk = 72;
365 1.1 jtc goto l2011;
366 1.8 lukem case 15:
367 1.8 lukem goto l9150; /* drink */
368 1.8 lukem case 18: /* quit: 8180 */
369 1.8 lukem gaveup = yes(22, 54, 54);
370 1.8 lukem if (gaveup)
371 1.8 lukem done(2); /* 8185 */
372 1.1 jtc goto l2012;
373 1.8 lukem case 20: /* invent=8200 */
374 1.8 lukem spk = 98;
375 1.8 lukem for (i = 1; i <= 100; i++) {
376 1.8 lukem if (i != bear && toting(i)) {
377 1.8 lukem if (spk == 98)
378 1.8 lukem rspeak(99);
379 1.8 lukem blklin = FALSE;
380 1.8 lukem pspeak(i, -1);
381 1.8 lukem blklin = TRUE;
382 1.8 lukem spk = 0;
383 1.1 jtc }
384 1.1 jtc }
385 1.8 lukem if (toting(bear))
386 1.8 lukem spk = 141;
387 1.1 jtc goto l2011;
388 1.8 lukem case 22:
389 1.8 lukem goto l9220; /* fill */
390 1.8 lukem case 23:
391 1.8 lukem goto l9230; /* blast */
392 1.8 lukem case 24: /* score: 8240 */
393 1.8 lukem scorng = TRUE;
394 1.1 jtc printf("If you were to quit now, you would score");
395 1.8 lukem printf(" %d out of a possible ", score());
396 1.8 lukem printf("%d.", mxscor);
397 1.8 lukem scorng = FALSE;
398 1.8 lukem gaveup = yes(143, 54, 54);
399 1.8 lukem if (gaveup)
400 1.8 lukem done(2);
401 1.1 jtc goto l2012;
402 1.8 lukem case 25: /* foo: 8250 */
403 1.8 lukem k = vocab(wd1, 3, 0);
404 1.8 lukem spk = 42;
405 1.8 lukem if (foobar == 1 - k)
406 1.8 lukem goto l8252;
407 1.8 lukem if (foobar != 0)
408 1.8 lukem spk = 151;
409 1.1 jtc goto l2011;
410 1.8 lukem l8252: foobar = k;
411 1.8 lukem if (k != 4)
412 1.8 lukem goto l2009;
413 1.8 lukem foobar = 0;
414 1.8 lukem if (place[eggs] == plac[eggs]
415 1.8 lukem || (toting(eggs) && loc == plac[eggs]))
416 1.8 lukem goto l2011;
417 1.8 lukem if (place[eggs] == 0 && place[troll] == 0 && prop[troll] == 0)
418 1.8 lukem prop[troll] = 1;
419 1.8 lukem k = 2;
420 1.8 lukem if (here(eggs))
421 1.8 lukem k = 1;
422 1.8 lukem if (loc == plac[eggs])
423 1.8 lukem k = 0;
424 1.8 lukem move(eggs, plac[eggs]);
425 1.8 lukem pspeak(eggs, k);
426 1.1 jtc goto l2012;
427 1.8 lukem case 26: /* brief=8260 */
428 1.8 lukem spk = 156;
429 1.8 lukem abbnum = 10000;
430 1.8 lukem detail = 3;
431 1.1 jtc goto l2011;
432 1.8 lukem case 27: /* read=8270 */
433 1.8 lukem if (here(magzin))
434 1.8 lukem obj = magzin;
435 1.8 lukem if (here(tablet))
436 1.8 lukem obj = obj * 100 + tablet;
437 1.8 lukem if (here(messag))
438 1.8 lukem obj = obj * 100 + messag;
439 1.8 lukem if (closed && toting(oyster))
440 1.8 lukem obj = oyster;
441 1.9 hubertf if (obj > 100 || obj == 0 || dark())
442 1.8 lukem goto l8000;
443 1.1 jtc goto l9270;
444 1.8 lukem case 30: /* suspend=8300 */
445 1.8 lukem spk = 201;
446 1.8 lukem if (demo)
447 1.8 lukem goto l2011;
448 1.1 jtc printf("I can suspend your adventure for you so");
449 1.1 jtc printf(" you can resume later, but\n");
450 1.1 jtc printf("you will have to wait at least");
451 1.8 lukem printf(" %d minutes before continuing.", latncy);
452 1.8 lukem if (!yes(200, 54, 54))
453 1.8 lukem goto l2012;
454 1.8 lukem datime(&saved, &savet);
455 1.9 hubertf ciao(); /* Do we quit? */
456 1.8 lukem continue; /* Maybe not */
457 1.8 lukem case 31: /* hours=8310 */
458 1.1 jtc printf("Colossal cave is closed 9am-5pm Mon ");
459 1.1 jtc printf("through Fri except holidays.\n");
460 1.1 jtc goto l2012;
461 1.8 lukem default:
462 1.8 lukem bug(23);
463 1.1 jtc }
464 1.1 jtc
465 1.8 lukem l4090:
466 1.8 lukem switch (verb) {
467 1.8 lukem case 1: /* take = 9010 */
468 1.8 lukem l9010: switch (trtake()) {
469 1.8 lukem case 2011:
470 1.8 lukem goto l2011;
471 1.8 lukem case 9220:
472 1.8 lukem goto l9220;
473 1.8 lukem case 2009:
474 1.8 lukem goto l2009;
475 1.8 lukem case 2012:
476 1.8 lukem goto l2012;
477 1.8 lukem default:
478 1.8 lukem bug(102);
479 1.8 lukem }
480 1.8 lukem l9020: case 2: /* drop = 9020 */
481 1.8 lukem switch (trdrop()) {
482 1.8 lukem case 2011:
483 1.8 lukem goto l2011;
484 1.8 lukem case 19000:
485 1.8 lukem done(3);
486 1.8 lukem case 2012:
487 1.8 lukem goto l2012;
488 1.8 lukem default:
489 1.8 lukem bug(105);
490 1.1 jtc }
491 1.6 christos #if 0
492 1.6 christos l9030:
493 1.6 christos #endif
494 1.8 lukem case 3:
495 1.8 lukem switch (trsay()) {
496 1.8 lukem case 2012:
497 1.8 lukem goto l2012;
498 1.8 lukem case 2630:
499 1.8 lukem goto l2630;
500 1.8 lukem default:
501 1.8 lukem bug(107);
502 1.8 lukem }
503 1.8 lukem l9040: case 4:
504 1.8 lukem case 6: /* open, close */
505 1.8 lukem switch (tropen()) {
506 1.8 lukem case 2011:
507 1.8 lukem goto l2011;
508 1.8 lukem case 2010:
509 1.8 lukem goto l2010;
510 1.8 lukem default:
511 1.8 lukem bug(106);
512 1.8 lukem }
513 1.8 lukem case 5:
514 1.8 lukem goto l2009; /* nothing */
515 1.8 lukem case 7: /* on 9070 */
516 1.8 lukem l9070: if (!here(lamp))
517 1.8 lukem goto l2011;
518 1.8 lukem spk = 184;
519 1.8 lukem if (limit < 0)
520 1.8 lukem goto l2011;
521 1.8 lukem prop[lamp] = 1;
522 1.1 jtc rspeak(39);
523 1.8 lukem if (wzdark)
524 1.8 lukem goto l2000;
525 1.1 jtc goto l2012;
526 1.1 jtc
527 1.8 lukem case 8: /* off */
528 1.8 lukem l9080: if (!here(lamp))
529 1.8 lukem goto l2011;
530 1.8 lukem prop[lamp] = 0;
531 1.1 jtc rspeak(40);
532 1.9 hubertf if (dark())
533 1.8 lukem rspeak(16);
534 1.1 jtc goto l2012;
535 1.1 jtc
536 1.8 lukem case 9: /* wave */
537 1.8 lukem if ((!toting(obj)) && (obj != rod || !toting(rod2)))
538 1.8 lukem spk = 29;
539 1.8 lukem if (obj != rod || !at(fissur) || !toting(obj) || closng)
540 1.1 jtc goto l2011;
541 1.8 lukem prop[fissur] = 1 - prop[fissur];
542 1.8 lukem pspeak(fissur, 2 - prop[fissur]);
543 1.1 jtc goto l2012;
544 1.8 lukem case 10:
545 1.8 lukem case 11:
546 1.8 lukem case 18: /* calm, walk, quit */
547 1.8 lukem case 24:
548 1.8 lukem case 25:
549 1.8 lukem case 26: /* score, foo, brief */
550 1.8 lukem case 30:
551 1.8 lukem case 31: /* suspend, hours */
552 1.8 lukem goto l2011;
553 1.8 lukem l9120: case 12:/* kill */
554 1.8 lukem switch (trkill()) {
555 1.8 lukem case 8000:
556 1.8 lukem goto l8000;
557 1.8 lukem case 8:
558 1.8 lukem goto l8;
559 1.8 lukem case 2011:
560 1.8 lukem goto l2011;
561 1.8 lukem case 2608:
562 1.8 lukem goto l2608;
563 1.8 lukem case 19000:
564 1.8 lukem done(3);
565 1.8 lukem default:
566 1.8 lukem bug(112);
567 1.8 lukem }
568 1.8 lukem l9130: case 13:/* pour */
569 1.8 lukem if (obj == bottle || obj == 0)
570 1.9 hubertf obj = liq();
571 1.8 lukem if (obj == 0)
572 1.8 lukem goto l8000;
573 1.8 lukem if (!toting(obj))
574 1.8 lukem goto l2011;
575 1.8 lukem spk = 78;
576 1.8 lukem if (obj != oil && obj != water)
577 1.8 lukem goto l2011;
578 1.8 lukem prop[bottle] = 1;
579 1.8 lukem place[obj] = 0;
580 1.8 lukem spk = 77;
581 1.8 lukem if (!(at(plant) || at(door)))
582 1.8 lukem goto l2011;
583 1.8 lukem if (at(door)) {
584 1.8 lukem prop[door] = 0; /* 9132 */
585 1.8 lukem if (obj == oil)
586 1.8 lukem prop[door] = 1;
587 1.8 lukem spk = 113 + prop[door];
588 1.1 jtc goto l2011;
589 1.1 jtc }
590 1.8 lukem spk = 112;
591 1.8 lukem if (obj != water)
592 1.8 lukem goto l2011;
593 1.8 lukem pspeak(plant, prop[plant] + 1);
594 1.8 lukem prop[plant] = (prop[plant] + 2) % 6;
595 1.8 lukem prop[plant2] = prop[plant] / 2;
596 1.8 lukem k = null;
597 1.1 jtc goto l8;
598 1.8 lukem case 14: /* 9140 - eat */
599 1.8 lukem if (obj == food)
600 1.8 lukem goto l8142;
601 1.8 lukem if (obj == bird || obj == snake || obj == clam || obj == oyster
602 1.8 lukem || obj == dwarf || obj == dragon || obj == troll
603 1.8 lukem || obj == bear)
604 1.8 lukem spk = 71;
605 1.1 jtc goto l2011;
606 1.8 lukem l9150: case 15:/* 9150 - drink */
607 1.9 hubertf if (obj == 0 && liqloc(loc) != water && (liq() != water
608 1.8 lukem || !here(bottle)))
609 1.8 lukem goto l8000;
610 1.8 lukem if (obj != 0 && obj != water)
611 1.8 lukem spk = 110;
612 1.9 hubertf if (spk == 110 || liq() != water || !here(bottle))
613 1.8 lukem goto l2011;
614 1.8 lukem prop[bottle] = 1;
615 1.8 lukem place[water] = 0;
616 1.8 lukem spk = 74;
617 1.1 jtc goto l2011;
618 1.8 lukem case 16: /* 9160: rub */
619 1.8 lukem if (obj != lamp)
620 1.8 lukem spk = 76;
621 1.1 jtc goto l2011;
622 1.8 lukem case 17: /* 9170: throw */
623 1.8 lukem switch (trtoss()) {
624 1.8 lukem case 2011:
625 1.8 lukem goto l2011;
626 1.8 lukem case 9020:
627 1.8 lukem goto l9020;
628 1.8 lukem case 9120:
629 1.8 lukem goto l9120;
630 1.8 lukem case 8:
631 1.8 lukem goto l8;
632 1.8 lukem case 9210:
633 1.8 lukem goto l9210;
634 1.8 lukem default:
635 1.8 lukem bug(113);
636 1.8 lukem }
637 1.8 lukem case 19:
638 1.8 lukem case 20: /* 9190: find, invent */
639 1.9 hubertf if (at(obj) || (liq() == obj && at(bottle))
640 1.8 lukem || k == liqloc(loc))
641 1.8 lukem spk = 94;
642 1.8 lukem for (i = 1; i <= 5; i++)
643 1.8 lukem if (dloc[i] == loc && dflag >= 2 && obj == dwarf)
644 1.8 lukem spk = 94;
645 1.8 lukem if (closed)
646 1.8 lukem spk = 138;
647 1.8 lukem if (toting(obj))
648 1.8 lukem spk = 24;
649 1.1 jtc goto l2011;
650 1.8 lukem l9210: case 21:/* feed */
651 1.8 lukem switch (trfeed()) {
652 1.8 lukem case 2011:
653 1.8 lukem goto l2011;
654 1.8 lukem default:
655 1.8 lukem bug(114);
656 1.8 lukem }
657 1.8 lukem l9220: case 22:/* fill */
658 1.8 lukem switch (trfill()) {
659 1.8 lukem case 2011:
660 1.8 lukem goto l2011;
661 1.8 lukem case 8000:
662 1.8 lukem goto l8000;
663 1.8 lukem case 9020:
664 1.8 lukem goto l9020;
665 1.8 lukem default:
666 1.8 lukem bug(115);
667 1.8 lukem }
668 1.8 lukem l9230: case 23:/* blast */
669 1.8 lukem if (prop[rod2] < 0 || !closed)
670 1.8 lukem goto l2011;
671 1.8 lukem bonus = 133;
672 1.8 lukem if (loc == 115)
673 1.8 lukem bonus = 134;
674 1.8 lukem if (here(rod2))
675 1.8 lukem bonus = 135;
676 1.1 jtc rspeak(bonus);
677 1.1 jtc done(2);
678 1.8 lukem l9270: case 27:/* read */
679 1.9 hubertf if (dark())
680 1.8 lukem goto l5190;
681 1.8 lukem if (obj == magzin)
682 1.8 lukem spk = 190;
683 1.8 lukem if (obj == tablet)
684 1.8 lukem spk = 196;
685 1.8 lukem if (obj == messag)
686 1.8 lukem spk = 191;
687 1.8 lukem if (obj == oyster && hinted[2] && toting(oyster))
688 1.8 lukem spk = 194;
689 1.8 lukem if (obj != oyster || hinted[2] || !toting(oyster)
690 1.8 lukem || !closed)
691 1.8 lukem goto l2011;
692 1.8 lukem hinted[2] = yes(192, 193, 54);
693 1.1 jtc goto l2012;
694 1.6 christos #if 0
695 1.6 christos l9280:
696 1.6 christos #endif
697 1.8 lukem case 28: /* break */
698 1.8 lukem if (obj == mirror)
699 1.8 lukem spk = 148;
700 1.8 lukem if (obj == vase && prop[vase] == 0) {
701 1.8 lukem spk = 198;
702 1.8 lukem if (toting(vase))
703 1.8 lukem drop(vase, loc);
704 1.8 lukem prop[vase] = 2;
705 1.8 lukem fixed[vase] = -1;
706 1.1 jtc goto l2011;
707 1.1 jtc }
708 1.8 lukem if (obj != mirror || !closed)
709 1.8 lukem goto l2011;
710 1.1 jtc rspeak(197);
711 1.1 jtc done(3);
712 1.6 christos #if 0
713 1.6 christos l9290:
714 1.6 christos #endif
715 1.8 lukem case 29: /* wake */
716 1.8 lukem if (obj != dwarf || !closed)
717 1.8 lukem goto l2011;
718 1.1 jtc rspeak(199);
719 1.1 jtc done(3);
720 1.1 jtc
721 1.8 lukem default:
722 1.8 lukem bug(24);
723 1.1 jtc }
724 1.1 jtc
725 1.8 lukem l5000:
726 1.8 lukem obj = k;
727 1.8 lukem if (fixed[k] != loc && !here(k))
728 1.8 lukem goto l5100;
729 1.8 lukem l5010: if (*wd2 != 0)
730 1.8 lukem goto l2800;
731 1.8 lukem if (verb != 0)
732 1.8 lukem goto l4090;
733 1.8 lukem printf("What do you want to do with the %s?\n", wd1);
734 1.1 jtc goto l2600;
735 1.8 lukem l5100: if (k != grate)
736 1.8 lukem goto l5110;
737 1.8 lukem if (loc == 1 || loc == 4 || loc == 7)
738 1.8 lukem k = dprssn;
739 1.8 lukem if (loc > 9 && loc < 15)
740 1.8 lukem k = entrnc;
741 1.8 lukem if (k != grate)
742 1.8 lukem goto l8;
743 1.8 lukem l5110: if (k != dwarf)
744 1.8 lukem goto l5120;
745 1.8 lukem for (i = 1; i <= 5; i++)
746 1.8 lukem if (dloc[i] == loc && dflag >= 2)
747 1.8 lukem goto l5010;
748 1.9 hubertf l5120: if ((liq() == k && here(bottle)) || k == liqloc(loc))
749 1.8 lukem goto l5010;
750 1.8 lukem if (obj != plant || !at(plant2) || prop[plant2] == 0)
751 1.8 lukem goto l5130;
752 1.8 lukem obj = plant2;
753 1.1 jtc goto l5010;
754 1.8 lukem l5130: if (obj != knife || knfloc != loc)
755 1.8 lukem goto l5140;
756 1.1 jtc knfloc = -1;
757 1.8 lukem spk = 116;
758 1.1 jtc goto l2011;
759 1.8 lukem l5140: if (obj != rod || !here(rod2))
760 1.8 lukem goto l5190;
761 1.8 lukem obj = rod2;
762 1.1 jtc goto l5010;
763 1.8 lukem l5190: if ((verb == find || verb == invent) && *wd2 == 0)
764 1.8 lukem goto l5010;
765 1.8 lukem printf("I see no %s here\n", wd1);
766 1.1 jtc goto l2012;
767 1.1 jtc }
768 1.1 jtc }
769