X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/7a7d157b6dfb2274277e61ea5f1c8a97e88e73ba..e2fc204ddc36cdded5693d299f4f5c8b04c464c0:/adventure/init.c diff --git a/adventure/init.c b/adventure/init.c index 8b2252cc..5269b96c 100644 --- a/adventure/init.c +++ b/adventure/init.c @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.7 1997/10/11 01:53:28 lukem Exp $ */ +/* $NetBSD: init.c,v 1.17 2007/12/15 19:44:38 perry Exp $ */ /*- * Copyright (c) 1993 @@ -17,11 +17,7 @@ * 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 + * 3. 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. * @@ -43,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93"; #else -__RCSID("$NetBSD: init.c,v 1.7 1997/10/11 01:53:28 lukem Exp $"); +__RCSID("$NetBSD: init.c,v 1.17 2007/12/15 19:44:38 perry Exp $"); #endif #endif /* not lint */ @@ -53,28 +49,93 @@ __RCSID("$NetBSD: init.c,v 1.7 1997/10/11 01:53:28 lukem Exp $"); #include #include #include +#include #include + #include "hdr.h" #include "extern.h" int blklin = TRUE; -int setbit[16] = {1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000, 04000, -010000, 020000, 040000, 0100000}; +int setbit[16] = {1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000, + 04000, 010000, 020000, 040000, 0100000}; + +int datfd; /* message file descriptor */ +volatile sig_atomic_t delhit; +int yea; + +int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2; +char *wd1, *wd2; /* the complete words */ +int verb, obj, spk; +int saveday, savet, mxscor, latncy; + +struct hashtab voc[HTSIZE]; + +struct text rtext[RTXSIZ]; /* random text messages */ + +struct text mtext[MAGSIZ]; /* magic messages */ + +int clsses; + +struct text ctext[CLSMAX]; /* classes of adventurer */ +int cval[CLSMAX]; + +struct text ptext[101]; /* object descriptions */ + +struct text ltext[LOCSIZ]; /* long loc description */ +struct text stext[LOCSIZ]; /* short loc descriptions */ + +struct travlist *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 actspk[35]; /* rtext msg for verb */ + +int cond[LOCSIZ]; /* various condition bits */ + +int hntmax; +int hints[20][5]; /* info on hints */ +int hinted[20], hintlc[20]; + +int place[101], prop[101], links[201]; +int abb[LOCSIZ]; + +int maxtrs, tally, tally2; /* treasure values */ + +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, 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 */ + odloc[7], dflag, daltlc; + +int tk[21], stick, dtotal, attack; +int turns, lmwarn, iwest, knfloc, detail, /* various flags and + * counters */ + abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1, + clock2, saved, closng, panic, closed, scorng; + +int demo, limit; + +/* everything for 1st time run */ void -init(command) /* everything for 1st time run */ - char *command; /* command we were called with */ +init(void) { rdata(); /* read data from orig. file */ linkdata(); poof(); } -char * -decr(a, b, c, d, e) - char a, b, c, d, e; +char * +decr(int a, int b, int c, int d, int e) { static char buf[6]; @@ -88,12 +149,12 @@ decr(a, b, c, d, e) } void -linkdata() +linkdata(void) { /* secondary data manipulation */ int i, j; /* array linkages */ - for (i = 1; i <= LOCSIZ; i++) + for (i = 1; i < LOCSIZ; i++) if (ltext[i].seekadr != 0 && travel[i] != 0) if ((travel[i]->tverb) == 1) cond[i] = 2; @@ -212,21 +273,19 @@ linkdata() closng = panic = closed = scorng = FALSE; } - - +/* come here if he hits a del */ void -trapdel(n) /* come here if he hits a del */ - int n; +trapdel(int n __unused) { - delhit++; /* main checks, treats as QUIT */ + delhit = 1; /* main checks, treats as QUIT */ signal(SIGINT, trapdel);/* catch subsequent DELs */ } void -startup() +startup(void) { - demo = Start(0); + demo = Start(); srand((int) (time((time_t *) NULL))); /* random seed */ #if 0 srand(371); /* non-random seed */