Oops, fix lagg's type in LINT64.
[dragonfly.git] / games / battlestar / command3.c
blob5ed708c02ce904820fa6bdd0b84d19e369ef956d
1 /*-
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
7 * are met:
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. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
29 * @(#)com3.c 8.1 (Berkeley) 5/31/93
30 * $FreeBSD: src/games/battlestar/com3.c,v 1.8.2.1 2001/03/05 11:45:35 kris Exp $
33 #include "externs.h"
35 void
36 dig(void)
38 if (testbit(inven, SHOVEL)) {
39 puts("OK");
40 gtime++;
41 switch (position) {
42 case 144: /* copse near beach */
43 if (!notes[DUG]) {
44 setbit(location[position].objects, DEADWOOD);
45 setbit(location[position].objects, COMPASS);
46 setbit(location[position].objects, KNIFE);
47 setbit(location[position].objects, MACE);
48 notes[DUG] = 1;
50 break;
52 default:
53 puts("Nothing happens.");
55 } else
56 puts("You don't have a shovel.");
59 int
60 jump(void)
62 int n;
64 switch (position) {
65 default:
66 puts("Nothing happens.");
67 return (-1);
69 case 242:
70 position = 133;
71 break;
72 case 214:
73 case 215:
74 case 162:
75 case 159:
76 position = 145;
77 break;
78 case 232:
79 position = 275;
80 break;
81 case 3:
82 position = 1;
83 break;
84 case 172:
85 position = 201;
87 puts("Ahhhhhhh...");
88 injuries[12] = injuries[8] = injuries[7] = injuries[6] = 1;
89 for (n = 0; n < NUMOFOBJECTS; n++)
90 if (testbit(inven, n)) {
91 clearbit(inven, n);
92 setbit(location[position].objects, n);
94 carrying = 0;
95 encumber = 0;
96 return (0);
99 void
100 bury(void)
102 int value;
104 if (testbit(inven, SHOVEL)) {
105 while (wordtype[++wordnumber] != OBJECT &&
106 wordtype[wordnumber] != NOUNS && wordnumber < wordcount)
107 ; /* nothing */
108 value = wordvalue[wordnumber];
109 if (wordtype[wordnumber] == NOUNS &&
110 (testbit(location[position].objects, value) ||
111 value == BODY))
112 switch (value) {
113 case BODY:
114 wordtype[wordnumber] = OBJECT;
115 if (testbit(inven, MAID) ||
116 testbit(location[position].objects, MAID))
117 value = MAID;
118 if (testbit(inven, DEADWOOD) ||
119 testbit(location[position].objects,
120 DEADWOOD))
121 value = DEADWOOD;
122 if (testbit(inven, DEADGOD) ||
123 testbit(location[position].objects,
124 DEADGOD))
125 value = DEADGOD;
126 if (testbit(inven, DEADTIME) ||
127 testbit(location[position].objects,
128 DEADTIME))
129 value = DEADTIME;
130 if (testbit(inven, DEADNATIVE) ||
131 testbit(location[position].objects,
132 DEADNATIVE))
133 value = DEADNATIVE;
134 break;
136 case NATIVE:
137 case NORMGOD:
138 puts("She screams as you wrestle her into the hole.");
139 /* FALLTHROUGH */
140 case TIMER:
141 power += 7;
142 ego -= 10;
143 /* FALLTHROUGH */
144 case AMULET:
145 case MEDALION:
146 case TALISMAN:
147 wordtype[wordnumber] = OBJECT;
148 break;
150 default:
151 puts("Wha..?");
153 if (wordtype[wordnumber] == OBJECT && position > 88 &&
154 (testbit(inven, value) ||
155 testbit(location[position].objects, value))) {
156 puts("Buried.");
157 if (testbit(inven, value)) {
158 clearbit(inven, value);
159 carrying -= objwt[value];
160 encumber -= objcumber[value];
162 clearbit(location[position].objects, value);
163 switch (value) {
164 case MAID:
165 case DEADWOOD:
166 case DEADNATIVE:
167 case DEADTIME:
168 case DEADGOD:
169 ego += 2;
170 printf("The %s should rest easier now.\n",
171 objsht[value]);
173 } else
174 puts("It doesn't seem to work.");
175 } else
176 puts("You aren't holding a shovel.");
179 void
180 drink(void)
182 int n;
184 if (testbit(inven, POTION)) {
185 puts("The cool liquid runs down your throat but turns to fire and you choke.");
186 puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
187 puts("asleep.");
188 clearbit(inven, POTION);
189 WEIGHT = MAXWEIGHT;
190 CUMBER = MAXCUMBER;
191 for (n = 0; n < NUMOFINJURIES; n++)
192 injuries[n] = 0;
193 gtime++;
194 zzz();
195 } else
196 puts("I'm not thirsty.");
200 shoot(void)
202 int firstnumber, value;
203 int n;
205 firstnumber = wordnumber;
206 if (!testbit(inven, LASER))
207 puts("You aren't holding a blaster.");
208 else {
209 while (wordtype[++wordnumber] == ADJS)
210 ; /* nothing */
211 while (wordnumber <= wordcount &&
212 wordtype[wordnumber] == OBJECT) {
213 value = wordvalue[wordnumber];
214 printf("%s:\n", objsht[value]);
215 for (n = 0; objsht[value][n]; n++)
216 ; /* nothing */
217 if (testbit(location[position].objects, value)) {
218 clearbit(location[position].objects, value);
219 gtime++;
220 printf("The %s explode%s\n", objsht[value],
221 (objsht[value][n - 1] ==
222 's' ? (objsht[value][n - 2] ==
223 's' ? "s." : ".") : "s."));
224 if (value == BOMB)
225 die(0);
226 } else
227 printf("I dont see any %s around here.\n",
228 objsht[value]);
229 if (wordnumber < wordcount - 1 &&
230 wordvalue[++wordnumber] == AND)
231 wordnumber++;
232 else
233 return (firstnumber);
235 /* special cases with their own return()'s */
237 if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS) {
238 gtime++;
239 switch (wordvalue[wordnumber]) {
240 case DOOR:
241 switch (position) {
242 case 189:
243 case 231:
244 puts("The door is unhinged.");
245 location[189].north = 231;
246 location[231].south = 189;
247 whichway(location[position]);
248 break;
249 case 30:
250 puts("The wooden door splinters.");
251 location[30].west = 25;
252 whichway(location[position]);
253 break;
254 case 31:
255 puts("The laser blast has no effect on the door.");
256 break;
257 case 20:
258 puts("The blast hits the door and it explodes into flame. The magnesium burns");
259 puts("so rapidly that we have no chance to escape.");
260 die(0);
261 default:
262 puts("Nothing happens.");
264 break;
266 case NORMGOD:
267 if (testbit(location[position].objects,
268 BATHGOD)) {
269 puts("The goddess is hit in the chest and splashes back against the rocks.");
270 puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
271 puts("pools and then off downstream.");
272 clearbit(location[position].objects,
273 BATHGOD);
274 setbit(location[180].objects, DEADGOD);
275 power += 5;
276 ego -= 10;
277 notes[JINXED]++;
278 } else
279 if (testbit(location[position].objects,
280 NORMGOD)) {
281 puts("The blast catches the goddess in the stomach, knocking her to the ground.");
282 puts("She writhes in the dirt as the agony of death taunts her.");
283 puts("She has stopped moving.");
284 clearbit(location[position].objects, NORMGOD);
285 setbit(location[position].objects, DEADGOD);
286 power += 5;
287 ego -= 10;
288 notes[JINXED]++;
289 if (wintime)
290 live();
291 break;
292 } else
293 puts("I don't see any goddess around here.");
294 break;
296 case TIMER:
297 if (testbit(location[position].objects,
298 TIMER)) {
299 puts("The old man slumps over the bar.");
300 power++;
301 ego -= 2;
302 notes[JINXED]++;
303 clearbit(location[position].objects,
304 TIMER);
305 setbit(location[position].objects,
306 DEADTIME);
307 } else
308 puts("What old timer?");
309 break;
310 case MAN:
311 if (testbit(location[position].objects, MAN)) {
312 puts("The man falls to the ground with blood pouring all over his white suit.");
313 puts("Your fantasy is over.");
314 die(0);
315 } else
316 puts("What man?");
317 break;
318 case NATIVE:
319 if (testbit(location[position].objects,
320 NATIVE)) {
321 puts("The girl is blown backwards several feet and lies in a pool of blood.");
322 clearbit(location[position].objects,
323 NATIVE);
324 setbit(location[position].objects,
325 DEADNATIVE);
326 power += 5;
327 ego -= 2;
328 notes[JINXED]++;
329 } else
330 puts("There is no girl here.");
331 break;
332 case -1:
333 puts("Shoot what?");
334 break;
336 default:
337 printf("You can't shoot the %s.\n",
338 objsht[wordvalue[wordnumber]]);
340 } else
341 puts("You must be a looney.");
343 return (firstnumber);