1 /* SCCS Id: @(#)global.h 3.3 99/07/02 */ 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 11 /*#define BETA */ /* if a beta-test copy [MRS] */ 12 13 /* 14 * Files expected to exist in the playground directory. 15 */ 16 17 #define RECORD "record" /* file containing list of topscorers */ 18 #define HELP "help" /* file containing command descriptions */ 19 #define SHELP "hh" /* abbreviated form of the same */ 20 #define DEBUGHELP "wizhelp" /* file containing debug mode cmds */ 21 #define RUMORFILE "rumors" /* file with fortune cookies */ 22 #define ORACLEFILE "oracles" /* file with oracular information */ 23 #define DATAFILE "data" /* file giving the meaning of symbols used */ 24 #define CMDHELPFILE "cmdhelp" /* file telling what commands do */ 25 #define HISTORY "history" /* file giving nethack's history */ 26 #define LICENSE "license" /* file with license information */ 27 #define OPTIONFILE "opthelp" /* file explaining runtime options */ 28 #define OPTIONS_USED "options" /* compile-time options, for #version */ 29 30 #define LEV_EXT ".lev" /* extension for special level files */ 31 32 33 /* Assorted definitions that may depend on selections in config.h. */ 34 35 /* 36 * for DUMB preprocessor and compiler, e.g., cpp and pcc supplied 37 * with Microport SysV/AT, which have small symbol tables; 38 * DUMB if needed is defined in CFLAGS 39 */ 40 #ifdef DUMB 41 #ifdef BITFIELDS 42 #undef BITFIELDS 43 #endif 44 #ifndef STUPID 45 #define STUPID 46 #endif 47 #endif /* DUMB */ 48 49 /* 50 * type xchar: small integers in the range 0 - 127, usually coordinates 51 * although they are nonnegative they must not be declared unsigned 52 * since otherwise comparisons with signed quantities are done incorrectly 53 */ 54 typedef schar xchar; 55 #ifndef SKIP_BOOLEAN 56 typedef xchar boolean; /* 0 or 1 */ 57 #endif 58 59 #ifndef TRUE /* defined in some systems' native include files */ 60 #define TRUE ((boolean)1) 61 #define FALSE ((boolean)0) 62 #endif 63 64 #ifndef STRNCMPI 65 # ifndef __SASC_60 /* SAS/C already shifts to stricmp */ 66 # define strcmpi(a,b) strncmpi((a),(b),-1) 67 # endif 68 #endif 69 70 /* comment out to test effects of each #define -- these will probably 71 * disappear eventually 72 */ 73 #ifdef INTERNAL_COMP 74 # define RLECOMP /* run-length compression of levl array - JLee */ 75 # define ZEROCOMP /* zero-run compression of everything - Olaf Seibert */ 76 #endif 77 78 /* #define SPECIALIZATION */ /* do "specialized" version of new topology */ 79 80 81 #ifdef BITFIELDS 82 #define Bitfield(x,n) unsigned x:n 83 #else 84 #define Bitfield(x,n) uchar x 85 #endif 86 87 #ifdef UNWIDENED_PROTOTYPES 88 # define CHAR_P char 89 # define SCHAR_P schar 90 # define UCHAR_P uchar 91 # define XCHAR_P xchar 92 # define SHORT_P short 93 #ifndef SKIP_BOOLEAN 94 # define BOOLEAN_P boolean 95 #endif 96 # define ALIGNTYP_P aligntyp 97 #else 98 # ifdef WIDENED_PROTOTYPES 99 # define CHAR_P int 100 # define SCHAR_P int 101 # define UCHAR_P int 102 # define XCHAR_P int 103 # define SHORT_P int 104 # define BOOLEAN_P int 105 # define ALIGNTYP_P int 106 # endif 107 #endif 108 #if defined(ULTRIX_PROTO) && !defined(__STDC__) 109 /* The ultrix 2.0 and 2.1 compilers (on Ultrix 4.0 and 4.2 respectively) can't 110 * handle "struct obj *" constructs in prototypes. Their bugs are different, 111 * but both seem to work if we put "void*" in the prototype instead. This 112 * gives us minimal prototype checking but avoids the compiler bugs. 113 * 114 * OBJ_P and MONST_P should _only_ be used for declaring function pointers. 115 */ 116 #define OBJ_P void* 117 #define MONST_P void* 118 #else 119 #define OBJ_P struct obj* 120 #define MONST_P struct monst* 121 #endif 122 123 #define SIZE(x) (int)(sizeof(x) / sizeof(x[0])) 124 125 126 /* A limit for some NetHack int variables. It need not, and for comparable 127 * scoring should not, depend on the actual limit on integers for a 128 * particular machine, although it is set to the minimum required maximum 129 * signed integer for C (2^15 -1). 130 */ 131 #define LARGEST_INT 32767 132 133 134 #ifdef REDO 135 #define Getchar pgetchar 136 #endif 137 138 139 #include "coord.h" 140 /* 141 * Automatic inclusions for the subsidiary files. 142 * Please don't change the order. It does matter. 143 */ 144 145 #ifdef VMS 146 #include "vmsconf.h" 147 #endif 148 149 #ifdef UNIX 150 #include "unixconf.h" 151 #endif 152 153 #ifdef OS2 154 #include "os2conf.h" 155 #endif 156 157 #ifdef MSDOS 158 #include "pcconf.h" 159 #endif 160 161 #ifdef TOS 162 #include "tosconf.h" 163 #endif 164 165 #ifdef AMIGA 166 #include "amiconf.h" 167 #endif 168 169 #ifdef MAC 170 #include "macconf.h" 171 #endif 172 173 #ifdef __BEOS__ 174 #include "beconf.h" 175 #endif 176 177 #ifdef WIN32 178 #include "ntconf.h" 179 #endif 180 181 /* Displayable name of this port; don't redefine if defined in *conf.h */ 182 #ifndef PORT_ID 183 # ifdef AMIGA 184 # define PORT_ID "Amiga" 185 # endif 186 # ifdef MAC 187 # define PORT_ID "Mac" 188 # endif 189 # ifdef MSDOS 190 # ifdef PC9800 191 # define PORT_ID "PC-9800" 192 # else 193 # define PORT_ID "PC" 194 # endif 195 # ifdef DJGPP 196 # define PORT_SUB_ID "djgpp" 197 # else 198 # ifdef OVERLAY 199 # define PORT_SUB_ID "overlaid" 200 # else 201 # define PORT_SUB_ID "non-overlaid" 202 # endif 203 # endif 204 # endif 205 # ifdef OS2 206 # define PORT_ID "OS/2" 207 # endif 208 # ifdef TOS 209 # define PORT_ID "ST" 210 # endif 211 # ifdef UNIX 212 # define PORT_ID "Unix" 213 # endif 214 # ifdef VMS 215 # define PORT_ID "VMS" 216 # endif 217 # ifdef WIN32 218 # define PORT_ID "NT" 219 # endif 220 #endif 221 222 #if defined(MICRO) 223 #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS) && !defined(WIN32) 224 #define SHORT_FILENAMES /* filenames are 8.3 */ 225 #endif 226 #endif 227 228 #ifdef VMS 229 /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below. 230 * these definitions allow all systems to be treated uniformly, provided 231 * main() routines do not terminate with return(), whose value is not 232 * so massaged. 233 */ 234 # ifdef EXIT_SUCCESS 235 # undef EXIT_SUCCESS 236 # endif 237 # ifdef EXIT_FAILURE 238 # undef EXIT_FAILURE 239 # endif 240 #endif 241 242 #ifndef EXIT_SUCCESS 243 # define EXIT_SUCCESS 0 244 #endif 245 #ifndef EXIT_FAILURE 246 # define EXIT_FAILURE 1 247 #endif 248 249 #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) 250 # ifndef USE_TILES 251 # define USE_TILES /* glyph2tile[] will be available */ 252 # endif 253 #endif 254 #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS) 255 # ifndef USE_TILES 256 # define USE_TILES 257 # endif 258 #endif 259 260 261 #define Sprintf (void) sprintf 262 #define Strcat (void) strcat 263 #define Strcpy (void) strcpy 264 #ifdef NEED_VARARGS 265 #define Vprintf (void) vprintf 266 #define Vfprintf (void) vfprintf 267 #define Vsprintf (void) vsprintf 268 #endif 269 270 271 /* primitive memory leak debugging; see alloc.c */ 272 #ifdef MONITOR_HEAP 273 extern long *FDECL(nhalloc, (unsigned int,const char *,int)); 274 extern void FDECL(nhfree, (genericptr_t,const char *,int)); 275 # ifndef __FILE__ 276 # define __FILE__ "" 277 # endif 278 # ifndef __LINE__ 279 # define __LINE__ 0 280 # endif 281 # define alloc(a) nhalloc(a,__FILE__,(int)__LINE__) 282 # define free(a) nhfree(a,__FILE__,(int)__LINE__) 283 #else /* !MONITOR_HEAP */ 284 extern long *FDECL(alloc, (unsigned int)); /* alloc.c */ 285 #endif 286 287 /* Used for consistency checks of various data files; declare it here so 288 that utility programs which include config.h but not hack.h can see it. */ 289 struct version_info { 290 unsigned long incarnation; /* actual version number */ 291 unsigned long feature_set; /* bitmask of config settings */ 292 unsigned long entity_count; /* # of monsters and objects */ 293 unsigned long struct_sizes; /* size of key structs */ 294 }; 295 296 297 /* 298 * Configurable internal parameters. 299 * 300 * Please be very careful if you are going to change one of these. Any 301 * changes in these parameters, unless properly done, can render the 302 * executable inoperative. 303 */ 304 305 /* size of terminal screen is (at least) (ROWNO+3) by COLNO */ 306 #define COLNO 80 307 #define ROWNO 21 308 309 #define MAXNROFROOMS 40 /* max number of rooms per level */ 310 #define MAX_SUBROOMS 24 /* max # of subrooms in a given room */ 311 #define DOORMAX 120 /* max number of doors per level */ 312 313 #define BUFSZ 256 /* for getlin buffers */ 314 #define QBUFSZ 128 /* for building question text */ 315 #define TBUFSZ 300 /* toplines[] buffer max msg: 3 81char names */ 316 /* plus longest prefix plus a few extra words */ 317 318 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ 319 #define PL_CSIZ 32 /* sizeof pl_character */ 320 #define PL_FSIZ 32 /* fruit name */ 321 #define PL_PSIZ 63 /* player-given names for pets, other 322 * monsters, objects */ 323 324 #define MAXDUNGEON 16 /* current maximum number of dungeons */ 325 #define MAXLEVEL 32 /* max number of levels in one dungeon */ 326 #define MAXSTAIRS 1 /* max # of special stairways in a dungeon */ 327 #define ALIGNWEIGHT 4 /* generation weight of alignment */ 328 329 #define MAXULEV 30 /* max character experience level */ 330 331 #define MAXMONNO 120 /* geno monst after this number killed */ 332 #define MHPMAX 500 /* maximum monster hp */ 333 334 #endif /* GLOBAL_H */ 335