1 /*	SCCS Id: @(#)hack.h	3.3	2000/01/28	*/
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4 
5 #ifndef HACK_H
6 #define HACK_H
7 
8 #ifndef CONFIG_H
9 #include "config.h"
10 #endif
11 
12 /*	For debugging beta code.	*/
13 #ifdef BETA
14 #define Dpline	pline
15 #endif
16 
17 #define TELL		1
18 #define NOTELL		0
19 #define ON		1
20 #define OFF		0
21 #define BOLT_LIM	8 /* from this distance ranged attacks will be made */
22 #define MAX_CARR_CAP	1000	/* so that boulders can be heavier */
23 #define DUMMY { 0 }
24 
25 /* symbolic names for capacity levels */
26 #define UNENCUMBERED	0
27 #define SLT_ENCUMBER	1
28 #define MOD_ENCUMBER	2
29 #define HVY_ENCUMBER	3
30 #define EXT_ENCUMBER	4
31 #define OVERLOADED	5
32 
33 /* Macros for how a rumor was delivered in outrumor() */
34 #define BY_ORACLE	0
35 #define BY_COOKIE	1
36 #define BY_PAPER	2
37 #define BY_OTHER	9
38 
39 #ifdef STEED
40 /* Macros for why you are no longer riding */
41 #define DISMOUNT_GENERIC	0
42 #define DISMOUNT_FELL		1
43 #define DISMOUNT_THROWN		2
44 #define DISMOUNT_POLY		3
45 #define DISMOUNT_ENGULFED	4
46 #define DISMOUNT_BYCHOICE	5
47 #endif
48 
49 /*
50  * This is the way the game ends.  If these are rearranged, the arrays
51  * in end.c and topten.c will need to be changed.  Some parts of the
52  * code assume that PANIC separates the deaths from the non-deaths.
53  */
54 #define DIED		 0
55 #define CHOKING		 1
56 #define POISONING	 2
57 #define STARVING	 3
58 #define DROWNING	 4
59 #define BURNING		 5
60 #define DISSOLVED	 6
61 #define CRUSHING	 7
62 #define STONING		 8
63 #define TURNED_SLIME	 9
64 #define GENOCIDED	10
65 #define PANICKED	11
66 #define TRICKED		12
67 #define QUIT		13
68 #define ESCAPED		14
69 #define ASCENDED	15
70 
71 #include "align.h"
72 #include "dungeon.h"
73 #include "monsym.h"
74 #include "mkroom.h"
75 #include "objclass.h"
76 #include "youprop.h"
77 #include "wintype.h"
78 #include "decl.h"
79 #include "timeout.h"
80 
81 NEARDATA extern coord bhitpos;	/* place where throw or zap hits or stops */
82 
83 /* types of calls to bhit() */
84 #define ZAPPED_WAND	0
85 #define THROWN_WEAPON	1
86 #define KICKED_WEAPON	2
87 #define FLASHED_LIGHT	3
88 #define INVIS_BEAM	4
89 
90 #define MATCH_WARN_OF_MON(mon)	 (Warn_of_mon && flags.warntype && \
91 		   		 (flags.warntype & (mon)->data->mflags2))
92 
93 #include "trap.h"
94 #include "flag.h"
95 #include "rm.h"
96 #include "vision.h"
97 #include "display.h"
98 #include "engrave.h"
99 #include "rect.h"
100 #include "region.h"
101 
102 #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */
103 #undef NDECL
104 #define NDECL(f) f()
105 #endif
106 
107 #include "extern.h"
108 #include "winprocs.h"
109 
110 #ifdef USE_TRAMPOLI
111 #include "wintty.h"
112 #undef WINTTY_H
113 #include "trampoli.h"
114 #undef EXTERN_H
115 #include "extern.h"
116 #endif /* USE_TRAMPOLI */
117 
118 #define NO_SPELL	0
119 
120 /* flags to control makemon() */
121 #define NO_MM_FLAGS	  0x00	/* use this rather than plain 0 */
122 #define NO_MINVENT	  0x01	/* suppress minvent when creating mon */
123 #define MM_NOWAIT	  0x02	/* don't set STRAT_WAITMASK flags */
124 #define MM_EDOG		  0x04	/* add edog structure */
125 #define MM_EMIN		  0x08	/* add emin structure */
126 #define MM_ANGRY	  0x10  /* monster is created angry */
127 #define MM_NONAME	  0x20  /* monster is not christened */
128 
129 /* flags to control query_objlist() */
130 #define BY_NEXTHERE	  0x1	/* follow objlist by nexthere field */
131 #define AUTOSELECT_SINGLE 0x2	/* if only 1 object, don't ask */
132 #define USE_INVLET	  0x4	/* use object's invlet */
133 #define INVORDER_SORT	  0x8	/* sort objects by packorder */
134 #define SIGNAL_NOMENU	  0x10	/* return -1 rather than 0 if none allowed */
135 
136 /* Flags to control query_category() */
137 /* BY_NEXTHERE used by query_category() too, so skip 0x01 */
138 #define UNPAID_TYPES 0x02
139 #define GOLD_TYPES   0x04
140 #define WORN_TYPES   0x08
141 #define ALL_TYPES    0x10
142 #define BILLED_TYPES 0x20
143 #define CHOOSE_ALL   0x40
144 #define ALL_TYPES_SELECTED -2
145 
146 /* Flags to control find_mid() */
147 #define FM_FMON	       0x01	/* search the fmon chain */
148 #define FM_MIGRATE     0x02	/* search the migrating monster chain */
149 #define FM_MYDOGS      0x04	/* search mydogs */
150 #define FM_EVERYWHERE  (FM_FMON | FM_MIGRATE | FM_MYDOGS)
151 
152 /*** some utility macros ***/
153 #define yn(query) yn_function(query,ynchars, 'n')
154 #define ynq(query) yn_function(query,ynqchars, 'q')
155 #define ynaq(query) yn_function(query,ynaqchars, 'y')
156 #define nyaq(query) yn_function(query,ynaqchars, 'n')
157 #define nyNaq(query) yn_function(query,ynNaqchars, 'n')
158 #define ynNaq(query) yn_function(query,ynNaqchars, 'y')
159 
160 /* Macros for scatter */
161 #define VIS_EFFECTS	0x01	/* display visual effects */
162 #define MAY_HITMON	0x02	/* objects may hit monsters */
163 #define MAY_HITYOU	0x04	/* objects may hit you */
164 #define MAY_HIT		(MAY_HITMON|MAY_HITYOU)
165 #define MAY_DESTROY	0x08	/* objects may be destroyed at random */
166 #define MAY_FRACTURE	0x10	/* boulders & statues may fracture */
167 
168 /* Macros for launching objects */
169 #define ROLL	1
170 #define FLING	2
171 
172 /* Macros for messages referring to hands, eyes, feet, etc... */
173 #define ARM 0
174 #define EYE 1
175 #define FACE 2
176 #define FINGER 3
177 #define FINGERTIP 4
178 #define FOOT 5
179 #define HAND 6
180 #define HANDED 7
181 #define HEAD 8
182 #define LEG 9
183 #define LIGHT_HEADED 10
184 #define NECK 11
185 #define SPINE 12
186 #define TOE 13
187 #define HAIR 14
188 #define BLOOD 15
189 #define LUNG 16
190 
191 /* Flags to control menus */
192 #define MENUTYPELEN sizeof("traditional ")
193 #define MENU_TRADITIONAL 0
194 #define MENU_COMBINATION 1
195 #define MENU_PARTIAL	 2
196 #define MENU_FULL	 3
197 
198 #define MENU_SELECTED	TRUE
199 #define MENU_UNSELECTED FALSE
200 
201 #define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \
202 	((unsigned long)minor << 16) | \
203 	((unsigned long)patch << 8) | \
204 	((unsigned long)0))
205 
206 #define FEATURE_NOTICE_VER_MAJ	  (flags.suppress_alert >> 24)
207 #define FEATURE_NOTICE_VER_MIN	  (((unsigned long)(0x0000000000FF0000L & flags.suppress_alert)) >> 16)
208 #define FEATURE_NOTICE_VER_PATCH  (((unsigned long)(0x000000000000FF00L & flags.suppress_alert)) >>  8)
209 
210 #ifndef max
211 #define max(a,b) ((a) > (b) ? (a) : (b))
212 #endif
213 #ifndef min
214 #define min(x,y) ((x) < (y) ? (x) : (y))
215 #endif
216 #define plur(x) (((x) == 1) ? "" : "s")
217 
218 #define ARM_BONUS(obj)	(objects[(obj)->otyp].a_ac + (obj)->spe \
219 			 - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac))
220 
221 #define makeknown(x)	discover_object((x),TRUE,TRUE)
222 #define distu(xx,yy)	dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
223 #define onlineu(xx,yy)	online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
224 
225 #define rn1(x,y)	(rn2(x)+(y))
226 
227 /* negative armor class is randomly weakened to prevent invulnerability */
228 #define AC_VALUE(AC)	((AC) >= 0 ? (AC) : -rnd(-(AC)))
229 
230 #if defined(MICRO) && !defined(__DJGPP__)
231 #define getuid() 1
232 #define getlogin() ((char *)0)
233 #endif /* MICRO */
234 
235 #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB))
236 # define USE_OVLx
237 # define STATIC_DCL extern
238 # define STATIC_OVL
239 # ifdef OVLB
240 #  define STATIC_VAR
241 # else
242 #  define STATIC_VAR extern
243 # endif
244 
245 #else	/* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */
246 # define STATIC_DCL static
247 # define STATIC_OVL static
248 # define STATIC_VAR static
249 
250 /* If not compiling an overlay, compile everything. */
251 # define OVL0	/* highest priority */
252 # define OVL1
253 # define OVL2
254 # define OVL3	/* lowest specified priority */
255 # define OVLB	/* the base overlay segment */
256 #endif	/* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */
257 
258 /* Macro for a few items that are only static if we're not overlaid.... */
259 #if defined(USE_TRAMPOLI) || defined(USE_OVLx)
260 # define STATIC_PTR
261 #else
262 # define STATIC_PTR static
263 #endif
264 
265 #endif /* HACK_H */
266