]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/extern.h
1 /* $NetBSD: extern.h,v 1.20 2000/09/17 23:03:43 jsm 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
48 #define BITS (8 * sizeof (int))
50 #define OUTSIDE (position > 68 && position < 246 && position != 218)
51 #define rnd(x) (rand() % (x))
52 #define max(a,b) ((a) < (b) ? (b) : (a))
53 #define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
54 #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
195 #define ARM 6 /* broken arm */
196 #define RIBS 7 /* broken ribs */
197 #define SPINE 9 /* broken back */
198 #define SKULL 11 /* fractured skull */
199 #define INCISE 10 /* deep incisions */
200 #define NECK 12 /* broken NECK */
201 #define NUMOFINJURIES 13
212 /* Number of times room description shown. */
215 /* fundamental constants */
216 #define NUMOFROOMS 275
217 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
218 #define LINELENGTH 81
224 /* initial variable values */
233 #define north link[0]
234 #define south link[1]
238 #define access link[5]
240 #define flyhere link[7]
242 unsigned int objects
[NUMOFWORDS
];
244 extern struct room dayfile
[];
245 extern struct room nightfile
[];
246 extern struct room
*location
;
248 /* object characteristics */
249 extern const char *const objdes
[NUMOFOBJECTS
];
250 extern const char *const objsht
[NUMOFOBJECTS
];
251 extern const char *const ouch
[NUMOFINJURIES
];
252 extern const int objwt
[NUMOFOBJECTS
];
253 extern const int objcumber
[NUMOFOBJECTS
];
255 /* current input line */
256 #define NWORD 20 /* words per line */
257 extern char words
[NWORD
][15];
258 extern int wordvalue
[NWORD
];
259 extern int wordtype
[NWORD
];
260 extern int wordcount
, wordnumber
;
262 /* state of the game */
265 extern int direction
;
266 extern int left
, right
, ahead
, back
;
267 extern int ourclock
, fuel
, torps
;
268 extern int carrying
, encumber
;
270 extern int followfight
;
274 extern int followgod
;
280 extern int matchlight
, matchcount
;
282 extern int pleasure
, power
, ego
;
285 extern int notes
[NUMOFNOTES
];
286 extern unsigned int inven
[NUMOFWORDS
];
287 extern unsigned int wear
[NUMOFWORDS
];
288 extern char beenthere
[NUMOFROOMS
+ 1];
289 extern char injuries
[NUMOFINJURIES
];
292 extern const char *username
;
301 #define HASHMASK (HASHSIZE - 1)
302 extern struct wlist
*hashtab
[HASHSIZE
];
303 extern struct wlist wlist
[];
309 extern const struct objs dayobjs
[];
310 extern const struct objs nightobjs
[];
312 #define DEFAULT_SAVE_FILE ".Bstar"
314 void blast
__P((void));
315 void bury
__P((void));
316 int card
__P((const char *, int));
317 void chime
__P((void));
318 void convert
__P((int));
319 void crash
__P((void));
320 int cypher
__P((void));
321 void die
__P((void)) __attribute__((__noreturn__
));
322 void diesig
__P((int)) __attribute__((__noreturn__
));
323 void dig
__P((void));
324 void dooropen
__P((void));
325 int draw
__P((void));
326 void drink
__P((void));
327 int drive
__P((void));
328 int drop
__P((const char *));
330 void endfly
__P((void));
331 int fight
__P((int, int));
332 int follow
__P((void));
333 char *getcom
__P((char *, int, const char *, const char *));
334 char *getword
__P((char *, char *, int));
335 int give
__P((void));
336 int hash
__P((const char *));
337 void initialize
__P((const char *));
338 void install
__P((struct wlist
*));
339 int jump
__P((void));
340 void kiss
__P((void));
341 int land
__P((void));
342 int launch
__P((void));
343 void light
__P((void));
344 void live
__P((void)) __attribute__((__noreturn__
));
345 struct wlist
*lookup
__P((const char *));
346 void love
__P((void));
347 void moveenemy
__P((int));
348 int moveplayer
__P((int, int));
349 void murder
__P((void));
350 void news
__P((void));
351 void newway
__P((int));
352 void notarget
__P((void));
353 void open_score_file
__P((void));
354 void parse
__P((void));
355 void post
__P((char));
356 void printobjs
__P((void));
358 int puton
__P((void));
359 const char *rate
__P((void));
360 void ravage
__P((void));
361 void restore
__P((const char *));
362 int ride
__P((void));
363 void save
__P((const char *));
364 char *save_file_name
__P((const char *, size_t));
365 void screen
__P((void));
366 int shoot
__P((void));
367 void succumb
__P((int));
368 int take
__P((unsigned int[]));
369 int takeoff
__P((void));
370 void target
__P((void));
371 int throw __P((const char *));
372 const char *truedirec
__P((int, char));
373 int ucard
__P((const unsigned int *));
375 int visual
__P((void));
376 int wearit
__P((void));
377 void whichway
__P((struct room
));
378 void wordinit
__P((void));
379 void writedes
__P((void));