Home | History | Annotate | Line # | Download | only in adventure
hdr.h revision 1.6
      1 /*	$NetBSD: hdr.h,v 1.6 1999/02/10 00:11:28 hubertf Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1991, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * The game adventure was originally written in Fortran by Will Crowther
      8  * and Don Woods.  It was later translated to C and enhanced by Jim
      9  * Gillogly.  This code is derived from software contributed to Berkeley
     10  * by Jim Gillogly at The Rand Corporation.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. All advertising materials mentioning features or use of this software
     21  *    must display the following acknowledgement:
     22  *	This product includes software developed by the University of
     23  *	California, Berkeley and its contributors.
     24  * 4. Neither the name of the University nor the names of its contributors
     25  *    may be used to endorse or promote products derived from this software
     26  *    without specific prior written permission.
     27  *
     28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38  * SUCH DAMAGE.
     39  *
     40  *	@(#)hdr.h	8.1 (Berkeley) 5/31/93
     41  */
     42 
     43 /*   ADVENTURE -- Jim Gillogly, Jul 1977
     44  * This program is a re-write of ADVENT, written in FORTRAN mostly by
     45  * Don Woods of SAIL.  In most places it is as nearly identical to the
     46  * original as possible given the language and word-size differences.
     47  * A few places, such as the message arrays and travel arrays were changed
     48  * to reflect the smaller core size and word size.  The labels of the
     49  * original are reflected in this version, so that the comments of the
     50  * fortran are still applicable here.
     51  *
     52  * The data file distributed with the fortran source is assumed to be called
     53  * "glorkz" in the directory where the program is first run.
     54  */
     55 
     56 /* hdr.h: included by c advent files */
     57 
     58 #include <signal.h>
     59 
     60 int     datfd;			/* message file descriptor */
     61 volatile sig_atomic_t delhit;
     62 int     yea;
     63 extern char data_file[];	/* Virtual data file */
     64 
     65 #define TAB     011
     66 #define LF      012
     67 #define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0)
     68 #define FLUSHLF   while (next()!=LF)
     69 
     70 int     loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
     71 char   *wd1, *wd2;		/* the complete words */
     72 int     verb, obj, spk;
     73 extern int blklin;
     74 int     saved, savet, mxscor, latncy;
     75 
     76 #define SHORT 50		/* How short is a demo game? */
     77 
     78 #define MAXSTR  20		/* max length of user's words */
     79 
     80 #define HTSIZE  512		/* max number of vocab words */
     81 struct hashtab {		/* hash table for vocabulary */
     82 	int     val;		/* word type &index (ktab) */
     83 	char   *atab;		/* pointer to actual string */
     84 }       voc[HTSIZE];
     85 #define SEED 1815622		/* "Encryption" seed */
     86 
     87 struct text
     88 #ifdef OLDSTUFF
     89 {
     90 	int     seekadr;	/* DATFILE must be < 2**16 */
     91 #endif /* OLDSTUFF */
     92 	{
     93 		char   *seekadr;/* Msg start in virtual disk */
     94 		int     txtlen;	/* length of msg starting here */
     95 	};
     96 
     97 #define RTXSIZ  205
     98 	struct text rtext[RTXSIZ];	/* random text messages */
     99 
    100 #define MAGSIZ  35
    101 	struct text mtext[MAGSIZ];	/* magic messages */
    102 
    103 	int     clsses;
    104 #define CLSMAX  12
    105 	struct text ctext[CLSMAX];	/* classes of adventurer */
    106 	int     cval[CLSMAX];
    107 
    108 	struct text ptext[101];		/* object descriptions */
    109 
    110 #define LOCSIZ  141			/* number of locations */
    111 	struct text ltext[LOCSIZ];	/* long loc description */
    112 	struct text stext[LOCSIZ];	/* short loc descriptions */
    113 
    114 	struct travlist {		/* direcs & conditions of travel */
    115 		struct travlist *next;	/* ptr to next list entry */
    116 		int     conditions;	/* m in writeup (newloc / 1000) */
    117 		int     tloc;		/* n in writeup (newloc % 1000) */
    118 		int     tverb;		/* the verb that takes you there */
    119 	}      *travel[LOCSIZ], *tkk;	/* travel is closer to keys(...) */
    120 
    121 	int     atloc[LOCSIZ];
    122 
    123 	int     plac[101];		/* initial object placement */
    124 	int     fixd[101], fixed[101];	/* location fixed? */
    125 
    126 	int     actspk[35];		/* rtext msg for verb <n> */
    127 
    128 	int     cond[LOCSIZ];		/* various condition bits */
    129 
    130 	extern int setbit[16];		/* bit defn masks 1,2,4,... */
    131 
    132 	int     hntmax;
    133 	int     hints[20][5];		/* info on hints */
    134 	int     hinted[20], hintlc[20];
    135 
    136 	int     place[101], prop[101], links[201];
    137 	int     abb[LOCSIZ];
    138 
    139 	int     maxtrs, tally, tally2;	/* treasure values */
    140 
    141 #define FALSE   0
    142 #define TRUE    1
    143 
    144 	int     keys, lamp, grate, cage, rod, rod2, steps,	/* mnemonics */
    145 	        bird, door, pillow, snake, fissur, tablet, clam, oyster,
    146 	        magzin, dwarf, knife, food, bottle, water, oil, plant, plant2,
    147 	        axe, mirror, dragon, chasm, troll, troll2, bear, messag,
    148 	        vend, batter, nugget, coins, chest, eggs, tridnt, vase,
    149 	        emrald, pyram, pearl, rug, chain, spices, back, look, cave,
    150 	        null, entrnc, dprssn, enter, stream, pour, say, lock, throw,
    151 	        find, invent;
    152 
    153 	int     chloc, chloc2, dseen[7], dloc[7],	/* dwarf stuff */
    154 	        odloc[7], dflag, daltlc;
    155 
    156 	int     tk[21], stick, dtotal, attack;
    157 	int     turns, lmwarn, iwest, knfloc, detail,	/* various flags and
    158 							 * counters */
    159 	        abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1,
    160 	        clock2, saved, closng, panic, closed, scorng;
    161 
    162 	int     demo, newloc, limit;
    163 
    164 #define DECR(a,b,c,d,e) decr(a+'+',b+'-',c+'#',d+'&',e+'%')
    165