-# $NetBSD: Makefile,v 1.5 1997/08/11 14:06:10 christos Exp $
+# $NetBSD: Makefile,v 1.6 1997/10/10 11:59:26 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 6/12/93
-WARNS?= 1
PROG= adventure
SRCS= main.c init.c done.c save.c subr.c vocab.c wizard.c io.c data.c crc.c
MAN= adventure.6
-.\" $NetBSD: adventure.6,v 1.2 1995/03/21 12:04:57 cgd Exp $
+.\" $NetBSD: adventure.6,v 1.3 1997/10/10 11:59:33 lukem Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.Nm adventure
.Nd an exploration game
.Sh SYNOPSIS
-.Nm adventure
+.Nm
.Op saved-file
.Sh DESCRIPTION
The object of the game is to locate and explore Colossal Cave, find the
-/* $NetBSD: crc.c,v 1.3 1997/08/11 14:06:11 christos Exp $ */
+/* $NetBSD: crc.c,v 1.4 1997/10/10 11:59:36 lukem Exp $ */
/*-
* Copyright (c) 1993
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 5/31/93";
static char ORIGINAL_sccsid[] = "@(#)crc.c 5.2 (Berkeley) 4/4/91";
#else
-__RCSID("$NetBSD: crc.c,v 1.3 1997/08/11 14:06:11 christos Exp $");
+__RCSID("$NetBSD: crc.c,v 1.4 1997/10/10 11:59:36 lukem Exp $");
#endif
#endif /* not lint */
crcval = step = 0;
}
-unsigned long crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */
-char *ptr;
-int nr;
+unsigned long
+crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */
+ char *ptr;
+ int nr;
{
- register int i;
- register char *p;
+ int i;
+ char *p;
while (nr > 0)
for (p = ptr; nr--; ++p)
-/* $NetBSD: done.c,v 1.3 1997/08/11 14:06:12 christos Exp $ */
+/* $NetBSD: done.c,v 1.4 1997/10/10 11:59:39 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)done.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: done.c,v 1.3 1997/08/11 14:06:12 christos Exp $");
+__RCSID("$NetBSD: done.c,v 1.4 1997/10/10 11:59:39 lukem Exp $");
#endif
#endif /* not lint */
int
score() /* sort of like 20000 */
-{ register int scor,i;
+{ int scor,i;
mxscor=scor=0;
for (i=50; i<=maxtrs; i++)
{ if (ptext[i].txtlen==0) continue;
void
done(entry) /* entry=1 means goto 13000 */ /* game is over */
int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
-{ register int i,sc;
+{ int i,sc;
if (entry==1) mspeak(1);
if (entry==3) rspeak(136);
printf("\n\n\nYou scored %d out of a ",(sc=score()));
int
die(entry) /* label 90 */
int entry;
-{ register int i;
+{ int i;
if (entry != 99)
{ rspeak(23);
oldlc2=loc;
-/* $NetBSD: init.c,v 1.5 1997/08/11 14:06:14 christos Exp $ */
+/* $NetBSD: init.c,v 1.6 1997/10/10 11:59:42 lukem Exp $ */
/*-
* Copyright (c) 1993
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93";
#else
-__RCSID("$NetBSD: init.c,v 1.5 1997/08/11 14:06:14 christos Exp $");
+__RCSID("$NetBSD: init.c,v 1.6 1997/10/10 11:59:42 lukem Exp $");
#endif
#endif /* not lint */
void
linkdata() /* secondary data manipulation */
-{ register int i,j;
+{ int i,j;
/* array linkages */
for (i=1; i<=LOCSIZ; i++)
-/* $NetBSD: io.c,v 1.4 1997/08/11 14:06:15 christos Exp $ */
+/* $NetBSD: io.c,v 1.5 1997/10/10 11:59:45 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: io.c,v 1.4 1997/08/11 14:06:15 christos Exp $");
+__RCSID("$NetBSD: io.c,v 1.5 1997/10/10 11:59:45 lukem Exp $");
#endif
#endif /* not lint */
void
getin(wrd1,wrd2) /* get command from user */
char **wrd1,**wrd2; /* no prompt, usually */
-{ register char *s;
+{ char *s;
static char wd1buf[MAXSTR],wd2buf[MAXSTR];
int first, numch;
int
confirm(mesg) /* confirm irreversible action */
char *mesg;
-{ register int result;
+{ int result;
printf("%s",mesg); /* tell him what he did */
if (getchar()=='y') /* was his first letter a 'y'? */
result=1;
int
yes(x,y,z) /* confirm with rspeak */
int x,y,z;
-{ register int result = TRUE; /* pacify gcc */
- register char ch;
+{ int result = TRUE; /* pacify gcc */
+ char ch;
for (;;)
{ rspeak(x); /* tell him what we want*/
if ((ch=getchar())=='y')
int
yesm(x,y,z) /* confirm with mspeak */
int x,y,z;
-{ register int result = TRUE; /* pacify gcc */
- register char ch;
+{ int result = TRUE; /* pacify gcc */
+ char ch;
for (;;)
{ mspeak(x); /* tell him what we want*/
if ((ch=getchar())=='y')
void
rdata() /* "read" data from virtual file*/
-{ register int sect;
- register char ch;
+{ int sect;
+ char ch;
inptr = data_file; /* Pointer to virtual data file */
srandom(SEED); /* which is lightly encrypted. */
int
rnum() /* read initial location num */
-{ register char *s;
+{ char *s;
tape = iotape; /* restart encryption tape */
for (s=nbf,*s=0;; s++)
if ((*s=next())==TAB || *s=='\n' || *s==LF)
void
rdesc(sect) /* read description-format msgs */
int sect;
-{ register int locc;
+{ int locc;
char *seekstart, *maystart;
seekhere = inptr; /* Where are we in virtual file?*/
void
rtrav() /* read travel table */
-{ register int locc;
- register struct travlist *t = NULL;
- register char *s;
+{ int locc;
+ struct travlist *t = NULL;
+ char *s;
char buf[12];
int len,m,n,entries = 0;
void
twrite(loq) /* travel options from this loc */
int loq;
-{ register struct travlist *t;
+{ struct travlist *t;
printf("If");
speak(<ext[loq]);
printf("then\n");
void
rvoc()
-{ register char *s; /* read the vocabulary */
- register int index;
+{ char *s; /* read the vocabulary */
+ int index;
char buf[6];
for (;;)
{ index=rnum();
void
rliq() /* liquid assets &c: cond bits */
-{ register int bitnum;
+{ int bitnum;
for (;;) /* read new bit list */
{ if ((bitnum=rnum())<0) break;
for (;;) /* read locs for bits */
void
rhints()
-{ register int hintnum,i;
+{ int hintnum,i;
hntmax=0;
for (;;)
{ if ((hintnum=rnum())<0) break;
speak(msg) /* read, decrypt, and print a message (not ptext) */
struct text *msg;/* msg is a pointer to seek address and length of mess */
{
- register char *s, nonfirst;
+ char *s, nonfirst;
s = msg->seekadr;
nonfirst=0;
int m; /* msg is the number of all the p msgs for this place */
int skip; /* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/
{
- register char *s,nonfirst;
+ char *s,nonfirst;
char *numst, save;
struct text *msg;
char *tbuf;
-/* $NetBSD: main.c,v 1.6 1997/08/11 14:06:16 christos Exp $ */
+/* $NetBSD: main.c,v 1.7 1997/10/10 11:59:49 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
#else
-__RCSID("$NetBSD: main.c,v 1.6 1997/08/11 14:06:16 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.7 1997/10/10 11:59:49 lukem Exp $");
#endif
#endif /* not lint */
int argc;
char **argv;
{
- register int i;
+ int i;
int rval,ll;
struct text *kk;
-/* $NetBSD: subr.c,v 1.3 1997/08/11 14:06:17 christos Exp $ */
+/* $NetBSD: subr.c,v 1.4 1997/10/10 11:59:53 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: subr.c,v 1.3 1997/08/11 14:06:17 christos Exp $");
+__RCSID("$NetBSD: subr.c,v 1.4 1997/10/10 11:59:53 lukem Exp $");
#endif
#endif /* not lint */
int
liq(foo)
-{ register int i;
+{ int i;
i=prop[bottle];
if (i>-1-i) return(liq2(i));
else return(liq2(-1-i));
int
liqloc(locc) /* may want to clean this one up a bit */
int locc;
-{ register int i,j,l;
+{ int i,j,l;
i=cond[locc]/2;
j=((i*2)%8)-5;
l=cond[locc]/4;
int
fdwarf() /* 71 */
-{ register int i,j;
- register struct travlist *kk;
+{ int i,j;
+ struct travlist *kk;
if (newloc!=loc&&!forced(loc)&&!bitset(loc,3))
{ for (i=1; i<=5; i++)
int
march() /* label 8 */
-{ register int ll1,ll2;
+{ int ll1,ll2;
if ((tkk=travel[newloc=loc])==0) bug(26);
if (k==null) return(2);
int
mback() /* 20 */
-{ register struct travlist *tk2,*j;
- register int ll;
+{ struct travlist *tk2,*j;
+ int ll;
if (forced(k=oldloc)) k=oldlc2; /* k=location */
oldlc2=oldloc;
oldloc=loc;
int
checkhints() /* 2600 &c */
-{ register int hint;
+{ int hint;
for (hint=4; hint<=hntmax; hint++)
{ if (hinted[hint]) continue;
if (!bitset(loc,hint)) hintlc[hint]= -1;
int
trsay() /* 9030 */
-{ register int i;
+{ int i;
if (*wd2!=0) copystr(wd2,wd1);
i=vocab(wd1,-1,0);
if (i==62||i==65||i==71||i==2025)
int
trkill() /* 9120 */
-{ register int i;
+{ int i;
for (i=1; i<=5; i++)
if (dloc[i]==loc&&dflag>=2) break;
if (i==6) i=0;
int
trtoss() /* 9170: throw */
-{ register int i;
+{ int i;
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011);
if (obj>=50&&obj<=maxtrs&&at(troll))
int
closing() /* 10000 */
-{ register int i;
+{ int i;
prop[grate]=prop[fissur]=0;
for (i=1; i<=6; i++)
int
caveclose() /* 11000 */
-{ register int i;
+{ int i;
prop[bottle]=put(bottle,115,1);
prop[plant]=put(plant,115,0);
prop[oyster]=put(oyster,115,0);
-/* $NetBSD: vocab.c,v 1.3 1997/08/11 14:06:18 christos Exp $ */
+/* $NetBSD: vocab.c,v 1.4 1997/10/10 11:59:56 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: vocab.c,v 1.3 1997/08/11 14:06:18 christos Exp $");
+__RCSID("$NetBSD: vocab.c,v 1.4 1997/10/10 11:59:56 lukem Exp $");
#endif
#endif /* not lint */
void
juggle(object)
int object;
-{ register int i,j;
+{ int i,j;
i=place[object];
j=fixed[object];
void
move(object,where)
int object,where;
-{ register int from;
+{ int from;
if (object<=100)
from=place[object];
void
carry(object,where)
int object,where;
-{ register int temp;
+{ int temp;
if (object<=100)
{ if (place[object]== -1) return;
char *word;
int type; /* -2 for store, -1 for user word, >=0 for canned lookup*/
int value; /* used for storing only */
-{ register int adr;
- register char *s,*t;
+{ int adr;
+ char *s,*t;
int hash, i;
struct hashtab *h;
void
copystr(w1,w2) /* copy one string to another */
char *w1,*w2;
-{ register char *s,*t;
+{ char *s,*t;
for (s=w1,t=w2; *s;)
*t++ = *s++;
*t=0;
int
weq(w1,w2) /* compare words */
char *w1,*w2; /* w1 is user, w2 is system */
-{ register char *s,*t;
- register int i;
+{ char *s,*t;
+ int i;
s=w1;
t=w2;
for (i=0; i<5; i++) /* compare at most 5 chars */
int
length(str) /* includes 0 at end */
char *str;
-{ register char *s;
- register int n;
+{ char *s;
+ int n;
for (n=0,s=str; *s++;) n++;
return(n+1);
}
void
prht() /* print hash table */
-{ register int i,j,l;
+{ int i,j,l;
char *c;
struct hashtab *h;
for (i=0; i<HTSIZE/10+1; i++)
-/* $NetBSD: wizard.c,v 1.4 1997/08/11 14:06:19 christos Exp $ */
+/* $NetBSD: wizard.c,v 1.5 1997/10/10 12:00:02 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93";
#else
-__RCSID("$NetBSD: wizard.c,v 1.4 1997/08/11 14:06:19 christos Exp $");
+__RCSID("$NetBSD: wizard.c,v 1.5 1997/10/10 12:00:02 lukem Exp $");
#endif
#endif /* not lint */
void
ciao(cmdfile)
char *cmdfile;
-{ register char *c;
+{ char *c;
char fname[80];
printf("What would you like to call the saved version?\n");