]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.h
caesar: WARNS=6, strict bool mode
[bsdgames-darwin.git] / hack / hack.h
1 /* $NetBSD: hack.h,v 1.16 2011/08/06 20:18:26 dholland Exp $ */
2
3 /*
4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
5 * Amsterdam
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * - Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * - 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 *
19 * - Neither the name of the Stichting Centrum voor Wiskunde en
20 * Informatica, nor the names of its contributors may be used to endorse or
21 * promote products derived from this software without specific prior
22 * written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
27 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
28 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 /*
38 * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
39 * All rights reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. The name of the author may not be used to endorse or promote products
50 * derived from this software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
53 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
54 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
55 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
56 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
57 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
58 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
59 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
60 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
61 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63
64 #ifndef _HACK_H_
65 #define _HACK_H_
66
67 #include "hack-config.h"
68 #include <stdlib.h>
69 #include <string.h>
70 #include <sys/time.h>
71
72 #define Null(type) ((struct type *) 0)
73
74 #include "def.objclass.h"
75
76 typedef struct {
77 xchar x,y;
78 } coord;
79
80 #include "def.monst.h" /* uses coord */
81 #include "def.gold.h"
82 #include "def.trap.h"
83 #include "def.obj.h"
84 #include "def.flag.h"
85
86 #define plur(x) (((x) == 1) ? "" : "s")
87
88 #define BUFSZ 256 /* for getlin buffers */
89 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
90
91 #include "def.rm.h"
92 #include "def.permonst.h"
93
94 #define newstring(x) ((char *) alloc(x))
95 #include "hack.onames.h"
96
97 #define ON 1
98 #define OFF 0
99
100 struct prop {
101 #define TIMEOUT 007777 /* mask */
102 #define LEFT_RING W_RINGL /* 010000L */
103 #define RIGHT_RING W_RINGR /* 020000L */
104 #define INTRINSIC 040000L
105 #define LEFT_SIDE LEFT_RING
106 #define RIGHT_SIDE RIGHT_RING
107 #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE)
108 long p_flgs;
109 void (*p_tofn)(void); /* called after timeout */
110 };
111
112 struct you {
113 xchar ux, uy;
114 schar dx, dy, dz; /* direction of move (or zap or ... ) */
115 #ifdef QUEST
116 schar di; /* direction of FF */
117 xchar ux0, uy0; /* initial position FF */
118 #endif /* QUEST */
119 xchar udisx, udisy; /* last display pos */
120 char usym; /* usually '@' */
121 schar uluck;
122 #define LUCKMAX 10 /* on moonlit nights 11 */
123 #define LUCKMIN (-10)
124 int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */
125 /* +: turn right, -: turn left */
126 unsigned udispl:1; /* @ on display */
127 unsigned ulevel:4; /* 1 - 14 */
128 #ifdef QUEST
129 unsigned uhorizon:7;
130 #endif /* QUEST */
131 unsigned utrap:3; /* trap timeout */
132 unsigned utraptype:1; /* defined if utrap nonzero */
133 #define TT_BEARTRAP 0
134 #define TT_PIT 1
135 unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */
136
137
138 /* perhaps these #define's should also be generated by makedefs */
139 #define TELEPAT LAST_RING /* not a ring */
140 #define Telepat u.uprops[TELEPAT].p_flgs
141 #define FAST (LAST_RING+1) /* not a ring */
142 #define Fast u.uprops[FAST].p_flgs
143 #define CONFUSION (LAST_RING+2) /* not a ring */
144 #define Confusion u.uprops[CONFUSION].p_flgs
145 #define INVIS (LAST_RING+3) /* not a ring */
146 #define Invis u.uprops[INVIS].p_flgs
147 #define Invisible (Invis && !See_invisible)
148 #define GLIB (LAST_RING+4) /* not a ring */
149 #define Glib u.uprops[GLIB].p_flgs
150 #define PUNISHED (LAST_RING+5) /* not a ring */
151 #define Punished u.uprops[PUNISHED].p_flgs
152 #define SICK (LAST_RING+6) /* not a ring */
153 #define Sick u.uprops[SICK].p_flgs
154 #define BLIND (LAST_RING+7) /* not a ring */
155 #define Blind u.uprops[BLIND].p_flgs
156 #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */
157 #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs
158 #define STONED (LAST_RING+9) /* not a ring */
159 #define Stoned u.uprops[STONED].p_flgs
160 #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */
161 unsigned umconf:1;
162 const char *usick_cause;
163 struct prop uprops[LAST_RING+10];
164
165 unsigned uswallow:1; /* set if swallowed by a monster */
166 unsigned uswldtim:4; /* time you have been swallowed */
167 unsigned uhs:3; /* hunger state - see hack.eat.c */
168 schar ustr,ustrmax;
169 schar udaminc;
170 schar uac;
171 int uhp,uhpmax;
172 long int ugold,ugold0,uexp,urexp;
173 int uhunger; /* refd only in eat.c and shk.c */
174 int uinvault;
175 struct monst *ustuck;
176 int nr_killed[CMNUM+2]; /* used for experience bookkeeping */
177 };
178
179 #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
180
181 #define PL_CSIZ 20 /* sizeof pl_character */
182 #define MAX_CARR_CAP 120 /* so that boulders can be heavier */
183 #define MAXLEVEL 40
184 #define FAR (COLNO+2) /* position outside screen */
185
186 extern boolean in_mklev;
187 extern boolean level_exists[];
188 extern boolean restoring;
189 extern char *CD;
190 extern const char *catmore;
191 extern char *hname;
192 extern const char *const hu_stat[]; /* in eat.c */
193 extern const char *nomovemsg;
194 extern const char *occtxt;
195 extern const char *save_cm;
196 extern const char *killer;
197 extern const char *const traps[];
198 extern char SAVEF[];
199 extern char fut_geno[60]; /* idem */
200 extern char genocided[60]; /* defined in Decl.c */
201 extern char lock[PL_NSIZ + 4];
202 extern const char mlarge[];
203 extern char morc;
204 extern const char nul[];
205 extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
206 extern const char quitchars[];
207 extern char sdir[]; /* defined in hack.c */
208 extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
209 extern const char vowels[];
210 extern coord bhitpos; /* place where thrown weapon falls to the ground */
211 extern int (*afternmv)(void);
212 extern int (*occupation)(void);
213 extern int CO, LI; /* usually COLNO and ROWNO+2 */
214 extern int bases[];
215 extern int doorindex;
216 extern int hackpid;
217 extern int multi;
218 extern int nroom;
219 extern long moves;
220 extern long wailmsg;
221 extern schar xdir[], ydir[]; /* idem */
222 extern struct monst *mydogs;
223 extern struct monst youmonst;
224 extern struct obj *billobjs;
225 extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg;
226 extern struct obj *uleft, *uright, *fcobj;
227 extern struct obj *uball; /* defined if PUNISHED */
228 extern struct obj *uchain; /* defined iff PUNISHED */
229 extern struct obj zeroobj;
230 extern const struct permonst li_dog, dog, la_dog;
231 extern const struct permonst pm_eel;
232 extern const struct permonst pm_ghost;
233 extern const struct permonst pm_mail_daemon;
234 extern const struct permonst pm_wizard;
235 #ifndef NOWORM
236 extern long wgrowtime[32];
237 extern struct wseg *m_atseg;
238 extern struct wseg *wsegs[32], *wheads[32];
239 #endif
240 extern struct you u;
241 extern xchar curx, cury; /* cursor location on screen */
242 extern xchar dlevel, maxdlevel; /* dungeon level */
243 extern xchar seehx,seelx,seehy,seely; /* where to see*/
244 extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
245 #endif /* _HACK_H_ */