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