]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/extern.h
1 /* $NetBSD: extern.h,v 1.5 1997/10/10 11:39:47 lukem 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
35 * @(#)externs.h 8.1 (Berkeley) 5/31/93
46 #define BITS (8 * sizeof (int))
48 #define OUTSIDE (position > 68 && position < 246 && position != 218)
49 #define rnd(x) (rand() % (x))
50 #define max(a,b) ((a) < (b) ? (b) : (a))
51 #define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
52 #define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
53 #define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
55 /* well known rooms */
126 #define DEADNATIVE 57
133 #define NUMOFOBJECTS 64
134 /* non-objects below */
157 #define EVERYTHING 1022
190 #define ARM 6 /* broken arm */
191 #define RIBS 7 /* broken ribs */
192 #define SPINE 9 /* broken back */
193 #define SKULL 11 /* fractured skull */
194 #define INCISE 10 /* deep incisions */
195 #define NECK 12 /* broken NECK */
196 #define NUMOFINJURIES 13
207 /* fundamental constants */
208 #define NUMOFROOMS 275
209 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
210 #define LINELENGTH 81
216 /* initial variable values */
225 #define north link[0]
226 #define south link[1]
230 #define access link[5]
232 #define flyhere link[7]
234 unsigned int objects
[NUMOFWORDS
];
236 struct room dayfile
[];
237 struct room nightfile
[];
238 struct room
*location
;
240 /* object characteristics */
241 char *objdes
[NUMOFOBJECTS
];
242 char *objsht
[NUMOFOBJECTS
];
243 char *ouch
[NUMOFINJURIES
];
244 int objwt
[NUMOFOBJECTS
];
245 int objcumber
[NUMOFOBJECTS
];
247 /* current input line */
248 #define NWORD 20 /* words per line */
249 char words
[NWORD
][15];
250 int wordvalue
[NWORD
];
252 int wordcount
, wordnumber
;
254 /* state of the game */
258 int left
, right
, ahead
, back
;
259 int ourclock
, fuel
, torps
;
260 int carrying
, encumber
;
272 int matchlight
, matchcount
;
274 int pleasure
, power
, ego
;
277 int notes
[NUMOFNOTES
];
278 unsigned int inven
[NUMOFWORDS
];
279 unsigned int wear
[NUMOFWORDS
];
280 char beenthere
[NUMOFROOMS
+1];
281 char injuries
[NUMOFINJURIES
];
292 #define HASHMASK (HASHSIZE - 1)
293 struct wlist
*hashtab
[HASHSIZE
];
294 struct wlist wlist
[];
300 struct objs dayobjs
[];
301 struct objs nightobjs
[];
303 void blast
__P((void));
304 void bury
__P((void));
305 int card
__P((char *, int));
306 int checkout
__P((char *));
307 void chime
__P((void));
308 void convert
__P((int));
309 void crash
__P((void));
310 int cypher
__P((void));
311 void die
__P((void));
312 void diesig
__P((int));
313 void dig
__P((void));
314 int draw
__P((void));
315 void drink
__P((void));
316 int drive
__P((void));
317 int drop
__P((char *));
319 void endfly
__P((void));
320 int fight
__P((int, int));
321 int follow
__P((void));
322 void getutmp
__P((char *));
323 int give
__P((void));
324 int hash
__P((char *));
325 void initialize
__P((char));
326 void install
__P((struct wlist
*));
327 int jump
__P((void));
328 void kiss
__P((void));
329 int land
__P((void));
330 int launch
__P((void));
331 void light
__P((void));
332 void live
__P((void));
333 void love
__P((void));
334 int move
__P((int, int));
335 void moveenemy
__P((int));
336 void murder
__P((void));
337 void news
__P((void));
338 void newway
__P((int));
339 void notarget
__P((void));
340 void parse
__P((void));
341 void post
__P((char));
342 void printobjs
__P((void));
344 int puton
__P((void));
345 void ravage
__P((void));
346 void restore
__P((void));
347 int ride
__P((void));
348 void save
__P((void));
349 void screen
__P((void));
350 int shoot
__P((void));
351 void succumb
__P((int));
352 int take
__P((unsigned int []));
353 int takeoff
__P((void));
354 void target
__P((void));
355 int throw __P((char *));
356 int ucard
__P((unsigned int *));
358 int visual
__P((void));
359 int wearit
__P((void));
360 void whichway
__P((struct room
));
361 int wizard
__P((char *));
362 void wordinit
__P((void));
363 void writedes
__P((void));
365 char *getcom
__P((char *, int, char *, char *));
366 char *getword
__P((char *, char *, int));
367 char *rate
__P((void));
368 char *truedirec
__P((int, char));
369 struct wlist
*lookup
__P((char *));