cypher.c revision 1.23 1 1.23 jmc /* $NetBSD: cypher.c,v 1.23 2005/07/01 06:04:54 jmc Exp $ */
2 1.3 cgd
3 1.1 cgd /*
4 1.3 cgd * Copyright (c) 1983, 1993
5 1.3 cgd * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Redistribution and use in source and binary forms, with or without
8 1.1 cgd * modification, are permitted provided that the following conditions
9 1.1 cgd * are met:
10 1.1 cgd * 1. Redistributions of source code must retain the above copyright
11 1.1 cgd * notice, this list of conditions and the following disclaimer.
12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer in the
14 1.1 cgd * documentation and/or other materials provided with the distribution.
15 1.22 agc * 3. Neither the name of the University nor the names of its contributors
16 1.1 cgd * may be used to endorse or promote products derived from this software
17 1.1 cgd * without specific prior written permission.
18 1.1 cgd *
19 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 cgd * SUCH DAMAGE.
30 1.1 cgd */
31 1.1 cgd
32 1.5 lukem #include <sys/cdefs.h>
33 1.1 cgd #ifndef lint
34 1.3 cgd #if 0
35 1.4 tls static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95";
36 1.3 cgd #else
37 1.23 jmc __RCSID("$NetBSD: cypher.c,v 1.23 2005/07/01 06:04:54 jmc Exp $");
38 1.3 cgd #endif
39 1.6 lukem #endif /* not lint */
40 1.1 cgd
41 1.4 tls #include "extern.h"
42 1.1 cgd
43 1.5 lukem int
44 1.23 jmc cypher(void)
45 1.1 cgd {
46 1.6 lukem int n;
47 1.6 lukem int junk;
48 1.6 lukem int lflag = -1;
49 1.6 lukem char buffer[10];
50 1.9 hubertf char *filename, *rfilename;
51 1.9 hubertf size_t filename_len;
52 1.1 cgd
53 1.1 cgd while (wordnumber <= wordcount) {
54 1.21 jsm if (wordtype[wordnumber] != VERB &&
55 1.23 jmc !(wordtype[wordnumber] == OBJECT &&
56 1.23 jmc wordvalue[wordnumber] == KNIFE)) {
57 1.21 jsm printf("%s: How's that?\n",
58 1.23 jmc (wordnumber == wordcount) ? words[0] :
59 1.23 jmc words[wordnumber]);
60 1.21 jsm return (-1);
61 1.21 jsm }
62 1.21 jsm
63 1.6 lukem switch (wordvalue[wordnumber]) {
64 1.21 jsm
65 1.21 jsm case AUXVERB:
66 1.21 jsm /*
67 1.21 jsm * Take the following word as the verb (e.g.
68 1.21 jsm * "make love", "climb up").
69 1.21 jsm */
70 1.21 jsm wordnumber++;
71 1.21 jsm continue;
72 1.1 cgd
73 1.6 lukem case UP:
74 1.6 lukem if (location[position].access || wiz || tempwiz) {
75 1.23 jmc if (!location[position].access) {
76 1.23 jmc printf("Zap! A gust of wind lifts ");
77 1.23 jmc puts("you up.");
78 1.23 jmc }
79 1.11 mycroft if (!moveplayer(location[position].up, AHEAD))
80 1.6 lukem return (-1);
81 1.6 lukem } else {
82 1.12 jsm puts("There is no way up.");
83 1.6 lukem return (-1);
84 1.6 lukem }
85 1.6 lukem lflag = 0;
86 1.6 lukem break;
87 1.6 lukem
88 1.6 lukem case DOWN:
89 1.11 mycroft if (!moveplayer(location[position].down, AHEAD))
90 1.6 lukem return (-1);
91 1.6 lukem lflag = 0;
92 1.6 lukem break;
93 1.6 lukem
94 1.6 lukem case LEFT:
95 1.11 mycroft if (!moveplayer(left, LEFT))
96 1.6 lukem return (-1);
97 1.6 lukem lflag = 0;
98 1.6 lukem break;
99 1.6 lukem
100 1.6 lukem case RIGHT:
101 1.11 mycroft if (!moveplayer(right, RIGHT))
102 1.6 lukem return (-1);
103 1.6 lukem lflag = 0;
104 1.6 lukem break;
105 1.6 lukem
106 1.6 lukem case AHEAD:
107 1.11 mycroft if (!moveplayer(ahead, AHEAD))
108 1.6 lukem return (-1);
109 1.6 lukem lflag = 0;
110 1.6 lukem break;
111 1.6 lukem
112 1.6 lukem case BACK:
113 1.11 mycroft if (!moveplayer(back, BACK))
114 1.6 lukem return (-1);
115 1.6 lukem lflag = 0;
116 1.6 lukem break;
117 1.6 lukem
118 1.6 lukem case SHOOT:
119 1.23 jmc if (wordnumber < wordcount &&
120 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
121 1.17 jsm int things;
122 1.17 jsm things = 0;
123 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
124 1.23 jmc if (testbit(location[position].objects,
125 1.23 jmc n) && objsht[n]) {
126 1.17 jsm things++;
127 1.6 lukem wordvalue[wordnumber + 1] = n;
128 1.6 lukem wordnumber = shoot();
129 1.6 lukem }
130 1.17 jsm if (!things)
131 1.17 jsm puts("Nothing to shoot at!");
132 1.1 cgd wordnumber++;
133 1.1 cgd wordnumber++;
134 1.6 lukem } else
135 1.6 lukem shoot();
136 1.6 lukem break;
137 1.6 lukem
138 1.6 lukem case TAKE:
139 1.23 jmc if (wordnumber < wordcount &&
140 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
141 1.17 jsm int things;
142 1.17 jsm things = 0;
143 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
144 1.23 jmc if (testbit(location[position].objects,
145 1.23 jmc n) && objsht[n]) {
146 1.17 jsm things++;
147 1.6 lukem wordvalue[wordnumber + 1] = n;
148 1.8 hubertf /* Some objects (type NOUNS)
149 1.8 hubertf * have special treatment in
150 1.8 hubertf * take(). For these we
151 1.8 hubertf * must set the type to NOUNS.
152 1.8 hubertf * However for SWORD and BODY
153 1.8 hubertf * all it does is find which
154 1.8 hubertf * of many objects is meant,
155 1.8 hubertf * so we need do nothing here.
156 1.8 hubertf * BATHGOD must become
157 1.8 hubertf * NORMGOD as well. NOUNS
158 1.8 hubertf * with no special case
159 1.8 hubertf * must be included here to
160 1.8 hubertf * get the right error. DOOR
161 1.8 hubertf * cannot occur as an object
162 1.8 hubertf * so need not be included. */
163 1.8 hubertf switch(n) {
164 1.8 hubertf case BATHGOD:
165 1.8 hubertf wordvalue[wordnumber + 1] = NORMGOD;
166 1.10 jsm /* FALLTHROUGH */
167 1.8 hubertf case NORMGOD:
168 1.8 hubertf case AMULET:
169 1.8 hubertf case MEDALION:
170 1.8 hubertf case TALISMAN:
171 1.8 hubertf case MAN:
172 1.8 hubertf case TIMER:
173 1.8 hubertf case NATIVE:
174 1.8 hubertf wordtype[wordnumber + 1] = NOUNS;
175 1.8 hubertf break;
176 1.8 hubertf default:
177 1.8 hubertf wordtype[wordnumber + 1] = OBJECT;
178 1.8 hubertf }
179 1.6 lukem wordnumber = take(location[position].objects);
180 1.6 lukem }
181 1.1 cgd wordnumber++;
182 1.1 cgd wordnumber++;
183 1.17 jsm if (!things)
184 1.17 jsm puts("Nothing to take!");
185 1.6 lukem } else
186 1.6 lukem take(location[position].objects);
187 1.6 lukem break;
188 1.6 lukem
189 1.6 lukem case DROP:
190 1.23 jmc if (wordnumber < wordcount &&
191 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
192 1.17 jsm int things;
193 1.17 jsm things = 0;
194 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
195 1.6 lukem if (testbit(inven, n)) {
196 1.17 jsm things++;
197 1.6 lukem wordvalue[wordnumber + 1] = n;
198 1.6 lukem wordnumber = drop("Dropped");
199 1.6 lukem }
200 1.1 cgd wordnumber++;
201 1.1 cgd wordnumber++;
202 1.17 jsm if (!things)
203 1.17 jsm puts("Nothing to drop!");
204 1.6 lukem } else
205 1.6 lukem drop("Dropped");
206 1.6 lukem break;
207 1.6 lukem
208 1.6 lukem case KICK:
209 1.6 lukem case THROW:
210 1.23 jmc if (wordnumber < wordcount &&
211 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
212 1.17 jsm int things, wv;
213 1.17 jsm things = 0;
214 1.17 jsm wv = wordvalue[wordnumber];
215 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
216 1.6 lukem if (testbit(inven, n) ||
217 1.7 hubertf (testbit(location[position].objects, n) && objsht[n])) {
218 1.17 jsm things++;
219 1.6 lukem wordvalue[wordnumber + 1] = n;
220 1.6 lukem wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
221 1.6 lukem }
222 1.6 lukem wordnumber += 2;
223 1.17 jsm if (!things)
224 1.23 jmc printf("Nothing to %s!\n",
225 1.23 jmc wv == KICK ? "kick" : "throw");
226 1.6 lukem } else
227 1.23 jmc throw(wordvalue[wordnumber] ==
228 1.23 jmc KICK ? "Kicked" : "Thrown");
229 1.6 lukem break;
230 1.6 lukem
231 1.6 lukem case TAKEOFF:
232 1.23 jmc if (wordnumber < wordcount &&
233 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
234 1.17 jsm int things;
235 1.17 jsm things = 0;
236 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
237 1.6 lukem if (testbit(wear, n)) {
238 1.17 jsm things++;
239 1.6 lukem wordvalue[wordnumber + 1] = n;
240 1.6 lukem wordnumber = takeoff();
241 1.6 lukem }
242 1.6 lukem wordnumber += 2;
243 1.17 jsm if (!things)
244 1.17 jsm puts("Nothing to take off!");
245 1.6 lukem } else
246 1.6 lukem takeoff();
247 1.6 lukem break;
248 1.1 cgd
249 1.6 lukem case DRAW:
250 1.23 jmc if (wordnumber < wordcount &&
251 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
252 1.17 jsm int things;
253 1.17 jsm things = 0;
254 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
255 1.6 lukem if (testbit(wear, n)) {
256 1.17 jsm things++;
257 1.6 lukem wordvalue[wordnumber + 1] = n;
258 1.6 lukem wordnumber = draw();
259 1.6 lukem }
260 1.6 lukem wordnumber += 2;
261 1.17 jsm if (!things)
262 1.17 jsm puts("Nothing to draw!");
263 1.6 lukem } else
264 1.6 lukem draw();
265 1.6 lukem break;
266 1.1 cgd
267 1.6 lukem case PUTON:
268 1.23 jmc if (wordnumber < wordcount &&
269 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
270 1.17 jsm int things;
271 1.17 jsm things = 0;
272 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
273 1.23 jmc if (testbit(location[position].objects,
274 1.23 jmc n) && objsht[n]) {
275 1.17 jsm things++;
276 1.6 lukem wordvalue[wordnumber + 1] = n;
277 1.6 lukem wordnumber = puton();
278 1.6 lukem }
279 1.6 lukem wordnumber += 2;
280 1.17 jsm if (!things)
281 1.17 jsm puts("Nothing to put on!");
282 1.6 lukem } else
283 1.6 lukem puton();
284 1.6 lukem break;
285 1.6 lukem
286 1.6 lukem case WEARIT:
287 1.23 jmc if (wordnumber < wordcount &&
288 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
289 1.17 jsm int things;
290 1.17 jsm things = 0;
291 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
292 1.6 lukem if (testbit(inven, n)) {
293 1.17 jsm things++;
294 1.6 lukem wordvalue[wordnumber + 1] = n;
295 1.6 lukem wordnumber = wearit();
296 1.6 lukem }
297 1.6 lukem wordnumber += 2;
298 1.17 jsm if (!things)
299 1.17 jsm puts("Nothing to wear!");
300 1.6 lukem } else
301 1.6 lukem wearit();
302 1.6 lukem break;
303 1.1 cgd
304 1.6 lukem case EAT:
305 1.23 jmc if (wordnumber < wordcount &&
306 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
307 1.17 jsm int things;
308 1.17 jsm things = 0;
309 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
310 1.6 lukem if (testbit(inven, n)) {
311 1.17 jsm things++;
312 1.6 lukem wordvalue[wordnumber + 1] = n;
313 1.6 lukem wordnumber = eat();
314 1.1 cgd }
315 1.6 lukem wordnumber += 2;
316 1.17 jsm if (!things)
317 1.17 jsm puts("Nothing to eat!");
318 1.6 lukem } else
319 1.6 lukem eat();
320 1.6 lukem break;
321 1.6 lukem
322 1.6 lukem case PUT:
323 1.6 lukem put();
324 1.6 lukem break;
325 1.6 lukem
326 1.6 lukem case INVEN:
327 1.6 lukem if (ucard(inven)) {
328 1.6 lukem puts("You are holding:\n");
329 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
330 1.6 lukem if (testbit(inven, n))
331 1.6 lukem printf("\t%s\n", objsht[n]);
332 1.23 jmc if (WEIGHT == 0) {
333 1.23 jmc printf("\n= %d kilogram%s",
334 1.19 jsm carrying,
335 1.23 jmc (carrying == 1 ? "." : "s."));
336 1.23 jmc printf(" (can't lift any weight%s)\n",
337 1.23 jmc (carrying ?
338 1.23 jmc " or move with what you have" :
339 1.23 jmc ""));
340 1.23 jmc } else
341 1.19 jsm printf("\n= %d kilogram%s (%d%%)\n",
342 1.19 jsm carrying,
343 1.19 jsm (carrying == 1 ? "." : "s."),
344 1.19 jsm carrying * 100 / WEIGHT);
345 1.23 jmc if (CUMBER == 0) {
346 1.23 jmc printf("Your arms can't pick ");
347 1.23 jmc printf("anything up.\n");
348 1.23 jmc } else
349 1.19 jsm printf("Your arms are %d%% full.\n",
350 1.19 jsm encumber * 100 / CUMBER);
351 1.6 lukem } else
352 1.6 lukem puts("You aren't carrying anything.");
353 1.6 lukem
354 1.6 lukem if (ucard(wear)) {
355 1.6 lukem puts("\nYou are wearing:\n");
356 1.6 lukem for (n = 0; n < NUMOFOBJECTS; n++)
357 1.6 lukem if (testbit(wear, n))
358 1.6 lukem printf("\t%s\n", objsht[n]);
359 1.6 lukem } else
360 1.6 lukem puts("\nYou are stark naked.");
361 1.6 lukem if (card(injuries, NUMOFINJURIES)) {
362 1.6 lukem puts("\nYou have suffered:\n");
363 1.6 lukem for (n = 0; n < NUMOFINJURIES; n++)
364 1.6 lukem if (injuries[n])
365 1.6 lukem printf("\t%s\n", ouch[n]);
366 1.23 jmc printf("\nYou can still carry up to ");
367 1.23 jmc printf("%d kilogram%s\n", WEIGHT,
368 1.23 jmc (WEIGHT == 1 ? "." : "s."));
369 1.6 lukem } else
370 1.6 lukem puts("\nYou are in perfect health.");
371 1.15 jsm wordnumber++;
372 1.6 lukem break;
373 1.6 lukem
374 1.6 lukem case USE:
375 1.6 lukem lflag = use();
376 1.6 lukem break;
377 1.6 lukem
378 1.14 jsm case OPEN:
379 1.23 jmc if (wordnumber < wordcount &&
380 1.23 jmc wordvalue[wordnumber + 1] == EVERYTHING) {
381 1.14 jsm int things;
382 1.14 jsm things = 0;
383 1.14 jsm for (n = 0; n < NUMOFOBJECTS; n++)
384 1.14 jsm if (testbit(inven, n)) {
385 1.14 jsm things++;
386 1.14 jsm wordvalue[wordnumber + 1] = n;
387 1.14 jsm dooropen();
388 1.14 jsm }
389 1.14 jsm wordnumber += 2;
390 1.14 jsm if (!things)
391 1.14 jsm puts("Nothing to open!");
392 1.14 jsm } else
393 1.14 jsm dooropen();
394 1.14 jsm break;
395 1.14 jsm
396 1.6 lukem case LOOK:
397 1.6 lukem if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
398 1.6 lukem testbit(location[position].objects, LAMPON)
399 1.6 lukem || matchlight) {
400 1.6 lukem beenthere[position] = 2;
401 1.6 lukem writedes();
402 1.6 lukem printobjs();
403 1.6 lukem if (matchlight) {
404 1.6 lukem puts("\nYour match splutters out.");
405 1.6 lukem matchlight = 0;
406 1.6 lukem }
407 1.6 lukem } else
408 1.6 lukem puts("I can't see anything.");
409 1.6 lukem return (-1);
410 1.6 lukem break;
411 1.1 cgd
412 1.6 lukem case SU:
413 1.6 lukem if (wiz || tempwiz) {
414 1.1 cgd printf("\nRoom (was %d) = ", position);
415 1.6 lukem fgets(buffer, 10, stdin);
416 1.1 cgd if (*buffer != '\n')
417 1.6 lukem sscanf(buffer, "%d", &position);
418 1.5 lukem printf("Time (was %d) = ", ourtime);
419 1.6 lukem fgets(buffer, 10, stdin);
420 1.1 cgd if (*buffer != '\n')
421 1.6 lukem sscanf(buffer, "%d", &ourtime);
422 1.6 lukem printf("Fuel (was %d) = ", fuel);
423 1.6 lukem fgets(buffer, 10, stdin);
424 1.1 cgd if (*buffer != '\n')
425 1.6 lukem sscanf(buffer, "%d", &fuel);
426 1.6 lukem printf("Torps (was %d) = ", torps);
427 1.6 lukem fgets(buffer, 10, stdin);
428 1.1 cgd if (*buffer != '\n')
429 1.6 lukem sscanf(buffer, "%d", &torps);
430 1.6 lukem printf("CUMBER (was %d) = ", CUMBER);
431 1.6 lukem fgets(buffer, 10, stdin);
432 1.1 cgd if (*buffer != '\n')
433 1.6 lukem sscanf(buffer, "%d", &CUMBER);
434 1.6 lukem printf("WEIGHT (was %d) = ", WEIGHT);
435 1.6 lukem fgets(buffer, 10, stdin);
436 1.1 cgd if (*buffer != '\n')
437 1.6 lukem sscanf(buffer, "%d", &WEIGHT);
438 1.5 lukem printf("Clock (was %d) = ", ourclock);
439 1.6 lukem fgets(buffer, 10, stdin);
440 1.1 cgd if (*buffer != '\n')
441 1.6 lukem sscanf(buffer, "%d", &ourclock);
442 1.6 lukem printf("Wizard (was %d, %d) = ", wiz, tempwiz);
443 1.6 lukem fgets(buffer, 10, stdin);
444 1.6 lukem if (*buffer != '\n') {
445 1.6 lukem sscanf(buffer, "%d", &junk);
446 1.1 cgd if (!junk)
447 1.1 cgd tempwiz = wiz = 0;
448 1.1 cgd }
449 1.1 cgd printf("\nDONE.\n");
450 1.6 lukem return (0);
451 1.6 lukem } else
452 1.6 lukem puts("You aren't a wizard.");
453 1.6 lukem break;
454 1.6 lukem
455 1.6 lukem case SCORE:
456 1.6 lukem printf("\tPLEASURE\tPOWER\t\tEGO\n");
457 1.6 lukem printf("\t%3d\t\t%3d\t\t%3d\n\n", pleasure, power, ego);
458 1.23 jmc printf("This gives you the rating of ");
459 1.23 jmc printf("%s in %d turns.\n", rate(), ourtime);
460 1.23 jmc printf("You have visited %d out of %d rooms ",
461 1.23 jmc card(beenthere, NUMOFROOMS), NUMOFROOMS);
462 1.23 jmc printf("this run (%d%%).\n",
463 1.23 jmc card(beenthere, NUMOFROOMS) * 100 / NUMOFROOMS);
464 1.6 lukem break;
465 1.6 lukem
466 1.6 lukem case KNIFE:
467 1.6 lukem case KILL:
468 1.6 lukem murder();
469 1.6 lukem break;
470 1.6 lukem
471 1.6 lukem case UNDRESS:
472 1.6 lukem case RAVAGE:
473 1.6 lukem ravage();
474 1.6 lukem break;
475 1.6 lukem
476 1.6 lukem case SAVE:
477 1.13 jsm printf("\nSave file name (default %s): ",
478 1.9 hubertf DEFAULT_SAVE_FILE);
479 1.9 hubertf filename = fgetln(stdin, &filename_len);
480 1.9 hubertf if (filename_len == 0
481 1.9 hubertf || (filename_len == 1 && filename[0] == '\n'))
482 1.9 hubertf rfilename = save_file_name(DEFAULT_SAVE_FILE,
483 1.9 hubertf strlen(DEFAULT_SAVE_FILE));
484 1.9 hubertf else {
485 1.9 hubertf if (filename[filename_len - 1] == '\n')
486 1.9 hubertf filename_len--;
487 1.9 hubertf rfilename = save_file_name(filename,
488 1.9 hubertf filename_len);
489 1.9 hubertf }
490 1.9 hubertf save(rfilename);
491 1.9 hubertf free(rfilename);
492 1.14 jsm break;
493 1.14 jsm
494 1.14 jsm case VERBOSE:
495 1.14 jsm verbose = 1;
496 1.14 jsm printf("[Maximum verbosity]\n");
497 1.14 jsm break;
498 1.14 jsm
499 1.14 jsm case BRIEF:
500 1.14 jsm verbose = 0;
501 1.14 jsm printf("[Standard verbosity]\n");
502 1.6 lukem break;
503 1.6 lukem
504 1.6 lukem case FOLLOW:
505 1.6 lukem lflag = follow();
506 1.6 lukem break;
507 1.6 lukem
508 1.6 lukem case GIVE:
509 1.6 lukem give();
510 1.6 lukem break;
511 1.6 lukem
512 1.6 lukem case KISS:
513 1.6 lukem kiss();
514 1.6 lukem break;
515 1.6 lukem
516 1.6 lukem case LOVE:
517 1.6 lukem love();
518 1.6 lukem break;
519 1.6 lukem
520 1.6 lukem case RIDE:
521 1.6 lukem lflag = ride();
522 1.6 lukem break;
523 1.6 lukem
524 1.6 lukem case DRIVE:
525 1.6 lukem lflag = drive();
526 1.6 lukem break;
527 1.6 lukem
528 1.6 lukem case LIGHT:
529 1.6 lukem light();
530 1.6 lukem break;
531 1.6 lukem
532 1.6 lukem case LAUNCH:
533 1.6 lukem if (!launch())
534 1.6 lukem return (-1);
535 1.6 lukem else
536 1.6 lukem lflag = 0;
537 1.6 lukem break;
538 1.6 lukem
539 1.6 lukem case LANDIT:
540 1.6 lukem if (!land())
541 1.6 lukem return (-1);
542 1.6 lukem else
543 1.6 lukem lflag = 0;
544 1.6 lukem break;
545 1.6 lukem
546 1.6 lukem case TIME:
547 1.6 lukem chime();
548 1.6 lukem break;
549 1.6 lukem
550 1.6 lukem case SLEEP:
551 1.6 lukem zzz();
552 1.6 lukem break;
553 1.6 lukem
554 1.6 lukem case DIG:
555 1.6 lukem dig();
556 1.6 lukem break;
557 1.6 lukem
558 1.6 lukem case JUMP:
559 1.6 lukem lflag = jump();
560 1.6 lukem break;
561 1.6 lukem
562 1.6 lukem case BURY:
563 1.6 lukem bury();
564 1.6 lukem break;
565 1.6 lukem
566 1.6 lukem case SWIM:
567 1.6 lukem puts("Surf's up!");
568 1.6 lukem break;
569 1.6 lukem
570 1.6 lukem case DRINK:
571 1.6 lukem drink();
572 1.6 lukem break;
573 1.6 lukem
574 1.6 lukem case QUIT:
575 1.6 lukem die();
576 1.6 lukem
577 1.6 lukem default:
578 1.6 lukem puts("How's that?");
579 1.6 lukem return (-1);
580 1.6 lukem break;
581 1.1 cgd
582 1.1 cgd }
583 1.1 cgd if (wordnumber < wordcount && *words[wordnumber++] == ',')
584 1.1 cgd continue;
585 1.6 lukem else
586 1.6 lukem return (lflag);
587 1.6 lukem }
588 1.6 lukem return (lflag);
589 1.1 cgd }
590