summaryrefslogtreecommitdiff
path: root/games/adventure
diff options
context:
space:
mode:
Diffstat (limited to 'games/adventure')
-rw-r--r--games/adventure/hdr.h83
-rw-r--r--games/adventure/main.c68
2 files changed, 112 insertions, 39 deletions
diff --git a/games/adventure/hdr.h b/games/adventure/hdr.h
index 063b145363d..3d954964a22 100644
--- a/games/adventure/hdr.h
+++ b/games/adventure/hdr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdr.h,v 1.17 2017/05/19 08:22:53 tb Exp $ */
+/* $OpenBSD: hdr.h,v 1.18 2021/01/27 01:59:39 deraadt Exp $ */
/* $NetBSD: hdr.h,v 1.2 1995/03/21 12:05:02 cgd Exp $ */
/*-
@@ -56,9 +56,9 @@
#include <signal.h>
-int datfd; /* message file descriptor */
-volatile sig_atomic_t delhit;
-int yea;
+extern int datfd; /* message file descriptor */
+extern volatile sig_atomic_t delhit;
+extern int yea;
extern char data_file[]; /* Virtual data file */
#define TAB 011
@@ -66,23 +66,24 @@ extern char data_file[]; /* Virtual data file */
#define FLUSHLINE do { int c; while ((c = getchar()) != EOF && c != '\n'); } while (0)
#define FLUSHLF while (next()!=LF)
-int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
-int verb, obj, spk;
+extern int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
+extern int verb, obj, spk;
extern int blklin;
-time_t savet;
-int mxscor, latncy;
+extern time_t savet;
+extern int mxscor, latncy;
#define SHORT 50 /* How short is a demo game? */
#define MAXSTR 20 /* max length of user's words */
-char wd1[MAXSTR]; /* the complete words */
-char wd2[MAXSTR];
+extern char wd1[MAXSTR]; /* the complete words */
+extern char wd2[MAXSTR];
#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];
+};
+extern struct hashtab voc[HTSIZE];
struct text {
char *seekadr; /* Msg start in virtual disk */
@@ -90,53 +91,55 @@ struct text {
};
#define RTXSIZ 205
-struct text rtext[RTXSIZ]; /* random text messages */
+extern struct text rtext[RTXSIZ]; /* random text messages */
#define MAGSIZ 35
-struct text mtext[MAGSIZ]; /* magic messages */
+extern struct text mtext[MAGSIZ]; /* magic messages */
-int clsses;
+extern int clsses;
#define CLSMAX 12
-struct text ctext[CLSMAX]; /* classes of adventurer */
-int cval[CLSMAX];
+extern struct text ctext[CLSMAX]; /* classes of adventurer */
+extern int cval[CLSMAX];
-struct text ptext[101]; /* object descriptions */
+extern 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 */
+extern struct text ltext[LOCSIZ]; /* long loc description */
+extern struct text stext[LOCSIZ]; /* short loc descriptions */
-struct travlist /* direcs & conditions of travel*/
-{ struct travlist *next; /* ptr to next list entry */
+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(...)*/
+};
+extern struct travlist *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/
-int atloc[LOCSIZ];
+extern int atloc[LOCSIZ];
-int plac[101]; /* initial object placement */
-int fixd[101], fixed[101]; /* location fixed? */
+extern int plac[101]; /* initial object placement */
+extern int fixd[101], fixed[101]; /* location fixed? */
-int actspk[35]; /* rtext msg for verb <n> */
+extern int actspk[35]; /* rtext msg for verb <n> */
-int cond[LOCSIZ]; /* various condition bits */
+extern int cond[LOCSIZ]; /* various condition bits */
extern int setbit[16]; /* bit defn masks 1,2,4,... */
-int hntmax;
-int hints[20][5]; /* info on hints */
-int hinted[20], hintlc[20];
+extern int hntmax;
+extern int hints[20][5]; /* info on hints */
+extern int hinted[20], hintlc[20];
-int place[101], prop[101], linkx[201];
-int abb[LOCSIZ];
+extern int place[101], prop[101], linkx[201];
+extern int abb[LOCSIZ];
-int maxtrs, tally, tally2; /* treasure values */
+extern int maxtrs, tally, tally2; /* treasure values */
#define FALSE 0
#define TRUE 1
-int keys, lamp, grate, cage, rod, rod2, steps, /* mnemonics */
+extern 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,
@@ -145,15 +148,19 @@ int keys, lamp, grate, cage, rod, rod2, steps, /* mnemonics */
null, entrnc, dprssn, enter, stream, pour, say, lock, throw,
find, invent;
-int chloc, chloc2, dseen[7], dloc[7], /* dwarf stuff */
+extern 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 & counters */
+extern int
+ tk[21], stick, dtotal, attack;
+extern int
+ turns, lmwarn, iwest, knfloc, detail, /* various flags & counters */
abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1,
clock2, saved, closng, panic, closed, scorng;
-int demo, limit;
+extern int
+ demo, limit;
/* We need to get a little tricky to avoid strings */
#define DECR(a,b,c,d,e) decr(*#a-'+',*#b-'-',*#c-'#',*#d-'&',*#e-'%')
diff --git a/games/adventure/main.c b/games/adventure/main.c
index b7401e5301f..53808e4d06f 100644
--- a/games/adventure/main.c
+++ b/games/adventure/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.25 2017/01/21 08:22:57 krw Exp $ */
+/* $OpenBSD: main.c,v 1.26 2021/01/27 01:59:39 deraadt Exp $ */
/* $NetBSD: main.c,v 1.5 1996/05/21 21:53:09 mrg Exp $ */
/*-
@@ -45,6 +45,72 @@
#include "extern.h"
#include "hdr.h"
+int datfd; /* message file descriptor */
+volatile sig_atomic_t delhit;
+int yea;
+
+int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
+int verb, obj, spk;
+time_t savet;
+int mxscor, latncy;
+
+char wd1[MAXSTR]; /* the complete words */
+char wd2[MAXSTR];
+
+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 <n> */
+
+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], linkx[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 & counters */
+ abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1,
+ clock2, saved, closng, panic, closed, scorng;
+
+int demo, limit;
+
int
main(int argc, char *argv[])
{