Fandom

Wikihack

Source: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.

hac viet voi


Below is the full text to include/hack.h from NetHack 3.4.3. To link to a particular line, write [[hack.h#line123]], for example.

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.    
The NetHack General Public License applies to screenshots, source code and other content from NetHack.
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	/* 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 CHOKING		 1
69.   #define POISONING	 2
70.   #define STARVING	 3
71.   #define DROWNING	 4
72.   #define BURNING		 5
73.   #define DISSOLVED	 6
74.   #define CRUSHING	 7
75.   #define STONING		 8
76.   #define TURNED_SLIME	 9
77.   #define GENOCIDED	10
78.   #define PANICKED	11
79.   #define TRICKED		12
80.   #define QUIT		13
81.   #define ESCAPED		14
82.   #define ASCENDED	15
83.   
84.   #include "align.h"
85.   #include "dungeon.h"
86.   #include "monsym.h"
87.   #include "mkroom.h"
88.   #include "objclass.h"
89.   #include "youprop.h"
90.   #include "wintype.h"
91.   #include "decl.h"
92.   #include "timeout.h"
93.   
94.   NEARDATA extern coord bhitpos;	/* place where throw or zap hits or stops */
95.   
96.   /* types of calls to bhit() */
97.   #define ZAPPED_WAND	0
98.   #define THROWN_WEAPON	1
99.   #define KICKED_WEAPON	2
100.  #define FLASHED_LIGHT	3
101.  #define INVIS_BEAM	4
102.  
103.  #define MATCH_WARN_OF_MON(mon)	 (Warn_of_mon && flags.warntype && \
104.  		   		 (flags.warntype & (mon)->data->mflags2))
105.  
106.  #include "trap.h"
107.  #include "flag.h"
108.  #include "rm.h"
109.  #include "vision.h"
110.  #include "display.h"
111.  #include "engrave.h"
112.  #include "rect.h"
113.  #include "region.h"
114.  
115.  #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */
116.  #undef NDECL
117.  #define NDECL(f) f()
118.  #endif
119.  
120.  #include "extern.h"
121.  #include "winprocs.h"
122.  
123.  #ifdef USE_TRAMPOLI
124.  #include "wintty.h"
125.  #undef WINTTY_H
126.  #include "trampoli.h"
127.  #undef EXTERN_H
128.  #include "extern.h"
129.  #endif /* USE_TRAMPOLI */
130.  
131.  #define NO_SPELL	0
132.  
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 */
144.  
145.  /* special mhpmax value when loading bones monster to flag as extinct or genocided */
146.  #define DEFUNCT_MONSTER	(-100)
147.  
148.  /* flags for special ggetobj status returns */
149.  #define ALL_FINISHED	  0x01  /* called routine already finished the job */
150.  
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 */
158.  
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
173.  
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)
179.  
180.  /* Flags to control pick_[race,role,gend,align] routines in role.c */
181.  #define PICK_RANDOM	0
182.  #define PICK_RIGID	1
183.  
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 */
188.  
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 */
193.  
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')
201.  
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 */
209.  
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 */
215.  
216.  /* Macros for explosion types */
217.  #define EXPL_DARK	0
218.  #define EXPL_NOXIOUS	1
219.  #define EXPL_MUDDY	2
220.  #define EXPL_WET	3
221.  #define EXPL_MAGICAL	4
222.  #define EXPL_FIERY	5
223.  #define EXPL_FROSTY	6
224.  #define EXPL_MAX	7
225.  
226.  /* Macros for messages referring to hands, eyes, feet, etc... */
227.  #define ARM 0
228.  #define EYE 1
229.  #define FACE 2
230.  #define FINGER 3
231.  #define FINGERTIP 4
232.  #define FOOT 5
233.  #define HAND 6
234.  #define HANDED 7
235.  #define HEAD 8
236.  #define LEG 9
237.  #define LIGHT_HEADED 10
238.  #define NECK 11
239.  #define SPINE 12
240.  #define TOE 13
241.  #define HAIR 14
242.  #define BLOOD 15
243.  #define LUNG 16
244.  #define NOSE 17
245.  #define STOMACH 18
246.  
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
252.  #define MENU_FULL	 3
253.  
254.  #define MENU_SELECTED	TRUE
255.  #define MENU_UNSELECTED FALSE
256.  
257.  /*
258.   * Option flags
259.   * Each higher number includes the characteristics of the numbers
260.   * below it.
261.   */
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 */
266.  
267.  #define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \
268.  	((unsigned long)minor << 16) | \
269.  	((unsigned long)patch << 8) | \
270.  	((unsigned long)0))
271.  
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)
275.  
276.  #ifndef max
277.  #define max(a,b) ((a) > (b) ? (a) : (b))
278.  #endif
279.  #ifndef min
280.  #define min(x,y) ((x) < (y) ? (x) : (y))
281.  #endif
282.  #define plur(x) (((x) == 1) ? "" : "s")
283.  
284.  #define ARM_BONUS(obj)	(objects[(obj)->otyp].a_ac + (obj)->spe \
285.  			 - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac))
286.  
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)
290.  
291.  #define rn1(x,y)	(rn2(x)+(y))
292.  
293.  /* negative armor class is randomly weakened to prevent invulnerability */
294.  #define AC_VALUE(AC)	((AC) >= 0 ? (AC) : -rnd(-(AC)))
295.  
296.  #if defined(MICRO) && !defined(__DJGPP__)
297.  #define getuid() 1
298.  #define getlogin() ((char *)0)
299.  #endif /* MICRO */
300.  
301.  #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB))
302.  # define USE_OVLx
303.  # define STATIC_DCL extern
304.  # define STATIC_OVL
305.  # ifdef OVLB
306.  #  define STATIC_VAR
307.  # else
308.  #  define STATIC_VAR extern
309.  # endif
310.  
311.  #else	/* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */
312.  # define STATIC_DCL static
313.  # define STATIC_OVL static
314.  # define STATIC_VAR static
315.  
316.  /* If not compiling an overlay, compile everything. */
317.  # define OVL0	/* highest priority */
318.  # define OVL1
319.  # define OVL2
320.  # define OVL3	/* lowest specified priority */
321.  # define OVLB	/* the base overlay segment */
322.  #endif	/* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */
323.  
324.  /* Macro for a few items that are only static if we're not overlaid.... */
325.  #if defined(USE_TRAMPOLI) || defined(USE_OVLx)
326.  # define STATIC_PTR
327.  #else
328.  # define STATIC_PTR static
329.  #endif
330.  
331.  /* The function argument to qsort() requires a particular
332.   * calling convention under WINCE which is not the default
333.   * in that environment.
334.   */
335.  #if defined(WIN_CE)
336.  # define CFDECLSPEC __cdecl
337.  #else
338.  # define CFDECLSPEC
339.  #endif
340.   
341.  #endif /* HACK_H */

jghgfgffgf

Also on Fandom

Random Wiki