1 | /* header ADVENT.H *
|
---|
2 | * WARNING: HEADER file for all adventure modules */
|
---|
3 |
|
---|
4 | #ifndef EXIT_FAILURE
|
---|
5 | #define EXIT_FAILURE 1
|
---|
6 | #define EXIT_SUCCESS (!(EXIT_FAILURE))
|
---|
7 | #endif
|
---|
8 |
|
---|
9 | #define INPUTBUFLEN 80 /* Max input line length */
|
---|
10 |
|
---|
11 | typedef int boolean;
|
---|
12 | #define FALSE (0)
|
---|
13 | #define TRUE (!FALSE)
|
---|
14 |
|
---|
15 | #define MAXOBJ 123 /* max # of objects in cave */
|
---|
16 | #define MAXLOC 248 /* max # of cave locations */
|
---|
17 | #define WORDSIZE 20 /* max # of chars in commands */
|
---|
18 | #define MAXMSG 408 /* max # of long location descr */
|
---|
19 | #define HNTMAX 18 /* max # of hints */
|
---|
20 | #define HNTMIN 7 /* hints starting count */
|
---|
21 |
|
---|
22 | #define MAXWORDS 25
|
---|
23 | #define MAXITEMS 45
|
---|
24 |
|
---|
25 | #define CLASS(word) ((word)<0 ? -((-(word)) / 1000) : (word) / 1000)
|
---|
26 | #define VAL(word) ((word)<0 ? -((-(word)) % 1000) : (word) % 1000)
|
---|
27 | #define MAXTRAV (23+1) /* max # of travel directions from loc */
|
---|
28 | /* +1 for terminator travel[x].tdest=-1 */
|
---|
29 | #define DWARFMAX 6 /* max # of nasty dwarves */
|
---|
30 | #define MAXDIE 3 /* max # of deaths before close */
|
---|
31 | #define MAXTRS 79 /* max # of */
|
---|
32 |
|
---|
33 | #define Y2 33
|
---|
34 | /*
|
---|
35 | Object definitions
|
---|
36 | */
|
---|
37 | #define ANVIL 91
|
---|
38 | #define AXE 28
|
---|
39 | #define BATTERIES 39
|
---|
40 | #define BEAR 35
|
---|
41 | #define BEES 87
|
---|
42 | #define BILLBD 116
|
---|
43 | #define BIRD 101
|
---|
44 | #define BOAT 48
|
---|
45 | #define BOOK 110
|
---|
46 | #define BOOK2 BOOK + 1
|
---|
47 | #define BOOTH 93
|
---|
48 | #define BOTTLE 20
|
---|
49 | #define BRUSH 114
|
---|
50 | #define CAGE 4
|
---|
51 | #define CAKES 107
|
---|
52 | #define CARVNG 115
|
---|
53 | #define CASK 71
|
---|
54 | #define CHAIN 64
|
---|
55 | #define CHASM 21
|
---|
56 | #define CHASM2 CHASM + 1
|
---|
57 | #define CHEST 55
|
---|
58 | #define CLAM 14
|
---|
59 | #define CLOAK 47
|
---|
60 | #define COINS 54
|
---|
61 | #define CROWN 66
|
---|
62 | #define DOG 98
|
---|
63 | #define DOOR 41 /* giant door */
|
---|
64 | #define DRAGON 31
|
---|
65 | #define DWARF 17
|
---|
66 | #define EGGS 56
|
---|
67 | #define EMERALD 59
|
---|
68 | #define FISSURE 12
|
---|
69 | #define FLOWER 46
|
---|
70 | #define FLY 69
|
---|
71 | #define FOOD 19
|
---|
72 | #define GNOME 105
|
---|
73 | #define GRAIL 70
|
---|
74 | #define GRATE 3
|
---|
75 | #define HIVE 97
|
---|
76 | #define HONEY 96
|
---|
77 | #define HORN 52
|
---|
78 | #define JEWELS 53
|
---|
79 | #define KEYS 102
|
---|
80 | #define KNIFE 18
|
---|
81 | #define LAMP 2
|
---|
82 | #define LYRE 68
|
---|
83 | #define MAGAZINE 16
|
---|
84 | #define MESSAGE 36
|
---|
85 | #define MIRROR 23
|
---|
86 | #define MUSHRM 106
|
---|
87 | #define NUGGET 50
|
---|
88 | #define OIL 83
|
---|
89 | #define OIL2 OIL + 1
|
---|
90 | #define OYSTER 15
|
---|
91 | #define PLAGUE 125
|
---|
92 | #define PEARL 61
|
---|
93 | #define PHONE 94
|
---|
94 | #define PILLOW 10
|
---|
95 | #define PLANT 24
|
---|
96 | #define PLANT2 PLANT + 1
|
---|
97 | #define POLE 9
|
---|
98 | #define POSTER 113
|
---|
99 | #define PYRAMID 60
|
---|
100 | #define RADIUM 119
|
---|
101 | #define RING 72
|
---|
102 | #define ROCKS 92
|
---|
103 | #define ROD 5
|
---|
104 | #define ROD2 ROD + 1
|
---|
105 | #define RUG 62
|
---|
106 | #define SAFE 112
|
---|
107 | #define SAPPHIRE 69
|
---|
108 | #define SHIELD 118
|
---|
109 | #define SHOES 67
|
---|
110 | #define SKEY 90
|
---|
111 | #define SLUGS 95
|
---|
112 | #define SNAKE 11
|
---|
113 | #define SPHERE 120
|
---|
114 | #define SPICES 63
|
---|
115 | #define SPIDER 121
|
---|
116 | #define STEPS 7
|
---|
117 | #define STICKS 49
|
---|
118 | #define SWORD 65
|
---|
119 | #define TABLET 13
|
---|
120 | #define TDOOR 42 /* tiny door */
|
---|
121 | #define TDOOR2 TDOOR + 1 /* wrought-iron door */
|
---|
122 | #define PDOOR TDOOR2 + 1 /* door to phone booth */
|
---|
123 | #define TRIDENT 57
|
---|
124 | #define TROLL 33
|
---|
125 | #define TROLL2 TROLL + 1
|
---|
126 | #define VASE 58
|
---|
127 | #define VEND 38
|
---|
128 | #define WALL 88
|
---|
129 | #define WALL2 WALL + 1
|
---|
130 | #define WATER 81 /* in bottle */
|
---|
131 | #define WATER2 WATER + 1 /* in cask */
|
---|
132 | #define WINE 85 /* in bottle */
|
---|
133 | #define WINE2 WINE + 1 /* in cask */
|
---|
134 | #define WUMPUS 99
|
---|
135 |
|
---|
136 | /*
|
---|
137 | Verb definitions
|
---|
138 | */
|
---|
139 | #define BACK 8
|
---|
140 | #define CAVE 67
|
---|
141 | #define DEPRESSION 63
|
---|
142 | #define ENTRANCE 64
|
---|
143 | #define EXIT 11
|
---|
144 | #define NULLX 21
|
---|
145 |
|
---|
146 | /*
|
---|
147 | Action verb definitions
|
---|
148 | */
|
---|
149 | #define TAKE 1
|
---|
150 | #define DROP 2
|
---|
151 | #define SAY 3
|
---|
152 | #define OPEN 4
|
---|
153 | #define NOTHING 5
|
---|
154 | #define CLOSE 6
|
---|
155 | #define ON 7
|
---|
156 | #define OFF 8
|
---|
157 | #define WAVE 9
|
---|
158 | #define CALM 10
|
---|
159 | #define WALK 11
|
---|
160 | #define KILL 12
|
---|
161 | #define POUR 13
|
---|
162 | #define EAT 14
|
---|
163 | #define DRINK 15
|
---|
164 | #define RUB 16
|
---|
165 | #define THROW 17
|
---|
166 | #define QUIT 18
|
---|
167 | #define FIND 19
|
---|
168 | #define INVENTORY 20
|
---|
169 | #define FEED 21
|
---|
170 | #define FILL 22
|
---|
171 | #define BLAST 23
|
---|
172 | #define SCORE 24
|
---|
173 | #define FOO 25
|
---|
174 | #define BRIEF 26
|
---|
175 | #define READ 27
|
---|
176 | #define BREAK 28
|
---|
177 | #define WAKE 29
|
---|
178 | #define SUSPEND 30
|
---|
179 | #define RESTORE 31
|
---|
180 | #define YANK 32
|
---|
181 | #define WEAR 33
|
---|
182 | #define HIT 34
|
---|
183 | #define ANSWER 35
|
---|
184 | #define BLOW 36
|
---|
185 | #define LEAVE 37
|
---|
186 | #define YELL 38
|
---|
187 | #define DIAL 39
|
---|
188 | #define PLAY 40
|
---|
189 | #define PICK 41
|
---|
190 | #define PUT 42
|
---|
191 | #define TURN 43
|
---|
192 | #define GET 44
|
---|
193 | #define INSRT 45
|
---|
194 | #define REMOVE 46
|
---|
195 | #define BURN 47
|
---|
196 | #define GRIPE 48
|
---|
197 | #define LOCK 49
|
---|
198 | #define UNLOCK 50
|
---|
199 | #define HEALTH 51
|
---|
200 | #define LOOK 52
|
---|
201 | #define COMBO 53
|
---|
202 | #define SWEEP 54
|
---|
203 | #define TERSE 55
|
---|
204 | #define WIZ 56
|
---|
205 | #define MAP 57
|
---|
206 | #define GATE 58
|
---|
207 | #define PIRLOC 59
|
---|
208 |
|
---|
209 | #define GO 11
|
---|
210 | #define SHUT 6
|
---|
211 | #define LOG 33
|
---|
212 |
|
---|
213 | #define MOTION 0 /* CLASSD */
|
---|
214 | #define NOUN 1 /* CLASSN */
|
---|
215 | #define ACTION 2 /* CLASSA */
|
---|
216 | #define MISC 3 /* CLASSM */
|
---|
217 | #define PREPOSITION 4 /* CLASSP */
|
---|
218 | #define ADJACTIVE 5 /* CLASSJ */
|
---|
219 | #define CONJUNCTION 6 /* CLASSC */
|
---|
220 |
|
---|
221 | /*
|
---|
222 | and a few preposition. prefix PREP to distinguish them from
|
---|
223 | verbs or nouns
|
---|
224 | */
|
---|
225 | #define PREPAT 9
|
---|
226 | #define PREPDN 8
|
---|
227 | #define PREPIN 1
|
---|
228 | #define PREPFR 5
|
---|
229 | #define PREPOF 6
|
---|
230 | #define PREPOFF 6
|
---|
231 | #define PREPON 2
|
---|
232 |
|
---|
233 | /*
|
---|
234 | BIT mapping of "cond" array which indicates location status
|
---|
235 | */
|
---|
236 | #define LIGHT 1
|
---|
237 | #define WATOIL 2
|
---|
238 | #define LIQUID 4
|
---|
239 | #define NOPIRAT 16
|
---|
240 |
|
---|
241 | /* Object condition bit functions */
|
---|
242 | #define OPENBT 2
|
---|
243 | #define LOCKBT 4
|
---|
244 | #define BURNBT 6
|
---|
245 | #define DEADBT 10
|
---|
246 | #define WEARBT 12
|
---|
247 | /*
|
---|
248 | Structure definitions
|
---|
249 | */
|
---|
250 | struct wac {
|
---|
251 | char *aword;
|
---|
252 | int acode;
|
---|
253 | };
|
---|
254 |
|
---|
255 | struct trav {
|
---|
256 | int tdest;
|
---|
257 | int tverb;
|
---|
258 | int tcond;
|
---|
259 | };
|
---|
260 |
|
---|
261 | /* Function prototypes.
|
---|
262 | "#if (__STDC__)" should have been be enough,
|
---|
263 | but some compilers are stupid, so allow Makefile to say -DHAS_STDC=whatever.
|
---|
264 | */
|
---|
265 | #if defined(HAS_STDC) ? (HAS_STDC) : (__STDC__)
|
---|
266 | #undef HAS_STDC
|
---|
267 | #define HAS_STDC 1
|
---|
268 | #define _PROTOTYPE(function, params) function params
|
---|
269 | #define _CONST const
|
---|
270 | #else
|
---|
271 | #define _PROTOTYPE(function, params) function ()
|
---|
272 | #define _CONST
|
---|
273 | #endif
|
---|
274 |
|
---|
275 | /* Advent.c */
|
---|
276 |
|
---|
277 | _PROTOTYPE(void saveadv, (char *username));
|
---|
278 | _PROTOTYPE(void restore, (char *username));
|
---|
279 |
|
---|
280 | /* Initialize.c */
|
---|
281 |
|
---|
282 | _PROTOTYPE(void initialize, (void));
|
---|
283 |
|
---|
284 | /* Database.c */
|
---|
285 |
|
---|
286 | _PROTOTYPE(int yes, (int msg1, int msg2, int msg3));
|
---|
287 | _PROTOTYPE(void rspeak, (int msg));
|
---|
288 | _PROTOTYPE(void pspeak, (int item, int state));
|
---|
289 | _PROTOTYPE(void desclg, (int loc));
|
---|
290 | _PROTOTYPE(void descsh, (int loc));
|
---|
291 |
|
---|
292 | /* English.c */
|
---|
293 |
|
---|
294 | _PROTOTYPE(int english, (void));
|
---|
295 | _PROTOTYPE(int analyze, (char *word, int *type, int *value));
|
---|
296 |
|
---|
297 | /* Itverb.c */
|
---|
298 |
|
---|
299 | _PROTOTYPE(void itverb, (void));
|
---|
300 | _PROTOTYPE(void ivblast, (void));
|
---|
301 | _PROTOTYPE(void ivlook, (void));
|
---|
302 |
|
---|
303 | /* Turn.c */
|
---|
304 |
|
---|
305 | _PROTOTYPE(void turn, (void));
|
---|
306 | _PROTOTYPE(void describe, (void));
|
---|
307 | _PROTOTYPE(void descitem, (void));
|
---|
308 | _PROTOTYPE(void dwarfend, (void));
|
---|
309 | _PROTOTYPE(void normend, (void));
|
---|
310 | _PROTOTYPE(void score, (int));
|
---|
311 | _PROTOTYPE(void death, (void));
|
---|
312 | _PROTOTYPE(char *probj, (void));
|
---|
313 | _PROTOTYPE(void trobj, (void));
|
---|
314 | _PROTOTYPE(void dwarves, (void));
|
---|
315 | _PROTOTYPE(void dopirate, (void));
|
---|
316 | _PROTOTYPE(int stimer, (void));
|
---|
317 |
|
---|
318 | /* Verb.c */
|
---|
319 |
|
---|
320 | _PROTOTYPE(void trverb, (void));
|
---|
321 | _PROTOTYPE(void vtake, (void));
|
---|
322 | _PROTOTYPE(void vdrop, (void));
|
---|
323 | _PROTOTYPE(void vopen, (void));
|
---|
324 | _PROTOTYPE(void vsay, (void));
|
---|
325 | _PROTOTYPE(void von, (void));
|
---|
326 | _PROTOTYPE(void voff, (void));
|
---|
327 | _PROTOTYPE(void vwave, (void));
|
---|
328 | _PROTOTYPE(void vkill, (void));
|
---|
329 | _PROTOTYPE(void vpour, (void));
|
---|
330 | _PROTOTYPE(void veat, (void));
|
---|
331 | _PROTOTYPE(void vdrink, (void));
|
---|
332 | _PROTOTYPE(void vthrow, (void));
|
---|
333 | _PROTOTYPE(void vfind, (void));
|
---|
334 | _PROTOTYPE(void vfill, (void));
|
---|
335 | _PROTOTYPE(void vfeed, (void));
|
---|
336 | _PROTOTYPE(void vread, (void));
|
---|
337 | _PROTOTYPE(void vbreak, (void));
|
---|
338 | _PROTOTYPE(void vwake, (void));
|
---|
339 | _PROTOTYPE(void actspk, (int verb));
|
---|
340 | _PROTOTYPE(void vyank, (void));
|
---|
341 | _PROTOTYPE(void vwear, (void));
|
---|
342 | _PROTOTYPE(void vlock, (void));
|
---|
343 | _PROTOTYPE(void vunlock, (void));
|
---|
344 | _PROTOTYPE(void vclose, (void));
|
---|
345 |
|
---|
346 | /* Utility.c */
|
---|
347 |
|
---|
348 | _PROTOTYPE(boolean ajar, (int));
|
---|
349 | _PROTOTYPE(boolean at, (int item));
|
---|
350 | _PROTOTYPE(boolean athand, (int));
|
---|
351 | _PROTOTYPE(void bitoff, (int, int));
|
---|
352 | _PROTOTYPE(void biton, (int, int));
|
---|
353 | _PROTOTYPE(boolean bitset, (long, int));
|
---|
354 | _PROTOTYPE(boolean blind, (void));
|
---|
355 | _PROTOTYPE(int burden, (int));
|
---|
356 | _PROTOTYPE(void carry, (int obj, int where));
|
---|
357 | _PROTOTYPE(int confuz, (void));
|
---|
358 | _PROTOTYPE(boolean dark, (void));
|
---|
359 | _PROTOTYPE(boolean dcheck, (void));
|
---|
360 | _PROTOTYPE(boolean dead, (int));
|
---|
361 | _PROTOTYPE(void drop, (int obj, int where));
|
---|
362 | _PROTOTYPE(void destroy, (int obj));
|
---|
363 | _PROTOTYPE(boolean edible, (int));
|
---|
364 | _PROTOTYPE(boolean enclosed, (int));
|
---|
365 | _PROTOTYPE(void extract, (int));
|
---|
366 | _PROTOTYPE(boolean forced, (int atloc));
|
---|
367 | _PROTOTYPE(boolean here, (int item));
|
---|
368 | _PROTOTYPE(boolean hinged, (int));
|
---|
369 | _PROTOTYPE(boolean holding, (int));
|
---|
370 | _PROTOTYPE(void insert, (int, int));
|
---|
371 | _PROTOTYPE(boolean inside, (int));
|
---|
372 | _PROTOTYPE(void juggle, (int loc));
|
---|
373 | _PROTOTYPE(int liq, (int));
|
---|
374 | _PROTOTYPE(int liqloc, (int loc));
|
---|
375 | _PROTOTYPE(int liq2, (int pbottle));
|
---|
376 | _PROTOTYPE(boolean living, (int));
|
---|
377 | _PROTOTYPE(boolean locked, (int));
|
---|
378 | _PROTOTYPE(boolean locks, (int));
|
---|
379 | _PROTOTYPE(void lookin, (int));
|
---|
380 | _PROTOTYPE(void move, (int obj, int where));
|
---|
381 | _PROTOTYPE(int noway, (void));
|
---|
382 | _PROTOTYPE(boolean opaque, (int));
|
---|
383 | _PROTOTYPE(boolean outside, (int));
|
---|
384 | _PROTOTYPE(boolean pct, (int x));
|
---|
385 | _PROTOTYPE(boolean plural, (int));
|
---|
386 | _PROTOTYPE(boolean portal, (int));
|
---|
387 | _PROTOTYPE(boolean printed, (int));
|
---|
388 | _PROTOTYPE(int put, (int obj, int where, int pval));
|
---|
389 | _PROTOTYPE(int ranz, (int));
|
---|
390 | _PROTOTYPE(boolean small, (int));
|
---|
391 | _PROTOTYPE(boolean toting, (int item));
|
---|
392 | _PROTOTYPE(boolean treasr, (int));
|
---|
393 | _PROTOTYPE(boolean vessel, (int));
|
---|
394 | _PROTOTYPE(boolean wearng, (int));
|
---|
395 | _PROTOTYPE(boolean worn, (int));
|
---|
396 | _PROTOTYPE(void bug, (unsigned int n));
|
---|
397 | _PROTOTYPE(char *ask, (char *prompt, char *buf, int buflen));
|
---|
398 | _PROTOTYPE(void panic, (char *msg, boolean save));
|
---|
399 |
|
---|
400 | /* travel.c */
|
---|
401 | _PROTOTYPE(void domove, (void));
|
---|
402 | _PROTOTYPE(void gettrav, (int loc, struct trav *travel));
|
---|
403 |
|
---|
404 | /* vocab.c */
|
---|
405 | _PROTOTYPE(int vocab, (char *word, int val));
|
---|