summaryrefslogtreecommitdiff
path: root/games/adventure
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1997-07-23 20:05:17 +0000
committerkstailey <kstailey@cvs.openbsd.org>1997-07-23 20:05:17 +0000
commit24ebfd27177ba2d49b2fd2e9d5b5fba3df35744c (patch)
treef301459f6e2160b59f102e5506c37de2f4c48251 /games/adventure
parentec11c0c45f17c8fcab3c1dcd043b3cd0b55c4c82 (diff)
tabify
Diffstat (limited to 'games/adventure')
-rw-r--r--games/adventure/crc.c2
-rw-r--r--games/adventure/done.c10
-rw-r--r--games/adventure/hdr.h70
-rw-r--r--games/adventure/init.c16
-rw-r--r--games/adventure/io.c170
-rw-r--r--games/adventure/main.c172
-rw-r--r--games/adventure/save.c128
-rw-r--r--games/adventure/setup.c4
-rw-r--r--games/adventure/subr.c120
-rw-r--r--games/adventure/vocab.c46
-rw-r--r--games/adventure/wizard.c12
11 files changed, 375 insertions, 375 deletions
diff --git a/games/adventure/crc.c b/games/adventure/crc.c
index 45e43036045..34020907e69 100644
--- a/games/adventure/crc.c
+++ b/games/adventure/crc.c
@@ -136,5 +136,5 @@ int nr;
}
crcval = (crcval << 8) ^ crctab[i];
}
- return crcval & 0xffffffff; /* Mask to 32 bits. */
+ return crcval & 0xffffffff; /* Mask to 32 bits. */
}
diff --git a/games/adventure/done.c b/games/adventure/done.c
index 464d606fb89..fad18181b5b 100644
--- a/games/adventure/done.c
+++ b/games/adventure/done.c
@@ -46,11 +46,11 @@ static char rcsid[] = "$NetBSD: done.c,v 1.2 1995/03/21 12:05:01 cgd Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: termination routines */
+/* Re-coding of advent in C: termination routines */
#include "hdr.h"
-score() /* sort of like 20000 */
+score() /* sort of like 20000 */
{ register int scor,i;
mxscor=scor=0;
for (i=50; i<=maxtrs; i++)
@@ -86,7 +86,7 @@ score() /* sort of like 20000 */
return(scor);
}
-done(entry) /* entry=1 means goto 13000 */ /* game is over */
+done(entry) /* entry=1 means goto 13000 */ /* game is over */
int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
{ register int i,sc;
if (entry==1) mspeak(1);
@@ -114,14 +114,14 @@ int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
}
-die(entry) /* label 90 */
+die(entry) /* label 90 */
int entry;
{ register int i;
if (entry != 99)
{ rspeak(23);
oldlc2=loc;
}
- if (closng) /* 99 */
+ if (closng) /* 99 */
{ rspeak(131);
numdie++;
done(2);
diff --git a/games/adventure/hdr.h b/games/adventure/hdr.h
index 0143e561e0f..bfea417e047 100644
--- a/games/adventure/hdr.h
+++ b/games/adventure/hdr.h
@@ -57,10 +57,10 @@
#include <sys/types.h>
#include <stdio.h>
-int datfd; /* message file descriptor */
+int datfd; /* message file descriptor */
int delhit;
int yea;
-extern char data_file[]; /* Virtual data file */
+extern char data_file[]; /* Virtual data file */
#define TAB 011
#define LF 012
@@ -68,79 +68,79 @@ extern char data_file[]; /* Virtual data file */
#define FLUSHLF while (next()!=LF)
int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2;
-char *wd1,*wd2; /* the complete words */
+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 SHORT 50 /* How short is a demo game? */
-#define MAXSTR 20 /* max length of user's words */
+#define MAXSTR 20 /* max length of user's words */
-#define HTSIZE 512 /* max number of vocab words */
-struct hashtab /* hash table for vocabulary */
-{ int val; /* word type &index (ktab) */
- char *atab; /* pointer to actual string */
+#define HTSIZE 512 /* max number of vocab words */
+struct hashtab /* hash table for vocabulary */
+{ int val; /* word type &index (ktab) */
+ char *atab; /* pointer to actual string */
} voc[HTSIZE];
-#define SEED 1815622 /* "Encryption" seed */
+#define SEED 1815622 /* "Encryption" seed */
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 */
+{ char *seekadr; /* Msg start in virtual disk */
+ int txtlen; /* length of msg starting here */
};
#define RTXSIZ 205
-struct text rtext[RTXSIZ]; /* random text messages */
+struct text rtext[RTXSIZ]; /* random text messages */
#define MAGSIZ 35
-struct text mtext[MAGSIZ]; /* magic messages */
+struct text mtext[MAGSIZ]; /* magic messages */
int clsses;
#define CLSMAX 12
-struct text ctext[CLSMAX]; /* classes of adventurer */
+struct text ctext[CLSMAX]; /* classes of adventurer */
int cval[CLSMAX];
-struct text ptext[101]; /* object descriptions */
+struct text ptext[101]; /* object descriptions */
-#define LOCSIZ 141 /* number of locations */
-struct text ltext[LOCSIZ]; /* long loc description */
-struct text stext[LOCSIZ]; /* short loc descriptions */
+#define LOCSIZ 141 /* number of locations */
+struct text ltext[LOCSIZ]; /* long loc description */
+struct text stext[LOCSIZ]; /* short loc descriptions */
-struct travlist /* direcs & conditions of travel*/
-{ struct travlist *next; /* ptr to next list entry */
- int conditions; /* m in writeup (newloc / 1000) */
- int tloc; /* n in writeup (newloc % 1000) */
- int tverb; /* the verb that takes you there*/
-} *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/
+struct travlist /* direcs & conditions of travel*/
+{ struct travlist *next; /* ptr to next list entry */
+ int conditions; /* m in writeup (newloc / 1000) */
+ int tloc; /* n in writeup (newloc % 1000) */
+ int tverb; /* the verb that takes you there*/
+} *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/
int atloc[LOCSIZ];
-int plac[101]; /* initial object placement */
-int fixd[101],fixed[101]; /* location fixed? */
+int plac[101]; /* initial object placement */
+int fixd[101],fixed[101]; /* location fixed? */
-int actspk[35]; /* rtext msg for verb <n> */
+int actspk[35]; /* rtext msg for verb <n> */
-int cond[LOCSIZ]; /* various condition bits */
+int cond[LOCSIZ]; /* various condition bits */
-extern int setbit[16]; /* bit defn masks 1,2,4,... */
+extern int setbit[16]; /* bit defn masks 1,2,4,... */
int hntmax;
-int hints[20][5]; /* info on hints */
+int hints[20][5]; /* info on hints */
int hinted[20],hintlc[20];
int place[101], prop[101],linkx[201];
int abb[LOCSIZ];
-int maxtrs,tally,tally2; /* treasure values */
+int maxtrs,tally,tally2; /* treasure values */
#define FALSE 0
#define TRUE 1
-int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */
+int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */
bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin,
dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon,
chasm,troll,troll2,bear,messag,vend,batter,
@@ -150,7 +150,7 @@ int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */
enter, stream, pour,
say,lock,throw,find,invent;
-int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */
+int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */
odloc[7],dflag,daltlc;
int tk[21],stick,dtotal,attack;
diff --git a/games/adventure/init.c b/games/adventure/init.c
index 298dc3b0a04..16bbe034d27 100644
--- a/games/adventure/init.c
+++ b/games/adventure/init.c
@@ -46,7 +46,7 @@ static char rcsid[] = "$NetBSD: init.c,v 1.4 1996/05/21 21:53:05 mrg Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: data initialization */
+/* Re-coding of advent in C: data initialization */
#include <sys/types.h>
#include <signal.h>
@@ -59,10 +59,10 @@ int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
010000,020000,040000,0100000};
-init(command) /* everything for 1st time run */
-char *command; /* command we were called with */
+init(command) /* everything for 1st time run */
+char *command; /* command we were called with */
{
- rdata(); /* read data from orig. file */
+ rdata(); /* read data from orig. file */
linkdata();
poof();
}
@@ -81,10 +81,10 @@ char a,b,c,d,e;
return buf;
}
-linkdata() /* secondary data manipulation */
+linkdata() /* secondary data manipulation */
{ register int i,j;
- /* array linkages */
+ /* array linkages */
for (i=1; i<=LOCSIZ; i++)
if (ltext[i].seekadr!=0 && travel[i] != 0)
if ((travel[i]->tverb)==1) cond[i]=2;
@@ -202,9 +202,9 @@ linkdata() /* secondary data manipulation */
-trapdel() /* come here if he hits a del */
+trapdel() /* come here if he hits a del */
{ delhit++; /* main checks, treats as QUIT */
- signal(SIGINT,trapdel); /* catch subsequent DELs */
+ signal(SIGINT,trapdel); /* catch subsequent DELs */
}
diff --git a/games/adventure/io.c b/games/adventure/io.c
index fb7686ffacc..8137f2d4a92 100644
--- a/games/adventure/io.c
+++ b/games/adventure/io.c
@@ -46,26 +46,26 @@ static char rcsid[] = "$NetBSD: io.c,v 1.3 1995/04/24 12:21:37 cgd Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: file i/o and user i/o */
+/* Re-coding of advent in C: file i/o and user i/o */
#include "hdr.h"
#include <stdio.h>
#include <string.h>
-getin(wrd1,wrd2) /* get command from user */
-char **wrd1,**wrd2; /* no prompt, usually */
+getin(wrd1,wrd2) /* get command from user */
+char **wrd1,**wrd2; /* no prompt, usually */
{ register char *s;
static char wd1buf[MAXSTR],wd2buf[MAXSTR];
int first, numch;
- *wrd1=wd1buf; /* return ptr to internal string*/
+ *wrd1=wd1buf; /* return ptr to internal string*/
*wrd2=wd2buf;
- wd2buf[0]=0; /* in case it isn't set here */
+ wd2buf[0]=0; /* in case it isn't set here */
for (s=wd1buf, first=1, numch=0;;)
{ if ((*s=getchar())>='A' && *s <='Z') *s = *s - ('A' -'a');
- /* convert to upper case */
- switch(*s) /* start reading from user */
+ /* convert to upper case */
+ switch(*s) /* start reading from user */
{ case '\n':
*s=0;
return;
@@ -78,7 +78,7 @@ char **wrd1,**wrd2; /* no prompt, usually */
s=wd2buf;
break;
}
- else /* finished 2nd word */
+ else /* finished 2nd word */
{ FLUSHLINE;
*s=0;
return;
@@ -99,12 +99,12 @@ char **wrd1,**wrd2; /* no prompt, usually */
}
-confirm(mesg) /* confirm irreversible action */
+confirm(mesg) /* confirm irreversible action */
char *mesg;
{ register int result;
register int c;
- printf("%s",mesg); /* tell him what he did */
- if ((c = getchar())=='y') /* was his first letter a 'y'? */
+ printf("%s",mesg); /* tell him what he did */
+ if ((c = getchar())=='y') /* was his first letter a 'y'? */
result=1;
else if (c == EOF) {
printf("user closed input stream, quitting...\n");
@@ -114,12 +114,12 @@ char *mesg;
return(result);
}
-yes(x,y,z) /* confirm with rspeak */
+yes(x,y,z) /* confirm with rspeak */
int x,y,z;
{ register int result;
register int ch;
for (;;)
- { rspeak(x); /* tell him what we want*/
+ { rspeak(x); /* tell him what we want*/
if ((ch=getchar())=='y')
result=TRUE;
else if (ch=='n') result=FALSE;
@@ -136,12 +136,12 @@ int x,y,z;
return(result);
}
-yesm(x,y,z) /* confirm with mspeak */
+yesm(x,y,z) /* confirm with mspeak */
int x,y,z;
{ register int result;
register char ch;
for (;;)
- { mspeak(x); /* tell him what we want*/
+ { mspeak(x); /* tell him what we want*/
if ((ch=getchar())=='y')
result=TRUE;
else if (ch=='n') result=FALSE;
@@ -160,19 +160,19 @@ int x,y,z;
/* FILE *inbuf,*outbuf; */
-char *inptr; /* Pointer into virtual disk */
+char *inptr; /* Pointer into virtual disk */
int outsw = 0; /* putting stuff to data file? */
char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l";
char *tape = iotape; /* pointer to encryption tape */
-next() /* next virtual char, bump adr */
+next() /* next virtual char, bump adr */
{
int ch;
- ch=(*inptr ^ random()) & 0xFF; /* Decrypt input data */
- if (outsw) /* putting data in tmp file */
+ ch=(*inptr ^ random()) & 0xFF; /* Decrypt input data */
+ if (outsw) /* putting data in tmp file */
{ if (*tape==0) tape=iotape; /* rewind encryption tape */
*inptr = ch ^ *tape++; /* re-encrypt and replace value */
}
@@ -180,18 +180,18 @@ next() /* next virtual char, bump adr */
return(ch);
}
-char breakch; /* tell which char ended rnum */
+char breakch; /* tell which char ended rnum */
-rdata() /* "read" data from virtual file*/
+rdata() /* "read" data from virtual file*/
{ register int sect;
register char ch;
- inptr = data_file; /* Pointer to virtual data file */
- srandom(SEED); /* which is lightly encrypted. */
+ inptr = data_file; /* Pointer to virtual data file */
+ srandom(SEED); /* which is lightly encrypted. */
clsses=1;
- for (;;) /* read data sections */
- { sect=next()-'0'; /* 1st digit of section number */
+ for (;;) /* read data sections */
+ { sect=next()-'0'; /* 1st digit of section number */
#ifdef VERBOSE
printf("Section %c",sect+'0');
#endif
@@ -207,44 +207,44 @@ rdata() /* "read" data from virtual file*/
putchar('\n');
#endif
switch(sect)
- { case 0: /* finished reading database */
+ { case 0: /* finished reading database */
return;
- case 1: /* long form descriptions */
+ case 1: /* long form descriptions */
rdesc(1);
break;
- case 2: /* short form descriptions */
+ case 2: /* short form descriptions */
rdesc(2);
break;
- case 3: /* travel table */
+ case 3: /* travel table */
rtrav(); break;
- case 4: /* vocabulary */
+ case 4: /* vocabulary */
rvoc();
break;
- case 5: /* object descriptions */
+ case 5: /* object descriptions */
rdesc(5);
break;
- case 6: /* arbitrary messages */
+ case 6: /* arbitrary messages */
rdesc(6);
break;
- case 7: /* object locations */
+ case 7: /* object locations */
rlocs(); break;
- case 8: /* action defaults */
+ case 8: /* action defaults */
rdflt(); break;
- case 9: /* liquid assets */
+ case 9: /* liquid assets */
rliq(); break;
- case 10: /* class messages */
+ case 10: /* class messages */
rdesc(10);
break;
- case 11: /* hints */
+ case 11: /* hints */
rhints(); break;
- case 12: /* magic messages */
+ case 12: /* magic messages */
rdesc(12);
break;
default:
printf("Invalid data section number: %d\n",sect);
for (;;) putchar(next());
}
- if (breakch!=LF) /* routines return after "-1" */
+ if (breakch!=LF) /* routines return after "-1" */
FLUSHLF;
}
}
@@ -252,47 +252,47 @@ rdata() /* "read" data from virtual file*/
char nbf[12];
-rnum() /* read initial location num */
+rnum() /* read initial location num */
{ register char *s;
- tape = iotape; /* restart encryption tape */
+ tape = iotape; /* restart encryption tape */
for (s=nbf,*s=0;; s++)
if ((*s=next())==TAB || *s=='\n' || *s==LF)
break;
- breakch= *s; /* save char for rtrav() */
- *s=0; /* got the number as ascii */
- if (nbf[0]=='-') return(-1); /* end of data */
- return(atoi(nbf)); /* convert it to integer */
+ breakch= *s; /* save char for rtrav() */
+ *s=0; /* got the number as ascii */
+ if (nbf[0]=='-') return(-1); /* end of data */
+ return(atoi(nbf)); /* convert it to integer */
}
char *seekhere;
-rdesc(sect) /* read description-format msgs */
+rdesc(sect) /* read description-format msgs */
int sect;
{ register char *s,*t;
register int locc;
char *seekstart, *maystart, *adrstart;
char *entry;
- seekhere = inptr; /* Where are we in virtual file?*/
- outsw=1; /* these msgs go into tmp file */
+ seekhere = inptr; /* Where are we in virtual file?*/
+ outsw=1; /* these msgs go into tmp file */
for (oldloc= -1, seekstart=seekhere;;)
- { maystart=inptr; /* maybe starting new entry */
+ { maystart=inptr; /* maybe starting new entry */
if ((locc=rnum())!=oldloc && oldloc>=0 /* finished msg */
&& ! (sect==5 && (locc==0 || locc>=100)))/* unless sect 5*/
{ switch(sect) /* now put it into right table */
- { case 1: /* long descriptions */
+ { case 1: /* long descriptions */
ltext[oldloc].seekadr=seekhere;
ltext[oldloc].txtlen=maystart-seekstart;
break;
- case 2: /* short descriptions */
+ case 2: /* short descriptions */
stext[oldloc].seekadr=seekhere;
stext[oldloc].txtlen=maystart-seekstart;
break;
- case 5: /* object descriptions */
+ case 5: /* object descriptions */
ptext[oldloc].seekadr=seekhere;
ptext[oldloc].txtlen=maystart-seekstart;
break;
- case 6: /* random messages */
+ case 6: /* random messages */
if (oldloc>RTXSIZ)
{ printf("Too many random msgs\n");
exit(0);
@@ -300,12 +300,12 @@ int sect;
rtext[oldloc].seekadr=seekhere;
rtext[oldloc].txtlen=maystart-seekstart;
break;
- case 10: /* class messages */
+ case 10: /* class messages */
ctext[clsses].seekadr=seekhere;
ctext[clsses].txtlen=maystart-seekstart;
cval[clsses++]=oldloc;
break;
- case 12: /* magic messages */
+ case 12: /* magic messages */
if (oldloc>MAGSIZ)
{ printf("Too many magic msgs\n");
exit(0);
@@ -320,8 +320,8 @@ int sect;
seekhere += maystart-seekstart;
}
if (locc<0)
- { outsw=0; /* turn off output */
- seekhere += 3; /* -1<delimiter> */
+ { outsw=0; /* turn off output */
+ seekhere += 3; /* -1<delimiter> */
return;
}
if (sect!=5 || (locc>0 && locc<100))
@@ -329,28 +329,28 @@ int sect;
seekstart=maystart;
oldloc=locc;
}
- FLUSHLF; /* scan the line */
+ FLUSHLF; /* scan the line */
}
}
-rtrav() /* read travel table */
+rtrav() /* read travel table */
{ register int locc;
register struct travlist *t;
register char *s;
char buf[12];
int len,m,n,entries;
- for (oldloc= -1;;) /* get another line */
+ for (oldloc= -1;;) /* get another line */
{ if ((locc=rnum())!=oldloc && oldloc>=0) /* end of entry */
{
t->next = 0; /* terminate the old entry */
/* printf("%d:%d entries\n",oldloc,entries); */
- /* twrite(oldloc); */
+ /* twrite(oldloc); */
}
if (locc== -1) return;
- if (locc!=oldloc) /* getting a new entry */
+ if (locc!=oldloc) /* getting a new entry */
{ t=travel[locc]=(struct travlist *) malloc(sizeof (struct travlist));
- /* printf("New travel list for %d\n",locc); */
+ /* printf("New travel list for %d\n",locc); */
entries=0;
oldloc=locc;
}
@@ -358,21 +358,21 @@ rtrav() /* read travel table */
if ((*s=next())==TAB || *s==LF) break;
*s=0;
len=length(buf)-1; /* quad long number handling */
- /* printf("Newloc: %s (%d chars)\n",buf,len); */
- if (len<4) /* no "m" conditions */
+ /* printf("Newloc: %s (%d chars)\n",buf,len); */
+ if (len<4) /* no "m" conditions */
{ m=0;
n=atoi(buf); /* newloc mod 1000 = newloc */
}
- else /* a long integer */
+ else /* a long integer */
{ n=atoi(buf+len-3);
- buf[len-3]=0; /* terminate newloc/1000 */
+ buf[len-3]=0; /* terminate newloc/1000 */
m=atoi(buf);
}
while (breakch!=LF) /* only do one line at a time */
{ if (entries++) t=t->next=(struct travlist *) malloc(sizeof (struct travlist));
t->tverb=rnum();/* get verb from the file */
- t->tloc=n; /* table entry mod 1000 */
- t->conditions=m;/* table entry / 1000 */
+ t->tloc=n; /* table entry mod 1000 */
+ t->conditions=m;/* table entry / 1000 */
/* printf("entry %d for %d\n",entries,locc); */
}
}
@@ -380,7 +380,7 @@ rtrav() /* read travel table */
#ifdef DEBUG
-twrite(loq) /* travel options from this loc */
+twrite(loq) /* travel options from this loc */
int loq;
{ register struct travlist *t;
printf("If");
@@ -401,13 +401,13 @@ int loq;
#endif DEBUG
rvoc()
-{ register char *s; /* read the vocabulary */
+{ register char *s; /* read the vocabulary */
register int index;
char buf[6];
for (;;)
{ index=rnum();
if (index<0) break;
- for (s=buf,*s=0;; s++) /* get the word */
+ for (s=buf,*s=0;; s++) /* get the word */
if ((*s=next())==TAB || *s=='\n' || *s==LF
|| *s==' ') break;
/* terminate word with newline, LF, tab, blank */
@@ -420,28 +420,28 @@ rvoc()
}
-rlocs() /* initial object locations */
+rlocs() /* initial object locations */
{ for (;;)
{ if ((obj=rnum())<0) break;
plac[obj]=rnum(); /* initial loc for this obj */
- if (breakch==TAB) /* there's another entry */
+ if (breakch==TAB) /* there's another entry */
fixd[obj]=rnum();
else fixd[obj]=0;
}
}
-rdflt() /* default verb messages */
+rdflt() /* default verb messages */
{ for (;;)
{ if ((verb=rnum())<0) break;
actspk[verb]=rnum();
}
}
-rliq() /* liquid assets &c: cond bits */
+rliq() /* liquid assets &c: cond bits */
{ register int bitnum;
- for (;;) /* read new bit list */
+ for (;;) /* read new bit list */
{ if ((bitnum=rnum())<0) break;
- for (;;) /* read locs for bits */
+ for (;;) /* read locs for bits */
{ cond[rnum()] |= setbit[bitnum];
if (breakch==LF) break;
}
@@ -480,10 +480,10 @@ struct text *msg;/* msg is a pointer to seek address and length of mess */
s = msg->seekadr;
nonfirst=0;
while (s - msg->seekadr < msg->txtlen) /* read a line at a time */
- { tape=iotape; /* restart decryption tape */
+ { tape=iotape; /* restart decryption tape */
while ((*s++ ^ *tape++) != TAB); /* read past loc num */
- /* assume tape is longer than location number */
- /* plus the lookahead put together */
+ /* assume tape is longer than location number */
+ /* plus the lookahead put together */
if ((*s ^ *tape) == '>' &&
(*(s+1) ^ *(tape+1)) == '$' &&
(*(s+2) ^ *(tape+2)) == '<') break;
@@ -496,8 +496,8 @@ struct text *msg;/* msg is a pointer to seek address and length of mess */
}
-pspeak(m,skip) /* read, decrypt an print a ptext message */
-int m; /* msg is the number of all the p msgs for this place */
+pspeak(m,skip) /* read, decrypt an print a ptext message */
+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;
@@ -512,11 +512,11 @@ int skip; /* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/
nonfirst=0;
while (s - tbuf < msg->txtlen) /* read line at a time */
- { tape=iotape; /* restart decryption tape */
+ { tape=iotape; /* restart decryption tape */
for (numst=s; (*s^= *tape++)!=TAB; s++); /* get number */
save = *s; /* Temporarily trash the string (cringe) */
- *s++ = 0; /* decrypting number within the string */
+ *s++ = 0; /* decrypting number within the string */
if (atoi(numst) != 100 * skip && skip >= 0)
{ while ((*s++^*tape++)!=LF) /* flush the line */
diff --git a/games/adventure/main.c b/games/adventure/main.c
index aa113f85c7c..ca72b7530d8 100644
--- a/games/adventure/main.c
+++ b/games/adventure/main.c
@@ -52,7 +52,7 @@ static char rcsid[] = "$NetBSD: main.c,v 1.5 1996/05/21 21:53:09 mrg Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: main program */
+/* Re-coding of advent in C: main program */
#include <sys/file.h>
#include <signal.h>
@@ -71,11 +71,11 @@ char **argv;
egid = getegid();
setegid(getgid());
- init(); /* Initialize everything */
+ init(); /* Initialize everything */
signal(SIGINT,trapdel);
if (argc > 1) /* Restore file specified */
- { /* Restart is label 8305 (Fortran) */
+ { /* Restart is label 8305 (Fortran) */
i = restore(argv[1]); /* See what we've got */
switch(i)
{
@@ -83,29 +83,29 @@ char **argv;
yea=Start(0);
k=null;
unlink(argv[1]);/* Don't re-use the save */
- goto l8; /* Get where we're going */
- case 1: /* Couldn't open it */
- exit(0); /* So give up */
- case 2: /* Oops -- file was altered */
+ goto l8; /* Get where we're going */
+ case 1: /* Couldn't open it */
+ exit(0); /* So give up */
+ case 2: /* Oops -- file was altered */
rspeak(202); /* You dissolve */
- exit(0); /* File could be non-adventure */
- } /* So don't unlink it. */
+ exit(0); /* File could be non-adventure */
+ } /* So don't unlink it. */
}
- startup(); /* prepare for a user */
+ startup(); /* prepare for a user */
- for (;;) /* main command loop (label 2) */
+ for (;;) /* main command loop (label 2) */
{ if (newloc<9 && newloc!=0 && closng)
{ rspeak(130); /* if closing leave only by */
- newloc=loc; /* main office */
+ newloc=loc; /* main office */
if (!panic) clock2=15;
panic=TRUE;
}
- rval=fdwarf(); /* dwarf stuff */
+ rval=fdwarf(); /* dwarf stuff */
if (rval==99) die(99);
- l2000: if (loc==0) die(99); /* label 2000 */
+ l2000: if (loc==0) die(99); /* label 2000 */
kk = &stext[loc];
if ((abb[loc]%abbnum)==0 || kk->seekadr==0)
kk = &ltext[loc];
@@ -116,7 +116,7 @@ char **argv;
}
kk = &rtext[16];
}
- l2001: if (toting(bear)) rspeak(141); /* 2001 */
+ l2001: if (toting(bear)) rspeak(141); /* 2001 */
speak(kk);
k=1;
if (forced(loc))
@@ -137,19 +137,19 @@ char **argv;
if (tally==tally2 && tally != 0)
if (limit>35) limit=35;
}
- ll = prop[obj]; /* 2006 */
+ ll = prop[obj]; /* 2006 */
if (obj==steps && loc==fixed[steps])
ll = 1;
pspeak(obj, ll);
- } /* 2008 */
+ } /* 2008 */
goto l2012;
- l2009: k=54; /* 2009 */
- l2010: spk=k;
- l2011: rspeak(spk);
+ l2009: k=54; /* 2009 */
+ l2010: spk=k;
+ l2011: rspeak(spk);
}
- l2012: verb=0; /* 2012 */
+ l2012: verb=0; /* 2012 */
obj=0;
- l2600: checkhints(); /* to 2600-2602 */
+ l2600: checkhints(); /* to 2600-2602 */
if (closed)
{ if (prop[oyster]<0 && toting(oyster))
pspeak(oyster,1);
@@ -157,16 +157,16 @@ char **argv;
if (toting(i)&&prop[i]<0) /*2604 */
prop[i] = -1-prop[i];
}
- wzdark=dark(0); /* 2605 */
+ wzdark=dark(0); /* 2605 */
if (knfloc>0 && knfloc!=loc) knfloc=1;
getin(&wd1,&wd2);
- if (delhit) /* user typed a DEL */
- { delhit=0; /* reset counter */
+ if (delhit) /* user typed a DEL */
+ { delhit=0; /* reset counter */
copystr("quit",wd1); /* pretend he's quitting*/
*wd2=0;
}
- l2608: if ((foobar = -foobar)>0) foobar=0; /* 2608 */
- /* should check here for "magic mode" */
+ l2608: if ((foobar = -foobar)>0) foobar=0; /* 2608 */
+ /* should check here for "magic mode" */
turns++;
if (demo && turns>=SHORT) done(1); /* to 13000 */
@@ -175,18 +175,18 @@ char **argv;
goto l4090;
if (tally==0 && loc>=15 && loc!=33) clock1--;
if (clock1==0)
- { closing(); /* to 10000 */
+ { closing(); /* to 10000 */
goto l19999;
}
if (clock1<0) clock2--;
if (clock2==0)
- { caveclose(); /* to 11000 */
- continue; /* back to 2 */
+ { caveclose(); /* to 11000 */
+ continue; /* back to 2 */
}
if (prop[lamp]==1) limit--;
if (limit<=30 && here(batter) && prop[batter]==0
&& here(lamp))
- { rspeak(188); /* 12000 */
+ { rspeak(188); /* 12000 */
prop[batter]=1;
if (toting(batter)) drop(batter,loc);
limit=limit+2500;
@@ -194,15 +194,15 @@ char **argv;
goto l19999;
}
if (limit==0)
- { limit = -1; /* 12400 */
+ { limit = -1; /* 12400 */
prop[lamp]=0;
rspeak(184);
goto l19999;
}
if (limit<0&&loc<=8)
- { rspeak(185); /* 12600 */
+ { rspeak(185); /* 12600 */
gaveup=TRUE;
- done(2); /* to 20000 */
+ done(2); /* to 20000 */
}
if (limit<=30)
{ if (lmwarn|| !here(lamp)) goto l19999; /*12200*/
@@ -227,7 +227,7 @@ char **argv;
if (++iwest==10) rspeak(17);
l2630: i=vocab(wd1,-1);
if (i== -1)
- { spk=60; /* 3000 */
+ { spk=60; /* 3000 */
if (pct(20)) spk=61;
if (pct(20)) spk=13;
rspeak(spk);
@@ -247,7 +247,7 @@ char **argv;
l8:
switch(march())
- { case 2: continue; /* i.e. goto l2 */
+ { case 2: continue; /* i.e. goto l2 */
case 99:
switch(die(99))
{ case 2000: goto l2000;
@@ -267,20 +267,20 @@ char **argv;
if (obj!=0) goto l4090;
l4080:
switch(verb)
- { case 1: /* take = 8010 */
+ { case 1: /* take = 8010 */
if (atloc[loc]==0||linkx[atloc[loc]]!=0) goto l8000;
for (i=1; i<=5; i++)
if (dloc[i]==loc&&dflag>=2) goto l8000;
obj=atloc[loc];
goto l9010;
case 2: case 3: case 9: /* 8000 : drop,say,wave */
- case 10: case 16: case 17: /* calm,rub,toss */
+ case 10: case 16: case 17: /* calm,rub,toss */
case 19: case 21: case 28: /* find,feed,break */
- case 29: /* wake */
+ case 29: /* wake */
l8000: printf("%s what?\n",wd1);
obj=0;
goto l2600;
- case 4: case 6: /* 8040 open,lock */
+ case 4: case 6: /* 8040 open,lock */
spk=28;
if (here(clam)) obj=clam;
if (here(oyster)) obj=oyster;
@@ -290,23 +290,23 @@ char **argv;
if (here(chain)) obj=chain;
if (obj==0) goto l2011;
goto l9040;
- case 5: goto l2009; /* nothing */
- case 7: goto l9070; /* on */
- case 8: goto l9080; /* off */
- case 11: goto l8000; /* walk */
- case 12: goto l9120; /* kill */
- case 13: goto l9130; /* pour */
- case 14: /* eat: 8140 */
+ case 5: goto l2009; /* nothing */
+ case 7: goto l9070; /* on */
+ case 8: goto l9080; /* off */
+ case 11: goto l8000; /* walk */
+ case 12: goto l9120; /* kill */
+ case 13: goto l9130; /* pour */
+ case 14: /* eat: 8140 */
if (!here(food)) goto l8000;
l8142: dstroy(food);
spk=72;
goto l2011;
- case 15: goto l9150; /* drink */
- case 18: /* quit: 8180 */
+ case 15: goto l9150; /* drink */
+ case 18: /* quit: 8180 */
gaveup=yes(22,54,54);
- if (gaveup) done(2); /* 8185 */
+ if (gaveup) done(2); /* 8185 */
goto l2012;
- case 20: /* invent=8200 */
+ case 20: /* invent=8200 */
spk=98;
for (i=1; i<=100; i++)
{ if (i!=bear && toting(i))
@@ -319,9 +319,9 @@ char **argv;
}
if (toting(bear)) spk=141;
goto l2011;
- case 22: goto l9220; /* fill */
- case 23: goto l9230; /* blast */
- case 24: /* score: 8240 */
+ case 22: goto l9220; /* fill */
+ case 23: goto l9230; /* blast */
+ case 24: /* score: 8240 */
scorng=TRUE;
printf("If you were to quit now, you would score");
printf(" %d out of a possible ",score());
@@ -330,7 +330,7 @@ char **argv;
gaveup=yes(143,54,54);
if (gaveup) done(2);
goto l2012;
- case 25: /* foo: 8250 */
+ case 25: /* foo: 8250 */
k=vocab(wd1,3);
spk=42;
if (foobar==1-k) goto l8252;
@@ -349,19 +349,19 @@ char **argv;
move(eggs,plac[eggs]);
pspeak(eggs,k);
goto l2012;
- case 26: /* brief=8260 */
+ case 26: /* brief=8260 */
spk=156;
abbnum=10000;
detail=3;
goto l2011;
- case 27: /* read=8270 */
+ case 27: /* read=8270 */
if (here(magzin)) obj=magzin;
if (here(tablet)) obj=obj*100+tablet;
if (here(messag)) obj=obj*100+messag;
if (closed&&toting(oyster)) obj=oyster;
if (obj>100||obj==0||dark(0)) goto l8000;
goto l9270;
- case 30: /* suspend=8300 */
+ case 30: /* suspend=8300 */
spk=201;
if (demo) goto l2011;
printf("I can suspend your adventure for you so");
@@ -370,9 +370,9 @@ char **argv;
printf(" %d minutes before continuing.",latncy);
if (!yes(200,54,54)) goto l2012;
datime(&saved,&savet);
- ciao(argv[0]); /* Do we quit? */
- continue; /* Maybe not */
- case 31: /* hours=8310 */
+ ciao(argv[0]); /* Do we quit? */
+ continue; /* Maybe not */
+ case 31: /* hours=8310 */
printf("Colossal cave is closed 9am-5pm Mon ");
printf("through Fri except holidays.\n");
goto l2012;
@@ -381,15 +381,15 @@ char **argv;
l4090:
switch(verb)
- { case 1: /* take = 9010 */
- l9010: switch(trtake())
+ { case 1: /* take = 9010 */
+ l9010: switch(trtake())
{ case 2011: goto l2011;
case 9220: goto l9220;
case 2009: goto l2009;
case 2012: goto l2012;
default: bug(102);
}
- l9020: case 2: /* drop = 9020 */
+ l9020: case 2: /* drop = 9020 */
switch(trdrop())
{ case 2011: goto l2011;
case 19000: done(3);
@@ -402,15 +402,15 @@ char **argv;
case 2630: goto l2630;
default: bug(107);
}
- l9040: case 4: case 6: /* open, close */
+ l9040: case 4: case 6: /* open, close */
switch(tropen())
{ case 2011: goto l2011;
case 2010: goto l2010;
default: bug(106);
}
- case 5: goto l2009; /* nothing */
- case 7: /* on 9070 */
- l9070: if (!here(lamp)) goto l2011;
+ case 5: goto l2009; /* nothing */
+ case 7: /* on 9070 */
+ l9070: if (!here(lamp)) goto l2011;
spk=184;
if (limit<0) goto l2011;
prop[lamp]=1;
@@ -418,14 +418,14 @@ char **argv;
if (wzdark) goto l2000;
goto l2012;
- case 8: /* off */
- l9080: if (!here(lamp)) goto l2011;
+ case 8: /* off */
+ l9080: if (!here(lamp)) goto l2011;
prop[lamp]=0;
rspeak(40);
if (dark(0)) rspeak(16);
goto l2012;
- case 9: /* wave */
+ case 9: /* wave */
if ((!toting(obj))&&(obj!=rod||!toting(rod2)))
spk=29;
if (obj!=rod||!at(fissur)||!toting(obj)||closng)
@@ -435,9 +435,9 @@ char **argv;
goto l2012;
case 10: case 11: case 18: /* calm, walk, quit */
case 24: case 25: case 26: /* score, foo, brief */
- case 30: case 31: /* suspend, hours */
+ case 30: case 31: /* suspend, hours */
goto l2011;
- l9120: case 12: /* kill */
+ l9120: case 12: /* kill */
switch(trkill())
{ case 8000: goto l8000;
case 8: goto l8;
@@ -446,7 +446,7 @@ char **argv;
case 19000: done(3);
default: bug(112);
}
- l9130: case 13: /* pour */
+ l9130: case 13: /* pour */
if (obj==bottle||obj==0) obj=liq(0);
if (obj==0) goto l8000;
if (!toting(obj)) goto l2011;
@@ -457,7 +457,7 @@ char **argv;
spk=77;
if (!(at(plant)||at(door))) goto l2011;
if (at(door))
- { prop[door]=0; /* 9132 */
+ { prop[door]=0; /* 9132 */
if (obj==oil) prop[door]=1;
spk=113+prop[door];
goto l2011;
@@ -469,13 +469,13 @@ char **argv;
prop[plant2]=prop[plant]/2;
k=null;
goto l8;
- case 14: /* 9140 - eat */
+ case 14: /* 9140 - eat */
if (obj==food) goto l8142;
if (obj==bird||obj==snake||obj==clam||obj==oyster
||obj==dwarf||obj==dragon||obj==troll
||obj==bear) spk=71;
goto l2011;
- l9150: case 15: /* 9150 - drink */
+ l9150: case 15: /* 9150 - drink */
if (obj==0&&liqloc(loc)!=water&&(liq(0)!=water
||!here(bottle))) goto l8000;
if (obj!=0&&obj!=water) spk=110;
@@ -485,10 +485,10 @@ char **argv;
place[water]=0;
spk=74;
goto l2011;
- case 16: /* 9160: rub */
+ case 16: /* 9160: rub */
if (obj!=lamp) spk=76;
goto l2011;
- case 17: /* 9170: throw */
+ case 17: /* 9170: throw */
switch(trtoss())
{ case 2011: goto l2011;
case 9020: goto l9020;
@@ -497,7 +497,7 @@ char **argv;
case 9210: goto l9210;
default: bug(113);
}
- case 19: case 20: /* 9190: find, invent */
+ case 19: case 20: /* 9190: find, invent */
if (at(obj)||(liq(0)==obj&&at(bottle))
||k==liqloc(loc)) spk=94;
for (i=1; i<=5; i++)
@@ -506,26 +506,26 @@ char **argv;
if (closed) spk=138;
if (toting(obj)) spk=24;
goto l2011;
- l9210: case 21: /* feed */
+ l9210: case 21: /* feed */
switch(trfeed())
{ case 2011: goto l2011;
default: bug(114);
}
- l9220: case 22: /* fill */
+ l9220: case 22: /* fill */
switch(trfill())
{ case 2011: goto l2011;
case 8000: goto l8000;
case 9020: goto l9020;
default: bug(115);
}
- l9230: case 23: /* blast */
+ l9230: case 23: /* blast */
if (prop[rod2]<0||!closed) goto l2011;
bonus=133;
if (loc==115) bonus=134;
if (here(rod2)) bonus=135;
rspeak(bonus);
done(2);
- l9270: case 27: /* read */
+ l9270: case 27: /* read */
if (dark(0)) goto l5190;
if (obj==magzin) spk=190;
if (obj==tablet) spk=196;
@@ -535,7 +535,7 @@ char **argv;
||!closed) goto l2011;
hinted[2]=yes(192,193,54);
goto l2012;
- l9280: case 28: /* break */
+ l9280: case 28: /* break */
if (obj==mirror) spk=148;
if (obj==vase&&prop[vase]==0)
{ spk=198;
@@ -548,7 +548,7 @@ char **argv;
rspeak(197);
done(3);
- l9290: case 29: /* wake */
+ l9290: case 29: /* wake */
if (obj!=dwarf||!closed) goto l2011;
rspeak(199);
done(3);
diff --git a/games/adventure/save.c b/games/adventure/save.c
index 77f36f09c3d..f4bbb5c2660 100644
--- a/games/adventure/save.c
+++ b/games/adventure/save.c
@@ -59,66 +59,66 @@ struct savestruct
struct savestruct save_array[] =
{
- &abbnum, sizeof(abbnum),
- &attack, sizeof(attack),
- &blklin, sizeof(blklin),
- &bonus, sizeof(bonus),
- &chloc, sizeof(chloc),
- &chloc2, sizeof(chloc2),
- &clock1, sizeof(clock1),
- &clock2, sizeof(clock2),
- &closed, sizeof(closed),
- &closng, sizeof(closng),
- &daltlc, sizeof(daltlc),
- &demo, sizeof(demo),
- &detail, sizeof(detail),
- &dflag, sizeof(dflag),
- &dkill, sizeof(dkill),
- &dtotal, sizeof(dtotal),
- &foobar, sizeof(foobar),
- &gaveup, sizeof(gaveup),
- &holdng, sizeof(holdng),
- &iwest, sizeof(iwest),
- &k, sizeof(k),
- &k2, sizeof(k2),
- &knfloc, sizeof(knfloc),
- &kq, sizeof(kq),
- &latncy, sizeof(latncy),
- &limit, sizeof(limit),
- &lmwarn, sizeof(lmwarn),
- &loc, sizeof(loc),
- &maxdie, sizeof(maxdie),
- &mxscor, sizeof(mxscor),
- &newloc, sizeof(newloc),
- &numdie, sizeof(numdie),
- &obj, sizeof(obj),
- &oldlc2, sizeof(oldlc2),
- &oldloc, sizeof(oldloc),
- &panic, sizeof(panic),
- &saved, sizeof(saved),
- &savet, sizeof(savet),
- &scorng, sizeof(scorng),
- &spk, sizeof(spk),
- &stick, sizeof(stick),
- &tally, sizeof(tally),
- &tally2, sizeof(tally2),
- &tkk, sizeof(tkk),
- &turns, sizeof(turns),
- &verb, sizeof(verb),
- &wd1, sizeof(wd1),
- &wd2, sizeof(wd2),
- &wzdark, sizeof(wzdark),
- &yea, sizeof(yea),
- atloc, sizeof(atloc),
- dloc, sizeof(dloc),
- dseen, sizeof(dseen),
- fixed, sizeof(fixed),
- hinted, sizeof(hinted),
- linkx, sizeof(linkx),
- odloc, sizeof(odloc),
- place, sizeof(place),
- prop, sizeof(prop),
- tk, sizeof(tk),
+ &abbnum, sizeof(abbnum),
+ &attack, sizeof(attack),
+ &blklin, sizeof(blklin),
+ &bonus, sizeof(bonus),
+ &chloc, sizeof(chloc),
+ &chloc2, sizeof(chloc2),
+ &clock1, sizeof(clock1),
+ &clock2, sizeof(clock2),
+ &closed, sizeof(closed),
+ &closng, sizeof(closng),
+ &daltlc, sizeof(daltlc),
+ &demo, sizeof(demo),
+ &detail, sizeof(detail),
+ &dflag, sizeof(dflag),
+ &dkill, sizeof(dkill),
+ &dtotal, sizeof(dtotal),
+ &foobar, sizeof(foobar),
+ &gaveup, sizeof(gaveup),
+ &holdng, sizeof(holdng),
+ &iwest, sizeof(iwest),
+ &k, sizeof(k),
+ &k2, sizeof(k2),
+ &knfloc, sizeof(knfloc),
+ &kq, sizeof(kq),
+ &latncy, sizeof(latncy),
+ &limit, sizeof(limit),
+ &lmwarn, sizeof(lmwarn),
+ &loc, sizeof(loc),
+ &maxdie, sizeof(maxdie),
+ &mxscor, sizeof(mxscor),
+ &newloc, sizeof(newloc),
+ &numdie, sizeof(numdie),
+ &obj, sizeof(obj),
+ &oldlc2, sizeof(oldlc2),
+ &oldloc, sizeof(oldloc),
+ &panic, sizeof(panic),
+ &saved, sizeof(saved),
+ &savet, sizeof(savet),
+ &scorng, sizeof(scorng),
+ &spk, sizeof(spk),
+ &stick, sizeof(stick),
+ &tally, sizeof(tally),
+ &tally2, sizeof(tally2),
+ &tkk, sizeof(tkk),
+ &turns, sizeof(turns),
+ &verb, sizeof(verb),
+ &wd1, sizeof(wd1),
+ &wd2, sizeof(wd2),
+ &wzdark, sizeof(wzdark),
+ &yea, sizeof(yea),
+ atloc, sizeof(atloc),
+ dloc, sizeof(dloc),
+ dseen, sizeof(dseen),
+ fixed, sizeof(fixed),
+ hinted, sizeof(hinted),
+ linkx, sizeof(linkx),
+ odloc, sizeof(odloc),
+ place, sizeof(place),
+ prop, sizeof(prop),
+ tk, sizeof(tk),
NULL, 0
};
@@ -179,7 +179,7 @@ char *infile;
}
setegid(getgid());
- fread(&sum, sizeof(sum), 1, in); /* Get the seed */
+ fread(&sum, sizeof(sum), 1, in); /* Get the seed */
srandom((int) sum);
for (p = save_array; p->address != NULL; p++)
{
@@ -189,11 +189,11 @@ char *infile;
}
fclose(in);
- crc_start(); /* See if she cheated */
+ crc_start(); /* See if she cheated */
for (p = save_array; p->address != NULL; p++)
cksum = crc(p->address, p->width);
- if (sum != cksum) /* Tsk tsk */
- return 2; /* Altered the file */
+ if (sum != cksum) /* Tsk tsk */
+ return 2; /* Altered the file */
/* We successfully restored, so this really was a save file */
/* Get rid of the file, but don't bother checking that we did */
return 0;
diff --git a/games/adventure/setup.c b/games/adventure/setup.c
index c5c4a96c182..a5a520c07b7 100644
--- a/games/adventure/setup.c
+++ b/games/adventure/setup.c
@@ -64,7 +64,7 @@ static char rcsid[] = "$NetBSD: setup.c,v 1.2 1995/03/21 12:05:10 cgd Exp $";
#define SIG2 " * Sterday, 6 Thrimidge S.R. 1993, 15:24"
#include <stdio.h>
-#include "hdr.h" /* SEED lives in there; keep them coordinated. */
+#include "hdr.h" /* SEED lives in there; keep them coordinated. */
#define USAGE "Usage: setup file > data.c (file is typically glorkz)\n"
@@ -73,7 +73,7 @@ static char rcsid[] = "$NetBSD: setup.c,v 1.2 1995/03/21 12:05:10 cgd Exp $";
void fatal();
-#define LINE 10 /* How many values do we get on a line? */
+#define LINE 10 /* How many values do we get on a line? */
main(argc, argv)
int argc;
diff --git a/games/adventure/subr.c b/games/adventure/subr.c
index 9ee6d6f728b..4101c3223b6 100644
--- a/games/adventure/subr.c
+++ b/games/adventure/subr.c
@@ -46,11 +46,11 @@ static char rcsid[] = "$NetBSD: subr.c,v 1.2 1995/03/21 12:05:11 cgd Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: subroutines from main */
+/* Re-coding of advent in C: subroutines from main */
# include "hdr.h"
-/* Statement functions */
+/* Statement functions */
toting(objj)
int objj;
{ if (place[objj] == -1) return(TRUE);
@@ -150,7 +150,7 @@ fdwarf() /* 71 */
return(2000);
}
dtotal=attack=stick=0; /* 6010 */
- for (i=1; i<=6; i++) /* loop to 6030 */
+ for (i=1; i<=6; i++) /* loop to 6030 */
{ if (dloc[i]==0) continue;
j=1;
for (kk=travel[dloc[i]]; kk!=0; kk=kk->next)
@@ -162,15 +162,15 @@ fdwarf() /* 71 */
||kk->conditions==100) continue;
tk[j++]=newloc;
}
- tk[j]=odloc[i]; /* 6016 */
+ tk[j]=odloc[i]; /* 6016 */
if (j>=2) j--;
j=1+ran(j);
odloc[i]=dloc[i];
dloc[i]=tk[j];
dseen[i]=(dseen[i]&&loc>=15)||(dloc[i]==loc||odloc[i]==loc);
- if (!dseen[i]) continue; /* i.e. goto 6030 */
+ if (!dseen[i]) continue; /* i.e. goto 6030 */
dloc[i]=loc;
- if (i==6) /* pirate's spotted him */
+ if (i==6) /* pirate's spotted him */
{ if (loc==chloc||prop[chest]>=0) continue;
k=0;
for (j=50; j<=maxtrs; j++) /* loop to 6020 */
@@ -178,7 +178,7 @@ fdwarf() /* 71 */
|| loc==plac[emrald])) goto l6020;
if (toting(j)) goto l6022;
l6020: if (here(j)) k=1;
- } /* 6020 */
+ } /* 6020 */
if (tally==tally2+1 && k==0 && place[chest]==0
&&here(lamp) && prop[lamp]==1) goto l6025;
if (odloc[6]!=dloc[6]&&pct(20))
@@ -201,12 +201,12 @@ fdwarf() /* 71 */
move(messag,chloc2);
goto l6024;
}
- dtotal++; /* 6027 */
+ dtotal++; /* 6027 */
if (odloc[i]!=dloc[i]) continue;
attack++;
if (knfloc>=0) knfloc=loc;
if (ran(1000)<95*(dflag-2)) stick++;
- } /* 6030 */
+ } /* 6030 */
if (dtotal==0) return(2000);
if (dtotal!=1)
{ printf("There are %d threatening little dwarves ",dtotal);
@@ -219,7 +219,7 @@ fdwarf() /* 71 */
if (attack!=1)
{ printf("%d of them throw knives at you!\n",attack);
k=6;
- l82: if (stick<=1) /* 82 */
+ l82: if (stick<=1) /* 82 */
{ rspeak(k+stick);
if (stick==0) return(2000);
}
@@ -234,23 +234,23 @@ fdwarf() /* 71 */
}
-march() /* label 8 */
+march() /* label 8 */
{ register int ll1,ll2;
if ((tkk=travel[newloc=loc])==0) bug(26);
if (k==null) return(2);
- if (k==cave) /* 40 */
+ if (k==cave) /* 40 */
{ if (loc<8) rspeak(57);
if (loc>=8) rspeak(58);
return(2);
}
- if (k==look) /* 30 */
+ if (k==look) /* 30 */
{ if (detail++<3) rspeak(15);
wzdark=FALSE;
abb[loc]=0;
return(2);
}
- if (k==back) /* 20 */
+ if (k==back) /* 20 */
{ switch(mback())
{ case 2: return(2);
case 9: goto l9;
@@ -266,17 +266,17 @@ l9:
{ badmove();
return(2);
}
-l11: ll1=tkk->conditions; /* 11 */
+l11: ll1=tkk->conditions; /* 11 */
ll2=tkk->tloc;
- newloc=ll1; /* newloc=conditions */
- k=newloc%100; /* k used for prob */
+ newloc=ll1; /* newloc=conditions */
+ k=newloc%100; /* k used for prob */
if (newloc<=300)
- { if (newloc<=100) /* 13 */
+ { if (newloc<=100) /* 13 */
{ if (newloc!=0&&!pct(newloc)) goto l12; /* 14 */
- l16: newloc=ll2; /* newloc=location */
+ l16: newloc=ll2; /* newloc=location */
if (newloc<=300) return(2);
if (newloc<=500)
- switch(specials())/* to 30000 */
+ switch(specials())/* to 30000 */
{ case 2: return(2);
case 12: goto l12;
case 99: return(99);
@@ -299,10 +299,10 @@ l12: /* alternative to probability move */
-mback() /* 20 */
+mback() /* 20 */
{ register struct travlist *tk2,*j;
register int ll;
- if (forced(k=oldloc)) k=oldlc2; /* k=location */
+ if (forced(k=oldloc)) k=oldlc2; /* k=location */
oldlc2=oldloc;
oldloc=loc;
tk2=0;
@@ -310,10 +310,10 @@ mback() /* 20 */
{ rspeak(91);
return(2);
}
- for (; tkk!=0; tkk=tkk->next) /* 21 */
+ for (; tkk!=0; tkk=tkk->next) /* 21 */
{ ll=tkk->tloc;
if (ll==k)
- { k=tkk->tverb; /* k back to verb */
+ { k=tkk->tverb; /* k back to verb */
tkk=travel[loc];
return(9);
}
@@ -322,7 +322,7 @@ mback() /* 20 */
if (forced(ll) && k==j->tloc) tk2=tkk;
}
}
- tkk=tk2; /* 23 */
+ tkk=tk2; /* 23 */
if (tkk!=0)
{ k=tkk->tverb;
tkk=travel[loc];
@@ -333,25 +333,25 @@ mback() /* 20 */
}
-specials() /* 30000 */
+specials() /* 30000 */
{ switch(newloc -= 300)
- { case 1: /* 30100 */
+ { case 1: /* 30100 */
newloc = 99+100-loc;
if (holdng==0||(holdng==1&&toting(emrald))) return(2);
newloc=loc;
rspeak(117);
return(2);
- case 2: /* 30200 */
+ case 2: /* 30200 */
drop(emrald,loc);
return(12);
- case 3: /* to 30300 */
+ case 3: /* to 30300 */
return(trbridge());
default: bug(29);
}
}
-trbridge() /* 30300 */
+trbridge() /* 30300 */
{ if (prop[troll]==1)
{ pspeak(troll,1);
prop[troll]=0;
@@ -363,7 +363,7 @@ trbridge() /* 30300 */
newloc=loc;
return(2);
}
- newloc=plac[troll]+fixd[troll]-loc; /* 30310 */
+ newloc=plac[troll]+fixd[troll]-loc; /* 30310 */
if (prop[troll]==0) prop[troll]=1;
if (!toting(bear)) return(2);
rspeak(162);
@@ -378,7 +378,7 @@ trbridge() /* 30300 */
}
-badmove() /* 20 */
+badmove() /* 20 */
{ spk=12;
if (k>=43 && k<=50) spk=9;
if (k==29||k==30) spk=9;
@@ -398,7 +398,7 @@ int n;
}
-checkhints() /* 2600 &c */
+checkhints() /* 2600 &c */
{ register int hint;
for (hint=4; hint<=hntmax; hint++)
{ if (hinted[hint]) continue;
@@ -436,7 +436,7 @@ checkhints() /* 2600 &c */
}
-trsay() /* 9030 */
+trsay() /* 9030 */
{ register int i;
if (*wd2!=0) copystr(wd2,wd1);
i=vocab(wd1,-1);
@@ -450,7 +450,7 @@ trsay() /* 9030 */
}
-trtake() /* 9010 */
+trtake() /* 9010 */
{ register int i;
if (toting(obj)) return(2011); /* 9010 */
spk=25;
@@ -484,7 +484,7 @@ l9017: if (holdng>=7)
{ rspeak(27);
return(2012);
}
- prop[bird]=1; /* 9015 */
+ prop[bird]=1; /* 9015 */
}
l9014: if ((obj==bird||obj==cage)&&prop[bird]!=0)
carry(bird+cage-obj,loc);
@@ -495,7 +495,7 @@ l9014: if ((obj==bird||obj==cage)&&prop[bird]!=0)
}
-dropper() /* 9021 */
+dropper() /* 9021 */
{ k=liq(0);
if (k==obj) obj=bottle;
if (obj==bottle&&k!=0) place[k]=0;
@@ -505,7 +505,7 @@ dropper() /* 9021 */
return(2012);
}
-trdrop() /* 9020 */
+trdrop() /* 9020 */
{
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011);
@@ -516,20 +516,20 @@ trdrop() /* 9020 */
prop[snake]=1;
return(dropper());
}
- if (obj==coins&&here(vend)) /* 9024 */
+ if (obj==coins&&here(vend)) /* 9024 */
{ dstroy(coins);
drop(batter,loc);
pspeak(batter,0);
return(2012);
}
- if (obj==bird&&at(dragon)&&prop[dragon]==0) /* 9025 */
+ if (obj==bird&&at(dragon)&&prop[dragon]==0) /* 9025 */
{ rspeak(154);
dstroy(bird);
prop[bird]=0;
if (place[snake]==plac[snake]) tally2--;
return(2012);
}
- if (obj==bear&&at(troll)) /* 9026 */
+ if (obj==bear&&at(troll)) /* 9026 */
{ rspeak(163);
move(troll,0);
move(troll+100,0);
@@ -539,11 +539,11 @@ trdrop() /* 9020 */
prop[troll]=2;
return(dropper());
}
- if (obj!=vase||loc==plac[pillow]) /* 9027 */
+ if (obj!=vase||loc==plac[pillow]) /* 9027 */
{ rspeak(54);
return(dropper());
}
- prop[vase]=2; /* 9028 */
+ prop[vase]=2; /* 9028 */
if (at(pillow)) prop[vase]=0;
pspeak(vase,prop[vase]+1);
if (prop[vase]!=0) fixed[vase] = -1;
@@ -551,9 +551,9 @@ trdrop() /* 9020 */
}
-tropen() /* 9040 */
+tropen() /* 9040 */
{ if (obj==clam||obj==oyster)
- { k=0; /* 9046 */
+ { k=0; /* 9046 */
if (obj==oyster) k=1;
spk=124+k;
if (toting(obj)) spk=120+k;
@@ -573,7 +573,7 @@ tropen() /* 9040 */
if (spk!=31||!here(keys)) return(2011);
if (obj==chain)
{ if (verb==lock)
- { spk=172; /* 9049: lock */
+ { spk=172; /* 9049: lock */
if (prop[chain]!=0) spk=34;
if (loc!=plac[chain]) spk=173;
if (spk!=172) return(2011);
@@ -598,7 +598,7 @@ tropen() /* 9040 */
panic=TRUE;
return(2010);
}
- k=34+prop[grate]; /* 9043 */
+ k=34+prop[grate]; /* 9043 */
prop[grate]=1;
if (verb==lock) prop[grate]=0;
k=k+2*prop[grate];
@@ -606,12 +606,12 @@ tropen() /* 9040 */
}
-trkill() /* 9120 */
+trkill() /* 9120 */
{ register int i;
for (i=1; i<=5; i++)
if (dloc[i]==loc&&dflag>=2) break;
if (i==6) i=0;
- if (obj==0) /* 9122 */
+ if (obj==0) /* 9122 */
{ if (i!=0) obj=dwarf;
if (here(snake)) obj=obj*100+snake;
if (at(dragon)&&prop[dragon]==0) obj=obj*100+dragon;
@@ -624,7 +624,7 @@ trkill() /* 9120 */
if (obj>100) return(8000);
}
}
- if (obj==bird) /* 9124 */
+ if (obj==bird) /* 9124 */
{ spk=137;
if (closed) return(2011);
dstroy(bird);
@@ -632,7 +632,7 @@ trkill() /* 9120 */
if (place[snake]==plac[snake]) tally2++;
spk=45;
}
- if (obj==0) spk=44; /* 9125 */
+ if (obj==0) spk=44; /* 9125 */
if (obj==clam||obj==oyster) spk=150;
if (obj==snake) spk=46;
if (obj==dwarf) spk=49;
@@ -663,12 +663,12 @@ trkill() /* 9120 */
}
-trtoss() /* 9170: throw */
+trtoss() /* 9170: throw */
{ register int i;
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011);
if (obj>=50&&obj<=maxtrs&&at(troll))
- { spk=159; /* 9178 */
+ { spk=159; /* 9178 */
drop(obj,0);
move(troll,0);
move(troll+100,0);
@@ -678,13 +678,13 @@ trtoss() /* 9170: throw */
return(2011);
}
if (obj==food&&here(bear))
- { obj=bear; /* 9177 */
+ { obj=bear; /* 9177 */
return(9210);
}
if (obj!=axe) return(9020);
for (i=1; i<=5; i++)
{ if (dloc[i]==loc)
- { spk=48; /* 9172 */
+ { spk=48; /* 9172 */
if (ran(3)==0||saved!= -1)
l9175: { rspeak(spk);
drop(axe,loc);
@@ -717,7 +717,7 @@ trtoss() /* 9170: throw */
}
-trfeed() /* 9210 */
+trfeed() /* 9210 */
{ if (obj==bird)
{ spk=100;
return(2011);
@@ -755,7 +755,7 @@ trfeed() /* 9210 */
}
-trfill() /* 9220 */
+trfill() /* 9220 */
{ if (obj==vase)
{ spk=29;
if (liqloc(loc)==0) spk=144;
@@ -763,7 +763,7 @@ trfill() /* 9220 */
rspeak(145);
prop[vase]=2;
fixed[vase]= -1;
- return(9020); /* advent/10 goes to 9024 */
+ return(9020); /* advent/10 goes to 9024 */
}
if (obj!=0&&obj!=bottle) return(2011);
if (obj==0&&!here(bottle)) return(8000);
@@ -779,7 +779,7 @@ trfill() /* 9220 */
}
-closing() /* 10000 */
+closing() /* 10000 */
{ register int i;
prop[grate]=prop[fissur]=0;
@@ -804,7 +804,7 @@ closing() /* 10000 */
}
-caveclose() /* 11000 */
+caveclose() /* 11000 */
{ register int i;
prop[bottle]=put(bottle,115,1);
prop[plant]=put(plant,115,0);
diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c
index 84478182c2a..404c258af69 100644
--- a/games/adventure/vocab.c
+++ b/games/adventure/vocab.c
@@ -46,7 +46,7 @@ static char rcsid[] = "$NetBSD: vocab.c,v 1.2 1995/03/21 12:05:13 cgd Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: data structure routines */
+/* Re-coding of advent in C: data structure routines */
#include <stdlib.h>
#include "hdr.h"
@@ -117,26 +117,26 @@ int object,where;
}
-vocab(word,type,value) /* look up or store a word */
+vocab(word,type,value) /* look up or store a word */
char *word;
int type; /* -2 for store, -1 for user word, >=0 for canned lookup*/
-int value; /* used for storing only */
+int value; /* used for storing only */
{ register int adr;
register char *s,*t;
int hash, i;
struct hashtab *h;
for (hash=0,s=word,i=0; i<5 &&*s; i++) /* some kind of hash */
- hash += *s++; /* add all chars in the word */
+ hash += *s++; /* add all chars in the word */
hash = (hash*3719)&077777; /* pulled that one out of a hat */
- hash %= HTSIZE; /* put it into range of table */
+ hash %= HTSIZE; /* put it into range of table */
- for(adr=hash;; adr++) /* look for entry in table */
- { if (adr==HTSIZE) adr=0; /* wrap around */
- h = &voc[adr]; /* point at the entry */
+ for(adr=hash;; adr++) /* look for entry in table */
+ { if (adr==HTSIZE) adr=0; /* wrap around */
+ h = &voc[adr]; /* point at the entry */
switch(type)
- { case -2: /* fill in entry */
- if (h->val) /* already got an entry? */
+ { case -2: /* fill in entry */
+ if (h->val) /* already got an entry? */
goto exitloop2;
h->val=value;
h->atab=malloc(length(word));
@@ -145,29 +145,29 @@ int value; /* used for storing only */
*t=0^'=';
/* encrypt slightly to thwart core reader */
/* printf("Stored \"%s\" (%d ch) as entry %d\n", */
- /* word, length(word), adr); */
- return(0); /* entry unused */
- case -1: /* looking up user word */
+ /* word, length(word), adr); */
+ return(0); /* entry unused */
+ case -1: /* looking up user word */
if (h->val==0) return(-1); /* not found */
for (s=word, t=h->atab;*t ^ '=';)
if ((*s++ ^ '=') != *t++)
goto exitloop2;
if ((*s ^ '=') != *t && s-word<5) goto exitloop2;
- /* the word matched o.k. */
+ /* the word matched o.k. */
return(h->val);
- default: /* looking up known word */
+ default: /* looking up known word */
if (h->val==0)
{ printf("Unable to find %s in vocab\n",word);
exit(0);
}
for (s=word, t=h->atab;*t ^ '=';)
if ((*s++ ^ '=') != *t++) goto exitloop2;
- /* the word matched o.k. */
+ /* the word matched o.k. */
if (h->val/1000 != type) continue;
return(h->val%1000);
}
- exitloop2: /* hashed entry does not match */
+ exitloop2: /* hashed entry does not match */
if (adr+1==hash || (adr==HTSIZE && hash==0))
{ printf("Hash table overflow\n");
exit(0);
@@ -176,7 +176,7 @@ int value; /* used for storing only */
}
-copystr(w1,w2) /* copy one string to another */
+copystr(w1,w2) /* copy one string to another */
char *w1,*w2;
{ register char *s,*t;
for (s=w1,t=w2; *s;)
@@ -184,13 +184,13 @@ char *w1,*w2;
*t=0;
}
-weq(w1,w2) /* compare words */
-char *w1,*w2; /* w1 is user, w2 is system */
+weq(w1,w2) /* compare words */
+char *w1,*w2; /* w1 is user, w2 is system */
{ register char *s,*t;
register int i;
s=w1;
t=w2;
- for (i=0; i<5; i++) /* compare at most 5 chars */
+ for (i=0; i<5; i++) /* compare at most 5 chars */
{ if (*t==0 && *s==0)
return(TRUE);
if (*s++ != *t++) return(FALSE);
@@ -199,7 +199,7 @@ char *w1,*w2; /* w1 is user, w2 is system */
}
-length(str) /* includes 0 at end */
+length(str) /* includes 0 at end */
char *str;
{ register char *s;
register int n;
@@ -207,7 +207,7 @@ char *str;
return(n+1);
}
-prht() /* print hash table */
+prht() /* print hash table */
{ register int i,j,l;
char *c;
struct hashtab *h;
diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c
index aad20539674..c01a76509e2 100644
--- a/games/adventure/wizard.c
+++ b/games/adventure/wizard.c
@@ -46,7 +46,7 @@ static char rcsid[] = "$NetBSD: wizard.c,v 1.3 1995/04/24 12:21:41 cgd Exp $";
#endif
#endif /* not lint */
-/* Re-coding of advent in C: privileged operations */
+/* Re-coding of advent in C: privileged operations */
# include "hdr.h"
#include <string.h>
@@ -59,10 +59,10 @@ int *d,*t;
time(tvec);
tptr=(int *)localtime(tvec);
*d=tptr[7]+365*(tptr[5]-77); /* day since 1977 (mod leap) */
- /* bug: this will overflow in the year 2066 AD */
+ /* bug: this will overflow in the year 2066 AD */
/* it will be attributed to Wm the C's millenial celebration */
- *t=tptr[2]*60+tptr[1]; /* and minutes since midnite */
-} /* pretty painless */
+ *t=tptr[2]*60+tptr[1]; /* and minutes since midnite */
+} /* pretty painless */
char magic[6];
@@ -98,7 +98,7 @@ Start(n)
return(FALSE);
}
-wizard() /* not as complex as advent/10 (for now) */
+wizard() /* not as complex as advent/10 (for now) */
{ register int wiz;
char *word,*x;
if (!yesm(16,0,7)) return(FALSE);
@@ -123,7 +123,7 @@ char *cmdfile;
for (c=fname;; c++)
if ((*c=getchar())=='\n' || *c == EOF) break;
*c=0;
- if (save(fname) != 0) return; /* Save failed */
+ if (save(fname) != 0) return; /* Save failed */
printf("To resume, say \"adventure %s\".\n", fname);
printf("\"With these rooms I might now have been familiarly acquainted.\"\n");
exit(0);