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