Merge branch 'master' into actions-arithmetic
[open-adventure.git] / actions.c
1 #include <stdlib.h>
2 #include <stdbool.h>
3 #include "advent.h"
4 #include "database.h"
5 #include "newdb.h"
6
7 /* Limit visibility of ugly globals.  Eventually these should go away. */
8 extern long WD1, WD1X, WD2, WD2X;
9
10 /*
11  * Action handlers.  Eventually we'll do lookup through a method table
12  * that calls these.
13  */
14
15 static int fill(token_t verb, token_t);
16
17 static int attack(FILE *input, long verb, token_t obj)
18 /*  Attack.  Assume target if unambiguous.  "Throw" also links here.
19  *  Attackable objects fall into two categories: enemies (snake,
20  *  dwarf, etc.)  and others (bird, clam, machine).  Ambiguous if 2
21  *  enemies, or no enemies but 2 others. */
22 {
23     int spk = ACTSPK[verb];
24     int d = ATDWRF(game.loc);
25     if (obj == 0) {
26         if (d > 0)
27             obj=DWARF;
28         if (HERE(SNAKE))obj=obj*NOBJECTS+SNAKE;
29         if (AT(DRAGON) && game.prop[DRAGON] == 0)obj=obj*NOBJECTS+DRAGON;
30         if (AT(TROLL))obj=obj*NOBJECTS+TROLL;
31         if (AT(OGRE))obj=obj*NOBJECTS+OGRE;
32         if (HERE(BEAR) && game.prop[BEAR] == 0)obj=obj*NOBJECTS+BEAR;
33         if (obj > NOBJECTS) return GO_UNKNOWN;
34         if (obj == 0) {
35             /* Can't attack bird or machine by throwing axe. */
36             if (HERE(BIRD) && verb != THROW)obj=BIRD;
37             if (HERE(VEND) && verb != THROW)obj=obj*NOBJECTS+VEND;
38             /* Clam and oyster both treated as clam for intransitive case;
39              * no harm done. */
40             if (HERE(CLAM) || HERE(OYSTER))obj=NOBJECTS*obj+CLAM;
41             if (obj > NOBJECTS) return GO_UNKNOWN;
42         }
43     }
44     if (obj == BIRD) {
45         spk=UNHAPPY_BIRD;
46         if (game.closed)
47         {
48             RSPEAK(spk);
49             return GO_CLEAROBJ;
50         }
51         DESTROY(BIRD);
52         game.prop[BIRD]=0;
53         spk=BIRD_DEAD;
54     }
55     if (obj == VEND) {
56         PSPEAK(VEND,game.prop[VEND]+2);
57         game.prop[VEND]=3-game.prop[VEND];
58         return GO_CLEAROBJ;
59     }
60
61     if (obj == 0)spk=NO_TARGET;
62     if (obj == CLAM || obj == OYSTER)spk=SHELL_IMPERVIOUS;
63     if (obj == SNAKE)spk=SNAKE_WARNING;
64     if (obj == DWARF)spk=BARE_HANDS_QUERY;
65     if (obj == DWARF && game.closed) return GO_DWARFWAKE;
66     if (obj == DRAGON)spk=ALREADY_DEAD;
67     if (obj == TROLL)spk=ROCKY_TROLL;
68     if (obj == OGRE)spk=OGRE_DODGE;
69     if (obj == OGRE && d > 0) {
70         RSPEAK(spk);
71         RSPEAK(KNIFE_THROWN);
72         DESTROY(OGRE);
73         int dwarves=0;
74         for (int i=1; i < PIRATE; i++) {
75             if (game.dloc[i] == game.loc) {
76                 ++dwarves;
77                 game.dloc[i] = LOC_LONGWEST;
78                 game.dseen[i]=false;
79             }
80         }
81         spk=dwarves == 2 ? OGRE_PANIC1 : OGRE_PANIC2;
82         RSPEAK(spk);
83         return GO_CLEAROBJ;
84     }
85     else if (obj == BEAR)
86         /* FIXME: Arithmetic on message numbers */
87         spk = BEAR_HANDS+(game.prop[BEAR]+1)/2;
88     else if (obj == DRAGON && game.prop[DRAGON] == 0) {
89         /*  Fun stuff for dragon.  If he insists on attacking it, win!
90          *  Set game.prop to dead, move dragon to central loc (still
91          *  fixed), move rug there (not fixed), and move him there,
92          *  too.  Then do a null motion to get new description. */
93         RSPEAK(BARE_HANDS_QUERY);
94         GETIN(input,&WD1,&WD1X,&WD2,&WD2X);
95         if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519))
96             return GO_CHECKFOO;
97         PSPEAK(DRAGON,3);
98         game.prop[DRAGON]=1;
99         game.prop[RUG]=0;
100         int k=(PLAC[DRAGON]+FIXD[DRAGON])/2;
101         MOVE(DRAGON+NOBJECTS,-1);
102         MOVE(RUG+NOBJECTS,0);
103         MOVE(DRAGON,k);
104         MOVE(RUG,k);
105         DROP(BLOOD,k);
106         for (obj=1; obj<=NOBJECTS; obj++) {
107             if (game.place[obj] == PLAC[DRAGON] || game.place[obj] == FIXD[DRAGON])
108                 MOVE(obj,k);
109         }
110         game.loc=k;
111         return GO_MOVE;
112     }
113
114     RSPEAK(spk);
115     return GO_CLEAROBJ;
116 }
117
118 static int bigwords(long foo)
119 /*  FEE FIE FOE FOO (AND FUM).  Advance to next state if given in proper order.
120  *  Look up WD1 in section 3 of vocab to determine which word we've got.  Last
121  *  word zips the eggs back to the giant room (unless already there). */
122 {
123     int k=VOCAB(foo,3);
124     int spk=NOTHING_HAPPENS;
125     if (game.foobar != 1-k) {
126         if (game.foobar != 0)spk=START_OVER;
127         RSPEAK(spk);
128         return GO_CLEAROBJ;
129     } else {
130         game.foobar=k;
131         if (k != 4) {
132             RSPEAK(OK_MAN);
133             return GO_CLEAROBJ;
134         }
135         game.foobar=0;
136         if (game.place[EGGS]==PLAC[EGGS] || (TOTING(EGGS) && game.loc==PLAC[EGGS])) {
137             RSPEAK(spk);
138             return GO_CLEAROBJ;
139         } else {
140             /*  Bring back troll if we steal the eggs back from him before
141              *  crossing. */
142             if (game.place[EGGS]==0 && game.place[TROLL]==0 && game.prop[TROLL]==0)
143                 game.prop[TROLL]=1;
144             k=2;
145             if (HERE(EGGS))k=1;
146             if (game.loc == PLAC[EGGS])k=0;
147             MOVE(EGGS,PLAC[EGGS]);
148             PSPEAK(EGGS,k);
149             return GO_CLEAROBJ;
150         }
151     }
152 }
153
154 static int bivalve(token_t verb, token_t obj)
155 /* Clam/oyster actions */
156 {
157     int spk;
158     bool is_oyster = (obj == OYSTER);
159     spk= is_oyster ? OYSTER_OPENS : PEARL_FALLS;
160     if (TOTING(obj))spk= is_oyster ? DROP_OYSTER : DROP_CLAM;
161     if (!TOTING(TRIDNT))spk= is_oyster ? OYSTER_OPENER : CLAM_OPENER;
162     if (verb == LOCK)spk=HUH_MAN;
163     if (spk == PEARL_FALLS) {
164         DESTROY(CLAM);
165         DROP(OYSTER,game.loc);
166         DROP(PEARL,LOC_CULDESAC);
167     }
168     RSPEAK(spk);
169     return GO_CLEAROBJ;
170 }
171
172 static int blast(void)
173 /*  Blast.  No effect unless you've got dynamite, which is a neat trick! */
174 {
175     if (game.prop[ROD2] < 0 || !game.closed)
176     {
177         RSPEAK(REQUIRES_DYNAMITE);
178         return GO_CLEAROBJ;
179     }
180     game.bonus=133;
181     if (game.loc == LOC_NE)
182         game.bonus=134;
183     if (HERE(ROD2))
184         game.bonus=135;
185     RSPEAK(game.bonus);
186     score(endgame);
187     return GO_CLEAROBJ; /* pacify compiler - we never get here */
188 }
189
190 static int vbreak(token_t verb, token_t obj)
191 /*  Break.  Only works for mirror in repository and, of course, the vase. */
192 {
193     int spk = ACTSPK[verb];
194     if (obj == MIRROR)spk=TOO_FAR;
195     if (obj == VASE && game.prop[VASE] == 0) {
196         if (TOTING(VASE))DROP(VASE,game.loc);
197         game.prop[VASE]=2;
198         game.fixed[VASE]= -1;
199         spk=BREAK_VASE;
200     } else {
201         if (obj == MIRROR && game.closed) {
202             RSPEAK(BREAK_MIRROR);
203             return GO_DWARFWAKE;
204         }
205     }
206     RSPEAK(spk);
207     return GO_CLEAROBJ;
208 }
209
210 static int brief(void)
211 /*  Brief.  Intransitive only.  Suppress long descriptions after first time. */
212 {
213     game.abbnum=10000;
214     game.detail=3;
215     RSPEAK(BRIEF_CONFIRM);
216     return GO_CLEAROBJ;
217 }
218
219 static int carry(token_t verb, token_t obj)
220 /*  Carry an object.  Special cases for bird and cage (if bird in cage, can't
221  *  take one without the other).  Liquids also special, since they depend on
222  *  status of bottle.  Also various side effects, etc. */
223 {
224     int spk;
225     if (obj == INTRANSITIVE) {
226         /*  Carry, no object given yet.  OK if only one object present. */
227         if(game.atloc[game.loc] == 0 ||
228            game.link[game.atloc[game.loc]] != 0 ||
229            ATDWRF(game.loc) > 0)
230             return GO_UNKNOWN;
231         obj=game.atloc[game.loc];
232     }
233
234     if (TOTING(obj)) {RSPEAK(ALREADY_CARRYING); return GO_CLEAROBJ;}
235     spk=YOU_JOKING;
236     if (obj == PLANT && game.prop[PLANT] <= 0)spk=DEEP_ROOTS;
237     if (obj == BEAR && game.prop[BEAR] == 1)spk=BEAR_CHAINED;
238     if (obj == CHAIN && game.prop[BEAR] != 0)spk=STILL_LOCKED;
239     if (obj == URN)spk=URN_NOBUDGE;
240     if (obj == CAVITY)spk=DOUGHNUT_HOLES;
241     if (obj == BLOOD)spk=FEW_DROPS;
242     if (obj == RUG && game.prop[RUG] == 2)spk=RUG_HOVERS;
243     if (obj == SIGN)spk=HAND_PASSTHROUGH;
244     if (obj == MESSAG) {
245         RSPEAK(REMOVE_MESSAGE);
246         DESTROY(MESSAG);
247         return GO_CLEAROBJ;
248     }
249     if (game.fixed[obj] != 0) {
250         RSPEAK(spk);
251         return GO_CLEAROBJ;
252     }
253     if (obj == WATER || obj == OIL) {
254         if (!HERE(BOTTLE) || LIQUID() != obj) {
255             if (TOTING(BOTTLE) && game.prop[BOTTLE] == 1)
256                 return(fill(verb, BOTTLE));
257             if (game.prop[BOTTLE] != 1)spk=BOTTLE_FULL;
258             if (!TOTING(BOTTLE))spk=NO_CONTAINER;
259             RSPEAK(spk);
260             return GO_CLEAROBJ;
261         }
262         obj = BOTTLE;
263     }
264
265     spk=CARRY_LIMIT;
266     if (game.holdng >= INVLIMIT) {
267         RSPEAK(spk);
268         return GO_CLEAROBJ;
269     }
270     else if (obj == BIRD && game.prop[BIRD] != 1 && -1-game.prop[BIRD] != 1) {
271         if (game.prop[BIRD] == 2) {
272             DESTROY(BIRD);
273             RSPEAK(BIRD_CRAP);
274             return GO_CLEAROBJ;
275         }
276         if (!TOTING(CAGE))spk=CANNOT_CARRY;
277         if (TOTING(ROD))spk=BIRD_EVADES;
278         if (spk == CANNOT_CARRY || spk == BIRD_EVADES) {
279             RSPEAK(spk);
280             return GO_CLEAROBJ;
281         }
282         game.prop[BIRD]=1;
283     }
284     if ((obj==BIRD || obj==CAGE) && (game.prop[BIRD]==1 || -1-game.prop[BIRD]==1))
285         CARRY(BIRD+CAGE-obj,game.loc);
286     CARRY(obj,game.loc);
287     if (obj == BOTTLE && LIQUID() != 0)
288         game.place[LIQUID()] = CARRIED;
289     if (GSTONE(obj) && game.prop[obj] != 0) {
290         game.prop[obj]=0;
291         game.prop[CAVITY]=1;
292     }
293     RSPEAK(OK_MAN);
294     return GO_CLEAROBJ;
295 }
296
297 static int chain(token_t verb)
298 /* Do something to the bear's chain */
299 {
300     int spk;
301     if (verb != LOCK) {
302         spk=CHAIN_UNLOCKED;
303         if (game.prop[BEAR] == 0)spk=BEAR_BLOCKS;
304         if (game.prop[CHAIN] == 0)spk=ALREADY_UNLOCKED;
305         if (spk != CHAIN_UNLOCKED) {RSPEAK(spk); return GO_CLEAROBJ;}
306         game.prop[CHAIN]=0;
307         game.fixed[CHAIN]=0;
308         if (game.prop[BEAR] != 3)game.prop[BEAR]=2;
309         game.fixed[BEAR]=2-game.prop[BEAR];
310     } else {
311         spk=CHAIN_LOCKED;
312         if (game.prop[CHAIN] != 0)spk=ALREADY_LOCKED;
313         if (game.loc != PLAC[CHAIN])spk=NO_LOCKSITE;
314         if (spk != CHAIN_LOCKED) {
315             RSPEAK(spk);
316             return GO_CLEAROBJ;
317         }
318         game.prop[CHAIN]=2;
319         if (TOTING(CHAIN))DROP(CHAIN,game.loc);
320         game.fixed[CHAIN]= -1;
321     }
322     RSPEAK(spk);
323     return GO_CLEAROBJ;
324 }
325
326 static int discard(token_t verb, token_t obj, bool just_do_it)
327 /*  Discard object.  "Throw" also comes here for most objects.  Special cases for
328  *  bird (might attack snake or dragon) and cage (might contain bird) and vase.
329  *  Drop coins at vending machine for extra batteries. */
330 {
331     int spk = ACTSPK[verb];
332     if (!just_do_it) {
333         if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj=ROD2;
334         if (!TOTING(obj)) {RSPEAK(spk); return GO_CLEAROBJ;}
335         if (obj == BIRD && HERE(SNAKE)) {
336             RSPEAK(BIRD_ATTACKS);
337             if (game.closed) return GO_DWARFWAKE;
338             DESTROY(SNAKE);
339             /* Set game.prop for use by travel options */
340             game.prop[SNAKE]=1;
341
342         } else if ((GSTONE(obj) && AT(CAVITY) && game.prop[CAVITY] != 0)) {
343             RSPEAK(GEM_FITS);
344             game.prop[obj]=1;
345             game.prop[CAVITY]=0;
346             if (HERE(RUG) && ((obj == EMRALD && game.prop[RUG] != 2) || (obj == RUBY &&
347                                                                          game.prop[RUG] == 2))) {
348                 spk=RUG_RISES;
349                 if (TOTING(RUG))spk=RUG_WIGGLES;
350                 if (obj == RUBY)spk=RUG_SETTLES;
351                 RSPEAK(spk);
352                 if (spk != RUG_WIGGLES) {
353                     int k = 2-game.prop[RUG];
354                     game.prop[RUG] = k;
355                     if (k == 2) k = PLAC[SAPPH];
356                     MOVE(RUG+NOBJECTS, k);
357                 }
358             }
359         } else if (obj == COINS && HERE(VEND)) {
360             DESTROY(COINS);
361             DROP(BATTER,game.loc);
362             PSPEAK(BATTER,0);
363             return GO_CLEAROBJ;
364         } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) {
365             RSPEAK(BIRD_BURNT);
366             DESTROY(BIRD);
367             game.prop[BIRD]=0;
368             return GO_CLEAROBJ;
369         } else if (obj == BEAR && AT(TROLL)) {
370             RSPEAK(TROLL_SCAMPERS);
371             MOVE(TROLL,0);
372             MOVE(TROLL+NOBJECTS,0);
373             MOVE(TROLL2,PLAC[TROLL]);
374             MOVE(TROLL2+NOBJECTS,FIXD[TROLL]);
375             JUGGLE(CHASM);
376             game.prop[TROLL]=2;
377         } else if (obj != VASE || game.loc == PLAC[PILLOW]) {
378             RSPEAK(OK_MAN);
379         } else {
380             game.prop[VASE]=2;
381             if (AT(PILLOW))game.prop[VASE]=0;
382             PSPEAK(VASE,game.prop[VASE]+1);
383             if (game.prop[VASE] != 0)game.fixed[VASE]= -1;
384         }
385     }
386     int k = LIQUID();
387     if (k == obj)obj=BOTTLE;
388     if (obj == BOTTLE && k != 0)
389         game.place[k] = NOWHERE;
390     if (obj == CAGE && game.prop[BIRD] == 1)DROP(BIRD,game.loc);
391     DROP(obj,game.loc);
392     if (obj != BIRD) return GO_CLEAROBJ;
393     game.prop[BIRD]=0;
394     if (FOREST(game.loc))game.prop[BIRD]=2;
395     return GO_CLEAROBJ;
396 }
397
398 static int drink(token_t verb, token_t obj)
399 /*  Drink.  If no object, assume water and look for it here.  If water is in
400  *  the bottle, drink that, else must be at a water loc, so drink stream. */
401 {
402     int spk = ACTSPK[verb];
403     if (obj == 0 && LIQLOC(game.loc) != WATER && (LIQUID() != WATER || !HERE(BOTTLE)))
404         return GO_UNKNOWN;
405     if (obj != BLOOD) {
406         if (obj != 0 && obj != WATER)spk=RIDICULOUS_ATTEMPT;
407         if (spk != RIDICULOUS_ATTEMPT && LIQUID() == WATER && HERE(BOTTLE)) {
408             game.prop[BOTTLE] = 1;
409             game.place[WATER] = NOWHERE;
410             spk=BOTTLE_EMPTY;
411         }
412     } else {
413         DESTROY(BLOOD);
414         game.prop[DRAGON]=2;
415         OBJSND[BIRD]=OBJSND[BIRD]+3;
416         spk=HEAD_BUZZES;
417     }
418     RSPEAK(spk);
419     return GO_CLEAROBJ;
420 }
421
422 static int eat(token_t verb, token_t obj)
423 /*  Eat.  Intransitive: assume food if present, else ask what.  Transitive: food
424  *  ok, some things lose appetite, rest are ridiculous. */
425 {
426     int spk = ACTSPK[verb];
427     if (obj == INTRANSITIVE) {
428         if (!HERE(FOOD))
429             return GO_UNKNOWN;
430         DESTROY(FOOD);
431         spk=THANKS_DELICIOUS;
432     } else {
433         if (obj == FOOD) {
434             DESTROY(FOOD);
435             spk=THANKS_DELICIOUS;
436         }
437         if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
438            DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj ==
439            OGRE)spk=LOST_APPETITE;
440     }
441     RSPEAK(spk);
442     return GO_CLEAROBJ;
443 }
444
445 static int extinguish(token_t verb, int obj)
446 /* Extinguish.  Lamp, urn, dragon/volcano (nice try). */
447 {
448     int spk = ACTSPK[verb];
449     if (obj == INTRANSITIVE) {
450         if (HERE(LAMP) && game.prop[LAMP] == 1)obj=LAMP;
451         if (HERE(URN) && game.prop[URN] == 2)obj=obj*NOBJECTS+URN;
452         if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) return GO_UNKNOWN;
453     }
454
455     if (obj == URN) {
456         game.prop[URN]=game.prop[URN]/2;
457         spk=URN_DARK;
458     }
459     else if (obj == LAMP) {
460         game.prop[LAMP]=0;
461         RSPEAK(LAMP_OFF);
462         spk = DARK(game.loc) ? PITCH_DARK : ARB_0;
463     }
464     else if (obj == DRAGON || obj == VOLCAN)
465         spk=BEYOND_POWER;
466     RSPEAK(spk);
467     return GO_CLEAROBJ;
468 }
469
470 static int feed(token_t verb, token_t obj)
471 /*  Feed.  If bird, no seed.  Snake, dragon, troll: quip.  If dwarf, make him
472  *  mad.  Bear, special. */
473 {
474     int spk = ACTSPK[verb];
475     if (obj == BIRD) {
476         RSPEAK(BIRD_PINING);
477         return GO_CLEAROBJ;
478     }
479     else if (obj == SNAKE || obj == DRAGON || obj == TROLL) {
480         spk=NOTHING_EDIBLE;
481         if (obj == DRAGON && game.prop[DRAGON] != 0)spk=RIDICULOUS_ATTEMPT;
482         if (obj == TROLL)spk=TROLL_VICES;
483         if (obj == SNAKE && !game.closed && HERE(BIRD)) {
484             DESTROY(BIRD);
485             game.prop[BIRD]=0;
486             spk = BIRD_DEVOURED;
487         }
488     }
489     else if (obj == DWARF) {
490         if (HERE(FOOD)) {
491             game.dflag += 2;
492             spk = REALLY_MAD;
493         }
494     }
495     else if (obj == BEAR) {
496         if (game.prop[BEAR] == 0)spk=NOTHING_EDIBLE;
497         if (game.prop[BEAR] == 3)spk=RIDICULOUS_ATTEMPT;
498         if (HERE(FOOD)) {
499             DESTROY(FOOD);
500             game.prop[BEAR]=1;
501             game.fixed[AXE]=0;
502             game.prop[AXE]=0;
503             spk=BEAR_TAMED;
504         }
505     }
506     else if (obj == OGRE) {
507         if (HERE(FOOD))
508             spk=OGRE_FULL;
509     } else {
510         spk=AM_GAME;
511     }
512     RSPEAK(spk);
513     return GO_CLEAROBJ;
514 }
515
516 int fill(token_t verb, token_t obj)
517 /*  Fill.  Bottle or urn must be empty, and liquid available.  (Vase
518  *  is nasty.) */
519 {
520     int k;
521     int spk = ACTSPK[verb];
522     if (obj == VASE) {
523         spk=ARENT_CARRYING;
524         if (LIQLOC(game.loc) == 0)spk=FILL_INVALID;
525         if (LIQLOC(game.loc) == 0 || !TOTING(VASE)) {
526             RSPEAK(spk);
527             return GO_CLEAROBJ;
528         }
529         RSPEAK(SHATTER_VASE);
530         game.prop[VASE] = 2;
531         game.fixed[VASE]= -1;
532         return(discard(verb, obj, true));
533     }
534     else if (obj == URN) {
535         spk=FULL_URN;
536         if (game.prop[URN] != 0) {RSPEAK(spk); return GO_CLEAROBJ;}
537         spk=FILL_INVALID;
538         k=LIQUID();
539         if (k == 0 || !HERE(BOTTLE)) {RSPEAK(spk); return GO_CLEAROBJ;}
540         game.place[k] = NOWHERE;
541         game.prop[BOTTLE] = 1;
542         if (k == OIL)game.prop[URN]=1;
543         spk=WATER_URN+game.prop[URN];
544         RSPEAK(spk);
545         return GO_CLEAROBJ;
546     }
547     else if (obj != 0 && obj != BOTTLE) {
548         RSPEAK(spk);
549         return GO_CLEAROBJ;
550     }
551     else if (obj == 0 && !HERE(BOTTLE))
552         return GO_UNKNOWN;
553     spk=BOTTLED_WATER;
554     if (LIQLOC(game.loc) == 0)
555         spk=NO_LIQUID;
556     if (HERE(URN) && game.prop[URN] != 0)
557         spk=URN_NOPOUR;
558     if (LIQUID() != 0)
559         spk=BOTTLE_FULL;
560     if (spk == 107) {
561         game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2;
562         k=LIQUID();
563         if (TOTING(BOTTLE))
564             game.place[k] = CARRIED;
565         if (k == OIL)
566             spk=BOTTLED_OIL;
567     }
568     RSPEAK(spk);
569     return GO_CLEAROBJ;
570 }
571
572 static int find(token_t verb, token_t obj)
573 /* Find.  Might be carrying it, or it might be here.  Else give caveat. */
574 {
575     int spk = ACTSPK[verb];
576     if (AT(obj) ||
577        (LIQUID() == obj && AT(BOTTLE)) ||
578        obj == LIQLOC(game.loc) ||
579        (obj == DWARF && ATDWRF(game.loc) > 0))
580         spk=YOU_HAVEIT;
581     if (game.closed)spk=NEEDED_NEreplace;
582     if (TOTING(obj))spk=ALREADY_CARRYING;
583     RSPEAK(spk);
584     return GO_CLEAROBJ;
585 }
586
587 static int fly(token_t verb, token_t obj)
588 /* Fly.  Snide remarks unless hovering rug is here. */
589 {
590     int spk = ACTSPK[verb];
591     if (obj == INTRANSITIVE) {
592         if (game.prop[RUG] != 2)spk=RUG_NOTHING2;
593         if (!HERE(RUG))spk=FLAP_ARMS;
594         if (spk == RUG_NOTHING2 || spk == FLAP_ARMS) {
595             RSPEAK(spk);
596             return GO_CLEAROBJ;
597         }
598         obj=RUG;
599     }
600
601     if (obj != RUG) {
602         RSPEAK(spk);
603         return GO_CLEAROBJ;
604     }
605     spk=RUG_NOTHING1;
606     if (game.prop[RUG] != 2) {RSPEAK(spk); return GO_CLEAROBJ;}
607     game.oldlc2=game.oldloc;
608     game.oldloc=game.loc;
609     game.newloc=game.place[RUG]+game.fixed[RUG]-game.loc;
610     spk=RUG_GOES;
611     if (game.prop[SAPPH] >= 0)
612         spk=RUG_RETURNS;
613     RSPEAK(spk);
614     return GO_TERMINATE;
615 }
616
617 static int inven(void)
618 /* Inventory. If object, treat same as find.  Else report on current burden. */
619 {
620     int spk=NO_CARRY;
621     for (int i=1; i<=NOBJECTS; i++) {
622         if (i == BEAR || !TOTING(i))
623             continue;
624         if (spk == NO_CARRY)
625             RSPEAK(NOW_HOLDING);
626         game.blklin=false;
627         PSPEAK(i,-1);
628         game.blklin=true;
629         spk=ARB_0;
630     }
631     if (TOTING(BEAR))
632         spk=TAME_BEAR;
633     RSPEAK(spk);
634     return GO_CLEAROBJ;
635 }
636
637 int light(token_t verb, token_t obj)
638 /*  Light.  Applicable only to lamp and urn. */
639 {
640     int spk = ACTSPK[verb];
641     if (obj == INTRANSITIVE) {
642         if (HERE(LAMP) && game.prop[LAMP] == 0 && game.limit >= 0)obj=LAMP;
643         if (HERE(URN) && game.prop[URN] == 1)obj=obj*NOBJECTS+URN;
644         if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) return GO_UNKNOWN;
645     }
646
647     if (obj == URN) {
648         spk=URN_EMPTY;
649         if (game.prop[URN] == 0)
650             {RSPEAK(spk); return GO_CLEAROBJ;}
651         spk=URN_LIT;
652         game.prop[URN]=2;
653         RSPEAK(spk);
654         return GO_CLEAROBJ;
655     } else {
656         if (obj != LAMP)
657         {
658             RSPEAK(spk);
659             return GO_CLEAROBJ;
660         }
661         spk=LAMP_OUT;
662         if (game.limit < 0) {
663             RSPEAK(spk);
664             return GO_CLEAROBJ;
665         }
666         game.prop[LAMP]=1;
667         RSPEAK(LAMP_ON);
668         if (game.wzdark)
669             return GO_TOP;
670         else
671             return GO_CLEAROBJ;
672     }
673 }
674
675 static int listen(void)
676 /*  Listen.  Intransitive only.  Print stuff based on objsnd/locsnd. */
677 {
678     int k;
679     int spk=ALL_SILENT;
680     k=LOCSND[game.loc];
681     if (k != 0) {
682         RSPEAK(labs(k));
683         if (k < 0) return GO_CLEAROBJ;
684         spk=ARB_0;
685     }
686     SETPRM(1,game.zzword,0);
687     for (int i=1; i<=NOBJECTS; i++) {
688         if (!HERE(i) || OBJSND[i] == 0 || game.prop[i] < 0)
689             continue;
690         PSPEAK(i,OBJSND[i]+game.prop[i]);
691         spk=ARB_0;
692         if (i == BIRD && OBJSND[i]+game.prop[i] == 8)
693             DESTROY(BIRD);
694     }
695     RSPEAK(spk);
696     return GO_CLEAROBJ;
697 }
698
699 static int lock(token_t verb, token_t obj)
700 /* Lock, unlock, no object given.  Assume various things if present. */
701 {
702     int spk = ACTSPK[verb];
703     if (obj == INTRANSITIVE) {
704         spk=NOTHING_LOCKED;
705         if (HERE(CLAM))obj=CLAM;
706         if (HERE(OYSTER))obj=OYSTER;
707         if (AT(DOOR))obj=DOOR;
708         if (AT(GRATE))obj=GRATE;
709         if (obj != 0 && HERE(CHAIN)) return GO_UNKNOWN;
710         if (HERE(CHAIN))obj=CHAIN;
711         if (obj == 0) {RSPEAK(spk); return GO_CLEAROBJ;}
712     }
713         
714     /*  Lock, unlock object.  Special stuff for opening clam/oyster
715      *  and for chain. */
716     if (obj == CLAM || obj == OYSTER)
717         return bivalve(verb, obj);
718     if (obj == DOOR)spk=RUSTY_DOOR;
719     if (obj == DOOR && game.prop[DOOR] == 1)spk=OK_MAN;
720     if (obj == CAGE)spk=NO_LOCK;
721     if (obj == KEYS)spk=CANNOT_UNLOCK;
722     if (obj == GRATE || obj == CHAIN) {
723         spk=NO_KEYS;
724         if (HERE(KEYS)) {
725             if (obj == CHAIN)
726                 return chain(verb);
727             if (game.closng) {
728                 spk=EXIT_CLOSED;
729                 if (!game.panic)game.clock2=15;
730                 game.panic=true;
731             } else {
732                 spk=game.prop[GRATE] ? GRATE_LOCKED : ALREADY_LOCKED;
733                 game.prop[GRATE]=1;
734                 if (verb == LOCK)game.prop[GRATE]=0;
735                 spk=game.prop[GRATE] ? GRATE_UNLOCKED : GRATE_LOCKED;
736             }
737         }
738     }
739     RSPEAK(spk);
740     return GO_CLEAROBJ;
741 }
742
743 static int pour(token_t verb, token_t obj)
744 /*  Pour.  If no object, or object is bottle, assume contents of bottle.
745  *  special tests for pouring water or oil on plant or rusty door. */
746 {
747     int spk = ACTSPK[verb];
748     if (obj == BOTTLE || obj == 0)obj=LIQUID();
749     if (obj == 0) return GO_UNKNOWN;
750     if (!TOTING(obj)) {RSPEAK(spk); return GO_CLEAROBJ;}
751     spk=CANT_POUR;
752     if (obj != OIL && obj != WATER) {RSPEAK(spk); return GO_CLEAROBJ;}
753     if (HERE(URN) && game.prop[URN] == 0)
754         return fill(verb, URN);
755     game.prop[BOTTLE] = 1;
756     game.place[obj] = NOWHERE;
757     spk=GROUND_WET;
758     if (!(AT(PLANT) || AT(DOOR)))
759         {RSPEAK(spk); return GO_CLEAROBJ;}
760     if (!AT(DOOR)) {
761         spk=SHAKING_LEAVES;
762         if (obj != WATER) {RSPEAK(spk); return GO_CLEAROBJ;}
763         PSPEAK(PLANT,game.prop[PLANT]+3);
764         game.prop[PLANT]=MOD(game.prop[PLANT]+1,3);
765         game.prop[PLANT2]=game.prop[PLANT];
766         return GO_MOVE;
767     } else {
768         game.prop[DOOR]=0;
769         if (obj == OIL)game.prop[DOOR]=1;
770         spk=RUSTED_HINGES+game.prop[DOOR];
771         RSPEAK(spk);
772         return GO_CLEAROBJ;
773     }
774 }
775
776 static int quit(FILE *input)
777 /*  Quit.  Intransitive only.  Verify intent and exit if that's what he wants. */
778 {
779     if (YES(input,REALLY_QUIT,OK_MAN,OK_MAN))
780         score(quitgame);
781     return GO_CLEAROBJ;
782 }
783
784 static int read(FILE *input, token_t verb, token_t obj)
785 /*  Read.  Print stuff based on objtxt.  Oyster (?) is special case. */
786 {
787     int spk = ACTSPK[verb];
788     if (obj == INTRANSITIVE) {
789         obj = 0;
790         for (int i=1; i<=NOBJECTS; i++) {
791             if (HERE(i) && OBJTXT[i] != 0 && game.prop[i] >= 0)
792                 obj = obj * NOBJECTS + i;
793         }
794         if (obj > NOBJECTS || obj == 0 || DARK(game.loc)) return GO_UNKNOWN;
795     }
796         
797     if (DARK(game.loc)) {
798         SETPRM(1,WD1,WD1X);
799         RSPEAK(NO_SEE);
800         return GO_CLEAROBJ;
801     }
802     if (OBJTXT[obj] == 0 || game.prop[obj] < 0) {
803         RSPEAK(spk);
804         return GO_CLEAROBJ;
805     }
806     if (obj == OYSTER && !game.clshnt) {
807         game.clshnt=YES(input,CLUE_QUERY,WAYOUT_CLUE,OK_MAN);
808         return GO_CLEAROBJ;
809     }
810     PSPEAK(obj,OBJTXT[obj]+game.prop[obj]);
811     return GO_CLEAROBJ;
812 }
813
814 static int reservoir(void)
815 /*  Z'ZZZ (word gets recomputed at startup; different each game). */
816 {
817     if (!AT(RESER) && game.loc != game.fixed[RESER]-1) {
818         RSPEAK(RUB_NOGO);
819         return GO_CLEAROBJ;
820     } else {
821         PSPEAK(RESER,game.prop[RESER]+1);
822         game.prop[RESER]=1-game.prop[RESER];
823         if (AT(RESER))
824             return GO_CLEAROBJ;
825         else {
826             game.oldlc2=game.loc;
827             game.newloc=0;
828             RSPEAK(NOT_BRIGHT);
829             return GO_TERMINATE;
830         }
831     }
832 }
833
834 static int rub(token_t verb, token_t obj)
835 /* Rub.  Yields various snide remarks except for lit urn. */
836 {
837     int spk = ACTSPK[verb];
838     if (obj != LAMP)
839         spk=PECULIAR_NOTHING;
840     if (obj == URN && game.prop[URN] == 2) {
841         DESTROY(URN);
842         DROP(AMBER,game.loc);
843         game.prop[AMBER]=1;
844         --game.tally;
845         DROP(CAVITY,game.loc);
846         spk=URN_GENIES;
847     }
848     RSPEAK(spk);
849     return GO_CLEAROBJ;
850 }
851
852 static int say(void)
853 /* Say.  Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).)  Magic words override. */
854 {
855     /* FIXME: ugly use of globals */
856     SETPRM(1,WD2,WD2X);
857     if (WD2 <= 0)
858         SETPRM(1,WD1,WD1X);
859     if (WD2 > 0)
860         WD1=WD2;
861     int wd=VOCAB(WD1,-1);
862     /* FIXME: Magic numbers */
863     if (wd == 62 || wd == 65 || wd == 71 || wd == 2025 || wd == 2034) {
864         WD2=0;
865         return GO_LOOKUP;
866     }
867     RSPEAK(OKEY_DOKEY);
868     return GO_CLEAROBJ;
869
870 }
871
872 static int throw_support(long spk)
873 {
874     RSPEAK(spk);
875     DROP(AXE,game.loc);
876     return GO_MOVE;
877 }
878
879 static int throw(FILE *cmdin, long verb, token_t obj)
880 /*  Throw.  Same as discard unless axe.  Then same as attack except
881  *  ignore bird, and if dwarf is present then one might be killed.
882  *  (Only way to do so!)  Axe also special for dragon, bear, and
883  *  troll.  Treasures special for troll. */
884 {
885     int spk = ACTSPK[verb];
886     if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj=ROD2;
887     if (!TOTING(obj)) {
888         RSPEAK(spk);
889         return GO_CLEAROBJ;
890     }
891     if (obj >= MINTRS && obj <= MAXTRS && AT(TROLL)) {
892         spk=TROLL_SATISFIED;
893         /*  Snarf a treasure for the troll. */
894         DROP(obj,0);
895         MOVE(TROLL,0);
896         MOVE(TROLL+NOBJECTS,0);
897         DROP(TROLL2,PLAC[TROLL]);
898         DROP(TROLL2+NOBJECTS,FIXD[TROLL]);
899         JUGGLE(CHASM);
900         RSPEAK(spk);
901         return GO_CLEAROBJ;
902     }
903     if (obj == FOOD && HERE(BEAR)) {
904     /* But throwing food is another story. */
905         obj=BEAR;
906         return(feed(verb, obj));
907     }
908     if (obj != AXE)
909         return(discard(verb, obj, false));
910     int i=ATDWRF(game.loc);
911     if (i <= 0) {
912         if (AT(DRAGON) && game.prop[DRAGON] == 0) {
913             spk=DRAGON_SCALES;
914             return throw_support(spk);
915         }
916         if (AT(TROLL)) {
917             spk=TROLL_RETURNS;
918             return throw_support(spk);
919         }
920         if (AT(OGRE)) {
921             spk=OGRE_DODGE;
922             return throw_support(spk);
923         }
924         if (HERE(BEAR) && game.prop[BEAR] == 0) {
925             /* This'll teach him to throw the axe at the bear! */
926             spk=AXE_LOST;
927             DROP(AXE,game.loc);
928             game.fixed[AXE]= -1;
929             game.prop[AXE]=1;
930             JUGGLE(BEAR);
931             {RSPEAK(spk); return GO_CLEAROBJ;}
932         }
933         return(attack(cmdin, verb, 0));
934     }
935
936     if (randrange(NDWARVES+1) < game.dflag) {
937         spk=DWARF_DODGES;
938         return throw_support(spk);
939     }
940     game.dseen[i]=false;
941     game.dloc[i]=0;
942     spk=KILLED_DWARF;
943     ++game.dkill;
944     if (game.dkill == 1)spk=DWARF_SMOKE;
945
946     return throw_support(spk);
947 }
948
949 static int vscore(void)
950 /* Score.  Call scoring routine but tell it to return. */
951 {
952     score(scoregame);
953     return GO_CLEAROBJ;
954 }
955
956 static int wake(token_t verb, token_t obj)
957 /* Wake.  Only use is to disturb the dwarves. */
958 {
959     if (obj != DWARF || !game.closed)
960     {
961         RSPEAK(ACTSPK[verb]);
962         return GO_CLEAROBJ;
963     }
964     RSPEAK(PROD_DWARF);
965     return GO_DWARFWAKE;
966 }
967
968 static int wave(token_t verb, token_t obj)
969 /* Wave.  No effect unless waving rod at fissure or at bird. */
970 {
971     int spk = ACTSPK[verb];
972     if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2)))spk=ARENT_CARRYING;
973     if (obj != ROD ||
974        !TOTING(obj) ||
975        (!HERE(BIRD) && (game.closng || !AT(FISSUR)))) {
976         RSPEAK(spk);
977         return GO_CLEAROBJ;
978     }
979     if (HERE(BIRD))spk=FREE_FLY+MOD(game.prop[BIRD],2);
980     if (spk == 206 && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
981         DROP(JADE,game.loc);
982         game.prop[JADE]=0;
983         --game.tally;
984         spk=NECKLACE_FLY;
985         RSPEAK(spk);
986         return GO_CLEAROBJ;
987     } else {
988         if (game.closed) {
989             RSPEAK(spk);
990             return GO_DWARFWAKE;
991         }
992         if (game.closng || !AT(FISSUR)) {RSPEAK(spk); return GO_CLEAROBJ;}
993         if (HERE(BIRD))RSPEAK(spk);
994         game.prop[FISSUR]=1-game.prop[FISSUR];
995         PSPEAK(FISSUR,2-game.prop[FISSUR]);
996         return GO_CLEAROBJ;
997     }
998 }
999
1000 int action(FILE *input, enum speechpart part, long verb, token_t obj)
1001 /*  Analyse a verb.  Remember what it was, go back for object if second word
1002  *  unless verb is "say", which snarfs arbitrary second word.
1003  */
1004 {
1005     token_t spk=ACTSPK[verb];
1006
1007     if (part == unknown)
1008     {
1009         /*  Analyse an object word.  See if the thing is here, whether
1010          *  we've got a verb yet, and so on.  Object must be here
1011          *  unless verb is "find" or "invent(ory)" (and no new verb
1012          *  yet to be analysed).  Water and oil are also funny, since
1013          *  they are never actually dropped at any location, but might
1014          *  be here inside the bottle or urn or as a feature of the
1015          *  location. */
1016         if (HERE(obj))
1017             /* FALL THROUGH */;
1018         else if (obj == GRATE) {
1019             if (game.loc == LOC_START || game.loc == LOC_VALLEY || game.loc == LOC_SLIT)
1020                 obj=DPRSSN;
1021             if (game.loc == LOC_COBBLE || game.loc == LOC_DEBRIS || game.loc == LOC_AWKWARD ||
1022                 game.loc == LOC_BIRD || game.loc == LOC_PITTOP)
1023                 obj=ENTRNC;
1024             if (obj != GRATE)
1025                 return GO_MOVE;
1026         }
1027         else if (obj == DWARF && ATDWRF(game.loc) > 0)
1028             /* FALL THROUGH */;
1029         else if ((LIQUID() == obj && HERE(BOTTLE)) || obj == LIQLOC(game.loc))
1030             /* FALL THROUGH */;
1031         else if (obj == OIL && HERE(URN) && game.prop[URN] != 0) {
1032             obj=URN;
1033             /* FALL THROUGH */;
1034         }
1035         else if (obj == PLANT && AT(PLANT2) && game.prop[PLANT2] != 0) {
1036             obj=PLANT2;
1037             /* FALL THROUGH */;
1038         }
1039         else if (obj == KNIFE && game.knfloc == game.loc) {
1040             game.knfloc= -1;
1041             spk=KNIVES_VANISH;
1042             RSPEAK(spk);
1043             return GO_CLEAROBJ;
1044         }
1045         else if (obj == ROD && HERE(ROD2)) {
1046             obj=ROD2;
1047             /* FALL THROUGH */;
1048         }
1049         else if ((verb == FIND || verb == INVENT) && WD2 <= 0)
1050             /* FALL THROUGH */;
1051         else {
1052             SETPRM(1,WD1,WD1X);
1053             RSPEAK(NO_SEE);
1054             return GO_CLEAROBJ;
1055         }
1056
1057         if (WD2 > 0)
1058             return GO_WORD2;
1059         if (verb != 0)
1060             part = transitive;
1061     }
1062
1063     switch(part)
1064     {
1065         case intransitive:
1066             if (WD2 > 0 && verb != SAY) return(2800);
1067             if (verb == SAY)obj=WD2;
1068             if (obj == 0 || obj == INTRANSITIVE) {
1069                 /*  Analyse an intransitive verb (ie, no object given yet). */
1070                     switch (verb-1) {
1071                     case  0: /* CARRY */ return carry(verb, INTRANSITIVE);
1072                     case  1: /* DROP  */ return GO_UNKNOWN; 
1073                     case  2: /* SAY   */ return GO_UNKNOWN; 
1074                     case  3: /* UNLOC */ return lock(verb, INTRANSITIVE);    
1075                     case  4: /* NOTHI */ {RSPEAK(OK_MAN); return(GO_CLEAROBJ);}
1076                     case  5: /* LOCK  */ return lock(verb, INTRANSITIVE);    
1077                     case  6: /* LIGHT */ return light(verb, INTRANSITIVE);    
1078                     case  7: /* EXTIN */ return extinguish(verb, INTRANSITIVE);    
1079                     case  8: /* WAVE  */ return GO_UNKNOWN; 
1080                     case  9: /* CALM  */ return GO_UNKNOWN; 
1081                     case 10: /* WALK  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1082                     case 11: /* ATTAC */ return attack(input, verb, obj);   
1083                     case 12: /* POUR  */ return pour(verb, obj);   
1084                     case 13: /* EAT   */ return eat(verb, INTRANSITIVE);   
1085                     case 14: /* DRINK */ return drink(verb, obj);   
1086                     case 15: /* RUB   */ return GO_UNKNOWN; 
1087                     case 16: /* TOSS  */ return GO_UNKNOWN; 
1088                     case 17: /* QUIT  */ return quit(input);   
1089                     case 18: /* FIND  */ return GO_UNKNOWN; 
1090                     case 19: /* INVEN */ return inven();
1091                     case 20: /* FEED  */ return GO_UNKNOWN; 
1092                     case 21: /* FILL  */ return fill(verb, obj);   
1093                     case 22: /* BLAST */ return blast();   
1094                     case 23: /* SCOR  */ return vscore();   
1095                     case 24: /* FOO   */ return bigwords(WD1);   
1096                     case 25: /* BRIEF */ return brief();   
1097                     case 26: /* READ  */ return read(input, verb, INTRANSITIVE);
1098                     case 27: /* BREAK */ return GO_UNKNOWN; 
1099                     case 28: /* WAKE  */ return GO_UNKNOWN; 
1100                     case 29: /* SUSP  */ return saveresume(input, false);   
1101                     case 30: /* RESU  */ return saveresume(input, true);   
1102                     case 31: /* FLY   */ return fly(verb, INTRANSITIVE);   
1103                     case 32: /* LISTE */ return listen();   
1104                     case 33: /* ZZZZ  */ return reservoir();   
1105                 }
1106                 BUG(23);
1107             }
1108             /* FALLTHRU */
1109         case transitive:
1110             /*  Analyse a transitive verb. */
1111             switch (verb-1) {
1112             case  0: /* CARRY */ return carry(verb, obj);    
1113                 case  1: /* DROP  */ return discard(verb, obj, false);    
1114                 case  2: /* SAY   */ return say();    
1115                 case  3: /* UNLOC */ return lock(verb, obj);    
1116                 case  4: /* NOTHI */ {RSPEAK(OK_MAN); return(GO_CLEAROBJ);}
1117                 case  5: /* LOCK  */ return lock(verb, obj);    
1118                 case  6: /* LIGHT */ return light(verb, obj);    
1119                 case  7: /* EXTI  */ return extinguish(verb, obj);    
1120                 case  8: /* WAVE  */ return wave(verb, obj);    
1121                 case  9: /* CALM  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1122                 case 10: /* WALK  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1123                 case 11: /* ATTAC */ return attack(input, verb, obj);   
1124                 case 12: /* POUR  */ return pour(verb, obj);   
1125                 case 13: /* EAT   */ return eat(verb, obj);   
1126                 case 14: /* DRINK */ return drink(verb, obj);   
1127                 case 15: /* RUB   */ return rub(verb, obj);   
1128                 case 16: /* TOSS  */ return throw(input, verb, obj);   
1129                 case 17: /* QUIT  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1130                 case 18: /* FIND  */ return find(verb, obj);   
1131                 case 19: /* INVEN */ return find(verb, obj);   
1132                 case 20: /* FEED  */ return feed(verb, obj);   
1133                 case 21: /* FILL  */ return fill(verb, obj);   
1134                 case 22: /* BLAST */ return blast();   
1135                 case 23: /* SCOR  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1136                 case 24: /* FOO   */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1137                 case 25: /* BRIEF */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1138                 case 26: /* READ  */ return read(input, verb, obj);   
1139                 case 27: /* BREAK */ return vbreak(verb, obj);   
1140                 case 28: /* WAKE  */ return wake(verb, obj);   
1141                 case 29: /* SUSP  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1142                 case 30: /* RESU  */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1143                 case 31: /* FLY   */ return fly(verb, obj);   
1144                 case 32: /* LISTE */ {RSPEAK(spk); return GO_CLEAROBJ;} 
1145                 case 33: /* ZZZZ  */ return reservoir();   
1146             }
1147             BUG(24);
1148         case unknown:
1149             /* Unknown verb, couldn't deduce object - might need hint */
1150             SETPRM(1,WD1,WD1X);
1151             RSPEAK(WHAT_DO);
1152             return GO_CHECKHINT;
1153     default:
1154             BUG(99);
1155     }
1156 }