BSD 4_4 release
[unix-history] / usr / src / games / adventure / hdr.h
index 3aa2499..3072f9b 100644 (file)
@@ -1,4 +1,43 @@
-#
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * The game adventure was originally written in Fortran by Will Crowther
+ * and Don Woods.  It was later translated to C and enhanced by Jim
+ * Gillogly.  This code is derived from software contributed to Berkeley
+ * by Jim Gillogly at The Rand Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)hdr.h       8.1 (Berkeley) 5/31/93
+ */
+
 /*   ADVENTURE -- Jim Gillogly, Jul 1977
  * This program is a re-write of ADVENT, written in FORTRAN mostly by
  * Don Woods of SAIL.  In most places it is as nearly identical to the
 /*   ADVENTURE -- Jim Gillogly, Jul 1977
  * This program is a re-write of ADVENT, written in FORTRAN mostly by
  * Don Woods of SAIL.  In most places it is as nearly identical to the
  * "glorkz" in the directory where the program is first run.
  */
 
  * "glorkz" in the directory where the program is first run.
  */
 
-static char hdr_sccsid[] = "   hdr.h   4.1     82/05/11        ";
-
-/* \f hdr.h */
 /* hdr.h: included by c advent files */
 
 /* hdr.h: included by c advent files */
 
-extern int setup;                       /* changed by savec & init      */
 int datfd;                              /* message file descriptor      */
 int delhit;
 int yea;
 int datfd;                              /* message file descriptor      */
 int delhit;
 int yea;
+extern char data_file[];                /* Virtual data file            */
 
 #define TAB     011
 #define LF      012
 #define FLUSHLINE while (getchar()!='\n')
 #define FLUSHLF   while (next()!=LF)
 
 
 #define TAB     011
 #define LF      012
 #define FLUSHLINE while (getchar()!='\n')
 #define FLUSHLF   while (next()!=LF)
 
-int loc,newloc,oldloc,oldlc2,wzdark,SHORT,gaveup,kq,k,k2;
+int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2;
 char *wd1,*wd2;                         /* the complete words           */
 int verb,obj,spk;
 extern int blklin;
 int saved,savet,mxscor,latncy;
 
 char *wd1,*wd2;                         /* the complete words           */
 int verb,obj,spk;
 extern int blklin;
 int saved,savet,mxscor,latncy;
 
+#define SHORT 50                        /* How short is a demo game?    */
+
 #define MAXSTR  20                      /* max length of user's words   */
 
 #define HTSIZE  512                     /* max number of vocab words    */
 #define MAXSTR  20                      /* max length of user's words   */
 
 #define HTSIZE  512                     /* max number of vocab words    */
@@ -41,12 +79,13 @@ struct hashtab                          /* hash table for vocabulary    */
        char *atab;                     /* pointer to actual string     */
 } voc[HTSIZE];
 
        char *atab;                     /* pointer to actual string     */
 } voc[HTSIZE];
 
-#define DATFILE "glorkz"                /* all the original msgs        */
-#define TMPFILE "tmp.foo.baz"           /* just the text msgs           */
-
+#define SEED 1815622                    /* "Encryption" seed            */
 
 struct text
 
 struct text
+#ifdef OLDSTUFF
 {       int seekadr;                    /* DATFILE must be < 2**16      */
 {       int seekadr;                    /* DATFILE must be < 2**16      */
+#endif OLDSTUFF
+{       char *seekadr;                  /* Msg start in virtual disk    */
        int txtlen;                     /* length of msg starting here  */
 };
 
        int txtlen;                     /* length of msg starting here  */
 };
 
@@ -104,6 +143,7 @@ int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics                    */
        nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain,
        spices,
        back,look,cave,null,entrnc,dprssn,
        nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain,
        spices,
        back,look,cave,null,entrnc,dprssn,
+       enter, stream, pour,
        say,lock,throw,find,invent;
 
 int chloc,chloc2,dseen[7],dloc[7],      /* dwarf stuff                  */
        say,lock,throw,find,invent;
 
 int chloc,chloc2,dseen[7],dloc[7],      /* dwarf stuff                  */
@@ -117,3 +157,8 @@ int turns,lmwarn,iwest,knfloc,detail,   /* various flags & counters     */
 int demo,newloc,limit;
 
 char *malloc();
 int demo,newloc,limit;
 
 char *malloc();
+char *decr();
+unsigned long crc();
+
+/* We need to get a little tricky to avoid strings */
+#define DECR(a,b,c,d,e) decr('a'+'+','b'+'-','c'+'#','d'+'&','e'+'%')