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