linearized extinguish
[open-adventure.git] / actions.c
1 #include <stdlib.h>
2 #include <stdbool.h>
3 #include <string.h>
4 #include "advent.h"
5 #include "dungeon.h"
6
7 static int fill(token_t, token_t);
8
9 static void state_change(long obj, long state)
10 {
11     game.prop[obj] = state;
12     pspeak(obj, change, state, true);
13 }
14
15 static int attack(struct command_t *command)
16 /*  Attack.  Assume target if unambiguous.  "Throw" also links here.
17  *  Attackable objects fall into two categories: enemies (snake,
18  *  dwarf, etc.)  and others (bird, clam, machine).  Ambiguous if 2
19  *  enemies, or no enemies but 2 others. */
20 {
21     vocab_t verb = command->verb;
22     vocab_t obj = command->obj;
23
24     long spk = actions[verb].message;
25     if (obj == NO_OBJECT ||
26         obj == INTRANSITIVE) {
27         int changes = 0;
28         if (atdwrf(game.loc) > 0) {
29             obj = DWARF;
30             ++changes;
31         }
32         if (HERE(SNAKE)) {
33             obj = SNAKE;
34             ++changes;
35         }
36         if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
37             obj = DRAGON;
38             ++changes;
39         }
40         if (AT(TROLL)) {
41             obj = TROLL;
42             ++changes;
43         }
44         if (AT(OGRE)) {
45             obj = OGRE;
46             ++changes;
47         }
48         if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
49             obj = BEAR;
50             ++changes;
51         }
52         /* check for low-priority targets */
53         if (obj == NO_OBJECT) {
54             /* Can't attack bird or machine by throwing axe. */
55             if (HERE(BIRD) && verb != THROW) {
56                 obj = BIRD;
57                 ++changes;
58             }
59             if (HERE(VEND) && verb != THROW) {
60                 obj = VEND;
61                 ++changes;
62             }
63             /* Clam and oyster both treated as clam for intransitive case;
64              * no harm done. */
65             if (HERE(CLAM) || HERE(OYSTER)) {
66                 obj = CLAM;
67                 ++changes;
68             }
69         }
70         if (changes >= 2)
71             return GO_UNKNOWN;
72
73     }
74     if (obj == BIRD) {
75         if (game.closed) {
76             rspeak(UNHAPPY_BIRD);
77             return GO_CLEAROBJ;
78         }
79         DESTROY(BIRD);
80         spk = BIRD_DEAD;
81     } else if (obj == VEND) {
82         state_change(VEND,
83                      game.prop[VEND] == VEND_BLOCKS ? VEND_UNBLOCKS : VEND_BLOCKS);
84         return GO_CLEAROBJ;
85     }
86
87     if (obj == NO_OBJECT)
88         spk = NO_TARGET;
89     if (obj == CLAM ||
90         obj == OYSTER)
91         spk = SHELL_IMPERVIOUS;
92     if (obj == SNAKE)
93         spk = SNAKE_WARNING;
94     if (obj == DWARF)
95         spk = BARE_HANDS_QUERY;
96     if (obj == DWARF && game.closed)
97         return GO_DWARFWAKE;
98     if (obj == DRAGON)
99         spk = ALREADY_DEAD;
100     if (obj == TROLL)
101         spk = ROCKY_TROLL;
102     if (obj == OGRE)
103         spk = OGRE_DODGE;
104     if (obj == OGRE && atdwrf(game.loc) > 0) {
105         rspeak(spk);
106         rspeak(KNIFE_THROWN);
107         DESTROY(OGRE);
108         int dwarves = 0;
109         for (int i = 1; i < PIRATE; i++) {
110             if (game.dloc[i] == game.loc) {
111                 ++dwarves;
112                 game.dloc[i] = LOC_LONGWEST;
113                 game.dseen[i] = false;
114             }
115         }
116         spk = (dwarves > 1) ?
117               OGRE_PANIC1 :
118               OGRE_PANIC2;
119     } else if (obj == BEAR) {
120         switch (game.prop[BEAR]) {
121         case UNTAMED_BEAR:
122             spk = BEAR_HANDS;
123             break;
124         case SITTING_BEAR:
125             spk = BEAR_CONFUSED;
126             break;
127         case CONTENTED_BEAR:
128             spk = BEAR_CONFUSED;
129             break;
130         case BEAR_DEAD:
131             spk = ALREADY_DEAD;
132             break;
133         }
134     } else if (obj == DRAGON && game.prop[DRAGON] == DRAGON_BARS) {
135         /*  Fun stuff for dragon.  If he insists on attacking it, win!
136          *  Set game.prop to dead, move dragon to central loc (still
137          *  fixed), move rug there (not fixed), and move him there,
138          *  too.  Then do a null motion to get new description. */
139         rspeak(BARE_HANDS_QUERY);
140         if (silent_yes()) {
141             // FIXME: setting wd1 is a workaround for broken logic
142             command->wd1 = token_to_packed("Y");
143         } else {
144             // FIXME: setting wd1 is a workaround for broken logic
145             command->wd1 = token_to_packed("N");
146             return GO_CHECKFOO;
147         }
148         state_change(DRAGON, DRAGON_DEAD);
149         game.prop[RUG] = RUG_FLOOR;
150         /* FIXME: Arithmetic on location values */
151         int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
152         move(DRAGON + NOBJECTS, -1);
153         move(RUG + NOBJECTS, 0);
154         move(DRAGON, k);
155         move(RUG, k);
156         drop(BLOOD, k);
157         for (obj = 1; obj <= NOBJECTS; obj++) {
158             if (game.place[obj] == objects[DRAGON].plac ||
159                 game.place[obj] == objects[DRAGON].fixd)
160                 move(obj, k);
161         }
162         game.loc = k;
163         return GO_MOVE;
164     }
165
166     rspeak(spk);
167     return GO_CLEAROBJ;
168 }
169
170 static int bigwords(token_t foo)
171 /*  FEE FIE FOE FOO (AND FUM).  Advance to next state if given in proper order.
172  *  Look up foo in special section of vocab to determine which word we've got.
173  *  Last word zips the eggs back to the giant room (unless already there). */
174 {
175     char word[TOKLEN + 1];
176     packed_to_token(foo, word);
177     int k = (int) get_special_vocab_id(word);
178     if (game.foobar != 1 - k) {
179         if (game.foobar != 0 && game.loc == LOC_GIANTROOM) {
180             rspeak( START_OVER);
181         } else {
182             rspeak(NOTHING_HAPPENS);
183         }
184         return GO_CLEAROBJ;
185     } else {
186         game.foobar = k;
187         if (k != 4) {
188             rspeak(OK_MAN);
189             return GO_CLEAROBJ;
190         }
191         game.foobar = 0;
192         if (game.place[EGGS] == objects[EGGS].plac ||
193             (TOTING(EGGS) && game.loc == objects[EGGS].plac)) {
194             rspeak(NOTHING_HAPPENS);
195             return GO_CLEAROBJ;
196         } else {
197             /*  Bring back troll if we steal the eggs back from him before
198              *  crossing. */
199             if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
200                 game.prop[TROLL] = TROLL_PAIDONCE;
201             k = EGGS_DONE;
202             if (HERE(EGGS))
203                 k = EGGS_VANISHED;
204             if (game.loc == objects[EGGS].plac)
205                 k = EGGS_HERE;
206             move(EGGS, objects[EGGS].plac);
207             pspeak(EGGS, look, k, true);
208             return GO_CLEAROBJ;
209         }
210     }
211 }
212
213 static int bivalve(token_t verb, token_t obj)
214 /* Clam/oyster actions */
215 {
216     bool is_oyster = (obj == OYSTER);
217     if (verb == LOCK) {
218         rspeak(HUH_MAN);
219         return GO_CLEAROBJ;
220     }
221     if (!TOTING(TRIDENT)) {
222         rspeak(is_oyster ?
223                OYSTER_OPENER :
224                CLAM_OPENER);
225         return GO_CLEAROBJ;
226     }
227     if (TOTING(obj)) {
228         rspeak( is_oyster ?
229                 DROP_OYSTER :
230                 DROP_CLAM);
231         return GO_CLEAROBJ;
232     }
233
234     if (!is_oyster) {
235         DESTROY(CLAM);
236         drop(OYSTER, game.loc);
237         drop(PEARL, LOC_CULDESAC);
238     }
239     rspeak(is_oyster ?
240            OYSTER_OPENS :
241            PEARL_FALLS);
242     return GO_CLEAROBJ;
243 }
244
245 static void blast(void)
246 /*  Blast.  No effect unless you've got dynamite, which is a neat trick! */
247 {
248     if (game.prop[ROD2] < 0 ||
249         !game.closed)
250         rspeak(REQUIRES_DYNAMITE);
251     else {
252         game.bonus = VICTORY_MESSAGE;
253         if (game.loc == LOC_NE)
254             game.bonus = DEFEAT_MESSAGE;
255         if (HERE(ROD2))
256             game.bonus = SPLATTER_MESSAGE;
257         rspeak(game.bonus);
258         terminate(endgame);
259     }
260 }
261
262 static int vbreak(token_t verb, token_t obj)
263 /*  Break.  Only works for mirror in repository and, of course, the vase. */
264 {
265     if (obj == MIRROR) {
266         if (game.closed) {
267             rspeak(BREAK_MIRROR);
268             return GO_DWARFWAKE;
269         } else {
270             rspeak(TOO_FAR);
271             return GO_CLEAROBJ;
272         }
273     }
274     if (obj == VASE && game.prop[VASE] == VASE_WHOLE) {
275         if (TOTING(VASE))
276             drop(VASE, game.loc);
277         state_change(VASE, VASE_BROKEN);
278         game.fixed[VASE] = -1;
279         return GO_CLEAROBJ;
280     }
281     rspeak(actions[verb].message);
282     return (GO_CLEAROBJ);
283 }
284
285 static int brief(void)
286 /*  Brief.  Intransitive only.  Suppress long descriptions after first time. */
287 {
288     game.abbnum = 10000;
289     game.detail = 3;
290     rspeak(BRIEF_CONFIRM);
291     return GO_CLEAROBJ;
292 }
293
294 static int vcarry(token_t verb, token_t obj)
295 /*  Carry an object.  Special cases for bird and cage (if bird in cage, can't
296  *  take one without the other).  Liquids also special, since they depend on
297  *  status of bottle.  Also various side effects, etc. */
298 {
299     int spk;
300     if (obj == INTRANSITIVE) {
301         /*  Carry, no object given yet.  OK if only one object present. */
302         if (game.atloc[game.loc] == 0 ||
303             game.link[game.atloc[game.loc]] != 0 ||
304             atdwrf(game.loc) > 0)
305             return GO_UNKNOWN;
306         obj = game.atloc[game.loc];
307     }
308
309     if (TOTING(obj)) {
310         rspeak(ALREADY_CARRYING);
311         return GO_CLEAROBJ;
312     }
313     spk = YOU_JOKING;
314     if (obj == PLANT && game.prop[PLANT] <= 0)
315         spk = DEEP_ROOTS;
316     if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR)
317         spk = BEAR_CHAINED;
318     if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR)
319         spk = STILL_LOCKED;
320     if (obj == URN)
321         spk = URN_NOBUDGE;
322     if (obj == CAVITY)
323         spk = DOUGHNUT_HOLES;
324     if (obj == BLOOD)
325         spk = FEW_DROPS;
326     if (obj == RUG && game.prop[RUG] == RUG_HOVER)
327         spk = RUG_HOVERS;
328     if (obj == SIGN)
329         spk = HAND_PASSTHROUGH;
330     if (obj == MESSAG) {
331         rspeak(REMOVE_MESSAGE);
332         DESTROY(MESSAG);
333         return GO_CLEAROBJ;
334     }
335     if (game.fixed[obj] != 0) {
336         rspeak(spk);
337         return GO_CLEAROBJ;
338     }
339     if (obj == WATER ||
340         obj == OIL) {
341         if (!HERE(BOTTLE) ||
342             LIQUID() != obj) {
343             if (TOTING(BOTTLE) && game.prop[BOTTLE] == EMPTY_BOTTLE)
344                 return (fill(verb, BOTTLE));
345             else {
346                 if (game.prop[BOTTLE] != EMPTY_BOTTLE)
347                     spk = BOTTLE_FULL;
348                 if (!TOTING(BOTTLE))
349                     spk = NO_CONTAINER;
350                 rspeak(spk);
351                 return GO_CLEAROBJ;
352             }
353         }
354         obj = BOTTLE;
355     }
356
357     spk = CARRY_LIMIT;
358     if (game.holdng >= INVLIMIT) {
359         rspeak(spk);
360         return GO_CLEAROBJ;
361     } else if (obj == BIRD && game.prop[BIRD] != BIRD_CAGED && -1 - game.prop[BIRD] != BIRD_CAGED) {
362         if (game.prop[BIRD] == BIRD_FOREST_UNCAGED) {
363             DESTROY(BIRD);
364             rspeak(BIRD_CRAP);
365             return GO_CLEAROBJ;
366         }
367         if (!TOTING(CAGE))
368             spk = CANNOT_CARRY;
369         if (TOTING(ROD))
370             spk = BIRD_EVADES;
371         if (spk == CANNOT_CARRY ||
372             spk == BIRD_EVADES) {
373             rspeak(spk);
374             return GO_CLEAROBJ;
375         }
376         game.prop[BIRD] = BIRD_CAGED;
377     }
378     /* FIXME: Arithmetic on state numbers */
379     if ((obj == BIRD ||
380          obj == CAGE) &&
381         (game.prop[BIRD] == BIRD_CAGED ||
382          -1 - game.prop[BIRD] == 1))
383         carry(BIRD + CAGE - obj, game.loc);
384     carry(obj, game.loc);
385     if (obj == BOTTLE && LIQUID() != 0)
386         game.place[LIQUID()] = CARRIED;
387     if (GSTONE(obj) && game.prop[obj] != 0) {
388         game.prop[obj] = STATE_GROUND;
389         game.prop[CAVITY] = CAVITY_EMPTY;
390     }
391     rspeak(OK_MAN);
392     return GO_CLEAROBJ;
393 }
394
395 static int chain(token_t verb)
396 /* Do something to the bear's chain */
397 {
398     int spk;
399     if (verb != LOCK) {
400         spk = CHAIN_UNLOCKED;
401         if (game.prop[BEAR] == UNTAMED_BEAR)
402             spk = BEAR_BLOCKS;
403         if (game.prop[CHAIN] == CHAIN_HEAP)
404             spk = ALREADY_UNLOCKED;
405         if (spk != CHAIN_UNLOCKED) {
406             rspeak(spk);
407             return GO_CLEAROBJ;
408         }
409         game.prop[CHAIN] = CHAIN_HEAP;
410         game.fixed[CHAIN] = CHAIN_HEAP;
411         if (game.prop[BEAR] != BEAR_DEAD)
412             game.prop[BEAR] = CONTENTED_BEAR;
413         /* FIXME: Arithmetic on state numbers */
414         game.fixed[BEAR] = 2 - game.prop[BEAR];
415     } else {
416         spk = CHAIN_LOCKED;
417         if (game.prop[CHAIN] != CHAIN_HEAP)
418             spk = ALREADY_LOCKED;
419         if (game.loc != objects[CHAIN].plac)
420             spk = NO_LOCKSITE;
421         if (spk != CHAIN_LOCKED) {
422             rspeak(spk);
423             return GO_CLEAROBJ;
424         }
425         game.prop[CHAIN] = CHAIN_FIXED;
426         if (TOTING(CHAIN))
427             drop(CHAIN, game.loc);
428         game.fixed[CHAIN] = -1;
429     }
430     rspeak(spk);
431     return GO_CLEAROBJ;
432 }
433
434 static int discard(token_t verb, token_t obj, bool just_do_it)
435 /*  Discard object.  "Throw" also comes here for most objects.  Special cases for
436  *  bird (might attack snake or dragon) and cage (might contain bird) and vase.
437  *  Drop coins at vending machine for extra batteries. */
438 {
439     int spk = actions[verb].message;
440     if (!just_do_it) {
441         if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))
442             obj = ROD2;
443         if (!TOTING(obj)) {
444             rspeak(spk);
445             return GO_CLEAROBJ;
446         }
447         if (obj == BIRD && HERE(SNAKE)) {
448             rspeak(BIRD_ATTACKS);
449             if (game.closed)
450                 return GO_DWARFWAKE;
451             DESTROY(SNAKE);
452             /* Set game.prop for use by travel options */
453             game.prop[SNAKE] = SNAKE_CHASED;
454
455         } else if ((GSTONE(obj) && AT(CAVITY) && game.prop[CAVITY] != CAVITY_FULL)) {
456             rspeak(GEM_FITS);
457             game.prop[obj] = 1;
458             game.prop[CAVITY] = CAVITY_FULL;
459             if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != RUG_HOVER) ||
460                               (obj == RUBY && game.prop[RUG] == RUG_HOVER))) {
461                 spk = RUG_RISES;
462                 if (TOTING(RUG))
463                     spk = RUG_WIGGLES;
464                 if (obj == RUBY)
465                     spk = RUG_SETTLES;
466                 rspeak(spk);
467                 if (spk != RUG_WIGGLES) {
468                     /* FIXME: Arithmetic on state numbers */
469                     int k = 2 - game.prop[RUG];
470                     game.prop[RUG] = k;
471                     if (k == 2)
472                         k = objects[SAPPH].plac;
473                     move(RUG + NOBJECTS, k);
474                 }
475             }
476         } else if (obj == COINS && HERE(VEND)) {
477             DESTROY(COINS);
478             drop(BATTERY, game.loc);
479             pspeak(BATTERY, look, FRESH_BATTERIES, true);
480             return GO_CLEAROBJ;
481         } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
482             rspeak(BIRD_BURNT);
483             DESTROY(BIRD);
484             return GO_CLEAROBJ;
485         } else if (obj == BEAR && AT(TROLL)) {
486             state_change(TROLL, TROLL_GONE);
487             move(TROLL, LOC_NOWHERE);
488             move(TROLL + NOBJECTS, LOC_NOWHERE);
489             move(TROLL2, objects[TROLL].plac);
490             move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
491             juggle(CHASM);
492         } else if (obj != VASE ||
493                    game.loc == objects[PILLOW].plac) {
494             rspeak(OK_MAN);
495         } else {
496             game.prop[VASE] = VASE_BROKEN;
497             if (AT(PILLOW))
498                 game.prop[VASE] = VASE_WHOLE;
499             pspeak(VASE, look, game.prop[VASE] + 1, true);
500             if (game.prop[VASE] != VASE_WHOLE)
501                 game.fixed[VASE] = -1;
502         }
503     }
504     int k = LIQUID();
505     if (k == obj)
506         obj = BOTTLE;
507     if (obj == BOTTLE && k != 0)
508         game.place[k] = LOC_NOWHERE;
509     if (obj == CAGE && game.prop[BIRD] == BIRD_CAGED)
510         drop(BIRD, game.loc);
511     drop(obj, game.loc);
512     if (obj != BIRD)
513         return GO_CLEAROBJ;
514     game.prop[BIRD] = BIRD_UNCAGED;
515     if (FOREST(game.loc))
516         game.prop[BIRD] = BIRD_FOREST_UNCAGED;
517     return GO_CLEAROBJ;
518 }
519
520 static int drink(token_t verb, token_t obj)
521 /*  Drink.  If no object, assume water and look for it here.  If water is in
522  *  the bottle, drink that, else must be at a water loc, so drink stream. */
523 {
524     if (obj == NO_OBJECT && LIQLOC(game.loc) != WATER && (LIQUID() != WATER ||
525             !HERE(BOTTLE)))
526         return GO_UNKNOWN;
527     if (obj != BLOOD) {
528         if (obj != NO_OBJECT && obj != WATER) {
529             rspeak(RIDICULOUS_ATTEMPT);
530         } else if (LIQUID() == WATER && HERE(BOTTLE)) {
531             game.prop[BOTTLE] = EMPTY_BOTTLE;
532             game.place[WATER] = LOC_NOWHERE;
533             rspeak(BOTTLE_EMPTY);
534         } else {
535             rspeak(actions[verb].message);
536         }
537     } else {
538         DESTROY(BLOOD);
539         state_change(DRAGON, DRAGON_BLOODLESS);
540         game.blooded = true;
541     }
542     return GO_CLEAROBJ;
543 }
544
545 static int eat(token_t verb, token_t obj)
546 /*  Eat.  Intransitive: assume food if present, else ask what.  Transitive: food
547  *  ok, some things lose appetite, rest are ridiculous. */
548 {
549     if (obj == INTRANSITIVE) {
550         if (!HERE(FOOD))
551             return GO_UNKNOWN;
552         DESTROY(FOOD);
553         rspeak(THANKS_DELICIOUS);
554         return GO_CLEAROBJ;
555     }
556     if (obj == FOOD) {
557         DESTROY(FOOD);
558         rspeak(THANKS_DELICIOUS);
559         return GO_CLEAROBJ;
560     }
561     if (obj == BIRD ||
562         obj == SNAKE ||
563         obj == CLAM ||
564         obj == OYSTER ||
565         obj == DWARF ||
566         obj == DRAGON ||
567         obj == TROLL ||
568         obj == BEAR ||
569         obj == OGRE) {
570         rspeak(LOST_APPETITE);
571         return GO_CLEAROBJ;
572     }
573     rspeak(actions[verb].message);
574     return GO_CLEAROBJ;
575 }
576
577 static int extinguish(token_t verb, int obj)
578 /* Extinguish.  Lamp, urn, dragon/volcano (nice try). */
579 {
580     if (obj == INTRANSITIVE) {
581         if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
582             obj = LAMP;
583         if (HERE(URN) && game.prop[URN] == URN_LIT)
584             obj = URN;
585         if (obj == INTRANSITIVE)
586             return GO_UNKNOWN;
587     }
588
589     if (obj == URN) {
590         if (game.prop[URN] != URN_EMPTY) {
591             state_change(URN, URN_DARK);
592         } else {
593             pspeak(URN, change, URN_DARK, true);
594         }
595         return GO_CLEAROBJ;
596     }
597
598     if (obj == LAMP) {
599         state_change(LAMP, LAMP_DARK);
600         rspeak(DARK(game.loc) ?
601                PITCH_DARK :
602                NO_MESSAGE);
603         return GO_CLEAROBJ;
604     }
605
606     if (obj == DRAGON ||
607         obj == VOLCANO) {
608         rspeak(BEYOND_POWER);
609         return GO_CLEAROBJ;
610     }
611
612     rspeak(actions[verb].message);
613     return GO_CLEAROBJ;
614 }
615
616 static int feed(token_t verb, token_t obj)
617 /*  Feed.  If bird, no seed.  Snake, dragon, troll: quip.  If dwarf, make him
618  *  mad.  Bear, special. */
619 {
620     int spk = actions[verb].message;
621     if (obj == BIRD) {
622         rspeak(BIRD_PINING);
623         return GO_CLEAROBJ;
624     } else if (obj == SNAKE ||
625                obj == DRAGON ||
626                obj == TROLL) {
627         spk = NOTHING_EDIBLE;
628         if (obj == DRAGON && game.prop[DRAGON] != DRAGON_BARS)
629             spk = RIDICULOUS_ATTEMPT;
630         if (obj == TROLL)
631             spk = TROLL_VICES;
632         if (obj == SNAKE && !game.closed && HERE(BIRD)) {
633             DESTROY(BIRD);
634             spk = BIRD_DEVOURED;
635         }
636     } else if (obj == DWARF) {
637         if (HERE(FOOD)) {
638             game.dflag += 2;
639             spk = REALLY_MAD;
640         }
641     } else if (obj == BEAR) {
642         if (game.prop[BEAR] == UNTAMED_BEAR)
643             spk = NOTHING_EDIBLE;
644         if (game.prop[BEAR] == BEAR_DEAD)
645             spk = RIDICULOUS_ATTEMPT;
646         if (HERE(FOOD)) {
647             DESTROY(FOOD);
648             game.prop[BEAR] = SITTING_BEAR;
649             game.fixed[AXE] = 0;
650             game.prop[AXE] = 0;
651             spk = BEAR_TAMED;
652         }
653     } else if (obj == OGRE) {
654         if (HERE(FOOD))
655             spk = OGRE_FULL;
656     } else {
657         spk = AM_GAME;
658     }
659     rspeak(spk);
660     return GO_CLEAROBJ;
661 }
662
663 int fill(token_t verb, token_t obj)
664 /*  Fill.  Bottle or urn must be empty, and liquid available.  (Vase
665  *  is nasty.) */
666 {
667     if (obj == VASE) {
668         if (LIQLOC(game.loc) == NO_OBJECT) {
669             rspeak(FILL_INVALID);
670             return GO_CLEAROBJ;
671         }
672         if (!TOTING(VASE)) {
673             rspeak(ARENT_CARRYING);
674             return GO_CLEAROBJ;
675         }
676         rspeak(SHATTER_VASE);
677         game.prop[VASE] = VASE_BROKEN;
678         game.fixed[VASE] = -1;
679         return (discard(verb, obj, true));
680     }
681
682     if (obj == URN) {
683         if (game.prop[URN] != URN_EMPTY) {
684             rspeak(FULL_URN);
685             return GO_CLEAROBJ;
686         }
687         if (!HERE(BOTTLE)) {
688             rspeak(FILL_INVALID);
689             return GO_CLEAROBJ;
690         }
691         int k = LIQUID();
692         switch (k) {
693         case WATER:
694             game.prop[BOTTLE] = EMPTY_BOTTLE;
695             rspeak(WATER_URN);
696             break;
697         case OIL:
698             game.prop[URN] = URN_DARK;
699             game.prop[BOTTLE] = EMPTY_BOTTLE;
700             rspeak(OIL_URN);
701             break;
702         case NO_OBJECT:
703         default:
704             rspeak(FILL_INVALID);
705             return GO_CLEAROBJ;
706         }
707         game.place[k] = LOC_NOWHERE;
708         return GO_CLEAROBJ;
709     }
710     if (obj != NO_OBJECT && obj != BOTTLE) {
711         rspeak(actions[verb].message);
712         return GO_CLEAROBJ;
713     }
714     if (obj == NO_OBJECT && !HERE(BOTTLE))
715         return GO_UNKNOWN;
716
717     if (HERE(URN) && game.prop[URN] != URN_EMPTY) {
718         rspeak(URN_NOPOUR);
719         return GO_CLEAROBJ;
720     }
721     if (LIQUID() != NO_OBJECT) {
722         rspeak(BOTTLE_FULL);
723         return GO_CLEAROBJ;
724     }
725     if (LIQLOC(game.loc) == NO_OBJECT) {
726         rspeak(NO_LIQUID);
727         return GO_CLEAROBJ;
728     }
729
730     game.prop[BOTTLE] = (LIQLOC(game.loc) == OIL) ? OIL_BOTTLE : WATER_BOTTLE;
731     if (TOTING(BOTTLE))
732         game.place[LIQUID()] = CARRIED;
733     if (LIQUID() == OIL)
734         rspeak(BOTTLED_OIL);
735     else
736         rspeak(BOTTLED_WATER);
737     return GO_CLEAROBJ;
738 }
739
740 static int find(token_t verb, token_t obj)
741 /* Find.  Might be carrying it, or it might be here.  Else give caveat. */
742 {
743     if (TOTING(obj)) {
744         rspeak(ALREADY_CARRYING);
745         return GO_CLEAROBJ;
746     }
747
748     if (game.closed) {
749         rspeak(NEEDED_NEARBY);
750         return GO_CLEAROBJ;
751     }
752
753     if (AT(obj) ||
754         (LIQUID() == obj && AT(BOTTLE)) ||
755         obj == LIQLOC(game.loc) ||
756         (obj == DWARF && atdwrf(game.loc) > 0)) {
757         rspeak(YOU_HAVEIT);
758         return GO_CLEAROBJ;
759     }
760
761
762     rspeak(actions[verb].message);
763     return GO_CLEAROBJ;
764 }
765
766 static int fly(token_t verb, token_t obj)
767 /* Fly.  Snide remarks unless hovering rug is here. */
768 {
769     if (obj == INTRANSITIVE) {
770         if (!HERE(RUG)) {
771             rspeak(FLAP_ARMS);
772             return GO_CLEAROBJ;
773         }
774         if (game.prop[RUG] != RUG_HOVER) {
775             rspeak(RUG_NOTHING2);
776             return GO_CLEAROBJ;
777         }
778         obj = RUG;
779     }
780
781     if (obj != RUG) {
782         rspeak(actions[verb].message);
783         return GO_CLEAROBJ;
784     }
785     if (game.prop[RUG] != RUG_HOVER) {
786         rspeak(RUG_NOTHING1);
787         return GO_CLEAROBJ;
788     }
789     game.oldlc2 = game.oldloc;
790     game.oldloc = game.loc;
791     /* FIXME: Arithmetic on location values */
792     game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc;
793
794     if (game.prop[SAPPH] >= 0) {
795         rspeak(RUG_RETURNS);
796     } else {
797         rspeak(RUG_GOES);
798     }
799     return GO_TERMINATE;
800 }
801
802 static int inven(void)
803 /* Inventory. If object, treat same as find.  Else report on current burden. */
804 {
805     bool empty = true;
806     for (int i = 1; i <= NOBJECTS; i++) {
807         if (i == BEAR ||
808             !TOTING(i))
809             continue;
810         if (empty) {
811             rspeak(NOW_HOLDING);
812             empty = false;
813         }
814         pspeak(i, touch, -1, false);
815     }
816     if (TOTING(BEAR))
817         rspeak(TAME_BEAR);
818     if (empty)
819         rspeak(NO_CARRY);
820     return GO_CLEAROBJ;
821 }
822
823 static int light(token_t verb, token_t obj)
824 /*  Light.  Applicable only to lamp and urn. */
825 {
826     if (obj == INTRANSITIVE) {
827         if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
828             obj = LAMP;
829         if (HERE(URN) && game.prop[URN] == URN_DARK)
830             obj =  URN;
831         if (obj == INTRANSITIVE ||
832             (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
833              HERE(URN) && game.prop[URN] == URN_DARK))
834             return GO_UNKNOWN;
835     }
836
837     if (obj == URN) {
838         state_change(URN, game.prop[URN] == URN_EMPTY ?
839                      URN_EMPTY :
840                      URN_LIT);
841         return GO_CLEAROBJ;
842     } else {
843         if (obj != LAMP) {
844             rspeak(actions[verb].message);
845             return GO_CLEAROBJ;
846         }
847         if (game.limit < 0) {
848             rspeak(LAMP_OUT);
849             return GO_CLEAROBJ;
850         }
851         state_change(LAMP, LAMP_BRIGHT);
852         if (game.wzdark)
853             return GO_TOP;
854         else
855             return GO_CLEAROBJ;
856     }
857 }
858
859 static int listen(void)
860 /*  Listen.  Intransitive only.  Print stuff based on objsnd/locsnd. */
861 {
862     long sound = locations[game.loc].sound;
863     if (sound != SILENT) {
864         rspeak(sound);
865         if (!locations[game.loc].loud)
866             rspeak(NO_MESSAGE);
867         return GO_CLEAROBJ;
868     }
869     for (int i = 1; i <= NOBJECTS; i++) {
870         if (!HERE(i) ||
871             objects[i].sounds[0] == NULL ||
872             game.prop[i] < 0)
873             continue;
874         int mi =  game.prop[i];
875         if (i == BIRD)
876             mi += 3 * game.blooded;
877         long packed_zzword = token_to_packed(game.zzword);
878         pspeak(i, hear, mi, true, packed_zzword);
879         rspeak(NO_MESSAGE);
880         /* FIXME: Magic number, sensitive to bird state logic */
881         if (i == BIRD && game.prop[i] == 5)
882             DESTROY(BIRD);
883         return GO_CLEAROBJ;
884     }
885     rspeak(ALL_SILENT);
886     return GO_CLEAROBJ;
887 }
888
889 static int lock(token_t verb, token_t obj)
890 /* Lock, unlock, no object given.  Assume various things if present. */
891 {
892     if (obj == INTRANSITIVE) {
893         if (HERE(CLAM))
894             obj = CLAM;
895         if (HERE(OYSTER))
896             obj = OYSTER;
897         if (AT(DOOR))
898             obj = DOOR;
899         if (AT(GRATE))
900             obj = GRATE;
901         if (HERE(CHAIN))
902             obj = CHAIN;
903         if (obj == INTRANSITIVE) {
904             rspeak(NOTHING_LOCKED);
905             return GO_CLEAROBJ;
906         }
907     }
908
909     /*  Lock, unlock object.  Special stuff for opening clam/oyster
910      *  and for chain. */
911     if (obj == GRATE ||
912         obj == CHAIN) {
913         if (HERE(KEYS)) {
914             if (obj == CHAIN)
915                 return chain(verb);
916             if (game.closng) {
917                 rspeak(EXIT_CLOSED);
918                 if (!game.panic)
919                     game.clock2 = PANICTIME;
920                 game.panic = true;
921                 return GO_CLEAROBJ ;
922             } else {
923                 state_change(GRATE, (verb == LOCK) ?
924                              GRATE_CLOSED :
925                              GRATE_OPEN);
926                 return GO_CLEAROBJ;
927             }
928         }
929         rspeak(NO_KEYS);
930         return GO_CLEAROBJ;
931     }
932
933     switch (obj) {
934     case CLAM:
935     case OYSTER:
936         return bivalve(verb, obj);
937     case DOOR:
938         rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR);
939         break;
940     case CAGE:
941         rspeak( NO_LOCK);
942         break;
943     case KEYS:
944         rspeak(CANNOT_UNLOCK);
945         break;
946     default:
947         rspeak(actions[verb].message);
948     }
949
950     return GO_CLEAROBJ;
951 }
952
953 static int pour(token_t verb, token_t obj)
954 /*  Pour.  If no object, or object is bottle, assume contents of bottle.
955  *  special tests for pouring water or oil on plant or rusty door. */
956 {
957     if (obj == BOTTLE ||
958         obj == NO_OBJECT)
959         obj = LIQUID();
960     if (obj == NO_OBJECT)
961         return GO_UNKNOWN;
962     if (!TOTING(obj)) {
963         rspeak(actions[verb].message);
964         return GO_CLEAROBJ;
965     }
966
967     if (obj != OIL && obj != WATER) {
968         rspeak(CANT_POUR);
969         return GO_CLEAROBJ;
970     }
971     if (HERE(URN) && game.prop[URN] == URN_EMPTY)
972         return fill(verb, URN);
973     game.prop[BOTTLE] = EMPTY_BOTTLE;
974     game.place[obj] = LOC_NOWHERE;
975     if (!(AT(PLANT) ||
976           AT(DOOR))) {
977         rspeak(GROUND_WET);
978         return GO_CLEAROBJ;
979     }
980     if (!AT(DOOR)) {
981         if (obj == WATER) {
982             /* cycle through the three plant states */
983             state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
984             game.prop[PLANT2] = game.prop[PLANT];
985             return GO_MOVE;
986         } else {
987             rspeak(SHAKING_LEAVES);
988             return GO_CLEAROBJ;
989         }
990     } else {
991         state_change(DOOR, (obj == OIL) ?
992                      DOOR_UNRUSTED :
993                      DOOR_RUSTED);
994         return GO_CLEAROBJ;
995     }
996 }
997
998 static int quit(void)
999 /*  Quit.  Intransitive only.  Verify intent and exit if that's what he wants. */
1000 {
1001     if (yes(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
1002         terminate(quitgame);
1003     return GO_CLEAROBJ;
1004 }
1005
1006 static int read(struct command_t command)
1007 /*  Read.  Print stuff based on objtxt.  Oyster (?) is special case. */
1008 {
1009     if (command.obj == INTRANSITIVE) {
1010         command.obj = 0;
1011         for (int i = 1; i <= NOBJECTS; i++) {
1012             if (HERE(i) && objects[i].texts[0] != NULL && game.prop[i] >= 0)
1013                 command.obj = command.obj * NOBJECTS + i;
1014         }
1015         if (command.obj > NOBJECTS ||
1016             command.obj == 0 ||
1017             DARK(game.loc))
1018             return GO_UNKNOWN;
1019     }
1020
1021     if (DARK(game.loc)) {
1022         sspeak(NO_SEE, command.raw1);
1023     } else if (command.obj == OYSTER && !game.clshnt && game.closed) {
1024         game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
1025     } else if (objects[command.obj].texts[0] == NULL ||
1026                game.prop[command.obj] < 0) {
1027         rspeak(actions[command.verb].message);
1028     } else
1029         pspeak(command.obj, study, game.prop[command.obj], true);
1030     return GO_CLEAROBJ;
1031 }
1032
1033 static int reservoir(void)
1034 /*  Z'ZZZ (word gets recomputed at startup; different each game). */
1035 {
1036     /* FIXME: Arithmetic on state numbers */
1037     if (!AT(RESER) && game.loc != game.fixed[RESER] - 1) {
1038         rspeak(NOTHING_HAPPENS);
1039         return GO_CLEAROBJ;
1040     } else {
1041         /* FIXME: Arithmetic on state numbers */
1042         pspeak(RESER, look, game.prop[RESER] + 1, true);
1043         game.prop[RESER] = 1 - game.prop[RESER];
1044         if (AT(RESER))
1045             return GO_CLEAROBJ;
1046         else {
1047             game.oldlc2 = game.loc;
1048             game.newloc = LOC_NOWHERE;
1049             rspeak(NOT_BRIGHT);
1050             return GO_TERMINATE;
1051         }
1052     }
1053 }
1054
1055 static int rub(token_t verb, token_t obj)
1056 /* Rub.  Yields various snide remarks except for lit urn. */
1057 {
1058     if (obj == URN && game.prop[URN] == URN_LIT) {
1059         DESTROY(URN);
1060         drop(AMBER, game.loc);
1061         game.prop[AMBER] = AMBER_IN_ROCK;
1062         --game.tally;
1063         drop(CAVITY, game.loc);
1064         rspeak(URN_GENIES);
1065     } else if (obj != LAMP) {
1066         rspeak(PECULIAR_NOTHING);
1067     } else {
1068         rspeak(actions[verb].message);
1069     }
1070     return GO_CLEAROBJ;
1071 }
1072
1073 static int say(struct command_t *command)
1074 /* Say.  Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).)  Magic words override. */
1075 {
1076     if (command->wd2 > 0) {
1077         command->wd1 = command->wd2;
1078         strcpy(command->raw1, command->raw2);
1079     }
1080     char word1[TOKLEN + 1];
1081     packed_to_token(command->wd1, word1);
1082     int wd = (int) get_vocab_id(word1);
1083     /* FIXME: magic numbers */
1084     if (wd == MOTION_WORD(XYZZY) ||
1085         wd == MOTION_WORD(PLUGH) ||
1086         wd == MOTION_WORD(PLOVER) ||
1087         wd == ACTION_WORD(GIANTWORDS) ||
1088         wd == ACTION_WORD(PART)) {
1089         /* FIXME: scribbles on the interpreter's command block */
1090         wordclear(&command->wd2);
1091         return GO_LOOKUP;
1092     }
1093     sspeak(OKEY_DOKEY, command->raw1);
1094     return GO_CLEAROBJ;
1095 }
1096
1097 static int throw_support(long spk)
1098 {
1099     rspeak(spk);
1100     drop(AXE, game.loc);
1101     return GO_MOVE;
1102 }
1103
1104 static int throw (struct command_t *command)
1105 /*  Throw.  Same as discard unless axe.  Then same as attack except
1106  *  ignore bird, and if dwarf is present then one might be killed.
1107  *  (Only way to do so!)  Axe also special for dragon, bear, and
1108  *  troll.  Treasures special for troll. */
1109 {
1110     if (TOTING(ROD2) && command->obj == ROD && !TOTING(ROD))
1111         command->obj = ROD2;
1112     if (!TOTING(command->obj)) {
1113         rspeak(actions[command->verb].message);
1114         return GO_CLEAROBJ;
1115     }
1116     if (objects[command->obj].is_treasure && AT(TROLL)) {
1117         /*  Snarf a treasure for the troll. */
1118         drop(command->obj, LOC_NOWHERE);
1119         move(TROLL, LOC_NOWHERE);
1120         move(TROLL + NOBJECTS, LOC_NOWHERE);
1121         drop(TROLL2, objects[TROLL].plac);
1122         drop(TROLL2 + NOBJECTS, objects[TROLL].fixd);
1123         juggle(CHASM);
1124         rspeak(TROLL_SATISFIED);
1125         return GO_CLEAROBJ;
1126     }
1127     if (command->obj == FOOD && HERE(BEAR)) {
1128         /* But throwing food is another story. */
1129         command->obj = BEAR;
1130         return (feed(command->verb, command->obj));
1131     }
1132     if (command->obj != AXE)
1133         return (discard(command->verb, command->obj, false));
1134     else {
1135         if (atdwrf(game.loc) <= 0) {
1136             if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS)
1137                 return throw_support(DRAGON_SCALES);
1138             if (AT(TROLL))
1139                 return throw_support(TROLL_RETURNS);
1140             else if (AT(OGRE))
1141                 return throw_support(OGRE_DODGE);
1142             else if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
1143                 /* This'll teach him to throw the axe at the bear! */
1144                 drop(AXE, game.loc);
1145                 game.fixed[AXE] = -1;
1146                 juggle(BEAR);
1147                 state_change(AXE, AXE_LOST);
1148                 return GO_CLEAROBJ;
1149             }
1150             command->obj = NO_OBJECT;
1151             return (attack(command));
1152         }
1153
1154         if (randrange(NDWARVES + 1) < game.dflag) {
1155             return throw_support(DWARF_DODGES);
1156         } else {
1157             long i = atdwrf(game.loc);
1158             game.dseen[i] = false;
1159             game.dloc[i] = LOC_NOWHERE;
1160             return throw_support((++game.dkill == 1) ?
1161                                  DWARF_SMOKE :
1162                                  KILLED_DWARF);
1163         }
1164     }
1165 }
1166
1167 static int wake(token_t verb, token_t obj)
1168 /* Wake.  Only use is to disturb the dwarves. */
1169 {
1170     if (obj != DWARF ||
1171         !game.closed) {
1172         rspeak(actions[verb].message);
1173         return GO_CLEAROBJ;
1174     } else {
1175         rspeak(PROD_DWARF);
1176         return GO_DWARFWAKE;
1177     }
1178 }
1179
1180 static int wave(token_t verb, token_t obj)
1181 /* Wave.  No effect unless waving rod at fissure or at bird. */
1182 {
1183     if (obj != ROD ||
1184         !TOTING(obj) ||
1185         (!HERE(BIRD) &&
1186          (game.closng ||
1187           !AT(FISSURE)))) {
1188         rspeak(((!TOTING(obj)) && (obj != ROD ||
1189                                    !TOTING(ROD2))) ?
1190                ARENT_CARRYING :
1191                actions[verb].message);
1192         return GO_CLEAROBJ;
1193     }
1194
1195     if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
1196         drop(JADE, game.loc);
1197         game.prop[JADE] = 0;
1198         --game.tally;
1199         rspeak(NECKLACE_FLY);
1200         return GO_CLEAROBJ;
1201     } else {
1202         if (game.closed) {
1203             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1204                    CAGE_FLY :
1205                    FREE_FLY);
1206             return GO_DWARFWAKE;
1207         }
1208         if (game.closng ||
1209             !AT(FISSURE)) {
1210             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1211                    CAGE_FLY :
1212                    FREE_FLY);
1213             return GO_CLEAROBJ;
1214         }
1215         if (HERE(BIRD))
1216             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1217                    CAGE_FLY :
1218                    FREE_FLY);
1219
1220         /* FIXME: Arithemetic on property values */
1221         game.prop[FISSURE] = 1 - game.prop[FISSURE];
1222         pspeak(FISSURE, look, 2 - game.prop[FISSURE], true);
1223         return GO_CLEAROBJ;
1224     }
1225 }
1226
1227 int action(struct command_t *command)
1228 /*  Analyse a verb.  Remember what it was, go back for object if second word
1229  *  unless verb is "say", which snarfs arbitrary second word.
1230  */
1231 {
1232     if (command->part == unknown) {
1233         /*  Analyse an object word.  See if the thing is here, whether
1234          *  we've got a verb yet, and so on.  Object must be here
1235          *  unless verb is "find" or "invent(ory)" (and no new verb
1236          *  yet to be analysed).  Water and oil are also funny, since
1237          *  they are never actually dropped at any location, but might
1238          *  be here inside the bottle or urn or as a feature of the
1239          *  location. */
1240         if (HERE(command->obj))
1241             /* FALL THROUGH */;
1242         else if (command->obj == GRATE) {
1243             if (game.loc == LOC_START ||
1244                 game.loc == LOC_VALLEY ||
1245                 game.loc == LOC_SLIT) {
1246                 command->obj = DPRSSN;
1247             }
1248             if (game.loc == LOC_COBBLE ||
1249                 game.loc == LOC_DEBRIS ||
1250                 game.loc == LOC_AWKWARD ||
1251                 game.loc == LOC_BIRD ||
1252                 game.loc == LOC_PITTOP) {
1253                 command->obj = ENTRNC;
1254             }
1255         } else if (command->obj == DWARF && atdwrf(game.loc) > 0)
1256             /* FALL THROUGH */;
1257         else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
1258                  command->obj == LIQLOC(game.loc))
1259             /* FALL THROUGH */;
1260         else if (command->obj == OIL && HERE(URN) && game.prop[URN] != 0) {
1261             command->obj = URN;
1262             /* FALL THROUGH */;
1263         } else if (command->obj == PLANT && AT(PLANT2) && game.prop[PLANT2] != 0) {
1264             command->obj = PLANT2;
1265             /* FALL THROUGH */;
1266         } else if (command->obj == KNIFE && game.knfloc == game.loc) {
1267             game.knfloc = -1;
1268             rspeak(KNIVES_VANISH);
1269             return GO_CLEAROBJ;
1270         } else if (command->obj == ROD && HERE(ROD2)) {
1271             command->obj = ROD2;
1272             /* FALL THROUGH */;
1273         } else if ((command->verb == FIND ||
1274                     command->verb == INVENTORY) && command->wd2 <= 0)
1275             /* FALL THROUGH */;
1276         else {
1277             sspeak(NO_SEE, command->raw1);
1278             return GO_CLEAROBJ;
1279         }
1280
1281         if (command->wd2 > 0)
1282             return GO_WORD2;
1283         if (command->verb != 0)
1284             command->part = transitive;
1285     }
1286
1287     switch (command->part) {
1288     case intransitive:
1289         if (command->wd2 > 0 && command->verb != SAY)
1290             return GO_WORD2;
1291         if (command->verb == SAY)
1292             command->obj = command->wd2;
1293         if (command->obj == 0 ||
1294             command->obj == INTRANSITIVE) {
1295             /*  Analyse an intransitive verb (ie, no object given yet). */
1296             switch (command->verb) {
1297             case CARRY:
1298                 return vcarry(command->verb, INTRANSITIVE);
1299             case  DROP:
1300                 return GO_UNKNOWN;
1301             case  SAY:
1302                 return GO_UNKNOWN;
1303             case  UNLOCK:
1304                 return lock(command->verb, INTRANSITIVE);
1305             case  NOTHING: {
1306                 rspeak(OK_MAN);
1307                 return (GO_CLEAROBJ);
1308             }
1309             case  LOCK:
1310                 return lock(command->verb, INTRANSITIVE);
1311             case  LIGHT:
1312                 return light(command->verb, INTRANSITIVE);
1313             case  EXTINGUISH:
1314                 return extinguish(command->verb, INTRANSITIVE);
1315             case  WAVE:
1316                 return GO_UNKNOWN;
1317             case  TAME:
1318                 return GO_UNKNOWN;
1319             case GO: {
1320                 rspeak(actions[command->verb].message);
1321                 return GO_CLEAROBJ;
1322             }
1323             case ATTACK:
1324                 return attack(command);
1325             case POUR:
1326                 return pour(command->verb, command->obj);
1327             case EAT:
1328                 return eat(command->verb, INTRANSITIVE);
1329             case DRINK:
1330                 return drink(command->verb, command->obj);
1331             case RUB:
1332                 return GO_UNKNOWN;
1333             case THROW:
1334                 return GO_UNKNOWN;
1335             case QUIT:
1336                 return quit();
1337             case FIND:
1338                 return GO_UNKNOWN;
1339             case INVENTORY:
1340                 return inven();
1341             case FEED:
1342                 return GO_UNKNOWN;
1343             case FILL:
1344                 return fill(command->verb, command->obj);
1345             case BLAST:
1346                 blast();
1347                 return GO_CLEAROBJ;
1348             case SCORE:
1349                 score(scoregame);
1350                 return GO_CLEAROBJ;
1351             case GIANTWORDS:
1352                 return bigwords(command->wd1);
1353             case BRIEF:
1354                 return brief();
1355             case READ:
1356                 command->obj = INTRANSITIVE;
1357                 return read(*command);
1358             case BREAK:
1359                 return GO_UNKNOWN;
1360             case WAKE:
1361                 return GO_UNKNOWN;
1362             case SAVE:
1363                 return suspend();
1364             case RESUME:
1365                 return resume();
1366             case FLY:
1367                 return fly(command->verb, INTRANSITIVE);
1368             case LISTEN:
1369                 return listen();
1370             case PART:
1371                 return reservoir();
1372             default:
1373                 BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1374             }
1375         }
1376     /* FALLTHRU */
1377     case transitive:
1378         /*  Analyse a transitive verb. */
1379         switch (command->verb) {
1380         case  CARRY:
1381             return vcarry(command->verb, command->obj);
1382         case  DROP:
1383             return discard(command->verb, command->obj, false);
1384         case  SAY:
1385             return say(command);
1386         case  UNLOCK:
1387             return lock(command->verb, command->obj);
1388         case  NOTHING: {
1389             rspeak(OK_MAN);
1390             return (GO_CLEAROBJ);
1391         }
1392         case  LOCK:
1393             return lock(command->verb, command->obj);
1394         case LIGHT:
1395             return light(command->verb, command->obj);
1396         case EXTINGUISH:
1397             return extinguish(command->verb, command->obj);
1398         case WAVE:
1399             return wave(command->verb, command->obj);
1400         case TAME: {
1401             rspeak(actions[command->verb].message);
1402             return GO_CLEAROBJ;
1403         }
1404         case GO: {
1405             rspeak(actions[command->verb].message);
1406             return GO_CLEAROBJ;
1407         }
1408         case ATTACK:
1409             return attack(command);
1410         case POUR:
1411             return pour(command->verb, command->obj);
1412         case EAT:
1413             return eat(command->verb, command->obj);
1414         case DRINK:
1415             return drink(command->verb, command->obj);
1416         case RUB:
1417             return rub(command->verb, command->obj);
1418         case THROW:
1419             return throw (command);
1420         case QUIT: {
1421             rspeak(actions[command->verb].message);
1422             return GO_CLEAROBJ;
1423         }
1424         case FIND:
1425             return find(command->verb, command->obj);
1426         case INVENTORY:
1427             return find(command->verb, command->obj);
1428         case FEED:
1429             return feed(command->verb, command->obj);
1430         case FILL:
1431             return fill(command->verb, command->obj);
1432         case BLAST:
1433             blast();
1434             return GO_CLEAROBJ;
1435         case SCORE: {
1436             rspeak(actions[command->verb].message);
1437             return GO_CLEAROBJ;
1438         }
1439         case GIANTWORDS: {
1440             rspeak(actions[command->verb].message);
1441             return GO_CLEAROBJ;
1442         }
1443         case BRIEF: {
1444             rspeak(actions[command->verb].message);
1445             return GO_CLEAROBJ;
1446         }
1447         case READ:
1448             return read(*command);
1449         case BREAK:
1450             return vbreak(command->verb, command->obj);
1451         case WAKE:
1452             return wake(command->verb, command->obj);
1453         case SAVE: {
1454             rspeak(actions[command->verb].message);
1455             return GO_CLEAROBJ;
1456         }
1457         case RESUME: {
1458             rspeak(actions[command->verb].message);
1459             return GO_CLEAROBJ;
1460         }
1461         case FLY:
1462             return fly(command->verb, command->obj);
1463         case LISTEN: {
1464             rspeak(actions[command->verb].message);
1465             return GO_CLEAROBJ;
1466         }
1467         case PART:
1468             return reservoir();
1469         default:
1470             BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1471         }
1472     case unknown:
1473         /* Unknown verb, couldn't deduce object - might need hint */
1474         sspeak(WHAT_DO, command->raw1);
1475         return GO_CHECKHINT;
1476     default:
1477         BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
1478     }
1479 }