Expand PMF_FN_* macros.
[netbsd-mini2440.git] / games / hack / hack.h
blob97f8bae115bb9458020b6a6ada1ec2ba1448c7ec
1 /* $NetBSD: hack.h,v 1.12 2009/06/07 21:04:54 dholland Exp $ */
3 /*
4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
5 * Amsterdam
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
12 * - Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
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.
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.
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.
38 * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
39 * All rights reserved.
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.
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.
64 #ifndef _HACK_H_
65 #define _HACK_H_
67 #include "config.h"
68 #include <stdlib.h>
69 #include <string.h>
71 #ifndef BSD
72 #define index strchr
73 #define rindex strrchr
74 #endif /* BSD */
76 #define Null(type) ((struct type *) 0)
78 #include "def.objclass.h"
80 typedef struct {
81 xchar x,y;
82 } coord;
84 #include "def.monst.h" /* uses coord */
85 #include "def.gold.h"
86 #include "def.trap.h"
87 #include "def.obj.h"
88 #include "def.flag.h"
90 #define plur(x) (((x) == 1) ? "" : "s")
92 #define BUFSZ 256 /* for getlin buffers */
93 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
95 #include "def.rm.h"
96 #include "def.permonst.h"
98 #define newstring(x) (char *) alloc((unsigned)(x))
99 #include "hack.onames.h"
101 #define ON 1
102 #define OFF 0
104 struct prop {
105 #define TIMEOUT 007777 /* mask */
106 #define LEFT_RING W_RINGL /* 010000L */
107 #define RIGHT_RING W_RINGR /* 020000L */
108 #define INTRINSIC 040000L
109 #define LEFT_SIDE LEFT_RING
110 #define RIGHT_SIDE RIGHT_RING
111 #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE)
112 long p_flgs;
113 void (*p_tofn)(void); /* called after timeout */
116 struct you {
117 xchar ux, uy;
118 schar dx, dy, dz; /* direction of move (or zap or ... ) */
119 #ifdef QUEST
120 schar di; /* direction of FF */
121 xchar ux0, uy0; /* initial position FF */
122 #endif /* QUEST */
123 xchar udisx, udisy; /* last display pos */
124 char usym; /* usually '@' */
125 schar uluck;
126 #define LUCKMAX 10 /* on moonlit nights 11 */
127 #define LUCKMIN (-10)
128 int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */
129 /* +: turn right, -: turn left */
130 unsigned udispl:1; /* @ on display */
131 unsigned ulevel:4; /* 1 - 14 */
132 #ifdef QUEST
133 unsigned uhorizon:7;
134 #endif /* QUEST */
135 unsigned utrap:3; /* trap timeout */
136 unsigned utraptype:1; /* defined if utrap nonzero */
137 #define TT_BEARTRAP 0
138 #define TT_PIT 1
139 unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */
142 /* perhaps these #define's should also be generated by makedefs */
143 #define TELEPAT LAST_RING /* not a ring */
144 #define Telepat u.uprops[TELEPAT].p_flgs
145 #define FAST (LAST_RING+1) /* not a ring */
146 #define Fast u.uprops[FAST].p_flgs
147 #define CONFUSION (LAST_RING+2) /* not a ring */
148 #define Confusion u.uprops[CONFUSION].p_flgs
149 #define INVIS (LAST_RING+3) /* not a ring */
150 #define Invis u.uprops[INVIS].p_flgs
151 #define Invisible (Invis && !See_invisible)
152 #define GLIB (LAST_RING+4) /* not a ring */
153 #define Glib u.uprops[GLIB].p_flgs
154 #define PUNISHED (LAST_RING+5) /* not a ring */
155 #define Punished u.uprops[PUNISHED].p_flgs
156 #define SICK (LAST_RING+6) /* not a ring */
157 #define Sick u.uprops[SICK].p_flgs
158 #define BLIND (LAST_RING+7) /* not a ring */
159 #define Blind u.uprops[BLIND].p_flgs
160 #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */
161 #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs
162 #define STONED (LAST_RING+9) /* not a ring */
163 #define Stoned u.uprops[STONED].p_flgs
164 #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */
165 unsigned umconf:1;
166 const char *usick_cause;
167 struct prop uprops[LAST_RING+10];
169 unsigned uswallow:1; /* set if swallowed by a monster */
170 unsigned uswldtim:4; /* time you have been swallowed */
171 unsigned uhs:3; /* hunger state - see hack.eat.c */
172 schar ustr,ustrmax;
173 schar udaminc;
174 schar uac;
175 int uhp,uhpmax;
176 long int ugold,ugold0,uexp,urexp;
177 int uhunger; /* refd only in eat.c and shk.c */
178 int uinvault;
179 struct monst *ustuck;
180 int nr_killed[CMNUM+2]; /* used for experience bookkeeping */
183 #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
185 #define PL_CSIZ 20 /* sizeof pl_character */
186 #define MAX_CARR_CAP 120 /* so that boulders can be heavier */
187 #define MAXLEVEL 40
188 #define FAR (COLNO+2) /* position outside screen */
190 extern boolean in_mklev;
191 extern boolean level_exists[];
192 extern boolean restoring;
193 extern char *CD;
194 extern const char *catmore;
195 extern char *hname;
196 extern const char *const hu_stat[]; /* in eat.c */
197 extern const char *nomovemsg;
198 extern const char *occtxt;
199 extern const char *save_cm;
200 extern const char *killer;
201 extern const char *const traps[];
202 extern char SAVEF[];
203 extern char fut_geno[60]; /* idem */
204 extern char genocided[60]; /* defined in Decl.c */
205 extern char lock[PL_NSIZ + 4];
206 extern const char mlarge[];
207 extern char morc;
208 extern const char nul[];
209 extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
210 extern const char quitchars[];
211 extern char sdir[]; /* defined in hack.c */
212 extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
213 extern const char vowels[];
214 extern coord bhitpos; /* place where thrown weapon falls to the ground */
215 extern int (*afternmv)(void);
216 extern int (*occupation)(void);
217 extern int CO, LI; /* usually COLNO and ROWNO+2 */
218 extern int bases[];
219 extern int doorindex;
220 extern int hackpid;
221 extern int multi;
222 extern int nroom;
223 extern long moves;
224 extern long wailmsg;
225 extern schar xdir[], ydir[]; /* idem */
226 extern struct monst *mydogs;
227 extern struct monst youmonst;
228 extern struct obj *billobjs;
229 extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg;
230 extern struct obj *uleft, *uright, *fcobj;
231 extern struct obj *uball; /* defined if PUNISHED */
232 extern struct obj *uchain; /* defined iff PUNISHED */
233 extern struct obj zeroobj;
234 extern const struct permonst li_dog, dog, la_dog;
235 extern const struct permonst pm_eel;
236 extern const struct permonst pm_ghost;
237 extern const struct permonst pm_mail_daemon;
238 extern const struct permonst pm_wizard;
239 #ifndef NOWORM
240 extern long wgrowtime[32];
241 extern struct wseg *m_atseg;
242 extern struct wseg *wsegs[32], *wheads[32];
243 #endif
244 extern struct you u;
245 extern xchar curx, cury; /* cursor location on screen */
246 extern xchar dlevel, maxdlevel; /* dungeon level */
247 extern xchar seehx,seelx,seehy,seely; /* where to see*/
248 extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
249 #endif /* _HACK_H_ */