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