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