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
33 * @(#)externs.h 8.1 (Berkeley) 5/31/93
35 * $FreeBSD: src/games/battlestar/externs.h,v 1.9.2.1 2001/03/05 11:45:36 kris Exp $
36 * $DragonFly: src/games/battlestar/externs.h,v 1.2 2003/06/17 04:25:22 dillon Exp $
40 #include <sys/param.h>
41 #include <sys/signal.h>
42 #include <sys/types.h>
49 #define OUTSIDE (position > 68 && position < 246 && position != 218)
50 #define rnd(x) (random() % (x))
51 #define max(a,b) ((a) < (b) ? (b) : (a))
52 #define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
54 #define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
56 #define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
58 /* well known rooms */
129 #define DEADNATIVE 57
136 #define NUMOFOBJECTS 64
137 /* non-objects below */
160 #define EVERYTHING 1022
193 #define ARM 6 /* broken arm */
194 #define RIBS 7 /* broken ribs */
195 #define SPINE 9 /* broken back */
196 #define SKULL 11 /* fractured skull */
197 #define INCISE 10 /* deep incisions */
198 #define NECK 12 /* broken NECK */
199 #define NUMOFINJURIES 13
210 /* fundamental constants */
211 #define NUMOFROOMS 275
212 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
213 #define LINELENGTH 81
219 /* initial variable values */
228 #define north link[0]
229 #define south link[1]
233 #define access link[5]
235 #define flyhere link[7]
237 unsigned int objects[NUMOFWORDS];
239 extern struct room dayfile[];
240 extern struct room nightfile[];
241 struct room *location;
243 /* object characteristics */
244 extern const char *const objdes[NUMOFOBJECTS];
245 extern const char *const objsht[NUMOFOBJECTS];
246 extern const char *const ouch[NUMOFINJURIES];
247 extern const int objwt[NUMOFOBJECTS];
248 extern const int objcumber[NUMOFOBJECTS];
250 /* current input line */
251 #define NWORD 20 /* words per line */
252 char words[NWORD][15];
253 int wordvalue[NWORD];
255 int wordcount, wordnumber;
258 int battlestar_move __P((int, int));
259 void bury __P((void));
260 int card __P((const char *, int));
261 void chime __P((void));
262 void crash __P((void));
263 int cypher __P((void));
265 void dig __P((void));
266 int draw __P((void));
267 void drink __P((void));
268 int drive __P((void));
269 int drop __P((const char *name));
271 int fight __P((int, int));
272 int follow __P((void));
273 char *getcom __P((char *, int, const char *, const char *));
274 char *getword __P((char *, char *, int));
275 int give __P((void));
276 void initialize __P((int));
277 int jump __P((void));
278 void kiss __P((void));
279 int land __P((void));
280 int launch __P((void));
281 void light __P((void));
282 void live __P((void));
283 void love __P((void));
284 void murder __P((void));
285 void news __P((void));
286 void newway __P((int));
287 void open_score_file __P((void));
288 void parse __P((void));
289 void printobjs __P((void));
291 int puton __P((void));
292 void ravage __P((void));
293 const char *rate __P((void));
294 void restore __P((void));
295 int ride __P((void));
296 void save __P((void));
297 int shoot __P((void));
298 int take __P((unsigned int from[]));
300 int throw __P((const char *name));
301 const char *truedirec __P((int, unsigned int));
302 int ucard __P((const unsigned int *));
304 int visual __P((void));
305 int wearit __P((void));
306 void whichway __P((struct room));
307 void wordinit __P((void));
308 void writedes __P((void));
311 /* state of the game */
316 int left, right, ahead, back;
318 int carrying, encumber;
320 extern int followfight;
324 extern int followgod;
331 extern int matchcount;
333 int pleasure, power, ego;
336 int notes[NUMOFNOTES];
337 unsigned int inven[NUMOFWORDS];
338 u_int wear[NUMOFWORDS];
339 char beenthere[NUMOFROOMS+1];
340 char injuries[NUMOFINJURIES];
342 char uname[MAXLOGNAME];
351 #define HASHMASK (HASHSIZE - 1)
352 struct wlist *hashtab[HASHSIZE];
353 extern struct wlist wlist[];
359 extern const struct objs dayobjs[];
360 extern const struct objs nightobjs[];