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