hdr.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* $NetBSD: hdr.h,v 1.10 2003/08/07 09:36:50 agc Exp $ */
  2. /*-
  3. * Copyright (c) 1991, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * The game adventure was originally written in Fortran by Will Crowther
  7. * and Don Woods. It was later translated to C and enhanced by Jim
  8. * Gillogly. This code is derived from software contributed to Berkeley
  9. * by Jim Gillogly at The Rand Corporation.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. * 3. 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. * @(#)hdr.h 8.1 (Berkeley) 5/31/93
  36. */
  37. /* ADVENTURE -- Jim Gillogly, Jul 1977
  38. * This program is a re-write of ADVENT, written in FORTRAN mostly by
  39. * Don Woods of SAIL. In most places it is as nearly identical to the
  40. * original as possible given the language and word-size differences.
  41. * A few places, such as the message arrays and travel arrays were changed
  42. * to reflect the smaller core size and word size. The labels of the
  43. * original are reflected in this version, so that the comments of the
  44. * fortran are still applicable here.
  45. *
  46. * The data file distributed with the fortran source is assumed to be called
  47. * "glorkz" in the directory where the program is first run.
  48. *
  49. * The original FORTRAN version can be found at
  50. * <URL:ftp://ftp.gmd.de/if-archive/games/source/advent-original.tar.gz>.
  51. */
  52. /* hdr.h: included by c advent files */
  53. #include <signal.h>
  54. extern int datfd; /* message file descriptor */
  55. extern volatile sig_atomic_t delhit;
  56. extern int yea;
  57. extern char data_file[]; /* Virtual data file */
  58. #define TAB 011
  59. #define LF 012
  60. #define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0)
  61. #define FLUSHLF while (next()!=LF)
  62. extern int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
  63. extern char *wd1, *wd2; /* the complete words */
  64. extern int verb, obj, spk;
  65. extern int blklin;
  66. extern int saveday, savet, mxscor, latncy;
  67. #define SHORT 50 /* How short is a demo game? */
  68. #define MAXSTR 20 /* max length of user's words */
  69. #define HTSIZE 512 /* max number of vocab words */
  70. extern struct hashtab { /* hash table for vocabulary */
  71. int val; /* word type &index (ktab) */
  72. char *atab; /* pointer to actual string */
  73. } voc[HTSIZE];
  74. #define SEED 1815622 /* "Encryption" seed */
  75. struct text
  76. {
  77. char *seekadr;/* Msg start in virtual disk */
  78. int txtlen; /* length of msg starting here */
  79. };
  80. #define RTXSIZ 205
  81. extern struct text rtext[RTXSIZ]; /* random text messages */
  82. #define MAGSIZ 35
  83. extern struct text mtext[MAGSIZ]; /* magic messages */
  84. extern int clsses;
  85. #define CLSMAX 12
  86. extern struct text ctext[CLSMAX]; /* classes of adventurer */
  87. extern int cval[CLSMAX];
  88. extern struct text ptext[101]; /* object descriptions */
  89. #define LOCSIZ 141 /* number of locations */
  90. extern struct text ltext[LOCSIZ]; /* long loc description */
  91. extern struct text stext[LOCSIZ]; /* short loc descriptions */
  92. extern struct travlist { /* direcs & conditions of travel */
  93. struct travlist *next; /* ptr to next list entry */
  94. int conditions; /* m in writeup (newloc / 1000) */
  95. int tloc; /* n in writeup (newloc % 1000) */
  96. int tverb; /* the verb that takes you there */
  97. } *travel[LOCSIZ], *tkk; /* travel is closer to keys(...) */
  98. extern int atloc[LOCSIZ];
  99. extern int plac[101]; /* initial object placement */
  100. extern int fixd[101], fixed[101]; /* location fixed? */
  101. extern int actspk[35]; /* rtext msg for verb <n> */
  102. extern int cond[LOCSIZ]; /* various condition bits */
  103. extern int setbit[16]; /* bit defn masks 1,2,4,... */
  104. extern int hntmax;
  105. extern int hints[20][5]; /* info on hints */
  106. extern int hinted[20], hintlc[20];
  107. extern int place[101], prop[101], links[201];
  108. extern int abb[LOCSIZ];
  109. extern int maxtrs, tally, tally2; /* treasure values */
  110. #define FALSE 0
  111. #define TRUE 1
  112. extern int keys, lamp, grate, cage, rod, rod2, steps, /* mnemonics */
  113. bird, door, pillow, snake, fissur, tablet, clam, oyster,
  114. magzin, dwarf, knife, food, bottle, water, oil, plant, plant2,
  115. axe, mirror, dragon, chasm, troll, troll2, bear, messag,
  116. vend, batter, nugget, coins, chest, eggs, tridnt, vase,
  117. emrald, pyram, pearl, rug, chain, spices, back, look, cave,
  118. null, entrnc, dprssn, enter, stream, pour, say, lock, throw,
  119. find, invent;
  120. extern int chloc, chloc2, dseen[7], dloc[7], /* dwarf stuff */
  121. odloc[7], dflag, daltlc;
  122. extern int tk[21], stick, dtotal, attack;
  123. extern int turns, lmwarn, iwest, knfloc, detail, /* various flags and
  124. * counters */
  125. abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1,
  126. clock2, saved, closng, panic, closed, scorng;
  127. extern int demo, limit;
  128. #define DECR(a,b,c,d,e) decr(a+'+',b+'-',c+'#',d+'&',e+'%')