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