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