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
37 #include <sys/param.h>
38 #include <sys/signal.h>
44 #define OUTSIDE (position > 68 && position < 246 && position != 218)
45 #define rnd(x) (random() % (x))
46 #define max(a,b) ((a) < (b) ? (b) : (a))
47 #define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
49 #define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
51 #define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
53 /* well known rooms */
124 #define DEADNATIVE 57
131 #define NUMOFOBJECTS 64
132 /* non-objects below */
155 #define EVERYTHING 1022
188 #define ARM 6 /* broken arm */
189 #define RIBS 7 /* broken ribs */
190 #define SPINE 9 /* broken back */
191 #define SKULL 11 /* fractured skull */
192 #define INCISE 10 /* deep incisions */
193 #define NECK 12 /* broken NECK */
194 #define NUMOFINJURIES 13
205 /* fundamental constants */
206 #define NUMOFROOMS 275
207 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
208 #define LINELENGTH 81
214 /* initial variable values */
223 #define north link[0]
224 #define south link[1]
228 #define access link[5]
230 #define flyhere link[7]
232 int objects[NUMOFWORDS];
234 struct room dayfile[];
235 struct room nightfile[];
236 struct room *location;
238 /* object characteristics */
239 char *objdes[NUMOFOBJECTS];
240 char *objsht[NUMOFOBJECTS];
241 char *ouch[NUMOFINJURIES];
242 int objwt[NUMOFOBJECTS];
243 int objcumber[NUMOFOBJECTS];
245 /* current input line */
246 #define NWORD 20 /* words per line */
247 char words[NWORD][15];
248 int wordvalue[NWORD];
250 int wordcount, wordnumber;
252 char *truedirec(), *rate();
253 char *getcom(), *getword();
255 /* state of the game */
259 int left, right, ahead, back;
260 int gclock, fuel, torps;
261 int carrying, encumber;
273 int matchlight, matchcount;
275 int pleasure, power, ego;
278 int notes[NUMOFNOTES];
279 int inven[NUMOFWORDS];
280 int wear[NUMOFWORDS];
281 char beenthere[NUMOFROOMS+1];
282 char injuries[NUMOFINJURIES];
284 char uname[MAXLOGNAME];
293 #define HASHMASK (HASHSIZE - 1)
294 struct wlist *hashtab[HASHSIZE];
295 struct wlist wlist[];
301 struct objs dayobjs[];
302 struct objs nightobjs[];