Fandom

Wikihack

Source:SLASH'EM 0.0.7E7F2/hack.h

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to hack.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/hack.h#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.
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. */
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    6	/* 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	/* Burdened */
28.   #define MOD_ENCUMBER	2	/* Stressed */
29.   #define HVY_ENCUMBER	3	/* Strained */
30.   #define EXT_ENCUMBER	4	/* Overtaxed */
31.   #define OVERLOADED	5	/* Overloaded */
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_BONES		5
47.   #define DISMOUNT_BYCHOICE	6
48.   #endif
49.   
50.   /* Special returns from mapglyph() */
51.   #define MG_CORPSE	0x01
52.   #define MG_INVIS	0x02
53.   #define MG_DETECT	0x04
54.   #define MG_PET		0x08
55.   #define MG_RIDDEN	0x10
56.   
57.   /* sellobj_state() states */
58.   #define SELL_NORMAL	(0)
59.   #define SELL_DELIBERATE	(1)
60.   #define SELL_DONTSELL	(2)
61.   
62.   /*
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.
66.    */
67.   #define DIED		 0
68.   #define BETRAYED	 1
69.   #define CHOKING		 2
70.   #define POISONING	 3
71.   #define STARVING	 4
72.   #define DROWNING	 5
73.   #define BURNING		 6
74.   #define DISSOLVED	 7
75.   #define CRUSHING	 8
76.   #define STONING		 9
77.   #define TURNED_SLIME 10
78.   #define GENOCIDED	11
79.   #define PANICKED	12
80.   #define TRICKED		13
81.   #define QUIT		14
82.   #define ESCAPED		15
83.   #define ASCENDED	16
84.   
85.   #include "align.h"
86.   #include "dungeon.h"
87.   #include "monsym.h"
88.   #include "mkroom.h"
89.   #include "objclass.h"
90.   #include "youprop.h"
91.   #include "wintype.h"
92.   #include "decl.h"
93.   #include "timeout.h"
94.   
95.   NEARDATA extern coord bhitpos;	/* place where throw or zap hits or stops */
96.   
97.   /* types of calls to bhit() */
98.   #define ZAPPED_WAND	0
99.   #define THROWN_WEAPON	1
100.  #define KICKED_WEAPON	2
101.  #define FLASHED_LIGHT	3
102.  #define INVIS_BEAM	4
103.  
104.  #define MATCH_WARN_OF_MON(mon)	 (Warn_of_mon && flags.warntype && \
105.  		   		 (flags.warntype & (mon)->data->mflags2))
106.  
107.  #include "trap.h"
108.  #include "flag.h"
109.  #include "rm.h"
110.  #include "vision.h"
111.  #include "display.h"
112.  #include "engrave.h"
113.  #include "rect.h"
114.  #include "region.h"
115.  
116.  #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */
117.  #undef NDECL
118.  #define NDECL(f) f()
119.  #endif
120.  
121.  #include "extern.h"
122.  #include "winprocs.h"
123.  
124.  #ifdef USE_TRAMPOLI
125.  #include "wintty.h"
126.  #undef WINTTY_H
127.  #include "trampoli.h"
128.  #undef EXTERN_H
129.  #include "extern.h"
130.  #endif /* USE_TRAMPOLI */
131.  
132.  #define NO_SPELL	0
133.  
134.  /* flags to control makemon() */
135.  #define NO_MM_FLAGS	  0x00	/* use this rather than plain 0 */
136.  #define NO_MINVENT	  0x01	/* suppress minvent when creating mon */
137.  #define MM_NOWAIT	  0x02	/* don't set STRAT_WAITMASK flags */
138.  #define MM_EDOG		  0x04	/* add edog structure */
139.  #define MM_EMIN		  0x08	/* add emin structure */
140.  #define MM_ANGRY	  0x10  /* monster is created angry */
141.  #define MM_NONAME	  0x20  /* monster is not christened */
142.  #define MM_NOCOUNTBIRTH	  0x40  /* don't increment born counter (for revival) */
143.  #define MM_IGNOREWATER	  0x80	/* ignore water when positioning */
144.  #define MM_ADJACENTOK	  0x100 /* it is acceptable to use adjacent coordinates */
145.  
146.  /* special mhpmax value when loading bones monster to flag as extinct or genocided */
147.  #define DEFUNCT_MONSTER	(-100)
148.  
149.  /* flags for special ggetobj status returns */
150.  #define ALL_FINISHED	  0x01  /* called routine already finished the job */
151.  
152.  /* flags to control query_objlist() */
153.  #define BY_NEXTHERE	  0x1	/* follow objlist by nexthere field */
154.  #define AUTOSELECT_SINGLE 0x2	/* if only 1 object, don't ask */
155.  #define USE_INVLET	  0x4	/* use object's invlet */
156.  #define INVORDER_SORT	  0x8	/* sort objects by packorder */
157.  #define SIGNAL_NOMENU	  0x10	/* return -1 rather than 0 if none allowed */
158.  #define FEEL_COCKATRICE   0x20  /* engage cockatrice checks and react */
159.  #define SIGNAL_CANCEL	  0x40	/* return -4 rather than 0 if explicit cancel */
160.  
161.  /* Flags to control query_category() */
162.  /* BY_NEXTHERE used by query_category() too, so skip 0x01 */
163.  #define UNPAID_TYPES 0x02
164.  #define GOLD_TYPES   0x04
165.  #define WORN_TYPES   0x08
166.  #define ALL_TYPES    0x10
167.  #define BILLED_TYPES 0x20
168.  #define CHOOSE_ALL   0x40
169.  #define BUC_BLESSED  0x80
170.  #define BUC_CURSED   0x100
171.  #define BUC_UNCURSED 0x200
172.  #define BUC_UNKNOWN  0x400
173.  #define BUC_ALLBKNOWN (BUC_BLESSED|BUC_CURSED|BUC_UNCURSED)
174.  #define ALL_TYPES_SELECTED -2
175.  
176.  /* Flags to control find_mid() */
177.  #define FM_FMON	       0x01	/* search the fmon chain */
178.  #define FM_MIGRATE     0x02	/* search the migrating monster chain */
179.  #define FM_MYDOGS      0x04	/* search mydogs */
180.  #define FM_EVERYWHERE  (FM_FMON | FM_MIGRATE | FM_MYDOGS)
181.  
182.  /* Flags to control pick_[race,role,gend,align] routines in role.c */
183.  #define PICK_RANDOM	0
184.  #define PICK_RIGID	1
185.  
186.  /* Flags to control dotrap() in trap.c */
187.  #define NOWEBMSG	0x01	/* suppress stumble into web message */
188.  #define FORCEBUNGLE	0x02	/* adjustments appropriate for bungling */
189.  #define RECURSIVETRAP	0x04	/* trap changed into another type this same turn */
190.  
191.  /* Flags to control test_move in hack.c */
192.  #define DO_MOVE		0	/* really doing the move */
193.  #define TEST_MOVE	1	/* test a normal move (move there next) */
194.  #define TEST_TRAV	2	/* test a future travel location */
195.  
196.  /*** some utility macros ***/
197.  #define yn(query) yn_function(query,ynchars, 'n')
198.  #define ynq(query) yn_function(query,ynqchars, 'q')
199.  #define ynaq(query) yn_function(query,ynaqchars, 'y')
200.  #define nyaq(query) yn_function(query,ynaqchars, 'n')
201.  #define nyNaq(query) yn_function(query,ynNaqchars, 'n')
202.  #define ynNaq(query) yn_function(query,ynNaqchars, 'y')
203.  
204.  /* Macros for scatter */
205.  #define VIS_EFFECTS	0x01	/* display visual effects */
206.  #define MAY_HITMON	0x02	/* objects may hit monsters */
207.  #define MAY_HITYOU	0x04	/* objects may hit you */
208.  #define MAY_HIT		(MAY_HITMON|MAY_HITYOU)
209.  #define MAY_DESTROY	0x08	/* objects may be destroyed at random */
210.  #define MAY_FRACTURE	0x10	/* boulders & statues may fracture */
211.  
212.  /* Macros for launching objects */
213.  #define ROLL		0x01	/* the object is rolling */
214.  #define FLING		0x02	/* the object is flying thru the air */
215.  #define LAUNCH_UNSEEN	0x40	/* hero neither caused nor saw it */
216.  #define LAUNCH_KNOWN	0x80	/* the hero caused this by explicit action */
217.  
218.  /* Macros for explosion types */
219.  #define EXPL_DARK	0
220.  #define EXPL_NOXIOUS	1
221.  #define EXPL_MUDDY	2
222.  #define EXPL_WET	3
223.  #define EXPL_MAGICAL	4
224.  #define EXPL_FIERY	5
225.  #define EXPL_FROSTY	6
226.  #define EXPL_MAX	7
227.  
228.  /* Macros for messages referring to hands, eyes, feet, etc... */
229.  #define ARM 0
230.  #define EYE 1
231.  #define FACE 2
232.  #define FINGER 3
233.  #define FINGERTIP 4
234.  #define FOOT 5
235.  #define HAND 6
236.  #define HANDED 7
237.  #define HEAD 8
238.  #define LEG 9
239.  #define LIGHT_HEADED 10
240.  #define NECK 11
241.  #define SPINE 12
242.  #define TOE 13
243.  #define HAIR 14
244.  #define BLOOD 15
245.  #define LUNG 16
246.  #define NOSE 17
247.  #define STOMACH 18
248.  
249.  /* Flags to control menus */
250.  #define MENUTYPELEN sizeof("traditional ")
251.  #define MENU_TRADITIONAL 0
252.  #define MENU_COMBINATION 1
253.  #define MENU_PARTIAL	 2
254.  #define MENU_FULL	 3
255.  
256.  #define MENU_SELECTED	TRUE
257.  #define MENU_UNSELECTED FALSE
258.  
259.  /*
260.   * Option flags
261.   * Each higher number includes the characteristics of the numbers
262.   * below it.
263.   */
264.  #define SET_IN_FILE	0 /* config file option only */
265.  #define SET_VIA_PROG	1 /* may be set via extern program, not seen in game */
266.  #define DISP_IN_GAME	2 /* may be set via extern program, displayed in game */
267.  #define SET_IN_GAME	3 /* may be set via extern program or set in the game */
268.  
269.  #define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \
270.  	((unsigned long)minor << 16) | \
271.  	((unsigned long)patch << 8) | \
272.  	((unsigned long)0))
273.  
274.  #define FEATURE_NOTICE_VER_MAJ	  (flags.suppress_alert >> 24)
275.  #define FEATURE_NOTICE_VER_MIN	  (((unsigned long)(0x0000000000FF0000L & flags.suppress_alert)) >> 16)
276.  #define FEATURE_NOTICE_VER_PATCH  (((unsigned long)(0x000000000000FF00L & flags.suppress_alert)) >>  8)
277.  
278.  #ifndef max
279.  #define max(a,b) ((a) > (b) ? (a) : (b))
280.  #endif
281.  #ifndef min
282.  #define min(x,y) ((x) < (y) ? (x) : (y))
283.  #endif
284.  #define plur(x) (((x) == 1) ? "" : "s")
285.  
286.  #define ARM_BONUS(obj)	(objects[(obj)->otyp].a_ac + (obj)->spe \
287.  			 - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac))
288.  
289.  #define makeknown(x)	discover_object((x),TRUE,TRUE)
290.  #define distu(xx,yy)	dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
291.  #define onlineu(xx,yy)	online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
292.  #define setustuck(v)	(flags.botl = 1, u.ustuck = (v))
293.  
294.  #define rn1(x,y)	(rn2(x)+(y))
295.  
296.  /* negative armor class is randomly weakened to prevent invulnerability */
297.  #define AC_VALUE(AC)	((AC) >= 0 ? (AC) : -rnd(-(AC)))
298.  
299.  #if defined(MICRO) && !defined(__DJGPP__)
300.  #define getuid() 1
301.  #define getlogin() ((char *)0)
302.  #endif /* MICRO */
303.  
304.  #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB))
305.  # define USE_OVLx
306.  # define STATIC_DCL extern
307.  # define STATIC_OVL
308.  # ifdef OVLB
309.  #  define STATIC_VAR
310.  # else
311.  #  define STATIC_VAR extern
312.  # endif
313.  
314.  #else	/* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */
315.  # define STATIC_DCL static
316.  # define STATIC_OVL static
317.  # define STATIC_VAR static
318.  
319.  /* If not compiling an overlay, compile everything. */
320.  # define OVL0	/* highest priority */
321.  # define OVL1
322.  # define OVL2
323.  # define OVL3	/* lowest specified priority */
324.  # define OVLB	/* the base overlay segment */
325.  #endif	/* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */
326.  
327.  /* Macro for a few items that are only static if we're not overlaid.... */
328.  #if defined(USE_TRAMPOLI) || defined(USE_OVLx)
329.  # define STATIC_PTR
330.  #else
331.  # define STATIC_PTR static
332.  #endif
333.  
334.  /* For my clever ending messages... */
335.  extern int Instant_Death;
336.  extern int Quick_Death;
337.  extern int Nibble_Death;
338.  extern int last_hit;
339.  extern int second_last_hit;
340.  extern int third_last_hit;
341.  
342.  /* For those tough guys who get carried away... */
343.  extern int repeat_hit;
344.  
345.  /* Raw status flags */
346.  #define RAW_STAT_LEVITATION	0x00000001
347.  #define RAW_STAT_CONFUSION	0x00000002
348.  #define RAW_STAT_FOODPOIS	0x00000004
349.  #define RAW_STAT_ILL		0x00000008
350.  #define RAW_STAT_BLIND		0x00000010
351.  #define RAW_STAT_STUNNED	0x00000020
352.  #define RAW_STAT_HALLUCINATION	0x00000040
353.  #define RAW_STAT_SLIMED		0x00000080
354.  
355.  /* The function argument to qsort() requires a particular
356.   * calling convention under WINCE which is not the default
357.   * in that environment.
358.   */
359.  #if defined(WIN_CE)
360.  # define CFDECLSPEC __cdecl
361.  #else
362.  # define CFDECLSPEC
363.  #endif
364.   
365.  #endif /* HACK_H */

Also on Fandom

Random Wiki