]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com6.c
1 /* $NetBSD: com6.c,v 1.13 1999/09/13 17:15:42 jsm Exp $ */
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <sys/cdefs.h>
39 static char sccsid
[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
41 __RCSID("$NetBSD: com6.c,v 1.13 1999/09/13 17:15:42 jsm Exp $");
46 #include "pathnames.h"
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.");
62 puts("Not enough fuel to launch.");
64 puts("Can't launch.");
71 if (notes
[LAUNCHED
] && testbit(location
[position
].objects
, LAND
) &&
72 location
[position
].down
) {
74 position
= location
[position
].down
;
75 setbit(location
[position
].objects
, VIPER
);
78 puts("You are down.");
81 puts("You can't land here.");
88 printf("bye.\nYour rating was %s.\n", rate());
95 int dummy
__attribute__((__unused__
));
108 static FILE *score_fp
;
113 score_fp
= fopen(_PATH_SCORE
, "a");
114 if (score_fp
== NULL
)
115 warn("open %s for append", _PATH_SCORE
);
116 if (score_fp
!= NULL
&& fileno(score_fp
) < 3)
127 sigset_t sigset
, osigset
;
129 sigemptyset(&sigset
);
130 sigaddset(&sigset
, SIGINT
);
131 sigprocmask(SIG_BLOCK
, &sigset
, &osigset
);
132 gettimeofday(&tv
, (struct timezone
*) 0); /* can't call time */
133 tvsec
= (time_t) tv
.tv_sec
;
134 date
= ctime(&tvsec
);
136 if (score_fp
!= NULL
) {
137 fprintf(score_fp
, "%s %8s %c%20s", date
, uname
, ch
, rate());
139 fprintf(score_fp
, " wizard\n");
142 fprintf(score_fp
, " WIZARD!\n");
144 fprintf(score_fp
, "\n");
146 sigprocmask(SIG_SETMASK
, &osigset
, (sigset_t
*) 0);
154 score
= max(max(pleasure
, power
), ego
);
155 if (score
== pleasure
) {
160 return ("junior voyeur");
165 return ("Marquis De Sade");
167 if (score
== power
) {
178 return ("Darth Vader");
180 return ("Sauron the Great");
186 return ("philanthropist");
191 return ("Mr. Roarke");
198 if (testbit(location
[position
].objects
, CAR
)) {
199 puts("You hop in the car and turn the key. There is a perceptible grating noise,");
200 puts("and an explosion knocks you unconscious...");
201 clearbit(location
[position
].objects
, CAR
);
202 setbit(location
[position
].objects
, CRASH
);
203 injuries
[5] = injuries
[6] = injuries
[7] = injuries
[8] = 1;
208 puts("There is nothing to drive here.");
215 if (testbit(location
[position
].objects
, HORSE
)) {
216 puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
217 puts("forward through bush and fern. You are thrown and the horse gallups off.");
218 clearbit(location
[position
].objects
, HORSE
);
219 while (!(position
= rnd(NUMOFROOMS
+ 1)) || !OUTSIDE
|| !beenthere
[position
] || location
[position
].flyhere
);
220 setbit(location
[position
].objects
, HORSE
);
221 if (location
[position
].north
)
222 position
= location
[position
].north
;
224 if (location
[position
].south
)
225 position
= location
[position
].south
;
227 if (location
[position
].east
)
228 position
= location
[position
].east
;
230 position
= location
[position
].west
;
233 puts("There is no horse here.");
239 { /* synonyms = {strike, smoke} *//* for
241 if (testbit(inven
, MATCHES
) && matchcount
) {
242 puts("Your match splutters to life.");
246 if (position
== 217) {
247 puts("The whole bungalow explodes with an intense blast.");
251 puts("You're out of matches.");