Wikihack
Advertisement

Below is the full text to global.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/global.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: @(#)global.h	3.4	2003/08/31	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef GLOBAL_H
6.    #define GLOBAL_H
7.    
8.    #include <stdio.h>
9.    
10.   /* #define ALPHA */	/* if an alpha-test copy */
11.   /* #define BETA */	/* if an alpha- or beta-test copy */
12.   /* #define OBJ_SANITY *//* Object sanity checks for all players */
13.   
14.   /*
15.    * Files expected to exist in the playground directory if file areas are not
16.    * enabled and in the named areas otherwise.
17.    * [WAC] - put a NH_ prefix on all the names to prevent conflicts
18.    */
19.   
20.   #define NH_RECORD		"record"  /* a file containing list of topscorers */
21.   #define NH_RECORD_AREA	FILE_AREA_VAR
22.   #define NH_HELP		"help"	  /* a file containing command descriptions */
23.   #define NH_HELP_AREA	FILE_AREA_SHARE
24.   #define NH_SHELP		"hh"		/* abbreviated form of the same */
25.   #define NH_SHELP_AREA	FILE_AREA_SHARE
26.   #define NH_DEBUGHELP	"wizhelp"	/* a file containing debug mode cmds */
27.   #define NH_DEBUGHELP_AREA	FILE_AREA_SHARE
28.   #define NH_RUMORFILE	"rumors"	/* a file with fortune cookies */
29.   #define NH_RUMORAREA	FILE_AREA_SHARE
30.   #define NH_ORACLEFILE	"oracles"	/* a file with oracular information */
31.   #define NH_ORACLEAREA	FILE_AREA_SHARE
32.   #define NH_DATAFILE	"data"	/* a file giving the meaning of symbols used */
33.   #define NH_DATAAREA	FILE_AREA_SHARE
34.   #define NH_CMDHELPFILE	"cmdhelp"	/* file telling what commands do */
35.   #define NH_CMDHELPAREA	FILE_AREA_SHARE
36.   #define NH_HISTORY		"history"	/* a file giving nethack's history */
37.   #define NH_HISTORY_AREA	FILE_AREA_SHARE
38.   #define NH_LICENSE		"license"	/* file with license information */
39.   #define NH_LICENSE_AREA	FILE_AREA_DOC
40.   #define NH_OPTIONFILE	"opthelp"	/* a file explaining runtime options */
41.   #define NH_OPTIONAREA	FILE_AREA_SHARE
42.   #define NH_OPTIONS_USED	"options"	/* compile-time options, for #version */
43.   #define NH_OPTIONS_USED_AREA FILE_AREA_SHARE
44.   #ifdef SHORT_FILENAMES
45.   # define NH_GUIDEBOOK       "guideboo.txt"        /* Nethack Guidebook*/
46.   #else
47.   #define NH_GUIDEBOOK       "Guidebook.txt"       /* Nethack Guidebook*/
48.   #endif
49.   #define NH_GUIDEBOOK_AREA	FILE_AREA_DOC
50.   
51.   #define LEV_EXT	".lev"		/* extension for special level files */
52.   
53.   
54.   /* Assorted definitions that may depend on selections in config.h. */
55.   
56.   /*
57.    * for DUMB preprocessor and compiler, e.g., cpp and pcc supplied
58.    * with Microport SysV/AT, which have small symbol tables;
59.    * DUMB if needed is defined in CFLAGS
60.    */
61.   #ifdef DUMB
62.   #ifdef BITFIELDS
63.   #undef BITFIELDS
64.   #endif
65.   #ifndef STUPID
66.   #define STUPID
67.   #endif
68.   #endif	/* DUMB */
69.   
70.   /*
71.    * type xchar: small integers in the range 0 - 127, usually coordinates
72.    * although they are nonnegative they must not be declared unsigned
73.    * since otherwise comparisons with signed quantities are done incorrectly
74.    */
75.   typedef schar	xchar;
76.   #ifndef SKIP_BOOLEAN
77.   typedef xchar	boolean;		/* 0 or 1 */
78.   #endif
79.   
80.   #ifndef TRUE		/* defined in some systems' native include files */
81.   #define TRUE	((boolean)1)
82.   #define FALSE	((boolean)0)
83.   #endif
84.   
85.   #ifndef STRNCMPI
86.   # if !defined(__SASC_60) && !defined(__MINGW32__) /* SAS/C already shifts to stricmp */
87.   #  define strcmpi(a,b) strncmpi((a),(b),-1)
88.   # endif
89.   #endif
90.   
91.   /* comment out to test effects of each #define -- these will probably
92.    * disappear eventually
93.    */
94.   #ifdef INTERNAL_COMP
95.   # define RLECOMP	/* run-length compression of levl array - JLee */
96.   # define ZEROCOMP	/* zero-run compression of everything - Olaf Seibert */
97.   #endif
98.   
99.   /* #define SPECIALIZATION */	/* do "specialized" version of new topology */
100.  
101.  
102.  #ifdef BITFIELDS
103.  #define Bitfield(x,n)	unsigned x:n
104.  #else
105.  #define Bitfield(x,n)	uchar x
106.  #endif
107.  
108.  #ifdef UNWIDENED_PROTOTYPES
109.  # define CHAR_P char
110.  # define SCHAR_P schar
111.  # define UCHAR_P uchar
112.  # define XCHAR_P xchar
113.  # define SHORT_P short
114.  #ifndef SKIP_BOOLEAN
115.  # define BOOLEAN_P boolean
116.  #endif
117.  # define ALIGNTYP_P aligntyp
118.  #else
119.  # ifdef WIDENED_PROTOTYPES
120.  #  define CHAR_P int
121.  #  define SCHAR_P int
122.  #  define UCHAR_P int
123.  #  define XCHAR_P int
124.  #  define SHORT_P int
125.  #  define BOOLEAN_P int
126.  #  define ALIGNTYP_P int
127.  # endif
128.  #endif
129.  #if defined(ULTRIX_PROTO) && !defined(__STDC__)
130.  /* The ultrix 2.0 and 2.1 compilers (on Ultrix 4.0 and 4.2 respectively) can't
131.   * handle "struct obj *" constructs in prototypes.  Their bugs are different,
132.   * but both seem to work if we put "void*" in the prototype instead.  This
133.   * gives us minimal prototype checking but avoids the compiler bugs.
134.   *
135.   * OBJ_P and MONST_P should _only_ be used for declaring function pointers.
136.   */
137.  #define OBJ_P void*
138.  #define MONST_P void*
139.  #else
140.  #define OBJ_P struct obj*
141.  #define MONST_P struct monst*
142.  #endif
143.  
144.  #define SIZE(x)	(int)(sizeof(x) / sizeof(x[0]))
145.  
146.  
147.  /* A limit for some NetHack int variables.  It need not, and for comparable
148.   * scoring should not, depend on the actual limit on integers for a
149.   * particular machine, although it is set to the minimum required maximum
150.   * signed integer for C (2^15 -1).
151.   */
152.  #define LARGEST_INT	32767
153.  
154.  
155.  #ifdef REDO
156.  #define Getchar pgetchar
157.  #endif
158.  
159.  
160.  #include "coord.h"
161.  /*
162.   * Automatic inclusions for the subsidiary files.
163.   * Please don't change the order.  It does matter.
164.   */
165.  
166.  #ifdef VMS
167.  #include "vmsconf.h"
168.  #endif
169.  
170.  #ifdef UNIX
171.  #include "unixconf.h"
172.  #endif
173.  
174.  #ifdef OS2
175.  #include "os2conf.h"
176.  #endif
177.  
178.  #ifdef MSDOS
179.  #include "pcconf.h"
180.  #endif
181.  
182.  #ifdef TOS
183.  #include "tosconf.h"
184.  #endif
185.  
186.  #ifdef AMIGA
187.  #include "amiconf.h"
188.  #endif
189.  
190.  #ifdef MAC
191.  #include "macconf.h"
192.  #endif
193.  
194.  #ifdef __BEOS__
195.  #include "beconf.h"
196.  #endif
197.  
198.  #ifdef WIN32
199.  #ifdef WIN_CE
200.  #include "wceconf.h"
201.  #else
202.  #include "ntconf.h"
203.  #endif
204.  #endif
205.  
206.  #ifndef FILE_AREAS
207.  
208.  #define fopen_datafile_area(area, filename, mode, use_spfx) \
209.   		fopen_datafile(filename, mode, use_spfx)
210.  #define lock_file_area(area, filename, prefix, retryct) \
211.   		lock_file(filename, prefix, retryct)
212.  #define unlock_file_area(area, filename) unlock_file(filename)
213.  #define dlb_fopen_area(area, name, mode) dlb_fopen(name, mode)
214.  
215.  /*
216.   * ALI
217.   *
218.   * By defining these, functions can pass them around even though they're
219.   * not actually used. This can make the code easier to read at the cost
220.   * of some efficiency. Given the high overhead of dealing with files anyway,
221.   * this is often a good trade-off.
222.   */
223.  
224.  #define FILE_AREA_VAR		NULL
225.  #define FILE_AREA_SAVE		NULL
226.  #define FILE_AREA_LEVL		NULL
227.  #define FILE_AREA_BONES		NULL
228.  #define FILE_AREA_SHARE		NULL
229.  #define FILE_AREA_UNSHARE	NULL
230.  
231.  #endif
232.  
233.  /* Displayable name of this port; don't redefine if defined in *conf.h */
234.  #ifndef PORT_ID
235.  # ifdef AMIGA
236.  #  define PORT_ID	"Amiga"
237.  # endif
238.  # ifdef MAC
239.  #  define PORT_ID	"Mac"
240.  #  if 0
241.  #  ifdef MAC_MPW_PPC
242.  #   define PORT_SUB_ID "PPC"
243.  #  else
244.  #   ifdef MAC_MPW_68K
245.  #    define PORT_SUB_ID "68K"
246.  #   endif
247.  #  endif
248.  #  endif
249.  # endif
250.  # ifdef MSDOS
251.  #  ifdef PC9800
252.  #  define PORT_ID	"PC-9800"
253.  #  else
254.  #  define PORT_ID	"PC"
255.  #  endif
256.  #  ifdef DJGPP
257.  #  define PORT_SUB_ID	"djgpp"
258.  #  else
259.  #   ifdef OVERLAY
260.  #  define PORT_SUB_ID	"overlaid"
261.  #   else
262.  #  define PORT_SUB_ID	"non-overlaid"
263.  #   endif
264.  #  endif
265.  # endif
266.  # ifdef OS2
267.  #  define PORT_ID	"OS/2"
268.  # endif
269.  # ifdef TOS
270.  #  define PORT_ID	"ST"
271.  # endif
272.  # ifdef UNIX
273.  #  define PORT_ID	"Unix"
274.  # endif
275.  # ifdef VMS
276.  #  define PORT_ID	"VMS"
277.  # endif
278.  # ifdef WIN32
279.  #  define PORT_ID	"Windows"
280.  #  ifndef PORT_SUB_ID
281.  #   if defined(MSWIN_GRAPHICS) || defined(GTK_GRAPHICS)
282.  #    define PORT_SUB_ID	"graphical"
283.  #   else
284.  #    define PORT_SUB_ID	"tty"
285.  #   endif
286.  #  endif
287.  # endif
288.  #endif
289.  
290.  #if defined(MICRO)
291.  #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS)
292.  #define SHORT_FILENAMES		/* filenames are 8.3 */
293.  #endif
294.  #endif
295.  
296.  #ifdef VMS
297.  /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below.
298.   * these definitions allow all systems to be treated uniformly, provided
299.   * main() routines do not terminate with return(), whose value is not
300.   * so massaged.
301.   */
302.  # ifdef EXIT_SUCCESS
303.  #  undef EXIT_SUCCESS
304.  # endif
305.  # ifdef EXIT_FAILURE
306.  #  undef EXIT_FAILURE
307.  # endif
308.  #endif
309.  
310.  #ifndef EXIT_SUCCESS
311.  # define EXIT_SUCCESS 0
312.  #endif
313.  #ifndef EXIT_FAILURE
314.  # define EXIT_FAILURE 1
315.  #endif
316.  
317.  #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) || defined(MSWIN_GRAPHICS)
318.  # ifndef USE_TILES
319.  #  define USE_TILES		/* glyph2tile[] will be available */
320.  # endif
321.  #endif
322.  #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS) || defined(GTK_GRAPHICS)
323.  # ifndef USE_TILES
324.  #  define USE_TILES
325.  # endif
326.  #endif
327.  #if defined(GL_GRAPHICS) || defined(SDL_GRAPHICS)
328.  # ifndef USE_TILES
329.  #  define USE_TILES
330.  # endif
331.  #endif
332.  
333.  #define Sprintf  (void) sprintf
334.  #define Strcat   (void) strcat
335.  #define Strcpy   (void) strcpy
336.  #ifdef NEED_VARARGS
337.  #define Vprintf  (void) vprintf
338.  #define Vfprintf (void) vfprintf
339.  #define Vsprintf (void) vsprintf
340.  #endif
341.  
342.  
343.  /* primitive memory leak debugging; see alloc.c */
344.  #ifdef MONITOR_HEAP
345.  extern long *FDECL(nhalloc, (unsigned int,const char *,int));
346.  extern void FDECL(nhfree, (genericptr_t,const char *,int));
347.  #ifdef INTERNAL_MALLOC
348.  extern void FDECL(monitor_heap_push, (const char *, int));
349.  extern unsigned long FDECL(monitor_heap_pop, (const char *, int, unsigned long));
350.  extern void FDECL(monitor_heap_set_subid, (const char *, int ));
351.  extern size_t NDECL(monitor_heap_getmem);
352.  extern boolean FDECL(monitor_heap_trace, (boolean flag));
353.  extern void NDECL(monitor_heap_mark);
354.  #endif
355.  # ifndef __FILE__
356.  #  define __FILE__ ""
357.  # endif
358.  # ifndef __LINE__
359.  #  define __LINE__ 0
360.  # endif
361.  # define alloc(a) nhalloc(a,__FILE__,(int)__LINE__)
362.  # define free(a) nhfree(a,__FILE__,(int)__LINE__)
363.  #else	/* !MONITOR_HEAP */
364.  extern long *FDECL(alloc, (unsigned int));		/* alloc.c */
365.  #endif
366.  
367.  /* Used for consistency checks of various data files; declare it here so
368.     that utility programs which include config.h but not hack.h can see it. */
369.  struct version_info {
370.  	unsigned long	incarnation;	/* actual version number */
371.  	unsigned long	feature_set;	/* bitmask of config settings */
372.  	unsigned long	entity_count;	/* # of monsters and objects */
373.  	unsigned long	struct_sizes;	/* size of key structs */
374.  };
375.  
376.  /*
377.   * Configurable internal parameters.
378.   *
379.   * Please be very careful if you are going to change one of these.  Any
380.   * changes in these parameters, unless properly done, can render the
381.   * executable inoperative.
382.   */
383.  
384.  /* size of terminal screen is (at least) (ROWNO+3) by COLNO */
385.  #define COLNO	80
386.  #define ROWNO	21
387.  
388.  #define MAXNROFROOMS	40	/* max number of rooms per level */
389.  #define MAX_SUBROOMS	24	/* max # of subrooms in a given room */
390.  #define DOORMAX		120	/* max number of doors per level */
391.  
392.  #define BUFSZ		256	/* for getlin buffers */
393.  #define QBUFSZ		128	/* for building question text */
394.  #define TBUFSZ		300	/* toplines[] buffer max msg: 3 81char names */
395.  				/* plus longest prefix plus a few extra words */
396.  
397.  #define PL_NSIZ		32	/* name of player, ghost, shopkeeper */
398.  #define PL_CSIZ		32	/* sizeof pl_character */
399.  #define PL_FSIZ		32	/* fruit name */
400.  #define PL_PSIZ		63	/* player-given names for pets, other
401.  				 * monsters, objects */
402.  
403.  #define MAXDUNGEON	32	/* current maximum number of dungeons */
404.  #define MAXLEVEL	50	/* max number of levels in one dungeon */
405.  #define MAXSTAIRS	1	/* max # of special stairways in a dungeon */
406.  #define ALIGNWEIGHT	10	/* generation weight of alignment */
407.  
408.  #define MAXULEV		30	/* max character experience level */
409.  
410.  #define MAXMONNO	120	/* extinct monst after this number created */
411.  #define MHPMAX		500	/* maximum monster hp */
412.  
413.  #endif /* GLOBAL_H */
Advertisement