Remove some more unused headers.
[dragonfly.git] / games / battlestar / externs.h
CommitLineData
6693db17 1/*-
984263bc
MD
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
6693db17 13 * 3. Neither the name of the University nor the names of its contributors
984263bc
MD
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)externs.h 8.1 (Berkeley) 5/31/93
30 *
31 * $FreeBSD: src/games/battlestar/externs.h,v 1.9.2.1 2001/03/05 11:45:36 kris Exp $
5c7cac79 32 * $DragonFly: src/games/battlestar/externs.h,v 1.4 2006/08/08 16:47:20 pavalos Exp $
984263bc
MD
33 */
34
35#include <errno.h>
36#include <sys/param.h>
37#include <sys/signal.h>
984263bc
MD
38#include <stdio.h>
39#include <stdlib.h>
5c7cac79 40#include <string.h>
984263bc
MD
41#include <unistd.h>
42
43#define BITS (8)
44
45#define OUTSIDE (position > 68 && position < 246 && position != 218)
46#define rnd(x) (random() % (x))
47#define max(a,b) ((a) < (b) ? (b) : (a))
48#define testbit(array, index) (array[index/BITS] & (1 << (index % BITS)))
49#ifndef setbit
50#define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS)))
51#endif
52#define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
53
54 /* well known rooms */
55#define FINAL 275
56#define GARDEN 197
57#define POOLS 126
58#define DOCK 93
59
60 /* word types */
61#define VERB 0
62#define OBJECT 1
63#define NOUNS 2
64#define PREPS 3
65#define ADJS 4
66#define CONJ 5
67
68 /* words numbers */
69#define KNIFE 0
70#define SWORD 1
71#define LAND 2
72#define WOODSMAN 3
73#define TWO_HANDED 4
74#define CLEAVER 5
75#define BROAD 6
76#define MAIL 7
77#define HELM 8
78#define SHIELD 9
79#define MAID 10
80#define BODY 10
81#define VIPER 11
82#define LAMPON 12
83#define SHOES 13
84#define CYLON 14
85#define PAJAMAS 15
86#define ROBE 16
87#define AMULET 17
88#define MEDALION 18
89#define TALISMAN 19
90#define DEADWOOD 20
91#define MALLET 21
92#define LASER 22
93#define BATHGOD 23
94#define NORMGOD 24
95#define GRENADE 25
96#define CHAIN 26
97#define ROPE 27
98#define LEVIS 28
99#define MACE 29
100#define SHOVEL 30
101#define HALBERD 31
102#define COMPASS 32
103#define CRASH 33
104#define ELF 34
105#define FOOT 35
106#define COINS 36
107#define MATCHES 37
108#define MAN 38
109#define PAPAYAS 39
110#define PINEAPPLE 40
111#define KIWI 41
112#define COCONUTS 42
113#define MANGO 43
114#define RING 44
115#define POTION 45
116#define BRACELET 46
117#define GIRL 47
118#define GIRLTALK 48
119#define DARK 49
120#define TIMER 50
121#define CHAR 53
122#define BOMB 54
123#define DEADGOD 55
124#define DEADTIME 56
125#define DEADNATIVE 57
126#define NATIVE 58
127#define HORSE 59
128#define CAR 60
129#define POT 61
130#define BAR 62
131#define BLOCK 63
132#define NUMOFOBJECTS 64
133 /* non-objects below */
134#define UP 1000
135#define DOWN 1001
136#define AHEAD 1002
137#define BACK 1003
138#define RIGHT 1004
139#define LEFT 1005
140#define TAKE 1006
141#define USE 1007
142#define LOOK 1008
143#define QUIT 1009
144#define NORTH 1010
145#define SOUTH 1011
146#define EAST 1012
147#define WEST 1013
148#define SU 1014
149#define DROP 1015
150#define TAKEOFF 1016
151#define DRAW 1017
152#define PUTON 1018
153#define WEARIT 1019
154#define PUT 1020
155#define INVEN 1021
156#define EVERYTHING 1022
157#define AND 1023
158#define KILL 1024
159#define RAVAGE 1025
160#define UNDRESS 1026
161#define THROW 1027
162#define LAUNCH 1028
163#define LANDIT 1029
164#define LIGHT 1030
165#define FOLLOW 1031
166#define KISS 1032
167#define LOVE 1033
168#define GIVE 1034
169#define SMITE 1035
170#define SHOOT 1036
171#define ON 1037
172#define OFF 1038
173#define TIME 1039
174#define SLEEP 1040
175#define DIG 1041
176#define EAT 1042
177#define SWIM 1043
178#define DRINK 1044
179#define DOOR 1045
180#define SAVE 1046
181#define RIDE 1047
182#define DRIVE 1048
183#define SCORE 1049
184#define BURY 1050
185#define JUMP 1051
186#define KICK 1052
187
188 /* injuries */
189#define ARM 6 /* broken arm */
190#define RIBS 7 /* broken ribs */
191#define SPINE 9 /* broken back */
192#define SKULL 11 /* fractured skull */
193#define INCISE 10 /* deep incisions */
194#define NECK 12 /* broken NECK */
195#define NUMOFINJURIES 13
196
197 /* notes */
198#define CANTLAUNCH 0
199#define LAUNCHED 1
200#define CANTSEE 2
201#define CANTMOVE 3
202#define JINXED 4
203#define DUG 5
204#define NUMOFNOTES 6
205
206 /* fundamental constants */
207#define NUMOFROOMS 275
208#define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
209#define LINELENGTH 81
210
211#define TODAY 0
212#define TONIGHT 1
213#define CYCLE 100
214
215 /* initial variable values */
216#define TANKFULL 250
217#define TORPEDOES 10
218#define MAXWEIGHT 60
219#define MAXCUMBER 10
220
221struct room {
222 const char *name;
223 int link[8];
224#define north link[0]
225#define south link[1]
226#define east link[2]
227#define west link[3]
228#define up link[4]
229#define access link[5]
230#define down link[6]
231#define flyhere link[7]
232 const char *desc;
233 unsigned int objects[NUMOFWORDS];
234};
235extern struct room dayfile[];
236extern struct room nightfile[];
237struct room *location;
238
239 /* object characteristics */
240extern const char *const objdes[NUMOFOBJECTS];
241extern const char *const objsht[NUMOFOBJECTS];
242extern const char *const ouch[NUMOFINJURIES];
243extern const int objwt[NUMOFOBJECTS];
244extern const int objcumber[NUMOFOBJECTS];
245
246 /* current input line */
247#define NWORD 20 /* words per line */
248char words[NWORD][15];
249int wordvalue[NWORD];
250int wordtype[NWORD];
251int wordcount, wordnumber;
252
984263bc 253 /* state of the game */
6693db17 254extern int gclock;
984263bc
MD
255int gtime;
256int position;
257int direction;
258int left, right, ahead, back;
259int fuel, torps;
260int carrying, encumber;
261int rythmn;
262extern int followfight;
263int ate;
264int snooze;
265int meetgirl;
266extern int followgod;
267int godready;
268extern int bs_win;
269int wintime;
270int wiz;
271int tempwiz;
272int matchlight;
273extern int matchcount;
274int loved;
275int pleasure, power, ego;
276extern int WEIGHT;
277extern int CUMBER;
278int notes[NUMOFNOTES];
279unsigned int inven[NUMOFWORDS];
280u_int wear[NUMOFWORDS];
281char beenthere[NUMOFROOMS+1];
282char injuries[NUMOFINJURIES];
283
284char uname[MAXLOGNAME];
285
286struct wlist {
287 const char *string;
288 int value, article;
289 struct wlist *next;
290};
291#define HASHSIZE 256
292#define HASHMUL 81
293#define HASHMASK (HASHSIZE - 1)
294struct wlist *hashtab[HASHSIZE];
295extern struct wlist wlist[];
296
297struct objs {
298 short room;
299 short obj;
300};
301extern const struct objs dayobjs[];
302extern const struct objs nightobjs[];
303
304extern gid_t egid;
6693db17
SW
305
306
307int battlestar_move(int, int);
308void bury(void);
309int card(const char *, int);
310void chime(void);
311void crash(void);
312int cypher(void);
313void die(int);
314void dig(void);
315int draw(void);
316void drink(void);
317int drive(void);
318int drop(const char *);
319int eat(void);
320int fight(int, int);
321int follow(void);
322char *getcom(char *, int, const char *, const char *);
323char *getword(char *, char *, int);
324int give(void);
325void initialize(int);
326int jump(void);
327void kiss(void);
328int land(void);
329int launch(void);
330void light(void);
331void live(void);
332void love(void);
333void murder(void);
334void news(void);
335void newway(int);
336void open_score_file(void);
337void parse(void);
338void printobjs(void);
339int put(void);
340int puton(void);
341const char *rate(void);
342void ravage(void);
343void restore(void);
344int ride(void);
345void save(void);
346int shoot(void);
347int take(unsigned int[]);
348int takeoff(void);
349int throw(const char *);
350const char *truedirec(int, unsigned int);
351int ucard(const unsigned int *);
352int use(void);
353int visual(void);
354int wearit(void);
355void whichway(struct room);
356void wordinit(void);
357void writedes(void);
358int zzz(void);