]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/externs.h
2 * Copyright (c) 1983 Regents of the University of California.
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 * from: @(#)externs.h 5.4 (Berkeley) 6/1/90
34 * $Id: externs.h,v 1.2 1993/08/01 18:56:15 mycroft Exp $
37 #include <sys/signal.h>
40 #define BITS (8 * sizeof (int))
42 #define OUTSIDE (position > 68 && position < 246 && position != 218)
43 #define rnd(x) (rand() % (x))
44 #define max(a,b) ((a) < (b) ? (b) : (a))
45 #define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
46 #define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
47 #define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
49 /* well known rooms */
120 #define DEADNATIVE 57
127 #define NUMOFOBJECTS 64
128 /* non-objects below */
151 #define EVERYTHING 1022
184 #define ARM 6 /* broken arm */
185 #define RIBS 7 /* broken ribs */
186 #define SPINE 9 /* broken back */
187 #define SKULL 11 /* fractured skull */
188 #define INCISE 10 /* deep incisions */
189 #define NECK 12 /* broken NECK */
190 #define NUMOFINJURIES 13
201 /* fundamental constants */
202 #define NUMOFROOMS 275
203 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
204 #define LINELENGTH 81
210 /* initial variable values */
219 #define north link[0]
220 #define south link[1]
224 #define access link[5]
226 #define flyhere link[7]
228 unsigned int objects
[NUMOFWORDS
];
230 struct room dayfile
[];
231 struct room nightfile
[];
232 struct room
*location
;
234 /* object characteristics */
235 char *objdes
[NUMOFOBJECTS
];
236 char *objsht
[NUMOFOBJECTS
];
237 char *ouch
[NUMOFINJURIES
];
238 int objwt
[NUMOFOBJECTS
];
239 int objcumber
[NUMOFOBJECTS
];
241 /* current input line */
242 #define NWORD 20 /* words per line */
243 char words
[NWORD
][15];
244 int wordvalue
[NWORD
];
246 int wordcount
, wordnumber
;
248 char *truedirec(), *rate();
249 char *getcom(), *getword();
251 /* state of the game */
255 int left
, right
, ahead
, back
;
256 int clock
, fuel
, torps
;
257 int carrying
, encumber
;
269 int matchlight
, matchcount
;
271 int pleasure
, power
, ego
;
274 int notes
[NUMOFNOTES
];
275 unsigned int inven
[NUMOFWORDS
];
276 unsigned int wear
[NUMOFWORDS
];
277 char beenthere
[NUMOFROOMS
+1];
278 char injuries
[NUMOFINJURIES
];
289 #define HASHMASK (HASHSIZE - 1)
290 struct wlist
*hashtab
[HASHSIZE
];
291 struct wlist wlist
[];
297 struct objs dayobjs
[];
298 struct objs nightobjs
[];