1 /* SCCS Id: @(#)hack.h 3.4 2001/04/12 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
12 /* For debugging beta code. */
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 */
25 /* symbolic names for capacity levels */
26 #define UNENCUMBERED 0
27 #define SLT_ENCUMBER 1 /* Burdened */
28 #define MOD_ENCUMBER 2 /* Stressed */
29 #define HVY_ENCUMBER 3 /* Strained */
30 #define EXT_ENCUMBER 4 /* Overtaxed */
31 #define OVERLOADED 5 /* Overloaded */
33 /* Macros for how a rumor was delivered in outrumor() */
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_BONES 5
47 #define DISMOUNT_BYCHOICE 6
50 /* Special returns from mapglyph() */
51 #define MG_CORPSE 0x01
53 #define MG_DETECT 0x04
55 #define MG_RIDDEN 0x10
57 /* sellobj_state() states */
58 #define SELL_NORMAL (0)
59 #define SELL_DELIBERATE (1)
60 #define SELL_DONTSELL (2)
63 * This is the way the game ends. If these are rearranged, the arrays
64 * in end.c and topten.c will need to be changed. Some parts of the
65 * code assume that PANIC separates the deaths from the non-deaths.
76 #define TURNED_SLIME 9
94 NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
96 /* types of calls to bhit() */
98 #define THROWN_WEAPON 1
99 #define KICKED_WEAPON 2
100 #define FLASHED_LIGHT 3
103 #define MATCH_WARN_OF_MON(mon) (Warn_of_mon && flags.warntype && \
104 (flags.warntype & (mon)->data->mflags2))
115 #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */
121 #include "winprocs.h"
126 #include "trampoli.h"
129 #endif /* USE_TRAMPOLI */
133 /* flags to control makemon() */
134 #define NO_MM_FLAGS 0x00 /* use this rather than plain 0 */
135 #define NO_MINVENT 0x01 /* suppress minvent when creating mon */
136 #define MM_NOWAIT 0x02 /* don't set STRAT_WAITMASK flags */
137 #define MM_EDOG 0x04 /* add edog structure */
138 #define MM_EMIN 0x08 /* add emin structure */
139 #define MM_ANGRY 0x10 /* monster is created angry */
140 #define MM_NONAME 0x20 /* monster is not christened */
141 #define MM_NOCOUNTBIRTH 0x40 /* don't increment born counter (for revival) */
142 #define MM_IGNOREWATER 0x80 /* ignore water when positioning */
143 #define MM_ADJACENTOK 0x100 /* it is acceptable to use adjacent coordinates */
145 /* special mhpmax value when loading bones monster to flag as extinct or genocided */
146 #define DEFUNCT_MONSTER (-100)
148 /* flags for special ggetobj status returns */
149 #define ALL_FINISHED 0x01 /* called routine already finished the job */
151 /* flags to control query_objlist() */
152 #define BY_NEXTHERE 0x1 /* follow objlist by nexthere field */
153 #define AUTOSELECT_SINGLE 0x2 /* if only 1 object, don't ask */
154 #define USE_INVLET 0x4 /* use object's invlet */
155 #define INVORDER_SORT 0x8 /* sort objects by packorder */
156 #define SIGNAL_NOMENU 0x10 /* return -1 rather than 0 if none allowed */
157 #define FEEL_COCKATRICE 0x20 /* engage cockatrice checks and react */
159 /* Flags to control query_category() */
160 /* BY_NEXTHERE used by query_category() too, so skip 0x01 */
161 #define UNPAID_TYPES 0x02
162 #define GOLD_TYPES 0x04
163 #define WORN_TYPES 0x08
164 #define ALL_TYPES 0x10
165 #define BILLED_TYPES 0x20
166 #define CHOOSE_ALL 0x40
167 #define BUC_BLESSED 0x80
168 #define BUC_CURSED 0x100
169 #define BUC_UNCURSED 0x200
170 #define BUC_UNKNOWN 0x400
171 #define BUC_ALLBKNOWN (BUC_BLESSED|BUC_CURSED|BUC_UNCURSED)
172 #define ALL_TYPES_SELECTED -2
174 /* Flags to control find_mid() */
175 #define FM_FMON 0x01 /* search the fmon chain */
176 #define FM_MIGRATE 0x02 /* search the migrating monster chain */
177 #define FM_MYDOGS 0x04 /* search mydogs */
178 #define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS)
180 /* Flags to control pick_[race,role,gend,align] routines in role.c */
181 #define PICK_RANDOM 0
184 /* Flags to control dotrap() in trap.c */
185 #define NOWEBMSG 0x01 /* suppress stumble into web message */
186 #define FORCEBUNGLE 0x02 /* adjustments appropriate for bungling */
187 #define RECURSIVETRAP 0x04 /* trap changed into another type this same turn */
189 /* Flags to control test_move in hack.c */
190 #define DO_MOVE 0 /* really doing the move */
191 #define TEST_MOVE 1 /* test a normal move (move there next) */
192 #define TEST_TRAV 2 /* test a future travel location */
194 /*** some utility macros ***/
195 #define yn(query) yn_function(query,ynchars, 'n')
196 #define ynq(query) yn_function(query,ynqchars, 'q')
197 #define ynaq(query) yn_function(query,ynaqchars, 'y')
198 #define nyaq(query) yn_function(query,ynaqchars, 'n')
199 #define nyNaq(query) yn_function(query,ynNaqchars, 'n')
200 #define ynNaq(query) yn_function(query,ynNaqchars, 'y')
202 /* Macros for scatter */
203 #define VIS_EFFECTS 0x01 /* display visual effects */
204 #define MAY_HITMON 0x02 /* objects may hit monsters */
205 #define MAY_HITYOU 0x04 /* objects may hit you */
206 #define MAY_HIT (MAY_HITMON|MAY_HITYOU)
207 #define MAY_DESTROY 0x08 /* objects may be destroyed at random */
208 #define MAY_FRACTURE 0x10 /* boulders & statues may fracture */
210 /* Macros for launching objects */
211 #define ROLL 0x01 /* the object is rolling */
212 #define FLING 0x02 /* the object is flying thru the air */
213 #define LAUNCH_UNSEEN 0x40 /* hero neither caused nor saw it */
214 #define LAUNCH_KNOWN 0x80 /* the hero caused this by explicit action */
216 /* Macros for explosion types */
218 #define EXPL_NOXIOUS 1
221 #define EXPL_MAGICAL 4
223 #define EXPL_FROSTY 6
226 /* Macros for messages referring to hands, eyes, feet, etc... */
237 #define LIGHT_HEADED 10
247 /* Flags to control menus */
248 #define MENUTYPELEN sizeof("traditional ")
249 #define MENU_TRADITIONAL 0
250 #define MENU_COMBINATION 1
251 #define MENU_PARTIAL 2
254 #define MENU_SELECTED TRUE
255 #define MENU_UNSELECTED FALSE
259 * Each higher number includes the characteristics of the numbers
262 #define SET_IN_FILE 0 /* config file option only */
263 #define SET_VIA_PROG 1 /* may be set via extern program, not seen in game */
264 #define DISP_IN_GAME 2 /* may be set via extern program, displayed in game */
265 #define SET_IN_GAME 3 /* may be set via extern program or set in the game */
267 #define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \
268 ((unsigned long)minor << 16) | \
269 ((unsigned long)patch << 8) | \
272 #define FEATURE_NOTICE_VER_MAJ (flags.suppress_alert >> 24)
273 #define FEATURE_NOTICE_VER_MIN (((unsigned long)(0x0000000000FF0000L & flags.suppress_alert)) >> 16)
274 #define FEATURE_NOTICE_VER_PATCH (((unsigned long)(0x000000000000FF00L & flags.suppress_alert)) >> 8)
277 #define max(a,b) ((a) > (b) ? (a) : (b))
280 #define min(x,y) ((x) < (y) ? (x) : (y))
282 #define plur(x) (((x) == 1) ? "" : "s")
284 #define ARM_BONUS(obj) (objects[(obj)->otyp].a_ac + (obj)->spe \
285 - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac))
287 #define makeknown(x) discover_object((x),TRUE,TRUE)
288 #define distu(xx,yy) dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
289 #define onlineu(xx,yy) online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
291 #define rn1(x,y) (rn2(x)+(y))
293 /* negative armor class is randomly weakened to prevent invulnerability */
294 #define AC_VALUE(AC) ((AC) >= 0 ? (AC) : -rnd(-(AC)))
296 #if defined(MICRO) && !defined(__DJGPP__)
298 #define getlogin() ((char *)0)
301 #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB))
303 # define STATIC_DCL extern
308 # define STATIC_VAR extern
311 #else /* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */
312 # define STATIC_DCL static
313 # define STATIC_OVL static
314 # define STATIC_VAR static
316 /* If not compiling an overlay, compile everything. */
317 # define OVL0 /* highest priority */
320 # define OVL3 /* lowest specified priority */
321 # define OVLB /* the base overlay segment */
322 #endif /* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */
324 /* Macro for a few items that are only static if we're not overlaid.... */
325 #if defined(USE_TRAMPOLI) || defined(USE_OVLx)
328 # define STATIC_PTR static
331 /* The function argument to qsort() requires a particular
332 * calling convention under WINCE which is not the default
333 * in that environment.
336 # define CFDECLSPEC __cdecl