xref: /original-bsd/games/adventure/hdr.h (revision 66cc6aec)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
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.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)hdr.h	8.1 (Berkeley) 05/31/93
13  */
14 
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 
28 /* hdr.h: included by c advent files */
29 
30 int datfd;                              /* message file descriptor      */
31 int delhit;
32 int yea;
33 extern char data_file[];                /* Virtual data file            */
34 
35 #define TAB     011
36 #define LF      012
37 #define FLUSHLINE while (getchar()!='\n')
38 #define FLUSHLF   while (next()!=LF)
39 
40 int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2;
41 char *wd1,*wd2;                         /* the complete words           */
42 int verb,obj,spk;
43 extern int blklin;
44 int saved,savet,mxscor,latncy;
45 
46 #define SHORT 50                        /* How short is a demo game?    */
47 
48 #define MAXSTR  20                      /* max length of user's words   */
49 
50 #define HTSIZE  512                     /* max number of vocab words    */
51 struct hashtab                          /* hash table for vocabulary    */
52 {       int val;                        /* word type &index (ktab)      */
53 	char *atab;                     /* pointer to actual string     */
54 } voc[HTSIZE];
55 
56 #define SEED 1815622                    /* "Encryption" seed            */
57 
58 struct text
59 #ifdef OLDSTUFF
60 {       int seekadr;                    /* DATFILE must be < 2**16      */
61 #endif OLDSTUFF
62 {       char *seekadr;                  /* Msg start in virtual disk    */
63 	int txtlen;                     /* length of msg starting here  */
64 };
65 
66 #define RTXSIZ  205
67 struct text rtext[RTXSIZ];              /* random text messages         */
68 
69 #define MAGSIZ  35
70 struct text mtext[MAGSIZ];              /* magic messages               */
71 
72 int clsses;
73 #define CLSMAX  12
74 struct text ctext[CLSMAX];              /* classes of adventurer        */
75 int cval[CLSMAX];
76 
77 struct text ptext[101];                 /* object descriptions          */
78 
79 #define LOCSIZ  141                     /* number of locations          */
80 struct text ltext[LOCSIZ];              /* long loc description         */
81 struct text stext[LOCSIZ];              /* short loc descriptions       */
82 
83 struct 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 
90 int atloc[LOCSIZ];
91 
92 int  plac[101];                         /* initial object placement     */
93 int  fixd[101],fixed[101];              /* location fixed?              */
94 
95 int actspk[35];                         /* rtext msg for verb <n>       */
96 
97 int cond[LOCSIZ];                       /* various condition bits       */
98 
99 extern int setbit[16];                  /* bit defn masks 1,2,4,...     */
100 
101 int hntmax;
102 int hints[20][5];                       /* info on hints                */
103 int hinted[20],hintlc[20];
104 
105 int place[101], prop[101],link[201];
106 int abb[LOCSIZ];
107 
108 int maxtrs,tally,tally2;                /* treasure values              */
109 
110 #define FALSE   0
111 #define TRUE    1
112 
113 int 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,
120 	enter, stream, pour,
121 	say,lock,throw,find,invent;
122 
123 int chloc,chloc2,dseen[7],dloc[7],      /* dwarf stuff                  */
124 	odloc[7],dflag,daltlc;
125 
126 int tk[21],stick,dtotal,attack;
127 int 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 
131 int demo,newloc,limit;
132 
133 char *malloc();
134 char *decr();
135 unsigned long crc();
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'+'%')
139