7 * Action handlers. Eventually we'll do lookup through a method table
8 * that calls these. Absolutely nothing like the original FORTRAN.
11 static int fill(long);
13 static int attack(FILE *input, long verb, long obj)
14 /* Attack. Assume target if unambiguous. "Throw" also links here.
15 * Attackable objects fall into two categories: enemies (snake,
16 * dwarf, etc.) and others (bird, clam, machine). Ambiguous if 2
17 * enemies, or no enemies but 2 others. */
19 int i =ATDWRF(game.loc);
23 if (HERE(SNAKE))obj=obj*NOBJECTS+SNAKE;
24 if (AT(DRAGON) && game.prop[DRAGON] == 0)obj=obj*NOBJECTS+DRAGON;
25 if (AT(TROLL))obj=obj*NOBJECTS+TROLL;
26 if (AT(OGRE))obj=obj*NOBJECTS+OGRE;
27 if (HERE(BEAR) && game.prop[BEAR] == 0)obj=obj*NOBJECTS+BEAR;
28 if (obj > NOBJECTS) return(8000);
30 /* Can't attack bird or machine by throwing axe. */
31 if (HERE(BIRD) && verb != THROW)obj=BIRD;
32 if (HERE(VEND) && verb != THROW)obj=obj*NOBJECTS+VEND;
33 /* Clam and oyster both treated as clam for intransitive case;
35 if (HERE(CLAM) || HERE(OYSTER))obj=NOBJECTS*obj+CLAM;
36 if (obj > NOBJECTS) return(8000);
41 if (game.closed) return(2011);
47 PSPEAK(VEND,game.prop[VEND]+2);
48 game.prop[VEND]=3-game.prop[VEND];
53 if (obj == CLAM || obj == OYSTER)SPK=150;
54 if (obj == SNAKE)SPK=46;
55 if (obj == DWARF)SPK=49;
56 if (obj == DWARF && game.closed) return(19000);
57 if (obj == DRAGON)SPK=167;
58 if (obj == TROLL)SPK=157;
59 if (obj == OGRE)SPK=203;
60 if (obj == OGRE && i > 0) {
65 for (i=1; i < PIRATE; i++) {
66 if (game.dloc[i] == game.loc) {
75 if (obj == BEAR)SPK=165+(game.prop[BEAR]+1)/2;
76 if (obj != DRAGON || game.prop[DRAGON] != 0) return(2011);
77 /* Fun stuff for dragon. If he insists on attacking it, win!
78 * Set game.prop to dead, move dragon to central loc (still
79 * fixed), move rug there (not fixed), and move him there,
80 * too. Then do a null motion to get new description. */
82 GETIN(input,WD1,WD1X,WD2,WD2X);
83 if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519)) return(2607);
87 K=(PLAC[DRAGON]+FIXD[DRAGON])/2;
88 MOVE(DRAGON+NOBJECTS,-1);
93 for (obj=1; obj<=NOBJECTS; obj++) {
94 if (game.place[obj] == PLAC[DRAGON] || game.place[obj] == FIXD[DRAGON])MOVE(obj,K);
102 static int bigwords(long foo)
103 /* FEE FIE FOE FOO (AND FUM). Advance to next state if given in proper order.
104 * Look up WD1 in section 3 of vocab to determine which word we've got. Last
105 * word zips the eggs back to the giant room (unless already there). */
109 if (game.foobar != 1-k) {
110 if (game.foobar != 0)SPK=151;
115 if (k != 4) return(2009);
117 if (game.place[EGGS] == PLAC[EGGS] || (TOTING(EGGS) && game.loc == PLAC[EGGS]))
119 /* Bring back troll if we steal the eggs back from him before
121 if (game.place[EGGS]==0 && game.place[TROLL]==0 && game.prop[TROLL]==0)
125 if (game.loc == PLAC[EGGS])k=0;
126 MOVE(EGGS,PLAC[EGGS]);
132 static int bivalve(token_t verb, token_t obj)
133 /* Clam/oyster actions */
136 if (obj == OYSTER)k=1;
138 if (TOTING(obj))SPK=120+k;
139 if (!TOTING(TRIDNT))SPK=122+k;
140 if (verb == LOCK)SPK=61;
144 DROP(OYSTER,game.loc);
149 static int blast(void)
150 /* Blast. No effect unless you've got dynamite, which is a neat trick! */
152 if (game.prop[ROD2] < 0 || !game.closed) return(2011);
154 if (game.loc == 115)game.bonus=134;
155 if (HERE(ROD2))game.bonus=135;
160 static int vbreak(token_t obj)
161 /* Break. Only works for mirror in repository and, of course, the vase. */
163 if (obj == MIRROR)SPK=148;
164 if (obj == VASE && game.prop[VASE] == 0) {
166 if (TOTING(VASE))DROP(VASE,game.loc);
168 game.fixed[VASE]= -1;
171 if (obj != MIRROR || !game.closed) return(2011);
178 static int brief(void)
179 /* Brief. Intransitive only. Suppress long descriptions after first time. */
187 static int carry(long obj)
188 /* Carry an object. Special cases for bird and cage (if bird in cage, can't
189 * take one without the other). Liquids also special, since they depend on
190 * status of bottle. Also various side effects, etc. */
192 if (obj == INTRANSITIVE) {
193 /* Carry, no object given yet. OK if only one object present. */
194 if(game.atloc[game.loc] == 0 ||
195 game.link[game.atloc[game.loc]] != 0 ||
196 ATDWRF(game.loc) > 0)
198 obj=game.atloc[game.loc];
201 if (TOTING(obj)) return(2011);
203 if (obj == PLANT && game.prop[PLANT] <= 0)SPK=115;
204 if (obj == BEAR && game.prop[BEAR] == 1)SPK=169;
205 if (obj == CHAIN && game.prop[BEAR] != 0)SPK=170;
206 if (obj == URN)SPK=215;
207 if (obj == CAVITY)SPK=217;
208 if (obj == BLOOD)SPK=239;
209 if (obj == RUG && game.prop[RUG] == 2)SPK=222;
210 if (obj == SIGN)SPK=196;
215 if (game.fixed[obj] != 0)
217 if (obj == WATER || obj == OIL) {
218 if (!HERE(BOTTLE) || LIQ(0) != obj) {
219 if (TOTING(BOTTLE) && game.prop[BOTTLE] == 1)
220 return(fill(BOTTLE));
221 if (game.prop[BOTTLE] != 1)SPK=105;
222 if (!TOTING(BOTTLE))SPK=104;
229 if (game.holdng >= INVLIMIT)
231 if (obj == BIRD && game.prop[BIRD] != 1 && -1-game.prop[BIRD] != 1) {
232 if (game.prop[BIRD] == 2) {
237 if (!TOTING(CAGE))SPK=27;
238 if (TOTING(ROD))SPK=26;
239 if (SPK/2 == 13) return(2011);
242 if ((obj==BIRD || obj==CAGE) && (game.prop[BIRD]==1 || -1-game.prop[BIRD]==1))
243 CARRY(BIRD+CAGE-obj,game.loc);
245 if (obj == BOTTLE && LIQ(0) != 0)
246 game.place[LIQ(0)] = -1;
247 if (!GSTONE(obj) || game.prop[obj] == 0)
254 static int chain(token_t verb)
255 /* Do something to the bear's chain */
259 if (game.prop[BEAR] == 0)SPK=41;
260 if (game.prop[CHAIN] == 0)SPK=37;
261 if (SPK != 171) return(2011);
264 if (game.prop[BEAR] != 3)game.prop[BEAR]=2;
265 game.fixed[BEAR]=2-game.prop[BEAR];
269 if (game.prop[CHAIN] != 0)SPK=34;
270 if (game.loc != PLAC[CHAIN])SPK=173;
271 if (SPK != 172) return(2011);
273 if (TOTING(CHAIN))DROP(CHAIN,game.loc);
274 game.fixed[CHAIN]= -1;
279 static int discard(long obj, bool just_do_it)
280 /* Discard object. "Throw" also comes here for most objects. Special cases for
281 * bird (might attack snake or dragon) and cage (might contain bird) and vase.
282 * Drop coins at vending machine for extra batteries. */
285 if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj=ROD2;
286 if (!TOTING(obj)) return(2011);
287 if (obj == BIRD && HERE(SNAKE)) {
289 if (game.closed) return(19000);
291 /* Set game.prop for use by travel options */
294 } else if ((GSTONE(obj) && AT(CAVITY) && game.prop[CAVITY] != 0)) {
298 if (HERE(RUG) && ((obj == EMRALD && game.prop[RUG] != 2) || (obj == RUBY &&
299 game.prop[RUG] == 2))) {
301 if (TOTING(RUG))SPK=220;
302 if (obj == RUBY)SPK=221;
307 if (K == 2)K=PLAC[SAPPH];
308 MOVE(RUG+NOBJECTS,K);
311 } else if (obj == COINS && HERE(VEND)) {
313 DROP(BATTER,game.loc);
316 } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) {
321 } else if (obj == BEAR && AT(TROLL)) {
324 MOVE(TROLL+NOBJECTS,0);
325 MOVE(TROLL2,PLAC[TROLL]);
326 MOVE(TROLL2+NOBJECTS,FIXD[TROLL]);
329 } else if (obj != VASE || game.loc == PLAC[PILLOW]) {
333 if (AT(PILLOW))game.prop[VASE]=0;
334 PSPEAK(VASE,game.prop[VASE]+1);
335 if (game.prop[VASE] != 0)game.fixed[VASE]= -1;
339 if (K == obj)obj=BOTTLE;
340 if (obj == BOTTLE && K != 0)game.place[K]=0;
341 if (obj == CAGE && game.prop[BIRD] == 1)DROP(BIRD,game.loc);
343 if (obj != BIRD) return(2012);
345 if (FOREST(game.loc))game.prop[BIRD]=2;
349 static int drink(token_t obj)
350 /* Drink. If no object, assume water and look for it here. If water is in
351 * the bottle, drink that, else must be at a water loc, so drink stream. */
353 if (obj == 0 && LIQLOC(game.loc) != WATER && (LIQ(0) != WATER || !HERE(BOTTLE)))
356 if (obj != 0 && obj != WATER)SPK=110;
357 if (SPK == 110 || LIQ(0) != WATER || !HERE(BOTTLE)) return(2011);
365 OBJSND[BIRD]=OBJSND[BIRD]+3;
371 static int eat(token_t obj)
372 /* Eat. Intransitive: assume food if present, else ask what. Transitive: food
373 * ok, some things lose appetite, rest are ridiculous. */
375 if (obj == INTRANSITIVE) {
387 if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
388 DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj ==
394 static int extinguish(int obj)
395 /* Extinguish. Lamp, urn, dragon/volcano (nice try). */
397 if (obj == INTRANSITIVE) {
398 if (HERE(LAMP) && game.prop[LAMP] == 1)obj=LAMP;
399 if (HERE(URN) && game.prop[URN] == 2)obj=obj*NOBJECTS+URN;
400 if (obj == 0 || obj > NOBJECTS) return(8000);
404 game.prop[URN]=game.prop[URN]/2;
415 if (obj == DRAGON || obj == VOLCAN)
420 static int feed(long obj)
421 /* Feed. If bird, no seed. Snake, dragon, troll: quip. If dwarf, make him
422 * mad. Bear, special. */
429 if (!(obj != SNAKE && obj != DRAGON && obj != TROLL)) {
431 if (obj == DRAGON && game.prop[DRAGON] != 0)SPK=110;
432 if (obj == TROLL)SPK=182;
433 if (obj != SNAKE || game.closed || !HERE(BIRD))
445 game.dflag=game.dflag+2;
450 if (game.prop[BEAR] == 0)SPK=102;
451 if (game.prop[BEAR] == 3)SPK=110;
473 /* Fill. Bottle or urn must be empty, and liquid available. (Vase
479 if (LIQLOC(game.loc) == 0)SPK=144;
480 if (LIQLOC(game.loc) == 0 || !TOTING(VASE))
484 game.fixed[VASE]= -1;
485 return(discard(obj, true));
490 if (game.prop[URN] != 0) return(2011);
493 if (k == 0 || !HERE(BOTTLE)) return(2011);
496 if (k == OIL)game.prop[URN]=1;
497 SPK=211+game.prop[URN];
501 if (obj != 0 && obj != BOTTLE)
503 if (obj == 0 && !HERE(BOTTLE))
506 if (LIQLOC(game.loc) == 0)
508 if (HERE(URN) && game.prop[URN] != 0)
514 game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2;
523 static int find(token_t obj)
524 /* Find. Might be carrying it, or it might be here. Else give caveat. */
527 (LIQ(0) == obj && AT(BOTTLE)) ||
528 K == LIQLOC(game.loc) ||
529 (obj == DWARF && ATDWRF(game.loc) > 0))
531 if (game.closed)SPK=138;
532 if (TOTING(obj))SPK=24;
536 static int fly(token_t obj)
537 /* Fly. Snide remarks unless hovering rug is here. */
539 if (obj == INTRANSITIVE) {
540 if (game.prop[RUG] != 2)SPK=224;
541 if (!HERE(RUG))SPK=225;
542 if (SPK/2 == 112) return(2011);
546 if (obj != RUG) return(2011);
548 if (game.prop[RUG] != 2) return(2011);
549 game.oldlc2=game.oldloc;
550 game.oldloc=game.loc;
551 game.newloc=game.place[RUG]+game.fixed[RUG]-game.loc;
553 if (game.prop[SAPPH] >= 0)SPK=227;
558 static int inven(token_t obj)
559 /* Inventory. If object, treat same as find. Else report on current burden. */
563 for (i=1; i<=NOBJECTS; i++) {
564 if (i == BEAR || !TOTING(i))
566 if (SPK == 98)RSPEAK(99);
577 int light(token_t obj)
578 /* Light. Applicable only to lamp and urn. */
580 if (obj == INTRANSITIVE) {
581 if (HERE(LAMP) && game.prop[LAMP] == 0 && game.limit >= 0)obj=LAMP;
582 if (HERE(URN) && game.prop[URN] == 1)obj=obj*NOBJECTS+URN;
583 if (obj == 0 || obj > NOBJECTS) return(8000);
588 if (game.prop[URN] == 0)
594 if (obj != LAMP) return(2011);
596 if (game.limit < 0) return(2011);
599 if (game.wzdark) return(2000);
604 static int listen(void)
605 /* Listen. Intransitive only. Print stuff based on objsnd/locsnd. */
612 if (k < 0) return(2012);
615 SETPRM(1,game.zzword,0);
616 for (i=1; i<=NOBJECTS; i++) {
617 if (!HERE(i) || OBJSND[i] == 0 || game.prop[i] < 0)
619 PSPEAK(i,OBJSND[i]+game.prop[i]);
621 if (i == BIRD && OBJSND[i]+game.prop[i] == 8)
627 static int lock(token_t verb, token_t obj)
628 /* Lock, unlock, no object given. Assume various things if present. */
631 if (obj == INTRANSITIVE) {
633 if (HERE(CLAM))obj=CLAM;
634 if (HERE(OYSTER))obj=OYSTER;
635 if (AT(DOOR))obj=DOOR;
636 if (AT(GRATE))obj=GRATE;
637 if (obj != 0 && HERE(CHAIN)) return(8000);
638 if (HERE(CHAIN))obj=CHAIN;
639 if (obj == 0) return(2011);
642 /* Lock, unlock object. Special stuff for opening clam/oyster
644 if (obj == CLAM || obj == OYSTER)
645 return bivalve(verb, obj);
646 if (obj == DOOR)SPK=111;
647 if (obj == DOOR && game.prop[DOOR] == 1)SPK=54;
648 if (obj == CAGE)SPK=32;
649 if (obj == KEYS)SPK=55;
650 if (obj == GRATE || obj == CHAIN)SPK=31;
651 if (SPK != 31 || !HERE(KEYS)) return(2011);
656 if (!game.panic)game.clock2=15;
660 SPK=34+game.prop[GRATE];
662 if (verb == LOCK)game.prop[GRATE]=0;
663 SPK=SPK+2*game.prop[GRATE];
667 static int pour(token_t obj)
668 /* Pour. If no object, or object is bottle, assume contents of bottle.
669 * special tests for pouring water or oil on plant or rusty door. */
671 if (obj == BOTTLE || obj == 0)obj=LIQ(0);
672 if (obj == 0) return(8000);
673 if (!TOTING(obj)) return(2011);
675 if (obj != OIL && obj != WATER) return(2011);
676 if (HERE(URN) && game.prop[URN] == 0)
681 if (!(AT(PLANT) || AT(DOOR)))
685 if (obj != WATER) return(2011);
686 PSPEAK(PLANT,game.prop[PLANT]+3);
687 game.prop[PLANT]=MOD(game.prop[PLANT]+1,3);
688 game.prop[PLANT2]=game.prop[PLANT];
693 if (obj == OIL)game.prop[DOOR]=1;
694 SPK=113+game.prop[DOOR];
699 static int quit(FILE *input)
700 /* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
702 if (YES(input,22,54,54))
707 static int read(FILE *input, token_t obj)
708 /* Read. Print stuff based on objtxt. Oyster (?) is special case. */
711 if (obj == INTRANSITIVE) {
713 for (i=1; i<=NOBJECTS; i++) {
714 if (HERE(i) && OBJTXT[i] != 0 && game.prop[i] >= 0)
715 obj = obj * NOBJECTS + i;
717 if (obj > NOBJECTS || obj == 0 || DARK(0)) return(8000);
725 if (OBJTXT[obj] == 0 || game.prop[obj] < 0)
727 if (obj == OYSTER && !game.clshnt) {
728 game.clshnt=YES(input,192,193,54);
731 PSPEAK(obj,OBJTXT[obj]+game.prop[obj]);
735 static int reservoir(void)
736 /* Z'ZZZ (word gets recomputed at startup; different each game). */
738 if (!AT(RESER) && game.loc != game.fixed[RESER]-1) return(2011);
739 PSPEAK(RESER,game.prop[RESER]+1);
740 game.prop[RESER]=1-game.prop[RESER];
741 if (AT(RESER)) return(2012);
742 game.oldlc2=game.loc;
748 static int rub(token_t obj)
749 /* Rub. Yields various snide remarks except for lit urn. */
751 if (obj != LAMP)SPK=76;
752 if (obj != URN || game.prop[URN] != 2) return(2011);
754 DROP(AMBER,game.loc);
756 game.tally=game.tally-1;
757 DROP(CAVITY,game.loc);
763 /* SAY. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */
765 /* FIXME: ugly use of globals */
766 SETPRM(1,WD2,WD2X); if (WD2 <= 0)SETPRM(1,WD1,WD1X);
768 int wd=VOCAB(WD1,-1);
769 if (wd == 62 || wd == 65 || wd == 71 || wd == 2025 || wd == 2034) {
778 static int suspendresume(FILE *input, bool resume)
779 /* Suspend and resume */
783 /* Suspend. Offer to save things in a file, but charging
784 * some points (so can't win by using saved games to retry
785 * battles or to start over after learning zzword). */
788 if (!YES(input,200,54,54)) return(2012);
789 game.saved=game.saved+5;
794 /* Resume. Read a suspended game back from a file. */
796 if (game.loc != 1 || game.abbrev[1] != 1) {
798 if (!YES(input,200,54,54)) return(2012);
802 /* Suspend vs resume cases are distinguished by the value of kk
803 * (-1 for suspend, +1 for resume). */
806 * FIXME: This is way more complicated than it needs to be in C.
807 * What we ought to do is define a save-block structure that
808 * includes a game state block and then use a single fread/fwrite
809 * for I/O. All the SAV* functions can be scrapped.
818 SETPRM(1,K/10,MOD(K,10));
819 SETPRM(3,VRSION/10,MOD(VRSION,10));
823 /* Herewith are all the variables whose values can change during a game,
824 * omitting a few (such as I, J) whose values between turns are
825 * irrelevant and some whose values when a game is
826 * suspended or resumed are guaranteed to match. If unsure whether a value
827 * needs to be saved, include it. Overkill can't hurt. Pad the last savwds
828 * with junk variables to bring it up to 7 values. */
829 SAVWDS(game.abbnum,game.blklin,game.bonus,game.clock1,game.clock2,game.closed,game.closng);
830 SAVWDS(game.detail,game.dflag,game.dkill,game.dtotal,game.foobar,game.holdng,game.iwest);
831 SAVWDS(game.knfloc,game.limit,K,game.lmwarn,game.loc,game.newloc,game.numdie);
832 SAVWDS(K,game.oldlc2,game.oldloc,game.oldobj,game.panic,game.saved,game.setup);
833 SAVWDS(SPK,game.tally,game.thresh,game.trndex,game.trnluz,game.turns,OBJTXT[OYSTER]);
834 SAVWDS(K,WD1,WD1X,WD2,game.wzdark,game.zzword,OBJSND[BIRD]);
835 SAVWDS(OBJTXT[SIGN],game.clshnt,game.novice,K,K,K,K);
836 SAVARR(game.abbrev,LOCSIZ);
837 SAVARR(game.atloc,LOCSIZ);
838 SAVARR(game.dloc,NDWARVES);
839 SAVARR(game.dseen,NDWARVES);
840 SAVARR(game.fixed,NOBJECTS);
841 SAVARR(game.hinted,HNTSIZ);
842 SAVARR(game.hintlc,HNTSIZ);
843 SAVARR(game.link,NOBJECTS*2);
844 SAVARR(game.odloc,NDWARVES);
845 SAVARR(game.place,NOBJECTS);
846 SAVARR(game.prop,NOBJECTS);
853 game.zzword=RNDVOC(3,game.zzword);
854 if (kk > 0) return(8);
859 static int throw_support(long spk)
867 static int throw(FILE *cmdin, long verb, long obj)
868 /* Throw. Same as discard unless axe. Then same as attack except
869 * ignore bird, and if dwarf is present then one might be killed.
870 * (Only way to do so!) Axe also special for dragon, bear, and
871 * troll. Treasures special for troll. */
873 if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj=ROD2;
876 if (obj >= 50 && obj <= MAXTRS && AT(TROLL)) {
878 /* Snarf a treasure for the troll. */
881 MOVE(TROLL+NOBJECTS,0);
882 DROP(TROLL2,PLAC[TROLL]);
883 DROP(TROLL2+NOBJECTS,FIXD[TROLL]);
887 if (obj == FOOD && HERE(BEAR)) {
888 /* But throwing food is another story. */
893 return(discard(obj, false));
896 if (AT(DRAGON) && game.prop[DRAGON] == 0) {
898 return throw_support(SPK);
902 return throw_support(SPK);
906 return throw_support(SPK);
908 if (HERE(BEAR) && game.prop[BEAR] == 0) {
909 /* This'll teach him to throw the axe at the bear! */
917 return(attack(cmdin, verb, 0));
920 if (randrange(NDWARVES+1) < game.dflag) {
922 return throw_support(SPK);
927 game.dkill=game.dkill+1;
928 if (game.dkill == 1)SPK=149;
930 return throw_support(SPK);
933 static int vscore(void)
934 /* Score. Call scoring routine but tell it to return. */
940 static int wake(token_t obj)
941 /* Wake. Only use is to disturb the dwarves. */
943 if (obj != DWARF || !game.closed) return(2011);
948 static int wave(token_t obj)
949 /* Wave. No effect unless waving rod at fissure or at bird. */
951 if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2)))SPK=29;
954 (!HERE(BIRD) && (game.closng || !AT(FISSUR))))
956 if (HERE(BIRD))SPK=206+MOD(game.prop[BIRD],2);
957 if (SPK == 206 && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
960 game.tally=game.tally-1;
964 if (game.closed) return(18999);
965 if (game.closng || !AT(FISSUR)) return(2011);
966 if (HERE(BIRD))RSPEAK(SPK);
967 game.prop[FISSUR]=1-game.prop[FISSUR];
968 PSPEAK(FISSUR,2-game.prop[FISSUR]);
973 /* This stuff was broken off as part of an effort to get the main program
974 * to compile without running out of memory. We're called with a number
975 * that says what label the caller wanted to "goto", and we return a
976 * similar label number for the caller to "goto".
979 int action(FILE *input, long STARTAT, long verb, long obj)
980 /* Analyse a verb. Remember what it was, go back for object if second word
981 * unless verb is "say", which snarfs arbitrary second word.
986 case 4000: goto L4000;
987 case 4090: goto L4090;
988 case 5000: goto L5000;
994 if (WD2 > 0 && verb != SAY) return(2800);
995 if (verb == SAY)obj=WD2;
996 if (obj > 0) goto L4090;
998 /* Analyse an intransitive verb (ie, no object given yet). */
1001 case 0: /* CARRY */ return carry(INTRANSITIVE);
1002 case 1: /* DROP */ return(8000);
1003 case 2: /* SAY */ return(8000);
1004 case 3: /* UNLOC */ return lock(verb, INTRANSITIVE);
1005 case 4: /* NOTHI */ return(2009);
1006 case 5: /* LOCK */ return lock(verb, INTRANSITIVE);
1007 case 6: /* LIGHT */ return light(INTRANSITIVE);
1008 case 7: /* EXTIN */ return extinguish(INTRANSITIVE);
1009 case 8: /* WAVE */ return(8000);
1010 case 9: /* CALM */ return(8000);
1011 case 10: /* WALK */ return(2011);
1012 case 11: /* ATTAC */ return attack(input, verb, obj);
1013 case 12: /* POUR */ return pour(obj);
1014 case 13: /* EAT */ return eat(INTRANSITIVE);
1015 case 14: /* DRINK */ return drink(obj);
1016 case 15: /* RUB */ return(8000);
1017 case 16: /* TOSS */ return(8000);
1018 case 17: /* QUIT */ return quit(input);
1019 case 18: /* FIND */ return(8000);
1020 case 19: /* INVEN */ return inven(obj);
1021 case 20: /* FEED */ return(8000);
1022 case 21: /* FILL */ return fill(obj);
1023 case 22: /* BLAST */ return blast();
1024 case 23: /* SCOR */ return vscore();
1025 case 24: /* FOO */ return bigwords(WD1);
1026 case 25: /* BRIEF */ return brief();
1027 case 26: /* READ */ return read(input, INTRANSITIVE);
1028 case 27: /* BREAK */ return(8000);
1029 case 28: /* WAKE */ return(8000);
1030 case 29: /* SUSP */ return suspendresume(input, false);
1031 case 30: /* RESU */ return suspendresume(input, true);
1032 case 31: /* FLY */ return fly(INTRANSITIVE);
1033 case 32: /* LISTE */ return listen();
1034 case 33: /* ZZZZ */ return reservoir();
1038 /* Analyse a transitive verb. */
1040 L4090: switch (verb-1) {
1041 case 0: /* CARRY */ return carry(obj);
1042 case 1: /* DROP */ return discard(obj, false);
1043 case 2: /* SAY */ return say();
1044 case 3: /* UNLOC */ return lock(verb, obj);
1045 case 4: /* NOTHI */ return(2009);
1046 case 5: /* LOCK */ return lock(verb, obj);
1047 case 6: /* LIGHT */ return light(obj);
1048 case 7: /* EXTI */ return extinguish(obj);
1049 case 8: /* WAVE */ return wave(obj);
1050 case 9: /* CALM */ return(2011);
1051 case 10: /* WALK */ return(2011);
1052 case 11: /* ATTAC */ return attack(input, verb, obj);
1053 case 12: /* POUR */ return pour(obj);
1054 case 13: /* EAT */ return eat(obj);
1055 case 14: /* DRINK */ return drink(obj);
1056 case 15: /* RUB */ return rub(obj);
1057 case 16: /* TOSS */ return throw(input, verb, obj);
1058 case 17: /* QUIT */ return(2011);
1059 case 18: /* FIND */ return find(obj);
1060 case 19: /* INVEN */ return find(obj);
1061 case 20: /* FEED */ return feed(obj);
1062 case 21: /* FILL */ return fill(obj);
1063 case 22: /* BLAST */ return blast();
1064 case 23: /* SCOR */ return(2011);
1065 case 24: /* FOO */ return(2011);
1066 case 25: /* BRIEF */ return(2011);
1067 case 26: /* READ */ return read(input, obj);
1068 case 27: /* BREAK */ return vbreak(obj);
1069 case 28: /* WAKE */ return wake(obj);
1070 case 29: /* SUSP */ return(2011);
1071 case 30: /* RESU */ return(2011);
1072 case 31: /* FLY */ return fly(obj);
1073 case 32: /* LISTE */ return(2011);
1074 case 33: /* ZZZZ */ return reservoir();
1078 /* Analyse an object word. See if the thing is here, whether we've got a verb
1079 * yet, and so on. Object must be here unless verb is "find" or "invent(ory)"
1080 * (and no new verb yet to be analysed). Water and oil are also funny, since
1081 * they are never actually dropped at any location, but might be here inside
1082 * the bottle or urn or as a feature of the location. */
1085 if (!HERE(K)) goto L5100;
1086 L5010: if (WD2 > 0) return(2800);
1087 if (verb != 0) goto L4090;
1092 L5100: if (K != GRATE) goto L5110;
1093 if (game.loc == 1 || game.loc == 4 || game.loc == 7)K=DPRSSN;
1094 if (game.loc > 9 && game.loc < 15)K=ENTRNC;
1095 if (K != GRATE) return(8);
1096 L5110: if (K == DWARF && ATDWRF(game.loc) > 0) goto L5010;
1097 if ((LIQ(0) == K && HERE(BOTTLE)) || K == LIQLOC(game.loc)) goto L5010;
1098 if (obj != OIL || !HERE(URN) || game.prop[URN] == 0) goto L5120;
1101 L5120: if (obj != PLANT || !AT(PLANT2) || game.prop[PLANT2] == 0) goto L5130;
1104 L5130: if (obj != KNIFE || game.knfloc != game.loc) goto L5140;
1108 L5140: if (obj != ROD || !HERE(ROD2)) goto L5190;
1111 L5190: if ((verb == FIND || verb == INVENT) && WD2 <= 0) goto L5010;
1117 /* Statement numbers in this section are 8000 for intransitive verbs, 9000 for
1118 * transitive, plus ten times the verb number. Many intransitive verbs use the
1119 * transitive code, and some verbs use code for other verbs, as noted below. */