globals.c 8.9 KB

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