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