globals.c revision 1.14 1 1.14 jsm /* $NetBSD: globals.c,v 1.14 2000/09/23 19:23:58 jsm Exp $ */
2 1.3 cgd
3 1.1 cgd /*
4 1.3 cgd * Copyright (c) 1983, 1993
5 1.3 cgd * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Redistribution and use in source and binary forms, with or without
8 1.1 cgd * modification, are permitted provided that the following conditions
9 1.1 cgd * are met:
10 1.1 cgd * 1. Redistributions of source code must retain the above copyright
11 1.1 cgd * notice, this list of conditions and the following disclaimer.
12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer in the
14 1.1 cgd * documentation and/or other materials provided with the distribution.
15 1.1 cgd * 3. All advertising materials mentioning features or use of this software
16 1.1 cgd * must display the following acknowledgement:
17 1.1 cgd * This product includes software developed by the University of
18 1.1 cgd * California, Berkeley and its contributors.
19 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
20 1.1 cgd * may be used to endorse or promote products derived from this software
21 1.1 cgd * without specific prior written permission.
22 1.1 cgd *
23 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 cgd * SUCH DAMAGE.
34 1.1 cgd */
35 1.1 cgd
36 1.5 lukem #include <sys/cdefs.h>
37 1.1 cgd #ifndef lint
38 1.3 cgd #if 0
39 1.4 tls static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
40 1.3 cgd #else
41 1.14 jsm __RCSID("$NetBSD: globals.c,v 1.14 2000/09/23 19:23:58 jsm Exp $");
42 1.3 cgd #endif
43 1.6 lukem #endif /* not lint */
44 1.1 cgd
45 1.4 tls #include "extern.h"
46 1.1 cgd
47 1.6 lukem int WEIGHT = MAXWEIGHT;
48 1.6 lukem int CUMBER = MAXCUMBER;
49 1.1 cgd
50 1.7 hubertf const char *const objdes[NUMOFOBJECTS] = {
51 1.10 jsm "There is a knife here.",
52 1.10 jsm "There are an exquisitely crafted sword and scabbard here.",
53 1.6 lukem 0, /* can land from here */
54 1.1 cgd "There is a fierce woodsman here brandishing a heavy mallet.",
55 1.8 hubertf "There is an unwieldy two-handed sword here.",
56 1.1 cgd "There is a bloody meat cleaver here.",
57 1.1 cgd "A rusty broadsword is lying here.",
58 1.1 cgd "There is an ancient coat of finely woven mail here.",
59 1.1 cgd "There is a old dented helmet with an ostrich plume here.",
60 1.1 cgd "There is a shield of some native tribe here.",
61 1.1 cgd "The maid's body is lying here. She was murdered!",
62 1.1 cgd "There is a Viper ready for launch here.",
63 1.1 cgd "A kerosene lantern is burning luridly here.",
64 1.1 cgd "An old pair of shoes has been discarded here.",
65 1.6 lukem 0, /* cylon */
66 1.1 cgd "There is a pair of pajamas here.",
67 1.1 cgd "A kingly robe of royal purple and spun gold is draped here.",
68 1.1 cgd "There is a strange golden amulet on the floor here.",
69 1.1 cgd "A medallion of solid gold shimmers on the ground nearby.",
70 1.1 cgd "A talisman of gold is lying here.",
71 1.1 cgd "A dead woodsman has fallen here. He was savagely murdered.",
72 1.1 cgd "A heavy wooden mallet lies nearby.",
73 1.1 cgd "There is a laser pistol here.",
74 1.6 lukem "A flower-like young goddess is bathing in the hot mineral pools. She is \nwatching you, but continues to steep and sing softly.",
75 1.1 cgd "The goddess is reclining on a bed of ferns and studying you intently.",
76 1.10 jsm "There is a grenade here.",
77 1.1 cgd "There is a length of heavy chain here.",
78 1.1 cgd "There is a stout rope here.",
79 1.1 cgd "There is a pair of Levi's here.",
80 1.1 cgd "A bloody mace is lying on the ground here.",
81 1.1 cgd "There is a shovel here.",
82 1.1 cgd "A long, sharp halberd is propped up here.",
83 1.10 jsm "There is a compass here.",
84 1.1 cgd "Wreckage and smoldering debris from a crash litter the ground here.",
85 1.1 cgd "A woodland Elf armed with a shield and deadly halberd lunges toward you!",
86 1.1 cgd "I think I hear footsteps behind us.",
87 1.1 cgd "There are a few coins here.",
88 1.1 cgd "There are some matches here.",
89 1.6 lukem "An unctuous man in a white suit and a dwarf are standing here.",
90 1.6 lukem "There are some ripe papayas here.",
91 1.6 lukem "There is a ripe pineapple here.",
92 1.6 lukem "There are some kiwi fruit here.",
93 1.6 lukem "There are some coconuts here.",
94 1.6 lukem "There is a ripe mango here.",
95 1.6 lukem "There is a sparkling diamond ring here.",
96 1.6 lukem "There is a colorful pink potion in a small crystal vial here.",
97 1.6 lukem "A gold bracelet is on the ground here.",
98 1.6 lukem "A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here. Meet me at midnight in the gardens.'",
99 1.8 hubertf "The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'",
100 1.6 lukem "Out from the shadows a figure leaps! His black cape swirls around, and he\nholds a laser sword at your chest. 'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'",
101 1.10 jsm "An old-timer with one eye missing and no money for a drink sits at the bar.",
102 1.6 lukem "You are flying through an asteroid field!",
103 1.6 lukem "A planet is nearby.",
104 1.6 lukem "The ground is charred here.",
105 1.6 lukem "There is a thermonuclear warhead here.",
106 1.6 lukem "The fragile, beautiful young goddess lies here. You murdered her horribly.",
107 1.10 jsm "The old-timer is lying here. He is dead.",
108 1.6 lukem "The native girl's body is lying here.",
109 1.6 lukem "A native girl is sitting here.",
110 1.6 lukem "A gorgeous white stallion is standing here.",
111 1.6 lukem "The keys are in the ignition.",
112 1.6 lukem "A pot of pearls and jewels is sitting here.",
113 1.6 lukem "A bar of solid gold is here.",
114 1.6 lukem "There is a 10 kilogram diamond block here."
115 1.1 cgd
116 1.1 cgd };
117 1.1 cgd
118 1.7 hubertf const char *const objsht[NUMOFOBJECTS] = {
119 1.1 cgd "knife",
120 1.1 cgd "fine sword",
121 1.1 cgd 0,
122 1.1 cgd "Woodsman",
123 1.1 cgd "two-handed sword",
124 1.1 cgd "meat cleaver",
125 1.1 cgd "broadsword",
126 1.1 cgd "coat of mail",
127 1.1 cgd "plumed helmet",
128 1.1 cgd "shield",
129 1.1 cgd "maid's body",
130 1.1 cgd "viper",
131 1.1 cgd "lantern",
132 1.1 cgd "shoes",
133 1.1 cgd 0,
134 1.1 cgd "pajamas",
135 1.1 cgd "robe",
136 1.1 cgd "amulet",
137 1.1 cgd "medallion",
138 1.1 cgd "talisman",
139 1.1 cgd "woodsman's body",
140 1.1 cgd "wooden mallet",
141 1.1 cgd "laser",
142 1.1 cgd 0,
143 1.1 cgd 0,
144 1.1 cgd "grenade",
145 1.1 cgd "chain",
146 1.1 cgd "rope",
147 1.1 cgd "levis",
148 1.1 cgd "mace",
149 1.1 cgd "shovel",
150 1.1 cgd "halberd",
151 1.1 cgd "compass",
152 1.1 cgd 0,
153 1.1 cgd "Elf",
154 1.1 cgd 0,
155 1.1 cgd "coins",
156 1.1 cgd "match book",
157 1.1 cgd 0,
158 1.1 cgd "papayas",
159 1.1 cgd "pineapple",
160 1.1 cgd "kiwi",
161 1.1 cgd "coconuts",
162 1.1 cgd "mango",
163 1.1 cgd "ring",
164 1.1 cgd "potion",
165 1.1 cgd "bracelet",
166 1.1 cgd 0,
167 1.1 cgd 0,
168 1.1 cgd "Dark Lord",
169 1.1 cgd 0,
170 1.1 cgd 0,
171 1.1 cgd 0,
172 1.1 cgd 0,
173 1.1 cgd "warhead",
174 1.1 cgd "goddess's body",
175 1.10 jsm "old-timer's body",
176 1.1 cgd "girl's body",
177 1.1 cgd 0,
178 1.1 cgd "stallion",
179 1.1 cgd "car",
180 1.1 cgd "pot of jewels",
181 1.1 cgd "bar of gold",
182 1.1 cgd "diamond block"
183 1.1 cgd };
184 1.1 cgd
185 1.7 hubertf const char *const ouch[NUMOFINJURIES] = {
186 1.1 cgd "some minor abrasions",
187 1.1 cgd "some minor lacerations",
188 1.1 cgd "a minor puncture wound",
189 1.1 cgd "a minor amputation",
190 1.1 cgd "a sprained wrist",
191 1.1 cgd "a fractured ankle and shattered kneecap",
192 1.1 cgd "a broken arm and dislocated shoulder",
193 1.1 cgd "a few broken ribs",
194 1.1 cgd "a broken leg and torn ligaments",
195 1.1 cgd "a broken back and ruptured spleen",
196 1.6 lukem "some deep incisions and a loss of blood",
197 1.1 cgd "a fractured skull and mashed face",
198 1.1 cgd "a broken neck"
199 1.1 cgd };
200 1.1 cgd
201 1.7 hubertf const int objwt[NUMOFOBJECTS] = {
202 1.6 lukem 1, 5, 0, 10, 15, 2, 10, 10,
203 1.6 lukem 3, 5, 50, 2500, 2, 1, 100, 1,
204 1.6 lukem 2, 1, 1, 1, 60, 10, 5, 0,
205 1.6 lukem 50, 5, 15, 5, 1, 20, 10, 10,
206 1.6 lukem 0, 0, 0, 0, 1, 0, 0, 1,
207 1.6 lukem 1, 1, 2, 1, 0, 0, 0, 0,
208 1.6 lukem 0, 0, 100, 0, 0, 0, 55, 47,
209 1.6 lukem 50, 45, 45, 100, 2000, 30, 20, 10
210 1.1 cgd };
211 1.1 cgd
212 1.7 hubertf const int objcumber[NUMOFOBJECTS] = {
213 1.6 lukem 1, 5, 0, 150, 10, 1, 5, 2,
214 1.6 lukem 2, 1, 5, 10, 1, 1, 10, 1,
215 1.6 lukem 1, 1, 1, 1, 7, 5, 4, 0,
216 1.6 lukem 0, 1, 1, 1, 1, 5, 4, 4,
217 1.6 lukem 1, 0, 0, 0, 1, 0, 0, 1,
218 1.6 lukem 1, 1, 3, 1, 0, 0, 1, 0,
219 1.6 lukem 0, 0, 10, 0, 0, 0, 7, 8,
220 1.6 lukem 10, 8, 8, 10, 10, 3, 1, 2
221 1.14 jsm };
222 1.14 jsm
223 1.14 jsm const int objflags[NUMOFOBJECTS] = {
224 1.14 jsm 0, 0, 0, 0, 0, 0, 0, 0,
225 1.14 jsm 0, 0, 0, 0, 0, OBJ_PLURAL, 0, OBJ_PLURAL,
226 1.14 jsm 0, 0, 0, 0, 0, 0, 0, 0,
227 1.14 jsm 0, 0, 0, 0, OBJ_PLURAL, 0, 0, 0,
228 1.14 jsm 0, 0, 0, 0, OBJ_PLURAL, 0, 0, OBJ_PLURAL,
229 1.14 jsm 0, 0, OBJ_PLURAL, 0, 0, 0, 0, 0,
230 1.14 jsm 0, 0, 0, 0, 0, 0, 0, 0,
231 1.14 jsm 0, 0, 0, 0, 0, 0, 0, 0
232 1.1 cgd };
233 1.1 cgd
234 1.6 lukem int win = 1;
235 1.6 lukem int matchcount = 20;
236 1.6 lukem int followgod = -1;
237 1.6 lukem int followfight = -1;
238 1.9 jsm
239 1.9 jsm struct room *location;
240 1.9 jsm
241 1.9 jsm /* current input line */
242 1.13 jsm char words[NWORD][WORDLEN];
243 1.9 jsm int wordvalue[NWORD];
244 1.9 jsm int wordtype[NWORD];
245 1.9 jsm int wordcount, wordnumber;
246 1.9 jsm
247 1.9 jsm /* state of the game */
248 1.9 jsm int ourtime;
249 1.9 jsm int position;
250 1.9 jsm int direction;
251 1.9 jsm int left, right, ahead, back;
252 1.9 jsm int fuel, torps;
253 1.9 jsm int carrying, encumber;
254 1.9 jsm int rythmn;
255 1.9 jsm int ate;
256 1.9 jsm int snooze;
257 1.9 jsm int meetgirl;
258 1.9 jsm int godready;
259 1.9 jsm int wintime;
260 1.9 jsm int wiz;
261 1.9 jsm int tempwiz;
262 1.9 jsm int matchlight;
263 1.9 jsm int loved;
264 1.9 jsm int pleasure, power, ego;
265 1.9 jsm int notes[NUMOFNOTES];
266 1.9 jsm unsigned int inven[NUMOFWORDS];
267 1.9 jsm unsigned int wear[NUMOFWORDS];
268 1.9 jsm char beenthere[NUMOFROOMS + 1];
269 1.9 jsm char injuries[NUMOFINJURIES];
270 1.12 jsm int verbose = 0;
271 1.9 jsm
272 1.11 jsm const char *username;
273 1.9 jsm
274 1.9 jsm struct wlist *hashtab[HASHSIZE];
275