main.c 16 KB

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