]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com3.c
Fix some spelling errors reported by Joseph Myers <jsm28@cam.ac.uk>
[bsdgames-darwin.git] / battlestar / com3.c
1 /* $NetBSD: com3.c,v 1.6 1997/10/11 02:07:02 lukem Exp $ */
2
3 /*
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
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.
22 *
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
33 * SUCH DAMAGE.
34 */
35
36 #include <sys/cdefs.h>
37 #ifndef lint
38 #if 0
39 static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95";
40 #else
41 __RCSID("$NetBSD: com3.c,v 1.6 1997/10/11 02:07:02 lukem Exp $");
42 #endif
43 #endif /* not lint */
44
45 #include "extern.h"
46
47 void
48 dig()
49 {
50 if (testbit(inven, SHOVEL)) {
51 puts("OK");
52 ourtime++;
53 switch (position) {
54 case 144: /* copse near beach */
55 if (!notes[DUG]) {
56 setbit(location[position].objects, DEADWOOD);
57 setbit(location[position].objects, COMPASS);
58 setbit(location[position].objects, KNIFE);
59 setbit(location[position].objects, MACE);
60 notes[DUG] = 1;
61 }
62 break;
63
64 default:
65 puts("Nothing happens.");
66 }
67 } else
68 puts("You don't have a shovel.");
69 }
70
71 int
72 jump()
73 {
74 int n;
75
76 switch (position) {
77 default:
78 puts("Nothing happens.");
79 return (-1);
80
81 case 242:
82 position = 133;
83 break;
84 case 214:
85 case 215:
86 case 162:
87 case 159:
88 position = 145;
89 break;
90 case 232:
91 position = 275;
92 break;
93 case 3:
94 position = 1;
95 break;
96 case 172:
97 position = 201;
98 }
99 puts("Ahhhhhhh...");
100 injuries[12] = injuries[8] = injuries[7] = injuries[6] = 1;
101 for (n = 0; n < NUMOFOBJECTS; n++)
102 if (testbit(inven, n)) {
103 clearbit(inven, n);
104 setbit(location[position].objects, n);
105 }
106 carrying = 0;
107 encumber = 0;
108 return (0);
109 }
110
111 void
112 bury()
113 {
114 int value;
115
116 if (testbit(inven, SHOVEL)) {
117 while (wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber < wordcount);
118 value = wordvalue[wordnumber];
119 if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects, value) || value == BODY))
120 switch (value) {
121 case BODY:
122 wordtype[wordnumber] = OBJECT;
123 if (testbit(inven, MAID) || testbit(location[position].objects, MAID))
124 value = MAID;
125 if (testbit(inven, DEADWOOD) || testbit(location[position].objects, DEADWOOD))
126 value = DEADWOOD;
127 if (testbit(inven, DEADGOD) || testbit(location[position].objects, DEADGOD))
128 value = DEADGOD;
129 if (testbit(inven, DEADTIME) || testbit(location[position].objects, DEADTIME))
130 value = DEADTIME;
131 if (testbit(inven, DEADNATIVE) || testbit(location[position].objects, DEADNATIVE))
132 value = DEADNATIVE;
133 break;
134
135 case NATIVE:
136 case NORMGOD:
137 puts("She screams as you wrestle her into the hole.");
138 case TIMER:
139 power += 7;
140 ego -= 10;
141 case AMULET:
142 case MEDALION:
143 case TALISMAN:
144 wordtype[wordnumber] = OBJECT;
145 break;
146
147 default:
148 puts("Wha..?");
149 }
150 if (wordtype[wordnumber] == OBJECT && position > 88 && (testbit(inven, value) || testbit(location[position].objects, value))) {
151 puts("Buried.");
152 if (testbit(inven, value)) {
153 clearbit(inven, value);
154 carrying -= objwt[value];
155 encumber -= objcumber[value];
156 }
157 clearbit(location[position].objects, value);
158 switch (value) {
159 case MAID:
160 case DEADWOOD:
161 case DEADNATIVE:
162 case DEADTIME:
163 case DEADGOD:
164 ego += 2;
165 printf("The %s should rest easier now.\n", objsht[value]);
166 }
167 } else
168 puts("It doesn't seem to work.");
169 } else
170 puts("You aren't holding a shovel.");
171 }
172
173 void
174 drink()
175 {
176 int n;
177
178 if (testbit(inven, POTION)) {
179 puts("The cool liquid runs down your throat but turns to fire and you choke.");
180 puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
181 puts("asleep.");
182 clearbit(inven, POTION);
183 WEIGHT = MAXWEIGHT;
184 CUMBER = MAXCUMBER;
185 for (n = 0; n < NUMOFINJURIES; n++)
186 injuries[n] = 0;
187 ourtime++;
188 zzz();
189 } else
190 puts("I'm not thirsty.");
191 }
192
193 int
194 shoot()
195 {
196 int firstnumber, value;
197 int n;
198
199 firstnumber = 0;
200 if (!testbit(inven, LASER))
201 puts("You aren't holding a blaster.");
202 else {
203 firstnumber = wordnumber;
204 while (wordtype[++wordnumber] == ADJS);
205 while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) {
206 value = wordvalue[wordnumber];
207 printf("%s:\n", objsht[value]);
208 for (n = 0; objsht[value][n]; n++);
209 if (testbit(location[position].objects, value)) {
210 clearbit(location[position].objects, value);
211 ourtime++;
212 printf("The %s explode%s\n", objsht[value], (objsht[value][n - 1] == 's' ? (objsht[value][n - 2] == 's' ? "s." : ".") : "s."));
213 if (value == BOMB)
214 die();
215 } else
216 printf("I dont see any %s around here.\n", objsht[value]);
217 if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
218 wordnumber++;
219 else
220 return (firstnumber);
221 }
222 /* special cases with their own return()'s */
223
224 if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS) {
225 ourtime++;
226 switch (wordvalue[wordnumber]) {
227
228 case DOOR:
229 switch (position) {
230 case 189:
231 case 231:
232 puts("The door is unhinged.");
233 location[189].north = 231;
234 location[231].south = 189;
235 whichway(location[position]);
236 break;
237 case 30:
238 puts("The wooden door splinters.");
239 location[30].west = 25;
240 whichway(location[position]);
241 break;
242 case 31:
243 puts("The laser blast has no effect on the door.");
244 break;
245 case 20:
246 puts("The blast hits the door and it explodes into flame. The magnesium burns");
247 puts("so rapidly that we have no chance to escape.");
248 die();
249 default:
250 puts("Nothing happens.");
251 }
252 break;
253
254 case NORMGOD:
255 if (testbit(location[position].objects, BATHGOD)) {
256 puts("The goddess is hit in the chest and splashes back against the rocks.");
257 puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
258 puts("pools and then off downstream.");
259 clearbit(location[position].objects, BATHGOD);
260 setbit(location[180].objects, DEADGOD);
261 power += 5;
262 ego -= 10;
263 notes[JINXED]++;
264 } else
265 if (testbit(location[position].objects, NORMGOD)) {
266 puts("The blast catches the goddess in the stomach, knocking her to the ground.");
267 puts("She writhes in the dirt as the agony of death taunts her.");
268 puts("She has stopped moving.");
269 clearbit(location[position].objects, NORMGOD);
270 setbit(location[position].objects, DEADGOD);
271 power += 5;
272 ego -= 10;
273 notes[JINXED]++;
274 if (wintime)
275 live();
276 break;
277 } else
278 puts("I don't see any goddess around here.");
279 break;
280
281 case TIMER:
282 if (testbit(location[position].objects, TIMER)) {
283 puts("The old man slumps over the bar.");
284 power++;
285 ego -= 2;
286 notes[JINXED]++;
287 clearbit(location[position].objects, TIMER);
288 setbit(location[position].objects, DEADTIME);
289 } else
290 puts("What old timer?");
291 break;
292 case MAN:
293 if (testbit(location[position].objects, MAN)) {
294 puts("The man falls to the ground with blood pouring all over his white suit.");
295 puts("Your fantasy is over.");
296 die();
297 } else
298 puts("What man?");
299 break;
300 case NATIVE:
301 if (testbit(location[position].objects, NATIVE)) {
302 puts("The girl is blown backwards several feet and lies in a pool of blood.");
303 clearbit(location[position].objects, NATIVE);
304 setbit(location[position].objects, DEADNATIVE);
305 power += 5;
306 ego -= 2;
307 notes[JINXED]++;
308 } else
309 puts("There is no girl here.");
310 break;
311 case -1:
312 puts("Shoot what?");
313 break;
314
315 default:
316 printf("You can't shoot the %s.\n", objsht[wordvalue[wordnumber]]);
317 }
318 } else
319 puts("You must be a looney.");
320 }
321 return (firstnumber);
322 }