Add __attribute__((__noreturn__)) to various function prototypes in games/.
[dragonfly.git] / games / adventure / hdr.h
CommitLineData
984263bc
MD
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * The game adventure was originally written in Fortran by Will Crowther
6 * and Don Woods. It was later translated to C and enhanced by Jim
7 * Gillogly. This code is derived from software contributed to Berkeley
8 * by Jim Gillogly at The Rand Corporation.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
6693db17 18 * 3. Neither the name of the University nor the names of its contributors
984263bc
MD
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)hdr.h 8.1 (Berkeley) 5/31/93
35 */
36
37/* ADVENTURE -- Jim Gillogly, Jul 1977
38 * This program is a re-write of ADVENT, written in FORTRAN mostly by
39 * Don Woods of SAIL. In most places it is as nearly identical to the
40 * original as possible given the language and word-size differences.
41 * A few places, such as the message arrays and travel arrays were changed
42 * to reflect the smaller core size and word size. The labels of the
43 * original are reflected in this version, so that the comments of the
44 * fortran are still applicable here.
45 *
46 * The data file distributed with the fortran source is assumed to be called
47 * "glorkz" in the directory where the program is first run.
48 *
6693db17
SW
49 * The original FORTRAN version can be found at
50 * <URL:ftp://ftp.gmd.de/if-archive/games/source/advent-original.tar.gz>.
51 *
984263bc
MD
52 * $FreeBSD: src/games/adventure/hdr.h,v 1.5.2.1 2001/03/05 11:43:11 kris Exp $
53 */
54
55/* hdr.h: included by c advent files */
56#include <sys/types.h>
57#include <signal.h>
58
6693db17 59int datfd; /* message file descriptor */
984263bc
MD
60volatile sig_atomic_t delhit;
61int yea;
6693db17 62extern char data_file[]; /* Virtual data file */
984263bc
MD
63
64#define TAB 011
65#define LF 012
66#define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0)
67#define FLUSHLF while (next()!=LF)
68
6693db17
SW
69int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
70char *wd1, *wd2; /* the complete words */
71int verb, obj, spk;
984263bc 72extern int blklin;
6693db17 73int saved, savet, mxscor, latncy;
984263bc 74
6693db17 75#define SHORT 50 /* How short is a demo game? */
984263bc 76
6693db17 77#define MAXSTR 20 /* max length of user's words */
984263bc 78
6693db17
SW
79#define HTSIZE 512 /* max number of vocab words */
80struct hashtab { /* hash table for vocabulary */
81 int val; /* word type &index (ktab) */
82 char *atab; /* pointer to actual string */
984263bc
MD
83} voc[HTSIZE];
84
6693db17 85#define SEED 1815622 /* "Encryption" seed */
984263bc 86
6693db17
SW
87struct text {
88 char *seekadr; /* Msg start in virtual disk */
89 int txtlen; /* length of msg starting here */
984263bc
MD
90};
91
6693db17
SW
92#define RTXSIZ 205
93struct text rtext[RTXSIZ]; /* random text messages */
984263bc 94
6693db17
SW
95#define MAGSIZ 35
96struct text mtext[MAGSIZ]; /* magic messages */
984263bc
MD
97
98int clsses;
99#define CLSMAX 12
6693db17 100struct text ctext[CLSMAX]; /* classes of adventurer */
984263bc
MD
101int cval[CLSMAX];
102
6693db17 103struct text ptext[101]; /* object descriptions */
984263bc 104
6693db17
SW
105#define LOCSIZ 141 /* number of locations */
106struct text ltext[LOCSIZ]; /* long loc description */
107struct text stext[LOCSIZ]; /* short loc descriptions */
984263bc 108
6693db17
SW
109struct travlist { /* direcs & conditions of travel */
110 struct travlist *next; /* ptr to next list entry */
111 int conditions; /* m in writeup (newloc / 1000) */
112 int tloc; /* n in writeup (newloc % 1000) */
113 int tverb; /* the verb that takes you there */
114} *travel[LOCSIZ], *tkk; /* travel is closer to keys(...) */
984263bc
MD
115
116int atloc[LOCSIZ];
117
6693db17
SW
118int plac[101]; /* initial object placement */
119int fixd[101], fixed[101]; /* location fixed? */
984263bc 120
6693db17 121int actspk[35]; /* rtext msg for verb <n> */
984263bc 122
6693db17 123int cond[LOCSIZ]; /* various condition bits */
984263bc 124
6693db17 125extern int setbit[16]; /* bit defn masks 1,2,4,... */
984263bc
MD
126
127int hntmax;
6693db17
SW
128int hints[20][5]; /* info on hints */
129int hinted[20], hintlc[20];
984263bc 130
6693db17 131int place[101], prop[101], linkx[201];
984263bc
MD
132int abb[LOCSIZ];
133
6693db17 134int maxtrs, tally, tally2; /* treasure values */
984263bc
MD
135
136#define FALSE 0
137#define TRUE 1
138
6693db17
SW
139int axe, back, batter, bear, bird, bottle, /* mnemonics */
140 cage, cave, chain, chasm, chest, clam, coins, door, dprssn, dragon,
141 dwarf, eggs, emrald, enter, entrnc, find, fissur, food, grate, invent,
142 keys, knife, lamp, lock, look, magzin, messag, mirror, nugget, null,
143 oil, oyster, pearl, pillow, plant, plant2, pour, pyram, rod, rod2,
144 rug, say, snake, spices, steps, stream, tablet, throw, tridnt, troll,
145 troll2, vase, vend, water;
146
147int chloc, chloc2, daltlc, dflag, dloc[7], /* dwarf stuff */
148 dseen[7], odloc[7];
149
150int attack, dtotal, stick, tk[21];
151
152int abbnum, bonus, clock1, clock2, closed, /* various flags and counters */
153 closng, detail, dkill, foobar, holdng, iwest, knfloc,
154 lmwarn, maxdie, numdie, panic, scorng, turns;
155
156int demo, limit;
157
158int at(int objj);
09ac707a 159int bug(int n) __dead2;
6693db17
SW
160void carry(int, int);
161void caveclose(void);
162void checkhints(void);
163void ciao(void);
164void closing(void);
165unsigned long crc(const char *ptr, int nr);
166void crc_start(void);
167int dark(void);
168void datime(int *d, int *t);
169char *decr(const char *, const char *, const char *, const char *, const char *);
170void die(int entry);
09ac707a 171void done(int entry) __dead2;
6693db17
SW
172void drop(int object, int where);
173void dstroy(int);
174int fdwarf(void);
175int forced(int locc);
176void getin(char **wrd1, char **wrd2);
177int here(int objj);
178void init(void);
179void juggle(int);
180int liq(void);
181int liqloc(int locc);
182int march(void);
183void move(int, int);
184void mspeak(int);
185int pct(int n);
186void poof(void);
187void pspeak(int m, int skip);
188int put(int, int, int);
189int ran(int range);
190void rdata(void);
191int restore(const char *infile);
192void rspeak(int);
193int save(const char *);
194int score(void);
195void speak(const struct text *);
196int Start(void);
197void startup(void);
198int toting(int objj);
199void trapdel(int sig);
200int trdrop(void);
201int trfeed(void);
202int trfill(void);
203int trkill(void);
204int tropen(void);
205int trsay(void);
206int trtake(void);
207int trtoss(void);
208int vocab(const char *, int, int);
209int yes(int x, int y, int z);
210int yesm(int x, int y, int z);
984263bc
MD
211
212/* We need to get a little tricky to avoid strings */
e8f4b16f 213#define DECR(a,b,c,d,e) decr(#a,#b,#c,#d,#e)
984263bc
MD
214
215gid_t egid;