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 $
39 #include <sys/param.h>
40 #include <sys/signal.h>
41 #include <sys/types.h>
48 #define OUTSIDE (position > 68 && position < 246 && position != 218)
49 #define rnd(x) (random() % (x))
50 #define max(a,b) ((a) < (b) ? (b) : (a))
51 #define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
53 #define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
55 #define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
57 /* well known rooms */
128 #define DEADNATIVE 57
135 #define NUMOFOBJECTS 64
136 /* non-objects below */
159 #define EVERYTHING 1022
192 #define ARM 6 /* broken arm */
193 #define RIBS 7 /* broken ribs */
194 #define SPINE 9 /* broken back */
195 #define SKULL 11 /* fractured skull */
196 #define INCISE 10 /* deep incisions */
197 #define NECK 12 /* broken NECK */
198 #define NUMOFINJURIES 13
209 /* fundamental constants */
210 #define NUMOFROOMS 275
211 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
212 #define LINELENGTH 81
218 /* initial variable values */
227 #define north link[0]
228 #define south link[1]
232 #define access link[5]
234 #define flyhere link[7]
236 unsigned int objects[NUMOFWORDS];
238 extern struct room dayfile[];
239 extern struct room nightfile[];
240 struct room *location;
242 /* object characteristics */
243 extern const char *const objdes[NUMOFOBJECTS];
244 extern const char *const objsht[NUMOFOBJECTS];
245 extern const char *const ouch[NUMOFINJURIES];
246 extern const int objwt[NUMOFOBJECTS];
247 extern const int objcumber[NUMOFOBJECTS];
249 /* current input line */
250 #define NWORD 20 /* words per line */
251 char words[NWORD][15];
252 int wordvalue[NWORD];
254 int wordcount, wordnumber;
257 int battlestar_move __P((int, int));
258 void bury __P((void));
259 int card __P((const char *, int));
260 void chime __P((void));
261 void crash __P((void));
262 int cypher __P((void));
264 void dig __P((void));
265 int draw __P((void));
266 void drink __P((void));
267 int drive __P((void));
268 int drop __P((const char *name));
270 int fight __P((int, int));
271 int follow __P((void));
272 char *getcom __P((char *, int, const char *, const char *));
273 char *getword __P((char *, char *, int));
274 int give __P((void));
275 void initialize __P((int));
276 int jump __P((void));
277 void kiss __P((void));
278 int land __P((void));
279 int launch __P((void));
280 void light __P((void));
281 void live __P((void));
282 void love __P((void));
283 void murder __P((void));
284 void news __P((void));
285 void newway __P((int));
286 void open_score_file __P((void));
287 void parse __P((void));
288 void printobjs __P((void));
290 int puton __P((void));
291 void ravage __P((void));
292 const char *rate __P((void));
293 void restore __P((void));
294 int ride __P((void));
295 void save __P((void));
296 int shoot __P((void));
297 int take __P((unsigned int from[]));
299 int throw __P((const char *name));
300 const char *truedirec __P((int, unsigned int));
301 int ucard __P((const unsigned int *));
303 int visual __P((void));
304 int wearit __P((void));
305 void whichway __P((struct room));
306 void wordinit __P((void));
307 void writedes __P((void));
310 /* state of the game */
315 int left, right, ahead, back;
317 int carrying, encumber;
319 extern int followfight;
323 extern int followgod;
330 extern int matchcount;
332 int pleasure, power, ego;
335 int notes[NUMOFNOTES];
336 unsigned int inven[NUMOFWORDS];
337 u_int wear[NUMOFWORDS];
338 char beenthere[NUMOFROOMS+1];
339 char injuries[NUMOFINJURIES];
341 char uname[MAXLOGNAME];
350 #define HASHMASK (HASHSIZE - 1)
351 struct wlist *hashtab[HASHSIZE];
352 extern struct wlist wlist[];
358 extern const struct objs dayobjs[];
359 extern const struct objs nightobjs[];