2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 static char sccsid[] = "@(#)com6.c 8.1 (Berkeley) 5/31/93";
38 static const char rcsid[] =
39 "$FreeBSD: src/games/battlestar/com6.c,v 1.9.2.1 2001/03/05 11:45:35 kris Exp $";
44 #include "pathnames.h"
46 static void post __P((unsigned int ch));
51 if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
53 clearbit(location[position].objects,VIPER);
54 position = location[position].up;
58 puts("You climb into the viper and prepare for launch.");
59 puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
63 puts("Not enough fuel to launch.");
66 puts("Can't launch.");
73 if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
75 position = location[position].down;
76 setbit(location[position].objects,VIPER);
79 puts("You are down.");
83 puts("You can't land here.");
88 die(sig) /* endgame */
92 printf("bye.\nYour rating was %s.\n", rate());
105 #include <sys/time.h>
107 static FILE *score_fp;
112 if ((score_fp = fopen(_PATH_SCORE,"a")) == NULL)
125 if (score_fp == NULL)
128 s = sigblock(sigmask(SIGINT));
130 gettimeofday(&tv, (struct timezone *)0); /* can't call time */
131 tvsec = (time_t) tv.tv_sec;
132 date = ctime(&tvsec);
135 fprintf(score_fp, "%s %8s %c%20s", date, uname, ch, rate());
137 fprintf(score_fp, " wizard\n");
139 fprintf(score_fp, " WIZARD!\n");
141 fprintf(score_fp, "\n");
151 score = max(max(pleasure,power),ego);
152 if (score == pleasure){
156 return("junior voyeur");
159 else return("Marquis De Sade");
161 else if (score == power){
169 return("Darth Vader");
170 else return("Sauron the Great");
176 return("philanthropist");
179 else return("Mr. Roarke");
186 if (testbit(location[position].objects,CAR)){
187 puts("You hop in the car and turn the key. There is a perceptible grating noise,");
188 puts("and an explosion knocks you unconscious...");
189 clearbit(location[position].objects,CAR);
190 setbit(location[position].objects,CRASH);
191 injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
197 puts("There is nothing to drive here.");
204 if (testbit(location[position].objects,HORSE)){
205 puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
206 puts("forward through bush and fern. You are thrown and the horse gallups off.");
207 clearbit(location[position].objects,HORSE);
208 while (!(position = rnd(NUMOFROOMS+1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere);
209 setbit(location[position].objects,HORSE);
210 if (location[position].north)
211 position = location[position].north;
212 else if (location[position].south)
213 position = location[position].south;
214 else if (location[position].east)
215 position = location[position].east;
217 position = location[position].west;
220 else puts("There is no horse here.");
225 light() /* synonyms = {strike, smoke} */
226 { /* for matches, cigars */
227 if (testbit(inven,MATCHES) && matchcount){
228 puts("Your match splutters to life.");
232 if (position == 217){
233 puts("The whole bungalow explodes with an intense blast.");
237 else puts("You're out of matches.");