]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/command3.c
1 /* $NetBSD: command3.c,v 1.1 2001/10/19 03:06:11 tv 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
[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95";
41 __RCSID("$NetBSD: command3.c,v 1.1 2001/10/19 03:06:11 tv Exp $");
50 if (testbit(inven
, SHOVEL
)) {
54 case 144: /* copse near beach */
56 setbit(location
[position
].objects
, DEADWOOD
);
57 setbit(location
[position
].objects
, COMPASS
);
58 setbit(location
[position
].objects
, KNIFE
);
59 setbit(location
[position
].objects
, MACE
);
65 puts("Nothing happens.");
68 puts("You don't have a shovel.");
78 puts("Nothing happens.");
100 injuries
[12] = injuries
[8] = injuries
[7] = injuries
[6] = 1;
101 for (n
= 0; n
< NUMOFOBJECTS
; n
++)
102 if (testbit(inven
, n
)) {
104 setbit(location
[position
].objects
, n
);
116 if (testbit(inven
, SHOVEL
)) {
117 while (wordtype
[++wordnumber
] != OBJECT
&& wordtype
[wordnumber
] != NOUNS
&& wordnumber
< wordcount
)
119 value
= wordvalue
[wordnumber
];
120 if (wordtype
[wordnumber
] == NOUNS
&& (testbit(location
[position
].objects
, value
) || value
== BODY
))
123 wordtype
[wordnumber
] = OBJECT
;
124 if (testbit(inven
, MAID
) || testbit(location
[position
].objects
, MAID
))
126 if (testbit(inven
, DEADWOOD
) || testbit(location
[position
].objects
, DEADWOOD
))
128 if (testbit(inven
, DEADGOD
) || testbit(location
[position
].objects
, DEADGOD
))
130 if (testbit(inven
, DEADTIME
) || testbit(location
[position
].objects
, DEADTIME
))
132 if (testbit(inven
, DEADNATIVE
) || testbit(location
[position
].objects
, DEADNATIVE
))
138 puts("She screams as you wrestle her into the hole.");
145 wordtype
[wordnumber
] = OBJECT
;
151 if (wordtype
[wordnumber
] == OBJECT
&& position
> 88 && (testbit(inven
, value
) || testbit(location
[position
].objects
, value
))) {
153 if (testbit(inven
, value
)) {
154 clearbit(inven
, value
);
155 carrying
-= objwt
[value
];
156 encumber
-= objcumber
[value
];
158 clearbit(location
[position
].objects
, value
);
166 printf("The %s should rest easier now.\n", objsht
[value
]);
169 puts("It doesn't seem to work.");
171 puts("You aren't holding a shovel.");
179 if (testbit(inven
, POTION
)) {
180 puts("The cool liquid runs down your throat but turns to fire and you choke.");
181 puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
183 clearbit(inven
, POTION
);
186 for (n
= 0; n
< NUMOFINJURIES
; n
++)
191 puts("I'm not thirsty.");
197 int firstnumber
, value
;
199 firstnumber
= wordnumber
;
200 if (!testbit(inven
, LASER
))
201 puts("You aren't holding a blaster.");
204 while (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == OBJECT
) {
205 value
= wordvalue
[wordnumber
];
206 printf("%s:\n", objsht
[value
]);
207 if (testbit(location
[position
].objects
, value
)) {
208 clearbit(location
[position
].objects
, value
);
210 printf("The %s explode%s\n", objsht
[value
],
211 (is_plural_object(value
) ? "." : "s."));
215 printf("I don't see any %s around here.\n", objsht
[value
]);
216 if (wordnumber
< wordcount
- 1 && wordvalue
[++wordnumber
] == AND
)
219 return (firstnumber
);
221 /* special cases with their own return()'s */
223 if (wordnumber
<= wordcount
&& wordtype
[wordnumber
] == NOUNS
) {
225 switch (wordvalue
[wordnumber
]) {
231 puts("The door is unhinged.");
232 location
[189].north
= 231;
233 location
[231].south
= 189;
234 whichway(location
[position
]);
237 puts("The wooden door splinters.");
238 location
[30].west
= 25;
239 whichway(location
[position
]);
242 puts("The laser blast has no effect on the door.");
245 puts("The blast hits the door and it explodes into flame. The magnesium burns");
246 puts("so rapidly that we have no chance to escape.");
249 puts("Nothing happens.");
254 if (testbit(location
[position
].objects
, BATHGOD
)) {
255 puts("The goddess is hit in the chest and splashes back against the rocks.");
256 puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
257 puts("pools and then off downstream.");
258 clearbit(location
[position
].objects
, BATHGOD
);
259 setbit(location
[180].objects
, DEADGOD
);
264 if (testbit(location
[position
].objects
, NORMGOD
)) {
265 puts("The blast catches the goddess in the stomach, knocking her to the ground.");
266 puts("She writhes in the dirt as the agony of death taunts her.");
267 puts("She has stopped moving.");
268 clearbit(location
[position
].objects
, NORMGOD
);
269 setbit(location
[position
].objects
, DEADGOD
);
277 puts("I don't see any goddess around here.");
281 if (testbit(location
[position
].objects
, TIMER
)) {
282 puts("The old man slumps over the bar.");
286 clearbit(location
[position
].objects
, TIMER
);
287 setbit(location
[position
].objects
, DEADTIME
);
289 puts("What old-timer?");
292 if (testbit(location
[position
].objects
, MAN
)) {
293 puts("The man falls to the ground with blood pouring all over his white suit.");
294 puts("Your fantasy is over.");
300 if (testbit(location
[position
].objects
, NATIVE
)) {
301 puts("The girl is blown backwards several feet and lies in a pool of blood.");
302 clearbit(location
[position
].objects
, NATIVE
);
303 setbit(location
[position
].objects
, DEADNATIVE
);
308 puts("There is no girl here.");
315 printf("You can't shoot the %s.\n", objsht
[wordvalue
[wordnumber
]]);
318 puts("You must be a looney.");
320 return (firstnumber
);