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