Wikia

Wikihack

Source:NetHack 3.2.0/hack.h

2,032pages on
this wiki
Talk0

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

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)hack.h	3.2	95/07/04	*/
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.   /*
34.    * This is the way the game ends.  If these are rearranged, the arrays
35.    * in end.c and topten.c will need to be changed.
36.    */
37.   #define DIED		 0
38.   #define CHOKING		 1
39.   #define POISONING	 2
40.   #define STARVING	 3
41.   #define DROWNING	 4
42.   #define BURNING		 5
43.   #define DISSOLVED	 6
44.   #define CRUSHING	 7
45.   #define STONING		 8
46.   #define GENOCIDED	 9
47.   #define PANICKED	10
48.   #define TRICKED		11
49.   #define QUIT		12
50.   #define ESCAPED		13
51.   #define ASCENDED	14
52.   
53.   #ifndef DUNGEON_H	/* includes align.h */
54.   #include "dungeon.h"
55.   #endif
56.   
57.   #ifndef MONSYM_H
58.   #include "monsym.h"
59.   #endif
60.   #ifndef MKROOM_H
61.   #include "mkroom.h"
62.   #endif
63.   #ifndef OBJCLASS_H
64.   #include "objclass.h"
65.   #endif
66.   #ifndef WINTYPE_H
67.   #include "wintype.h"
68.   #endif
69.   #ifndef DECL_H
70.   #include "decl.h"
71.   #endif
72.   #ifndef TIMEOUT_H
73.   #include "timeout.h"
74.   #endif
75.   
76.   NEARDATA extern coord bhitpos;	/* place where thrown weapon falls to the ground */
77.   
78.   /* types of calls to bhit() */
79.   #define ZAPPED_WAND	0
80.   #define THROWN_WEAPON	1
81.   #define KICKED_WEAPON	2
82.   #define FLASHED_LIGHT	3
83.   #define INVIS_BEAM	4
84.   
85.   #ifndef TRAP_H
86.   #include "trap.h"
87.   #endif
88.   #ifndef FLAG_H
89.   #include "flag.h"
90.   #endif
91.   
92.   #ifndef RM_H
93.   #include "rm.h"
94.   #endif
95.   
96.   #ifndef VISION_H
97.   #include "vision.h"
98.   #endif
99.   
100.  #ifndef DISPLAY_H
101.  #include "display.h"
102.  #endif
103.  
104.  #ifndef ENGRAVE_H
105.  #include "engrave.h"
106.  #endif
107.  
108.  #ifndef RECT_H
109.  #include "rect.h"
110.  #endif
111.  
112.  #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */
113.  #undef NDECL
114.  #define NDECL(f) f()
115.  #endif
116.  
117.  #ifndef EXTERN_H
118.  #include "extern.h"
119.  #endif
120.  
121.  #ifndef WINPROCS_H
122.  #include "winprocs.h"
123.  #endif
124.  
125.  #ifdef USE_TRAMPOLI
126.  #include "wintty.h"
127.  #undef WINTTY_H
128.  
129.  #ifndef TRAMPOLI_H
130.  #include "trampoli.h"
131.  #endif
132.  
133.  #undef EXTERN_H
134.  #include "extern.h"
135.  #endif /* USE_TRAMPOLI */
136.  
137.  #define NO_SPELL	0
138.  
139.  /* flags to control query_objlist() */
140.  #define BY_NEXTHERE	  0x1	/* follow objlist by nexthere field */
141.  #define AUTOSELECT_SINGLE 0x2	/* if only 1 object, don't ask */
142.  #define USE_INVLET	  0x4	/* use object's invlet */
143.  #define INVORDER_SORT	  0x8	/* sort objects by packorder */
144.  #define SIGNAL_NOMENU	  0x10	/* return -1 rather than 0 if none allowed */
145.  
146.  /* Flags to control query_category() */
147.  /* BY_NEXTHERE used by query_category() too, so skip 0x01 */
148.  #define UNPAID_TYPES 0x02
149.  #define GOLD_TYPES   0x04
150.  #define WORN_TYPES   0x08
151.  #define ALL_TYPES    0x10
152.  #define BILLED_TYPES 0x20
153.  #define CHOOSE_ALL   0x40
154.  #define ALL_TYPES_SELECTED -2
155.  
156.  /*** some utility macros ***/
157.  #define yn(query) yn_function(query,ynchars, 'n')
158.  #define ynq(query) yn_function(query,ynqchars, 'q')
159.  #define ynaq(query) yn_function(query,ynaqchars, 'y')
160.  #define nyaq(query) yn_function(query,ynaqchars, 'n')
161.  #define nyNaq(query) yn_function(query,ynNaqchars, 'n')
162.  #define ynNaq(query) yn_function(query,ynNaqchars, 'y')
163.  
164.  /* Macros for scatter */
165.  #define VIS_EFFECTS  0x1	/* Display visual effects             */
166.  #define MAY_HITMON   0x2	/* Objects may hit monsters           */
167.  #define MAY_HITYOU   0x4	/* Objects may hit you                */
168.  #define MAY_HIT      0x6	/* Objects may hit you and monsters   */
169.  #define MAY_DESTROY  0x8	/* Objects may be destroyed at random */
170.  #define MAY_FRACTURE 0x10	/* Boulders & statues may fracture    */
171.  
172.  /* Macros for launching objects */
173.  #define ROLL	1
174.  #define FLING	2
175.  
176.  /* Flags to control menus */
177.  #define MENUTYPELEN sizeof("traditional ")
178.  #define MENU_TRADITIONAL 0
179.  #define MENU_COMBINATION 1
180.  #define MENU_PARTIAL	 2
181.  #define MENU_FULL	 3
182.  
183.  #define MENU_SELECTED	TRUE
184.  #define MENU_UNSELECTED	FALSE
185.  
186.  #ifndef max
187.  #define max(a,b) ((a) > (b) ? (a) : (b))
188.  #endif
189.  #ifndef min
190.  #define min(x,y) ((x) < (y) ? (x) : (y))
191.  #endif
192.  #define plur(x)	(((x) == 1) ? "" : "s")
193.  
194.  #define ARM_BONUS(obj)	(objects[(obj)->otyp].a_ac + (obj)->spe \
195.  			 - min((int)(obj)->oeroded,objects[(obj)->otyp].a_ac))
196.  
197.  #define makeknown(x)	discover_object((x),TRUE)
198.  #define distu(xx,yy)	dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
199.  #define onlineu(xx,yy)	online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy)
200.  
201.  #define rn1(x,y)	(rn2(x)+(y))
202.  
203.  /* negative armor class is randomly weakened to prevent invulnerability */
204.  #define AC_VALUE(AC)	((AC) >= 0 ? (AC) : -rnd(-(AC)))
205.  
206.  #if defined(MICRO) && !defined(__DJGPP__)
207.  #define getuid() 1
208.  #define getlogin() ((char *)0)
209.  #endif /* MICRO */
210.  
211.  #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB))
212.  # define USE_OVLx
213.  # define STATIC_DCL extern
214.  # define STATIC_OVL
215.  # ifdef OVLB
216.  #  define STATIC_VAR
217.  # else
218.  #  define STATIC_VAR extern
219.  # endif
220.  
221.  #else	/* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */
222.  # define STATIC_DCL static
223.  # define STATIC_OVL static
224.  # define STATIC_VAR static
225.  
226.  /* If not compiling an overlay, compile everything. */
227.  # define OVL0	/* Highest priority */
228.  # define OVL1
229.  # define OVL2
230.  # define OVL3	/* Lowest specified priority */
231.  # define OVLB	/* The base overlay segment */
232.  #endif	/* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */
233.  
234.  /* Macro for a few items that are only static if we're not overlaid.... */
235.  #if defined(USE_TRAMPOLI) || defined(USE_OVLx)
236.  # define STATIC_PTR
237.  #else
238.  # define STATIC_PTR static
239.  #endif
240.  
241.  #endif /* HACK_H */

Around Wikia's network

Random Wiki