]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/extern.h
1 /* $NetBSD: extern.h,v 1.28 2000/09/25 19:37:59 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
196 #define ARM 6 /* broken arm */
197 #define RIBS 7 /* broken ribs */
198 #define SPINE 9 /* broken back */
199 #define SKULL 11 /* fractured skull */
200 #define INCISE 10 /* deep incisions */
201 #define NECK 12 /* broken NECK */
202 #define NUMOFINJURIES 13
213 /* Number of times room description shown. */
216 /* fundamental constants */
217 #define NUMOFROOMS 275
218 #define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
219 #define LINELENGTH 81
225 /* initial variable values */
232 * These are flags for objects in the objflags array. OBJ_PLURAL means
233 * that the object short name is plural; OBJ_AN that it begins with a
234 * vowel sound so should be preceded by "an" instead of "a"; OBJ_PERSON
235 * that it is a living person; OBJ_NONOBJ that it is not an object (to
236 * which any game action can be applied) at all (e.g. footsteps, asteroids).
237 * Any individual object has at most one of OBJ_PERSON and OBJ_NONOBJ.
247 #define north link[0]
248 #define south link[1]
252 #define access link[5]
254 #define flyhere link[7]
256 unsigned int objects
[NUMOFWORDS
];
258 extern struct room dayfile
[];
259 extern struct room nightfile
[];
260 extern struct room
*location
;
262 /* object characteristics */
263 extern const char *const objdes
[NUMOFOBJECTS
];
264 extern const char *const objsht
[NUMOFOBJECTS
];
265 extern const char *const ouch
[NUMOFINJURIES
];
266 extern const int objwt
[NUMOFOBJECTS
];
267 extern const int objcumber
[NUMOFOBJECTS
];
268 extern const int objflags
[NUMOFOBJECTS
];
269 #define is_plural_object(n) (objflags[(n)] & OBJ_PLURAL)
271 * These macros yield words to use with objects (followed but not preceded
272 * by spaces, or with no spaces if the expansion is the empty string).
274 #define A_OR_AN(n) (objflags[(n)] & OBJ_AN ? "an " : "a ")
275 #define A_OR_AN_OR_THE(n) (is_plural_object((n)) ? "the " : A_OR_AN((n)))
276 #define A_OR_AN_OR_BLANK(n) (is_plural_object((n)) ? "" : A_OR_AN((n)))
277 #define IS_OR_ARE(n) (is_plural_object((n)) ? "are " : "is ")
279 /* current input line */
281 #define NWORD 20 /* words per line */
282 extern char words
[NWORD
][WORDLEN
];
283 extern int wordvalue
[NWORD
];
284 extern int wordtype
[NWORD
];
285 extern int wordcount
, wordnumber
;
287 /* state of the game */
290 extern int direction
;
291 extern int left
, right
, ahead
, back
;
292 extern int ourclock
, fuel
, torps
;
293 extern int carrying
, encumber
;
295 extern int followfight
;
299 extern int followgod
;
305 extern int matchlight
, matchcount
;
307 extern int pleasure
, power
, ego
;
310 extern int notes
[NUMOFNOTES
];
311 extern unsigned int inven
[NUMOFWORDS
];
312 extern unsigned int wear
[NUMOFWORDS
];
313 extern char beenthere
[NUMOFROOMS
+ 1];
314 extern char injuries
[NUMOFINJURIES
];
317 extern const char *username
;
324 extern struct wlist wlist
[];
330 extern const struct objs dayobjs
[];
331 extern const struct objs nightobjs
[];
333 #define DEFAULT_SAVE_FILE ".Bstar"
335 void bury
__P((void));
336 int card
__P((const char *, int));
337 void chime
__P((void));
338 void convert
__P((int));
339 void crash
__P((void));
340 int cypher
__P((void));
341 void die
__P((void)) __attribute__((__noreturn__
));
342 void diesig
__P((int)) __attribute__((__noreturn__
));
343 void dig
__P((void));
344 void dooropen
__P((void));
345 int draw
__P((void));
346 void drink
__P((void));
347 int drive
__P((void));
348 int drop
__P((const char *));
350 int fight
__P((int, int));
351 int follow
__P((void));
352 char *getcom
__P((char *, int, const char *, const char *));
353 char *getword
__P((char *, char *, int));
354 int give
__P((void));
355 void initialize
__P((const char *));
356 int jump
__P((void));
357 void kiss
__P((void));
358 int land
__P((void));
359 int launch
__P((void));
360 void light
__P((void));
361 void live
__P((void)) __attribute__((__noreturn__
));
362 void love
__P((void));
363 int moveplayer
__P((int, int));
364 void murder
__P((void));
365 void news
__P((void));
366 void newway
__P((int));
367 void open_score_file
__P((void));
368 void parse
__P((void));
369 void post
__P((char));
370 void printobjs
__P((void));
372 int puton
__P((void));
373 const char *rate
__P((void));
374 void ravage
__P((void));
375 void restore
__P((const char *));
376 int ride
__P((void));
377 void save
__P((const char *));
378 char *save_file_name
__P((const char *, size_t));
379 int shoot
__P((void));
380 int take
__P((unsigned int[]));
381 int takeoff
__P((void));
382 int throw __P((const char *));
383 const char *truedirec
__P((int, char));
384 int ucard
__P((const unsigned int *));
386 int visual
__P((void));
387 int wearit
__P((void));
388 void whichway
__P((struct room
));
389 void wordinit
__P((void));
390 void writedes
__P((void));