From dd7f5485197d9f9e22ca10927e835a01f6618059 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 15:43:13 +0100 Subject: [PATCH 1/9] Remove nh5 deleted headers --- include/beconf.h | 35 - include/bitmfile.h | 33 - include/def_os2.h | 213 ------ include/gem_rsc.h | 64 -- include/lev.h | 54 -- include/load_img.h | 47 -- include/mac-carbon.h | 33 - include/mac-qt.h | 34 - include/mac-term.h | 35 - include/macconf.h | 128 ---- include/macpopup.h | 15 - include/mactty.h | 349 ---------- include/macwin.h | 247 ------- include/monsym.h | 148 ----- include/mttypriv.h | 62 -- include/ntconf.h | 297 --------- include/os2conf.h | 105 --- include/qt_clust.h | 34 - include/qt_kde0.h | 11 - include/qt_win.h | 890 -------------------------- include/qt_xpms.h | 1422 ----------------------------------------- include/qtext.h | 118 ---- include/qttableview.h | 293 --------- include/system.h | 571 ----------------- include/trampoli.h | 288 --------- include/wceconf.h | 349 ---------- include/winGnome.h | 18 - include/wingem.h | 112 ---- 28 files changed, 6005 deletions(-) delete mode 100644 include/beconf.h delete mode 100644 include/bitmfile.h delete mode 100644 include/def_os2.h delete mode 100644 include/gem_rsc.h delete mode 100644 include/lev.h delete mode 100644 include/load_img.h delete mode 100644 include/mac-carbon.h delete mode 100644 include/mac-qt.h delete mode 100644 include/mac-term.h delete mode 100644 include/macconf.h delete mode 100644 include/macpopup.h delete mode 100644 include/mactty.h delete mode 100644 include/macwin.h delete mode 100644 include/monsym.h delete mode 100644 include/mttypriv.h delete mode 100644 include/ntconf.h delete mode 100644 include/os2conf.h delete mode 100644 include/qt_clust.h delete mode 100644 include/qt_kde0.h delete mode 100644 include/qt_win.h delete mode 100644 include/qt_xpms.h delete mode 100644 include/qtext.h delete mode 100644 include/qttableview.h delete mode 100644 include/system.h delete mode 100644 include/trampoli.h delete mode 100644 include/wceconf.h delete mode 100644 include/winGnome.h delete mode 100644 include/wingem.h diff --git a/include/beconf.h b/include/beconf.h deleted file mode 100644 index 29f5eec3d..000000000 --- a/include/beconf.h +++ /dev/null @@ -1,35 +0,0 @@ -/* NetHack 3.6 beconf.h $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Dean Luick 1996. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* Configuration for Be Inc.'s BeOS */ - -#ifndef BECONF_H -#define BECONF_H - -/* - * We must use UNWIDENED_PROTOTYPES because we mix C++ and C. - */ - -#define index strchr -#define rindex strrchr -#define Rand rand /* Be should have a better rand function! */ -#define tgetch getchar -#define FCMASK 0666 -#define PORT_ID "BeOS" -#define TEXTCOLOR -#define POSIX_TYPES -#define SIG_RET_TYPE __signal_func_ptr - -#include /* for time_t */ -#include /* for lseek() */ - -/* could go in extern.h, under bemain.c (or something..) */ -void regularize(char *); - -/* instead of including system.h... */ -#include -#include -#include - -#endif /* BECONF_H */ diff --git a/include/bitmfile.h b/include/bitmfile.h deleted file mode 100644 index e035a1127..000000000 --- a/include/bitmfile.h +++ /dev/null @@ -1,33 +0,0 @@ -/****************************\ -* Bitmap mit Farbtabelle als * -* Graphik-Datei speichern * -* Autor: Gabriel Schmidt * -* (c} 1992 by MAXON-Computer * -* -> Header-Datei * -\****************************/ - -#ifndef H_TO_FILE -#define H_TO_FILE - -/* #include */ -#define UWORD unsigned short -#define ULONG unsigned long -#define UBYTE unsigned char - -#define XIMG_MAGIC 0x58494D47 - -typedef enum { IMG, XIMG } FILE_TYP; - -const char *get_file_ext(FILE_TYP typ); - -struct RGB { - UWORD r, g, b; -}; - -int bitmap_to_file(FILE_TYP typ, int ww, int wh, unsigned int pwx, - unsigned int pwy, unsigned int planes, unsigned int colors, - const char *filename, - void (*get_color)(unsigned int colind, struct RGB *rgb), - void (*get_pixel)(int x, int y, unsigned int *colind)); - -#endif diff --git a/include/def_os2.h b/include/def_os2.h deleted file mode 100644 index 30d02c816..000000000 --- a/include/def_os2.h +++ /dev/null @@ -1,213 +0,0 @@ -/* NetHack 3.6 def_os2.h $NHDT-Date: 1432512782 2015/05/25 00:13:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Timo Hakulinen, 1990, 1991, 1992, 1993. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * Only a small portion of all OS/2 defines are needed, so the - * actual include files often need not be used. In fact, - * including the full headers may stall the compile in DOS. - */ - -#ifdef OS2_USESYSHEADERS - -#define INCL_NOPMAPI -#define INCL_DOSFILEMGR -#define INCL_DOS -#define INCL_SUB - -#include - -#else - -typedef char CHAR; -typedef void VOID; - -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef unsigned char BYTE; - -#ifdef OS2_32BITAPI - -typedef unsigned long SHANDLE; -typedef USHORT HKBD; -typedef USHORT HVIO; - -#define CCHMAXPATHCOMP 256 - -#ifdef OS2_CSET2 -#define API16 _Far16 _Pascal -#define DAT16 -#define API32 _System -#define KbdGetStatus KBD16GETSTATUS -#define KbdSetStatus KBD16SETSTATUS -#define KbdCharIn KBD16CHARIN -#define KbdPeek KBD16PEEK -#define VioGetMode VIO16GETMODE -#define VioSetCurPos VIO16SETCURPOS -#else -#define API16 -#define DAT16 -#define API32 -#endif - -#define DAT - -#else /* OS2_32BITAPI */ - -typedef unsigned short SHANDLE; -typedef SHANDLE HKBD; -typedef SHANDLE HVIO; - -#define CCHMAXPATHCOMP 13 - -#ifdef OS2_MSC -#define API16 pascal far -#define DAT16 -#endif - -#define DAT DAT16 - -#endif /* OS2_32BITAPI */ - -typedef USHORT *DAT16 PUSHORT; -typedef BYTE *DAT16 PBYTE; -typedef ULONG *DAT PULONG; -typedef VOID *DAT PVOID; - -typedef SHANDLE HDIR; -typedef HDIR *DAT PHDIR; - -typedef char *DAT16 PCH; -typedef char *DAT PSZ; - -/* all supported compilers understand this */ - -#pragma pack(2) - -typedef struct { - UCHAR chChar; - UCHAR chScan; - UCHAR fbStatus; - UCHAR bNlsShift; - USHORT fsState; - ULONG time; -} KBDKEYINFO; - -typedef KBDKEYINFO *DAT16 PKBDKEYINFO; - -/* File time and date types */ - -typedef struct { - UINT twosecs : 5; - UINT minutes : 6; - UINT hours : 5; -} FTIME; - -typedef struct { - UINT day : 5; - UINT month : 4; - UINT year : 7; -} FDATE; - -#ifdef OS2_32BITAPI - -typedef struct { - ULONG oNextEntryOffset; - FDATE fdateCreation; - FTIME ftimeCreation; - FDATE fdateLastAccess; - FTIME ftimeLastAccess; - FDATE fdateLastWrite; - FTIME ftimeLastWrite; - ULONG cbFile; - ULONG cbFileAlloc; - ULONG attrFile; - UCHAR cchName; - CHAR achName[CCHMAXPATHCOMP]; -} FILEFINDBUF3; - -#else - -typedef struct { - FDATE fdateCreation; - FTIME ftimeCreation; - FDATE fdateLastAccess; - FTIME ftimeLastAccess; - FDATE fdateLastWrite; - FTIME ftimeLastWrite; - ULONG cbFile; - ULONG cbFileAlloc; - USHORT attrFile; - UCHAR cchName; - CHAR achName[CCHMAXPATHCOMP]; -} FILEFINDBUF; - -typedef FILEFINDBUF *DAT16 PFILEFINDBUF; - -#endif /* OS2_32BITAPI */ - -typedef struct { - ULONG idFileSystem; - ULONG cSectorUnit; - ULONG cUnit; - ULONG cUnitAvail; - USHORT cbSector; -} FSALLOCATE; - -typedef struct { - USHORT cb; - USHORT fsMask; - USHORT chTurnAround; - USHORT fsInterim; - USHORT fsState; -} KBDINFO; - -typedef KBDINFO *DAT16 PKBDINFO; - -typedef struct { - USHORT cb; - UCHAR fbType; - UCHAR color; - USHORT col; - USHORT row; - USHORT hres; - USHORT vres; - UCHAR fmt_ID; - UCHAR attrib; - ULONG buf_addr; - ULONG buf_length; - ULONG full_length; - ULONG partial_length; - PCH ext_data_addr; -} VIOMODEINFO; - -typedef VIOMODEINFO *DAT16 PVIOMODEINFO; - -#pragma pack() - -/* OS2 API functions */ - -USHORT API16 KbdGetStatus(PKBDINFO, HKBD); -USHORT API16 KbdSetStatus(PKBDINFO, HKBD); -USHORT API16 KbdCharIn(PKBDKEYINFO, USHORT, HKBD); -USHORT API16 KbdPeek(PKBDKEYINFO, HKBD); - -USHORT API16 VioGetMode(PVIOMODEINFO, HVIO); -USHORT API16 VioSetCurPos(USHORT, USHORT, HVIO); - -#ifdef OS2_32BITAPI -ULONG API32 DosQueryFSInfo(ULONG, ULONG, PVOID, ULONG); -ULONG API32 DosFindFirst(PSZ, PHDIR, ULONG, PVOID, ULONG, PULONG, ULONG); -ULONG API32 DosFindNext(HDIR, PVOID, ULONG, PULONG); -ULONG API32 DosSetDefaultDisk(ULONG); -#else -USHORT API16 DosQFSInfo(USHORT, USHORT, PBYTE, USHORT); -USHORT API16 -DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG); -USHORT API16 DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT); -USHORT API16 DosSelectDisk(USHORT); -#endif /* OS2_32BITAPI */ - -#endif /* OS2_USESYSHEADERS */ diff --git a/include/gem_rsc.h b/include/gem_rsc.h deleted file mode 100644 index 14a879dd8..000000000 --- a/include/gem_rsc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* resource set indices for GEM_RSC */ - -#define MENU 0 /* menu */ -#define DOABOUT 12 /* STRING in tree MENU */ -#define DOQUIT 30 /* STRING in tree MENU */ - -#define STATUSLINE 1 /* form/dialog */ -#define GRABSTATUS 1 /* BOX in tree STATUSLINE */ - -#define MAPWIN 2 /* form/dialog */ -#define MAPBOX 0 /* BOX in tree MAPWIN */ -#define MAPCURSOR 1 /* IBOX in tree MAPWIN */ - -#define ABOUT 3 /* form/dialog */ -#define FLYABOUT 0 /* BOX in tree ABOUT */ -#define OKABOUT 1 /* BUTTON in tree ABOUT */ -#define NETHACKIMG0 3 /* ICON in tree ABOUT */ - -#define LINES 4 /* form/dialog */ -#define FLYLINES 0 /* BOX in tree LINES */ -#define QLINE 1 /* BUTTON in tree LINES */ -#define LINESLIST 2 /* USERDEF in tree LINES */ - -#define YNCHOICE 5 /* form/dialog */ -#define FLYYNCHOICE 0 /* BOX in tree YNCHOICE */ -#define YNPROMPT 1 /* TEXT in tree YNCHOICE */ -#define SOMECHARS 2 /* BOX in tree YNCHOICE */ -#define YN1 3 /* BUTTON in tree YNCHOICE */ -#define YNN 53 /* BUTTON in tree YNCHOICE */ -#define ANYCHAR 55 /* BOX in tree YNCHOICE */ -#define CHOSENCH 56 /* FBOXTEXT in tree YNCHOICE */ -#define COUNT 58 /* FBOXTEXT in tree YNCHOICE */ -#define YNOK 59 /* BUTTON in tree YNCHOICE */ - -#define LINEGET 6 /* form/dialog */ -#define FLYLINEGET 0 /* BOX in tree LINEGET */ -#define LGPROMPT 1 /* TEXT in tree LINEGET */ -#define LGREPLY 2 /* FBOXTEXT in tree LINEGET */ -#define QLG 3 /* BUTTON in tree LINEGET */ -#define LGOK 4 /* BUTTON in tree LINEGET */ - -#define DIRECTION 7 /* form/dialog */ -#define FLYDIRECTION 0 /* BOX in tree DIRECTION */ -#define DIR1 5 /* BOXTEXT in tree DIRECTION */ -#define DIR9 21 /* BOXTEXT in tree DIRECTION */ -#define DIRDOWN 23 /* BOXTEXT in tree DIRECTION */ -#define DIRUP 25 /* BOXTEXT in tree DIRECTION */ - -#define MSGWIN 8 /* form/dialog */ -#define UPMSG 1 /* BOXCHAR in tree MSGWIN */ -#define GRABMSGWIN 2 /* BOX in tree MSGWIN */ -#define DNMSG 3 /* BOXCHAR in tree MSGWIN */ -#define MSGLINES 4 /* USERDEF in tree MSGWIN */ - -#define NAMEGET 9 /* form/dialog */ -#define FLYNAMEGET 0 /* BOX in tree NAMEGET */ -#define PLNAME 2 /* FBOXTEXT in tree NAMEGET */ -#define NETHACKPICTURE 4 /* BOXTEXT in tree NAMEGET */ - -#define PAGER 10 /* form/dialog */ -#define FLYPAGER 0 /* BOX in tree PAGER */ -#define QPAGER 1 /* BUTTON in tree PAGER */ - -#define NHICON 11 /* form/dialog */ diff --git a/include/lev.h b/include/lev.h deleted file mode 100644 index 17fd8dddd..000000000 --- a/include/lev.h +++ /dev/null @@ -1,54 +0,0 @@ -/* NetHack 3.6 lev.h $NHDT-Date: 1432512781 2015/05/25 00:13:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Michael Allison, 2006. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* Common include file for save and restore routines */ - -#ifndef LEV_H -#define LEV_H - -#define COUNT_SAVE 0x1 -#define WRITE_SAVE 0x2 -#define FREE_SAVE 0x4 - -#define MAX_BMASK 4 - -/* operations of the various saveXXXchn & co. routines */ -#define perform_bwrite(mode) ((mode) & (COUNT_SAVE | WRITE_SAVE)) -#define release_data(mode) ((mode) &FREE_SAVE) - -/* The following are used in mkmaze.c */ -struct container { - struct container *next; - xchar x, y; - short what; - genericptr_t list; -}; - -enum bubble_contains_types { - CONS_OBJ = 0, - CONS_MON, - CONS_HERO, - CONS_TRAP -}; - -struct bubble { - xchar x, y; /* coordinates of the upper left corner */ - schar dx, dy; /* the general direction of the bubble's movement */ - uchar bm[MAX_BMASK + 2]; /* bubble bit mask */ - struct bubble *prev, *next; /* need to traverse the list up and down */ - struct container *cons; -}; - -/* used in light.c */ -typedef struct ls_t { - struct ls_t *next; - xchar x, y; /* source's position */ - short range; /* source's current range */ - short flags; - short type; /* type of light source */ - anything id; /* source's identifier */ -} light_source; - -#endif /* LEV_H */ diff --git a/include/load_img.h b/include/load_img.h deleted file mode 100644 index a6511832c..000000000 --- a/include/load_img.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* ------------------------------------------- */ -#define XIMG 0x58494D47 - -/* Header of GEM Image Files */ -typedef struct IMG_HEADER { - short version; /* Img file format version (1) */ - short length; /* Header length in words (8) */ - short planes; /* Number of bit-planes (1) */ - short pat_len; /* length of Patterns (2) */ - short pix_w; /* Pixel width in 1/1000 mmm (372) */ - short pix_h; /* Pixel height in 1/1000 mmm (372) */ - short img_w; /* Pixels per line (=(x+7)/8 Bytes) */ - short img_h; /* Total number of lines */ - long magic; /* Contains "XIMG" if standard color */ - short paltype; /* palette type (0=RGB (short each)) */ - short *palette; /* palette etc. */ - char *addr; /* Address for the depacked bit-planes */ -} IMG_header; - -/* ------------------------------------------- */ -/* error codes */ -#define ERR_HEADER 1 -#define ERR_ALLOC 2 -#define ERR_FILE 3 -#define ERR_DEPACK 4 -#define ERR_COLOR 5 - -/* saves the current colorpalette with col colors in palette */ -void get_colors(int handle, short *palette, int col); - -/* sets col colors from palette */ -void img_set_colors(int handle, short *palette, int col); - -/* converts MFDB of size from standard to deviceformat (0 if succeded, else - * error). */ -int convert(MFDB *, long); - -/* transforms image in VDI-Device format */ -int transform_img(MFDB *); - -/* Loads & depacks IMG (0 if succeded, else error). */ -/* Bitplanes are one after another in address IMG_HEADER.addr. */ -int depack_img(char *, IMG_header *); - -/* Halves IMG in Device-format, dest memory has to be allocated*/ -int half_img(MFDB *, MFDB *); diff --git a/include/mac-carbon.h b/include/mac-carbon.h deleted file mode 100644 index da53c622a..000000000 --- a/include/mac-carbon.h +++ /dev/null @@ -1,33 +0,0 @@ -/* NetHack 3.6 mac-carbon.h $NHDT-Date: 1432512777 2015/05/25 00:12:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 2003. */ -/*-Copyright (c) Kevin Hugo, 2003. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* Compiler prefix file for the Macintosh Carbon port. - * - * IMPORTANT: This file is intended only as a compiler prefix - * file and must NEVER be included by other source (.c or .h) - * files. - * - * Usage for MacOS X Project Builder: - * Project menu -> Edit Active Target '_target_' -> - * target settings dialog -> Settings -> Simple View -> - * GCC Compiler Settings -> - * set "Prefix Header" to include/mac-carbon.h - * - * Usage for Metrowerks CodeWarrior: - * Edit menu -> _target_ Settings -> Language Settings -> - * C/C++ Language -> - * set "Prefix File" to include/mac-carbon.h - */ - -#define MAC -#undef UNIX - -/* May already be defined by CodeWarrior as 0 or 1 */ -#ifdef TARGET_API_MAC_CARBON -#undef TARGET_API_MAC_CARBON -#endif -#define TARGET_API_MAC_CARBON 1 - -#define GCC_WARN diff --git a/include/mac-qt.h b/include/mac-qt.h deleted file mode 100644 index 96e406b4d..000000000 --- a/include/mac-qt.h +++ /dev/null @@ -1,34 +0,0 @@ -/* NetHack 3.6 mac-qt.h $NHDT-Date: 1432512776 2015/05/25 00:12:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 2003. */ -/*-Copyright (c) Kevin Hugo, 2003. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* Compiler prefix file for the Macintosh Qt port. - * - * IMPORTANT: This file is intended only as a compiler prefix - * file and must NEVER be included by other source (.c or .h) - * files. - * - * Usage for MacOS X Project Builder: - * Project menu -> Edit Active Target '_target_' -> - * target settings dialog -> Settings -> Simple View -> - * GCC Compiler Settings -> - * set "Prefix Header" to include/mac-qt.h - * - * Usage for Metrowerks CodeWarrior: - * Edit menu -> _target_ Settings -> Language Settings -> - * C/C++ Language -> - * set "Prefix File" to include/mac-qt.h - */ - -#undef MAC -#define UNIX -#define BSD - -/* May already be defined by CodeWarrior as 0 or 1 */ -#ifdef TARGET_API_MAC_CARBON -#undef TARGET_API_MAC_CARBON -#endif -#define TARGET_API_MAC_CARBON 0 - -#define GCC_WARN diff --git a/include/mac-term.h b/include/mac-term.h deleted file mode 100644 index 9f4ba462f..000000000 --- a/include/mac-term.h +++ /dev/null @@ -1,35 +0,0 @@ -/* NetHack 3.6 mac-term.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 2003. */ -/*-Copyright (c) Kevin Hugo, 2003. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* Compiler prefix file for the MacOS X Terminal.app port. - * - * IMPORTANT: This file is intended only as a compiler prefix - * file and must NEVER be included by other source (.c or .h) - * files. - * - * Usage for MacOS X Project Builder: - * Project menu -> Edit Active Target '_target_' -> - * target settings dialog -> Settings -> Simple View -> - * GCC Compiler Settings -> - * set "Prefix Header" to include/mac-term.h - * - * Usage for Metrowerks CodeWarrior: - * Edit menu -> _target_ Settings -> Language Settings -> - * C/C++ Language -> - * set "Prefix File" to include/mac-term.h - */ - -/* Stuff needed for the core of NetHack */ -#undef MAC -#define UNIX -#define BSD -#define __FreeBSD__ /* Darwin is based on FreeBSD */ -#define GCC_WARN - -/* May already be defined by CodeWarrior as 0 or 1 */ -#ifdef TARGET_API_MAC_CARBON -#undef TARGET_API_MAC_CARBON -#endif -#define TARGET_API_MAC_CARBON 0 /* Not Carbon */ diff --git a/include/macconf.h b/include/macconf.h deleted file mode 100644 index fbcd3aded..000000000 --- a/include/macconf.h +++ /dev/null @@ -1,128 +0,0 @@ -/* NetHack 3.6 macconf.h $NHDT-Date: 1432512782 2015/05/25 00:13:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Kevin Hugo, 2004. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifdef MAC -#ifndef MACCONF_H -#define MACCONF_H - -/* - * Compiler selection is based on the following symbols: - * - * __SC__ sc, a MPW 68k compiler - * __MRC__ mrc, a MPW PowerPC compiler - * THINK_C Think C compiler - * __MWERKS__ Metrowerks' Codewarrior compiler - * - * We use these early in config.h to define some needed symbols, - * including MAC. - # - # The Metrowerks compiler defines __STDC__ (which sets NHSTC) and uses - # WIDENED_PROTOTYPES (defined if UNWIDENED_PROTOTYPES is undefined and - # NHSTDC is defined). - */ - -#ifndef __powerc -#define MAC68K /* 68K mac (non-powerpc) */ -#endif -#ifndef TARGET_API_MAC_CARBON -#define TARGET_API_MAC_CARBON 0 -#endif - -#ifndef __MACH__ -#define RANDOM -#endif -#define NO_SIGNAL /* You wouldn't believe our signals ... */ -#define FILENAME 256 -#define NO_TERMS /* For tty port (see wintty.h) */ - -#define TEXTCOLOR /* For Mac TTY interface */ -#define CHANGE_COLOR - -/* Use these two includes instead of system.h. */ -#include -#include - -/* Uncomment this line if your headers don't already define off_t */ -/*typedef long off_t;*/ -#include /* for time_t */ - -/* - * Try and keep the number of files here to an ABSOLUTE minimum ! - * include the relevant files in the relevant .c files instead ! - */ -#if TARGET_API_MAC_CARBON -#ifdef GNUC -/* Avoid including -- it has a conflicting expl() */ -#define __FP__ -#include -#else -/* Avoid including -- it uses GENERATINGPOWERPC */ -#define __FENV__ -#include -#include -#endif -#else -#include -#endif - -/* - * We could use the PSN under sys 7 here ... - * ...but it wouldn't matter... - */ -#define getpid() 1 -#define getuid() 1 -#define index strchr -#define rindex strrchr - -#define Rand random -extern void error(const char *, ...); - -#if !defined(O_WRONLY) -#if defined(__MWERKS__) && !TARGET_API_MAC_CARBON -#include -#endif -#include -#endif - -/* - * Don't redefine these Unix IO functions when making LevComp or DgnComp for - * MPW. With MPW, we make them into MPW tools, which use unix IO. SPEC_LEV - * and DGN_COMP are defined when compiling for LevComp and DgnComp - * respectively. - */ -#if !((defined(__SC__) || defined(__MRC__) || defined(__MACH__)) \ - && (defined(SPEC_LEV) || defined(DGN_COMP))) -#define creat maccreat -#define open macopen -#define close macclose -#define read macread -#define write macwrite -#define lseek macseek -#ifdef __MWERKS__ -#define unlink _unlink -#endif -#endif - -#define YY_NEVER_INTERACTIVE 1 - -#define TEXT_TYPE 'TEXT' -#define LEVL_TYPE 'LEVL' -#define BONE_TYPE 'BONE' -#define SAVE_TYPE 'SAVE' -#define PREF_TYPE 'PREF' -#define DATA_TYPE 'DATA' -#define MAC_CREATOR 'nh31' /* Registered with DTS ! */ -#define TEXT_CREATOR 'ttxt' /* Something the user can actually edit */ - -/* - * Define PORT_HELP to be the name of the port-specfic help file. - * This file is included into the resource fork of the application. - */ -#define PORT_HELP "MacHelp" - -#define MAC_GRAPHICS_ENV - -#endif /* ! MACCONF_H */ -#endif /* MAC */ diff --git a/include/macpopup.h b/include/macpopup.h deleted file mode 100644 index 491592b1f..000000000 --- a/include/macpopup.h +++ /dev/null @@ -1,15 +0,0 @@ -/* NetHack 3.6 macpopup.h $NHDT-Date: 1432512781 2015/05/25 00:13:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ -/* Copyright (c) Nethack Development Team, 1999. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef MACPOPUP_H -#define MACPOPUP_H - -/* ### mmodal.c ### */ - -extern void FlashButton(DialogRef, short); -extern char queued_resp(char *resp); -extern char topl_yn_function(const char *query, const char *resp, char def); -extern int get_line_from_key_queue(char *bufp); - -#endif /* MACPOPUP_H */ diff --git a/include/mactty.h b/include/mactty.h deleted file mode 100644 index 733a548ce..000000000 --- a/include/mactty.h +++ /dev/null @@ -1,349 +0,0 @@ -/* NetHack 3.6 mactty.h $NHDT-Date: 1447755970 2015/11/17 10:26:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) Jon W{tte 1993. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This header is the supported external interface for the "tty" window - * package. This package sports care-free handling of "dumb" tty windows - * (preferably using monospaced fonts) - it does NOT remember the strings - * sent to it; rather, it uses an offscreen bitmap. - * - * For best performance, make sure it is aligned on a 32-pixel boundary - * (or at least a 16-pixel one) in black & white. For 24bit color, - * alignment doesn't matter, and for 8-bit color, alignment to every - * fourth pixel is most efficient. - * - * (c) Copyright 1993 Jon W{tte - */ - -/* - * You should really not poke in the structures used by the tty window. - * However, since it uses the wRefCon of windows (by calling GetWRefCon - * and SetWRefCon) you lose that possibility. If you still want to store - * information about a window, the FIRST location _pointed to_ by the - * wRefCon will be a void * that you can use for whatever reasons. Don't - * take the address of this variable and expect it to stay the same - * across calls to the tty window. - * - * void * my_config_ptr = * ( void * * ) GetWRefCon ( tty_window ) ; - */ - -/* - * The library uses the window's port temporarily through SetPortBits; - * that means you shouldn't do any funky things to the clipping region - * etc. Actually, you shouldn't even resize the window, as that will clip - * new drawing. - * - * Also, if you use this library under Pascal, remember that the string - * passed to add_tty_string() is a "C" style string with NO length byte, - * and a terminating zero byte at the end instead. - */ - -#ifndef _H_tty_public -#define _H_tty_public -#undef red /* undef internal color const strings from decl */ -#undef green -#undef blue -#if 1 /*!TARGET_API_MAC_CARBON*/ -#include -#endif - -/* - * Error code returned when it's probably our fault, or - * bad parameters. - */ -#define general_failure 1 - -/* - * Base resource id's for window types - */ -#define WIN_BASE_RES 128 -#define WIN_BASE_KIND 128 - -/* - * Commonly used characters - */ -#define CHAR_ENTER ((char) 3) -#define CHAR_BELL ((char) 7) -#define CHAR_BS ((char) 8) -#define CHAR_LF ((char) 10) -#define CHAR_CR ((char) 13) -#define CHAR_ESC ((char) 27) -#define CHAR_BLANK ((char) 32) -#define CHAR_DELETE ((char) 127) - -extern char game_active; /* flag to window rendering routines - not to use ppat */ -/* - * If you want some fancy operations that not a normal TTY device normally - * supports, use EXTENDED_SUPPORT. For frames, area erases and area scrolls, - * plus bitmap graphics - RESOLUTION DEPENDENT, be sure to call - * get_tty_metrics and use those limits. - */ -#define EXTENDED_SUPPORT 0 -/* - * if you print a lot of single characters, accumulating each one in a - * clipping region will take too much time. Instead, define this, which - * will clip in rects. - */ -#define CLIP_RECT_ONLY 1 - -typedef enum tty_attrib { - - /* - * Flags relating to the general functioning of the window. - * These flags are passed at create_tty time, and changing them - * later will clear the screen. - */ - TTY_ATTRIB_FLAGS, -/* - * When using proportional fonts, this will place each character - * separately, ensuring aligned columns (but looking ugly and taking - * time) - */ -#define TA_MOVE_EACH_CHAR 1L -/* - * This means draw each change as it occurs instead of collecting the area - * and draw it all at once at update_tty() - slower, but more reliable. - */ -#define TA_ALWAYS_REFRESH 2L -/* - * When reaching the right end, we either just stop drawing, or wrap to the - * next line. - */ -#define TA_WRAP_AROUND 4L -/* - * Overstrike means that characters are added on top of each other; i e don't - * clear the letter beneath. This is faster, using srcOr under QuickDraw - */ -#define TA_OVERSTRIKE 8L -/* - * We may want the window not to scroll when we reach the end line, - * but stop drawing instead. - */ -#define TA_INHIBIT_VERT_SCROLL 16L - - /* - * Foreground and background colors. These only affect characters - * drawn by subsequent calls; not what's already there (but it does - * affect clears) - * On b/w screens these do nothing. - */ - TTY_ATTRIB_FOREGROUND, - TTY_ATTRIB_BACKGROUND, -#define TA_RGB_TO_TTY(r) \ - ((((long) ((r).red >> 8) & 0xff) << 16) \ - + (((long) ((r).green >> 8) & 0xff) << 8) \ - + ((long) ((r).blue >> 8) & 0xff)) - - /* - * Attributes relating to the cursor, and character set mappings - */ - TTY_ATTRIB_CURSOR, -/* - * Blinking cursor is more noticeable when it's idle - */ -#define TA_BLINKING_CURSOR 1L -/* - * When handling input, do we echo characters as they are typed? - */ -#define TA_ECHO_INPUT 2L -/* - * Do we return each character code separately, or map delete etc? Note - * that non-raw input means getchar won't return anything until the user - * has typed a return. - */ -#define TA_RAW_INPUT 4L -/* - * Do we print every character as it is (including BS, NL and CR!) or do - * do we interpret characters such as NL, BS and CR? - */ -#define TA_RAW_OUTPUT 8L -/* - * When getting a NL, do we also move to the left? - */ -#define TA_NL_ADD_CR 16L -/* - * When getting a CR, do we also move down? - */ -#define TA_CR_ADD_NL 32L -/* - * Wait for input or return what we've got? - */ -#define TA_NONBLOCKING_IO 64L - -/* - * Use this macro to cast a function pointer to a tty attribute; this will - * help portability to systems where a function pointer doesn't fit in a long - */ -#define TA_ATTRIB_FUNC(x) ((long) (x)) - - /* - * This symbolic constant is used to check the number of attributes - */ - TTY_NUMBER_ATTRIBUTES - -} tty_attrib; - -/* - * Character returned by end-of-file condition - */ -#define TTY_EOF -1 - -/* - * Create the window according to a resource WIND template. - * The window pointer pointed to by window should be NULL to - * allocate the window record dynamically, or point to a - * WindowRecord structure already allocated. - * - * Passing in_color means you have to be sure there's color support; - * on the Mac, this means 32bit QuickDraw present, else it will - * crash. Not passing in_color means everything's rendered in - * black & white. - */ -extern short create_tty(WindowPtr *window, short resource_id, - Boolean in_color); - -/* - * Use init_tty_name or init_tty_number to initialize a window - * once allocated by create_tty. Size parameters are in characters. - */ - -extern short init_tty_number(WindowPtr window, short font_number, - short font_size, short x_size, short y_size); - -/* - * Close and deallocate a window and its data - */ -extern short destroy_tty(WindowPtr window); - -/* - * Change the font and font size used in the window for drawing after - * the calls are made. To change the coordinate system, be sure to call - * force_tty_coordinate_system_recalc() - else it may look strange if - * the new font doesn't match the old one. - */ -extern short set_tty_font_name(winid window_type, char *name); -extern short force_tty_coordinate_system_recalc(WindowPtr window); - -/* - * Getting some metrics about the tty and its drawing. - */ -extern short get_tty_metrics(WindowPtr window, short *x_size, short *y_size, - short *x_size_pixels, short *y_size_pixels, - short *font_number, short *font_size, - short *char_width, short *row_height); - -/* - * The basic move cursor function. 0,0 is topleft. - */ -extern short move_tty_cursor(WindowPtr window, short x_pos, short y_pos); - -/* - * Flush all changes done to a tty to the screen (see TA_ALWAYS_UPDATE above) - */ -extern short update_tty(WindowPtr window); - -/* - * Add a character to the tty and update the cursor position - */ -extern short add_tty_char(WindowPtr window, short character); - -/* - * Add a string of characters to the tty and update the cursor - * position. The string is 0-terminated! - */ -extern short add_tty_string(WindowPtr window, const char *string); - -/* - * Change or read an attribute of the tty. Note that some attribute changes - * may clear the screen. See the above enum and defines for values. - * Attributes can be both function pointers and special flag values. - */ -extern short get_tty_attrib(WindowPtr window, tty_attrib attrib, long *value); -extern short set_tty_attrib(WindowPtr window, tty_attrib attrib, long value); - -/* - * Scroll the actual TTY image, in characters, positive means up/left - * scroll_tty ( my_tty , 0 , 1 ) means a linefeed. Is always carried out - * directly, regardless of the wait-update setting. Does updates before - * scrolling. - */ -extern short scroll_tty(WindowPtr window, short delta_x, short delta_y); - -/* - * Erase the offscreen bitmap and move the cursor to 0,0. Re-init some window - * values (font etc) Is always carried out directly on-screen, regardless of - * the wait-for-update setting. Clears update area. - */ -extern short clear_tty(WindowPtr window); - -/* - * Call this routine with a window (always _mt_window) and a time (usually - * from most recent event) to determine if cursor in window should be blinked - */ -extern short blink_cursor(WindowPtr window, long when); - -/* - * For screen dumps, open the printer port and call this function. Can be used - * for clipboard as well (only for a PICT, though; this library doesn't - * concern - * itself with characters, just bitmaps) - */ -extern short image_tty(EventRecord *theEvent, WindowPtr window); - -/* - * For erasing just an area of characters - */ -extern short clear_tty_window(WindowPtr window, short from_row, - short from_col, short to_row, short to_col); - -/* - * get and set the invalid region of the main window - */ -extern short get_invalid_region(WindowPtr window, Rect *inval_rect); -extern short set_invalid_region(WindowPtr window, Rect *inval_rect); - -/* - * Now in macsnd.c, which seemed like a good place - */ -extern void tty_nhbell(); - -#if EXTENDED_SUPPORT - -/* - * Various versions of delete character/s, insert line/s etc can be handled by - * this general-purpose function. Negative num_ means delete, positive means - * insert, and you can never be sure which of row and col operations come - * first - * if you specify both... - */ -extern short mangle_tty_rows_columns(WindowPtr window, short from_row, - short num_rows, short from_col, - short num_cols); - -/* - * For framing an area without using grahpics characters. - * Note that the given limits are those used for framing, you should not - * draw in them. frame_fatness should typically be 1-5, and may be clipped - * if it is too large. - */ -extern short frame_tty_window(WindowPtr window, short from_row, - short from_col, short to_row, short to_col, - short frame_fatness); - -/* - * For inverting specific characters after the fact. May look funny in color. - */ -extern short invert_tty_window(WindowPtr window, short from_row, - short from_col, short to_row, short to_col); - -/* - * For drawing lines on the tty - VERY DEVICE DEPENDENT. Use get_tty_metrics. - */ -extern short draw_tty_line(WindowPtr window, short from_x, short from_y, - short to_x, short to_y); - -#endif /* EXTENDED_SUPPORT */ - -#endif /* _H_tty_public */ diff --git a/include/macwin.h b/include/macwin.h deleted file mode 100644 index b9b6ede14..000000000 --- a/include/macwin.h +++ /dev/null @@ -1,247 +0,0 @@ -/* NetHack 3.6 macwin.h $NHDT-Date: 1447755970 2015/11/17 10:26:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Kevin Hugo, 2003. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef MACWIN_H -#define MACWIN_H -#undef red /* undef internal color const strings from decl */ -#undef green -#undef blue - -#ifndef __MACH__ -#include -#include -#endif - -/* more headers */ -#ifdef THINK_C -#include /* for CtoPStr and PtoCStr */ -#endif - -/* resources */ -#define PLAYER_NAME_RES_ID 1001 - -/* fake some things if we don't have universal headers.. */ -#if 0 /*ndef NewUserItemProc*/ -typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo); -typedef UserItemProcPtr UserItemUPP; -#define NewUserItemProc(p) (UserItemUPP)(p) - -typedef pascal void (*ControlActionProcPtr)(ControlHandle theControl, - short partCode); -typedef ControlActionProcPtr ControlActionUPP; -#define NewControlActionProc(p) (ControlActionUPP)(p) - -typedef ModalFilterProcPtr ModalFilterUPP; -#define DisposeRoutineDescriptor(p) -#endif - -/* misc */ -#ifdef __MWERKS__ -#define ResumeProcPtr long /* for call to InitDialogs */ -#endif - -/* working dirs structure */ -typedef struct macdirs { - Str32 dataName; - short dataRefNum; - long dataDirID; - - Str32 saveName; - short saveRefNum; - long saveDirID; - - Str32 levelName; - short levelRefNum; - long levelDirID; -} MacDirs; - -typedef struct macflags { - Bitfield(processes, 1); - Bitfield(color, 1); - Bitfield(folders, 1); - Bitfield(tempMem, 1); - Bitfield(help, 1); - Bitfield(fsSpec, 1); - Bitfield(trueType, 1); - Bitfield(aux, 1); - Bitfield(alias, 1); - Bitfield(standardFile, 1); - Bitfield(hasDebugger, 1); - Bitfield(hasAE, 1); - Bitfield(gotOpen, 1); -} MacFlags; - -extern MacDirs theDirs; /* used in macfile.c */ -extern MacFlags macFlags; - -/* - * Mac windows - */ -#define NUM_MACWINDOWS 15 -#define TEXT_BLOCK 512L - -/* Window constants */ -#define kMapWindow 0 -#define kStatusWindow 1 -#define kMessageWindow 2 -#define kTextWindow 3 -#define kMenuWindow 4 -#define kLastWindowKind kMenuWindow - -/* - * This determines the minimum logical line length in text windows - * That is; even if physical width is less, this is where line breaks - * go at the minimum. 350 is about right for score lines with a - * geneva 10 pt font. - */ -#define MIN_RIGHT 350 - -typedef struct { - anything id; - char accelerator; - char groupAcc; - short line; -} MacMHMenuItem; - -typedef struct NhWindow { - WindowPtr its_window; - - short font_number; - short font_size; - short char_width; - short row_height; - short ascent_height; - - short x_size; - short y_size; - short x_curs; - short y_curs; - - short last_more_lin; /* Used by message window */ - short save_lin; /* Used by message window */ - - short miSize; /* size of menu items arrays */ - short miLen; /* number of menu items in array */ - MacMHMenuItem **menuInfo; /* Used by menus (array handle) */ - char menuChar; /* next menu accelerator to use */ - short **menuSelected; /* list of selected elements from list */ - short miSelLen; /* number of items selected */ - short how; /* menu mode */ - - char drawn; - Handle windowText; - long windowTextLen; - short scrollPos; - ControlHandle scrollBar; -} NhWindow; - -extern Boolean CheckNhWin(WindowPtr mac_win); - -#define NUM_STAT_ROWS 2 -#define NUM_ROWS 22 -#define NUM_COLS 80 /* We shouldn't use column 0 */ -#define QUEUE_LEN 24 - -extern NhWindow *theWindows; - -extern struct window_procs mac_procs; - -#define NHW_BASE 0 -extern winid BASE_WINDOW, WIN_MAP, WIN_MESSAGE, WIN_INVEN, WIN_STATUS; - -/* - * External declarations for the window routines. - */ - -#define E extern - -/* ### dprintf.c ### */ - -extern void dprintf(char *, ...); - -/* ### maccurs.c ### */ - -extern Boolean RetrievePosition(short, short *, short *); -extern Boolean RetrieveSize(short, short, short, short *, short *); -extern void SaveWindowPos(WindowPtr); -extern void SaveWindowSize(WindowPtr); -extern Boolean FDECL(RetrieveWinPos, (WindowPtr, short *, short *)); - -/* ### macerrs.c ### */ - -extern void showerror(char *, const char *); -extern Boolean itworked(short); -extern void mustwork(short); -extern void attemptingto(char *); -/* appear to be unused -extern void comment(char *,long); -extern void pushattemptingto(char *); -extern void popattempt(void); -*/ -/* ### macfile.c ### */ - -/* extern char *macgets(int fd, char *ptr, unsigned len); unused */ -extern void FDECL(C2P, (const char *c, unsigned char *p)); -extern void FDECL(P2C, (const unsigned char *p, char *c)); - -/* ### macmenu.c ### */ - -extern void DoMenuEvt(long); -extern void InitMenuRes(void); -extern void AdjustMenus(short); -#define DimMenuBar() AdjustMenus(1) -#define UndimMenuBar() AdjustMenus(0) - -/* ### macmain.c ### */ - -extern void FDECL(process_openfile, - (short s_vol, long s_dir, Str255 fNm, OSType ft)); - -/* ### macwin.c ### */ - -extern void AddToKeyQueue(unsigned char, Boolean); -extern unsigned char GetFromKeyQueue(void); -void trans_num_keys(EventRecord *); -extern void NDECL(InitMac); -int FDECL(try_key_queue, (char *)); -void FDECL(enter_topl_mode, (char *)); -void FDECL(leave_topl_mode, (char *)); -void FDECL(topl_set_resp, (char *, char)); -Boolean FDECL(topl_key, (unsigned char, Boolean)); -E void FDECL(HandleEvent, (EventRecord *)); /* used in mmodal.c */ -extern void NDECL(port_help); - -extern Boolean small_screen; - -E void FDECL(mac_init_nhwindows, (int *, char **)); -E void NDECL(mac_askname); -E void NDECL(mac_get_nh_event); -E void FDECL(mac_exit_nhwindows, (const char *)); -E winid FDECL(mac_create_nhwindow, (int)); -E void FDECL(mac_clear_nhwindow, (winid)); -E void FDECL(mac_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(mac_destroy_nhwindow, (winid)); -E void FDECL(mac_curs, (winid, int, int)); -E void FDECL(mac_putstr, (winid, int, const char *)); -E void FDECL(mac_start_menu, (winid)); -E void FDECL(mac_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); -E void FDECL(mac_end_menu, (winid, const char *)); -E int FDECL(mac_select_menu, (winid, int, menu_item **)); -#ifdef CLIPPING -E void FDECL(mac_cliparound, (int, int)); -#endif -E int NDECL(mac_nhgetch); -E int FDECL(mac_nh_poskey, (int *, int *, int *)); -E int NDECL(mac_doprev_message); -E char FDECL(mac_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(mac_getlin, (const char *, char *)); -E int NDECL(mac_get_ext_cmd); -E void FDECL(mac_number_pad, (int)); -E void NDECL(mac_delay_output); - -#undef E - -#endif /* ! MACWIN_H */ diff --git a/include/monsym.h b/include/monsym.h deleted file mode 100644 index 68737fd83..000000000 --- a/include/monsym.h +++ /dev/null @@ -1,148 +0,0 @@ -/* NetHack 3.6 monsym.h $NHDT-Date: 1547428769 2019/01/14 01:19:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) 2016 by Pasi Kallinen */ -/* NetHack may be freely redistributed. See license for details. */ -/* Monster symbols and creation information rev 1.0 */ - -#ifndef MONSYM_H -#define MONSYM_H - -/* - * Monster classes. Below, are the corresponding default characters for - * them. Monster class 0 is not used or defined so we can use it as a - * NULL character. - */ -enum mon_class_types { - S_ANT = 1, /* a */ - S_BLOB = 2, /* b */ - S_COCKATRICE = 3, /* c */ - S_DOG = 4, /* d */ - S_EYE = 5, /* e */ - S_FELINE = 6, /* f: cats */ - S_GREMLIN = 7, /* g */ - S_HUMANOID = 8, /* h: small humanoids: hobbit, dwarf */ - S_IMP = 9, /* i: minor demons */ - S_JELLY = 10, /* j */ - S_KOBOLD = 11, /* k */ - S_LEPRECHAUN = 12, /* l */ - S_MIMIC = 13, /* m */ - S_NYMPH = 14, /* n */ - S_ORC = 15, /* o */ - S_PIERCER = 16, /* p */ - S_QUADRUPED = 17, /* q: excludes horses */ - S_RODENT = 18, /* r */ - S_SPIDER = 19, /* s */ - S_TRAPPER = 20, /* t */ - S_UNICORN = 21, /* u: includes horses */ - S_VORTEX = 22, /* v */ - S_WORM = 23, /* w */ - S_XAN = 24, /* x */ - S_LIGHT = 25, /* y: yellow light, black light */ - S_ZRUTY = 26, /* z */ - S_ANGEL = 27, /* A */ - S_BAT = 28, /* B */ - S_CENTAUR = 29, /* C */ - S_DRAGON = 30, /* D */ - S_ELEMENTAL = 31, /* E: includes invisible stalker */ - S_FUNGUS = 32, /* F */ - S_GNOME = 33, /* G */ - S_GIANT = 34, /* H: large humanoid: giant, ettin, minotaur */ - S_invisible = 35, /* I: non-class present in def_monsyms[] */ - S_JABBERWOCK = 36, /* J */ - S_KOP = 37, /* K */ - S_LICH = 38, /* L */ - S_MUMMY = 39, /* M */ - S_NAGA = 40, /* N */ - S_OGRE = 41, /* O */ - S_PUDDING = 42, /* P */ - S_QUANTMECH = 43, /* Q */ - S_RUSTMONST = 44, /* R */ - S_SNAKE = 45, /* S */ - S_TROLL = 46, /* T */ - S_UMBER = 47, /* U: umber hulk */ - S_VAMPIRE = 48, /* V */ - S_WRAITH = 49, /* W */ - S_XORN = 50, /* X */ - S_YETI = 51, /* Y: includes owlbear, monkey */ - S_ZOMBIE = 52, /* Z */ - S_HUMAN = 53, /* @ */ - S_GHOST = 54, /* */ - S_GOLEM = 55, /* ' */ - S_DEMON = 56, /* & */ - S_EEL = 57, /* ; (fish) */ - S_LIZARD = 58, /* : (reptiles) */ - - S_WORM_TAIL = 59, /* ~ */ - S_MIMIC_DEF = 60, /* ] */ - - MAXMCLASSES = 61 /* number of monster classes */ -}; - -/* - * Default characters for monsters. These correspond to the monster classes - * above. - */ -/* clang-format off */ -#define DEF_ANT 'a' -#define DEF_BLOB 'b' -#define DEF_COCKATRICE 'c' -#define DEF_DOG 'd' -#define DEF_EYE 'e' -#define DEF_FELINE 'f' -#define DEF_GREMLIN 'g' -#define DEF_HUMANOID 'h' -#define DEF_IMP 'i' -#define DEF_JELLY 'j' -#define DEF_KOBOLD 'k' -#define DEF_LEPRECHAUN 'l' -#define DEF_MIMIC 'm' -#define DEF_NYMPH 'n' -#define DEF_ORC 'o' -#define DEF_PIERCER 'p' -#define DEF_QUADRUPED 'q' -#define DEF_RODENT 'r' -#define DEF_SPIDER 's' -#define DEF_TRAPPER 't' -#define DEF_UNICORN 'u' -#define DEF_VORTEX 'v' -#define DEF_WORM 'w' -#define DEF_XAN 'x' -#define DEF_LIGHT 'y' -#define DEF_ZRUTY 'z' -#define DEF_ANGEL 'A' -#define DEF_BAT 'B' -#define DEF_CENTAUR 'C' -#define DEF_DRAGON 'D' -#define DEF_ELEMENTAL 'E' -#define DEF_FUNGUS 'F' -#define DEF_GNOME 'G' -#define DEF_GIANT 'H' -#define DEF_JABBERWOCK 'J' -#define DEF_KOP 'K' -#define DEF_LICH 'L' -#define DEF_MUMMY 'M' -#define DEF_NAGA 'N' -#define DEF_OGRE 'O' -#define DEF_PUDDING 'P' -#define DEF_QUANTMECH 'Q' -#define DEF_RUSTMONST 'R' -#define DEF_SNAKE 'S' -#define DEF_TROLL 'T' -#define DEF_UMBER 'U' -#define DEF_VAMPIRE 'V' -#define DEF_WRAITH 'W' -#define DEF_XORN 'X' -#define DEF_YETI 'Y' -#define DEF_ZOMBIE 'Z' -#define DEF_HUMAN '@' -#define DEF_GHOST ' ' -#define DEF_GOLEM '\'' -#define DEF_DEMON '&' -#define DEF_EEL ';' -#define DEF_LIZARD ':' - -#define DEF_INVISIBLE 'I' -#define DEF_WORM_TAIL '~' -#define DEF_MIMIC_DEF ']' -/* clang-format on */ - -#endif /* MONSYM_H */ diff --git a/include/mttypriv.h b/include/mttypriv.h deleted file mode 100644 index e07813709..000000000 --- a/include/mttypriv.h +++ /dev/null @@ -1,62 +0,0 @@ -/* NetHack 3.6 mttypriv.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */ -/* Copyright (c) Jon W{tte 1993. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains private structures used to implement the - * tty windows - note that these structures may change between - * minor releases! - */ - -#ifndef _H_tty_private -#define _H_tty_private - -#ifndef _H_tty_public -#include "mactty.h" -#endif - -#if !TARGET_API_MAC_CARBON -#include -#include -#include -#endif - -#define TA_TO_RGB(ta, rgb) \ - (((rgb).red = (((ta) >> 16) & 0xff) * 257), \ - ((rgb).green = (((ta) >> 8) & 0xff) * 257), \ - ((rgb).blue = ((ta) &0xff) * 257)), \ - rgb - -typedef struct tty_record { - WindowPtr its_window; - - short font_number; - short font_size; - short char_width; - short row_height; - short ascent_height; - - short x_size; - short y_size; - short x_curs; - short y_curs; - - GWorldPtr its_window_world; - BitMap its_bits; - GrafPtr offscreen_port; - GWorldPtr offscreen_world; -#if CLIP_RECT_ONLY - Rect invalid_rect; -#else - RgnHandle invalid_part; -#endif - - long attribute[TTY_NUMBER_ATTRIBUTES]; - long last_cursor; - - Boolean was_allocated; - Boolean curs_state; - Boolean uses_gworld; -} tty_record; - -#endif /* _H_tty_private */ diff --git a/include/ntconf.h b/include/ntconf.h deleted file mode 100644 index a3a5b3713..000000000 --- a/include/ntconf.h +++ /dev/null @@ -1,297 +0,0 @@ -/* NetHack 3.6 ntconf.h $NHDT-Date: 1447424077 2015/11/13 14:14:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.48 $ */ -/* Copyright (c) NetHack PC Development Team 1993, 1994. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef NTCONF_H -#define NTCONF_H - -/* #define SHELL */ /* nt use of pcsys routines caused a hang */ - -#define TEXTCOLOR /* Color text */ - -#define EXEPATH /* Allow .exe location to be used as HACKDIR */ -#define TRADITIONAL_GLYPHMAP /* Store glyph mappings at level change time */ - -#define LAN_FEATURES /* Include code for lan-aware features. Untested in \ - 3.4.0*/ - -#define PC_LOCKING /* Prevent overwrites of aborted or in-progress games */ -/* without first receiving confirmation. */ - -#define HOLD_LOCKFILE_OPEN /* Keep an exclusive lock on the .0 file */ - -#define SELF_RECOVER /* Allow the game itself to recover from an aborted \ - game */ - -#define SYSCF /* Use a global configuration */ -#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */ - -#define DUMPLOG /* Enable dumplog files */ -/*#define DUMPLOG_FILE "nethack-%n-%d.log"*/ -#define DUMPLOG_MSG_COUNT 50 - -#define USER_SOUNDS - -/*#define CHANGE_COLOR*/ /* allow palette changes */ -#define SELECTSAVED /* Provide menu of saved games to choose from at start */ - -/* #define QWERTZ_SUPPORT */ /* when swap_yz is True, numpad 7 is 'z' not 'y' */ - -/* - * ----------------------------------------------------------------- - * The remaining code shouldn't need modification. - * ----------------------------------------------------------------- - */ -/* #define SHORT_FILENAMES */ /* All NT filesystems support long names now - */ - -#define VERSION_IN_DLB_FILENAME /* Append version digits to nhdat */ - -#ifdef MICRO -#undef MICRO /* never define this! */ -#endif - -#define NOCWD_ASSUMPTIONS /* Always define this. There are assumptions that \ - it is defined for WIN32. \ - Allow paths to be specified for HACKDIR, \ - LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \ - SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */ -#define NO_TERMS -#define ASCIIGRAPH - -#ifdef OPTIONS_USED -#undef OPTIONS_USED -#endif -#define OPTIONS_USED "options" -#define OPTIONS_FILE OPTIONS_USED - -#define PORT_HELP "porthelp" - -#define PORT_DEBUG /* include ability to debug international keyboard issues \ - */ - -#define RUNTIME_PORT_ID /* trigger run-time port identification for \ - * identification of exe CPU architecture \ - */ -#define RUNTIME_PASTEBUF_SUPPORT - - -#define SAFERHANGUP /* Define SAFERHANGUP to delay hangup processing \ - * until the main command loop. 'safer' because it \ - * avoids certain cheats and also avoids losing \ - * objects being thrown when the hangup occurs. \ - */ - -#define CONFIG_FILE ".nethackrc" -#define CONFIG_TEMPLATE ".nethackrc.template" -#define SYSCF_TEMPLATE "sysconf.template" -#define SYMBOLS_TEMPLATE "symbols.template" -#define GUIDEBOOK_FILE "Guidebook.txt" - -/* Stuff to help the user with some common, yet significant errors */ -#define INTERJECT_PANIC 0 -#define INTERJECTION_TYPES (INTERJECT_PANIC + 1) -extern void FDECL(interject_assistance, - (int, int, genericptr_t, genericptr_t)); -extern void FDECL(interject, (int)); - -/* - *=============================================== - * Compiler-specific adjustments - *=============================================== - */ - -#ifdef __MINGW32__ -#ifdef strncasecmp -#undef strncasecmp -#endif -#ifdef strcasecmp -#undef strcasecmp -#endif -/* extern int NDECL(getlock); */ -#endif - -#ifdef _MSC_VER -#if (_MSC_VER > 1000) -/* Visual C 8 warning elimination */ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _SCL_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#pragma warning(disable : 4996) /* VC8 deprecation warnings */ -#pragma warning(disable : 4142) /* benign redefinition */ -#pragma warning(disable : 4267) /* conversion from 'size_t' to XX */ -#if (_MSC_VER > 1600) -#pragma warning(disable : 4459) /* hide global declaration */ -#endif /* _MSC_VER > 1600 */ -#endif /* _MSC_VER > 1000 */ -#pragma warning(disable : 4761) /* integral size mismatch in arg; conv \ - supp*/ -#ifdef YYPREFIX -#pragma warning(disable : 4102) /* unreferenced label */ -#endif -#ifdef __cplusplus -/* suppress a warning in cppregex.cpp */ -#pragma warning(disable : 4101) /* unreferenced local variable */ -#endif -#ifndef HAS_STDINT_H -#define HAS_STDINT_H /* force include of stdint.h in integer.h */ -#endif -#endif /* _MSC_VER */ - -/* The following is needed for prototypes of certain functions */ -#if defined(_MSC_VER) -#include /* Provides prototypes of exit(), spawn() */ -#endif - -#include /* Provides prototypes of strncmpi(), etc. */ -#ifdef STRNCMPI -#define strncmpi(a, b, c) strnicmp(a, b, c) -#endif - -#ifdef _MSC_VER -/* Visual Studio defines this in their own headers, which we don't use */ -#ifndef snprintf -#define snprintf _snprintf -#pragma warning( \ - disable : 4996) /* deprecation warning suggesting snprintf_s */ -#endif -#endif - -#include -#include -#include -#ifdef __BORLANDC__ -#undef randomize -#undef random -#endif - -#define PATHLEN BUFSZ /* maximum pathlength */ -#define FILENAME BUFSZ /* maximum filename length (conservative) */ - -#if defined(_MAX_PATH) && defined(_MAX_FNAME) -#if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ) -#undef PATHLEN -#undef FILENAME -#define PATHLEN _MAX_PATH -#define FILENAME _MAX_FNAME -#endif -#endif - -#define NO_SIGNAL -#define index strchr -#define rindex strrchr - -/* Time stuff */ -#include - -#define USE_STDARG - -/* Use the high quality random number routines. */ -#ifdef USE_ISAAC64 -#undef RANDOM -#else -#define RANDOM -#define Rand() random() -#endif - -/* Fall back to C's if nothing else, but this really isn't acceptable */ -#if !defined(USE_ISAAC64) && !defined(RANDOM) -#define Rand() rand() -#endif - -#include -#define FCMASK (_S_IREAD | _S_IWRITE) /* file creation mask */ -#define regularize nt_regularize -#define HLOCK "NHPERM" - -#ifndef M -#define M(c) ((char) (0x80 | (c))) -/* #define M(c) ((c) - 128) */ -#endif - -#ifndef C -#define C(c) (0x1f & (c)) -#endif - -#if defined(DLB) -#define FILENAME_CMP stricmp /* case insensitive */ -#endif - -/* this was part of the MICRO stuff in the past */ -extern const char *alllevels, *allbones; -extern char hackdir[]; -#define ABORT C('a') -#define getuid() 1 -#define getlogin() ((char *) 0) -extern void NDECL(win32_abort); -extern void FDECL(nttty_preference_update, (const char *)); -extern void NDECL(toggle_mouse_support); -extern void FDECL(map_subkeyvalue, (char *)); -#if defined(WIN32CON) -extern void set_altkeyhandling(const char *); -#endif -extern void NDECL(raw_clear_screen); - -#include -#ifndef __BORLANDC__ -#include -#include -#else -int _RTLENTRY _EXPFUNC access(const char _FAR *__path, int __amode); -int _RTLENTRY _EXPFUNC _chdrive(int __drive); -int _RTLENTRYF _EXPFUNC32 chdir(const char _FAR *__path); -char _FAR *_RTLENTRY _EXPFUNC getcwd(char _FAR *__buf, int __buflen); -int _RTLENTRY _EXPFUNC -write(int __handle, const void _FAR *__buf, unsigned __len); -int _RTLENTRY _EXPFUNC creat(const char _FAR *__path, int __amode); -int _RTLENTRY _EXPFUNC close(int __handle); -int _RTLENTRY _EXPFUNC _close(int __handle); -int _RTLENTRY _EXPFUNC -open(const char _FAR *__path, int __access, ... /*unsigned mode*/); -long _RTLENTRY _EXPFUNC lseek(int __handle, long __offset, int __fromwhere); -int _RTLENTRY _EXPFUNC read(int __handle, void _FAR *__buf, unsigned __len); -#endif -#ifndef CURSES_GRAPHICS -#include /* conflicting definitions with curses.h */ -#endif -#undef kbhit /* Use our special NT kbhit */ -#define kbhit (*nt_kbhit) - -#ifdef LAN_FEATURES -#define MAX_LAN_USERNAME 20 -#endif - -#ifndef alloca -#define ALLOCA_HACK /* used in util/panic.c */ -#endif - -extern int FDECL(set_win32_option, (const char *, const char *)); -#define LEFTBUTTON FROM_LEFT_1ST_BUTTON_PRESSED -#define RIGHTBUTTON RIGHTMOST_BUTTON_PRESSED -#define MIDBUTTON FROM_LEFT_2ND_BUTTON_PRESSED -#define MOUSEMASK (LEFTBUTTON | RIGHTBUTTON | MIDBUTTON) -#ifdef CHANGE_COLOR -extern int FDECL(alternative_palette, (char *)); -#endif - -#ifdef NDEBUG -#define nhassert(expression) ((void)0) -#else -extern void FDECL(nhassert_failed, (const char * exp, const char * file, - int line)); - -#define nhassert(expression) (void)((!!(expression)) || \ - (nhassert_failed(#expression, __FILE__, __LINE__), 0)) -#endif - -#define nethack_enter(argc, argv) nethack_enter_winnt() -extern void FDECL(nethack_exit, (int)) NORETURN; -extern boolean FDECL(file_exists, (const char *)); -extern boolean FDECL(file_newer, (const char *, const char *)); -#endif /* NTCONF_H */ diff --git a/include/os2conf.h b/include/os2conf.h deleted file mode 100644 index fd625512a..000000000 --- a/include/os2conf.h +++ /dev/null @@ -1,105 +0,0 @@ -/* NetHack 3.6 os2conf.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ -/* Copyright (c) Timo Hakulinen, 1990, 1991, 1992, 1993, 1996. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifdef OS2 -#ifndef OS2CONF_H -#define OS2CONF_H - -/* - * Compiler configuration. Compiler may be - * selected either here or in Makefile.os2. - */ - -/* #define OS2_MSC /* Microsoft C 5.1 and 6.0 */ -#define OS2_GCC /* GCC emx 0.8f */ - /* #define OS2_CSET2 /* IBM C Set/2 (courtesy Jeff Urlwin) */ - /* #define OS2_CSET2_VER_1 /* CSet/2 version selection */ - /* #define OS2_CSET2_VER_2 /* - " - */ - -/* - * System configuration. - */ - -#define OS2_USESYSHEADERS /* use compiler's own system headers */ -/* #define OS2_HPFS /* use OS/2 High Performance File System */ - -#if defined(OS2_GCC) || defined(OS2_CSET2) -#define OS2_32BITAPI /* enable for compilation in OS/2 2.0 */ -#endif - -/* - * Other configurable options. Generally no - * reason to touch the defaults, I think. - */ - -/*#define MFLOPPY /* floppy and ramdisk support */ -#define RANDOM /* Berkeley random(3) */ -#define SHELL /* shell escape */ -/* #define TERMLIB /* use termcap file */ -#define ANSI_DEFAULT /* allows NetHack to run without termcap file */ -#define TEXTCOLOR /* allow color */ - -/* - * The remaining code shouldn't need modification. - */ - -#ifdef MSDOS -#undef MSDOS /* MSC autodefines this but we don't want it */ -#endif - -#ifndef MICRO -#define MICRO /* must be defined to allow some inclusions */ -#endif - -#if !defined(TERMLIB) && !defined(ANSI_DEFAULT) -#define ANSI_DEFAULT /* have to have one or the other */ -#endif - -#define PATHLEN 260 /* maximum pathlength (HPFS) */ -#define FILENAME 260 /* maximum filename length (HPFS) */ -#ifndef MICRO_H -#include "micro.h" /* necessary externs for [os_name].c */ -#endif - -#ifndef SYSTEM_H -#include "system.h" -#endif - -#ifndef index -#define index strchr -#endif -#ifndef rindex -#define rindex strrchr -#endif - -#include - -/* the high quality random number routines */ -#ifndef USE_ISAAC64 -# ifdef RANDOM -# define Rand() random() -# else -# define Rand() rand() -# endif -#endif - -/* file creation mask */ - -#include -#include - -#define FCMASK (S_IREAD | S_IWRITE) - -#include - -#ifdef __EMX__ -#include -#define sethanguphandler(foo) (void) signal(SIGHUP, (SIG_RET_TYPE) foo) -#endif - -void hangup(int i); -#endif /* OS2CONF_H */ -#endif /* OS2 */ diff --git a/include/qt_clust.h b/include/qt_clust.h deleted file mode 100644 index 46607c9b5..000000000 --- a/include/qt_clust.h +++ /dev/null @@ -1,34 +0,0 @@ -/* NetHack 3.6 qt_clust.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Warwick Allison, 1999. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef clusterizer_H -#define clusterizer_H - -#include - -class Clusterizer -{ - public: - Clusterizer(int maxclusters); - ~Clusterizer(); - - void add(int x, int y); // 1x1 rectangle (point) - void add(int x, int y, int w, int h); - void add(const QRect &rect); - - void clear(); - int - clusters() - { - return count; - } - const QRect &operator[](int i); - - private: - QRect *cluster; - int count; - const int max; -}; - -#endif diff --git a/include/qt_kde0.h b/include/qt_kde0.h deleted file mode 100644 index ecd448f0c..000000000 --- a/include/qt_kde0.h +++ /dev/null @@ -1,11 +0,0 @@ -/* NetHack 3.6 qt_kde0.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Warwick Allison, 1999. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef QT_DUMMYKDE -#define QT_DUMMYKDE -class KTopLevelWidget : public QMainWindow -{ - Q_OBJECT -}; -#endif diff --git a/include/qt_win.h b/include/qt_win.h deleted file mode 100644 index 136e8a6ef..000000000 --- a/include/qt_win.h +++ /dev/null @@ -1,890 +0,0 @@ -// NetHack 3.6 qt_win.h $NHDT-Date: 1447755972 2015/11/17 10:26:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ -// Copyright (c) Warwick Allison, 1999. -// NetHack may be freely redistributed. See license for details. -// -// Qt Binding for NetHack 3.4 -// -// Unfortunately, this doesn't use Qt as well as I would like, -// primarily because NetHack is fundamentally a getkey-type -// program rather than being event driven (hence the ugly key -// and click buffer rather), but also because this is my first -// major application of Qt. -// - -#ifndef qt_win_h -#define qt_win_h - -#define QT_CLEAN_NAMESPACE - -#include -#include -#include -#include -#include -#if defined(QWS) -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if QT_VERSION >= 300 -#include -// Should stop using QTableView -#define QTableView QtTableView -#else -#include -#endif -#include -#include - -#ifdef KDE -#include -#include -#endif - -#include "qt_clust.h" - -class QVBox; -class QMenuBar; -class QRadioButton; -class NhPSListView; - -////////////////////////////////////////////////////////////// -// -// The beautiful, abstracted and well-modelled classes... -// -////////////////////////////////////////////////////////////// - -class NetHackQtGlyphs; - -class NetHackQtLineEdit : public QLineEdit -{ - public: - NetHackQtLineEdit(); - NetHackQtLineEdit(QWidget *parent, const char *name); - - void fakeEvent(int key, int ascii, int state); -}; - -class NetHackQtSettings : public QDialog -{ - Q_OBJECT - public: - // Size of window - used to decide default sizes - NetHackQtSettings(int width, int height); - - NetHackQtGlyphs &glyphs(); - const QFont &normalFont(); - const QFont &normalFixedFont(); - const QFont &largeFont(); - - bool ynInMessages(); - - signals: - void fontChanged(); - void tilesChanged(); - - public slots: - void toggleGlyphSize(); - void setGlyphSize(bool); - - private: - QSpinBox tilewidth; - QSpinBox tileheight; - QLabel widthlbl; - QLabel heightlbl; - QCheckBox whichsize; - QSize othersize; - - QComboBox fontsize; - - QFont normal, normalfixed, large; - - NetHackQtGlyphs *theglyphs; - - private slots: - void resizeTiles(); -}; - -class NetHackQtKeyBuffer -{ - public: - NetHackQtKeyBuffer(); - - bool Empty() const; - bool Full() const; - - void Put(int k, int ascii, int state); - void Put(char a); - void Put(const char *str); - int GetKey(); - int GetAscii(); - int GetState(); - - int TopKey() const; - int TopAscii() const; - int TopState() const; - - private: - enum { maxkey = 64 }; - int key[maxkey]; - int ascii[maxkey]; - int state[maxkey]; - int in, out; -}; - -class NetHackQtClickBuffer -{ - public: - NetHackQtClickBuffer(); - - bool Empty() const; - bool Full() const; - - void Put(int x, int y, int mod); - - int NextX() const; - int NextY() const; - int NextMod() const; - - void Get(); - - private: - enum { maxclick = 64 }; - struct ClickRec { - int x, y, mod; - } click[maxclick]; - int in, out; -}; - -class NetHackQtSavedGameSelector : public QDialog -{ - public: - NetHackQtSavedGameSelector(const char **saved); - - int choose(); -}; - -class NetHackQtPlayerSelector : private QDialog -{ - Q_OBJECT - public: - enum { R_None = -1, R_Quit = -2, R_Rand = -3 }; - - NetHackQtPlayerSelector(NetHackQtKeyBuffer &); - - protected: - virtual void done(int); - - public slots: - void Quit(); - void Random(); - - void selectName(const QString &n); - void selectRole(); - void selectRace(); - void setupOthers(); - void selectGender(int); - void selectAlignment(int); - - public: - bool Choose(); - - private: - NetHackQtKeyBuffer &keysource; - NhPSListView *role; - NhPSListView *race; - QRadioButton **gender; - QRadioButton **alignment; - bool fully_specified_role; -}; - -class NetHackQtStringRequestor : QDialog -{ - private: - QLabel prompt; - NetHackQtLineEdit input; - QPushButton *okay; - QPushButton *cancel; - NetHackQtKeyBuffer &keysource; - - virtual void done(int); - - public: - NetHackQtStringRequestor(NetHackQtKeyBuffer &, const char *p, - const char *cancelstr = "Cancel"); - void SetDefault(const char *); - bool Get(char *buffer, int maxchar = 80); - virtual void resizeEvent(QResizeEvent *); -}; - -class NetHackQtExtCmdRequestor : public QDialog -{ - Q_OBJECT - - NetHackQtKeyBuffer &keysource; - - public: - NetHackQtExtCmdRequestor(NetHackQtKeyBuffer &ks); - int get(); - - private slots: - void cancel(); - void done(int i); -}; - -class NetHackQtWindow -{ - public: - NetHackQtWindow(); - virtual ~NetHackQtWindow(); - - virtual QWidget *Widget() = 0; - - virtual void Clear(); - virtual void Display(bool block); - virtual bool Destroy(); - virtual void CursorTo(int x, int y); - virtual void PutStr(int attr, const char *text); - virtual void StartMenu(); - virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, - char gch, int attr, const char *str, bool presel); - virtual void EndMenu(const char *prompt); - virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); - virtual void ClipAround(int x, int y); - virtual void PrintGlyph(int x, int y, int glyph); - virtual void UseRIP(int how, time_t when); - - int nhid; -}; - -class NetHackQtGlyphs -{ - public: - NetHackQtGlyphs(); - - int - width() const - { - return size.width(); - } - int - height() const - { - return size.height(); - } - void toggleSize(); - void setSize(int w, int h); - - void drawGlyph(QPainter &, int glyph, int pixelx, int pixely); - void drawCell(QPainter &, int glyph, int cellx, int celly); - - private: - QImage img; - QPixmap pm, pm1, pm2; - QSize size; - int tiles_per_row; -}; - -class BlackScrollView : public QScrollView -{ - public: - BlackScrollView() - { - viewport()->setBackgroundColor(black); - } -}; - -class NetHackQtMapWindow : public QWidget, public NetHackQtWindow -{ - Q_OBJECT - private: - NetHackQtClickBuffer &clicksink; - unsigned short glyph[ROWNO][COLNO]; - unsigned short & - Glyph(int x, int y) - { - return glyph[y][x]; - } - QPoint cursor; - BlackScrollView viewport; - QPixmap pet_annotation; - Clusterizer change; - QFont *rogue_font; - QString messages; - QRect messages_rect; - - void Changed(int x, int y); - - signals: - void resized(); - - private slots: - void updateTiles(); - void moveMessages(int x, int y); -#ifdef SAFERHANGUP - void timeout(); -#endif - - protected: - virtual void paintEvent(QPaintEvent *); - virtual void mousePressEvent(QMouseEvent *); - - public: - NetHackQtMapWindow(NetHackQtClickBuffer &click_sink); - ~NetHackQtMapWindow(); - - virtual QWidget *Widget(); - virtual bool Destroy(); - - virtual void Clear(); - virtual void Display(bool block); - virtual void CursorTo(int x, int y); - virtual void PutStr(int attr, const char *text); - virtual void ClipAround(int x, int y); - virtual void PrintGlyph(int x, int y, int glyph); - - void Scroll(int dx, int dy); - - // For messages - void displayMessages(bool block); - void putMessage(int attr, const char *text); - void clearMessages(); - - void clickCursor(); -}; - -class NetHackQtScrollText; -class NetHackQtMessageWindow : QObject, public NetHackQtWindow -{ - Q_OBJECT - public: - NetHackQtMessageWindow(); - ~NetHackQtMessageWindow(); - - virtual QWidget *Widget(); - virtual void Clear(); - virtual void Display(bool block); - virtual void PutStr(int attr, const char *text); - - void Scroll(int dx, int dy); - - void setMap(NetHackQtMapWindow *); - - private: - NetHackQtScrollText *list; - bool changed; - NetHackQtMapWindow *map; - - private slots: - void updateFont(); -}; - -class NetHackQtLabelledIcon : public QWidget -{ - public: - NetHackQtLabelledIcon(QWidget *parent, const char *label); - NetHackQtLabelledIcon(QWidget *parent, const char *label, - const QPixmap &icon); - - enum { NoNum = -99999 }; - void setLabel(const char *, bool lower = TRUE); // a string - void setLabel(const char *, long, const char *tail = ""); // a number - void setLabel(const char *, long show_value, long comparative_value, - const char *tail = ""); - void setIcon(const QPixmap &); - virtual void setFont(const QFont &); - - void highlightWhenChanging(); - void lowIsGood(); - void dissipateHighlight(); - - virtual void show(); - - protected: - void resizeEvent(QResizeEvent *); - - private: - void initHighlight(); - void setAlignments(); - void highlight(const QPalette &highlight); - void unhighlight(); - - bool low_is_good; - int prev_value; - int turn_count; /* last time the value changed */ - QPalette hl_good; - QPalette hl_bad; - - QLabel *label; - QLabel *icon; -}; - -class NetHackQtStatusWindow : QWidget, public NetHackQtWindow -{ - Q_OBJECT - public: - NetHackQtStatusWindow(); - - virtual QWidget *Widget(); - - virtual void Clear(); - virtual void Display(bool block); - virtual void CursorTo(int x, int y); - virtual void PutStr(int attr, const char *text); - - void fadeHighlighting(); - - protected: - void resizeEvent(QResizeEvent *); - - private slots: - void doUpdate(); - - private: - enum { hilight_time = 1 }; - - QPixmap p_str; - QPixmap p_dex; - QPixmap p_con; - QPixmap p_int; - QPixmap p_wis; - QPixmap p_cha; - - QPixmap p_chaotic; - QPixmap p_neutral; - QPixmap p_lawful; - - QPixmap p_satiated; - QPixmap p_hungry; - - QPixmap p_confused; - QPixmap p_sick_fp; - QPixmap p_sick_il; - QPixmap p_blind; - QPixmap p_stunned; - QPixmap p_hallu; - - QPixmap p_encumber[5]; - - NetHackQtLabelledIcon name; - NetHackQtLabelledIcon dlevel; - - NetHackQtLabelledIcon str; - NetHackQtLabelledIcon dex; - NetHackQtLabelledIcon con; - NetHackQtLabelledIcon intel; - NetHackQtLabelledIcon wis; - NetHackQtLabelledIcon cha; - - NetHackQtLabelledIcon gold; - NetHackQtLabelledIcon hp; - NetHackQtLabelledIcon power; - NetHackQtLabelledIcon ac; - NetHackQtLabelledIcon level; - NetHackQtLabelledIcon exp; - NetHackQtLabelledIcon align; - - NetHackQtLabelledIcon time; - NetHackQtLabelledIcon score; - - NetHackQtLabelledIcon hunger; - NetHackQtLabelledIcon confused; - NetHackQtLabelledIcon sick_fp; - NetHackQtLabelledIcon sick_il; - NetHackQtLabelledIcon blind; - NetHackQtLabelledIcon stunned; - NetHackQtLabelledIcon hallu; - NetHackQtLabelledIcon encumber; - - QFrame hline1; - QFrame hline2; - QFrame hline3; - - int cursy; - - bool first_set; - - void nullOut(); - void updateStats(); - void checkTurnEvents(); -}; - -class NetHackQtMenuDialog : public QDialog -{ - Q_OBJECT - public: - NetHackQtMenuDialog(); - - void Accept(); - void Reject(); - void SetResult(int); - - virtual void done(int); - - protected: - void resizeEvent(QResizeEvent *); - - signals: - void Resized(); -}; - -class NetHackQtMenuWindow : public QTableView, public NetHackQtWindow -{ - Q_OBJECT - public: - NetHackQtMenuWindow(NetHackQtKeyBuffer &); - ~NetHackQtMenuWindow(); - - virtual QWidget *Widget(); - - virtual void StartMenu(); - virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, - char gch, int attr, const char *str, bool presel); - virtual void EndMenu(const char *prompt); - virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); - - public slots: - void All(); - void ChooseNone(); - void Invert(); - void Search(); - - void Layout(); - void ToggleSelect(int); - - protected: - virtual void keyPressEvent(QKeyEvent *); - // virtual void mouseDoubleClickEvent(QMouseEvent*); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void mouseMoveEvent(QMouseEvent *); - virtual void focusOutEvent(QFocusEvent *); - virtual void focusInEvent(QFocusEvent *); - - virtual void paintCell(QPainter *, int, int); - virtual int cellWidth(int col); - - private: - struct MenuItem { - MenuItem(); - ~MenuItem(); - - int glyph; - ANY_P identifier; - int attr; - const char *str; - int count; - char ch; - bool selected; - - bool - Selectable() const - { - return identifier.a_void != 0; - } - }; - - QArray item; - - int itemcount; - int str_width; - bool str_fixed; - int next_accel; - - NetHackQtKeyBuffer &keysource; - - NetHackQtMenuDialog *dialog; - - QPushButton *ok; - QPushButton *cancel; - QPushButton *all; - QPushButton *none; - QPushButton *invert; - QPushButton *search; - QLabel prompt; - - int how; - - bool has_glyphs; - - int pressed; - bool was_sel; -}; - -class NetHackQtTextListBox; - -class NetHackQtRIP : public QWidget -{ - private: - static QPixmap *pixmap; - char **line; - int riplines; - - public: - NetHackQtRIP(QWidget *parent); - - void setLines(char **l, int n); - - protected: - virtual void paintEvent(QPaintEvent *event); - QSize sizeHint() const; -}; - -class NetHackQtTextWindow : public QDialog, public NetHackQtWindow -{ - Q_OBJECT - public: - NetHackQtTextWindow(NetHackQtKeyBuffer &); - ~NetHackQtTextWindow(); - - virtual QWidget *Widget(); - - virtual void Clear(); - virtual bool Destroy(); - virtual void Display(bool block); - virtual void PutStr(int attr, const char *text); - virtual void UseRIP(int how, time_t when); - - public slots: - void Search(); - - protected: - virtual void done(int); - virtual void keyPressEvent(QKeyEvent *); - - private slots: - void doUpdate(); - - private: - NetHackQtKeyBuffer &keysource; - - bool use_rip; - bool str_fixed; - - QPushButton ok; - QPushButton search; - NetHackQtTextListBox *lines; - - NetHackQtRIP rip; -}; - -class NetHackQtMenuOrTextWindow : public NetHackQtWindow -{ - private: - NetHackQtWindow *actual; - NetHackQtKeyBuffer &keysource; - - public: - NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer &); - - virtual QWidget *Widget(); - - // Text - virtual void Clear(); - virtual bool Destroy(); - virtual void Display(bool block); - virtual void PutStr(int attr, const char *text); - - // Menu - virtual void StartMenu(); - virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, - char gch, int attr, const char *str, bool presel); - virtual void EndMenu(const char *prompt); - virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); -}; - -class NetHackQtDelay : QObject -{ - private: - int msec; - - public: - NetHackQtDelay(int ms); - void wait(); - virtual void timerEvent(QTimerEvent *timer); -}; - -class NetHackQtInvUsageWindow : public QWidget -{ - public: - NetHackQtInvUsageWindow(QWidget *parent); - virtual void paintEvent(QPaintEvent *); - - private: - void drawWorn(QPainter &painter, obj *, int x, int y, bool canbe = TRUE); -}; - -// This class is the main widget for NetHack -// -// It is a collection of Message, Map, and Status windows. In the current -// version of nethack there is only one of each, and this class makes this -// assumption, not showing itself until all are inserted. -// -// This class simply knows how to layout such children sensibly. -// -// Since it is only responsible for layout, the class does not -// note the actual class of the windows. -// -#ifndef KDE -#include "qt_kde0.h" -#endif - -class NetHackQtMainWindow : public KTopLevelWidget -{ - Q_OBJECT - public: - NetHackQtMainWindow(NetHackQtKeyBuffer &); - - void AddMessageWindow(NetHackQtMessageWindow *window); - void AddMapWindow(NetHackQtMapWindow *window); - void AddStatusWindow(NetHackQtStatusWindow *window); - void RemoveWindow(NetHackQtWindow *window); - void updateInventory(); - - void fadeHighlighting(); - - public slots: - void doMenuItem(int); - void doKeys(const QString &); - - protected: - virtual void resizeEvent(QResizeEvent *); - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *event); - virtual void closeEvent(QCloseEvent *); - - private slots: - void layout(); - void raiseMap(); - void zoomMap(); - void raiseMessages(); - void raiseStatus(); - - private: - void ShowIfReady(); - -#ifdef KDE - KMenuBar *menubar; -#else - QMenuBar *menubar; -#endif - NetHackQtMessageWindow *message; - NetHackQtMapWindow *map; - NetHackQtStatusWindow *status; - NetHackQtInvUsageWindow *invusage; - - NetHackQtKeyBuffer &keysink; - QWidgetStack *stack; - int dirkey; - - const char **macro; -}; - -class NetHackQtYnDialog : QDialog -{ - Q_OBJECT - private: - const char *question; - const char *choices; - char def; - NetHackQtKeyBuffer &keysource; - - protected: - virtual void keyPressEvent(QKeyEvent *); - virtual void done(int); - - private slots: - void doneItem(int); - - public: - NetHackQtYnDialog(NetHackQtKeyBuffer &keysource, const char *, - const char *, char); - - char Exec(); -}; - -#ifdef KDE -#define NetHackQtBindBase KApplication -#elif defined(QWS) -#define NetHackQtBindBase QPEApplication -#else -#define NetHackQtBindBase QApplication -#endif - -class NetHackQtBind : NetHackQtBindBase -{ - private: - // Single-instance preservation... - NetHackQtBind(int &argc, char **argv); - - static NetHackQtBind *instance; - - static NetHackQtKeyBuffer keybuffer; - static NetHackQtClickBuffer clickbuffer; - - static QWidget *splash; - static NetHackQtMainWindow *main; - - public: - static void qt_init_nhwindows(int *argc, char **argv); - static void qt_player_selection(); - static void qt_askname(); - static void qt_get_nh_event(); - static void qt_exit_nhwindows(const char *); - static void qt_suspend_nhwindows(const char *); - static void qt_resume_nhwindows(); - static winid qt_create_nhwindow(int type); - static void qt_clear_nhwindow(winid wid); - static void qt_display_nhwindow(winid wid, BOOLEAN_P block); - static void qt_destroy_nhwindow(winid wid); - static void qt_curs(winid wid, int x, int y); - static void qt_putstr(winid wid, int attr, const char *text); - static void qt_display_file(const char *filename, BOOLEAN_P must_exist); - static void qt_start_menu(winid wid); - static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier, - CHAR_P ch, CHAR_P gch, int attr, const char *str, - BOOLEAN_P presel); - static void qt_end_menu(winid wid, const char *prompt); - static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); - static void qt_update_inventory(); - static void qt_mark_synch(); - static void qt_wait_synch(); - - static void qt_cliparound(int x, int y); - static void qt_cliparound_window(winid wid, int x, int y); - static void qt_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, - int glyph, int bkglyph); - static void qt_raw_print(const char *str); - static void qt_raw_print_bold(const char *str); - static int qt_nhgetch(); - static int qt_nh_poskey(int *x, int *y, int *mod); - static void qt_nhbell(); - static int qt_doprev_message(); - static char qt_yn_function(const char *question, const char *choices, - CHAR_P def); - static void qt_getlin(const char *prompt, char *line); - static int qt_get_ext_cmd(); - static void qt_number_pad(int); - static void qt_delay_output(); - static void qt_start_screen(); - static void qt_end_screen(); - - static void qt_outrip(winid wid, int how, time_t when); - static int qt_kbhit(); - - private: - virtual bool notify(QObject *receiver, QEvent *event); -}; - -#endif diff --git a/include/qt_xpms.h b/include/qt_xpms.h deleted file mode 100644 index 5667c13c0..000000000 --- a/include/qt_xpms.h +++ /dev/null @@ -1,1422 +0,0 @@ -/* clang-format off */ -/* XPM */ -static const char *blind_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 5 1", -/* colors */ -" c #000000", -". c None", -"X c #909090", -"o c #606060", -"O c #303030", -/* pixels */ -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"....ooooooooooooooooooooooooooooooooX...", -".... o...", -".... o...", -".... o...", -".... o...", -"......o ..o ......", -"......X O..X O......", -"....... o... o......", -".......o ....o .......", -"........O X.....O X.......", -".........O X.......O X........", -"..........o OX.........o OX.........", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................", -"........................................" -}; -/* XPM */ -static const char *cha_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 14 1", -/* colors */ -" c #F85848", -". c #949E9E", -"X c #F8B090", -"o c #E00028", -"O c #D4D4D4", -"+ c None", -"@ c #B0B0B0", -"# c #F82C24", -"$ c #F89E6C", -"% c #FF0000", -"& c #909090", -"* c #FFFFFF", -"= c #CEAA90", -"- c #DADAB6", -/* pixels */ -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"+++++++++++++++=#%#=+=#%% ++++++++++++++", -"++++++++++++++ %O%%%#%$$%o%=++++++++++++", -"+++++++++++++# +#%%o%%o%%%%% +++++++++++", -"+++++++++++ %%%%%%%%%%%%%%%%o#=+++++++++", -"+++++++++ o%%%%%%%%%%%%%%%%%%%%# +++++++", -"++++++ #%%%%%%o%%%o%%o%%o%o%%%%%o%o +++", -"++=#%%o%%%#= =*+**O*+**O*+- = =%%%%#@+++", -"++++ %=++*+*+**O****O****O*O*O*OO%=+++++", -"+++++.%=OO+*O*OO****+****+*O*+O&%=@+++++", -"++++++=%=*OO+**O**O*O**O*O*OO+$%=+++++++", -"+++++++#% +*OOOO****+****@O+*#%=++++++++", -"++++++++#%#*+**+O+OO+O+OOO*O#o#+++++++++", -"+++++++++o% O**+****O****O*#%%=+++++++++", -"+++++++++ %%#O*O****+****+ %o#++++++++++", -"++++++++++o%% XO*O**O*O**#%%%+++++++++++", -"++++++++++ %%%o%$-**+**$%%%%=+++++++++++", -"+++++++++++o%%$X$%%%%%%#= o#++++++++++++", -"++++++++++@ %%%o#O$$+$$$%%%=++++++++++++", -"++++++++++++#o%%%%%%%%o%%%=@++++++++++++", -"+++++++++++++ %%%%%%%%%%o=++++++++++++++", -"+++++++++++++++= & & @++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++" -}; -/* XPM */ -static const char *chaotic_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 9 1", -/* colors */ -" c #000000", -". c #5C7A7A", -"X c None", -"o c #B0B0B0", -"O c #909090", -"+ c #788C8C", -"@ c #606060", -"# c #FFFFFF", -"$ c #303030", -/* pixels */ -"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXXXXXX@$ @XXXXXXXXXXXX", -"XXXXXXXXXXXXXXXXXXX$$+#X$ $XXXXXXXXXX", -"XXXXXXXXXXXXXXXXXX@$#o @XXXXXXXXX", -"XXXXXXXXXXXXXXXXXX$XX OXXXXXXXX", -"XXXXXXXXXXXXXXXXX@ # $@$ $XXXXXXXX", -"XXXXXXXXXXXXXXXXX@.+ $XXXO @XXXXXXX", -"XXXXXXXXXXXXXXXXX O@ XXXXX@ @XXXXXXX", -"XXXXXXXXXXXXXXXXX @O $XXXXX@$ @XXXXXXX", -"XXXXXXXXXXXXXXXXX O+ @XXXXO++ @XXXXXXX", -"XXXXXXXXXXXXXXXXX @+ $@OXO$#$ XXXXXXXX", -"XXXXXXXXXXXXXXXXX O@ $ @$Xo $XXXXXXXX", -"XXXXXXXXXXXXXXXXX +O $X##+ $XXXXXXXXX", -"XXXXXXXXXXXXXXXXX +@ $XXXXXXXXXX", -"XXXXXXXXXXXXXXXXX oO $XXXXXXXXXXX", -"XXXXXXXXO@@@@@ +# $XXXXXXXXXXXX", -"XXXXXXO +o########$ $@XXXXXXXXX", -"XXXXXX +#+.$XXXXXXXX", -"XXXXXX @O @XXXXXXX", -"XXXXXX$ $@ $@@$ @XXXXXXX", -"XXXXXXX@@@@XXXXXX + @XXXX@$ OXXXXXXX", -"XXXXXXXXXXXXXXXX@ # @XXXXXXX@@OXXXXXXXX", -"XXXXXXXXXXXXXXXX@.+ @XXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXX$O@ XXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXX @O XXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXX #$ @XXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXX # @XXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXX # @XXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX@ # @XXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX@ # OXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX@.X XXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX ++ XXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX @+ XXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX O@ @XXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX +O @XXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX @XXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX$ OXXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXX@@OXXXXXXXXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -}; -/* XPM */ -static const char *cns_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 19 1", -/* colors */ -" c #000000", -". c #F85848", -"X c #949E9E", -"o c #F8B090", -"O c #E00028", -"+ c #7C3400", -"@ c None", -"# c #B0B0B0", -"$ c #F82C24", -"% c #F89E6C", -"& c #FF0000", -"* c #B64700", -"= c #909090", -"- c #788C8C", -"; c #606060", -": c #C80050", -"> c #CEAA90", -", c #303030", -"< c #FFB691", -/* pixels */ -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@.oo.o$ ;@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@>.o.%%O,@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@$oo.o. ,@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@.oo$oo+ =@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@..o&oo$ ,@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@#.o.oo. =@.$%@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@.o..oo& O.%ooo@@@@@@@@@@@@@", -"@@@@@@@@@@@@@.o.&%o.$oo%O++;@@@@@@@@@@@@", -"@@@@@@@@@@@@@.o.+$%$o.@@@@@@@@@@@", -"@@@@@@@@@@@@@.oo++o%$$ ,@@$.oo@@@@@@@@@@", -"@@@@@@@@@@@@>.oo+Oo$o%.@@$oo..-@@@@@@@@@", -"@@@@@@@@@@@@..o%;.o&%.$..o%O ++>@@@@@@@@", -"@@@@@@@@@@@@>.$O:%o.O::::O* $oooo@@@@@@@", -"@@@@@@@@@@@@::::::$$:OO&OO::oo%.;=@@@@@@", -"@@@@@@@@@@@.::::::::O&&&&&O::++ ,@@@@@@", -"@@@@@@@@@@>:::O&&OO&&&&&&&&:: ;@@@@@", -"@@@@@@@@@@=::O&&&&&O:O&&&&&O: ,=@@@@@@@", -"@@@@@@@@@@:::&&&&&&&&:&&&&&O: ;@@@@@@@@", -"@@@@@@@@@@::O&&&&&&&&:&O&&&O:, ;@@@@@@@@", -"@@@@@@@@@@::O&&&&O&O&OO&O&&O:+ ;@@@@@@@@", -"@@@@@@@@@@::&&&O&&&&&O:&&&&O:, @@@@@@@@", -"@@@@@@@@@@::O&&&&&O&&&:O&O&::+ @@@@@@@@", -"@@@@@@@@@@::O&&O&&&&O&OO&&&:: @@@@@@@@", -"@@@@@@@@@@=::O&&&&O&&&O:&&&:: @@@@@@@@", -"@@@@@@@@@@.:::O&&O&&&&&:&OO:: @@@@@@@@", -"@@@@@@@@@@@:::::&&&&O&O:&&O:, @@@@@@@@", -"@@@@@@@@@@.>:::::O&&&&&:&&::+ ;@@@@@@@@", -"@@@@@@@@@@>.<::::O&&O&O:&&:: @@@@@@@@@", -"@@@@@@@@@@@.o%,:::O&&&O:&O:, @@@@@@@@@", -"@@@@@@@@@@@$o. :::OO&OO&::, ;@@@@@@@@@", -"@@@@@@@@@@@&o%+ ,::O&OO&O:: =@@@@@@@@@", -"@@@@@@@@@@@.oo+ :::OO::: ,@@@@@@@@@@", -"@@@@@@@@@@@..oO +::::: =@@@@@@@@@@", -"@@@@@@@@@@@@.<.+ ,+, ,@@@@@@@@@@@", -"@@@@@@@@@@@@Oo<+ @X, ,@@@@@@@@@@@@", -"@@@@@@@@@@@@.%o$ @@@@@;, ;@@@@@@@@@@@@@", -"@@@@@@@@@@@@@.o., =@@@@@@@@@@@@@@@@@@@@@", -"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -}; -/* XPM */ -static const char *confused_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 13 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #303030", -"= c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOO.=.+OO=.+O.OO+O+OO.+OOOOOO", -"OOOOOOOOOOO++=====O=====+=O+==++=O+OOOOO", -"OOOOOOOOOOO+=.=====.=++++===OO==+O=+OOOO", -"OOOOOOOOOOO=+===.+=o==o===+&OoO======OOO", -"OOOOOOOO+O+====OO+=o&&&&Oo==o&oO+==+=.O.", -"OOOO+.+=+O==+&&o=oooOo&o&ooo=&oooO==O=+=", -"OOOOOOOO++O===oo=oo&=&o&&oo=o==&o+==++==", -"OOOOOOOO=o.=O====o&OO&o&oo&o&&oo=======O", -"OOOOOOOo===+=O=O=ooO=ooooOOo=o&O=====OOO", -"OOOOOOOOO+==+=======O=oo====O=o=O===+OOO", -"OOOOOOOOO.=#=X=+====O========O======OOOO", -"OOOOOOO.#Xo++.=#%====O==========OO==+OOO", -"OOOOOO+Xo#+#+.#=.==X====+====O=+=+==+OOO", -"OOOOO.+.+O===##.#=X.====oX##===o+OO.OOOO", -"OOOOO#+####O#O##o.#+==#X#O#+...=OOo=+OOO", -"OOOO++#o+#+X++++#.#O.#+#X.#+X+==+OO=oOOO", -"OOOO#+.+..X+.##X++#++#..+XX#+##+..OOOOOO", -"OOOO##....O+#++#+.++#+X+#+#X..+#+#OOOOOO", -"OOOO++#+.+.#+#O+X#X#XX#.++##.#++.X$OOOOO", -"OOOOO#+#+.+++#++.+++##+X###+X+X##+**OOOO", -"OOOOO#..#OO#+.##o###.+..++.+#X+#+#* @OOO", -"OOOOO+#.#O+#+#O.+++.###+##++###+.#* $OOO", -"OOOOOOXX+#+#+#o..X##++#+..##.#+### *OOO", -"OOOOOOOX#.#X+#+#+#+.#+..+####%XX%% OOO", -"OOOOOOOO.%%X.#+#+#.++#+#+#+.X++=.% *OOO", -"OOOOOOOOO.* *##+#+.O####.+XX%%%%#% $OOO", -"OOOOOOOOOOO. %X.+.#+++XXX=.+++#X $OOO", -"OOOOOOOOOOOO.* %%X..#X%=.####%X* $OOO", -"OOOOOOOOOOOOOO.$ *XX%%%=.#X%###=* OOOO", -"OOOOOOOOOOOOOOOOOO+%%%=%%#.+.#=* @OOOO", -"OOOOOOOOOOOOOOOOOOo=%%%==X##X%* OOOOO", -"OOOOOOOOOOOOOOOOOOO+X%%%%X=%* @OOOOO", -"OOOOOOOOOOOOOOOOOOOOX%%%%X *@OOOOOO", -"OOOOOOOOOOOOOOOOOOOO=%%%X* *$$OOOOOOOO", -"OOOOOOOOOOOOOOOOOOOO+X%%= .OOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOX%%% OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOO=%%* $OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOO=%%% $OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOO+%%% $OOOOOOOOOOOOO" -}; -/* XPM */ -static const char *dex_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 19 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #F8B090", -"o c #5C7A7A", -"O c #D4D4D4", -"+ c #F87A24", -"@ c #7C3400", -"# c None", -"$ c #B0B0B0", -"% c #F89E6C", -"& c #B64700", -"* c #909090", -"= c #606060", -"- c #CEAA90", -"; c #DADAB6", -": c #303030", -"> c #F86800", -", c #FFB691", -"< c #F88C48", -/* pixels */ -"########################################", -"########################################", -"########################################", -"########################################", -"########################################", -"########################################", -"###############-%-######################", -"##############-%X<-#####################", -"#########-<<-#-%XX+==###################", -"#########%,X< :<,X%@ :##################", -"#########-XX%: @;X%+ *#################", -"##########<,X& :<<%+: :#################", -"######->+#-%%%: <,XX@ #################", -"######%X%@ <,,& @XXX+ :++-#############", -"######-: +XX+ #########", -"#####+%%@@,X%<,XXXXXXX<:@XXX<: =########", -"####$%XX< <,<,XX& ########", -"#####$%<%X@%XXXX<%XX< =#######", -"#######<;X%XXXXX<<,XXXXXX%,XXXXXXXXX%@ #######", -"##########- c #788C8C", -", c #606060", -"< c #406868", -"1 c #C80050", -"2 c #FFFFFF", -"3 c #FFFF00", -"4 c #00B6FF", -"5 c #CEAA90", -"6 c #DADAB6", -"7 c #F86800", -"8 c #FFB691", -"9 c #6C91B6", -"0 c #F88C48", -"q c #0000FF", -/* pixels */ -"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", -"$$$$$$$$$$$$$$$353333335*$$$$$$$$$$$$$$$", -"$$$$$$$$$$$$*33333333#7@3335$$$$$$$$$$$$", -"$$$$$$$$$65333333333@7777#333*$$$$$$$$$$", -"$$$$$$$$$3333333333377777733333===%$$$$$", -"$$$$$$$533333333333#7777777333%=====$$$$", -"$$$$$$ #3333333333o>7777773330======%$$$", -"$$$$5---O#33333o3944077777333*=======$$$", -"$$$$-----O333333>4444.77333330======%$$$", -"$$$ ---O--;3333344444443333333:====5$$$$", -"$$$ O-----733333444444433333333 ==035$$$", -"$$$3--O--O333333>44444>33333333333333$$$", -"$$533---O33333333944493333#333333333356$", -"$$33867733333o33333:o333333o3333333333$$", -"$532+2233333#333333333333oooo3#3333333%$", -"6522222+33333333333333333oooooo33o3333*$", -"$+22+22263333333o3333333ooooooo333333356", -"662222+2533333333333333#ooooooo33333333$", -"$32+22223333o3#33333o333ooooooo3#333333%", -"$33222233333333333#333333ooooo333333333$", -"$33368333333333333330626*oooo#333333o33%", -"%333335== 33oo333333222223#333333333333$", -"$3333=====:ooooo333+22+2263333333.>o333%", -"$5333=====oooooo33322222223333339444935$", -"$*33 ====>ooooooo3362+222633333.44444>3$", -"$%330====:ooooooo333222+23333334444444$$", -"$$333177 =oooXoo#333*626333333;4444444$$", -"$$53##777&3oooo3333333333333#--,444449$$", -"$$$3;77777#3o333333333333333O---94449$$$", -"$$%*@77777#33333333333333337O----O:o3$$$", -"$$$5777777333 333333333333;---O-O73$$$$", -"$$$$#7777730====#:.,33333333------3$$$$$", -"$$$$$577333=====qqqq<0333333#O---35$$$$$", -"$$$$$%53335====qqqqqq.33o333337735$$$$$$", -"$$$$$$$533 ====qqqqqqq3333333333%$$$$$$$", -"$$$$$$$$%33====qqqqqqq333333333%$$$$$$$$", -"$$$$$$$$$$50===qqqqqq,3333333:$$$$$$$$$$", -"$$$$$$$$$%6%5503,qqq<333#335%$$$$$$$$$$$", -"$$$$$$$$$$$$$%$*53,03335o$%%$$$$$$$$$$$$", -"$$$$$$$$$$$$$$$$$$$$$%$$+$$$$$$$$$$$$$$$" -}; -/* XPM */ -static const char *hungry_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 15 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #CEAA90", -"= c #DADAB6", -"- c #303030", -"; c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO========OOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOO=============OOOOOOOOOOOOO", -"OO;XX;@OOOOO================OOOOOOOO;XOO", -"OO;%-;$OOOO==================OOOOOOO;XOO", -"OO;-%;$OOO========@$#@========OOOOO+;;$O", -"OO;%-;$OO=======- -*======*OOOO.;;$O", -"OO;-%;$O======* @====.$$&=====@OOO.;;$O", -"OO;X%;$O====== -========*@=====*.OO+;;$O", -"OO;;;X$o====* -==========@======$OO;;;$O", -"OO+;;-+o====- =============o====#@O+;;$O", -"OOO;%$O===== @=============&====*$O;;;$O", -"OOO+%OO====@ ==============&=====-OO;;$O", -"OOo;-Oo====$ ==============o&==== OO;;$O", -"OOO+%OO====@ ==============&===== O+;;#O", -"OOO;-Oo====$-==============&&==== O+;;-O", -"OOO;;+O=====$*============&&====* OO;;%+", -"OOO;;$o=====$.============&&====X-OO;;$O", -"OOO;;$O======*.===&======&&=====-$=O;;$O", -"OOO;;$Oo=====.==========&&=====* @O+;;$O", -"OOO;;$OO=======oo=====&&&======$-OOO;;$O", -"OOO;;$OOo=======&o&&&&&&======$ @OOO;;$O", -"OOO;;$OOOO========&=&========* $OOOO;;$O", -"OO+;;$OOOOo=================* -OOOOO#;$O", -"OOO;;$OOOOO=*==============@ -=OOOOO;;$O", -"OOO;;$OOOOOOO+*==========*- $OOOOOOO;;$O", -"OOOX-$OOOOOOOO@X@*====*#- -.OOOOOOOOX-$O", -"OOOOOOOOOOOOOO=*@$- -$.=OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOO=O==O=O=OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *hvy_enc_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 13 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #303030", -"= c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", -"OOOOOOOOOOO&&&&&&&&&&&&&&&.OOOOOOOOOOOOO", -"OOOOOOOOOOOo==============X*OOOOOOOOOOOO", -"OOOOOOOOOOoO===X====X=====X**OOOOOOOOOOO", -"OOOOOOOOOO&============X===% $OOOOOOOOOO", -"OOOOOOOOOoo===*%====***%===%* OOOOOOOOOO", -"OOOOOOOOOoO==% %===* %==X* @OOOOOOOOO", -"OOOOOOOOO&===% *==% X==**===% $OOOOOOOOO", -"OOOOOOOOoo===% %==% ===% ===X OOOOOOOOO", -"OOOOOOOOoO==== *== *==== *==X* @OOOOOOOO", -"OOOOOOOO&===== %== %==== %===% $OOOOOOOO", -"OOOOOOOoo===== *== *==== *===%* OOOOOOOO", -"OOOOOOOoO===== %==% ===* ====X* @OOOOOOO", -"OOOOOOO&===X== *==% X==**=====% $OOOOOOO", -"OOOOOOoo===== *==* %=====X OOOOOOO", -"OOOOOOoO=====*%%X===*%*X======%* @OOOOOO", -"OOOOOOo====================X===* $OOOOOO", -"OOOOOOO=%X%XXXX%XXXXXXXXX%X=%X% OOOOOO", -"OOOOOOO.=********************** OOOOOO", -"OOOOOOOOO OOOOOO", -"OOOOOOOOO. @OOOOOO", -"OOOOOOOOOOOoOOoOoOoOoOoOoOOoOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *int_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 12 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #303030", -"* c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOO+#.X.##@#OOOOOOOOOOOOOOOOOO", -"OOOOOOOO+##@X#O++.#+#.##OOOOOOOOOOOOOOOO", -"OOOOOO+#Xo++#X#%#+##o#O#.#+OOOOOOOOOOOOO", -"OOOOO.Xo#+#++##+.XX#..+.+..XOOOOOOOOOOOO", -"OOOO++.+O.+O##+#.X###..OX#.+X+OOOOOOOOOO", -"OOOO#+####O#O##o##+###X#+#+.#..OOOOOOOOO", -"OOO.+#o+#+X++++#.#O+#+#X.#+X++X+OOOOOOOO", -"OOO.+.+..X+.##X++#++#..+XX#+#X+..OOOOOOO", -"OOO##....O+#++#+.++#+X+#+#X..+#+#OOOOOOO", -"OOO++#+.+.#+#O+X#X#XX#.++##.#++.X$OOOOOO", -"OOOO#+#+.+++#++.+++##+X###+X+X##+&&OOOOO", -"OOOO#..#OO#+.##o###.+..++.+#X+#+#& @OOOO", -"OOOO.#.#O+#+#O.+++.###+##++###+.# $OOOO", -"OOOOOXX+#+#+#o..X##++#+..##.#+### &OOOO", -"OOOOOOX#.#X+#+#+#+.#+..+####XX%X% OOOO", -"OOOOOOO.%%X.#+#+#.++#+#+#+.%++*+% &OOOO", -"OOOOOOOO@& &##+#+.O####.+XXX%%%#% $OOOO", -"OOOOOOOOOO. %X.+.#+++XXX*.+++#% $OOOO", -"OOOOOOOOOOO@& %%X..#XXX.####%%& $OOOO", -"OOOOOOOOOOOOO@$ &XX%%%*.#X%###*& OOOOO", -"OOOOOOOOOOOOOOOOO+%%%*%%#.+.#*& @OOOOO", -"OOOOOOOOOOOOOOOOOO*%%%*.X##XX& OOOOOO", -"OOOOOOOOOOOOOOOOOOOX%%%%X*%& @OOOOOO", -"OOOOOOOOOOOOOOOOOOOX%%%%% &@OOOOOOO", -"OOOOOOOOOOOOOOOOOOO*%%%X& &$$OOOOOOOOO", -"OOOOOOOOOOOOOOOOOOO+%%%* .OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOO+*%%% OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOO*%%& $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOO+%%& $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOoOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *lawful_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 10 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #606060", -"$ c #FFFFFF", -"% c #303030", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOo$$$$$$oOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOO$$o$$o$$$$$OOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOo$$$$$$$o$$ooOOOOOOOOO", -"OOOOOOOOOOOOOOOOOO$o$$$o$$$$$$$oOOOOOOOO", -"OOOOOOOOOOOOOOOOOo$$$$+ .o$$$$$oOOOOOOOO", -"OOOOOOOOOOOOOOOOOo$$$+%OOOO$o$$$oOOOOOOO", -"OOOOOOOOOOOOOOOOO$$o$X@OOOOo$$$ooOOOOOOO", -"OOOOOOOOOOOOOOOOO$$$$%OOOOOo$$$..OOOOOOO", -"OOOOOOOOOOOOOOOOO$$$$@OOOOo$$oo##OOOOOOO", -"OOOOOOOOOOOOOOOO+$$o$$ooOoo$$$o OOOOOOOO", -"OOOOOOOOOOOOOOOOO$$$$$$$o$$$$o#%OOOOOOOO", -"OOOOOOOOOOOOOOOO+$$o$$o$$$$$o@%OOOOOOOOO", -"OOOOOOOOOOOOOOOOO$$$$$$$$o$o.%OOOOOOOOOO", -"OOOOOOOOOOOOOOOOOo$$$o$$oo@#%OOOOOOOOOOO", -"OOOOOOOOoooooo$$$$$$$$$$$% %OOOOOOOOOOOO", -"OOOOOOO$$$$$$$$$$$$o$$o$$$$$$$oOOOOOOOOO", -"OOOOOO$$$$$$$$$o$$$$$$$$$$$$o$$oOOOOOOOO", -"OOOOOO$$o$ooooo##+o$$+##@oo$$$$$oOOOOOOO", -"OOOOOOo$$#% %#$$$+%##%%#ooo$O#OOOOOOO", -"OOOOOOOo@##OOOOO+$$$##OOOO#%%##%@OOOOOOO", -"OOOOOOOOOOOOOOOOo$$$##OOOOOOO##@OOOOOOOO", -"OOOOOOOOOOOOOOOOo$$o##OOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO$$oo OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO+$$$o OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO$o$##OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo$$$##OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo$$o%@OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo$$o OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO$$oo OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO$$$o OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo$$##OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO$$o##OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo$# @OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO.#@OOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *mod_enc_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 13 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #303030", -"= c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOo&&&&&&&&&oXOOOOOOOOOOOOOOO", -"OOOOOOOOOOOO+&=========X%@OOOOOOOOOOOOOO", -"OOOOOOOOOOOOO&=====X====% @OOOOOOOOOOOOO", -"OOOOOOOOOOOOoO==X=======X* OOOOOOOOOOOOO", -"OOOOOOOOOOOO&====*%*%*===* $OOOOOOOOOOOO", -"OOOOOOOOOOO+&===X ===% *OOOOOOOOOOOO", -"OOOOOOOOOOOoO===**=======X* OOOOOOOOOOOO", -"OOOOOOOOOOO&===% %=======X% $OOOOOOOOOOO", -"OOOOOOOOOOO&===% %*%%=====% *OOOOOOOOOOO", -"OOOOOOOOOOoO===* ====X* OOOOOOOOOOO", -"OOOOOOOOOO&=========* X===X% $OOOOOOOOOO", -"OOOOOOOOO+&=========% *====% *OOOOOOOOOO", -"OOOOOOOOOoO===% %=== %====%* OOOOOOOOOO", -"OOOOOOOOO&====* *==X===% $OOOOOOOOO", -"OOOOOOOOO&======*%*%X=======% *OOOOOOOOO", -"OOOOOOOOOo==X===============% OOOOOOOOO", -"OOOOOOOOO=XXXXXXXXXX%X%X%X%%% $OOOOOOOO", -"OOOOOOOOOO=%**************** $OOOOOOOO", -"OOOOOOOOOOO$ $OOOOOOOO", -"OOOOOOOOOOOO* *OOOOOOOOO", -"OOOOOOOOOOOOOoOOoOoOoOoOoOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *neutral_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 14 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #00B6FF", -"= c #303030", -"- c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOO.------.OOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOO-+O&o.-----OOOOOOOOOO", -"OOOOOOOOOOOOOOOOOO+-&o--------.OOOOOOOOO", -"OOOOOOOOOOOOOOOOOO-oo----------+OOOOOOOO", -"OOOOOOOOOOOOOOOOO+-&--% #-------OOOOOOOO", -"OOOOOOOOOOOOOOOOO-OO-X=OOO.-----+OOOOOOO", -"OOOOOOOOOOOOOOOOO-oO-%#OOOO.-----OOOOOOO", -"OOOOOOOOOOOOOOOOO--O-=OOOOO+---X#OOOOOOO", -"OOOOOOOOOOOOOOOOO-oO-XOOOO+OO--=$OOOOOOO", -"OOOOOOOOOOOOOOOOO-OO--++OO-&--- OOOOOOOO", -"OOOOOOOOOOOOOOOOO-OO-----+oo--%=OOOOOOOO", -"OOOOOOOOOOOOOOOOO--O--+o&&o--%=OOOOOOOOO", -"OOOOOOOOOOOOOOOOO-oo*-------%=OOOOOOOOOO", -"OOOOOOOOOOOOOOOOO-oO------%%=OOOOOOOOOOO", -"OOOOOOOO+.+-+.---O&------= =OOOOOOOOOOOO", -"OOOOOO+-oo&&&&&&&&------------.OOOOOOOOO", -"OOOOOO---------------X-----O&Oo-OOOOOOOO", -"OOOOOO---------%=%---%%=%----OO-.OOOOOOO", -"OOOOOO---== =%---%=%%===----%XOOOOOOO", -"OOOOOOO-#$%OOOOOO-+-%$OOOO%===%=@OOOOOOO", -"OOOOOOOOOOOOOOOO.-&-=%OOOOOOO%%#OOOOOOOO", -"OOOOOOOOOOOOOOOo-O+-%$OOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO-oO- OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO-OO- OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO-&-%%OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO-&-%$OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO-&-=$OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO--o-%$OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO+-&- .OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO-Oo- OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO-OO- OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO-oO- OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO-OO%%OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO-o-%$OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO---%$OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO--% #OOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOX$@OOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *ovr_enc_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 13 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #303030", -"= c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOoO+=+OOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOo=#===+OOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo=.OO@X=OOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo#OO* #X @OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO+=.XX+=#* @OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO+=O=.=OO $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOO#.=+OO@ $OOOOOOOOOOOOOO", -"OOOOOOOOOooooooooo&O.#+#XooooOOOOOOOOOOO", -"OOOOOOOOO&OOoOoOoOOOOOOOOOoO%@OOOOOOOOOO", -"OOOOOOOOoO==================X*@OOOOOOOOO", -"OOOOOOOO&===================X% @OOOOOOOO", -"OOOOOOOO&==%*%*%*%*%*%*%*%*==% *OOOOOOOO", -"OOOOOOOoO==%*%%*%%*%%*%*%*%==X* OOOOOOOO", -"OOOOOOO&======================* $OOOOOOO", -"OOOOOO+&=== ===% *OOOOOOO", -"OOOOOOoO======================X* OOOOOOO", -"OOOOOO&=======================X% $OOOOOO", -"OOOOOOo========================% *OOOOOO", -"OOOOOoO===*%X=====%%======%%===X* OOOOOO", -"OOOOO&==% %==% *==== %==* $OOOOO", -"OOOOO&== *==**== **% *=X% %%* ==% *OOOOO", -"OOOOoO==%%==* =* ===% == %=== %=X* OOOOO", -"OOOO&=======% =**===% %X %X==* =X% $OOOO", -"OOOO&======% %= %==== %% ====* ==% *OOOO", -"OOOoO=====% *== *==== %* ====% ==X* OOOO", -"OOO&====XX *===**===% X% X=== *===* $OOO", -"OO+&====X *====* ===% == *=== %===% *OOO", -"OOoO===% %*%*== *** %==% %** ====X* OOO", -"OO&====% ==X *====* %====X% $OO", -"OO&================================% *OO", -"OOo===X============================% OO", -"OO=XXXXXXXXXXXX%XXXX%X%X%XXXXX%X%X%% $O", -"OOO=%****************************** $O", -"OOOO$ $O", -"OOOOO* *OO", -"OOOOOOOOOOoOOoOOoOOoOOoOOoOOoOOoOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *pet_mark_xpm[] = { -/* width height ncolors chars_per_pixel */ -"8 7 2 1", -/* colors */ -". c None", -" c #FF0000", -/* pixels */ -"........", -".. . .", -". ", -". ", -".. .", -"... ..", -".... ..." -}; -/* XPM */ -static const char *pet_mark_small_xpm[] = { -/* width height ncolors chars_per_pixel */ -"5 5 2 1", -/* colors */ -". c None", -"X c #FF0000", -/* pixels */ -".X.X.", -"XXXXX", -".XXX.", -"..X.." -}; -/* XPM */ -static const char *pile_mark_xpm[] = { -/* width height ncolors chars_per_pixel */ -"5 5 2 1", -/* colors */ -". c None", -"X c #00FF00", -/* pixels */ -"..X..", -"..X..", -"XXXXX", -"..X..", -"..X.." -}; -/* XPM */ -static const char *satiated_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 23 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #F8B090", -"o c #5C7A7A", -"O c #D4D4D4", -"+ c #F87A24", -"@ c #7C3400", -"# c None", -"$ c #B0B0B0", -"% c #F89E6C", -"& c #914700", -"* c #B64700", -"= c #909090", -"- c #788C8C", -"; c #606060", -": c #406868", -"> c #FFFFFF", -", c #CEAA90", -"< c #DADAB6", -"1 c #303030", -"2 c #FFB691", -"3 c #6C91B6", -"4 c #F88C48", -/* pixels */ -"########################################", -"########################################", -"########################################", -"########################################", -"########################################", -"########################################", -"########################################", -"################<<<<<<<<################", -"##############<<<<<<<<<<$#$$$###########", -"############<<<<<<<<<<$:31:3:###########", -"###########<<<<<<%42<<#:3:133-##########", -"##########<<<<<%<<;;=o$131:33;##########", -"#########<<<<<<,1 ::31:33;,#########", -"########<<<<<<, =<<<<.13:133;<=########", -"########<<<%2, 1<<<<<<#333:33;<,=#######", -"#######<<<3-=<33;<<@o######", -"#######O<<<<<,#<<<<<<<<.3:<3-;<, =######", -"########<<<<2<<<<<<<<<>#31<33o<11#######", -"########O<<<<44<>O>>>>>#3:<3.;- =#######", -"##########<<<4<<<<><><<$3:<331 ;<#######", -"##########<<<<<<<%2<<<<$3:<33 1#########", -"###########O,<<<<<<<<<<#31<331##########", -"#############.<<<<<<<<<$3:133;##########", -"##############=;=,<<<<,o 1;;=##########", -"###############<=;1 1;=##############", -"#################<# c #B64700", -", c #909090", -"< c #788C8C", -"1 c #606060", -"2 c #406868", -"3 c #FFFFFF", -"4 c #CEAA90", -"5 c #DADAB6", -"6 c #303030", -"7 c #F86800", -"8 c #FFB691", -"9 c #6C91B6", -"0 c #F88C48", -"q c #0000FF", -/* pixels */ -"****************************************", -"*************#333333333#****************", -"***********##33333#333333#**************", -"**********#33333#33333#33*==************", -"*********#33##33-;-3#3333399************", -"********#33#33#3-@ 33333#33=.***********", -"********#3*#33-;;;;;-33333#99***********", -"*******#3*3333-;;;;@ 33#333#9=**********", -"*******#333#33#3-;-33#*##33399**********", -"******#3#3333333-@-#333#9933*9=*********", -"******#333#33#3333333#333*9999=*********", -"******#333333333#3#33333333*999*********", -"******#3#33#33333333#33#3333#9=*********", -"******#333334>&&:&&>::44,3#33#9*********", -"******#33*::&41OOO6:4O 0::4433=*********", -"******#3:>,0:O0O1O+O:OXO,O+2+OOo4<+1104:>:#*********", -"******.&:1OOO,14X2O48:O80,440:,*********", -"******4::>OOO%8-X4O4%O,84+O0X&>=********", -"******.::>,O 99*X+<$,+.o*1O4&0:*********", -"******>:0&4O5qq9#10OO3qq9,+X:1:*********", -"****=>,,::,O4qq9X+O>O-qq9O2X0,>*********", -"******4:>OOOO48882OOOO+4OOO07*4*********", -"******4*,4OO+OXX3O5************", -"*********=0%,OO,>:>>O +1OO4*************", -"**********=%+OO:::1:::6+:7**************", -"***********7&OO:O+O,O1OO+1**************", -"***********40OO,O4:OOO11O<5*************", -"**********=4 +O1O2+O2+O0O***************", -"************72O+1+21-OOO%5**************", -"************0%1OOOO+O+174***************", -"*************%%O,OO1407-=***************", -"**************-$>%0%:74*****************", -"****************54044*=*****************", -"*****************=*=********************" -}; -/* XPM */ -static const char *sick_il_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 23 1", -/* colors */ -" c #F85848", -". c #949E9E", -"X c #F8B090", -"o c #E00028", -"O c #D4D4D4", -"+ c #F87A24", -"@ c #7C3400", -"# c None", -"$ c #B0B0B0", -"% c #F89E6C", -"& c #FF0000", -"* c #914700", -"= c #B64700", -"- c #909090", -"; c #606060", -": c #FFFFFF", -"> c #CEAA90", -", c #DADAB6", -"< c #F86800", -"1 c #FFB691", -"2 c #6C91B6", -"3 c #F88C48", -"4 c #0000FF", -/* pixels */ -"########################################", -"#############O:::::::::O################", -"###########OO:::::O::::::O##############", -"##########O:::::O:::::O::#$$############", -"#########O::OO::%&%:O:::::22############", -"########O::O::O:%o :::::O::$.###########", -"########O:#O::%&&&&&%:::::O22###########", -"#######O:#::::%&&&&o ::O:::O2$##########", -"#######O:::O::O:%&%::O#OO:::22##########", -"######O:O:::::::%o%O:::O22::#2$#########", -"######O:::O::O:::::::O:::#2222$#########", -"######O:::::::::O:O::::::::#222#########", -"######O:O::O::::::::O::O::::O2$#########", -"######O:::::>=@@=**=**>>-:O::O2#########", -"######O::#**@3>%* ;=>=3;<@>>::$#########", -"######O:** >=>XXXX1X >>+>%*%*;O#########", -"######O3@*,X%XXXXXXX>X%XX >*=*O#########", -"######.@@3XXXXXXXXXXXXXXX>X>3*-#########", -"######>***>X% >XXXXX3XXXXXX%>*=>########", -"######.***> 22#XXX<%X22#XXX@+;#########", -"######=*3@X>O442OXX==%XX11111O1+%X111XX%<#>#########", -"######.,;XXXXXX1O1X%3XXXXX%+3###########", -"########3=XXXXXX:XXXXXXXXX+<>$##########", -"########>+XXXXXX%-3->XXXX%+<############", -"#########%3XXXXXX>- -%XXX%<%$###########", -"#########$############", -"##########+%XXXXXXXXXXXX%+<#############", -"##########%3XXX>=****3XX%<%#############", -"##########>+XXX**=3-*@3>3+##############", -"###########<%XX >XX%X;%X3+##############", -"###########%3XX>XX++XXXX<%$#############", -"##########$>+XXXXXXXXXXX<###############", -"############<%XXXXXXXXX3+###############", -"###########$%+XXXXXXXX%<>###############", -"#############++XXXXXX%<%$###############", -"#############$%<<3333<%#################", -"#################%3>>$##################", -"#################$#$####################" -}; -/* XPM */ -static const char *slt_enc_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 13 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #FFFFFF", -"* c #303030", -"= c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOO&&&&&&&X @OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOo======X*OOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOoO======X**OOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOO&====X===% $OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOoo==%* %==%* OOOOOOOOOOOOOO", -"OOOOOOOOOOOOOoO=% % =X* @OOOOOOOOOOOOO", -"OOOOOOOOOOOOO&==**==% %=% $OOOOOOOOOOOOO", -"OOOOOOOOOOOOoo==%%==* %=X OOOOOOOOOOOOO", -"OOOOOOOOOOOOoO=====* X==X* @OOOOOOOOOOOO", -"OOOOOOOOOOOO&=====* %====% $OOOOOOOOOOOO", -"OOOOOOOOOOOoo==== X=====%* OOOOOOOOOOOO", -"OOOOOOOOOOOo+===* *%*%%==X* @OOOOOOOOOOO", -"OOOOOOOOOOO&==== %===% $OOOOOOOOOOO", -"OOOOOOOOOOO&==============% OOOOOOOOOOO", -"OOOOOOOOOOO==============X% @OOOOOOOOOO", -"OOOOOOOOOOO+%%%%%%%%%%%%%% $OOOOOOOOOO", -"OOOOOOOOOOOOO% $OOOOOOOOOO", -"OOOOOOOOOOOOO@ @OOOOOOOOOO", -"OOOOOOOOOOOOOO@$$$$$$$$$$$$$@OOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" -}; -/* XPM */ -static const char *str_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 17 1", -/* colors */ -" c #000000", -". c #F8B090", -"X c #5C7A7A", -"o c #F87A24", -"O c #7C3400", -"+ c None", -"@ c #B0B0B0", -"# c #F89E6C", -"$ c #B64700", -"% c #909090", -"& c #606060", -"* c #CEAA90", -"= c #DADAB6", -"- c #303030", -"; c #F86800", -": c #FFB691", -"> c #F88C48", -/* pixels */ -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++", -"+++++++++++++++++++*>*>#++++++++++++++++", -"++++++++++++++++*#o>..*#o*++++++++++++++", -"+++++++++++++++o#.#>.....o++++++++++++++", -"+++++++++++++++;>;#.o.>..#$X++++++++++++", -"+++++++++++++++o#>.o.>:...o %++++++++++", -"++++++++++++++o##>>#o##>..#O -++++++++++", -"++++++++++++++>#.oo#>..>...O ++++++++++", -"++++++++++++++*o##.>>;o#...o ++++++++++", -"+++++++++++++++*;o#........>- &+++++++++", -"+++++++++++++++++#>>;o......O -+++++++++", -"+++++++++++++++++@+@+o>.....$ +++++++++", -"+++++++++++++++++++++*;.#...>- %++++++++", -"++++++++++++++++++++++;>o....$ &++++++++", -"++++++++++++++++++++++#>>....>- %+++++++", -"+++++++++++++++++++++++;#>....; -+++++++", -"+++++++++++++++++++++++o#>....>O %++++++", -"+++++++++++++++++++++++*>o.....; -++++++", -"+++++++++++++#>**+++++++;#.....>O %+++++", -"+o#+++++++*o;>>>>o#+++++o##.....; -+++++", -"+:#o*++++oo#..*..*>;*+++#>#.....>O %++++", -"+:=#o#+*;>.:==:....#;*++@o.......; &++++", -"+::..>;o#.=::::......o*++;.......>O ++++", -"+.....#o.:.=:.........o#+;........$ ++++", -"+......#o..:...........#o;>.......o &+++", -"+........#..............*>o......:o- +++", -"+..................#o>#...#o.......O +++", -"+...............>o>#.......#>......O &++", -"+..................................o -++", -"+..................................> ++", -"+..................................> ++", -"+.................................#$ &+", -"+................................>$ &+", -"+..#>$o>#..............#>;>>>oOOO- ++", -"+...#O OOOOO$>>>>>>>$OO %++", -"+...o -&&++++", -"+..#O -&&%++++++++++", -"++++++++++++++++++++++++++++++++++++++++" -}; -/* XPM */ -static const char *stunned_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 12 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c #D4D4D4", -"O c None", -"+ c #B0B0B0", -"@ c #909090", -"# c #788C8C", -"$ c #606060", -"% c #406868", -"& c #303030", -"* c #6C91B6", -/* pixels */ -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", -"OOOOOOOOOOOO&$OOOO@OOO@@OO@OOOOOOOOOOOOO", -"OOOOOOOOOOO@& $OO@&&$$@ O@$$OOOOOOOOOOOO", -"OOOOOOOOOOOO$$ @@@$ &&OOO@$OOOOOOOOOOOO", -"OOOOOOOOOOOOO@@&$$$$&O$OO$O &@O@OOOOOOOO", -"OOOOOO@@@@@@OO@$$O$&$@@OO& &&$O&OOOOOOO", -"OOOOOO&&&& & $ &&@$ &O@$& &&&$ & $OOOOOO", -"OOOOOO$&OO &&&$ $$ $& $$&$&&&OOOOOOO", -"OOOOOO@@O@$ &+ # &O$$ $$&O@OOOOO", -"OOOOOOOO@X%$ %& %% & && $$@@@@OOOO", -"OOOOOOO+$$@+ &%%%&%& & &@OOO&&OOO", -"OOOOOO.Xo%+ &&%%%%%&& & OO@$&&OOO", -"OOOOO++ $$&&$ && %&%%& &O@&$&OOOO", -"OOOOO####$ X&&& && &%& & &&OOOO", -"OOOO++#.+## $&# %& & & &$ OOOO", -"OOOO#+++.@&%&& &#&%& & $ @OOOOOO", -"OOOO##....#+$#@%#& $%$&@&$$% & X##$@OOOO", -"OOOO.+#+.+@#+#+$&$X#%&%.+& %&#++.$&OOOOO", -"OOOOO#+#+.+++#$$%&++&X+X#&#+&+&##+ &OOOO", -"OOOOO#..#OO#+@%#o##X.@..++.+$&+#+#& @OOO", -"OOOOO+#.#O+#+#O@++@$$##+##++###+.#& $OOO", -"OOOOOOXX+#+#+#o.@%&$++#+..##.#+### &OOO", -"OOOOOOOX#.#X+#+#+##&#+..+####%XX%% OOO", -"OOOOOOOO+%%X.#+#+#.++#+#+#+.X++*.% &OOO", -"OOOOOOOOO@& &##+#+.O####.+XX%%%%#% $OOO", -"OOOOOOOOOOO. %X.+.#+++XXX*.+++#X $OOO", -"OOOOOOOOOOOO@& %%X..#X%#.####%X& $OOO", -"OOOOOOOOOOOOOO@$ &XX%%%*.#X%###*& OOOO", -"OOOOOOOOOOOOOOOOOO+%%%*%%#.+.#*& @OOOO", -"OOOOOOOOOOOOOOOOOOO*%%%**X##X%& OOOOO", -"OOOOOOOOOOOOOOOOOOOOX%%%%X*X& @OOOOO", -"OOOOOOOOOOOOOOOOOOOOX%%%%X &@OOOOOO", -"OOOOOOOOOOOOOOOOOOOO*%%%X& &$$OOOOOOOO", -"OOOOOOOOOOOOOOOOOOOO+X%%* @OOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOOX%%& OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOO", -"OOOOOOOOOOOOOOOOOOOOO.X%& $OOOOOOOOOOOOO" -}; -/* XPM */ -static const char *wis_xpm[] = { -/* width height ncolors chars_per_pixel */ -"40 40 13 1", -/* colors */ -" c #000000", -". c #949E9E", -"X c #5C7A7A", -"o c None", -"O c #B0B0B0", -"+ c #909090", -"@ c #788C8C", -"# c #606060", -"$ c #406868", -"% c #FFFFFF", -"& c #303030", -"* c #6C91B6", -"= c #0000FF", -/* pixels */ -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooo+#& &#oooooooooooooooooooo", -"oooooooooooo+& #oooooooooooooooooo", -"ooooooooooo+ &====&& &ooooooooooooooooo", -"oooooooooo+ &==& ===%& +ooooooooooooooo", -"ooooooooo+&%=== ===%%o&&oooooooooooooo", -"oooooooo.&%%===& ===%o& #+ooooooooooo", -"oooo&###&&%%*=======$#&ooo#& #+oooooooo", -"ooooo###o+&X$=====& #oo##oooo+######oooo", -"oooooooooooo######@oo##ooooooooooooooooo", -"oooooooooooooOoOoOo##ooooooooooooooooooo", -"ooooooooooooooooo+#+ooo+&#oooooooooooooo", -"ooooooooooooooooooooooo#oooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooooooooooo" -}; -/* clang-format on */ diff --git a/include/qtext.h b/include/qtext.h deleted file mode 100644 index 752938423..000000000 --- a/include/qtext.h +++ /dev/null @@ -1,118 +0,0 @@ -/* NetHack 3.6 qtext.h $NHDT-Date: 1505170347 2017/09/11 22:52:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.18 $ */ -/* Copyright (c) Mike Stephenson 1991. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef QTEXT_H -#define QTEXT_H - -#define N_HDR 16 /* Maximum number of categories */ -/* (i.e., num roles + 1) */ -#define LEN_HDR 3 /* Maximum length of a category name */ - -struct qtmsg { - int msgnum; - char delivery; - long offset, size, summary_size; -}; - -#ifdef MAKEDEFS_C /***** MAKEDEFS *****/ - -#define N_MSG 100 /* arbitrary */ - -struct msghdr { - int n_msg; - struct qtmsg qt_msg[N_MSG]; -}; - -struct qthdr { - int n_hdr; - char id[N_HDR][LEN_HDR]; - long offset[N_HDR]; -}; - -/* Error message macros */ -#define CREC_IN_MSG "Control record encountered during message - line %d\n" -#define DUP_MSG "Duplicate message number at line %d\n" -#define END_NOT_IN_MSG "End record encountered before message - line %d\n" -#define TEXT_NOT_IN_MSG "Text encountered outside message - line %d\n" -#define UNREC_CREC "Unrecognized Control record at line %d\n" -#define MAL_SUM "Malformed summary in End record - line %d\n" -#define DUMB_SUM "Summary for single line message is useless - line %d\n" -#define CTRL_TRUNC "Control record truncated at line %d\n" -#define TEXT_TRUNC "Text record truncated at line %d\n" -#define OUT_OF_HEADERS \ - "Too many message types (line %d)\nAdjust N_HDR in qtext.h and " \ - "recompile.\n" -#define OUT_OF_MESSAGES \ - "Too many messages in class (line %d)\nAdjust N_MSG in qtext.h and " \ - "recompile.\n" - -#else /***** !MAKEDEFS *****/ - -struct qtlists { - struct qtmsg *common, -#if 0 /* UNUSED but available */ - *chrace, -#endif - *chrole; -}; - -/* - * Quest message defines. Used in quest.c to trigger off "realistic" - * dialogue to the player. - */ -#define QT_FIRSTTIME 1 -#define QT_NEXTTIME 2 -#define QT_OTHERTIME 3 - -#define QT_GUARDTALK 5 /* 5 random things guards say before quest */ -#define QT_GUARDTALK2 10 /* 5 random things guards say after quest */ - -#define QT_FIRSTLEADER 15 -#define QT_NEXTLEADER 16 -#define QT_OTHERLEADER 17 -#define QT_LASTLEADER 18 -#define QT_BADLEVEL 19 -#define QT_BADALIGN 20 -#define QT_ASSIGNQUEST 21 - -#define QT_ENCOURAGE 25 /* 1-10 random encouragement messages */ - -#define QT_FIRSTLOCATE 35 -#define QT_NEXTLOCATE 36 - -#define QT_FIRSTGOAL 40 -#define QT_NEXTGOAL 41 -#define QT_ALTGOAL 42 /* alternate to QT_NEXTGOAL if artifact is absent */ - -#define QT_FIRSTNEMESIS 50 -#define QT_NEXTNEMESIS 51 -#define QT_OTHERNEMESIS 52 -#define QT_NEMWANTSIT 53 /* you somehow got the artifact */ - -#define QT_DISCOURAGE 60 /* 1-10 random maledictive messages */ - -#define QT_GOTIT 70 - -#define QT_KILLEDNEM 80 -#define QT_OFFEREDIT 81 -#define QT_OFFEREDIT2 82 - -#define QT_POSTHANKS 90 -#define QT_HASAMULET 91 - -/* - * Message defines for common text used in maledictions. - */ -#define COMMON_ID "-" /* Common message id value */ - -#define QT_ANGELIC 10 -#define QTN_ANGELIC 10 - -#define QT_DEMONIC 30 -#define QTN_DEMONIC 20 - -#define QT_BANISHED 60 -#endif /***** !MAKEDEFS *****/ - -#endif /* QTEXT_H */ diff --git a/include/qttableview.h b/include/qttableview.h deleted file mode 100644 index 3fc9ce56f..000000000 --- a/include/qttableview.h +++ /dev/null @@ -1,293 +0,0 @@ -/********************************************************************** -** $NHDT-Date: 1524683840 2018/04/25 19:17:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.5 $ -** $Id: qttableview.h,v 1.2 2002/03/09 03:13:13 jwalz Exp $ -** -** Definition of QtTableView class -** -** Created : 941115 -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file contains a class moved out of the Qt GUI Toolkit API. It -** may be used, distributed and modified without limitation. -** -**********************************************************************/ - -#ifndef QTTABLEVIEW_H -#define QTTABLEVIEW_H - -#ifndef QT_H -#include -#endif // QT_H - -#ifndef QT_NO_QTTABLEVIEW - -class QScrollBar; -class QCornerSquare; - -class QtTableView : public QFrame -{ - Q_OBJECT - public: - virtual void setBackgroundColor(const QColor &); - virtual void setPalette(const QPalette &); - void show(); - - void repaint(bool erase = TRUE); - void repaint(int x, int y, int w, int h, bool erase = TRUE); - void repaint(const QRect &, bool erase = TRUE); - - protected: - QtTableView(QWidget *parent = 0, const char *name = 0, WFlags f = 0); - ~QtTableView(); - - int numRows() const; - virtual void setNumRows(int); - int numCols() const; - virtual void setNumCols(int); - - int topCell() const; - virtual void setTopCell(int row); - int leftCell() const; - virtual void setLeftCell(int col); - virtual void setTopLeftCell(int row, int col); - - int xOffset() const; - virtual void setXOffset(int); - int yOffset() const; - virtual void setYOffset(int); - virtual void setOffset(int x, int y, bool updateScrBars = TRUE); - - virtual int cellWidth(int col); - virtual int cellHeight(int row); - int cellWidth() const; - int cellHeight() const; - virtual void setCellWidth(int); - virtual void setCellHeight(int); - - virtual int totalWidth(); - virtual int totalHeight(); - - uint tableFlags() const; - bool testTableFlags(uint f) const; - virtual void setTableFlags(uint f); - void clearTableFlags(uint f = ~0); - - bool autoUpdate() const; - virtual void setAutoUpdate(bool); - - void updateCell(int row, int column, bool erase = TRUE); - - QRect cellUpdateRect() const; - QRect viewRect() const; - - int lastRowVisible() const; - int lastColVisible() const; - - bool rowIsVisible(int row) const; - bool colIsVisible(int col) const; - - QScrollBar *verticalScrollBar() const; - QScrollBar *horizontalScrollBar() const; - - private slots: - void horSbValue(int); - void horSbSliding(int); - void horSbSlidingDone(); - void verSbValue(int); - void verSbSliding(int); - void verSbSlidingDone(); - - protected: - virtual void paintCell(QPainter *, int row, int col) = 0; - virtual void setupPainter(QPainter *); - - void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); - - int findRow(int yPos) const; - int findCol(int xPos) const; - - bool rowYPos(int row, int *yPos) const; - bool colXPos(int col, int *xPos) const; - - int maxXOffset(); - int maxYOffset(); - int maxColOffset(); - int maxRowOffset(); - - int minViewX() const; - int minViewY() const; - int maxViewX() const; - int maxViewY() const; - int viewWidth() const; - int viewHeight() const; - - void scroll(int xPixels, int yPixels); - void updateScrollBars(); - void updateTableSize(); - - private: - void coverCornerSquare(bool); - void snapToGrid(bool horizontal, bool vertical); - virtual void setHorScrollBar(bool on, bool update = TRUE); - virtual void setVerScrollBar(bool on, bool update = TRUE); - void updateView(); - int findRawRow(int yPos, int *cellMaxY, int *cellMinY = 0, - bool goOutsideView = FALSE) const; - int findRawCol(int xPos, int *cellMaxX, int *cellMinX = 0, - bool goOutsideView = FALSE) const; - int maxColsVisible() const; - - void updateScrollBars(uint); - void updateFrameSize(); - - void doAutoScrollBars(); - void showOrHideScrollBars(); - - int nRows; - int nCols; - int xOffs, yOffs; - int xCellOffs, yCellOffs; - short xCellDelta, yCellDelta; - short cellH, cellW; - - uint eraseInPaint : 1; - uint verSliding : 1; - uint verSnappingOff : 1; - uint horSliding : 1; - uint horSnappingOff : 1; - uint coveringCornerSquare : 1; - uint sbDirty : 8; - uint inSbUpdate : 1; - - uint tFlags; - QRect cellUpdateR; - - QScrollBar *vScrollBar; - QScrollBar *hScrollBar; - QCornerSquare *cornerSquare; - - private: // Disabled copy constructor and operator= -#if defined(Q_DISABLE_COPY) - QtTableView(const QtTableView &); - QtTableView &operator=(const QtTableView &); -#endif -}; - -const uint Tbl_vScrollBar = 0x00000001; -const uint Tbl_hScrollBar = 0x00000002; -const uint Tbl_autoVScrollBar = 0x00000004; -const uint Tbl_autoHScrollBar = 0x00000008; -const uint Tbl_autoScrollBars = 0x0000000C; - -const uint Tbl_clipCellPainting = 0x00000100; -const uint Tbl_cutCellsV = 0x00000200; -const uint Tbl_cutCellsH = 0x00000400; -const uint Tbl_cutCells = 0x00000600; - -const uint Tbl_scrollLastHCell = 0x00000800; -const uint Tbl_scrollLastVCell = 0x00001000; -const uint Tbl_scrollLastCell = 0x00001800; - -const uint Tbl_smoothHScrolling = 0x00002000; -const uint Tbl_smoothVScrolling = 0x00004000; -const uint Tbl_smoothScrolling = 0x00006000; - -const uint Tbl_snapToHGrid = 0x00008000; -const uint Tbl_snapToVGrid = 0x00010000; -const uint Tbl_snapToGrid = 0x00018000; - -inline int -QtTableView::numRows() const -{ - return nRows; -} - -inline int -QtTableView::numCols() const -{ - return nCols; -} - -inline int -QtTableView::topCell() const -{ - return yCellOffs; -} - -inline int -QtTableView::leftCell() const -{ - return xCellOffs; -} - -inline int -QtTableView::xOffset() const -{ - return xOffs; -} - -inline int -QtTableView::yOffset() const -{ - return yOffs; -} - -inline int -QtTableView::cellHeight() const -{ - return cellH; -} - -inline int -QtTableView::cellWidth() const -{ - return cellW; -} - -inline uint -QtTableView::tableFlags() const -{ - return tFlags; -} - -inline bool -QtTableView::testTableFlags(uint f) const -{ - return (tFlags & f) != 0; -} - -inline QRect -QtTableView::cellUpdateRect() const -{ - return cellUpdateR; -} - -inline bool -QtTableView::autoUpdate() const -{ - return isUpdatesEnabled(); -} - -inline void -QtTableView::repaint(bool erase) -{ - repaint(0, 0, width(), height(), erase); -} - -inline void -QtTableView::repaint(const QRect &r, bool erase) -{ - repaint(r.x(), r.y(), r.width(), r.height(), erase); -} - -inline void -QtTableView::updateScrollBars() -{ - updateScrollBars(0); -} - -#endif // QT_NO_QTTABLEVIEW - -#endif // QTTABLEVIEW_H diff --git a/include/system.h b/include/system.h deleted file mode 100644 index a2cb51f40..000000000 --- a/include/system.h +++ /dev/null @@ -1,571 +0,0 @@ -/* NetHack 3.6 system.h $NHDT-Date: 1550268586 2019/02/15 22:09:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Robert Patrick Rankin, 2017. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef SYSTEM_H -#define SYSTEM_H - -#if !defined(__cplusplus) && !defined(__GO32__) - -#define E extern - -/* some old may not define off_t and size_t; if your system is - * one of these, define them by hand below - */ -#if (defined(VMS) && !defined(__GNUC__)) || defined(MAC) -#include -#else -#ifndef AMIGA -#include -#endif -#endif - -#if (defined(MICRO) && !defined(TOS)) || defined(ANCIENT_VAXC) -#if !defined(_SIZE_T) && !defined(__size_t) /* __size_t for CSet/2 */ -#define _SIZE_T -#if !((defined(MSDOS) || defined(OS2)) \ - && defined(_SIZE_T_DEFINED)) /* MSC 5.1 */ -#if !(defined(__GNUC__) && defined(AMIGA)) -typedef unsigned int size_t; -#endif -#endif -#endif -#endif /* MICRO && !TOS */ - -#if defined(__TURBOC__) || defined(MAC) -#include /* time_t is not in */ -#endif -#if defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC)) -/* The Ultrix v3.0 seems to be very wrong. */ -#define time_t long -#endif - -#if defined(ULTRIX) || defined(VMS) -#define off_t long -#endif -#if defined(AZTEC) || defined(THINKC4) || defined(__TURBOC__) -typedef long off_t; -#endif - -#endif /* !__cplusplus && !__GO32__ */ - -/* You may want to change this to fit your system, as this is almost - * impossible to get right automatically. - * This is the type of signal handling functions. - */ -#if !defined(OS2) && (defined(_MSC_VER) || defined(__TURBOC__) \ - || defined(__SC__) || defined(WIN32)) -#define SIG_RET_TYPE void(__cdecl *)(int) -#endif -#ifndef SIG_RET_TYPE -#if defined(NHSTDC) || defined(POSIX_TYPES) || defined(OS2) || defined(__DECC) -#define SIG_RET_TYPE void (*)() -#endif -#endif -#ifndef SIG_RET_TYPE -#if defined(ULTRIX) || defined(SUNOS4) || defined(SVR3) || defined(SVR4) -/* SVR3 is defined automatically by some systems */ -#define SIG_RET_TYPE void (*)() -#endif -#endif -#ifndef SIG_RET_TYPE /* BSD, SIII, SVR2 and earlier, Sun3.5 and earlier */ -#define SIG_RET_TYPE int (*)() -#endif - -#if !defined(__cplusplus) && !defined(__GO32__) - -#if defined(BSD) || defined(ULTRIX) || defined(RANDOM) -#ifdef random -#undef random -#endif -#if !defined(__SC__) && !defined(LINUX) -E long NDECL(random); -#endif -#if (!defined(SUNOS4) && !defined(bsdi) && !defined(__FreeBSD__)) \ - || defined(RANDOM) -E void FDECL(srandom, (unsigned int)); -#else -#if !defined(bsdi) && !defined(__FreeBSD__) -E int FDECL(srandom, (unsigned int)); -#endif -#endif -#else -#if defined(MACOSX) -E long NDECL(lrand48); -E void FDECL(srand48, (long)); -#else -E long lrand48(); -E void srand48(); -#endif /* MACOSX */ -#endif /* BSD || ULTRIX || RANDOM */ - -#if !defined(BSD) || defined(ultrix) -/* real BSD wants all these to return int */ -#ifndef MICRO -E void FDECL(exit, (int)); -#endif /* MICRO */ -/* compensate for some CSet/2 bogosities */ -#if defined(OS2_CSET2) && defined(OS2_CSET2_VER_2) -#define open _open -#define close _close -#define read _read -#define write _write -#define lseek _lseek -#define chdir _chdir -#define getcwd _getcwd -#define setmode _setmode -#endif /* OS2_CSET2 && OS2_CSET2_VER_2 */ - /* If flex thinks that we're not __STDC__ it declares free() to return - int and we die. We must use __STDC__ instead of NHSTDC because - the former is naturally what flex tests for. */ -#if defined(__STDC__) || !defined(FLEX_SCANNER) -#ifndef OS2_CSET2 -#ifndef MONITOR_HEAP -E void FDECL(free, (genericptr_t)); -#endif -#endif -#endif -#if !defined(__SASC_60) && !defined(_DCC) && !defined(__SC__) -#if defined(AMIGA) && !defined(AZTEC_50) && !defined(__GNUC__) -E int FDECL(perror, (const char *)); -#else -#if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) -E void FDECL(perror, (const char *)); -#endif -#endif -#endif -#endif -#ifndef NeXT -#ifdef POSIX_TYPES -E void FDECL(qsort, (genericptr_t, size_t, size_t, - int (*)(const genericptr, const genericptr))); -#else -#if defined(BSD) || defined(ULTRIX) -E int qsort(); -#else -#if !defined(LATTICE) && !defined(AZTEC_50) -E void FDECL(qsort, (genericptr_t, size_t, size_t, - int (*)(const genericptr, const genericptr))); -#endif -#endif -#endif -#endif /* NeXT */ - -#ifndef __SASC_60 -#if !defined(AZTEC_50) && !defined(__GNUC__) -/* may already be defined */ - -#ifdef ULTRIX -#ifdef ULTRIX_PROTO -E int FDECL(lseek, (int, off_t, int)); -#else -E long FDECL(lseek, (int, off_t, int)); -#endif -/* Ultrix 3.0 man page mistakenly says it returns an int. */ -E int FDECL(write, (int, char *, int)); -E int FDECL(link, (const char *, const char *)); -#else /*!ULTRIX*/ -#if !(defined(bsdi) || defined(VMS)) -E long FDECL(lseek, (int, long, int)); -#if defined(POSIX_TYPES) || defined(__TURBOC__) -E int FDECL(write, (int, const void *, unsigned)); -#else -#ifndef __MWERKS__ /* metrowerks defines write via universal headers */ -E int FDECL(write, (int, genericptr_t, unsigned)); -#endif -#endif /*?(POSIX_TYPES || __TURBOC__)*/ -#endif /*!(bsdi || VMS)*/ -#endif /*?ULTRIX*/ - -#ifdef OS2_CSET2 /* IBM CSet/2 */ -#ifdef OS2_CSET2_VER_1 -E int FDECL(unlink, (char *)); -#else -E int FDECL(unlink, (const char *)); /* prototype is ok in ver >= 2 */ -#endif -#else -#ifndef __SC__ -E int FDECL(unlink, (const char *)); -#endif -#endif - -#endif /* AZTEC_50 && __GNUC__ */ - -#ifdef MAC -#ifndef __CONDITIONALMACROS__ /* universal headers */ -E int FDECL(close, (int)); /* unistd.h */ -E int FDECL(read, (int, char *, int)); /* unistd.h */ -E int FDECL(chdir, (const char *)); /* unistd.h */ -E char *FDECL(getcwd, (char *, int)); /* unistd.h */ -#endif - -E int FDECL(open, (const char *, int)); -#endif - -#if defined(MICRO) -E int FDECL(close, (int)); -#ifndef __EMX__ -E int FDECL(read, (int, genericptr_t, unsigned int)); -#endif -E int FDECL(open, (const char *, int, ...)); -E int FDECL(dup2, (int, int)); -E int FDECL(setmode, (int, int)); -E int NDECL(kbhit); -#if !defined(_DCC) -#if defined(__TURBOC__) -E int FDECL(chdir, (const char *)); -#else -#ifndef __EMX__ -E int FDECL(chdir, (char *)); -#endif -#endif -#ifndef __EMX__ -E char *FDECL(getcwd, (char *, int)); -#endif -#endif /* !_DCC */ -#endif - -#ifdef ULTRIX -E int FDECL(close, (int)); -E int FDECL(atoi, (const char *)); -E long FDECL(atol, (const char *)); -E int FDECL(chdir, (const char *)); -#if !defined(ULTRIX_CC20) && !defined(__GNUC__) -E int FDECL(chmod, (const char *, int)); -E mode_t FDECL(umask, (int)); -#endif -E int FDECL(read, (int, genericptr_t, unsigned)); -/* these aren't quite right, but this saves including lots of system files */ -E int FDECL(stty, (int, genericptr_t)); -E int FDECL(gtty, (int, genericptr_t)); -E int FDECL(ioctl, (int, int, char *)); -E int FDECL(isatty, (int)); /* 1==yes, 0==no, -1==error */ -#include -#if defined(ULTRIX_PROTO) || defined(__GNUC__) -E int NDECL(fork); -#else -E long NDECL(fork); -#endif -#endif /* ULTRIX */ - -#ifdef VMS -#ifndef abs -E int FDECL(abs, (int)); -#endif -E int FDECL(atexit, (void (*)(void))); -E int FDECL(atoi, (const char *)); -E long FDECL(atol, (const char *)); -E int FDECL(chdir, (const char *)); -E int FDECL(chown, (const char *, unsigned, unsigned)); -#ifdef __DECC_VER -E int FDECL(chmod, (const char *, mode_t)); -E mode_t FDECL(umask, (mode_t)); -#else -E int FDECL(chmod, (const char *, int)); -E int FDECL(umask, (int)); -#endif -/* #include */ -E int FDECL(close, (int)); -E int VDECL(creat, (const char *, unsigned, ...)); -E int FDECL(delete, (const char *)); -E int FDECL(fstat, (/*_ int, stat_t * _*/)); -E int FDECL(isatty, (int)); /* 1==yes, 0==no, -1==error */ -E off_t FDECL(lseek, (int, off_t, int)); -E int VDECL(open, (const char *, int, unsigned, ...)); -E int FDECL(read, (int, genericptr_t, unsigned)); -E int FDECL(rename, (const char *, const char *)); -E int FDECL(stat, (/*_ const char *,stat_t * _*/)); -E int FDECL(write, (int, const genericptr, unsigned)); -#endif - -#endif /* __SASC_60 */ - -/* both old & new versions of Ultrix want these, but real BSD does not */ -#ifdef ultrix -E void abort(); -E void bcopy(); -#ifdef ULTRIX -E int FDECL(system, (const char *)); -#ifndef _UNISTD_H_ -E int FDECL(execl, (const char *, ...)); -#endif -#endif -#endif -#ifdef MICRO -E void NDECL(abort); -E void FDECL(_exit, (int)); -E int FDECL(system, (const char *)); -#endif -#if defined(HPUX) && !defined(_POSIX_SOURCE) -E long NDECL(fork); -#endif - -#ifdef POSIX_TYPES -/* The POSIX string.h is required to define all the mem* and str* functions */ -#include -#else -#if defined(SYSV) || defined(VMS) || defined(MAC) || defined(SUNOS4) -#if defined(NHSTDC) || (defined(VMS) && !defined(ANCIENT_VAXC)) -#if !defined(_AIX32) && !(defined(SUNOS4) && defined(__STDC__)) -/* Solaris unbundled cc (acc) */ -E int FDECL(memcmp, (const void *, const void *, size_t)); -E void *FDECL(memcpy, (void *, const void *, size_t)); -E void *FDECL(memset, (void *, int, size_t)); -#endif -#else -#ifndef memcmp /* some systems seem to macro these back to b*() */ -E int memcmp(); -#endif -#ifndef memcpy -E char *memcpy(); -#endif -#ifndef memset -E char *memset(); -#endif -#endif -#else -#ifdef HPUX -E int FDECL(memcmp, (char *, char *, int)); -E void *FDECL(memcpy, (char *, char *, int)); -E void *FDECL(memset, (char *, int, int)); -#endif -#endif -#endif /* POSIX_TYPES */ - -#if defined(MICRO) && !defined(LATTICE) -#if defined(TOS) && defined(__GNUC__) -E int FDECL(memcmp, (const void *, const void *, size_t)); -E void *FDECL(memcpy, (void *, const void *, size_t)); -E void *FDECL(memset, (void *, int, size_t)); -#else -#if defined(AZTEC_50) || defined(NHSTDC) || defined(WIN32) -E int FDECL(memcmp, (const void *, const void *, size_t)); -E void *FDECL(memcpy, (void *, const void *, size_t)); -E void *FDECL(memset, (void *, int, size_t)); -#else -E int FDECL(memcmp, (char *, char *, unsigned int)); -E char *FDECL(memcpy, (char *, char *, unsigned int)); -E char *FDECL(memset, (char *, int, int)); -#endif /* AZTEC_50 || NHSTDC */ -#endif /* TOS */ -#endif /* MICRO */ - -#if defined(BSD) && defined(ultrix) /* i.e., old versions of Ultrix */ -E void sleep(); -#endif -#if defined(ULTRIX) || defined(SYSV) -E unsigned sleep(); -#endif -#if defined(HPUX) -E unsigned int FDECL(sleep, (unsigned int)); -#endif -#ifdef VMS -E int FDECL(sleep, (unsigned)); -#endif - -E char *FDECL(getenv, (const char *)); -E char *getlogin(); -#if defined(HPUX) && !defined(_POSIX_SOURCE) -E long NDECL(getuid); -E long NDECL(getgid); -E long NDECL(getpid); -#else -#ifdef POSIX_TYPES -E pid_t NDECL(getpid); -E uid_t NDECL(getuid); -E gid_t NDECL(getgid); -#ifdef VMS -E pid_t NDECL(getppid); -#endif -#else /*!POSIX_TYPES*/ -#ifndef getpid /* Borland C defines getpid() as a macro */ -E int NDECL(getpid); -#endif -#ifdef VMS -E int NDECL(getppid); -E unsigned NDECL(getuid); -E unsigned NDECL(getgid); -#endif -#if defined(ULTRIX) && !defined(_UNISTD_H_) -E unsigned NDECL(getuid); -E unsigned NDECL(getgid); -E int FDECL(setgid, (int)); -E int FDECL(setuid, (int)); -#endif -#endif /*?POSIX_TYPES*/ -#endif /*?(HPUX && !_POSIX_SOURCE)*/ - -/* add more architectures as needed */ -#if defined(HPUX) -#define seteuid(x) setreuid(-1, (x)); -#endif - -/*# string(s).h #*/ -#if !defined(_XtIntrinsic_h) && !defined(POSIX_TYPES) -/* #includes ; so does defining POSIX_TYPES */ - -#if (defined(ULTRIX) || defined(NeXT)) && defined(__GNUC__) -#include -#else -E char *FDECL(strcpy, (char *, const char *)); -E char *FDECL(strncpy, (char *, const char *, size_t)); -E char *FDECL(strcat, (char *, const char *)); -E char *FDECL(strncat, (char *, const char *, size_t)); -E char *FDECL(strpbrk, (const char *, const char *)); - -#if defined(SYSV) || defined(MICRO) || defined(MAC) || defined(VMS) \ - || defined(HPUX) -E char *FDECL(strchr, (const char *, int)); -E char *FDECL(strrchr, (const char *, int)); -#else /* BSD */ -E char *FDECL(index, (const char *, int)); -E char *FDECL(rindex, (const char *, int)); -#endif - -E int FDECL(strcmp, (const char *, const char *)); -E int FDECL(strncmp, (const char *, const char *, size_t)); -#if defined(MICRO) || defined(MAC) || defined(VMS) -E size_t FDECL(strlen, (const char *)); -#else -#ifdef HPUX -E unsigned int FDECL(strlen, (char *)); -#else -#if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) -E int FDECL(strlen, (const char *)); -#endif -#endif /* HPUX */ -#endif /* MICRO */ -#endif /* ULTRIX */ - -#endif /* !_XtIntrinsic_h_ && !POSIX_TYPES */ - -#if defined(ULTRIX) && defined(__GNUC__) -E char *FDECL(index, (const char *, int)); -E char *FDECL(rindex, (const char *, int)); -#endif - -/* Old varieties of BSD have char *sprintf(). - * Newer varieties of BSD have int sprintf() but allow for the old char *. - * Several varieties of SYSV and PC systems also have int sprintf(). - * If your system doesn't agree with this breakdown, you may want to change - * this declaration, especially if your machine treats the types differently. - * If your system defines sprintf, et al, in stdio.h, add to the initial - * #if. - */ -#if defined(ULTRIX) || defined(__DECC) || defined(__SASC_60) || defined(WIN32) -#define SPRINTF_PROTO -#endif -#if (defined(SUNOS4) && defined(__STDC__)) || defined(_AIX32) -#define SPRINTF_PROTO -#endif -#if defined(TOS) || defined(AZTEC_50) || defined(__sgi) || defined(__GNUC__) -/* problem with prototype mismatches */ -#define SPRINTF_PROTO -#endif -#if defined(__MWERKS__) || defined(__SC__) -/* Metrowerks already has a prototype for sprintf() */ -#define SPRINTF_PROTO -#endif - -#ifndef SPRINTF_PROTO -#if defined(POSIX_TYPES) || defined(DGUX) || defined(NeXT) || !defined(BSD) -E int FDECL(sprintf, (char *, const char *, ...)); -#else -#define OLD_SPRINTF -E char *sprintf(); -#endif -#endif -#ifdef SPRINTF_PROTO -#undef SPRINTF_PROTO -#endif - -#ifndef __SASC_60 -#ifdef NEED_VARARGS -#if defined(USE_STDARG) || defined(USE_VARARGS) -#if !defined(SVR4) && !defined(apollo) -#if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) -#if !(defined(SUNOS4) && defined(__STDC__)) /* Solaris unbundled cc (acc) */ -E int FDECL(vsprintf, (char *, const char *, va_list)); -E int FDECL(vfprintf, (FILE *, const char *, va_list)); -E int FDECL(vprintf, (const char *, va_list)); -#endif -#endif -#endif -#else -#ifdef vprintf -#undef vprintf -#endif -#define vprintf printf -#ifdef vfprintf -#undef vfprintf -#endif -#define vfprintf fprintf -#ifdef vsprintf -#undef vsprintf -#endif -#define vsprintf sprintf -#endif -#endif /* NEED_VARARGS */ -#endif - -#ifdef MICRO -E int FDECL(tgetent, (const char *, const char *)); -E void FDECL(tputs, (const char *, int, int (*)())); -E int FDECL(tgetnum, (const char *)); -E int FDECL(tgetflag, (const char *)); -E char *FDECL(tgetstr, (const char *, char **)); -E char *FDECL(tgoto, (const char *, int, int)); -#else -#if !(defined(HPUX) && defined(_POSIX_SOURCE)) -E int FDECL(tgetent, (char *, const char *)); -E void FDECL(tputs, (const char *, int, int (*)())); -#endif -E int FDECL(tgetnum, (const char *)); -E int FDECL(tgetflag, (const char *)); -E char *FDECL(tgetstr, (const char *, char **)); -E char *FDECL(tgoto, (const char *, int, int)); -#endif - -#if defined(ALLOC_C) || defined(MAKEDEFS_C) -E genericptr_t FDECL(malloc, (size_t)); -E genericptr_t FDECL(realloc, (genericptr_t, size_t)); -#endif - -/* time functions */ - -#ifndef LATTICE -#if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) -E struct tm *FDECL(localtime, (const time_t *)); -#endif -#endif - -#if defined(ULTRIX) || (defined(BSD) && defined(POSIX_TYPES)) \ - || defined(SYSV) || defined(MICRO) || defined(VMS) || defined(MAC) \ - || (defined(HPUX) && defined(_POSIX_SOURCE)) -E time_t FDECL(time, (time_t *)); -#else -E long FDECL(time, (time_t *)); -#endif /* ULTRIX */ - -#ifdef VMS -/* used in makedefs.c, but missing from gcc-vms's */ -E char *FDECL(ctime, (const time_t *)); -#endif - -#ifdef MICRO -#ifdef abs -#undef abs -#endif -E int FDECL(abs, (int)); -#ifdef atoi -#undef atoi -#endif -E int FDECL(atoi, (const char *)); -#endif - -#undef E - -#endif /* !__cplusplus && !__GO32__ */ - -#endif /* SYSTEM_H */ diff --git a/include/trampoli.h b/include/trampoli.h deleted file mode 100644 index 865da44c1..000000000 --- a/include/trampoli.h +++ /dev/null @@ -1,288 +0,0 @@ -/* NetHack 3.6 trampoli.h $NHDT-Date: 1433806581 2015/06/08 23:36:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */ -/* Copyright (c) 1989, by Norm Meluch and Stephen Spackman */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef TRAMPOLI_H -#define TRAMPOLI_H - -#ifdef USE_TRAMPOLI - -/* ### apply.c ### */ -#define dig() dig_() -#define doapply() doapply_() -#define dojump() dojump_() -#define dorub() dorub_() - -/* ### artifact.c ### */ -#define doinvoke() doinvoke_() - -/* ### cmd.c ### */ -#define doextcmd() doextcmd_() -#define doextlist() doextlist_() -#define domonability() domonability_() -#define enter_explore_mode() enter_explore_mode_() -#define doprev_message() doprev_message_() -#define timed_occupation() timed_occupation_() -#define wiz_attributes() wiz_attributes_() -#define wiz_detect() wiz_detect_() -#define wiz_genesis() wiz_genesis_() -#define wiz_identify() wiz_identify_() -#define wiz_level_tele() wiz_level_tele_() -#define wiz_map() wiz_map_() -#define wiz_where() wiz_where_() -#define wiz_wish() wiz_wish_() - -/* ### display.c ### */ -#define doredraw() doredraw_() - -/* ### do.c ### */ -#define doddrop() doddrop_() -#define dodown() dodown_() -#define dodrop() dodrop_() -#define donull() donull_() -#define doup() doup_() -#define dowipe() dowipe_() -#define drop(x) drop_(x) -#define wipeoff() wipeoff_() - -/* ### do_name.c ### */ -#define ddocall() ddocall_() -#define do_mname() do_mname_() - -/* ### do_wear.c ### */ -#define Armor_off() Armor_off_() -#define Boots_off() Boots_off_() -#define Gloves_off() Gloves_off_() -#define Helmet_off() Helmet_off_() -#define Armor_on() Armor_on_() -#define Boots_on() Boots_on_() -#define Gloves_on() Gloves_on_() -#define Helmet_on() Helmet_on_() -#define doddoremarm() doddoremarm_() -#define doputon() doputon_() -#define doremring() doremring_() -#define dotakeoff() dotakeoff_() -#define dowear() dowear_() -#define select_off(x) select_off_(x) -#define take_off() take_off_() - -/* ### dogmove.c ### */ -#define wantdoor(x, y, dummy) wantdoor_(x, y, dummy) - -/* ### dokick.c ### */ -#define dokick() dokick_() - -/* ### dothrow.c ### */ -#define dothrow() dothrow_() - -/* ### eat.c ### */ -#define Hear_again() Hear_again_() -#define eatmdone() eatmdone_() -#define doeat() doeat_() -#define eatfood() eatfood_() -#define opentin() opentin_() -#define unfaint() unfaint_() - -/* ### end.c ### */ -#define done1(sig) done1_(sig) -#define done2() done2_() -#define done_intr(sig) done_intr_(sig) -#if defined(UNIX) || defined(VMS) || defined(__EMX__) -#define done_hangup(sig) done_hangup_(sig) -#endif - -/* ### engrave.c ### */ -#define doengrave() doengrave_() - -/* ### fountain.c ### */ -#define gush(x, y, poolcnt) gush_(x, y, poolcnt) - -/* ### hack.c ### */ -#define dopickup() dopickup_() -#define identify(x) identify_(x) - -/* ### invent.c ### */ -#define ckunpaid(x) ckunpaid_(x) -#define ddoinv() ddoinv_() -#define dolook() dolook_() -#define dopramulet() dopramulet_() -#define doprarm() doprarm_() -#define doprgold() doprgold_() -#define doprring() doprring_() -#define doprtool() doprtool_() -#define doprwep() doprwep_() -#define dotypeinv() dotypeinv_() -#define doorganize() doorganize_() - -/* ### ioctl.c ### */ -#ifdef UNIX -#ifdef SUSPEND -#define dosuspend() dosuspend_() -#endif /* SUSPEND */ -#endif /* UNIX */ - -/* ### lock.c ### */ -#define doclose() doclose_() -#define doforce() doforce_() -#define doopen() doopen_() -#define forcelock() forcelock_() -#define picklock() picklock_() - -/* ### mklev.c ### */ -#define do_comp(x, y) comp_(x, y) - -/* ### mondata.c ### */ -/* See comment in trampoli.c before uncommenting canseemon. */ -/* #define canseemon(x) canseemon_(x) */ - -/* ### muse.c ### */ -#define mbhitm(x, y) mbhitm_(x, y) - -/* ### o_init.c ### */ -#define dodiscovered() dodiscovered_() - -/* ### objnam.c ### */ -#define doname(x) doname_(x) -#define xname(x) xname_(x) - -/* ### options.c ### */ -#define doset() doset_() -#define dotogglepickup() dotogglepickup_() - -/* ### pager.c ### */ -#define dohelp() dohelp_() -#define dohistory() dohistory_() -#ifdef UNIX -#define intruph() intruph_() -#endif /* UNIX */ -#define dowhatdoes() dowhatdoes_() -#define dowhatis() dowhatis_() -#define doquickwhatis() doquickwhatis_() - -/* ### pcsys.c ### */ -#ifdef SHELL -#define dosh() dosh_() -#endif /* SHELL */ - -/* ### pickup.c ### */ -#define ck_bag(x) ck_bag_(x) -#define doloot() doloot_() -#define in_container(x) in_container_(x) -#define out_container(x) out_container_(x) - -/* ### potion.c ### */ -#define dodrink() dodrink_() -#define dodip() dodip_() - -/* ### pray.c ### */ -#define doturn() doturn_() -#define dopray() dopray_() -#define prayer_done() prayer_done_() -#define dosacrifice() dosacrifice_() - -/* ### read.c ### */ -#define doread() doread_() -#define set_lit(x, y, val) set_lit_(x, y, val) - -/* ### rip.c ### */ -#define genl_outrip(tmpwin, how) genl_outrip_(tmpwin, how) - -/* ### save.c ### */ -#define dosave() dosave_() -#if defined(UNIX) || defined(VMS) || defined(__EMX__) -#define hangup(sig) hangup_(sig) -#endif - -/* ### search.c ### */ -#define doidtrap() doidtrap_() -#define dosearch() dosearch_() -#define findone(zx, zy, num) findone_(zx, zy, num) -#define openone(zx, zy, num) openone_(zx, zy, num) - -/* ### shk.c ### */ -#define dopay() dopay_() - -/* ### sit.c ### */ -#define dosit() dosit_() - -/* ### sounds.c ### */ -#define dotalk() dotalk_() - -/* ### spell.c ### */ -#define learn() learn_() -#define docast() docast_() -#define dovspell() dovspell_() - -/* ### steal.c ### */ -#define stealarm() stealarm_() - -/* ### trap.c ### */ -#define dotele() dotele_() -#define dountrap() dountrap_() -#define float_down() float_down_() - -/* ### version.c ### */ -#define doversion() doversion_() -#define doextversion() doextversion_() - -/* ### wield.c ### */ -#define dowield() dowield_() - -/* ### zap.c ### */ -#define bhitm(x, y) bhitm_(x, y) -#define bhito(x, y) bhito_(x, y) -#define dozap() dozap_() - -/* ### getline.c ### */ -#define tty_getlin(x, y) tty_getlin_(x, y) -#define tty_get_ext_cmd() tty_get_ext_cmd_() - -/* ### termcap.c ### */ -#define tty_nhbell() tty_nhbell_() -#define tty_number_pad(x) tty_number_pad_(x) -#define tty_delay_output() tty_delay_output_() -#define tty_start_screen() tty_start_screen_() -#define tty_end_screen() tty_end_screen_() - -/* ### topl.c ### */ -#define tty_doprev_message() tty_doprev_message_() -#define tty_yn_function(x, y, z) tty_yn_function_(x, y, z) - -/* ### wintty.c ### */ -#define tty_init_nhwindows(x, y) tty_init_nhwindows_(x, y) -#define tty_player_selection() tty_player_selection_() -#define tty_askname() tty_askname_() -#define tty_get_nh_event() tty_get_nh_event_() -#define tty_exit_nhwindows(x) tty_exit_nhwindows_(x) -#define tty_suspend_nhwindows(x) tty_suspend_nhwindows_(x) -#define tty_resume_nhwindows() tty_resume_nhwindows_() -#define tty_create_nhwindow(x) tty_create_nhwindow_(x) -#define tty_clear_nhwindow(x) tty_clear_nhwindow_(x) -#define tty_display_nhwindow(x, y) tty_display_nhwindow_(x, y) -#define tty_destroy_nhwindow(x) tty_destroy_nhwindow_(x) -#define tty_curs(x, y, z) tty_curs_(x, y, z) -#define tty_putstr(x, y, z) tty_putstr_(x, y, z) -#define tty_display_file(x, y) tty_display_file_(x, y) -#define tty_start_menu(x) tty_start_menu_(x) -#define tty_add_menu(a, b, c, d, e, f, g, h) \ - tty_add_menu_(a, b, c, d, e, f, g, h) -#define tty_end_menu(a, b) tty_end_menu_(a, b) -#define tty_select_menu(a, b, c) tty_select_menu_(a, b, c) -#define tty_update_inventory() tty_update_inventory_() -#define tty_mark_synch() tty_mark_synch_() -#define tty_wait_synch() tty_wait_synch_() -#ifdef CLIPPING -#define tty_cliparound(x, y) tty_cliparound_(x, y) -#endif -#ifdef POSITIONBAR -#define tty_update_positionbar(x) tty_update_positionbar_(x) -#endif -#define tty_print_glyph(a, b, c, d, e) tty_print_glyph_(a, b, c, d, e) -#define tty_raw_print(x) tty_raw_print_(x) -#define tty_raw_print_bold(x) tty_raw_print_bold_(x) -#define tty_nhgetch() tty_nhgetch_() -#define tty_nh_poskey(x, y, z) tty_nh_poskey_(x, y, z) - -#endif /* USE_TRAMPOLI */ - -#endif /* TRAMPOLI_H */ diff --git a/include/wceconf.h b/include/wceconf.h deleted file mode 100644 index dcc7b6f95..000000000 --- a/include/wceconf.h +++ /dev/null @@ -1,349 +0,0 @@ -/* NetHack 3.6 wceconf.h $NHDT-Date: 1432512776 2015/05/25 00:12:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */ -/* Copyright (C) 2001 by Alex Kompel */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef WCECONF_H -#define WCECONF_H - -#pragma warning(disable : 4142) /* benign redefinition of type */ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include - -/* Detect the target device */ -#if defined(WIN32_PLATFORM_PSPC) -#if _WIN32_WCE >= 300 -#define WIN_CE_POCKETPC -#else -#define WIN_CE_PS2xx -#endif -#elif defined(WIN32_PLATFORM_HPCPRO) -#define WIN_CE_HPCPRO -#elif defined(WIN32_PLATFORM_WFSP) -#define WIN_CE_SMARTPHONE -#else -#error "Unsupported Windows CE platform" -#endif - -/* #define SHELL /* nt use of pcsys routines caused a hang */ - -#define RANDOM /* have Berkeley random(3) */ -#define TEXTCOLOR /* Color text */ - -#define EXEPATH /* Allow .exe location to be used as HACKDIR */ -#define TRADITIONAL_GLYPHMAP /* Store glyph mappings at level change time */ - -#define PC_LOCKING /* Prevent overwrites of aborted or in-progress games */ -/* without first receiving confirmation. */ - -#define SELF_RECOVER /* Allow the game itself to recover from an aborted \ - game */ - -#define NOTSTDC /* no strerror() */ - -#define USER_SOUNDS - -/* - * ----------------------------------------------------------------- - * The remaining code shouldn't need modification. - * ----------------------------------------------------------------- - */ -/* #define SHORT_FILENAMES /* All NT filesystems support long names now - */ - -#ifdef MICRO -#undef MICRO /* never define this! */ -#endif - -#define NOCWD_ASSUMPTIONS /* Always define this. There are assumptions that \ - it is defined for WIN32. \ - Allow paths to be specified for HACKDIR, \ - LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \ - SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */ -#define NO_TERMS -#define ASCIIGRAPH - -#ifdef OPTIONS_USED -#undef OPTIONS_USED -#endif -#ifdef MSWIN_GRAPHICS -#define OPTIONS_USED "guioptions" -#else -#define OPTIONS_USED "ttyoptions" -#endif -#define OPTIONS_FILE OPTIONS_USED - -#define PORT_HELP "porthelp" - -#define SAFERHANGUP /* Define SAFERHANGUP to delay hangup processing \ - * until the main command loop. 'safer' because it \ - * avoids certain cheats and also avoids losing \ - * objects being thrown when the hangup occurs. \ - */ - -#if defined(WIN_CE_POCKETPC) -#define PORT_CE_PLATFORM "Pocket PC" -#elif defined(WIN_CE_PS2xx) -#define PORT_CE_PLATFORM "Palm-size PC 2.11" -#elif defined(WIN_CE_HPCPRO) -#define PORT_CE_PLATFORM "H/PC Pro 2.11" -#elif defined(WIN_CE_SMARTPHONE) -#define PORT_CE_PLATFORM "Smartphone 2002" -#endif - -#if defined(ARM) -#define PORT_CE_CPU "ARM" -#elif defined(PPC) -#define PORT_CE_CPU "PPC" -#elif defined(ALPHA) -#define PORT_CE_CPU "ALPHA" -#elif defined(SH3) -#define PORT_CE_CPU "SH3" -#elif defined(SH4) -#define PORT_CE_CPU "SH4" -#elif defined(MIPS) -#define PORT_CE_CPU "MIPS" -#elif defined(X86) || defined(_X86_) -#define PORT_CE_CPU "X86" -#else -#error Only ARM, PPC, ALPHA, SH3, SH4, MIPS and X86 supported -#endif - -#define RUNTIME_PORT_ID /* trigger run-time port identification since \ - Makedefs is bootstrapped on a cross-platform. */ - -#include /* Provides prototypes of strncmpi(), etc. */ -#ifdef STRNCMPI -#define strncmpi(a, b, c) _strnicmp(a, b, c) -#endif - -#ifdef STRCMPI -#define strcmpi(a, b) _stricmp(a, b) -#define stricmp(a, b) _stricmp(a, b) -#endif - -#include - -#define PATHLEN BUFSZ /* maximum pathlength */ -#define FILENAME BUFSZ /* maximum filename length (conservative) */ - -#if defined(_MAX_PATH) && defined(_MAX_FNAME) -#if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ) -#undef PATHLEN -#undef FILENAME -#define PATHLEN _MAX_PATH -#define FILENAME _MAX_FNAME -#endif -#endif - -#define NO_SIGNAL -#define index strchr -#define rindex strrchr -#define USE_STDARG - -/* Use the high quality random number routines. */ -#ifndef USE_ISAAC64 -# ifdef RANDOM -# define Rand() random() -# else -# define Rand() rand() -# endif -#endif - -#define FCMASK 0660 /* file creation mask */ -#define regularize nt_regularize -#define HLOCK "NHPERM" - -#ifndef M -#define M(c) ((char) (0x80 | (c))) -/* #define M(c) ((c) - 128) */ -#endif - -#ifndef C -#define C(c) (0x1f & (c)) -#endif - -#if defined(DLB) -#define FILENAME_CMP _stricmp /* case insensitive */ -#endif - -#if 0 -extern char levels[], bones[], permbones[], -#endif /* 0 */ - -/* this was part of the MICRO stuff in the past */ -extern const char *alllevels, *allbones; -extern char hackdir[]; -#define ABORT C('a') -#define getuid() 1 -#define getlogin() ((char *) 0) -extern void NDECL(win32_abort); -#ifdef WIN32CON -extern void FDECL(nttty_preference_update, (const char *)); -extern void NDECL(toggle_mouse_support); -#endif - -#ifndef alloca -#define ALLOCA_HACK /* used in util/panic.c */ -#endif - -#ifdef _MSC_VER -#if 0 -#pragma warning(disable : 4018) /* signed/unsigned mismatch */ -#pragma warning(disable : 4305) /* init, conv from 'const int' to 'char' */ -#endif -#pragma warning(disable : 4761) /* integral size mismatch in arg; conv \ - supp*/ -#ifdef YYPREFIX -#pragma warning(disable : 4102) /* unreferenced label */ -#endif -#endif - -/* UNICODE stuff */ -#define NHSTR_BUFSIZE 255 -#ifdef UNICODE -#define NH_W2A(w, a, cb) \ - (WideCharToMultiByte(CP_ACP, 0, (w), -1, (a), (cb), NULL, NULL), (a)) - -#define NH_A2W(a, w, cb) \ - (MultiByteToWideChar(CP_ACP, 0, (a), -1, (w), (cb)), (w)) -#else -#define NH_W2A(w, a, cb) (strncpy((a), (w), (cb))) - -#define NH_A2W(a, w, cb) (strncpy((w), (a), (cb))) -#endif - -extern int FDECL(set_win32_option, (const char *, const char *)); - -/* - * 3.4.3 addition - Stuff to help the user with some common, yet significant - * errors - * Let's make it NOP for now - */ -#define interject_assistance(_1, _2, _3, _4) -#define interject(_1) - -/* Missing definitions */ -extern int mswin_have_input(); -#define kbhit mswin_have_input - -#define getenv(a) ((char *) NULL) - -/* __stdio.h__ */ -#define perror(a) -#define freopen(a, b, c) fopen(a, b) -extern int isatty(int); - -/* __time.h___ */ -#ifndef _TIME_T_DEFINED -typedef __int64 time_t; /* time value */ -#define _TIME_T_DEFINED /* avoid multiple def's of time_t */ -#endif - -#ifndef _TM_DEFINED -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight savings time flag - - NOT IMPLEMENTED */ -}; -#define _TM_DEFINED -#endif - -extern struct tm *__cdecl localtime(const time_t *); -extern time_t __cdecl time(time_t *); -extern time_t __cdecl mktime(struct tm *tb); - -/* __stdio.h__ */ -#ifndef BUFSIZ -#define BUFSIZ 255 -#endif - -#define rewind(stream) (void) fseek(stream, 0L, SEEK_SET) - -/* __io.h__ */ -typedef long off_t; - -extern int __cdecl close(int); -extern int __cdecl creat(const char *, int); -extern int __cdecl eof(int); -extern long __cdecl lseek(int, long, int); -extern int __cdecl open(const char *, int, ...); -extern int __cdecl read(int, void *, unsigned int); -extern int __cdecl unlink(const char *); -extern int __cdecl write(int, const void *, unsigned int); -extern int __cdecl rename(const char *, const char *); -extern int __cdecl access(const char *, int); - -#ifdef DeleteFile -#undef DeleteFile -#endif -#define DeleteFile(a) unlink(a) - -int chdir(const char *dirname); -extern char *getcwd(char *buffer, int maxlen); - -/* __stdlib.h__ */ -#define abort() (void) TerminateProcess(GetCurrentProcess(), 0) -#ifndef strdup -#define strdup _strdup -#endif - -/* sys/stat.h */ -#define S_IWRITE GENERIC_WRITE -#define S_IREAD GENERIC_READ - -/* CE 2.xx is missing even more stuff */ -#if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO) -#define ZeroMemory(p, s) memset((p), 0, (s)) - -extern int __cdecl isupper(int c); -extern int __cdecl isdigit(int c); -extern int __cdecl isspace(int c); -extern int __cdecl isprint(int c); - -extern char *__cdecl _strdup(const char *s); -extern char *__cdecl strrchr(const char *string, int c); -extern int __cdecl _stricmp(const char *a, const char *b); - -extern FILE *__cdecl fopen(const char *filename, const char *mode); -extern int __cdecl fscanf(FILE *f, const char *format, ...); -extern int __cdecl fprintf(FILE *f, const char *format, ...); -extern int __cdecl vfprintf(FILE *f, const char *format, va_list args); -extern int __cdecl fgetc(FILE *f); -extern char *__cdecl fgets(char *s, int size, FILE *f); -extern int __cdecl printf(const char *format, ...); -extern int __cdecl vprintf(const char *format, va_list args); -extern int __cdecl puts(const char *s); -extern FILE *__cdecl _getstdfilex(int desc); -extern int __cdecl fclose(FILE *f); -extern size_t __cdecl fread(void *p, size_t size, size_t count, FILE *f); -extern size_t __cdecl fwrite(const void *p, size_t size, size_t count, - FILE *f); -extern int __cdecl fflush(FILE *f); -extern int __cdecl feof(FILE *f); -extern int __cdecl fseek(FILE *f, long offset, int from); -extern long __cdecl ftell(FILE *f); - -#endif - -/* ARM - the processor; avoids conflict with ARM in hack.h */ -#ifdef ARM -#undef ARM -#endif - -/* leave - Windows CE defines leave as part of exception handling (__leave) - It conflicts with existing sources and since we don't use exceptions it is - safe - to undefine it */ -#ifdef leave -#undef leave -#endif - -#endif /* WCECONF_H */ diff --git a/include/winGnome.h b/include/winGnome.h deleted file mode 100644 index 0c2483a78..000000000 --- a/include/winGnome.h +++ /dev/null @@ -1,18 +0,0 @@ -/* NetHack 3.6 winGnome.h $NHDT-Date: 1432512782 2015/05/25 00:13:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (C) 1998 by Erik Andersen */ -/* Copyright (C) 1998 by Anthony Taylor */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef WINGNOME_H -#define WINGNOME_H - -#define E extern - -E struct window_procs Gnome_procs; - -#undef E - -#define NHW_WORN 6 -extern winid WIN_WORN; - -#endif /* WINGNOME_H */ diff --git a/include/wingem.h b/include/wingem.h deleted file mode 100644 index 61c7e7c87..000000000 --- a/include/wingem.h +++ /dev/null @@ -1,112 +0,0 @@ -/* NetHack 3.6 wingem.h $NHDT-Date: 1433806582 2015/06/08 23:36:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) Christian Bressler, 1999 */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef WINGEM_H -#define WINGEM_H - -#define E extern - -/* menu structure */ -typedef struct Gmi { - struct Gmi *Gmi_next; - int Gmi_glyph; - long Gmi_identifier; - char Gmi_accelerator, Gmi_groupacc; - int Gmi_attr; - char *Gmi_str; - long Gmi_count; - int Gmi_selected; -} Gem_menu_item; - -#define MAXWIN 20 /* maximum number of windows, cop-out */ - -extern struct window_procs Gem_procs; - -/* ### wingem1.c ### */ -#ifdef CLIPPING -E void NDECL(setclipped); -#endif -E void FDECL(docorner, (int, int)); -E void NDECL(end_glyphout); -E void FDECL(g_putch, (int)); -E void FDECL(win_Gem_init, (int)); -E int NDECL(mar_gem_init); -E char NDECL(mar_ask_class); -E char *NDECL(mar_ask_name); -E int FDECL(mar_create_window, (int)); -E void FDECL(mar_destroy_nhwindow, (int)); -E void FDECL(mar_print_glyph, (int, int, int, int, int)); -E void FDECL(mar_print_line, (int, int, int, char *)); -E void FDECL(mar_set_message, (char *, char *, char *)); -E Gem_menu_item *NDECL(mar_hol_inv); -E void FDECL(mar_set_menu_type, (int)); -E void NDECL(mar_reverse_menu); -E void FDECL(mar_set_menu_title, (const char *)); -E void NDECL(mar_set_accelerators); -E void FDECL(mar_add_menu, (winid, Gem_menu_item *)); -E void FDECL(mar_change_menu_2_text, (winid)); -E void FDECL(mar_add_message, (const char *)); -E void NDECL(mar_status_dirty); -E int FDECL(mar_hol_win_type, (int)); -E void NDECL(mar_clear_messagewin); -E void FDECL(mar_set_no_glyph, (int)); -E void NDECL(mar_map_curs_weiter); - -/* external declarations */ -E void FDECL(Gem_init_nhwindows, (int *, char **)); -E void NDECL(Gem_player_selection); -E void NDECL(Gem_askname); -E void NDECL(Gem_get_nh_event); -E void FDECL(Gem_exit_nhwindows, (const char *)); -E void FDECL(Gem_suspend_nhwindows, (const char *)); -E void NDECL(Gem_resume_nhwindows); -E winid FDECL(Gem_create_nhwindow, (int)); -E void FDECL(Gem_clear_nhwindow, (winid)); -E void FDECL(Gem_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(Gem_dismiss_nhwindow, (winid)); -E void FDECL(Gem_destroy_nhwindow, (winid)); -E void FDECL(Gem_curs, (winid, int, int)); -E void FDECL(Gem_putstr, (winid, int, const char *)); -E void FDECL(Gem_display_file, (const char *, BOOLEAN_P)); -E void FDECL(Gem_start_menu, (winid)); -E void FDECL(Gem_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); -E void FDECL(Gem_end_menu, (winid, const char *)); -E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **)); -E char FDECL(Gem_message_menu, (CHAR_P, int, const char *)); -E void NDECL(Gem_update_inventory); -E void NDECL(Gem_mark_synch); -E void NDECL(Gem_wait_synch); -#ifdef CLIPPING -E void FDECL(Gem_cliparound, (int, int)); -#endif -#ifdef POSITIONBAR -E void FDECL(Gem_update_positionbar, (char *)); -#endif -E void FDECL(Gem_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int)); -E void FDECL(Gem_raw_print, (const char *)); -E void FDECL(Gem_raw_print_bold, (const char *)); -E int NDECL(Gem_nhgetch); -E int FDECL(Gem_nh_poskey, (int *, int *, int *)); -E void NDECL(Gem_nhbell); -E int NDECL(Gem_doprev_message); -E char FDECL(Gem_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(Gem_getlin, (const char *, char *)); -E int NDECL(Gem_get_ext_cmd); -E void FDECL(Gem_number_pad, (int)); -E void NDECL(Gem_delay_output); -#ifdef CHANGE_COLOR -E void FDECL(Gem_change_color, (int color, long rgb, int reverse)); -E char *NDECL(Gem_get_color_string); -#endif - -/* other defs that really should go away (they're tty specific) */ -E void NDECL(Gem_start_screen); -E void NDECL(Gem_end_screen); - -E void FDECL(genl_outrip, (winid, int, time_t)); - -#undef E - -#endif /* WINGEM_H */ From e2922e3277e68f993f3246e918a24cca63570282 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 15:49:18 +0100 Subject: [PATCH 2/9] Copy NetHack 5 header files - unmodified for NLE set --- include/align.h | 55 +- include/amiconf.h | 107 +- include/artifact.h | 83 +- include/artilist.h | 212 ++- include/attrib.h | 14 +- include/botl.h | 283 ++- include/color.h | 34 +- include/config1.h | 36 +- include/context.h | 69 +- include/coord.h | 4 +- include/cstd.h | 68 + include/decl.h | 1621 ++++++++++++----- include/defsym.h | 511 ++++++ include/dgn_file.h | 27 +- include/display.h | 972 +++++++++-- include/dlb.h | 24 +- include/dungeon.h | 179 +- include/engrave.h | 40 +- include/flag.h | 438 +++-- include/fnamesiz.h | 79 + include/func_tab.h | 42 +- include/global.h | 434 +++-- include/hack.h | 1589 ++++++++++++++--- include/hacklib.h | 86 + include/integer.h | 51 +- include/isaac64.h | 7 +- include/lint.h | 45 +- include/mail.h | 2 +- include/mcastu.h | 39 + include/mextra.h | 75 +- include/mfndpos.h | 44 +- include/micro.h | 7 +- include/mkroom.h | 55 +- include/monattk.h | 40 +- include/mondata.h | 94 +- include/monflag.h | 357 ++-- include/monst.h | 137 +- include/monsters.h | 3927 ++++++++++++++++++++++++++++++++++++++++++ include/nhmd4.h | 37 + include/nhregex.h | 17 + include/obj.h | 351 ++-- include/objclass.h | 174 +- include/objects.h | 1659 ++++++++++++++++++ include/optlist.h | 928 ++++++++++ include/patchlevel.h | 126 +- include/pcconf.h | 92 +- include/permonst.h | 74 +- include/prop.h | 84 +- include/quest.h | 8 +- include/rect.h | 8 +- include/region.h | 57 +- include/rm.h | 571 +++--- include/savefile.h | 594 +++++++ include/seffects.h | 216 +++ include/selvar.h | 11 + include/sfmacros.h | 81 + include/sfprocs.h | 202 +++ include/skills.h | 73 +- include/sndprocs.h | 303 ++++ include/sp_lev.h | 458 +---- include/spell.h | 25 +- include/stairs.h | 18 + include/sym.h | 180 ++ include/sys.h | 19 +- include/tile2x11.h | 7 +- include/tileset.h | 24 +- include/timeout.h | 39 +- include/trap.h | 63 +- include/vision.h | 38 +- include/vmsconf.h | 69 +- include/warnings.h | 124 ++ include/weight.h | 34 + include/winX.h | 380 ++-- include/winami.h | 7 +- include/wincurs.h | 96 +- include/windconf.h | 297 ++++ include/winprocs.h | 407 ++--- include/wintype.h | 171 +- include/xwindow.h | 82 +- include/xwindowp.h | 4 +- include/you.h | 305 +++- include/youprop.h | 83 +- 82 files changed, 16696 insertions(+), 3787 deletions(-) create mode 100644 include/cstd.h create mode 100644 include/defsym.h create mode 100644 include/fnamesiz.h create mode 100644 include/hacklib.h create mode 100644 include/mcastu.h create mode 100644 include/monsters.h create mode 100644 include/nhmd4.h create mode 100644 include/nhregex.h create mode 100644 include/objects.h create mode 100644 include/optlist.h create mode 100644 include/savefile.h create mode 100644 include/seffects.h create mode 100644 include/selvar.h create mode 100644 include/sfmacros.h create mode 100644 include/sfprocs.h create mode 100755 include/sndprocs.h create mode 100644 include/stairs.h create mode 100644 include/sym.h create mode 100644 include/warnings.h create mode 100644 include/weight.h create mode 100644 include/windconf.h diff --git a/include/align.h b/include/align.h index 53e7a4b60..9890ae41b 100644 --- a/include/align.h +++ b/include/align.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 align.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Mike Stephenson, Izchak Miller 1991. */ +/* NetHack 5.0 align.h $NHDT-Date: 1604269810 2020/11/01 22:30:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */ +/* Copyright (c) Mike Stephenson, Izchak Miller 1991. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef ALIGN_H @@ -10,10 +10,11 @@ typedef schar aligntyp; /* basic alignment type */ typedef struct align { /* alignment & record */ aligntyp type; int record; + unsigned abuse; } align; /* bounds for "record" -- respect initial alignments of 10 */ -#define ALIGNLIM (10L + (moves / 200L)) +#define ALIGNLIM (10L + (svm.moves / 200L)) #define A_NONE (-128) /* the value range of type */ @@ -24,20 +25,46 @@ typedef struct align { /* alignment & record */ #define A_COALIGNED 1 #define A_OPALIGNED (-1) -#define AM_NONE 0 -#define AM_CHAOTIC 1 -#define AM_NEUTRAL 2 -#define AM_LAWFUL 4 +/* align masks */ +#define AM_NONE 0x00 +#define AM_CHAOTIC 0x01 +#define AM_NEUTRAL 0x02 +#define AM_LAWFUL 0x04 +#define AM_MASK 0x07 /* mask for "normal" alignment values */ -#define AM_MASK 7 +/* Some altars are considered shrines, add a flag for that + for the altarmask field of struct rm. */ +#define AM_SHRINE 0x08 +/* High altar on Astral plane or Moloch's sanctum */ +#define AM_SANCTUM 0x10 -#define AM_SPLEV_CO 3 -#define AM_SPLEV_NONCO 7 +/* special level flags, gone by the time the level has been loaded */ +#define AM_SPLEV_CO 0x20 /* co-aligned: force alignment to match hero's */ +#define AM_SPLEV_NONCO 0x40 /* non-co-aligned: force alignment to not match */ +#define AM_SPLEV_RANDOM 0x80 -#define Amask2align(x) \ - ((aligntyp)((!(x)) ? A_NONE : ((x) == AM_LAWFUL) ? A_LAWFUL \ - : ((int) x) - 2)) +#define Amask2align(x) \ + ((aligntyp) ((((x) & AM_MASK) == 0) ? A_NONE \ + : (((x) & AM_MASK) == AM_LAWFUL) ? A_LAWFUL \ + : ((int) ((x) & AM_MASK)) - 2)) /* 2 => 0, 1 => -1 */ #define Align2amask(x) \ - (((x) == A_NONE) ? AM_NONE : ((x) == A_LAWFUL) ? AM_LAWFUL : (x) + 2) + ((unsigned) (((x) == A_NONE) ? AM_NONE \ + : ((x) == A_LAWFUL) ? AM_LAWFUL \ + : ((x) + 2))) /* -1 => 1, 0 => 2 */ + +/* Because clearly Nethack needs more ways to specify alignment... + Amask2msa(): 1, 2, 4 converted to 1, 2, 3 to fit within a width 2 bitfield; + Msa2amask(): 1, 2, 3 converted back to 1, 2, 4; + For Amask2msa(), 'x' might have the shrine bit set so strip that off. */ +#define Amask2msa(x) ((((x) & AM_MASK) == 4) ? 3 : (x) & AM_MASK) +#define Msa2amask(x) (((x) == 3) ? 4 : (x)) +#define MSA_NONE 0 /* unaligned or multiple alignments */ + +/* alignment change reasons for uchangealign(attrib.c) */ +enum uchangealign_reasons { + A_CG_CONVERT = 0, /* permanently converted */ + A_CG_HELM_ON = 1, /* donned helm of opposite alignment */ + A_CG_HELM_OFF = 2, /* doffed helm of opposite alignment */ +}; #endif /* ALIGN_H */ diff --git a/include/amiconf.h b/include/amiconf.h index 21fe242af..a362c94f8 100644 --- a/include/amiconf.h +++ b/include/amiconf.h @@ -14,6 +14,15 @@ #include /* get time_t defined before use! */ +#ifdef CROSS_TO_AMIGA +#include +#include +#include +#include +#include +#include +#endif + #ifdef __SASC_60 /* since SAS can prevent re-inclusion */ #include /* general things, including builtins */ #include @@ -28,7 +37,6 @@ #ifdef _DCC #include #define _SIZE_T -#define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */ #endif #ifndef __GNUC__ @@ -41,16 +49,18 @@ typedef long off_t; LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \ SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */ +#define PATHLEN 130 + /* data librarian defs */ -#ifndef NOCWD_ASSUMPTIONS -#define DLBFILE "NetHack:nhdat" /* main library */ -#define DLBFILE2 "NetHack:nhsdat" /* sound library */ -#else #define DLBFILE "nhdat" /* main library */ -#define DLBFILE2 "nhsdat" /* sound library */ -#endif +/* nhsdat sound library not used in 5.0 */ +#undef DLBFILE2 +#ifndef CROSS_TO_AMIGA #define FILENAME_CMP stricmp /* case insensitive */ +#else +#define FILENAME_CMP strcmpi /* case insensitive */ +#endif #ifndef __SASC_60 #define O_BINARY 0 @@ -66,38 +76,40 @@ typedef long off_t; #define MFLOPPY /* You'll probably want this; provides assistance \ * for typical personal computer configurations \ */ +#ifndef CROSS_TO_AMIGA #define RANDOM +#endif /* ### amidos.c ### */ -extern void FDECL(nethack_exit, (int)); +extern void nethack_exit(int); /* ### amiwbench.c ### */ -extern void NDECL(ami_wbench_init); -extern void NDECL(ami_wbench_args); -extern int FDECL(ami_wbench_getsave, (int)); -extern void FDECL(ami_wbench_unlink, (char *)); -extern int FDECL(ami_wbench_iconsize, (char *)); -extern void FDECL(ami_wbench_iconwrite, (char *)); -extern int FDECL(ami_wbench_badopt, (const char *)); -extern void NDECL(ami_wbench_cleanup); -extern void FDECL(getlind, (const char *, char *, const char *)); +extern void ami_wbench_init(void); +extern void ami_wbench_args(void); +extern int ami_wbench_getsave(int); +extern void ami_wbench_unlink(char *); +extern int ami_wbench_iconsize(char *); +extern void ami_wbench_iconwrite(char *); +extern int ami_wbench_badopt(const char *); +extern void ami_wbench_cleanup(void); +extern void getlind(const char *, char *, const char *); /* ### winreq.c ### */ extern void amii_setpens(int); -extern void FDECL(exit, (int)); -extern void NDECL(CleanUp); -extern void FDECL(Abort, (long)); -extern int NDECL(getpid); -extern char *FDECL(CopyFile, (const char *, const char *)); -extern int NDECL(kbhit); -extern int NDECL(WindowGetchar); -extern void FDECL(ami_argset, (int *, char *[])); -extern void FDECL(ami_mkargline, (int *, char **[])); -extern void FDECL(ami_wininit_data, (int)); +extern void exit(int); +extern void CleanUp(void); +extern void Abort(long); +extern int getpid(void); +extern char *CopyFile(const char *, const char *); +extern int kbhit(void); +extern int WindowGetchar(void); +extern void ami_argset(int *, char *[]); +extern void ami_mkargline(int *, char **[]); +extern void ami_wininit_data(int); #define FromWBench 0 /* A hint for compiler ... */ /* extern boolean FromWBench; /* how were we run? */ @@ -120,12 +132,10 @@ extern char **ami_argv; #endif #ifdef AZTEC_C -extern FILE *FDECL(freopen, (const char *, const char *, FILE *)); -extern char *FDECL(gets, (char *)); +extern FILE *freopen(const char *, const char *, FILE *); +extern char *gets(char *); #endif -#define msmsg printf - /* * If AZTEC_C we can't use the long cpath in vision.c.... */ @@ -137,9 +147,10 @@ extern char *FDECL(gets, (char *)); * (Possibly) configurable Amiga options: */ -#define TEXTCOLOR /* Use colored monsters and objects */ #define HACKFONT /* Use special hack.font */ -#define SHELL /* Have a shell escape command (!) */ +#ifndef CROSS_TO_AMIGA /* issues with prototype and spawnl */ +#define SHELL /* Have a shell escape command (!) */ +#endif #define MAIL /* Get mail at unexpected occasions */ #define DEFAULT_ICON "NetHack:default.icon" /* private icon */ #define AMIFLUSH /* toss typeahead (select flush in .cnf) */ @@ -152,13 +163,7 @@ extern char *FDECL(gets, (char *)); #endif #define CHANGE_COLOR 1 - -#ifdef TEXTCOLOR #define DEPTH 6 /* Maximum depth of the screen allowed */ -#else -#define DEPTH 2 /* Four colors...sigh... */ -#endif - #define AMII_MAXCOLORS (1L << DEPTH) typedef unsigned short AMII_COLOR_TYPE; @@ -179,7 +184,7 @@ extern int amibbs; /* BBS mode? */ #ifdef AMII_GRAPHICS extern int amii_numcolors; -void FDECL(amii_setpens, (int)); +void amii_setpens(int); #endif /* for cmd.c: override version in micro.h */ @@ -187,5 +192,27 @@ void FDECL(amii_setpens, (int)); #undef M #define M(c) ((c) -128) #endif +struct ami_sysflags { + char sysflagsid[10]; +#ifdef AMIFLUSH + boolean altmeta; /* use ALT keys as META */ + boolean amiflush; /* kill typeahead */ +#endif +#ifdef AMII_GRAPHICS + int numcols; + unsigned short amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */ + AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */ +#endif +#ifdef OPT_DISPMAP + boolean fast_map; /* use optimized, less flexible map display */ +#endif +#ifdef MFLOPPY + boolean asksavedisk; +#endif +}; +extern struct ami_sysflags sysflags; + +#undef SYSCF +#undef SYSCF_FILE #endif /* AMICONF_H */ diff --git a/include/artifact.h b/include/artifact.h index 4e5193f55..fd55ff7a1 100644 --- a/include/artifact.h +++ b/include/artifact.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 artifact.h $NHDT-Date: 1433050871 2015/05/31 05:41:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */ +/* NetHack 5.0 artifact.h $NHDT-Date: 1602692711 2020/10/14 16:25:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,38 +6,39 @@ #ifndef ARTIFACT_H #define ARTIFACT_H -#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */ -#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */ -#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */ -#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */ -#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */ -#define SPFX_SEEK 0x00000010L /* item helps you search for things */ -#define SPFX_WARN 0x00000020L /* item warns you of danger */ -#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */ -#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */ -#define SPFX_DRLI 0x00000100L /* drains a level from monsters */ +#include "permonst.h" +#include "prop.h" + +/* clang-format off */ + +#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */ +#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */ +#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */ +#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */ +#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */ +#define SPFX_SEEK 0x00000010L /* item helps you search for things */ +#define SPFX_WARN 0x00000020L /* item warns you of danger */ +#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */ +#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */ +#define SPFX_DRLI 0x00000100L /* drains a level from monsters */ #define SPFX_SEARCH 0x00000200L /* helps searching */ #define SPFX_BEHEAD 0x00000400L /* beheads monsters */ #define SPFX_HALRES 0x00000800L /* blocks hallucinations */ -#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */ -#define SPFX_STLTH 0x00002000L /* Stealth */ -#define SPFX_REGEN 0x00004000L /* Regeneration */ +#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */ +#define SPFX_STLTH 0x00002000L /* Stealth */ +#define SPFX_REGEN 0x00004000L /* Regeneration */ #define SPFX_EREGEN 0x00008000L /* Energy Regeneration */ #define SPFX_HSPDAM 0x00010000L /* 1/2 spell damage (on player) in combat */ -#define SPFX_HPHDAM \ - 0x00020000L /* 1/2 physical damage (on player) in combat */ -#define SPFX_TCTRL 0x00040000L /* Teleportation Control */ -#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */ -#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */ -#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype \ - */ -#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag \ - */ -#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag \ - */ -#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */ -#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */ -#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */ +#define SPFX_HPHDAM 0x00020000L /* 1/2 physical damage (on player) in combat */ +#define SPFX_TCTRL 0x00040000L /* Teleportation Control */ +#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */ +#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */ +#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype */ +#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag */ +#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag */ +#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */ +#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */ +#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */ #define SPFX_REFLECT 0x04000000L /* Reflection */ #define SPFX_PROTECT 0x08000000L /* Protection */ @@ -52,7 +53,9 @@ struct artifact { aligntyp alignment; /* alignment of bequeathing gods */ short role; /* character role associated with */ short race; /* character race associated with */ - long cost; /* price when sold to hero (default 100 x base cost) */ + schar gen_spe; /* bias to spe when gifted or randomly generated */ + uchar gift_value; /* minimum sacrifice value to be gifted this */ + long cost; /* price when sold to hero (default 100 x base cost) */ char acolor; /* color to use if artifact 'glows' */ }; @@ -66,7 +69,27 @@ enum invoke_prop_types { LEV_TELE, CREATE_PORTAL, ENLIGHTENING, - CREATE_AMMO + CREATE_AMMO, + BANISH, + FLING_POISON, + FIRESTORM, + SNOWSTORM, + BLINDING_RAY +}; + +/* artifact tracking; gift and wish imply found; it also gets set for items + seen on the floor, in containers, and wielded or dropped by monsters */ +struct arti_info { + Bitfield(exists, 1); /* 1 if corresponding artifact has been created */ + Bitfield(found, 1); /* 1 if artifact is known by hero to exist */ + Bitfield(gift, 1); /* 1 iff artifact was created as a prayer reward */ + Bitfield(wish, 1); /* 1 iff artifact was created via wish */ + Bitfield(named, 1); /* 1 iff artifact was made by naming an item */ + Bitfield(viadip, 1); /* 1 iff dipped long sword became Excalibur */ + Bitfield(lvldef, 1); /* 1 iff created by special level definition */ + Bitfield(bones, 1); /* 1 iff came from bones file */ + Bitfield(rndm, 1); /* 1 iff randomly generated */ }; +/* clang-format on */ #endif /* ARTIFACT_H */ diff --git a/include/artilist.h b/include/artilist.h index d1b1ef624..53caaa7c0 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -1,20 +1,34 @@ -/* NetHack 3.6 artilist.h $NHDT-Date: 1564351548 2019/07/28 22:05:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.20 $ */ +/* NetHack 5.0 artilist.h $NHDT-Date: 1710957374 2024/03/20 17:56:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ -#ifdef MAKEDEFS_C +#if defined(MAKEDEFS_C) || defined (MDLIB_C) /* in makedefs.c, all we care about is the list of names */ -#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr) nam +#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ + gs, gv, cost, clr, bn) nam -static const char *artifact_names[] = { -#else -/* in artifact.c, set up the actual artifact list structure */ +static const char *const artifact_names[] = { + +#elif defined(ARTI_ENUM) +#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ + gs, gv, cost, clr, bn) \ + ART_##bn -#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr) \ - { \ - typ, nam, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr \ +#elif defined(DUMP_ARTI_ENUM) +#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ + gs, gv, cost, clr, bn) \ + { ART_##bn, "ART_" #bn } +#else +/* in artifact.c, set up the actual artifact list structure; + color field is for an artifact when it glows, not for the item itself */ + +#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ + gs, gv, cost, clr, bn) \ + { \ + typ, nam, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ + gs, gv, cost, clr \ } /* clang-format off */ @@ -29,33 +43,57 @@ static const char *artifact_names[] = { #define FIRE(a,b) {0,AD_FIRE,a,b} #define ELEC(a,b) {0,AD_ELEC,a,b} /* electrical shock */ #define STUN(a,b) {0,AD_STUN,a,b} /* magical attack */ +#define POIS(a,b) {0,AD_DRST,a,b} /* poison */ /* clang-format on */ -STATIC_OVL NEARDATA struct artifact artilist[] = { -#endif /* MAKEDEFS_C */ +static NEARDATA struct artifact artilist[] = { +#endif /* MAKEDEFS_C || MDLIB_C */ /* Artifact cost rationale: * 1. The more useful the artifact, the better its cost. * 2. Quest artifacts are highly valued. * 3. Chaotic artifacts are inflated due to scarcity (and balance). + * + * Artifact gen_spe rationale: + * 1. If the artifact is useful against most enemies, +0. + * 2. If the artifact is useful against only a few enemies, usually +2. + * This gives the artifact use to early-game characters who receive + * it as a gift or find it on the ground. + * 3. Role gift gen_spe is chosen to balance against the role's + * default starting weapon (it should be better, but need not be + * much better). + * 4. This can be modified as required for special cases. + * (In some cases, like Excalibur, the value is irrelevant.) + * 5. Nonweapon spe may have a special meaning, so gen_spe for + * nonweapons must always be 0. + * + * Artifact gift_value is chosen so that "endgame-quality" artifacts are + * not gifted in the early game (so that characters don't grind on an + * altar early-game until they have their endgame weapon, then use it to + * carry them through the game). Those artifacts have values ranging from + * around 8 to 10, based on how good the artifact is. Less powerful + * artifacts have values in the 1 to 5 range. Values in between are used + * for conditionally good artifacts. (Note that the value of a gift is + * normally 1 higher than the difficulty of the monster.) */ /* dummy element #0, so that all interesting indices are non-zero */ A("", STRANGE_OBJECT, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, - NON_PM, NON_PM, 0L, NO_COLOR), + NON_PM, NON_PM, + 0, 0, 0L, NO_COLOR, NONARTIFACT), A("Excalibur", LONG_SWORD, (SPFX_NOGEN | SPFX_RESTR | SPFX_SEEK | SPFX_DEFN | SPFX_INTEL | SPFX_SEARCH), 0, 0, PHYS(5, 10), DRLI(0, 0), NO_CARY, 0, A_LAWFUL, PM_KNIGHT, NON_PM, - 4000L, NO_COLOR), + 0, 10, 4000L, NO_COLOR, EXCALIBUR), /* * Stormbringer only has a 2 because it can drain a level, * providing 8 more. */ A("Stormbringer", RUNESWORD, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN | SPFX_INTEL | SPFX_DRLI), 0, 0, - DRLI(5, 2), DRLI(0, 0), NO_CARY, 0, A_CHAOTIC, NON_PM, NON_PM, 8000L, - NO_COLOR), + DRLI(5, 2), DRLI(0, 0), NO_CARY, 0, A_CHAOTIC, NON_PM, NON_PM, + 0, 9, 8000L, NO_COLOR, STORMBRINGER), /* * Mjollnir can be thrown when wielded if hero has 25 Strength * (usually via gauntlets of power but possible with rings of @@ -70,10 +108,12 @@ STATIC_OVL NEARDATA struct artifact artilist[] = { */ A("Mjollnir", WAR_HAMMER, /* Mjo:llnir */ (SPFX_RESTR | SPFX_ATTK), 0, 0, ELEC(5, 24), NO_DFNS, NO_CARY, 0, - A_NEUTRAL, PM_VALKYRIE, NON_PM, 4000L, NO_COLOR), + A_NEUTRAL, PM_VALKYRIE, NON_PM, + 0, 8, 4000L, NO_COLOR, MJOLLNIR), A("Cleaver", BATTLE_AXE, SPFX_RESTR, 0, 0, PHYS(3, 6), NO_DFNS, NO_CARY, - 0, A_NEUTRAL, PM_BARBARIAN, NON_PM, 1500L, NO_COLOR), + 0, A_NEUTRAL, PM_BARBARIAN, NON_PM, + 0, 8, 1500L, NO_COLOR, CLEAVER), /* * Grimtooth glows in warning when elves are present, but its @@ -81,8 +121,9 @@ STATIC_OVL NEARDATA struct artifact artilist[] = { * (handled as special case in spec_dbon()). */ A("Grimtooth", ORCISH_DAGGER, (SPFX_RESTR | SPFX_WARN | SPFX_DFLAG2), - 0, M2_ELF, PHYS(2, 6), NO_DFNS, - NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ORC, 300L, CLR_RED), + 0, M2_ELF, PHYS(2, 6), POIS(0,0), + NO_CARY, FLING_POISON, A_CHAOTIC, NON_PM, PM_ORC, + 0, 5, 1200L, CLR_RED, GRIMTOOTH), /* * Orcrist and Sting have same alignment as elves. * @@ -91,131 +132,146 @@ STATIC_OVL NEARDATA struct artifact artilist[] = { * Sting and Orcrist will warn of M2_ORC monsters. */ A("Orcrist", ELVEN_BROADSWORD, (SPFX_WARN | SPFX_DFLAG2), 0, M2_ORC, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, 2000L, - CLR_BRIGHT_BLUE), /* bright blue is actually light blue */ + PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, + 3, 4, 2000L, CLR_BRIGHT_BLUE, ORCRIST), /* actually light blue */ - A("Sting", ELVEN_DAGGER, (SPFX_WARN | SPFX_DFLAG2), 0, M2_ORC, PHYS(5, 0), - NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, 800L, CLR_BRIGHT_BLUE), + A("Sting", ELVEN_DAGGER, (SPFX_WARN | SPFX_DFLAG2), 0, M2_ORC, + PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, + 3, 1, 800L, CLR_BRIGHT_BLUE, STING), /* * Magicbane is a bit different! Its magic fanfare * unbalances victims in addition to doing some damage. */ A("Magicbane", ATHAME, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN), 0, 0, STUN(3, 4), DFNS(AD_MAGM), NO_CARY, 0, A_NEUTRAL, PM_WIZARD, NON_PM, - 3500L, NO_COLOR), + 0, 7, 3500L, NO_COLOR, MAGICBANE), A("Frost Brand", LONG_SWORD, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN), 0, 0, - COLD(5, 0), COLD(0, 0), NO_CARY, 0, A_NONE, NON_PM, NON_PM, 3000L, - NO_COLOR), + COLD(5, 0), COLD(0, 0), NO_CARY, SNOWSTORM, A_NONE, NON_PM, NON_PM, + 0, 9, 3000L, NO_COLOR, FROST_BRAND), A("Fire Brand", LONG_SWORD, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN), 0, 0, - FIRE(5, 0), FIRE(0, 0), NO_CARY, 0, A_NONE, NON_PM, NON_PM, 3000L, - NO_COLOR), + FIRE(5, 0), FIRE(0, 0), NO_CARY, FIRESTORM, A_NONE, NON_PM, NON_PM, + 0, 5, 3000L, NO_COLOR, FIRE_BRAND), A("Dragonbane", BROADSWORD, (SPFX_RESTR | SPFX_DCLAS | SPFX_REFLECT), 0, S_DRAGON, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 500L, - NO_COLOR), + PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, + 2, 5, 500L, NO_COLOR, DRAGONBANE), - A("Demonbane", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_DEMON, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 2500L, - NO_COLOR), + A("Demonbane", SILVER_MACE, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_DEMON, + PHYS(5, 0), NO_DFNS, NO_CARY, BANISH, A_LAWFUL, PM_CLERIC, NON_PM, + 1, 3, 2500L, NO_COLOR, DEMONBANE), A("Werebane", SILVER_SABER, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_WERE, - PHYS(5, 0), DFNS(AD_WERE), NO_CARY, 0, A_NONE, NON_PM, NON_PM, 1500L, - NO_COLOR), + PHYS(5, 0), DFNS(AD_WERE), NO_CARY, 0, A_NONE, NON_PM, NON_PM, + 1, 4, 1500L, NO_COLOR, WEREBANE), A("Grayswandir", SILVER_SABER, (SPFX_RESTR | SPFX_HALRES), 0, 0, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 8000L, - NO_COLOR), + PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, + 0, 10, 8000L, NO_COLOR, GRAYSWANDIR), A("Giantslayer", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_GIANT, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 200L, - NO_COLOR), + PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, + 2, 4, 200L, NO_COLOR, GIANTSLAYER), A("Ogresmasher", WAR_HAMMER, (SPFX_RESTR | SPFX_DCLAS), 0, S_OGRE, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 200L, - NO_COLOR), + PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, + 2, 1, 200L, NO_COLOR, OGRESMASHER), + + A("Trollsbane", MORNING_STAR, (SPFX_RESTR | SPFX_DCLAS | SPFX_REGEN), 0, + S_TROLL, PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, + 2, 1, 200L, NO_COLOR, TROLLSBANE), - A("Trollsbane", MORNING_STAR, (SPFX_RESTR | SPFX_DCLAS), 0, S_TROLL, - PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 200L, - NO_COLOR), /* * Two problems: 1) doesn't let trolls regenerate heads, * 2) doesn't give unusual message for 2-headed monsters (but * allowing those at all causes more problems than worth the effort). */ A("Vorpal Blade", LONG_SWORD, (SPFX_RESTR | SPFX_BEHEAD), 0, 0, - PHYS(5, 1), NO_DFNS, NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 4000L, - NO_COLOR), + PHYS(5, 1), NO_DFNS, NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, + 1, 5, 4000L, NO_COLOR, VORPAL_BLADE), + /* * Ah, never shall I forget the cry, * or the shriek that shrieked he, * As I gnashed my teeth, and from my sheath * I drew my Snickersnee! - * --Koko, Lord high executioner of Titipu + * --Ko-Ko, Lord high executioner of Titipu * (From Sir W.S. Gilbert's "The Mikado") */ A("Snickersnee", KATANA, SPFX_RESTR, 0, 0, PHYS(0, 8), NO_DFNS, NO_CARY, - 0, A_LAWFUL, PM_SAMURAI, NON_PM, 1200L, NO_COLOR), + 0, A_LAWFUL, PM_SAMURAI, NON_PM, + 0, 8, 1200L, NO_COLOR, SNICKERSNEE), + /* Sunsword emits light when wielded (handled in the core rather than + via artifact fields), but that light has no particular color */ A("Sunsword", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_UNDEAD, - PHYS(5, 0), DFNS(AD_BLND), NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 1500L, - NO_COLOR), + PHYS(5, 0), DFNS(AD_BLND), NO_CARY, BLINDING_RAY, A_LAWFUL, NON_PM, + NON_PM, + 0, 6, 1500L, NO_COLOR, SUNSWORD), /* * The artifacts for the quest dungeon, all self-willed. + * gen_spe should be 0; gift_value irrelevant and set to 12. */ A("The Orb of Detection", CRYSTAL_BALL, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), (SPFX_ESP | SPFX_HSPDAM), 0, NO_ATTK, NO_DFNS, CARY(AD_MAGM), INVIS, A_LAWFUL, PM_ARCHEOLOGIST, - NON_PM, 2500L, NO_COLOR), + NON_PM, + 0, 12, 2500L, NO_COLOR, ORB_OF_DETECTION), A("The Heart of Ahriman", LUCKSTONE, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), SPFX_STLTH, 0, /* this stone does double damage if used as a projectile weapon */ PHYS(5, 0), NO_DFNS, NO_CARY, LEVITATION, A_NEUTRAL, PM_BARBARIAN, - NON_PM, 2500L, NO_COLOR), + NON_PM, + 0, 12, 2500L, NO_COLOR, HEART_OF_AHRIMAN), A("The Sceptre of Might", MACE, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_DALIGN), 0, 0, PHYS(5, 0), - DFNS(AD_MAGM), NO_CARY, CONFLICT, A_LAWFUL, PM_CAVEMAN, NON_PM, 2500L, - NO_COLOR), - -#if 0 /* OBSOLETE */ -A("The Palantir of Westernesse", CRYSTAL_BALL, - (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL), - (SPFX_ESP|SPFX_REGEN|SPFX_HSPDAM), 0, - NO_ATTK, NO_DFNS, NO_CARY, - TAMING, A_CHAOTIC, NON_PM , PM_ELF, 8000L, NO_COLOR ), + DFNS(AD_MAGM), NO_CARY, CONFLICT, A_LAWFUL, PM_CAVE_DWELLER, NON_PM, + 0, 12, 2500L, NO_COLOR, SCEPTRE_OF_MIGHT), + +#if 0 /* OBSOLETE -- from 3.1.0 to 3.2.x, this was quest artifact for the + * Elf role; in 3.3.0 elf became a race available to several roles + * and the Elf role along with its quest was eliminated; it's a bit + * overpowered to be an ordinary artifact so leave it excluded */ + A("The Palantir of Westernesse", CRYSTAL_BALL, + (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), + (SPFX_ESP | SPFX_REGEN | SPFX_HSPDAM), 0, + NO_ATTK, NO_DFNS, NO_CARY, TAMING, A_CHAOTIC, NON_PM, PM_ELF, + 0, 12, 8000L, NO_COLOR, PALANTIR_OF_WESTERNESSE), #endif A("The Staff of Aesculapius", QUARTERSTAFF, (SPFX_NOGEN | SPFX_RESTR | SPFX_ATTK | SPFX_INTEL | SPFX_DRLI | SPFX_REGEN), 0, 0, DRLI(0, 0), DRLI(0, 0), NO_CARY, HEALING, A_NEUTRAL, PM_HEALER, - NON_PM, 5000L, NO_COLOR), + NON_PM, + 0, 12, 5000L, NO_COLOR, STAFF_OF_AESCULAPIUS), A("The Magic Mirror of Merlin", MIRROR, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_SPEAK), SPFX_ESP, 0, - NO_ATTK, NO_DFNS, CARY(AD_MAGM), 0, A_LAWFUL, PM_KNIGHT, NON_PM, 1500L, - NO_COLOR), + NO_ATTK, NO_DFNS, CARY(AD_MAGM), 0, A_LAWFUL, PM_KNIGHT, NON_PM, + 0, 12, 1500L, NO_COLOR, MAGIC_MIRROR_OF_MERLIN), A("The Eyes of the Overworld", LENSES, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_XRAY), 0, 0, NO_ATTK, DFNS(AD_MAGM), NO_CARY, ENLIGHTENING, A_NEUTRAL, PM_MONK, NON_PM, - 2500L, NO_COLOR), + 0, 12, 2500L, NO_COLOR, EYES_OF_THE_OVERWORLD), A("The Mitre of Holiness", HELM_OF_BRILLIANCE, (SPFX_NOGEN | SPFX_RESTR | SPFX_DFLAG2 | SPFX_INTEL | SPFX_PROTECT), 0, M2_UNDEAD, NO_ATTK, NO_DFNS, CARY(AD_FIRE), ENERGY_BOOST, A_LAWFUL, - PM_PRIEST, NON_PM, 2000L, NO_COLOR), + PM_CLERIC, NON_PM, + 0, 12, 2000L, NO_COLOR, MITRE_OF_HOLINESS), A("The Longbow of Diana", BOW, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_REFLECT), SPFX_ESP, 0, PHYS(5, 0), NO_DFNS, NO_CARY, CREATE_AMMO, A_CHAOTIC, PM_RANGER, NON_PM, - 4000L, NO_COLOR), + 0, 12, 4000L, NO_COLOR, LONGBOW_OF_DIANA), /* MKoT has an additional carry property if the Key is not cursed (for rogues) or blessed (for non-rogues): #untrap of doors and chests @@ -223,40 +279,46 @@ A("The Palantir of Westernesse", CRYSTAL_BALL, A("The Master Key of Thievery", SKELETON_KEY, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_SPEAK), (SPFX_WARN | SPFX_TCTRL | SPFX_HPHDAM), 0, NO_ATTK, NO_DFNS, NO_CARY, - UNTRAP, A_CHAOTIC, PM_ROGUE, NON_PM, 3500L, NO_COLOR), + UNTRAP, A_CHAOTIC, PM_ROGUE, NON_PM, + 0, 12, 3500L, NO_COLOR, MASTER_KEY_OF_THIEVERY), A("The Tsurugi of Muramasa", TSURUGI, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_BEHEAD | SPFX_LUCK | SPFX_PROTECT), 0, 0, PHYS(0, 8), NO_DFNS, NO_CARY, 0, A_LAWFUL, PM_SAMURAI, NON_PM, - 4500L, NO_COLOR), + 0, 12, 4500L, NO_COLOR, TSURUGI_OF_MURAMASA), A("The Platinum Yendorian Express Card", CREDIT_CARD, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_DEFN), (SPFX_ESP | SPFX_HSPDAM), 0, NO_ATTK, NO_DFNS, CARY(AD_MAGM), - CHARGE_OBJ, A_NEUTRAL, PM_TOURIST, NON_PM, 7000L, NO_COLOR), + CHARGE_OBJ, A_NEUTRAL, PM_TOURIST, NON_PM, + 0, 12, 7000L, NO_COLOR, YENDORIAN_EXPRESS_CARD), A("The Orb of Fate", CRYSTAL_BALL, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_LUCK), (SPFX_WARN | SPFX_HSPDAM | SPFX_HPHDAM), 0, NO_ATTK, NO_DFNS, NO_CARY, - LEV_TELE, A_NEUTRAL, PM_VALKYRIE, NON_PM, 3500L, NO_COLOR), + LEV_TELE, A_NEUTRAL, PM_VALKYRIE, NON_PM, + 0, 12, 3500L, NO_COLOR, ORB_OF_FATE), A("The Eye of the Aethiopica", AMULET_OF_ESP, (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), (SPFX_EREGEN | SPFX_HSPDAM), 0, NO_ATTK, DFNS(AD_MAGM), NO_CARY, CREATE_PORTAL, A_NEUTRAL, PM_WIZARD, - NON_PM, 4000L, NO_COLOR), + NON_PM, + 0, 12, 4000L, NO_COLOR, EYE_OF_THE_AETHIOPICA), +#if !defined(ARTI_ENUM) && !defined(DUMP_ARTI_ENUM) /* * terminator; otyp must be zero */ - A(0, 0, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 0L, - 0) /* 0 is CLR_BLACK rather than NO_COLOR but it doesn't matter here */ + A(0, 0, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, + 0, 0, 0L, NO_COLOR, TERMINATOR) }; /* artilist[] (or artifact_names[]) */ +#endif #undef A -#ifndef MAKEDEFS_C +#ifdef NO_ATTK #undef NO_ATTK #undef NO_DFNS #undef DFNS diff --git a/include/attrib.h b/include/attrib.h index fe97a9fb2..a5299f423 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -1,8 +1,8 @@ -/* NetHack 3.6 attrib.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright 1988, Mike Stephenson */ +/* NetHack 5.0 attrib.h $NHDT-Date: 1596498527 2020/08/03 23:48:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.12 $ */ +/* Copyright 1988, Mike Stephenson */ /* NetHack may be freely redistributed. See license for details. */ -/* attrib.h - Header file for character class processing. */ +/* attrib.h - Header file for character class processing. */ #ifndef ATTRIB_H #define ATTRIB_H @@ -40,10 +40,8 @@ struct attribs { schar a[A_MAX]; }; -#define ATTRMAX(x) \ - ((x == A_STR && Upolyd && strongmonst(youmonst.data)) \ - ? STR18(100) \ - : urace.attrmax[x]) -#define ATTRMIN(x) (urace.attrmin[x]) +#define ATTRMAX(x) \ + ((x == A_STR && Upolyd) ? uasmon_maxStr() : gu.urace.attrmax[x]) +#define ATTRMIN(x) (gu.urace.attrmin[x]) #endif /* ATTRIB_H */ diff --git a/include/botl.h b/include/botl.h index 5b88072f4..87fc7cdbd 100644 --- a/include/botl.h +++ b/include/botl.h @@ -1,11 +1,16 @@ -/* NetHack 3.6 botl.h $NHDT-Date: 1554591222 2019/04/06 22:53:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.24 $ */ +/* NetHack 5.0 botl.h $NHDT-Date: 1694893330 2023/09/16 19:42:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.37 $ */ /* Copyright (c) Michael Allison, 2003 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef BOTL_H #define BOTL_H -/* MAXCO must hold longest uncompressed status line, and must be larger +/* Note: this comment is about the pre-VIA_WINDOWPORT two line status + * which is still available but has not added a bunch of conditional + * extra status conditions (Grab, InLava, Held, Zzz and many others) + * or the new fields Weapon, Armor, and Terrain. + * + * MAXCO must hold longest uncompressed status line, and must be larger * than COLNO * * longest practical second status line at the moment is @@ -27,6 +32,9 @@ Astral Plane \GXXXXNNNN:123456 HP:1234(1234) Pw:1234(1234) AC:-127 #define MAXCO (COLNO + 40) #endif +/* limit of the player's name in the status window */ +#define BOTL_NSIZ 16 + struct condmap { const char *id; unsigned long bitmask; @@ -36,40 +44,172 @@ enum statusfields { BL_CHARACTERISTICS = -3, /* alias for BL_STR..BL_CH */ BL_RESET = -2, /* Force everything to redisplay */ BL_FLUSH = -1, /* Finished cycling through bot fields */ + /* + * Note: status_sanity_check() in wintty.c has strings for the rest + * of these, so if any get renumbered or more get added, be sure to + * keep those in sync. + */ BL_TITLE = 0, - BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, /* 1..6 */ - BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX, /* 7..12 */ - BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, /* 13..18 */ - BL_HPMAX, BL_LEVELDESC, BL_EXP, BL_CONDITION, /* 19..22 */ - MAXBLSTATS /* [23] */ + BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, /* 1.. 6 */ + BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, /* 7..10 */ + BL_ENE, BL_ENEMAX, BL_XP, BL_AC, BL_HD, /* 11..15 */ + BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, /* 16..19 */ + BL_LEVELDESC, BL_EXP, BL_CONDITION, /* 20..22 */ + BL_WEAPON, BL_ARMOR, BL_TERRAIN, /* 23..25 */ + BL_VERS, /* 26 */ + MAXBLSTATS /* [27] */ }; -enum relationships { NO_LTEQGT = -1, - EQ_VALUE, LT_VALUE, LE_VALUE, - GE_VALUE, GT_VALUE, TXT_VALUE }; +enum relationships { + NO_LTEQGT = -1, + EQ_VALUE, LT_VALUE, LE_VALUE, + GE_VALUE, GT_VALUE, TXT_VALUE +}; -#define BEFORE 0 -#define NOW 1 +enum blconditions { + bl_bareh, /* deprecated -- bl_weapon encompasses this */ + bl_blind, + bl_busy, + bl_conf, + bl_deaf, + bl_elf_iron, + bl_fly, + bl_foodpois, + bl_glowhands, + bl_grab, + bl_hallu, + bl_held, + bl_icy, /* bl_terrain encompasses this */ + bl_inlava, + bl_lev, + bl_parlyz, + bl_ride, + bl_sleeping, + bl_slime, + bl_slippery, + bl_stone, + bl_strngl, + bl_stun, + bl_submerged, /* bl_terrain encompasses this */ + bl_termill, + bl_tethered, + bl_trapped, + bl_unconsc, + bl_woundedl, + bl_holding, + + CONDITION_COUNT +}; /* Boolean condition bits for the condition mask */ /* clang-format off */ -#define BL_MASK_STONE 0x00000001L -#define BL_MASK_SLIME 0x00000002L -#define BL_MASK_STRNGL 0x00000004L -#define BL_MASK_FOODPOIS 0x00000008L -#define BL_MASK_TERMILL 0x00000010L -#define BL_MASK_BLIND 0x00000020L -#define BL_MASK_DEAF 0x00000040L -#define BL_MASK_STUN 0x00000080L -#define BL_MASK_CONF 0x00000100L -#define BL_MASK_HALLU 0x00000200L -#define BL_MASK_LEV 0x00000400L -#define BL_MASK_FLY 0x00000800L -#define BL_MASK_RIDE 0x00001000L -#define BL_MASK_BITS 13 /* number of mask bits that can be set */ +#define BL_MASK_BAREH 0x00000001L +#define BL_MASK_BLIND 0x00000002L +#define BL_MASK_BUSY 0x00000004L +#define BL_MASK_CONF 0x00000008L +#define BL_MASK_DEAF 0x00000010L +#define BL_MASK_ELF_IRON 0x00000020L +#define BL_MASK_FLY 0x00000040L +#define BL_MASK_FOODPOIS 0x00000080L +#define BL_MASK_GLOWHANDS 0x00000100L +#define BL_MASK_GRAB 0x00000200L +#define BL_MASK_HALLU 0x00000400L +#define BL_MASK_HELD 0x00000800L +#define BL_MASK_ICY 0x00001000L +#define BL_MASK_INLAVA 0x00002000L +#define BL_MASK_LEV 0x00004000L +#define BL_MASK_PARLYZ 0x00008000L +#define BL_MASK_RIDE 0x00010000L +#define BL_MASK_SLEEPING 0x00020000L +#define BL_MASK_SLIME 0x00040000L +#define BL_MASK_SLIPPERY 0x00080000L +#define BL_MASK_STONE 0x00100000L +#define BL_MASK_STRNGL 0x00200000L +#define BL_MASK_STUN 0x00400000L +#define BL_MASK_SUBMERGED 0x00800000L +#define BL_MASK_TERMILL 0x01000000L +#define BL_MASK_TETHERED 0x02000000L +#define BL_MASK_TRAPPED 0x04000000L +#define BL_MASK_UNCONSC 0x08000000L +#define BL_MASK_WOUNDEDL 0x10000000L +#define BL_MASK_HOLDING 0x20000000L +#define BL_MASK_BITS 30 /* number of mask bits that can be set */ /* clang-format on */ +struct conditions_t { + int ranking; + long mask; + enum blconditions c; + const char *text[3]; +}; +extern const struct conditions_t conditions[CONDITION_COUNT]; + +struct condtests_t { + enum blconditions c; + const char *useroption; + enum optchoice opt; + boolean enabled; + boolean choice; + boolean test; +}; + +extern struct condtests_t condtests[CONDITION_COUNT]; +extern int cond_idx[CONDITION_COUNT]; + +#define BEFORE 0 +#define NOW 1 + +/* + * Possible additional conditions: + * major: + * grab - grabbed by eel so about to be drowned ("wrapd"? damage type + * is AD_WRAP but message is " swings itself around you") + * digst - swallowed and being digested + * lava - trapped sinking into lava + * in_between: (potentially severe but don't necessarily lead to death; + * explains to player why he isn't getting to take any turns) + * unconc - unconscious + * parlyz - (multi < 0 && (!strncmp(multi_reason, "paralyzed", 9) + * || !strncmp(multi_reason, "frozen", 6))) + * asleep - (multi < 0 && !strncmp(multi_reason, "sleeping", 8)) + * busy - other multi < 0 + * minor: + * held - grabbed by non-eel or by eel but not susceptible to drowning + * englf - engulfed or swallowed but not being digested (usually + * obvious but the blank symbol set makes that uncertain) + * vomit - vomiting (causes confusion and stun late in countdown) + * trap - trapped in pit, bear trap, web, or floor (solidified lava) + * teth - tethered to buried iron ball + * chain - punished + * slip - slippery fingers + * ice - standing on ice (movement becomes uncertain) + * [underwater - movement uncertain, vision truncated, equipment at risk] + * other: + * [hold - poly'd into grabber and holding adjacent monster] + * Stormbringer - wielded weapon poses risks + * Cleaver - wielded weapon risks unintended consequences + * barehand - not wielding any weapon nor wearing gloves + * no-weapon - not wielding any weapon + * bow/xbow/sling - wielding a missile launcher of specified type + * pole - wielding a polearm + * pick - wielding a pickaxe + * junk - wielding non-weapon, non-weptool + * naked - no armor + * no-gloves - self-explanatory + * no-cloak - ditto + * [no-{other armor slots?} - probably much too verbose] + * conduct? + * [maybe if third status line is added] + * + * Can't add all of these and probably don't want to. But maybe we + * can add some of them and it's not as many as first appears: + * lava/trap/teth are mutually exclusive; + * digst/grab/englf/held/hold are also mutually exclusive; + * Stormbringer/Cleaver/barehand/no-weapon/bow&c/pole/pick/junk too; + * naked/no-{any armor slot} likewise. + */ + #define VIA_WINDOWPORT() \ ((windowprocs.wincap2 & (WC2_HILITE_STATUS | WC2_FLUSH_STATUS)) != 0) @@ -77,10 +217,18 @@ enum relationships { NO_LTEQGT = -1, /* #ifdef STATUS_HILITES */ /* hilite status field behavior - coloridx values */ -#define BL_HILITE_NONE -1 /* no hilite of this field */ -#define BL_HILITE_INVERSE -2 /* inverse hilite */ -#define BL_HILITE_BOLD -3 /* bold hilite */ - /* or any CLR_ index (0 - 15) */ +#define BL_HILITE_NONE -1 /* no hilite of this field */ + +#if 0 +#define BL_HILITE_BOLD -2 /* bold hilite */ +#define BL_HILITE_DIM -3 /* dim hilite */ +#define BL_HILITE_ITALIC -4 /* italic hilite */ +#define BL_HILITE_ULINE -5 /* underline hilite */ +#define BL_HILITE_BLINK -6 /* blink hilite */ +#define BL_HILITE_INVERSE -7 /* inverse hilite */ + /* or any CLR_ index (0 - 15) */ +#endif + #define BL_TH_NONE 0 #define BL_TH_VAL_PERCENTAGE 100 /* threshold is percentage */ #define BL_TH_VAL_ABSOLUTE 101 /* threshold is particular value */ @@ -88,23 +236,68 @@ enum relationships { NO_LTEQGT = -1, #define BL_TH_CONDITION 103 /* threshold is bitmask of conditions */ #define BL_TH_TEXTMATCH 104 /* threshold text value to match against */ #define BL_TH_ALWAYS_HILITE 105 /* highlight regardless of value */ +#define BL_TH_CRITICALHP 106 /* highlight critically low HP */ + +#define HL_ATTCLR_NONE CLR_MAX + 1 +#define HL_ATTCLR_BOLD CLR_MAX + 2 +#define HL_ATTCLR_DIM CLR_MAX + 3 +#define HL_ATTCLR_ITALIC CLR_MAX + 4 +#define HL_ATTCLR_ULINE CLR_MAX + 5 +#define HL_ATTCLR_BLINK CLR_MAX + 6 +#define HL_ATTCLR_INVERSE CLR_MAX + 7 +#define BL_ATTCLR_MAX CLR_MAX + 8 +enum hlattribs { + HL_UNDEF = 0x00, + HL_NONE = 0x01, + HL_BOLD = 0x02, + HL_DIM = 0x04, + HL_ITALIC = 0x08, + HL_ULINE = 0x10, + HL_BLINK = 0x20, + HL_INVERSE = 0x40 +}; + +#define MAXVALWIDTH 80 /* actually less, but was using 80 to allocate title + * and leveldesc then using QBUFSZ everywhere else */ +#ifdef STATUS_HILITES +struct hilite_s { + enum statusfields fld; + boolean set; + enum any_types anytype; + anything value; + int behavior; + char textmatch[MAXVALWIDTH]; + enum relationships rel; + int coloridx; + struct hilite_s *next; +}; +#endif -#define HL_ATTCLR_DIM CLR_MAX + 0 -#define HL_ATTCLR_BLINK CLR_MAX + 1 -#define HL_ATTCLR_ULINE CLR_MAX + 2 -#define HL_ATTCLR_INVERSE CLR_MAX + 3 -#define HL_ATTCLR_BOLD CLR_MAX + 4 -#define BL_ATTCLR_MAX CLR_MAX + 5 - -enum hlattribs { HL_UNDEF = 0x00, - HL_NONE = 0x01, - HL_BOLD = 0x02, - HL_INVERSE = 0x04, - HL_ULINE = 0x08, - HL_BLINK = 0x10, - HL_DIM = 0x20 }; -/* #endif STATUS_HILITES */ +/* + * Note: If you add/change/remove fields in istat_s, you need to + * update the initialization of the istat_s struct blstats[][] + * array in instance_globals_b (decl.c). + */ +struct istat_s { + const char *fldname; + const char *fldfmt; + long time; /* moves when this field hilite times out */ + boolean chg; /* need to recalc time? */ + boolean percent_matters; + short percent_value; + enum any_types anytype; + anything a, rawval; + char *val; + int valwidth; + enum statusfields idxmax; + enum statusfields fld; +#ifdef STATUS_HILITES + struct hilite_s *hilite_rule; /* the entry, if any, in 'thresholds' + * list that currently applies */ + struct hilite_s *thresholds; +#endif +}; extern const char *status_fieldnames[]; /* in botl.c */ diff --git a/include/color.h b/include/color.h index b05ae6d73..3ad090346 100644 --- a/include/color.h +++ b/include/color.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 color.h $NHDT-Date: 1432512776 2015/05/25 00:12:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */ +/* NetHack 5.0 color.h $NHDT-Date: 1682205020 2023/04/22 23:10:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.18 $ */ /* Copyright (c) Steve Linhart, Eric Raymond, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -29,10 +29,15 @@ #define CLR_WHITE 15 #define CLR_MAX 16 -/* The "half-way" point for tty based color systems. This is used in */ +/* The "half-way" point for tty-based color systems. This is used in */ /* the tty color setup code. (IMHO, it should be removed - dean). */ #define BRIGHT 8 +/* color aliases used in monsters.h and display.c */ +#define HI_DOMESTIC CLR_WHITE /* for player + pets */ +#define HI_LORD CLR_MAGENTA /* for high-end monsters */ +#define HI_OVERLORD CLR_BRIGHT_MAGENTA /* for few uniques */ + /* these can be configured */ #define HI_OBJ CLR_MAGENTA #define HI_METAL CLR_CYAN @@ -49,11 +54,26 @@ #define DRAGON_SILVER CLR_BRIGHT_CYAN #define HI_ZAP CLR_BRIGHT_BLUE -struct menucoloring { - struct nhregex *match; - char *origstr; - int color, attr; - struct menucoloring *next; +#define NH_BASIC_COLOR 0x1000000 +#define NH_ALTPALETTE 0x2000000 +#define COLORVAL(x) ((x) & 0xFFFFFF) + +enum nhcolortype { no_color, nh_color, rgb_color }; + +struct nethack_color { + enum nhcolortype colortyp; + int tableindex; + int rgbindex; + const char *name; + long r, g, b; }; +typedef struct color_and_attr { + int color, attr; +} color_attr; + +extern const struct nethack_color colortable[]; + #endif /* COLOR_H */ + +/*color.h*/ diff --git a/include/config1.h b/include/config1.h index 411cf583b..190c47f97 100644 --- a/include/config1.h +++ b/include/config1.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 config1.h $NHDT-Date: 1555702947 2019/04/19 19:42:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.21 $ */ +/* NetHack 5.0 config1.h $NHDT-Date: 1596498530 2020/08/03 23:48:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.23 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -28,33 +28,40 @@ #ifdef MSDOS #undef UNIX +#ifndef CROSSCOMPILE +#define SHORT_FILENAMES +#endif +/* this is not fully-implemented yet for msdos */ +#ifdef ENHANCED_SYMBOLS +#undef ENHANCED_SYMBOLS +#endif #endif /* * Mac Stuff. */ #if defined(__APPLE__) && defined(__MACH__) -#define MACOSX +#define MACOS #endif #ifdef macintosh /* Auto-defined symbol for MPW compilers (sc and mrc) */ -#define MAC +#define MACOS9 #endif #ifdef THINK_C /* Think C auto-defined symbol */ -#define MAC +#define MACOS9 #define NEED_VARARGS #endif #ifdef __MWERKS__ /* defined by Metrowerks' Codewarrior compiler */ #ifndef __BEOS__ /* BeOS */ -#define MAC +#define MACOS9 #endif #define NEED_VARARGS #define USE_STDARG #endif -#if defined(MAC) || defined(__BEOS__) +#if defined(MACOS9) || defined(__BEOS__) #define DLB #undef UNIX #endif @@ -88,7 +95,7 @@ #undef UNIX #define DLB #define HACKDIR "NetHack:" -#define NO_MACRO_CPATH + #endif /* @@ -142,6 +149,12 @@ #define _GNU_SOURCE #endif +#ifdef __vms +#ifndef VMS +#define VMS +#endif +#endif + #ifdef VMS /* really old compilers need special handling, detected here */ #undef UNIX #ifdef __DECC @@ -150,15 +163,21 @@ /* [25 or so years later... That was probably uchar widening to */ /* 'unsigned int' rather than anything to do with typedefs. pr] */ #define USE_VARARGS -#else +#else /* __DECC_VER not defined */ +#if __DECC_VER >= 70000000 +#define VMSVSI +#endif /* _DECC_VER >= 70000000 */ +#ifndef VMSVSI #define NHSTDC #define USE_STDARG #define POSIX_TYPES #ifndef _DECC_V4_SOURCE /* only def here if not already def'd on comd line */ #define _DECC_V4_SOURCE /* avoid some incompatible V5.x (and later) changes */ #endif +#endif /* !VMSVSI */ #endif /*__DECC_VER*/ #undef __HIDE_FORBIDDEN_NAMES /* need non-ANSI library support functions */ +#ifndef VMSVSI #ifdef VAXC /* DEC C in VAX C compatibility mode; 'signed' works */ #define signed /* but causes diagnostic about VAX C not supporting it */ #endif @@ -187,6 +206,7 @@ #undef USE_STDARG #endif #endif +#endif /* !VMSVSI */ #endif /*VMS*/ #ifdef vax diff --git a/include/context.h b/include/context.h index c24da8d56..1593d23ca 100644 --- a/include/context.h +++ b/include/context.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 context.h $NHDT-Date: 1455907260 2016/02/19 18:41:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 5.0 context.h $NHDT-Date: 1753856387 2025/07/29 22:19:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.58 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -11,6 +11,15 @@ #define CONTEXTVERBSZ 30 +enum nh_tips { + TIP_ENHANCE = 0, /* #enhance */ + TIP_SWIM, /* walking into water */ + TIP_UNTRAP_MON, /* walking into trapped peaceful */ + TIP_GETPOS, /* getpos/farlook */ + + NUM_TIPS +}; + /* * The context structure houses things that the game tracks * or adjusts during the game, to preserve game state or context. @@ -65,6 +74,16 @@ struct victual_info { Bitfield(doreset, 1); /* stop eating at end of turn */ }; +struct engrave_info { + char text[BUFSZ]; /* actual text being engraved - doengrave() handles all + the possible mutations of this */ + char *nextc; /* next character(s) in text[] to engrave */ + struct obj *stylus; /* object doing the writing */ + xint8 type; /* type of engraving (DUST, MARK, etc) */ + coord pos; /* location the engraving is being placed on */ + int actionct; /* nth turn spent engraving */ +}; + struct warntype_info { unsigned long obj; /* object warn_of_mon monster type M2 */ unsigned long polyd; /* warn_of_mon monster type M2 due to poly */ @@ -94,7 +113,7 @@ struct tribute_info { struct novel_tracking { /* for choosing random passage when reading novel */ unsigned id; /* novel oid from previous passage selection */ int count; /* number of passage indices available in pasg[] */ - xchar pasg[30]; /* pasg[0..count-1] are passage indices */ + xint8 pasg[30]; /* pasg[0..count-1] are passage indices */ /* tribute file is allowed to have more than 30 passages for a novel; if it does, reading will first choose a random subset of 30 of them; reading all 30 or switching to a different novel and then back again @@ -105,19 +124,39 @@ struct novel_tracking { /* for choosing random passage when reading novel */ passage from the Death Quotes section of dat/tribute */ }; +struct achievement_tracking { + unsigned mines_prize_oid, /* luckstone->o_id */ + soko_prize_oid, /* {bag or amulet}->o_id */ + castle_prize_old; /* wand->o_id; not yet implemented */ + /* record_achievement() wants the item type for livelog() event */ + short mines_prize_otyp, /* luckstone */ + soko_prize_otyp, /* bag of holding or amulet of reflection */ + castle_prize_otyp; /* strange object (someday wand of wishing) */ + boolean minetn_reached; /* avoid redundant checking for town entry */ +}; + +struct lifelists { + long total_seen_upclose; /* count of critters seen up close */ + long total_photographed; /* count of critters photographed (tourists) */ +}; + struct context_info { unsigned ident; /* social security number for each monster */ unsigned no_of_wizards; /* 0, 1 or 2 (wizard and his shadow) */ - unsigned run; /* 0: h (etc), 1: H (etc), 2: fh (etc) */ - /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ - /* 8: travel */ - unsigned startingpet_mid; - int current_fruit; /* fruit->fid corresponding to pl_fruit[] */ - int warnlevel; + unsigned run; /* 0: h (etc), 1: H (etc), 2: fh (etc), + * 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF-, + * 8: travel */ + unsigned startingpet_mid; /* monster id number for initial pet */ + int current_fruit; /* fruit->fid corresponding to svp.pl_fruit[] */ + int mysteryforce; /* adjusts how often "mysterious force" kicks in */ int rndencode; /* randomized escape sequence introducer */ + int startingpet_typ; /* monster type for initial pet */ + int warnlevel; /* threshold (digit) to warn about unseen mons */ long next_attrib_check; /* next attribute check */ - long stethoscope_move; - short stethoscope_movement; + long seer_turn; /* when random clairvoyance will next kick in */ + long snickersnee_turn; /* Snickersnee last used to distance attack */ + long stethoscope_seq; /* when a stethoscope was last used; first use + * during a move takes no time, second uses move */ boolean travel; /* find way automatically to u.tx,u.ty */ boolean travel1; /* first travel step */ boolean forcefight; @@ -127,11 +166,12 @@ struct context_info { boolean move; boolean mv; boolean bypasses; /* bypass flag is set on at least one fobj */ - boolean botl; /* partially redo status line */ - boolean botlx; /* print an entirely new bottom line */ boolean door_opened; /* set to true if door was opened during test_move */ + boolean resume_wish; /* game was exited while in wish prompt */ + unsigned long tips; struct dig_info digging; struct victual_info victual; + struct engrave_info engraving; struct tin_info tin; struct book_info spbook; struct takeoff_info takeoff; @@ -140,8 +180,9 @@ struct context_info { struct obj_split objsplit; /* track most recently split object stack */ struct tribute_info tribute; struct novel_tracking novel; + struct achievement_tracking achieveo; + struct lifelists lifelist; + char jingle[5 + 1]; }; -extern NEARDATA struct context_info context; - #endif /* CONTEXT_H */ diff --git a/include/coord.h b/include/coord.h index e800fb876..ba8867ccd 100644 --- a/include/coord.h +++ b/include/coord.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 coord.h $NHDT-Date: 1432512778 2015/05/25 00:12:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */ +/* NetHack 5.0 coord.h $NHDT-Date: 1596498531 2020/08/03 23:48:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -7,7 +7,7 @@ #define COORD_H typedef struct nhcoord { - xchar x, y; + coordxy x, y; } coord; #endif /* COORD_H */ diff --git a/include/cstd.h b/include/cstd.h new file mode 100644 index 000000000..7b7a71497 --- /dev/null +++ b/include/cstd.h @@ -0,0 +1,68 @@ +/* NetHack 5.0 cstd.h $NHDT-Date: 1725652996 2024/09/06 20:03:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.6 $ */ +/*-Copyright (c) Robert Patrick Rankin, 2017. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef CSTD_H +#define CSTD_H + +/* + * The list of standard (C99 unless noted otherwise) header files: + * + * Conditionally compiled macro that calls abort if its + * argument evaluates to zero + * (C99) Complex number arithmetic + * Functions to categorize single characters + * Macros reporting error conditions + * (C99) Floating-point environment + * Limits of floating-point types + * (C99) Format conversion of integer types + * (C95) Alternative operator spellings + * Ranges of integer types + * Localization utilities + * Common mathematics functions + * Nonlocal jumps + * Signal handling + * Variable arguments + * (C99) Macros for boolean type + * Common macro definitions + * (C99) Fixed-width integer types + * Input/output program utilities + * General utilities: memory management, + * program utilities, string conversions, + * random numbers, algorithms + * String handling + * (C99) Type-generic math (macros wrapping math.h and + * complex.h) + * Time/date utilities + * (C95) Extended multibyte and wide character utilities + * (C95) Functions to categorize single wide character + + * We watch these and try not to conflict with them, or make it tough to adopt + * these in future: + * + * (C11) alignas and alignof convenience macros + * (C11) Atomic operations + * (C23) Macros to work with the byte and bit representations + * of types + * (C23) Macros for performing checked integer arithmetic + * (C11) noreturn convenience macro + * (C11) Thread library + * (C11) UTF-16 and UTF-32 character utilities + * + */ +#if !defined(__cplusplus) +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#else /* !__cplusplus */ +/* for FILE */ +#include +#endif /* !__cplusplus */ +#endif /* CSTD_H */ diff --git a/include/decl.h b/include/decl.h index c6e298b43..70727a2bf 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 decl.h $NHDT-Date: 1573869061 2019/11/16 01:51:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.165 $ */ +/* NetHack 5.0 decl.h $NHDT-Date: 1725653004 2024/09/06 20:03:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.377 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2007. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,283 +6,14 @@ #ifndef DECL_H #define DECL_H -#define E extern - -E int NDECL((*occupation)); -E int NDECL((*afternmv)); - -E const char *hname; -E int hackpid; -#if defined(UNIX) || defined(VMS) -E int locknum; -#endif -#ifdef DEF_PAGER -E char *catmore; -#endif /* DEF_PAGER */ - -E char SAVEF[]; -#ifdef MICRO -E char SAVEP[]; -#endif - -/* max size of a windowtype option */ -#define WINTYPELEN 16 -E char chosen_windowtype[WINTYPELEN]; - -E NEARDATA int bases[MAXOCLASSES]; - -E NEARDATA int multi; -E const char *multi_reason; -E NEARDATA int nroom; -E NEARDATA int nsubroom; -E NEARDATA int occtime; - -#define WARNCOUNT 6 /* number of different warning levels */ -E nhsym warnsyms[WARNCOUNT]; -E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */ - -E int x_maze_max, y_maze_max; -E int otg_temp; - -E NEARDATA int in_doagain; - -E struct dgn_topology { /* special dungeon levels for speed */ - d_level d_oracle_level; - d_level d_bigroom_level; /* unused */ - d_level d_rogue_level; - d_level d_medusa_level; - d_level d_stronghold_level; - d_level d_valley_level; - d_level d_wiz1_level; - d_level d_wiz2_level; - d_level d_wiz3_level; - d_level d_juiblex_level; - d_level d_orcus_level; - d_level d_baalzebub_level; /* unused */ - d_level d_asmodeus_level; /* unused */ - d_level d_portal_level; /* only in goto_level() [do.c] */ - d_level d_sanctum_level; - d_level d_earth_level; - d_level d_water_level; - d_level d_fire_level; - d_level d_air_level; - d_level d_astral_level; - xchar d_tower_dnum; - xchar d_sokoban_dnum; - xchar d_mines_dnum, d_quest_dnum; - d_level d_qstart_level, d_qlocate_level, d_nemesis_level; - d_level d_knox_level; - d_level d_mineend_level; - d_level d_sokoend_level; -} dungeon_topology; -/* macros for accessing the dungeon levels by their old names */ -/* clang-format off */ -#define oracle_level (dungeon_topology.d_oracle_level) -#define bigroom_level (dungeon_topology.d_bigroom_level) -#define rogue_level (dungeon_topology.d_rogue_level) -#define medusa_level (dungeon_topology.d_medusa_level) -#define stronghold_level (dungeon_topology.d_stronghold_level) -#define valley_level (dungeon_topology.d_valley_level) -#define wiz1_level (dungeon_topology.d_wiz1_level) -#define wiz2_level (dungeon_topology.d_wiz2_level) -#define wiz3_level (dungeon_topology.d_wiz3_level) -#define juiblex_level (dungeon_topology.d_juiblex_level) -#define orcus_level (dungeon_topology.d_orcus_level) -#define baalzebub_level (dungeon_topology.d_baalzebub_level) -#define asmodeus_level (dungeon_topology.d_asmodeus_level) -#define portal_level (dungeon_topology.d_portal_level) -#define sanctum_level (dungeon_topology.d_sanctum_level) -#define earth_level (dungeon_topology.d_earth_level) -#define water_level (dungeon_topology.d_water_level) -#define fire_level (dungeon_topology.d_fire_level) -#define air_level (dungeon_topology.d_air_level) -#define astral_level (dungeon_topology.d_astral_level) -#define tower_dnum (dungeon_topology.d_tower_dnum) -#define sokoban_dnum (dungeon_topology.d_sokoban_dnum) -#define mines_dnum (dungeon_topology.d_mines_dnum) -#define quest_dnum (dungeon_topology.d_quest_dnum) -#define qstart_level (dungeon_topology.d_qstart_level) -#define qlocate_level (dungeon_topology.d_qlocate_level) -#define nemesis_level (dungeon_topology.d_nemesis_level) -#define knox_level (dungeon_topology.d_knox_level) -#define mineend_level (dungeon_topology.d_mineend_level) -#define sokoend_level (dungeon_topology.d_sokoend_level) -/* clang-format on */ - -E NEARDATA stairway dnstair, upstair; /* stairs up and down */ -#define xdnstair (dnstair.sx) -#define ydnstair (dnstair.sy) -#define xupstair (upstair.sx) -#define yupstair (upstair.sy) - -E NEARDATA stairway dnladder, upladder; /* ladders up and down */ -#define xdnladder (dnladder.sx) -#define ydnladder (dnladder.sy) -#define xupladder (upladder.sx) -#define yupladder (upladder.sy) - -E NEARDATA stairway sstairs; - -E NEARDATA dest_area updest, dndest; /* level-change destination areas */ - -E NEARDATA coord inv_pos; -E NEARDATA dungeon dungeons[]; -E NEARDATA s_level *sp_levchn; -#define dunlev_reached(x) (dungeons[(x)->dnum].dunlev_ureached) - -#include "quest.h" -E struct q_score quest_status; - -E NEARDATA char pl_character[PL_CSIZ]; -E NEARDATA char pl_race; /* character's race */ - -E NEARDATA char pl_fruit[PL_FSIZ]; -E NEARDATA struct fruit *ffruit; - -E NEARDATA char tune[6]; - -#define MAXLINFO (MAXDUNGEON * MAXLEVEL) -E struct linfo level_info[MAXLINFO]; - -E NEARDATA struct sinfo { - int gameover; /* self explanatory? */ - int stopprint; /* inhibit further end of game disclosure */ -#ifdef HANGUPHANDLING - volatile int done_hup; /* SIGHUP or moral equivalent received - * -- no more screen output */ - int preserve_locks; /* don't remove level files prior to exit */ -#endif - int something_worth_saving; /* in case of panic */ - int panicking; /* `panic' is in progress */ - int exiting; /* an exit handler is executing */ - int in_moveloop; - int in_impossible; -#ifdef PANICLOG - int in_paniclog; -#endif - int wizkit_wishing; -} program_state; - -E boolean restoring; -E boolean ransacked; - -E const char quitchars[]; -E const char vowels[]; -E const char ynchars[]; -E const char ynqchars[]; -E const char ynaqchars[]; -E const char ynNaqchars[]; -E NEARDATA long yn_number; - -E const char disclosure_options[]; - -E NEARDATA int smeq[]; -E NEARDATA int doorindex; -E NEARDATA char *save_cm; - -E NEARDATA struct kinfo { - struct kinfo *next; /* chain of delayed killers */ - int id; /* uprop keys to ID a delayed killer */ - int format; /* one of the killer formats */ -#define KILLED_BY_AN 0 -#define KILLED_BY 1 -#define NO_KILLER_PREFIX 2 - char name[BUFSZ]; /* actual killer name */ -} killer; - -E long done_money; -E NEARDATA char plname[PL_NSIZ]; -E NEARDATA char dogname[]; -E NEARDATA char catname[]; -E NEARDATA char horsename[]; -E char preferred_pet; -E const char *occtxt; /* defined when occupation != NULL */ -E const char *nomovemsg; -E char lock[]; - -E const schar xdir[], ydir[], zdir[]; - -E NEARDATA schar tbx, tby; /* set in mthrowu.c */ - -E NEARDATA struct multishot { - int n, i; - short o; - boolean s; -} m_shot; - -E NEARDATA long moves, monstermoves; -E NEARDATA long wailmsg; - -E NEARDATA boolean in_mklev; -E NEARDATA boolean stoned; -E NEARDATA boolean unweapon; -E NEARDATA boolean mrg_to_wielded; -E NEARDATA boolean defer_see_monsters; - -E NEARDATA boolean in_steed_dismounting; -E NEARDATA boolean has_strong_rngseed; - -E const int shield_static[]; - -#include "spell.h" -E NEARDATA struct spell spl_book[]; /* sized in decl.c */ - -#include "color.h" -#ifdef TEXTCOLOR -E const int zapcolors[]; -#endif - -E const struct class_sym def_oc_syms[MAXOCLASSES]; /* default class symbols */ -E uchar oc_syms[MAXOCLASSES]; /* current class symbols */ -E const struct class_sym def_monsyms[MAXMCLASSES]; /* default class symbols */ -E uchar monsyms[MAXMCLASSES]; /* current class symbols */ - -#include "obj.h" -E NEARDATA struct obj *invent, *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf, - *uarmu, /* under-wear, so to speak */ - *uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver; - -E NEARDATA struct obj *uchain; /* defined only when punished */ -E NEARDATA struct obj *uball; -E NEARDATA struct obj *migrating_objs; -E NEARDATA struct obj *billobjs; -E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj; - -E NEARDATA const struct obj zeroobj; /* for init; also, &zeroobj is used - * as special value */ - -E NEARDATA const anything zeroany; /* init'd and defined in decl.c */ - -#include "you.h" -E NEARDATA struct you u; -E NEARDATA time_t ubirthday; -E NEARDATA struct u_realtime urealtime; - -#include "onames.h" -#ifndef PM_H /* (pm.h has already been included via youprop.h) */ -#include "pm.h" -#endif - -E NEARDATA const struct monst zeromonst; /* for init of new or temp monsters */ -E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */ -E NEARDATA struct monst *mydogs, *migrating_mons; - -E NEARDATA struct mvitals { - uchar born; - uchar died; - uchar mvflags; -} mvitals[NUMMONS]; +/* The names of the colors used for gems, etc. */ +extern const char *c_obj_colors[]; -E NEARDATA long domove_attempting; -E NEARDATA long domove_succeeded; -#define DOMOVE_WALK 0x00000001 -#define DOMOVE_RUSH 0x00000002 +/* lua callback queue names */ +extern const char * const nhcb_name[]; +extern int nhcb_counts[]; -E NEARDATA struct c_color_names { - const char *const c_black, *const c_amber, *const c_golden, - *const c_light_blue, *const c_red, *const c_green, *const c_silver, - *const c_blue, *const c_purple, *const c_white, *const c_orange; -} c_color_names; +extern NEARDATA const struct c_color_names c_color_names; #define NH_BLACK c_color_names.c_black #define NH_AMBER c_color_names.c_amber #define NH_GOLDEN c_color_names.c_golden @@ -295,17 +26,10 @@ E NEARDATA struct c_color_names { #define NH_WHITE c_color_names.c_white #define NH_ORANGE c_color_names.c_orange -/* The names of the colors used for gems, etc. */ -E const char *c_obj_colors[]; - -E struct c_common_strings { - const char *const c_nothing_happens, *const c_thats_enough_tries, - *const c_silly_thing_to, *const c_shudder_for_moment, - *const c_something, *const c_Something, *const c_You_can_move_again, - *const c_Never_mind, *c_vision_clears, *const c_the_your[2], - *const c_fakename[2]; -} c_common_strings; +/* common_strings */ +extern const struct c_common_strings c_common_strings; #define nothing_happens c_common_strings.c_nothing_happens +#define nothing_seems_to_happen c_common_strings.c_nothing_seems_to_happen #define thats_enough_tries c_common_strings.c_thats_enough_tries #define silly_thing_to c_common_strings.c_silly_thing_to #define shudder_for_moment c_common_strings.c_shudder_for_moment @@ -319,150 +43,1257 @@ E struct c_common_strings { name ending in 's' */ #define fakename c_common_strings.c_fakename +/* default object class symbols */ +extern const struct class_sym def_oc_syms[MAXOCLASSES]; + +/* default mon class symbols */ +extern const struct class_sym def_monsyms[MAXMCLASSES]; + +extern const char disclosure_options[]; + +/* empty string that is non-const for parameter use */ +extern char emptystr[]; + +#ifdef WIN32 +extern boolean fqn_prefix_locked[PREFIX_COUNT]; +#endif +#ifdef PREFIXES_IN_USE +extern const char *fqn_prefix_names[PREFIX_COUNT]; +#endif + +extern NEARDATA boolean has_strong_rngseed; +extern struct engr *head_engr; + +/* used by coloratt.c, options.c, utf8map.c, windows.c */ +extern const char hexdd[33]; + /* material strings */ -E const char *materialnm[]; - -/* Monster name articles */ -#define ARTICLE_NONE 0 -#define ARTICLE_THE 1 -#define ARTICLE_A 2 -#define ARTICLE_YOUR 3 - -/* Monster name suppress masks */ -#define SUPPRESS_IT 0x01 -#define SUPPRESS_INVISIBLE 0x02 -#define SUPPRESS_HALLUCINATION 0x04 -#define SUPPRESS_SADDLE 0x08 -#define EXACT_NAME 0x0F -#define SUPPRESS_NAME 0x10 - -/* Vision */ -E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */ -E NEARDATA char **viz_array; /* could see/in sight row pointers */ +extern const char *materialnm[]; + +/* current mon class symbols */ +extern uchar monsyms[MAXMCLASSES]; + +/* current object class symbols */ +extern uchar oc_syms[MAXOCLASSES]; + +extern const char quitchars[]; +extern NEARDATA char tune[6]; +extern const schar xdir[], ydir[], zdir[], dirs_ord[]; +extern const char vowels[]; +extern const char ynchars[]; +extern const char ynqchars[]; +extern const char ynaqchars[]; +extern const char ynNaqchars[]; +extern const char rightleftchars[]; +extern const char hidespinchars[]; +extern NEARDATA long yn_number; +extern struct restore_info restoreinfo; +extern NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo; +extern const int shield_static[]; + +extern NEARDATA struct obj *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf, + *uarmu, /* under-wear, so to speak */ + *uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver; +extern NEARDATA struct obj *uchain; /* defined only when punished */ +extern NEARDATA struct obj *uball; +extern NEARDATA struct you u; +extern NEARDATA time_t ubirthday; +extern NEARDATA struct u_realtime urealtime; /* Window system stuff */ -E NEARDATA winid WIN_MESSAGE; -E NEARDATA winid WIN_STATUS; -E NEARDATA winid WIN_MAP, WIN_INVEN; - -/* pline (et al) for a single string argument (suppress compiler warning) */ -#define pline1(cstr) pline("%s", cstr) -#define Your1(cstr) Your("%s", cstr) -#define You1(cstr) You("%s", cstr) -#define verbalize1(cstr) verbalize("%s", cstr) -#define You_hear1(cstr) You_hear("%s", cstr) -#define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr) -#define panic1(cstr) panic("%s", cstr) - -E char toplines[]; +extern NEARDATA winid WIN_MESSAGE; +extern NEARDATA winid WIN_STATUS; +extern NEARDATA winid WIN_MAP, WIN_INVEN; + #ifndef TCAP_H -E struct tc_gbl_data { /* also declared in tcap.h */ +extern struct tc_gbl_data { /* also declared in tcap.h */ char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */ int tc_LI, tc_CO; /* lines and columns */ } tc_gbl_data; -#define AS tc_gbl_data.tc_AS -#define AE tc_gbl_data.tc_AE -#define LI tc_gbl_data.tc_LI -#define CO tc_gbl_data.tc_CO +#define AS gt.tc_gbl_data.tc_AS +#define AE gt.tc_gbl_data.tc_AE +#define LI gt.tc_gbl_data.tc_LI +#define CO gt.tc_gbl_data.tc_CO #endif -/* xxxexplain[] is in drawing.c */ -E const char *const monexplain[], invisexplain[], *const oclass_names[]; +#ifdef PANICTRACE +extern const char *ARGV0; +#endif -/* Some systems want to use full pathnames for some subsets of file names, - * rather than assuming that they're all in the current directory. This - * provides all the subclasses that seem reasonable, and sets up for all - * prefixes being null. Port code can set those that it wants. +struct display_hints { + boolean botl; /* partially redo status line */ + boolean botlx; /* print an entirely new bottom line */ + boolean time_botl; /* context.botl for 'time' (moves) only */ +}; +extern struct display_hints disp; + +/* + * 'gX' -- instance_globals holds engine state that does not need to be + * persisted upon game exit. The initialization state is well defined + * and set in decl.c during early early engine initialization. + * + * Unlike instance_flags, values in the structure can be of any type. + * + * Pulled from other files to be grouped in one place. Some comments + * which came with them don't make much sense out of their original context. */ -#define HACKPREFIX 0 -#define LEVELPREFIX 1 -#define SAVEPREFIX 2 -#define BONESPREFIX 3 -#define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */ -#define SCOREPREFIX 5 -#define LOCKPREFIX 6 -#define SYSCONFPREFIX 7 -#define CONFIGPREFIX 8 -#define TROUBLEPREFIX 9 -#define PREFIX_COUNT 10 -/* used in files.c; xxconf.h can override if needed */ -#ifndef FQN_MAX_FILENAME -#define FQN_MAX_FILENAME 512 + +struct instance_globals_a { + /* decl.c */ + int (*afternmv)(void); + + /* detect.c */ + int already_found_flag; /* used to augment first "already found a monster" + * message if 'cmdassist' is Off */ + /* do.c */ + boolean at_ladder; + + /* dog.c */ + struct autopickup_exception *apelist; + + /* end.c */ + struct valuable_data amulets[LAST_AMULET + 1 - FIRST_AMULET]; + + /* mon.c */ + short *animal_list; /* list of PM values for animal monsters */ + int animal_list_count; + +#ifdef CHANGE_COLOR + /* options.c */ + uint32 altpalette[CLR_MAX]; #endif -#if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND) -/* the bare-bones stuff is unconditional above to simplify coding; for - * ports that actually use prefixes, add some more localized things - */ -#define PREFIXES_IN_USE + /* pickup.c */ + int A_first_hint; /* menustyle:Full plus 'A' response + !paranoid:A */ + int A_second_hint; /* menustyle:Full plus 'A' response + paranoid:A */ + boolean abort_looting; + + /* shk.c */ + boolean auto_credit; + + /* sounds.c */ + enum soundlib_ids active_soundlib; + + /* trap.c */ + /* context for water_damage(), managed by water_damage_chain(); + when more than one stack of potions of acid explode while processing + a chain of objects, use alternate phrasing after the first message */ + struct h2o_ctx acid_ctx; + + boolean havestate; +}; + +struct instance_globals_b { + + /* botl.c */ + struct istat_s blstats[2][MAXBLSTATS]; + boolean blinit; +#ifdef STATUS_HILITES + long bl_hilite_moves; #endif -E char *fqn_prefix[PREFIX_COUNT]; -#ifdef WIN32 -E boolean fqn_prefix_locked[PREFIX_COUNT]; + /* decl.c */ + coord bhitpos; /* place where throw or zap hits or stops */ + struct obj *billobjs; /* objects not yet paid for */ + + /* files.c */ + char bones[BONESSIZE]; + + /* hack.c */ + unsigned bldrpush_oid; /* id of last boulder pushed */ + long bldrpushtime; /* turn that a message was given for pushing + * a boulder; used in lieu of Norep() */ + + /* mkmaze.c */ + lev_region bughack; /* for preserving the insect legs when wallifying + * baalz level */ + + /* pickup.c */ + boolean bucx_filter; + + /* zap.c */ + struct monst *buzzer; /* zapper/caster/breather who initiates buzz() */ + + /* new */ + boolean bot_disabled; + + boolean havestate; +}; + +struct instance_globals_c { + + struct _cmd_queue *command_queue[NUM_CQS]; + + /* botl.c */ + unsigned long cond_hilites[BL_ATTCLR_MAX]; + int condmenu_sortorder; + + /* cmd.c */ + struct cmd Cmd; /* flag.h */ + /* Provide a means to redo the last command. The flag `in_doagain' + (decl.c below) is set to true while redoing the command. This flag + is tested in commands that require additional input (like `throw' + which requires a thing and a direction), and the input prompt is + not shown. Also, while in_doagain is TRUE, no keystrokes can be + saved into the saveq. */ + coord clicklook_cc; + /* decl.c */ + char chosen_windowtype[WINTYPELEN]; + int cmd_key; /* parse() / rhack() */ + struct Cmd_bind *cmd_bind; + cmdcount_nht command_count; + /* some objects need special handling during destruction or placement */ + struct obj *current_wand; /* wand currently zapped/applied */ +#ifdef DEF_PAGER + const char *catmore; /* external pager; from getenv() or DEF_PAGER */ #endif -#ifdef PREFIXES_IN_USE -E const char *fqn_prefix_names[PREFIX_COUNT]; + + /* dog.c */ + char catname[PL_PSIZ]; + + /* end.c */ + char *crash_email; // email for crash reports + char *crash_name; // human name for crash reports + int crash_urlmax; // maximum length for the url of a crash report + + /* symbols.c */ + int currentgraphics; + + /* files.c, cfgfiles.c */ + char *cmdline_rcfile; /* set in unixmain.c, used in options.c */ + char *config_section_chosen; + char *config_section_current; + boolean chosen_symset_start; + boolean chosen_symset_end; + + /* invent.c */ + /* for perm_invent when operating on a partial inventory display, so that + persistent one doesn't get shrunk during filtering for item selection + then regrown to full inventory, possibly being resized in process */ + winid cached_pickinv_win; + int core_invent_state; + + /* options.c */ + char *cmdline_windowsys; /* set in unixmain.c */ + struct menucoloring *color_colorings; /* alternate set of menu colors */ + + /* pickup.c */ + /* current_container is set in use_container(), to be used by the + callback routines in_container() and out_container() from askchain() + and use_container(). Also used by menu_loot() and container_gone(). */ + struct obj *current_container; + boolean class_filter; + + /* questpgr.c */ + char cvt_buf[CVT_BUF_SIZE]; + + /* sounds.c */ + enum soundlib_ids chosen_soundlib; + + /* sp_lev.c */ + struct sp_coder *coder; + + /* uhitm.c */ + short corpsenm_digested; /* monster type being digested, set by gulpum */ + + /* zap.c */ + /* new */ + boolean converted_savefile_loaded; + + boolean havestate; +}; + +struct instance_globals_d { + + /* decl.c */ + int doorindex; + long done_money; + long domove_attempting; + long domove_succeeded; +#define DOMOVE_WALK 0x00000001 +#define DOMOVE_RUSH 0x00000002 + boolean defer_see_monsters; + + /* dig.c */ + boolean did_dig_msg; + + /* do.c */ + char *dfr_pre_msg; /* pline() before level change */ + char *dfr_post_msg; /* pline() after level change */ + int did_nothing_flag; /* to augment the no-rest-next-to-monster message */ + + /* dog.c */ + char dogname[PL_PSIZ]; + + /* end.c */ + long done_seq; /* for counting deaths occurring on same hero_seq */ + + /* mon.c */ + boolean disintegested; + + /* objname.c */ + /* distantname used by distant_name() to pass extra information to + xname_flags(); it would be much cleaner if this were a parameter, + but that would require all xname() and doname() calls to be modified */ + int distantname; + + /* pickup.c */ + boolean decor_fumble_override; + boolean decor_levitate_override; + + /* new */ + boolean deferred_showpaths; + char *deferred_showpaths_dir; + + boolean havestate; +}; + +struct instance_globals_e { + + /* cmd.c */ + winid en_win; + boolean en_via_menu; + struct ext_func_tab *ext_tlist; /* info for rhack() from doextcmd() */ + + /* eat.c */ + char *eatmbuf; /* set by cpostfx() */ + + /* mkmaze.c */ + struct bubble *ebubbles; + + /* new stuff */ + int early_raw_messages; /* if raw_prints occurred early prior + to gb.beyond_savefile_load */ + + boolean havestate; +}; + +struct instance_globals_f { + + /* decl.c */ + struct trap *ftrap; + char *fqn_prefix[PREFIX_COUNT]; + struct fruit *ffruit; + + /* eat.c */ + boolean force_save_hs; + + /* mhitm.c */ + boolean far_noise; + + /* rumors.c */ + long false_rumor_size; + unsigned long false_rumor_start; + long false_rumor_end; + + /* shk.c */ + long int followmsg; /* last time of follow message */ + + boolean havestate; +}; + +struct instance_globals_g { + + /* display.c */ + gbuf_entry gbuf[ROWNO][COLNO]; + coordxy gbuf_start[ROWNO]; + coordxy gbuf_stop[ROWNO]; + + /* do_name.c */ + coordxy getposx, getposy; /* cursor position in case of async resize */ + struct selectionvar *gloc_filter_map; + int gloc_filter_floodfill_match_glyph; + + /* dog.c */ + xint16 gtyp; /* type of dog's current goal */ + coordxy gx; /* x position of dog's current goal */ + coordxy gy; /* y position of dog's current goal */ + + /* dokick.c */ + const char *gate_str; + + /* end.c */ + /* 1st +1: subtracting first from last, 2nd +1: one slot for all glass */ + struct valuable_data gems[LAST_REAL_GEM + 1 - FIRST_REAL_GEM + 1]; + + /* invent.c */ + long glyph_reset_timestamp; + + /* nhlua.c */ + boolean gmst_stored; + long gmst_moves; + struct obj *gmst_invent; + genericptr_t *gmst_ubak, *gmst_disco, *gmst_mvitals; + struct spell gmst_spl_book[MAXSPELL + 1]; + + /* pline.c */ + struct gamelog_line *gamelog; + + /* region.c */ + boolean gas_cloud_diss_within; + int gas_cloud_diss_seen; + + /* new stuff */ + /* per-level glyph mapping flags */ + long glyphmap_perlevel_flags; + + boolean havestate; +}; + +struct instance_globals_h { + + /* decl.c */ + const char *hname; /* name of the game (argv[0] of main) */ +#if defined(MICRO) || defined(WIN32) + char hackdir[PATHLEN]; /* where rumors, help, record are */ +#endif /* MICRO || WIN32 */ + long hero_seq; /* 'moves*8 + n' where n is updated each hero move during + * the current turn */ + + /* dog.c */ + char horsename[PL_PSIZ]; + + /* mhitu.c */ + unsigned hitmsg_mid; + struct attack *hitmsg_prev; + + boolean havestate; +}; + +struct instance_globals_i { + + /* decl.c */ + int in_doagain; + boolean in_mklev; + boolean in_steed_dismounting; + struct obj *invent; + + /* do_wear.c */ + /* starting equipment gets auto-worn at beginning of new game, + and we don't want stealth or displacement feedback then */ + boolean initial_don; /* manipulated in set_wear() */ + + /* invent.c */ + char *invbuf; + unsigned invbufsiz; + boolean item_action_in_progress; + int in_sync_perminvent; + + /* mon.c */ + struct monst **itermonarr; /* temporary array of all N monsters + * on the current level */ + + /* restore.c */ + struct bucket *id_map; + + /* sp_lev.c */ + boolean in_mk_themerooms; + + /* new */ + + boolean havestate; +}; + +struct instance_globals_j { + + /* apply.c */ + int jumping_is_magic; /* current jump result of magic */ + + boolean havestate; +}; + +struct instance_globals_k { + + coord kickedloc; /* location hero just kicked */ + + /* decl.c */ + struct obj *kickedobj; /* object in flight due to kicking */ + + /* read.c */ + boolean known; + + boolean havestate; +}; + +struct instance_globals_l { + + /* cmd.c */ + cmdcount_nht last_command_count; + + /* decl.c (before being incorporated into instance_globals_*) */ +#if defined(UNIX) || defined(VMS) + int locknum; /* max num of simultaneous users */ #endif +#ifdef MICRO + char levels[PATHLEN]; /* where levels are */ +#endif /* MICRO */ + + /* files.c */ + int lockptr; + char lock[LOCKNAMESIZE]; + + /* invent.c */ + int lastinvnr; /* 0 ... 51 (never saved&restored) */ + + /* light.c */ + light_source *light_base; + + /* mklev.c */ + genericptr_t luathemes[MAXDUNGEON]; + + /* mon.c */ + unsigned last_hider; /* m_id of hides-under mon seen going into hiding */ + + /* nhlan.c */ +#ifdef MAX_LAN_USERNAME + char lusername[MAX_LAN_USERNAME]; + int lusername_size; +#endif + + /* nhlua.c */ + genericptr_t luacore; /* lua_State * */ + char lua_warnbuf[BUFSZ]; + int loglua; + int lua_sid; + + /* options.c */ + boolean loot_reset_justpicked; + + /* save.c */ + struct obj *looseball; /* track uball during save and... */ + struct obj *loosechain; /* track uchain since saving might free it */ + + /* sp_lev.c */ + char *lev_message; + lev_region *lregions; + + /* trap.c */ + struct launchplace launchplace; + + /* windows.c */ + struct win_choices *last_winchoice; + + /* new stuff */ + char lua_ver[LUA_VER_BUFSIZ]; + char lua_copyright[LUA_COPYRIGHT_BUFSIZ]; + + boolean havestate; +}; -E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo; +struct instance_globals_m { -struct opvar { - xchar spovartyp; /* one of SPOVAR_foo */ - union { - char *str; - long l; - } vardata; + /* apply.c */ + int mkot_trap_warn_count; + + /* botl.c */ + int mrank_sz; /* loaded by max_rank_sz */ + + /* decl.c */ + cmdcount_nht multi; + const char *multi_reason; + char multireasonbuf[QBUFSZ]; /* note: smaller than usual [BUFSZ] */ + /* for xname handling of multiple shot missile volleys: + number of shots, index of current one, validity check, shoot vs throw */ + struct multishot m_shot; + boolean mrg_to_wielded; /* weapon picked is merged with wielded one */ + struct menucoloring *menu_colorings; + struct obj *migrating_objs; /* objects moving to another dungeon level */ + + /* dog.c */ + struct monst *mydogs; /* monsters that went down/up together with @ */ + struct monst *migrating_mons; /* monsters moving to another level */ + + /* dokick.c */ + struct rm *maploc; + + /* mhitm.c */ + struct monst *mswallower; /* for gas spore explosion when it's swallowed*/ + + /* mhitu.c */ + int mhitu_dieroll; + + /* mklev.c */ + boolean made_branch; /* used only during level creation */ + + /* mkmap.c */ + coordxy min_rx; /* rectangle bounds for regions */ + coordxy max_rx; + coordxy min_ry; + coordxy max_ry; + + /* mkobj.c */ + boolean mkcorpstat_norevive; /* for trolls */ + + /* mthrowu.c */ + int mesg_given; /* for m_throw()/thitu() 'miss' message */ + struct monst *mtarget; /* monster being shot by another monster */ + struct monst *marcher; /* monster that is shooting */ + + /* muse.c */ + boolean m_using; /* kludge to use mondied instead of killed */ + struct musable m; + + /* options.c */ + /* Allow the user to map incoming characters to various menu commands. */ + char mapped_menu_cmds[MAX_MENU_MAPPED_CMDS + 1]; /* exported */ + char mapped_menu_op[MAX_MENU_MAPPED_CMDS + 1]; + + /* region.c */ + int max_regions; + + /* trap.c */ + boolean mentioned_water; /* set to True by water_damage() if it issues + * a message about water; dodip() should make + * POT_WATER should become discovered */ + + boolean havestate; }; -struct autopickup_exception { - struct nhregex *regex; - char *pattern; - boolean grab; - struct autopickup_exception *next; +struct instance_globals_n { + + /* botl.c */ + int now_or_before_idx; /* 0..1 for array[2][] first index */ + + /* decl.c */ + const char *nomovemsg; + int nsubroom; + + /* dokick.c */ + struct rm nowhere; + + /* files.c */ + int nesting; + int no_sound_notified; /* run-time option processing: warn once if built + * without USER_SOUNDS and config file contains + * SOUND=foo or SOUNDDIR=bar */ + + /* mhitm.c */ + long noisetime; + + /* mkmap.c */ + char *new_locations; + int n_loc_filled; + + /* options.c */ + short n_menu_mapped; + + /* potion.c */ + boolean notonhead; /* for long worms */ + + /* questpgr.c */ + char nambuf[CVT_BUF_SIZE]; + + /* restore.c */ + int n_ids_mapped; + + /* sp_lev.c */ + int num_lregions; + + /* u_init.c */ + short nocreate; + short nocreate2; + short nocreate3; + short nocreate4; + + boolean havestate; }; -E struct autopickup_exception *apelist; -struct plinemsg_type { - xchar msgtype; /* one of MSGTYP_foo */ - struct nhregex *regex; - char *pattern; - struct plinemsg_type *next; +struct instance_globals_o { + + struct obj *objs_deleted; + + /* dbridge.c */ + struct entity occupants[ENTITIES]; + + /* decl.c */ + int (*occupation)(void); + int occtime; + int otg_temp; /* used by object_to_glyph() [otg] */ + struct obj *otg_otmp; /* used by obj_is_piletop() */ + const char *occtxt; /* defined when occupation != NULL */ + + /* symbols.c */ + nhsym ov_primary_syms[SYM_MAX]; /* loaded primary symbols */ + nhsym ov_rogue_syms[SYM_MAX]; /* loaded rogue symbols */ + + /* invent.c */ + /* query objlist callback: return TRUE if obj is at given location */ + coord only; + + /* o_init.c */ + short oclass_prob_totals[MAXOCLASSES]; + + /* options.c */ + + /* builtin_opt, syscf_, rc_file_, environ_, play_opt */ + enum option_phases opt_phase; + boolean opt_initial; + boolean opt_from_file; + boolean opt_need_redraw; /* for doset() */ + boolean opt_need_glyph_reset; + boolean opt_need_promptstyle; + boolean opt_reset_customcolors; + boolean opt_reset_customsymbols; + boolean opt_update_basic_palette; + boolean opt_symset_changed; + + /* pickup.c */ + int oldcap; /* last encumbrance */ + + /* restore.c */ + struct fruit *oldfruit; + + /* rumors.c */ + int oracle_flg; /* -1=>don't use, 0=>need init, 1=>init done */ + + /* uhitm.c */ + boolean override_confirmation; /* Used to flag attacks caused by + * Stormbringer's maliciousness. */ + /* zap.c */ + boolean obj_zapped; + + boolean havestate; }; -#define MSGTYP_NORMAL 0 -#define MSGTYP_NOREP 1 -#define MSGTYP_NOSHOW 2 -#define MSGTYP_STOP 3 -/* bitmask for callers of hide_unhide_msgtypes() */ -#define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW)) +struct instance_globals_p { + + /* apply.c */ + int polearm_range_min; + int polearm_range_max; + + /* decl.c */ + int plnamelen; /* length of plname[] if that came from getlogin() */ + char pl_race; /* character's race */ + struct plinemsg_type *plinemsg_types; + + /* dog.c */ + int petname_used; /* user preferred pet name has been used */ + char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */ -E struct plinemsg_type *plinemsg_types; + /* symbols.c */ + nhsym primary_syms[SYM_MAX]; /* loaded primary symbols */ -enum bcargs {override_restriction = -1}; -struct breadcrumbs { - const char *funcnm; - int linenum; - boolean in_effect; + /* invent.c */ + int perm_invent_toggling_direction; + + /* pickup.c */ + boolean picked_filter; + int pickup_encumbrance; /* when picking up multiple items in a single + * operation, encumbrance after previous item */ + + /* pline.c */ + unsigned pline_flags; + char prevmsg[BUFSZ]; + + /* potion.c */ + int potion_nothing; + int potion_unkn; + + /* pray.c */ + /* values calculated when prayer starts, and used when completed */ + aligntyp p_aligntyp; + int p_trouble; + int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */ + + /* weapon.c */ + struct obj *propellor; + + /* zap.c */ + int poly_zapped; + + /* new stuff */ + boolean havestate; }; -#ifdef PANICTRACE -E const char *ARGV0; +struct instance_globals_q { + + boolean havestate; +}; + +struct instance_globals_r { + + /* symbols.c */ + nhsym rogue_syms[SYM_MAX]; /* loaded rogue symbols */ + + /* extralev.c */ + struct rogueroom r[3][3]; + + /* mkmaze.c */ + boolean ransacked; + + /* region.c */ + NhRegion **regions; + + /* rip.c */ + char **rip; + + /* role.c */ + char role_pa[NUM_BP]; + char role_post_attribs; + struct role_filter rfilter; + + /* shk.c */ + struct repo repo; + + boolean havestate; +}; + +struct instance_globals_s { + + /* artifact.c */ + int spec_dbon_applies; /* coordinate effects from spec_dbon() with + messages in artifact_hit() */ + + /* decl.c */ + stairway *stairs; + int smeq[MAXNROFROOMS + 1]; + boolean stoned; /* done to monsters hit by 'c' */ + struct mkroom *subrooms; + + /* do.c */ + d_level save_dlevel; /* ? [even back in 3.4.3, only used in bones.c] */ + + /* symbols.c */ + struct symsetentry symset[NUM_GRAPHICS]; + /* adds UNICODESET */ + struct symset_customization + sym_customizations[NUM_GRAPHICS + 1][custom_count]; + nhsym showsyms[SYM_MAX]; /* symbols to be displayed */ + + /* files.c */ + int symset_count; /* for pick-list building only */ + int symset_which_set; + /* SAVESIZE, BONESSIZE, LOCKNAMESIZE are defined in "fnamesiz.h" */ + char SAVEF[SAVESIZE]; /* relative path of save file from playground */ +#ifdef MICRO + char SAVEP[SAVESIZE]; /* holds path of directory for save file */ #endif -enum earlyarg {ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS -#ifdef WIN32 - ,ARG_WINDOWS + /* invent.c */ + unsigned sortlootmode; /* set by sortloot() for use by sortloot_cmp(); + * reset by sortloot when done */ + /* mhitm.c */ + boolean skipdrin; /* mind flayer against headless target */ + + /* mon.c */ + boolean somebody_can_move; + + /* options.c */ + struct symsetentry *symset_list; /* files.c will populate this with + * list of available sets */ + boolean save_menucolors; /* copy of iflags.use_menu_colors */ + struct menucoloring *save_colorings; /* copy of gm.menu_colorings */ + boolean simple_options_help; + + /* pickup.c */ + boolean sellobj_first; /* True => need sellobj_state(); False => don't */ + boolean shop_filter; + + /* pline.c */ +#ifdef DUMPLOG_CORE + unsigned saved_pline_index; /* slot in saved_plines[] to use next */ + char *saved_plines[DUMPLOG_MSG_COUNT]; #endif + + /* polyself.c */ + int sex_change_ok; /* controls whether taking on new form or becoming new + man can also change sex (ought to be an arg to + polymon() and newman() instead) */ + + /* shk.c */ + /* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */ + char sell_response; + int sell_how; + + /* spells.c */ + int spl_sortmode; /* index into spl_sortchoices[] */ + int *spl_orderindx; /* array of svs.spl_book[] indices */ + + /* steal.c */ + unsigned int stealoid; /* object to be stolen */ + unsigned int stealmid; /* monster doing the stealing */ + + /* vision.c */ + int seethru; /* 'bubble' debugging: clouds and water don't block light */ + + boolean havestate; +}; + +struct instance_globals_t { + + /* apply.c */ + struct trapinfo trapinfo; + + /* decl.c */ + schar tbx; /* mthrowu: target x */ + schar tby; /* mthrowu: target y */ + char toplines[TBUFSZ]; + struct obj *thrownobj; /* object in flight due to throwing */ + /* Windowing stuff that's really tty oriented, but present for all ports */ + struct tc_gbl_data tc_gbl_data; /* AS,AE, LI,CO */ + + /* hack.c */ + anything tmp_anything; + struct selectionvar *travelmap; + + /* invent.c */ + /* query objlist callback: return TRUE if obj type matches "this_type" */ + int this_type; + const char *this_title; /* title for inventory list of specific type */ + + /* muse.c */ + coordxy trapx; + coordxy trapy; + + /* rumors.c */ + long true_rumor_size; /* rumor size variables are signed so that value -1 + * can be used as a flag */ + unsigned long true_rumor_start; /* rumor start offsets are unsigned due + * to use of %lx format */ + long true_rumor_end; /* rumor end offsets are signed because they're + * compared with [dlb_]ftell() */ + + /* sp_lev.c */ + boolean themeroom_failed; + + /* timeout.c */ + /* ordered timer list */ + struct fe *timer_base; /* "active" */ + + /* topten.c */ + winid toptenwin; + + /* uhitm.c */ + int twohits; /* 0: single hit; 1: first of 2; 2: second of 2 */ + + boolean havestate; +}; + +struct instance_globals_u { + + /* botl.c */ + boolean update_all; + + /* decl.c */ + boolean unweapon; + + /* role.c */ + struct Role urole; /* player's role. May be munged in role_init() */ + struct Race urace; /* player's race. May be munged in role_init() */ + + /* save.c */ + d_level uz_save; + + /* new stuff */ + boolean havestate; +}; + +struct instance_globals_v { + + /* botl.c */ + boolean valset[MAXBLSTATS]; + + /* end.c */ + struct val_list valuables[3]; + + /* mhitm.c */ + boolean vis; + + /* mklev.c */ + coordxy vault_x; + coordxy vault_y; + + /* mon.c */ + boolean vamp_rise_msg; + + /* pickup.c */ + long val_for_n_or_more; + /* list of menu classes for query_objlist() and allow_category callback + (with room for all object classes, 'u'npaid, BUCX, and terminator) */ + char valid_menu_classes[MAXOCLASSES + 1 + 4 + 1]; + + /* vision.c */ + seenV **viz_array; /* used in cansee() and couldsee() macros */ + coordxy *viz_rmin; /* min could see indices */ + coordxy *viz_rmax; /* max could see indices */ + boolean vision_full_recalc; + + /* new stuff */ + struct sound_voice voice; + + boolean havestate; +}; + +struct instance_globals_w { + + /* decl.c */ + int warn_obj_cnt; /* count of monsters meeting criteria */ + long wailmsg; + + /* do_wear.c */ + uint8 wasinwater; + + /* symbols.c */ + nhsym warnsyms[WARNCOUNT]; /* the current warning display symbols */ + + /* files.c */ + char wizkit[WIZKIT_MAX]; + + /* hack.c */ + int wc; /* current weight_cap(); valid after call to inv_weight() */ + + /* mkmaze.c */ + struct trap *wportal; + + /* new */ + struct win_settings wsettings; /* wintype.h */ + long were_changes; /* were.c, allmain.c */ + + boolean havestate; +}; + +struct instance_globals_x { + + /* decl.c */ + int x_maze_max; + + /* lock.c */ + struct xlock_s xlock; + + /* objnam.c */ + char *xnamep; /* obuf[] returned by xname(), for use in doname() for + * bounds checking; differs from xname() return value + * due to reserving PREFIX bytes at start and possibly + * skipping leading "the " after constructing result */ + + /* sp_lev.c */ + coordxy xstart, xsize; + + boolean havestate; }; -struct early_opt { - enum earlyarg e; - const char *name; - int minlength; - boolean valallowed; +struct instance_globals_y { + + /* decl.c */ + int y_maze_max; + struct monst youmonst; + + /* pline.c */ + /* work buffer for You(), &c and verbalize() */ + char *you_buf; + int you_buf_siz; + + /* sp_lev.c */ + coordxy ystart, ysize; + + boolean havestate; }; -#undef E +struct instance_globals_z { + + /* mon.c */ + boolean zombify; + + /* muse.c */ + boolean zap_oseen; /* for wands which use mbhitm and are zapped at + * players. We usually want an oseen local to + * the function, but this is impossible since the + * function mbhitm has to be compatible with the + * normal zap routines, and those routines don't + * remember who zapped the wand. */ + + boolean havestate; +}; + +struct instance_globals_saved_b { + /* dungeon.c */ + branch *branches; /* dungeon branch list */ + /* mkmaze.c */ + struct bubble *bbubbles; + /* o_init.c */ + int bases[MAXOCLASSES + 2]; /* make bases[MAXOCLASSES+1] available */ +}; + +struct instance_globals_saved_c { + /* decl.c */ + struct context_info context; +}; + +struct instance_globals_saved_d { + /* dungeon.c */ + dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */ + struct dgn_topology dungeon_topology; + /* decl.c */ + dest_area dndest; + coord *doors; /* array of door locations */ + int doors_alloc; /* doors-array allocated size */ + /* o_init.c */ + short disco[NUM_OBJECTS]; +}; + +struct instance_globals_saved_e { + /* decl.c */ + struct exclusion_zone *exclusion_zones; +}; + +struct instance_globals_saved_h { + /* decl.c */ + int hackpid; /* current process id */ +}; + +struct instance_globals_saved_i { + /* decl.c */ + coord inv_pos; +}; + +struct instance_globals_saved_k { + /* decl.c */ + struct kinfo killer; +}; + +struct instance_globals_saved_l { + /* decl.c */ + schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */ + dlevel_t level; /* level map */ + struct linfo level_info[MAXLINFO]; +}; + +struct instance_globals_saved_m { + /* dungeon.c */ + mapseen *mapseenchn; /*DUNGEON_OVERVIEW*/ + /* decl.c */ + long moves; /* turn counter */ + struct mvitals mvitals[NUMMONS]; +}; + +struct instance_globals_saved_n { + /* dungeon.c */ + int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */ + /* files.c */ + char nhuuid[NHUUIDSZ]; + /* mkroom.c */ + int nroom; + /* region.c */ + int n_regions; +}; + +struct instance_globals_saved_o { + /* rumors.c */ + unsigned oracle_cnt; /* oracles are handled differently from rumors... */ + unsigned long *oracle_loc; + + /* other */ + long omoves; /* level timestamp */ +}; + +struct instance_globals_saved_p { + /* decl.c */ + char plname[PL_NSIZ]; /* player name */ + char pl_character[PL_CSIZ]; + char pl_fruit[PL_FSIZ]; +}; + +struct instance_globals_saved_q { + /* quest.c */ + struct q_score quest_status; +}; + +struct instance_globals_saved_r { + /* mkroom.c */ + struct mkroom rooms[(MAXNROFROOMS + 1) * 2]; +}; + +struct instance_globals_saved_s { + /* decl.c */ + struct spell spl_book[MAXSPELL + 1]; + s_level *sp_levchn; +}; + +struct instance_globals_saved_t { + /* decl.c */ + char tune[6]; + /* timeout.c */ + unsigned long timer_id; +}; + +struct instance_globals_saved_u { + /* decl.c */ + dest_area updest; +}; + +struct instance_globals_saved_w { + /* reserved */ + long wreserve; + int32_t wtreserved; +}; + +struct instance_globals_saved_x { + /* mkmaze.c */ + int xmin, xmax; /* level boundaries x */ +}; + +struct instance_globals_saved_y { + /* mkmaze.c */ + int ymin, ymax; /* level boundaries y */ +}; + +extern struct instance_globals_a ga; +extern struct instance_globals_b gb; +extern struct instance_globals_c gc; +extern struct instance_globals_d gd; +extern struct instance_globals_e ge; +extern struct instance_globals_f gf; +extern struct instance_globals_g gg; +extern struct instance_globals_h gh; +extern struct instance_globals_i gi; +extern struct instance_globals_j gj; +extern struct instance_globals_k gk; +extern struct instance_globals_l gl; +extern struct instance_globals_m gm; +extern struct instance_globals_n gn; +extern struct instance_globals_o go; +extern struct instance_globals_p gp; +extern struct instance_globals_q gq; +extern struct instance_globals_r gr; +extern struct instance_globals_s gs; +extern struct instance_globals_t gt; +extern struct instance_globals_u gu; +extern struct instance_globals_v gv; +extern struct instance_globals_w gw; +extern struct instance_globals_x gx; +extern struct instance_globals_y gy; +extern struct instance_globals_z gz; +extern struct instance_globals_saved_b svb; +extern struct instance_globals_saved_c svc; +extern struct instance_globals_saved_d svd; +extern struct instance_globals_saved_e sve; +extern struct instance_globals_saved_h svh; +extern struct instance_globals_saved_i svi; +extern struct instance_globals_saved_k svk; +extern struct instance_globals_saved_l svl; +extern struct instance_globals_saved_m svm; +extern struct instance_globals_saved_n svn; +extern struct instance_globals_saved_o svo; +extern struct instance_globals_saved_p svp; +extern struct instance_globals_saved_q svq; +extern struct instance_globals_saved_r svr; +extern struct instance_globals_saved_s svs; +extern struct instance_globals_saved_t svt; +extern struct instance_globals_saved_u svu; +extern struct instance_globals_saved_w svw; +extern struct instance_globals_saved_x svx; +extern struct instance_globals_saved_y svy; +extern struct sinfo program_state; /* flags describing game's current state */ + +struct const_globals { + const struct obj zeroobj; /* used to zero out a struct obj */ + const struct monst zeromonst; /* used to zero out a struct monst */ + const anything zeroany; /* used to zero out union any */ + const NhRect zeroNhRect; /* used to zero out NhRect */ +}; + +extern const struct const_globals cg; + +extern struct obj hands_obj; #endif /* DECL_H */ diff --git a/include/defsym.h b/include/defsym.h new file mode 100644 index 000000000..598b2871b --- /dev/null +++ b/include/defsym.h @@ -0,0 +1,511 @@ +/* NetHack 5.0 defsym.h $NHDT-Date: 1725653007 2024/09/06 20:03:27 $ $NHDT-Branch: NetHack-3.7 $ $NHDT-Revision: 1.25 $ */ +/* Copyright (c) 2016 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +/* + This header is included in multiple places to produce + different code depending on its use. Its purpose is to + ensure that there is only one definitive source for + pchar, objclass and mon symbols. + + The morphing macro expansions are used in these places: + - in include/sym.h for enums of some S_* symbol values + (define PCHAR_S_ENUM, MONSYMS_S_ENUM prior to #include defsym.h) + - in include/sym.h for enums of some DEF_* symbol values + (define MONSYMS_DEFCHAR_ENUM prior to #include defsym.h) + - in include/objclass.h for enums of some default character values + (define OBJCLASS_DEFCHAR_ENUM prior to #include defsym.h) + - in include/objclass.h for enums of some *_CLASS values + (define OBJCLASS_CLASS_ENUM prior to #include defsym.h) + - in include/objclass.h for enums of S_* symbol values + (define OBJCLASS_S_ENUM prior to #include defsym.h) + - in src/symbols.c for parsing S_ entries in config files + (define PCHAR_PARSE, MONSYMS_PARSE, OBJCLASS_PARSE prior + to #include defsym.h) + - in src/drawing.c for initializing some data structures/arrays + (define PCHAR_DRAWING, MONSYMS_DRAWING, OBJCLASS_DRAWING prior + to #include defsym.h) + - in win/share/tilemap.c for processing a tile file + (define PCHAR_TILES prior to #include defsym.h). + - in src/allmain.c for setting up the dumping of several enums + (define DUMP_ENUMS_PCHAR, DUMP_ENUMS_MONSYS, DUMP_ENUMS_MONSYMS_DEFCHAR + DUMP_ENUMS_OBJCLASS_DEFCHARS, DUMP_ENUMS_OBJCLASS_DEFCHARS + DUMP_ENUMS_OBJCLASS_CLASSES, DUMP_ENUMS_OBJCLASS_SYMS) +*/ + +#if defined(PCHAR_S_ENUM) \ + || defined(PCHAR_PARSE) \ + || defined(PCHAR_DRAWING) \ + || defined(PCHAR_TILES) \ + || defined(DUMP_ENUMS_PCHAR) + +/* + PCHAR(idx, ch, sym, desc, clr) + idx: index used in enum + ch: character symbol + sym: symbol name for parsing purposes (also tile name) + desc: description + clr: color + + PCHAR2(idx, ch, sym, tilenm, desc, clr) + idx: index used in enum + ch: character symbol + sym: symbol name for parsing purposes + tilenm: if the name in the tile txt file differs from desc (below), + the name in the tile txt file can be specified here. + desc: description + clr: color +*/ + +#if defined(PCHAR_S_ENUM) +/* sym.h */ +#define PCHAR(idx, ch, sym, desc, clr) sym = idx, + +#elif defined(PCHAR_PARSE) +/* symbols.c */ +#define PCHAR(idx, ch, sym, desc, clr) { SYM_PCHAR, sym, #sym }, + +#elif defined(PCHAR_DRAWING) +/* drawing.c */ +#define PCHAR(idx, ch, sym, desc, clr) { ch, desc, clr }, + +#elif defined(PCHAR_TILES) +/* win/share/tilemap.c */ +#define PCHAR(idx, ch, sym, desc, clr) { sym, desc, desc }, +#define PCHAR2(idx, ch, sym, tilenm, desc, clr) { sym, tilenm, desc }, + +#elif defined(DUMP_ENUMS_PCHAR) +/* allmain.c */ +#define PCHAR(idx, ch, sym, desc, clr) { sym, #sym }, +#ifndef PCHAR2 +#define PCHAR2(idx, ch, sym, tilenm, desc, clr) { sym, #sym }, +#endif +#endif + +/* PCHAR with extra arg */ +#ifndef PCHAR2 +#define PCHAR2(idx, ch, sym, tilenm, desc, clr) PCHAR(idx, ch, sym, desc, clr) +#endif + + PCHAR2( 0, ' ', S_stone, "dark part of a room", "stone", NO_COLOR) + PCHAR2( 1, '|', S_vwall, "vertical wall", "wall", CLR_GRAY) + PCHAR2( 2, '-', S_hwall, "horizontal wall", "wall", CLR_GRAY) + PCHAR2( 3, '-', S_tlcorn, "top left corner wall", "wall", CLR_GRAY) + PCHAR2( 4, '-', S_trcorn, "top right corner wall", "wall", CLR_GRAY) + PCHAR2( 5, '-', S_blcorn, "bottom left corner wall", "wall", CLR_GRAY) + PCHAR2( 6, '-', S_brcorn, "bottom right corner wall", "wall", CLR_GRAY) + PCHAR2( 7, '-', S_crwall, "cross wall", "wall", CLR_GRAY) + PCHAR2( 8, '-', S_tuwall, "tuwall", "wall", CLR_GRAY) + PCHAR2( 9, '-', S_tdwall, "tdwall", "wall", CLR_GRAY) + PCHAR2(10, '|', S_tlwall, "tlwall", "wall", CLR_GRAY) + PCHAR2(11, '|', S_trwall, "trwall", "wall", CLR_GRAY) + /* start cmap A */ + PCHAR2(12, '.', S_ndoor, "no door", "doorway", CLR_GRAY) + PCHAR2(13, '-', S_vodoor, "vertical open door", "open door", CLR_BROWN) + PCHAR2(14, '|', S_hodoor, "horizontal open door", "open door", CLR_BROWN) + PCHAR2(15, '+', S_vcdoor, "vertical closed door", + "closed door", CLR_BROWN) + PCHAR2(16, '+', S_hcdoor, "horizontal closed door", + "closed door", CLR_BROWN) + PCHAR( 17, '#', S_bars, "iron bars", HI_METAL) + PCHAR( 18, '#', S_tree, "tree", CLR_GREEN) + PCHAR( 19, '.', S_room, "floor of a room", CLR_GRAY) + PCHAR( 20, '.', S_darkroom, "dark part of a room", CLR_BLACK) + PCHAR2(21, '`', S_engroom, "engraving in a room", "engraving", + CLR_BRIGHT_BLUE) + PCHAR2(22, '#', S_corr, "dark corridor", "corridor", CLR_GRAY) + PCHAR( 23, '#', S_litcorr, "lit corridor", CLR_GRAY) + PCHAR2(24, '#', S_engrcorr, "engraving in a corridor", "engraving", + CLR_BRIGHT_BLUE) + PCHAR2(25, '<', S_upstair, "up stairs", "staircase up", CLR_GRAY) + PCHAR2(26, '>', S_dnstair, "down stairs", "staircase down", CLR_GRAY) + PCHAR2(27, '<', S_upladder, "up ladder", "ladder up", CLR_BROWN) + PCHAR2(28, '>', S_dnladder, "down ladder", "ladder down", CLR_BROWN) + PCHAR( 29, '<', S_brupstair, "branch staircase up", CLR_YELLOW) + PCHAR( 30, '>', S_brdnstair, "branch staircase down", CLR_YELLOW) + PCHAR( 31, '<', S_brupladder, "branch ladder up", CLR_YELLOW) + PCHAR( 32, '>', S_brdnladder, "branch ladder down", CLR_YELLOW) + /* end cmap A */ + PCHAR( 33, '_', S_altar, "altar", CLR_GRAY) + /* start cmap B */ + PCHAR( 34, '|', S_grave, "grave", CLR_WHITE) + PCHAR2(35, '\\', S_throne, "throne", "opulent throne", HI_GOLD) + PCHAR( 36, '{', S_sink, "sink", CLR_WHITE) + PCHAR( 37, '{', S_fountain, "fountain", CLR_BRIGHT_BLUE) + /* the S_pool symbol is used for both POOL terrain and MOAT terrain */ + PCHAR2(38, '}', S_pool, "pool", "water", CLR_BLUE) + PCHAR( 39, '.', S_ice, "ice", CLR_CYAN) + PCHAR( 40, '}', S_lava, "molten lava", CLR_RED) + PCHAR( 41, '}', S_lavawall, "wall of lava", CLR_ORANGE) + PCHAR2(42, '.', S_vodbridge, "vertical open drawbridge", + "lowered drawbridge", CLR_BROWN) + PCHAR2(43, '.', S_hodbridge, "horizontal open drawbridge", + "lowered drawbridge", CLR_BROWN) + PCHAR2(44, '#', S_vcdbridge, "vertical closed drawbridge", + "raised drawbridge", CLR_BROWN) + PCHAR2(45, '#', S_hcdbridge, "horizontal closed drawbridge", + "raised drawbridge", CLR_BROWN) + PCHAR( 46, ' ', S_air, "air", CLR_CYAN) + PCHAR( 47, '#', S_cloud, "cloud", CLR_GRAY) + /* the S_water symbol is used for WATER terrain: wall of water in the + dungeon and Plane of Water in the endgame */ + PCHAR( 48, '}', S_water, "water", CLR_BRIGHT_BLUE) + /* end dungeon characters */ + /* */ + /* begin traps */ + /* */ + PCHAR( 49, '^', S_arrow_trap, "arrow trap", HI_METAL) + PCHAR( 50, '^', S_dart_trap, "dart trap", HI_METAL) + PCHAR( 51, '^', S_falling_rock_trap, "falling rock trap", CLR_GRAY) + PCHAR( 52, '^', S_squeaky_board, "squeaky board", CLR_BROWN) + PCHAR( 53, '^', S_bear_trap, "bear trap", HI_METAL) + PCHAR( 54, '^', S_land_mine, "land mine", CLR_RED) + PCHAR( 55, '^', S_rolling_boulder_trap, "rolling boulder trap", CLR_GRAY) + PCHAR( 56, '^', S_sleeping_gas_trap, "sleeping gas trap", HI_ZAP) + PCHAR( 57, '^', S_rust_trap, "rust trap", CLR_BLUE) + PCHAR( 58, '^', S_fire_trap, "fire trap", CLR_ORANGE) + PCHAR( 59, '^', S_pit, "pit", CLR_BLACK) + PCHAR( 60, '^', S_spiked_pit, "spiked pit", CLR_BLACK) + PCHAR( 61, '^', S_hole, "hole", CLR_BROWN) + PCHAR( 62, '^', S_trap_door, "trap door", CLR_BROWN) + PCHAR( 63, '^', S_teleportation_trap, "teleportation trap", CLR_MAGENTA) + PCHAR( 64, '^', S_level_teleporter, "level teleporter", CLR_MAGENTA) + PCHAR( 65, '^', S_magic_portal, "magic portal", CLR_BRIGHT_MAGENTA) + PCHAR( 66, '"', S_web, "web", CLR_GRAY) + PCHAR( 67, '^', S_statue_trap, "statue trap", CLR_GRAY) + PCHAR( 68, '^', S_magic_trap, "magic trap", HI_ZAP) + PCHAR2(69, '^', S_anti_magic_trap, "anti magic trap", "anti-magic field", + HI_ZAP) + PCHAR( 70, '^', S_polymorph_trap, "polymorph trap", CLR_BRIGHT_GREEN) + PCHAR( 71, '~', S_vibrating_square, "vibrating square", CLR_MAGENTA) + PCHAR( 72, '^', S_trapped_door, "trapped door", CLR_ORANGE) + PCHAR( 73, '^', S_trapped_chest, "trapped chest", CLR_ORANGE) + /* end traps */ + /* end cmap B */ + /* */ + /* begin special effects */ + /* */ + /* zap colors are changed by reset_glyphmap() to match type of beam */ + /* */ + PCHAR2(74, '|', S_vbeam, "vertical beam", "", CLR_GRAY) + PCHAR2(75, '-', S_hbeam, "horizontal beam", "", CLR_GRAY) + PCHAR2(76, '\\', S_lslant, "left slant beam", "", CLR_GRAY) + PCHAR2(77, '/', S_rslant, "right slant beam", "", CLR_GRAY) + /* start cmap C */ + PCHAR2(78, '*', S_digbeam, "dig beam", "", CLR_WHITE) + PCHAR2(79, '!', S_flashbeam, "flash beam", "", CLR_WHITE) + PCHAR2(80, ')', S_boomleft, "boom left", "", HI_WOOD) + PCHAR2(81, '(', S_boomright, "boom right", "", HI_WOOD) + /* 4 magic shield symbols */ + PCHAR2(82, '0', S_ss1, "shield1", "", HI_ZAP) + PCHAR2(83, '#', S_ss2, "shield2", "", HI_ZAP) + PCHAR2(84, '@', S_ss3, "shield3", "", HI_ZAP) + PCHAR2(85, '*', S_ss4, "shield4", "", HI_ZAP) + PCHAR( 86, '#', S_poisoncloud, "poison cloud", CLR_BRIGHT_GREEN) + /* for a time S_goodpos was a question mark, but dollar sign is the + default keystroke for getpos() to toggle goodpos glyphs on or off */ + PCHAR( 87, '$', S_goodpos, "valid position", HI_ZAP) + /* end cmap C */ + /* */ + /* The 8 swallow symbols. Do NOT separate. */ + /* To change order or add, see the function swallow_to_glyph() */ + /* in display.c. swallow colors are changed by */ + /* reset_glyphmap() to match the engulfing monst. */ + /* */ + /* Order: */ + /* */ + /* 1 2 3 */ + /* 4 5 6 */ + /* 7 8 9 */ + /* */ + PCHAR2(88, '/', S_sw_tl, "swallow top left", "", CLR_GREEN) /*1*/ + PCHAR2(89, '-', S_sw_tc, "swallow top center", "", CLR_GREEN) /*2*/ + PCHAR2(90, '\\', S_sw_tr, "swallow top right", "", CLR_GREEN) /*3*/ + PCHAR2(91, '|', S_sw_ml, "swallow middle left", "", CLR_GREEN) /*4*/ + PCHAR2(92, '|', S_sw_mr, "swallow middle right", "", CLR_GREEN) /*6*/ + PCHAR2(93, '\\', S_sw_bl, "swallow bottom left", "", CLR_GREEN) /*7*/ + PCHAR2(94, '-', S_sw_bc, "swallow bottom center", "", CLR_GREEN) /*8*/ + PCHAR2(95, '/', S_sw_br, "swallow bottom right", "", CLR_GREEN) /*9*/ + /* */ + /* explosion colors are changed by reset_glyphmap() to match */ + /* the type of expl. */ + /* */ + /* Ex. */ + /* */ + /* /-\ */ + /* |@| */ + /* \-/ */ + /* */ + PCHAR2(96, '/', S_expl_tl, "explosion top left", "", CLR_ORANGE) + PCHAR2(97, '-', S_expl_tc, "explosion top center", "", CLR_ORANGE) + PCHAR2(98, '\\', S_expl_tr, "explosion top right", "", CLR_ORANGE) + PCHAR2(99, '|', S_expl_ml, "explosion middle left", "", CLR_ORANGE) + PCHAR2(100, ' ', S_expl_mc, "explosion middle center", "", CLR_ORANGE) + PCHAR2(101, '|', S_expl_mr, "explosion middle right", "", CLR_ORANGE) + PCHAR2(102, '\\', S_expl_bl, "explosion bottom left", "", CLR_ORANGE) + PCHAR2(103, '-', S_expl_bc, "explosion bottom center", "", CLR_ORANGE) + PCHAR2(104, '/', S_expl_br, "explosion bottom right", "", CLR_ORANGE) +#undef PCHAR +#undef PCHAR2 +#endif /* PCHAR_S_ENUM || PCHAR_PARSE || PCHAR_DRAWING || PCHAR_TILES + * || DUMP_ENUMS_PCHAR */ + +#if defined(MONSYMS_S_ENUM) \ + || defined(MONSYMS_DEFCHAR_ENUM) \ + || defined(MONSYMS_PARSE) \ + || defined(MONSYMS_DRAWING) \ + || defined(DUMP_ENUMS_MONSYMS) \ + || defined(DUMP_ENUMS_MONSYMS_DEFCHAR) + +/* + MONSYM(idx, ch, sym desc) + idx: index used in enum + ch: character symbol + sym: symbol name for parsing purposes + desc: description +*/ + +#if defined(MONSYMS_S_ENUM) +/* sym.h */ +#define MONSYM(idx, ch, basename, sym, desc) sym = idx, + +#elif defined(MONSYMS_DEFCHAR_ENUM) +/* sym.h */ +#define MONSYM(idx, ch, basename, sym, desc) DEF_##basename = ch, + +#elif defined(MONSYMS_PARSE) +/* symbols.c */ +#define MONSYM(idx, ch, basename, sym, desc) \ + { SYM_MON, sym + SYM_OFF_M, #sym }, + +#elif defined(MONSYMS_DRAWING) +/* drawing.c */ +#define MONSYM(idx, ch, basename, sym, desc) { DEF_##basename, "", desc }, + +/* allmain.c */ +#elif defined(DUMP_ENUMS_MONSYMS) +#define MONSYM(idx, ch, basename, sym, desc) { sym, #sym }, + +#elif defined(DUMP_ENUMS_MONSYMS_DEFCHAR) +#define MONSYM(idx, ch, basename, sym, desc) \ + { DEF_##basename, "DEF_" #basename }, + +#endif + + MONSYM( 1, 'a', ANT, S_ANT, "ant or other insect") + MONSYM( 2, 'b', BLOB, S_BLOB, "blob") + MONSYM( 3, 'c', COCKATRICE, S_COCKATRICE, "cockatrice") + MONSYM( 4, 'd', DOG, S_DOG, "dog or other canine") + MONSYM( 5, 'e', EYE, S_EYE, "eye or sphere") + MONSYM( 6, 'f', FELINE, S_FELINE, "cat or other feline") + MONSYM( 7, 'g', GREMLIN, S_GREMLIN, "gremlin") + /* small humanoids: hobbit, dwarf */ + MONSYM( 8, 'h', HUMANOID, S_HUMANOID, "humanoid") + /* minor demons */ + MONSYM( 9, 'i', IMP, S_IMP, "imp or minor demon") + MONSYM(10, 'j', JELLY, S_JELLY, "jelly") + MONSYM(11, 'k', KOBOLD, S_KOBOLD, "kobold") + MONSYM(12, 'l', LEPRECHAUN, S_LEPRECHAUN, "leprechaun") + MONSYM(13, 'm', MIMIC, S_MIMIC, "mimic") + MONSYM(14, 'n', NYMPH, S_NYMPH, "nymph") + MONSYM(15, 'o', ORC, S_ORC, "orc") + MONSYM(16, 'p', PIERCER, S_PIERCER, "piercer") + /* quadruped excludes horses */ + MONSYM(17, 'q', QUADRUPED, S_QUADRUPED, "quadruped") + MONSYM(18, 'r', RODENT, S_RODENT, "rodent") + MONSYM(19, 's', SPIDER, S_SPIDER, "arachnid or centipede") + MONSYM(20, 't', TRAPPER, S_TRAPPER, "trapper or lurker above") + /* unicorn, horses */ + MONSYM(21, 'u', UNICORN, S_UNICORN, "unicorn or horse") + MONSYM(22, 'v', VORTEX, S_VORTEX, "vortex") + MONSYM(23, 'w', WORM, S_WORM, "worm") + MONSYM(24, 'x', XAN, S_XAN, "xan or other mythical/fantastic insect") + /* yellow light, black light */ + MONSYM(25, 'y', LIGHT, S_LIGHT, "light") + MONSYM(26, 'z', ZRUTY, S_ZRUTY, "zruty") + MONSYM(27, 'A', ANGEL, S_ANGEL, "angelic being") + MONSYM(28, 'B', BAT, S_BAT, "bat or bird") + MONSYM(29, 'C', CENTAUR, S_CENTAUR, "centaur") + MONSYM(30, 'D', DRAGON, S_DRAGON, "dragon") + /* elemental includes invisible stalker */ + MONSYM(31, 'E', ELEMENTAL, S_ELEMENTAL, "elemental") + MONSYM(32, 'F', FUNGUS, S_FUNGUS, "fungus or mold") + MONSYM(33, 'G', GNOME, S_GNOME, "gnome") + /* large humanoid: giant, ettin, minotaur */ + MONSYM(34, 'H', GIANT, S_GIANT, "giant humanoid") + MONSYM(35, 'I', INVISIBLE, S_invisible, "invisible monster") + MONSYM(36, 'J', JABBERWOCK, S_JABBERWOCK, "jabberwock") + MONSYM(37, 'K', KOP, S_KOP, "Keystone Kop") + MONSYM(38, 'L', LICH, S_LICH, "lich") + MONSYM(39, 'M', MUMMY, S_MUMMY, "mummy") + MONSYM(40, 'N', NAGA, S_NAGA, "naga") + MONSYM(41, 'O', OGRE, S_OGRE, "ogre") + MONSYM(42, 'P', PUDDING, S_PUDDING, "pudding or ooze") + MONSYM(43, 'Q', QUANTMECH, S_QUANTMECH, "quantum mechanic") + MONSYM(44, 'R', RUSTMONST, S_RUSTMONST, "rust monster or disenchanter") + MONSYM(45, 'S', SNAKE, S_SNAKE, "snake") + MONSYM(46, 'T', TROLL, S_TROLL, "troll") + /* umber hulk */ + MONSYM(47, 'U', UMBER, S_UMBER, "umber hulk") + MONSYM(48, 'V', VAMPIRE, S_VAMPIRE, "vampire") + MONSYM(49, 'W', WRAITH, S_WRAITH, "wraith") + MONSYM(50, 'X', XORN, S_XORN, "xorn") + /* apelike creature includes owlbear, monkey */ + MONSYM(51, 'Y', YETI, S_YETI, "apelike creature") + MONSYM(52, 'Z', ZOMBIE, S_ZOMBIE, "zombie") + MONSYM(53, '@', HUMAN, S_HUMAN, "human or elf") + /* space symbol*/ + MONSYM(54, ' ', GHOST, S_GHOST, "ghost") + MONSYM(55, '\'', GOLEM, S_GOLEM, "golem") + MONSYM(56, '&', DEMON, S_DEMON, "major demon") + /* fish */ + MONSYM(57, ';', EEL, S_EEL, "sea monster") + /* reptiles */ + MONSYM(58, ':', LIZARD, S_LIZARD, "lizard") + MONSYM(59, '~', WORM_TAIL, S_WORM_TAIL, "long worm tail") + MONSYM(60, ']', MIMIC_DEF, S_MIMIC_DEF, "mimic") + +#undef MONSYM +#endif /* MONSYMS_S_ENUM || MONSYMS_DEFCHAR_ENUM || MONSYMS_PARSE + * || MONSYMS_DRAWING || DUMP_ENUMS_MONSYMS) + * || DUMP_ENUMS_MONSYMS_DEFCHAR */ + +#if defined(OBJCLASS_S_ENUM) \ + || defined(OBJCLASS_DEFCHAR_ENUM) \ + || defined(OBJCLASS_CLASS_ENUM) \ + || defined(OBJCLASS_PARSE) \ + || defined(OBJCLASS_DRAWING) \ + || defined(DUMP_ENUMS_OBJCLASS_DEFCHARS) \ + || defined(DUMP_ENUMS_OBJCLASS_CLASSES) \ + || defined(DUMP_ENUMS_OBJCLASS_SYMS) + +/* + OBJCLASS(idx, ch, basename, sym, name, explain) + idx: index used in enum + ch: default character + basename: unadorned base name of objclass, used + to construct enums through suffixes/prefixes + sym: symbol name for enum and parsing purposes + name: used in object_detect() + explain: used in do_look() + + OBJCLASS2(idx, ch, basename, sname, sym, name, explain) + idx: index used in enum + ch: default character + basename: unadorned base name of objclass, used + to construct enums through suffixes/prefixes + sname: hardcoded *_SYM value for this entry (required + only because basename and GOLD_SYM differ + sym: symbol name for enum and parsing purposes + name: used in object_detect() + explain: used in do_look() +*/ + +#if defined(OBJCLASS_CLASS_ENUM) +/* objclass.h */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + basename##_CLASS = idx, + +#elif defined(OBJCLASS_DEFCHAR_ENUM) +/* objclass.h */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + basename##_SYM = ch, + +#elif defined(OBJCLASS_S_ENUM) +/* objclass.h */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + sym = idx, + +#elif defined(OBJCLASS_PARSE) +/* symbols.c */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + { SYM_OC, sym + SYM_OFF_O, #sym }, + +#elif defined(OBJCLASS_DRAWING) +/* drawing.c */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + { basename##_SYM, name, explain }, + +#elif defined(DUMP_ENUMS_OBJCLASS_DEFCHARS) +/* allmain.c */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + { basename##_SYM, #basename "_SYM" }, + +#elif defined(DUMP_ENUMS_OBJCLASS_CLASSES) +/* allmain.c */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + { basename##_CLASS, #basename "_CLASS" }, + +#elif defined(DUMP_ENUMS_OBJCLASS_SYMS) +/* allmain.c */ +#define OBJCLASS(idx, ch, basename, sym, name, explain) \ + { sym , #sym }, +#endif + +/* OBJCLASS with extra arg */ +#if defined(OBJCLASS_DEFCHAR_ENUM) +#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \ + sname = ch, +#elif defined(OBJCLASS_DRAWING) +#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \ + { sname, name, explain }, +#elif defined(DUMP_ENUMS_OBJCLASS_DEFCHARS) +#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \ + { sname, #sname }, +#elif defined(DUMP_ENUMS_OBJCLASS_CLASSES) +#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \ + { basename##_CLASS, #basename "_CLASS" }, +#elif defined(DUMP_ENUMS_OBJCLASS_SYMS) +#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \ + { sym , #sym }, +#else +#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \ + OBJCLASS(idx, ch, basename, sym, name, explain) +#endif + + OBJCLASS( 1, ']', ILLOBJ, S_strange_obj, "illegal objects", + "strange object") + OBJCLASS( 2, ')', WEAPON, S_weapon, "weapons", "weapon") + OBJCLASS( 3, '[', ARMOR, S_armor, "armor", "suit or piece of armor") + OBJCLASS( 4, '=', RING, S_ring, "rings", "ring") + OBJCLASS( 5, '"', AMULET, S_amulet, "amulets", "amulet") + OBJCLASS( 6, '(', TOOL, S_tool, "tools", + "useful item (pick-axe, key, lamp...)") + OBJCLASS( 7, '%', FOOD, S_food, "food", "piece of food") + OBJCLASS( 8, '!', POTION, S_potion, "potions", "potion") + OBJCLASS( 9, '?', SCROLL, S_scroll, "scrolls", "scroll") + OBJCLASS(10, '+', SPBOOK, S_book, "spellbooks", "spellbook") + OBJCLASS(11, '/', WAND, S_wand, "wands", "wand") + OBJCLASS2(12, '$', COIN, GOLD_SYM, S_coin, "coins", "pile of coins") + OBJCLASS(13, '*', GEM, S_gem, "rocks", "gem or rock") + OBJCLASS(14, '`', ROCK, S_rock, "large stones", "boulder or statue") + OBJCLASS(15, '0', BALL, S_ball, "iron balls", "iron ball") + OBJCLASS(16, '_', CHAIN, S_chain, "chains", "iron chain") + OBJCLASS(17, '.', VENOM, S_venom, "venoms", "splash of venom") + +#undef OBJCLASS +#undef OBJCLASS2 +#endif /* OBJCLASS_S_ENUM || OBJCLASS_DEFCHAR_ENUM || OBJCLASS_CLASS_ENUM + * || OBJCLASS_PARSE || OBJCLASS_DRAWING + * || DUMP_ENUMS_OBJCLASS_DEFCHARS || DUMP_ENUMS_OBJCLASS_CLASSES + * || DUMP_ENUMS_OBJCLASS_SYMS */ + +#ifdef DEBUG +#if !defined(PCHAR_S_ENUM) && !defined(PCHAR_DRAWING) \ + && !defined(PCHAR_PARSE) && !defined(PCHAR_TILES) \ + && !defined(DUMP_ENUMS_PCHAR) \ + && !defined(MONSYMS_S_ENUM) && !defined(MONSYMS_DEFCHAR_ENUM) \ + && !defined(MONSYMS_PARSE) && !defined(MONSYMS_DRAWING) \ + && !defined(DUMP_ENUMS_MONSYMS) \ + && !defined(DUMP_ENUMS_MONSYMS_DEFCHAR) \ + && !defined(OBJCLASS_S_ENUM) && !defined(OBJCLASS_DEFCHAR_ENUM) \ + && !defined(OBJCLASS_CLASS_ENUM) && !defined(OBJCLASS_PARSE) \ + && !defined (OBJCLASS_DRAWING) \ + && !defined(DUMP_ENUMS_OBJCLASS_DEFCHARS) \ + && !defined(DUMP_ENUMS_OBJCLASS_CLASSES) \ + && !defined(DUMP_ENUMS_OBJCLASS_SYMS) +#error Non-productive inclusion of defsym.h +#endif +#endif /* DEBUG */ + +/* end of defsym.h */ diff --git a/include/dgn_file.h b/include/dgn_file.h index 9e20de9c8..1a214e7c9 100644 --- a/include/dgn_file.h +++ b/include/dgn_file.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 dgn_file.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) 1989 by M. Stephenson */ +/* NetHack 5.0 dgn_file.h $NHDT-Date: 1596498533 2020/08/03 23:48:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.10 $ */ +/* Copyright (c) 1989 by M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ #ifndef DGN_FILE_H @@ -18,22 +18,24 @@ struct couple { }; struct tmpdungeon { - char name[24], protoname[24]; + char *name, *protoname; struct couple lev; int flags, chance, levels, branches, entry_lev; /* entry level for this dungeon */ char boneschar; + int align; }; struct tmplevel { - char name[24]; + char *name; + char *chainlvl; struct couple lev; int chance, rndlevs, chain, flags; char boneschar; }; struct tmpbranch { - char name[24]; /* destination dungeon name */ + char *name; /* destination dungeon name */ struct couple lev; int chain; /* index into tmplevel array (chained branch)*/ int type; /* branch type (see below) */ @@ -41,7 +43,7 @@ struct tmpbranch { }; /* - * Values for type for tmpbranch structure. + * Values for type in tmpbranch structure. */ #define TBR_STAIR 0 /* connection with both ends having a staircase */ #define TBR_NO_UP 1 /* connection with no up staircase */ @@ -49,12 +51,13 @@ struct tmpbranch { #define TBR_PORTAL 3 /* portal connection */ /* - * Flags that map into the dungeon flags bitfields. + * Flags that map into the dungeon flags bitfields. */ -#define TOWN 1 /* levels only */ -#define HELLISH 2 -#define MAZELIKE 4 -#define ROGUELIKE 8 +#define TOWN 0x01 /* levels only */ +#define HELLISH 0x02 +#define MAZELIKE 0x04 +#define ROGUELIKE 0x08 +#define UNCONNECTED 0x10 #define D_ALIGN_NONE 0 #define D_ALIGN_CHAOTIC (AM_CHAOTIC << 4) @@ -64,7 +67,7 @@ struct tmpbranch { #define D_ALIGN_MASK 0x70 /* - * Max number of prototype levels and branches. + * Max number of prototype levels and branches. */ #define LEV_LIMIT 50 #define BRANCH_LIMIT 32 diff --git a/include/display.h b/include/display.h index 233b84061..a48883342 100644 --- a/include/display.h +++ b/include/display.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.h $NHDT-Date: 1559994621 2019/06/08 11:50:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.32 $ */ +/* NetHack 5.0 display.h $NHDT-Date: 1725653008 2024/09/06 20:03:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.106 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -17,17 +17,28 @@ * vobj_at() * * Returns the head of the list of objects that the player can see - * at location (x,y). + * at location (x,y). [Vestige of unimplemented invisible objects.] */ -#define vobj_at(x, y) (level.objects[x][y]) +#define vobj_at(x, y) (svl.level.objects[x][y]) /* * sensemon() * * Returns true if the hero can sense the given monster. This includes - * monsters that are hiding or mimicing other monsters. + * monsters that are hiding or mimicking other monsters. + * + * [5.0] Note: the map doesn't display any monsters when hero is swallowed + * (or display non-adjacent, non-submerged ones when hero is underwater), + * so treat those situations as blocking telepathy, detection, and warning + * even though conceptually they shouldn't do so. + * + * [5.0 also] The macros whose name begins with an underscore have been + * converted to functions in order to have compilers generate smaller code. + * The retained underscore versions are still used in display.c but should + * only be used in other situations if the function calls actually produce + * noticeably slower processing. */ -#define tp_sensemon(mon) \ +#define _tp_sensemon(mon) \ (/* The hero can always sense a monster IF: */ \ /* 1. the monster has a brain to sense */ \ (!mindless(mon->data)) \ @@ -36,19 +47,23 @@ /* OR 2b. hero is using a telepathy inducing */ \ /* object and in range */ \ || (Unblind_telepat \ - && (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM))))) + && (mdistu(mon) <= u.unblind_telepat_range)))) -#define sensemon(mon) \ - (tp_sensemon(mon) || Detect_monsters || MATCH_WARN_OF_MON(mon)) +/* organized to perform cheaper tests first; + is_pool() vs is_pool_or_lava(): hero who is underwater can see adjacent + lava, but presumably any monster there is on top so not sensed */ +#define _sensemon(mon) \ + ( (!u.uswallow || (mon) == u.ustuck) \ + && (!Underwater || (mdistu(mon) <= 2 && is_pool((mon)->mx, (mon)->my))) \ + && (Detect_monsters || tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)) ) /* * mon_warning() is used to warn of any dangerous monsters in your * vicinity, and a glyph representing the warning level is displayed. */ - -#define mon_warning(mon) \ - (Warning && !(mon)->mpeaceful && (distu((mon)->mx, (mon)->my) < 100) \ - && (((int) ((mon)->m_lev / 4)) >= context.warnlevel)) +#define _mon_warning(mon) \ + (Warning && !(mon)->mpeaceful && (mdistu(mon) < 100) \ + && (((int) ((mon)->m_lev / 4)) >= svc.context.warnlevel)) /* * mon_visible() @@ -57,15 +72,24 @@ * hero can physically see the location of the monster. The function * vobj_at() returns a pointer to an object that the hero can see there. * Infravision is not taken into account. + * + * Note: not reliable for concealed mimics. They don't have + * 'mon->mundetected' set even when mimicking objects or furniture. + * [Fixing this with a pair of mon->m_ap_type checks here (via either + * 'typ!=object && typ!=furniture' or 'typ==nothing || typ==monster') + * will require reviewing every instance of mon_visible(), canseemon(), + * canspotmon(), is_safemon() and perhaps others. Fixing it by setting + * mon->mundetected when concealed would be better but also require + * reviewing all those instances and also existing mundetected instances.] */ #if 0 -#define mon_visible(mon) \ +#define _mon_visible(mon) \ (/* The hero can see the monster IF the monster */ \ (!mon->minvis || See_invisible) /* 1. is not invisible */ \ && !mon->mundetected /* AND 2. not an undetected hider */ \ - && !(mon->mburied || u.uburied)) /* AND 3. neither you nor it is buried */ + && !(mon->mburied || u.uburied)) /* AND 3. neither you nor it buried */ #else /* without 'mburied' and 'uburied' */ -#define mon_visible(mon) \ +#define _mon_visible(mon) \ (/* The hero can see the monster IF the monster */ \ (!mon->minvis || See_invisible) /* 1. is not invisible */ \ && !mon->mundetected) /* AND 2. not an undetected hider */ @@ -79,8 +103,8 @@ * invisible to infravision), because this is usually called from within * canseemon() or canspotmon() which already check that. */ -#define see_with_infrared(mon) \ - (!Blind && Infravision && mon && infravisible(mon->data) \ +#define _see_with_infrared(mon) \ + (!Blind && Infravision && infravisible(mon->data) \ && couldsee(mon->mx, mon->my)) /* @@ -90,7 +114,7 @@ * routines. Like mon_visible(), but it checks to see if the hero sees the * location instead of assuming it. (And also considers worms.) */ -#define canseemon(mon) \ +#define _canseemon(mon) \ ((mon->wormno ? worm_known(mon) \ : (cansee(mon->mx, mon->my) || see_with_infrared(mon))) \ && mon_visible(mon)) @@ -114,22 +138,27 @@ * creature in an apparently empty spot. * Infravision is not relevant; we assume that invisible monsters are also * invisible to infravision. + * [5.0: the macro definition erroneously started with 'mtmp->minvis' for + * over 20 years. The one place it's used called it as knowninvisible(mtmp) + * so worked by coincidence when there was no argument expansion involved + * on the first line.] */ -#define knowninvisible(mon) \ - (mtmp->minvis \ - && ((cansee(mon->mx, mon->my) && (See_invisible || Detect_monsters)) \ - || (!Blind && (HTelepat & ~INTRINSIC) \ - && distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))) +#define _knowninvisible(mon) \ + ((mon)->minvis \ + && ((cansee((mon)->mx, (mon)->my) \ + && (See_invisible || Detect_monsters)) \ + || (!Blind && (HTelepat & ~INTRINSIC) \ + && mdistu(mon) <= (BOLT_LIM * BOLT_LIM)))) /* - * is_safepet(mon) + * is_safemon(mon) * * A special case check used in attack() and domove(). Placing the - * definition here is convenient. + * definition here is convenient. No longer limited to pets. */ -#define is_safepet(mon) \ - (mon && mon->mtame && canspotmon(mon) && flags.safe_dog && !Confusion \ - && !Hallucination && !Stunned) +#define _is_safemon(mon) \ + (flags.safe_dog && (mon)->mpeaceful && canspotmon(mon) \ + && !Confusion && !Hallucination && !Stunned) /* * canseeself() @@ -149,25 +178,23 @@ /* * random_monster() * random_object() - * random_trap() * - * Respectively return a random monster, object, or trap number. + * Respectively return a random monster or object. + * random_object() won't return STRANGE_OBJECT or the generic objects. + * -/+ FIRST_OBJECT is used to skip it and them. */ -#define random_monster(rng) rng(NUMMONS) -#define random_object(rng) (rng(NUM_OBJECTS - 1) + 1) -#define random_trap(rng) (rng(TRAPNUM - 1) + 1) +#define random_monster(rng) ((*rng)(NUMMONS)) +#define random_object(rng) ((*rng)(NUM_OBJECTS - FIRST_OBJECT) + FIRST_OBJECT) /* * what_obj() * what_mon() - * what_trap() * * If hallucinating, choose a random object/monster, otherwise, use the one * given. Use the given rng to handle hallucination. */ #define what_obj(obj, rng) (Hallucination ? random_object(rng) : obj) #define what_mon(mon, rng) (Hallucination ? random_monster(rng) : mon) -#define what_trap(trp, rng) (Hallucination ? random_trap(rng) : trp) /* * newsym_rn2 @@ -189,7 +216,8 @@ * "cover" any objects or traps that might be there. */ #define covers_objects(xx, yy) \ - ((is_pool(xx, yy) && !Underwater) || (levl[xx][yy].typ == LAVAPOOL)) + ((is_pool(xx, yy) && !Underwater) || (levl[xx][yy].typ == LAVAPOOL) \ + || (levl[xx][yy].typ == LAVAWALL)) #define covers_traps(xx, yy) covers_objects(xx, yy) @@ -200,14 +228,14 @@ #define DISP_ALL (-2) /* Like beam, but still displayed if not visible. */ #define DISP_TETHER (-3) /* Like beam, but tether glyph differs from final */ #define DISP_FLASH (-4) /* Clean up each glyph before displaying new one. */ -#define DISP_ALWAYS (-5) /* Like flash, but still displayed if not visible. */ +#define DISP_ALWAYS (-5) /* Like flash, but still displayed if not visible */ #define DISP_CHANGE (-6) /* Change glyph. */ #define DISP_END (-7) /* Clean up. */ #define DISP_FREEMEM (-8) /* Free all memory during exit only. */ /* Total number of cmap indices in the shield_static[] array. */ #define SHIELD_COUNT 21 -#define BACKTRACK (-1) /* flag for DISP_END to display each prior location */ +#define BACKTRACK (-1) /* for DISP_END to display each prior location */ /* * display_self() @@ -215,23 +243,25 @@ * Display the hero. It is assumed that all checks necessary to determine * _if_ the hero can be seen have already been done. */ -#define maybe_display_usteed(otherwise_self) \ - ((u.usteed && mon_visible(u.usteed)) \ - ? ridden_mon_to_glyph(u.usteed, rn2_on_display_rng) \ - : (otherwise_self)) +#define maybe_display_usteed(otherwise_self) \ + ((u.usteed && mon_visible(u.usteed)) \ + ? ridden_mon_to_glyph(u.usteed, rn2_on_display_rng) \ + : (otherwise_self)) #define display_self() \ - show_glyph(u.ux, u.uy, \ - maybe_display_usteed((U_AP_TYPE == M_AP_NOTHING) \ - ? hero_glyph \ - : (U_AP_TYPE == M_AP_FURNITURE) \ - ? cmap_to_glyph(youmonst.mappearance) \ - : (U_AP_TYPE == M_AP_OBJECT) \ - ? objnum_to_glyph(youmonst.mappearance) \ - /* else U_AP_TYPE == M_AP_MONSTER */ \ - : monnum_to_glyph(youmonst.mappearance))) + show_glyph(u.ux, u.uy, maybe_display_usteed( \ + ((int) U_AP_TYPE == M_AP_NOTHING) \ + ? hero_glyph \ + : ((int) U_AP_TYPE == M_AP_FURNITURE) \ + ? cmap_to_glyph((int) gy.youmonst.mappearance) \ + : ((int) U_AP_TYPE == M_AP_OBJECT) \ + ? objnum_to_glyph((int) gy.youmonst.mappearance) \ + /* else U_AP_TYPE == M_AP_MONSTER */ \ + : monnum_to_glyph((int) gy.youmonst.mappearance, Ugender))) /* + * NetHack glyphs + * * A glyph is an abstraction that represents a _unique_ monster, object, * dungeon part, or effect. The uniqueness is important. For example, * It is not enough to have four (one for each "direction") zap beam glyphs, @@ -240,126 +270,393 @@ * [print_glyph()] can produce something different for each type of glyph. * That is, a beam of cold and a beam of fire would not only be different * colors, but would also be represented by different symbols. - * + */ + + +#include "color.h" +/* 3.6.3: poison gas zap used to be yellow and acid zap was green, + which conflicted with the corresponding dragon colors */ +enum zap_colors { + zap_color_missile = HI_ZAP, + zap_color_fire = CLR_ORANGE, + zap_color_frost = CLR_WHITE, + zap_color_sleep = HI_ZAP, + zap_color_death = CLR_BLACK, + zap_color_lightning = CLR_WHITE, + zap_color_poison_gas = CLR_GREEN, + zap_color_acid = CLR_YELLOW +}; + +enum altar_colors { + altar_color_unaligned = CLR_RED, +#if defined(USE_GENERAL_ALTAR_COLORS) + /* On OSX with TERM=xterm-color256 these render as + * white -> tty: gray, curses: ok + * gray -> both tty and curses: black + * black -> both tty and curses: blue + * red -> both tty and curses: ok. + * Since the colors have specific associations (with the + * unicorns matched with each alignment), we shouldn't use + * scrambled colors and we don't have sufficient information + * to handle platform-specific color variations. + */ + altar_color_chaotic = CLR_BLACK, + altar_color_neutral = CLR_GRAY, + altar_color_lawful = CLR_WHITE, +#else + altar_color_chaotic = CLR_GRAY, + altar_color_neutral = CLR_GRAY, + altar_color_lawful = CLR_GRAY, +#endif + altar_color_other = CLR_BRIGHT_MAGENTA, +}; + +/* types of explosions */ +enum explosion_types { + EXPL_DARK = 0, + EXPL_NOXIOUS = 1, + EXPL_MUDDY = 2, + EXPL_WET = 3, + EXPL_MAGICAL = 4, + EXPL_FIERY = 5, + EXPL_FROSTY = 6, + EXPL_MAX = 7 +}; + +/* above plus this redundant? */ +enum expl_types { + expl_dark, + expl_noxious, + expl_muddy, + expl_wet, + expl_magical, + expl_fiery, + expl_frosty, +}; + +enum explode_colors { + explode_color_dark = CLR_BLACK, + explode_color_noxious = CLR_GREEN, + explode_color_muddy = CLR_BROWN, + explode_color_wet = CLR_BLUE, + explode_color_magical = CLR_MAGENTA, + explode_color_fiery = CLR_ORANGE, + explode_color_frosty = CLR_WHITE +}; +enum altar_types { + altar_unaligned, + altar_chaotic, + altar_neutral, + altar_lawful, + altar_other +}; +enum level_walls { main_walls, mines_walls, gehennom_walls, + knox_walls, sokoban_walls }; +enum { GM_FLAGS, GM_TTYCHAR, GM_COLOR, NUM_GLYPHMOD }; /* glyphmod entries */ +enum glyphmap_change_triggers { gm_nochange, gm_newgame, gm_levelchange, + gm_optionchange, gm_symchange, + gm_accessibility_change }; +#define NUM_ZAP 8 /* number of zap beam types */ + +/* * Glyphs are grouped for easy accessibility: * - * monster Represents all the wild (not tame) monsters. Count: NUMMONS. + * male monsters Represents all the wild (not tame) male monsters. + * Count: NUMMONS. + * + * female monsters Represents all the wild (not tame) female monsters. + * Count: NUMMONS. + * + * male pets Represents all of the male tame monsters. + * Count: NUMMONS. + * + * female pets Represents all of the female tame monsters. + * Count: NUMMONS. + * + * invisible Invisible monster placeholder. + * Count: 1. + * + * detect (male) Represents all detected male monsters. + * Count: NUMMONS. + * + * detect (female) Represents all detected female monsters. + * Count: NUMMONS. + * + * corpse One for each monster (male/female not differentiated). + * Count: NUMMONS. + * + * ridden (male) Represents all male monsters being ridden. + * Count: NUMMONS * - * pet Represents all of the tame monsters. Count: NUMMONS + * ridden (female) Represents all female monsters being ridden. + * Count: NUMMONS * - * invisible Invisible monster placeholder. Count: 1 + * object One for each type of object. The first entry is + * 'strange object', the next 1..MAXOCLASSES-1 entries + * are generic (one for each class, including one for + * strange object's 'illobj class'), the rest are + * regular objects. Some members of the generic + * subset are used to prevent color of potions, gems, + * and spellbooks from being revealed when obj->dknown + * hasn't been set, avoiding a bug which had been + * present since day one of color support. + * Count: NUM_OBJECTS * - * detect Represents all detected monsters. Count: NUMMONS + * Stone Stone + * Count: 1 * - * corpse One for each monster. Count: NUMMONS + * main walls level walls (main) + * Count: (S_trwall - S_vwall) + 1 = 11 * - * ridden Represents all monsters being ridden. Count: NUMMONS + * mines walls level walls (mines) + * Count: (S_trwall - S_vwall) + 1 = 11 * - * object One for each object. Count: NUM_OBJECTS + * gehennom walls level walls (gehennom) + * Count: (S_trwall - S_vwall) + 1 = 11 * - * cmap One for each entry in the character map. The character map - * is the dungeon features and other miscellaneous things. - * Count: MAXPCHARS + * knox walls level walls (knox) + * Count: (S_trwall - S_vwall) + 1 = 11 * - * explosions A set of nine for each of the following seven explosion types: - * dark, noxious, muddy, wet, magical, fiery, frosty. - * The nine positions represent those surrounding the hero. - * Count: MAXEXPCHARS * EXPL_MAX (EXPL_MAX is defined in hack.h) + * sokoban walls level walls (sokoban) + * Count: (S_trwall - S_vwall) + 1 = 11 * - * zap beam A set of four (there are four directions) for each beam type. - * The beam type is shifted over 2 positions and the direction - * is stored in the lower 2 bits. Count: NUM_ZAP << 2 + * cmap A S_ndoor through S_brdnladder + * Count: (S_brdnladder - S_ndoor) + 1 = 19 * - * swallow A set of eight for each monster. The eight positions rep- - * resent those surrounding the hero. The monster number is - * shifted over 3 positions and the swallow position is stored - * in the lower three bits. Count: NUMMONS << 3 + * Altars Altar (unaligned, chaotic, neutral, lawful, other) + * Count: 5 * - * warning A set of six representing the different warning levels. + * cmap B S_grave through S_arrow_trap + TRAPNUM - 1 + * Count: (S_arrow_trap + (TRAPNUM - 1) - S_grave) = 39 * - * statue One for each monster. Count: NUMMONS + * zap beams set of four (there are four directions) HI_ZAP. + * Count: 4 * NUM_ZAP + * + * cmap C S_digbeam through S_goodpos + * Count: (S_goodpos - S_digbeam) + 1 = 10 + * + * swallow A set of eight for each monster. The eight positions + * represent those surrounding the hero. The monster + * number is shifted over 3 positions and the swallow + * position is stored in the lower three bits. + * Count: NUMMONS << 3 + * + * dark explosions A set of nine. + * Count: MAXEXPCHAR + * + * noxious explosions A set of nine. + * Count: MAXEXPCHAR + * + * muddy explosions A set of nine. + * Count: MAXEXPCHAR + * + * wet explosions A set of nine. + * Count: MAXEXPCHAR + * + * magical explosions A set of nine. + * Count: MAXEXPCHAR + * + * fiery explosions A set of nine. + * Count: MAXEXPCHAR + * + * frosty explosions A set of nine. + * Count: MAXEXPCHAR + * + * warning A set of six representing the different warning + * levels. + * Count: 6 + * + * statues (male) One for each male monster. + * Count: NUMMONS + * + * statues (female) One for each female mo nster. + * Count: NUMMONS + * + * objects piletop Represents the top of a pile as well as + * the object. + * Count: NUM_OBJECTS + * + * bodies piletop Represents the top of a pile as well as + * the object, corpse in this case. + * Count: NUMMONS + * + * male statues piletop Represents the top of a pile as well as + * the statue of a male monster. + * Count: NUMMONS + * + * female statues piletop Represents the top of a pile as well as + * the statue of a female monster. + * Count: NUMMONS + * + * unexplored One for unexplored areas of the map + * nothing Nothing but background * * The following are offsets used to convert to and from a glyph. */ -#define NUM_ZAP 8 /* number of zap beam types */ -#define GLYPH_MON_OFF 0 -#define GLYPH_PET_OFF (NUMMONS + GLYPH_MON_OFF) -#define GLYPH_INVIS_OFF (NUMMONS + GLYPH_PET_OFF) -#define GLYPH_DETECT_OFF (1 + GLYPH_INVIS_OFF) -#define GLYPH_BODY_OFF (NUMMONS + GLYPH_DETECT_OFF) -#define GLYPH_RIDDEN_OFF (NUMMONS + GLYPH_BODY_OFF) -#define GLYPH_OBJ_OFF (NUMMONS + GLYPH_RIDDEN_OFF) -#define GLYPH_CMAP_OFF (NUM_OBJECTS + GLYPH_OBJ_OFF) -#define GLYPH_EXPLODE_OFF ((MAXPCHARS - MAXEXPCHARS) + GLYPH_CMAP_OFF) -#define GLYPH_ZAP_OFF ((MAXEXPCHARS * EXPL_MAX) + GLYPH_EXPLODE_OFF) -#define GLYPH_SWALLOW_OFF ((NUM_ZAP << 2) + GLYPH_ZAP_OFF) -#define GLYPH_WARNING_OFF ((NUMMONS << 3) + GLYPH_SWALLOW_OFF) -#define GLYPH_STATUE_OFF (WARNCOUNT + GLYPH_WARNING_OFF) -#define MAX_GLYPH (NUMMONS + GLYPH_STATUE_OFF) +enum glyph_offsets { + GLYPH_MON_OFF = 0, + GLYPH_MON_MALE_OFF = (GLYPH_MON_OFF), + GLYPH_MON_FEM_OFF = (NUMMONS + GLYPH_MON_MALE_OFF), + GLYPH_PET_OFF = (NUMMONS + GLYPH_MON_FEM_OFF), + GLYPH_PET_MALE_OFF = (GLYPH_PET_OFF), + GLYPH_PET_FEM_OFF = (NUMMONS + GLYPH_PET_MALE_OFF), + GLYPH_INVIS_OFF = (NUMMONS + GLYPH_PET_FEM_OFF), + GLYPH_DETECT_OFF = (1 + GLYPH_INVIS_OFF), + GLYPH_DETECT_MALE_OFF = (GLYPH_DETECT_OFF), + GLYPH_DETECT_FEM_OFF = (NUMMONS + GLYPH_DETECT_MALE_OFF), + GLYPH_BODY_OFF = (NUMMONS + GLYPH_DETECT_FEM_OFF), + GLYPH_RIDDEN_OFF = (NUMMONS + GLYPH_BODY_OFF), + GLYPH_RIDDEN_MALE_OFF = (GLYPH_RIDDEN_OFF), + GLYPH_RIDDEN_FEM_OFF = (NUMMONS + GLYPH_RIDDEN_MALE_OFF), + GLYPH_OBJ_OFF = (NUMMONS + GLYPH_RIDDEN_FEM_OFF), + GLYPH_CMAP_OFF = (NUM_OBJECTS + GLYPH_OBJ_OFF), + GLYPH_CMAP_STONE_OFF = (GLYPH_CMAP_OFF), + GLYPH_CMAP_MAIN_OFF = (1 + GLYPH_CMAP_STONE_OFF), + GLYPH_CMAP_MINES_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_MAIN_OFF), + GLYPH_CMAP_GEH_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_MINES_OFF), + GLYPH_CMAP_KNOX_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_GEH_OFF), + GLYPH_CMAP_SOKO_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_KNOX_OFF), + GLYPH_CMAP_A_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_SOKO_OFF), + GLYPH_ALTAR_OFF = (((S_brdnladder - S_ndoor) + 1) + GLYPH_CMAP_A_OFF), + GLYPH_CMAP_B_OFF = (5 + GLYPH_ALTAR_OFF), + GLYPH_ZAP_OFF = ((S_arrow_trap + MAXTCHARS - S_grave) + GLYPH_CMAP_B_OFF), + GLYPH_CMAP_C_OFF = ((NUM_ZAP << 2) + GLYPH_ZAP_OFF), + GLYPH_SWALLOW_OFF = (((S_goodpos - S_digbeam) + 1) + GLYPH_CMAP_C_OFF), + GLYPH_EXPLODE_OFF = ((NUMMONS << 3) + GLYPH_SWALLOW_OFF), + GLYPH_EXPLODE_DARK_OFF = (GLYPH_EXPLODE_OFF), + GLYPH_EXPLODE_NOXIOUS_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_DARK_OFF), + GLYPH_EXPLODE_MUDDY_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_NOXIOUS_OFF), + GLYPH_EXPLODE_WET_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_MUDDY_OFF), + GLYPH_EXPLODE_MAGICAL_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_WET_OFF), + GLYPH_EXPLODE_FIERY_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_MAGICAL_OFF), + GLYPH_EXPLODE_FROSTY_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_FIERY_OFF), + GLYPH_WARNING_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_FROSTY_OFF), + GLYPH_STATUE_OFF = (WARNCOUNT + GLYPH_WARNING_OFF), + GLYPH_STATUE_MALE_OFF = (GLYPH_STATUE_OFF), + GLYPH_STATUE_FEM_OFF = (NUMMONS + GLYPH_STATUE_MALE_OFF), + GLYPH_PILETOP_OFF = (NUMMONS + GLYPH_STATUE_FEM_OFF), + GLYPH_OBJ_PILETOP_OFF = (GLYPH_PILETOP_OFF), + GLYPH_BODY_PILETOP_OFF = (NUM_OBJECTS + GLYPH_OBJ_PILETOP_OFF), + GLYPH_STATUE_MALE_PILETOP_OFF = (NUMMONS + GLYPH_BODY_PILETOP_OFF), + GLYPH_STATUE_FEM_PILETOP_OFF = (NUMMONS + GLYPH_STATUE_MALE_PILETOP_OFF), + GLYPH_UNEXPLORED_OFF = (NUMMONS + GLYPH_STATUE_FEM_PILETOP_OFF), + GLYPH_NOTHING_OFF = (GLYPH_UNEXPLORED_OFF + 1), + MAX_GLYPH +}; #define NO_GLYPH MAX_GLYPH #define GLYPH_INVISIBLE GLYPH_INVIS_OFF +#define GLYPH_UNEXPLORED GLYPH_UNEXPLORED_OFF +#define GLYPH_NOTHING GLYPH_NOTHING_OFF #define warning_to_glyph(mwarnlev) ((mwarnlev) + GLYPH_WARNING_OFF) -#define mon_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_MON_OFF) -#define detected_mon_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_DETECT_OFF) -#define ridden_mon_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_RIDDEN_OFF) -#define pet_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_PET_OFF) - -/* This has the unfortunate side effect of needing a global variable */ -/* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */ -#define random_obj_to_glyph(rng) \ - ((otg_temp = random_object(rng)) == CORPSE \ - ? random_monster(rng) + GLYPH_BODY_OFF \ - : otg_temp + GLYPH_OBJ_OFF) - -#define obj_to_glyph(obj, rng) \ - (((obj)->otyp == STATUE) \ - ? statue_to_glyph(obj, rng) \ - : Hallucination \ - ? random_obj_to_glyph(rng) \ - : ((obj)->otyp == CORPSE) \ - ? (int) (obj)->corpsenm + GLYPH_BODY_OFF \ - : (int) (obj)->otyp + GLYPH_OBJ_OFF) +#define mon_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) \ + + (((mon)->female == 0) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF)) +#define detected_mon_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) \ + + (((mon)->female == 0) ? GLYPH_DETECT_MALE_OFF : GLYPH_DETECT_FEM_OFF)) +#define ridden_mon_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) \ + + (((mon)->female == 0) ? GLYPH_RIDDEN_MALE_OFF : GLYPH_RIDDEN_FEM_OFF)) +#define pet_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) \ + + (((mon)->female == 0) ? GLYPH_PET_MALE_OFF : GLYPH_PET_FEM_OFF)) -/* MRKR: Statues now have glyphs corresponding to the monster they */ -/* represent and look like monsters when you are hallucinating. */ +/* treat unaligned as the default instead of explicitly checking for it; + altar alignment uses 3 bits with 4 defined values and 4 unused ones */ +#define altar_to_glyph(amsk) \ + ((((amsk) & AM_SANCTUM) == AM_SANCTUM) \ + ? (GLYPH_ALTAR_OFF + altar_other) \ + : (((amsk) & AM_MASK) == AM_LAWFUL) \ + ? (GLYPH_ALTAR_OFF + altar_lawful) \ + : (((amsk) & AM_MASK) == AM_NEUTRAL) \ + ? (GLYPH_ALTAR_OFF + altar_neutral) \ + : (((amsk) & AM_MASK) == AM_CHAOTIC) \ + ? (GLYPH_ALTAR_OFF + altar_chaotic) \ + /* (((amsk) & AM_MASK) == AM_UNALIGNED) */ \ + : (GLYPH_ALTAR_OFF + altar_unaligned)) + +/* not used, nor is it correct +#define zap_to_glyph(zaptype, cmap_idx) \ + ((((cmap_idx) - S_vbeam) + 1) + GLYPH_ZAP_OFF) +*/ + +/* EXPL_FIERY is the default explosion type */ +#define explosion_to_glyph(expltyp, idx) \ + ((idx) - S_expl_tl \ + + (((expltyp) == EXPL_FROSTY) ? GLYPH_EXPLODE_FROSTY_OFF \ + : ((expltyp) == EXPL_MAGICAL) ? GLYPH_EXPLODE_MAGICAL_OFF \ + : ((expltyp) == EXPL_WET) ? GLYPH_EXPLODE_WET_OFF \ + : ((expltyp) == EXPL_MUDDY) ? GLYPH_EXPLODE_MUDDY_OFF \ + : ((expltyp) == EXPL_NOXIOUS) ? GLYPH_EXPLODE_NOXIOUS_OFF \ + : GLYPH_EXPLODE_FIERY_OFF)) + +/* cmap_walls_to_glyph(): return the glyph number for specified wall + symbol; result varies by dungeon branch */ +#define cmap_walls_to_glyph(cmap_idx) \ + ((cmap_idx) - S_vwall \ + + (In_mines(&u.uz) ? GLYPH_CMAP_MINES_OFF \ + : In_hell(&u.uz) ? GLYPH_CMAP_GEH_OFF \ + : Is_knox(&u.uz) ? GLYPH_CMAP_KNOX_OFF \ + : In_sokoban(&u.uz) ? GLYPH_CMAP_SOKO_OFF \ + : GLYPH_CMAP_MAIN_OFF)) + +/* cmap_D0walls_to_glyph(): simpler version of cmap_walls_to_glyph() + which returns the glyph that would be used in the main dungeon, + regardless of hero's current location */ +#define cmap_D0walls_to_glyph(cmap_idx) \ + ((cmap_idx) - S_vwall + GLYPH_CMAP_MAIN_OFF) -#define statue_to_glyph(obj, rng) \ - (Hallucination ? random_monster(rng) + GLYPH_MON_OFF \ - : (int) (obj)->corpsenm + GLYPH_STATUE_OFF) +#define cmap_a_to_glyph(cmap_idx) \ + (((cmap_idx) - S_ndoor) + GLYPH_CMAP_A_OFF) -#define cmap_to_glyph(cmap_idx) ((int) (cmap_idx) + GLYPH_CMAP_OFF) -#define explosion_to_glyph(expltype, idx) \ - ((((expltype) * MAXEXPCHARS) + ((idx) - S_explode1)) + GLYPH_EXPLODE_OFF) +#define cmap_b_to_glyph(cmap_idx) \ + (((cmap_idx) - S_grave) + GLYPH_CMAP_B_OFF) -#define trap_to_glyph(trap, rng) \ - cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp, rng))) +#define cmap_c_to_glyph(cmap_idx) \ + (((cmap_idx) - S_digbeam) + GLYPH_CMAP_C_OFF) + +#define cmap_to_glyph(cmap_idx) \ + ( ((cmap_idx) == S_stone) ? GLYPH_CMAP_STONE_OFF \ + : ((cmap_idx) <= S_trwall) ? cmap_walls_to_glyph(cmap_idx) \ + : ((cmap_idx) < S_altar) ? cmap_a_to_glyph(cmap_idx) \ + : ((cmap_idx) == S_altar) ? altar_to_glyph(AM_NEUTRAL) \ + : ((cmap_idx) < S_arrow_trap + MAXTCHARS) ? cmap_b_to_glyph(cmap_idx) \ + : ((cmap_idx) <= S_goodpos) ? cmap_c_to_glyph(cmap_idx) \ + : NO_GLYPH ) + +#define trap_to_glyph(trap) \ + cmap_to_glyph(trap_to_defsym(((int) (trap)->ttyp))) + +#define engraving_to_glyph(ep) \ + cmap_to_glyph(engraving_to_defsym(ep)) /* Not affected by hallucination. Gives a generic body for CORPSE */ /* MRKR: ...and the generic statue */ #define objnum_to_glyph(onum) ((int) (onum) + GLYPH_OBJ_OFF) -#define monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_MON_OFF) -#define detected_monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_DETECT_OFF) -#define ridden_monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_RIDDEN_OFF) -#define petnum_to_glyph(mnum) ((int) (mnum) + GLYPH_PET_OFF) +#define monnum_to_glyph(mnum,gnd) \ + ((int) (mnum) + (((gnd) == MALE) ? GLYPH_MON_MALE_OFF \ + : GLYPH_MON_FEM_OFF)) +#define detected_monnum_to_glyph(mnum,gnd) \ + ((int) (mnum) + (((gnd) == MALE) ? GLYPH_DETECT_MALE_OFF \ + : GLYPH_DETECT_FEM_OFF)) +#define ridden_monnum_to_glyph(mnum,gnd) \ + ((int) (mnum) + (((gnd) == MALE) ? GLYPH_RIDDEN_MALE_OFF \ + : GLYPH_RIDDEN_FEM_OFF)) +#define petnum_to_glyph(mnum,gnd) \ + ((int) (mnum) + (((gnd) == MALE) ? GLYPH_PET_MALE_OFF \ + : GLYPH_PET_FEM_OFF)) /* The hero's glyph when seen as a monster. */ -#define hero_glyph \ - monnum_to_glyph((Upolyd || !flags.showrace) \ - ? u.umonnum \ - : (flags.female && urace.femalenum != NON_PM) \ - ? urace.femalenum \ - : urace.malenum) +#define hero_glyph \ + monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : gu.urace.mnum, \ + (Ugender)) /* - * Change the given glyph into it's given type. Note: + * Change the given glyph into its given type. Note: * 1) Pets, detected, and ridden monsters are animals and are converted * to the proper monster number. * 2) Bodies are all mapped into the generic CORPSE object @@ -370,73 +667,374 @@ * out of range, it will return zero (for lack of anything better * to return). */ -#define glyph_to_mon(glyph) \ - (glyph_is_normal_monster(glyph) \ - ? ((glyph) - GLYPH_MON_OFF) \ - : glyph_is_pet(glyph) \ - ? ((glyph) - GLYPH_PET_OFF) \ - : glyph_is_detected_monster(glyph) \ - ? ((glyph) - GLYPH_DETECT_OFF) \ - : glyph_is_ridden_monster(glyph) \ - ? ((glyph) - GLYPH_RIDDEN_OFF) \ - : glyph_is_statue(glyph) \ - ? ((glyph) - GLYPH_STATUE_OFF) \ - : NO_GLYPH) -#define glyph_to_obj(glyph) \ - (glyph_is_body(glyph) \ - ? CORPSE \ - : glyph_is_statue(glyph) \ - ? STATUE \ - : glyph_is_normal_object(glyph) \ - ? ((glyph) - GLYPH_OBJ_OFF) \ - : NO_GLYPH) + #define glyph_to_trap(glyph) \ - (glyph_is_trap(glyph) ? ((int) defsym_to_trap((glyph) - GLYPH_CMAP_OFF)) \ - : NO_GLYPH) -#define glyph_to_cmap(glyph) \ - (glyph_is_cmap(glyph) ? ((glyph) - GLYPH_CMAP_OFF) : NO_GLYPH) + (glyph_is_trap(glyph) \ + ? ((int) defsym_to_trap(((glyph) - GLYPH_TRAP_OFF) + S_arrow_trap)) \ + : NO_GLYPH) + +#define glyph_is_cmap_main(glyph) \ + ((glyph) >= GLYPH_CMAP_MAIN_OFF \ + && (glyph) < (((S_trwall - S_vwall) +1) + GLYPH_CMAP_MAIN_OFF)) +#define glyph_is_cmap_mines(glyph) \ + ((glyph) >= GLYPH_CMAP_MINES_OFF \ + && (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_MINES_OFF)) +#define glyph_is_cmap_gehennom(glyph) \ + ((glyph) >= GLYPH_CMAP_GEH_OFF \ + && (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_GEH_OFF)) +#define glyph_is_cmap_knox(glyph) \ + ((glyph) >= GLYPH_CMAP_KNOX_OFF \ + && (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_KNOX_OFF)) +#define glyph_is_cmap_sokoban(glyph) \ + ((glyph) >= GLYPH_CMAP_SOKO_OFF \ + && (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_SOKO_OFF)) +#define glyph_is_cmap_a(glyph) \ + ((glyph) >= GLYPH_CMAP_A_OFF \ + && (glyph) < (((S_brdnladder - S_ndoor) + 1) + GLYPH_CMAP_A_OFF)) +#define glyph_is_cmap_altar(glyph) \ + ((glyph) >= GLYPH_ALTAR_OFF && (glyph) < (5 + GLYPH_ALTAR_OFF)) +#define glyph_is_cmap_b(glyph) \ + ((glyph) >= GLYPH_CMAP_B_OFF \ + && ((glyph) < ((S_arrow_trap + MAXTCHARS - S_grave) + GLYPH_CMAP_B_OFF))) +#define glyph_is_cmap_zap(glyph) \ + ((glyph) >= GLYPH_ZAP_OFF && (glyph) < ((NUM_ZAP << 2) + GLYPH_ZAP_OFF)) +#define glyph_is_cmap_c(glyph) \ + ((glyph) >= GLYPH_CMAP_C_OFF \ + && (glyph) < (((S_goodpos - S_digbeam) + 1) + GLYPH_CMAP_C_OFF)) +#define glyph_is_swallow(glyph) \ + ((glyph) >= GLYPH_SWALLOW_OFF \ + && (glyph) < (((NUMMONS << 3) + GLYPH_SWALLOW_OFF))) +#define glyph_is_explosion(glyph) \ + ((glyph) >= GLYPH_EXPLODE_OFF \ + && (glyph) < (MAXEXPCHARS + GLYPH_EXPLODE_FROSTY_OFF)) +#if 0 /* this is more precise but expands to a lot of unnecessary code */ +#define glyph_is_cmap(glyph) \ + (((glyph) == GLYPH_CMAP_STONE_OFF) \ + || glyph_is_cmap_main(glyph) \ + || glyph_is_cmap_mines(glyph) \ + || glyph_is_cmap_gehennom(glyph) \ + || glyph_is_cmap_knox(glyph) \ + || glyph_is_cmap_sokoban(glyph) \ + || glyph_is_cmap_a(glyph) \ + || glyph_is_cmap_altar(glyph) \ + || glyph_is_cmap_b(glyph) \ + || glyph_is_cmap_c(glyph)) +#endif +#define glyph_is_cmap(glyph) \ + ((glyph) >= GLYPH_CMAP_STONE_OFF \ + && (glyph) < (GLYPH_CMAP_C_OFF + ((S_goodpos - S_digbeam) + 1))) #define glyph_to_swallow(glyph) \ (glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : 0) +#define glyph_to_explosion(glyph) \ + (glyph_is_explosion(glyph) ? (((glyph) - GLYPH_EXPLODE_OFF) % (S_expl_br - S_expl_tl + 1)) : 0) #define glyph_to_warning(glyph) \ - (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : NO_GLYPH); + (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : 0) /* * Return true if the given glyph is what we want. Note that bodies are * considered objects. */ -#define glyph_is_monster(glyph) \ - (glyph_is_normal_monster(glyph) || glyph_is_pet(glyph) \ - || glyph_is_ridden_monster(glyph) || glyph_is_detected_monster(glyph)) +#define glyph_is_normal_male_monster(glyph) \ + ((glyph) >= GLYPH_MON_MALE_OFF \ + && (glyph) < (GLYPH_MON_MALE_OFF + NUMMONS)) +#define glyph_is_normal_female_monster(glyph) \ + ((glyph) >= GLYPH_MON_FEM_OFF && (glyph) < (GLYPH_MON_FEM_OFF + NUMMONS)) #define glyph_is_normal_monster(glyph) \ - ((glyph) >= GLYPH_MON_OFF && (glyph) < (GLYPH_MON_OFF + NUMMONS)) + (glyph_is_normal_male_monster(glyph) \ + || glyph_is_normal_female_monster(glyph)) +#define glyph_is_female_pet(glyph) \ + ((glyph) >= GLYPH_PET_FEM_OFF && (glyph) < (GLYPH_PET_FEM_OFF + NUMMONS)) +#define glyph_is_male_pet(glyph) \ + ((glyph) >= GLYPH_PET_MALE_OFF \ + && (glyph) < (GLYPH_PET_MALE_OFF + NUMMONS)) #define glyph_is_pet(glyph) \ - ((glyph) >= GLYPH_PET_OFF && (glyph) < (GLYPH_PET_OFF + NUMMONS)) -#define glyph_is_body(glyph) \ - ((glyph) >= GLYPH_BODY_OFF && (glyph) < (GLYPH_BODY_OFF + NUMMONS)) - -#define glyph_is_statue(glyph) \ - ((glyph) >= GLYPH_STATUE_OFF && (glyph) < (GLYPH_STATUE_OFF + NUMMONS)) - + (glyph_is_male_pet(glyph) || glyph_is_female_pet(glyph)) +#define glyph_is_ridden_female_monster(glyph) \ + ((glyph) >= GLYPH_RIDDEN_FEM_OFF \ + && (glyph) < (GLYPH_RIDDEN_FEM_OFF + NUMMONS)) +#define glyph_is_ridden_male_monster(glyph) \ + ((glyph) >= GLYPH_RIDDEN_MALE_OFF \ + && (glyph) < (GLYPH_RIDDEN_MALE_OFF + NUMMONS)) #define glyph_is_ridden_monster(glyph) \ - ((glyph) >= GLYPH_RIDDEN_OFF && (glyph) < (GLYPH_RIDDEN_OFF + NUMMONS)) + (glyph_is_ridden_male_monster(glyph) \ + || glyph_is_ridden_female_monster(glyph)) +#define glyph_is_detected_female_monster(glyph) \ + ((glyph) >= GLYPH_DETECT_FEM_OFF \ + && (glyph) < (GLYPH_DETECT_FEM_OFF + NUMMONS)) +#define glyph_is_detected_male_monster(glyph) \ + ((glyph) >= GLYPH_DETECT_MALE_OFF \ + && (glyph) < (GLYPH_DETECT_MALE_OFF + NUMMONS)) #define glyph_is_detected_monster(glyph) \ - ((glyph) >= GLYPH_DETECT_OFF && (glyph) < (GLYPH_DETECT_OFF + NUMMONS)) + (glyph_is_detected_male_monster(glyph) \ + || glyph_is_detected_female_monster(glyph)) +#define glyph_is_monster(glyph) \ + (glyph_is_normal_monster(glyph) || glyph_is_pet(glyph) \ + || glyph_is_ridden_monster(glyph) || glyph_is_detected_monster(glyph)) #define glyph_is_invisible(glyph) ((glyph) == GLYPH_INVISIBLE) + +/* final NUMMONS is legal array index because of trailing fencepost entry */ +#define glyph_to_mon(glyph) \ + (glyph_is_normal_female_monster(glyph) \ + ? ((glyph) - GLYPH_MON_FEM_OFF) \ + : glyph_is_normal_male_monster(glyph) \ + ? ((glyph) - GLYPH_MON_MALE_OFF) \ + : glyph_is_female_pet(glyph) \ + ? ((glyph) - GLYPH_PET_FEM_OFF) \ + : glyph_is_male_pet(glyph) \ + ? ((glyph) - GLYPH_PET_MALE_OFF) \ + : glyph_is_detected_female_monster(glyph) \ + ? ((glyph) - GLYPH_DETECT_FEM_OFF) \ + : glyph_is_detected_male_monster(glyph) \ + ? ((glyph) - GLYPH_DETECT_MALE_OFF) \ + : glyph_is_ridden_female_monster(glyph) \ + ? ((glyph) - GLYPH_RIDDEN_FEM_OFF) \ + : glyph_is_ridden_male_monster(glyph) \ + ? ((glyph) - GLYPH_RIDDEN_MALE_OFF) \ + : NUMMONS) + +/* boulder hides pile except when on top of another boulder; + the otg_otmp assignment might occur multiple times in the same + expression but there will always be sequence points in between */ +#define obj_is_piletop(obj) \ + ((obj)->where == OBJ_FLOOR \ + && ((go.otg_otmp = svl.level.objects[(obj)->ox][(obj)->oy]->nexthere) \ + != 0) \ + && ((obj)->otyp != BOULDER || go.otg_otmp->otyp == BOULDER)) +/* used to hide info such as potion and gem color when not seen yet; + stones and rock are excluded for gem class; LAST_SPELL includes blank + spellbook but excludes novel and the Book of the Dead */ +#define obj_is_generic(obj) \ + (!(obj)->dknown \ + && ((obj)->oclass == POTION_CLASS \ + || ((obj)->otyp >= FIRST_REAL_GEM \ + && ((obj)->otyp <= LAST_GLASS_GEM)) \ + || ((obj)->otyp >= FIRST_SPELL \ + && ((obj)->otyp <= LAST_SPELL)))) + +#define glyph_is_body_piletop(glyph) \ + (((glyph) >= GLYPH_BODY_PILETOP_OFF) \ + && ((glyph) < (GLYPH_BODY_PILETOP_OFF + NUMMONS))) +#define glyph_is_body(glyph) \ + ((((glyph) >= GLYPH_BODY_OFF) && ((glyph) < (GLYPH_BODY_OFF + NUMMONS))) \ + || glyph_is_body_piletop(glyph)) + +#define glyph_is_fem_statue_piletop(glyph) \ + (((glyph) >= GLYPH_STATUE_FEM_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_PILETOP_OFF + NUMMONS))) +#define glyph_is_male_statue_piletop(glyph) \ + (((glyph) >= GLYPH_STATUE_MALE_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_PILETOP_OFF + NUMMONS))) +#define glyph_is_fem_statue(glyph) \ + ((((glyph) >= GLYPH_STATUE_FEM_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_OFF + NUMMONS))) \ + || glyph_is_fem_statue_piletop(glyph)) +#define glyph_is_male_statue(glyph) \ + ((((glyph) >= GLYPH_STATUE_MALE_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_OFF + NUMMONS))) \ + || glyph_is_male_statue_piletop(glyph)) +#define glyph_is_statue(glyph) \ + (glyph_is_male_statue(glyph) || glyph_is_fem_statue(glyph)) +/* generic objects are after strange object (GLYPH_OBJ_OFF) and before + other objects (GLYPH_OBJ_OFF + FIRST_OBJECT) */ +#define glyph_is_normal_generic_obj(glyph) \ + ((glyph) > GLYPH_OBJ_OFF && (glyph) < GLYPH_OBJ_OFF + FIRST_OBJECT - 1) +#define glyph_is_piletop_generic_obj(glyph) \ + ((glyph) > GLYPH_OBJ_PILETOP_OFF \ + && (glyph) < GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT - 1) +#define glyph_is_generic_object(glyph) \ + (glyph_is_normal_generic_obj(glyph) \ + || glyph_is_piletop_generic_obj(glyph)) +#define glyph_is_normal_piletop_obj(glyph) \ + ((glyph) == GLYPH_OBJ_PILETOP_OFF \ + || ((glyph) > GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT - 1 \ + && (glyph) < (GLYPH_OBJ_PILETOP_OFF + NUM_OBJECTS))) #define glyph_is_normal_object(glyph) \ - ((glyph) >= GLYPH_OBJ_OFF && (glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS)) -#define glyph_is_object(glyph) \ - (glyph_is_normal_object(glyph) || glyph_is_statue(glyph) \ - || glyph_is_body(glyph)) -#define glyph_is_trap(glyph) \ - ((glyph) >= (GLYPH_CMAP_OFF + trap_to_defsym(1)) \ - && (glyph) < (GLYPH_CMAP_OFF + trap_to_defsym(1) + TRAPNUM)) -#define glyph_is_cmap(glyph) \ - ((glyph) >= GLYPH_CMAP_OFF && (glyph) < (GLYPH_CMAP_OFF + MAXPCHARS)) -#define glyph_is_swallow(glyph) \ - ((glyph) >= GLYPH_SWALLOW_OFF \ - && (glyph) < (GLYPH_SWALLOW_OFF + (NUMMONS << 3))) -#define glyph_is_warning(glyph) \ - ((glyph) >= GLYPH_WARNING_OFF \ + ((glyph) == GLYPH_OBJ_OFF \ + || ((glyph) >= GLYPH_OBJ_OFF + FIRST_OBJECT - 1 \ + && (glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS)) \ + || glyph_is_normal_piletop_obj(glyph)) + +#if 0 /* [note: out of date] */ +#define glyph_is_object(glyph) \ + ( (((glyph) >= GLYPH_OBJ_OFF) \ + && ((glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS))) \ + || (((glyph) >= GLYPH_OBJ_PILETOP_OFF) \ + && ((glyph) < (GLYPH_OBJ_PILETOP_OFF + NUM_OBJECTS))) \ + || (((glyph) >= GLYPH_STATUE_MALE_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_STATUE_MALE_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_PILETOP_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_STATUE_FEM_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_STATUE_FEM_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_PILETOP_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_BODY_OFF) \ + && ((glyph) < (GLYPH_BODY_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_BODY_PILETOP_OFF) \ + && ((glyph) < (GLYPH_BODY_PILETOP_OFF + NUMMONS))) \ + ) +#endif +#define glyph_is_object(glyph) \ + (glyph_is_normal_object(glyph) || glyph_is_generic_object(glyph) \ + || glyph_is_statue(glyph) || glyph_is_body(glyph)) + +/* briefly used for Qt's "paper doll" inventory which shows map tiles for + equipped objects; those vary like floor items during hallucination now + so this isn't used anywhere [note: out of date since generic objs added] */ +#define obj_to_true_glyph(obj) \ + (((obj)->otyp == STATUE) \ + ? ((int) (obj)->corpsenm \ + + (((obj)->spe & CORPSTAT_GENDER) == CORPSTAT_FEMALE) \ + ? (obj_is_piletop(obj) \ + ? (GLYPH_STATUE_FEM_PILETOP_OFF) \ + : (GLYPH_STATUE_FEM_OFF)) \ + : (obj_is_piletop(obj) \ + ? (GLYPH_STATUE_MALE_PILETOP_OFF) \ + : (GLYPH_STATUE_MALE_OFF)) \ + : (((obj)->otyp == CORPSE) \ + ? ((int) (obj)->corpsenm \ + + (obj_is_piletop(obj) \ + ? (GLYPH_BODY_PILETOP_OFF) \ + ? (GLYPH_BODY_OFF))) \ + : ((int) (obj)->otyp + GLYPH_OBJ_OFF)))) + +/* final NUM_OBJECTS is legal array idx because of trailing fencepost entry */ +#define glyph_to_obj(glyph) \ + (glyph_is_body(glyph) ? CORPSE \ + : glyph_is_statue(glyph) ? STATUE \ + : glyph_is_generic_object(glyph) \ + ? ((glyph) - (glyph_is_piletop_generic_obj(glyph) \ + ? GLYPH_OBJ_PILETOP_OFF \ + : GLYPH_OBJ_OFF)) \ + : glyph_is_normal_object(glyph) \ + ? ((glyph) - (glyph_is_normal_piletop_obj(glyph) \ + ? GLYPH_OBJ_PILETOP_OFF \ + : GLYPH_OBJ_OFF)) \ + : NUM_OBJECTS) + +#define glyph_to_body_corpsenm(glyph) \ + (glyph_is_body_piletop(glyph) \ + ? ((glyph) - GLYPH_BODY_PILETOP_OFF) \ + : ((glyph) - GLYPH_BODY_OFF)) + +#define glyph_to_statue_corpsenm(glyph) \ + (glyph_is_fem_statue_piletop(glyph) \ + ? ((glyph) - GLYPH_STATUE_FEM_PILETOP_OFF) \ + : glyph_is_male_statue_piletop(glyph) \ + ? ((glyph) - GLYPH_STATUE_MALE_PILETOP_OFF) \ + : glyph_is_fem_statue(glyph) \ + ? ((glyph) - GLYPH_STATUE_FEM_OFF) \ + : glyph_is_male_statue(glyph) \ + ? ((glyph) - GLYPH_STATUE_MALE_OFF) \ + : NO_GLYPH) + +/* This has the unfortunate side effect of needing a global variable + to store a result. 'otg_temp' is defined and declared in decl.{ch}. */ +#define random_obj_to_glyph(rng) \ + (((go.otg_temp = random_object(rng)) == CORPSE) \ + ? (random_monster(rng) + GLYPH_BODY_OFF) \ + : (go.otg_temp + GLYPH_OBJ_OFF)) +#define corpse_to_glyph(obj) \ + ((int) ((obj)->corpsenm \ + + (obj_is_piletop(obj) ? GLYPH_BODY_PILETOP_OFF : GLYPH_BODY_OFF))) +#define generic_obj_to_glyph(obj) \ + ((int) ((obj)->oclass \ + + (obj_is_piletop(obj) ? GLYPH_OBJ_PILETOP_OFF : GLYPH_OBJ_OFF))) +#define normal_obj_to_glyph(obj) \ + ((int) ((obj)->otyp \ + + (obj_is_piletop(obj) ? GLYPH_OBJ_PILETOP_OFF : GLYPH_OBJ_OFF))) + +/* MRKR: Statues now have glyphs corresponding to the monster they */ +/* represent and look like monsters when you are hallucinating. */ + +#define statue_to_glyph(obj, rng) \ + ((Hallucination) \ + ? ((random_monster(rng)) \ + + ((!(rng)(2)) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF)) \ + : ((int) (obj)->corpsenm \ + + ((((obj)->spe & CORPSTAT_GENDER) == CORPSTAT_FEMALE) \ + ? (obj_is_piletop(obj) \ + ? GLYPH_STATUE_FEM_PILETOP_OFF \ + : GLYPH_STATUE_FEM_OFF) \ + : (obj_is_piletop(obj) \ + ? GLYPH_STATUE_MALE_PILETOP_OFF \ + : GLYPH_STATUE_MALE_OFF)))) + +#define obj_to_glyph(obj, rng) \ + (((obj)->otyp == STATUE) ? statue_to_glyph(obj, rng) \ + : (Hallucination) ? random_obj_to_glyph(rng) \ + : ((obj)->otyp == CORPSE) ? corpse_to_glyph(obj) \ + : obj_is_generic(obj) ? generic_obj_to_glyph(obj) \ + : normal_obj_to_glyph(obj)) + +#define GLYPH_TRAP_OFF \ + (GLYPH_CMAP_B_OFF + (S_arrow_trap - S_grave)) +#define glyph_is_trap(glyph) \ + ((glyph) >= (GLYPH_TRAP_OFF) \ + && (glyph) < ((GLYPH_TRAP_OFF) + MAXTCHARS)) +#define glyph_is_warning(glyph) \ + ((glyph) >= GLYPH_WARNING_OFF \ && (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT)) +#define glyph_is_unexplored(glyph) ((glyph) == GLYPH_UNEXPLORED) +#define glyph_is_nothing(glyph) ((glyph) == GLYPH_NOTHING) + +#if 0 +#define glyph_is_piletop(glyph) \ + (glyph_is_body_piletop(glyph) \ + || glyph_is_fem_statue_piletop(glyph) \ + || glyph_is_male_statue_piletop(glyph) \ + || glyph_is_piletop_generic_obj(glyph) \ + || glyph_is_normal_piletop_obj(glyph)) +#endif + +/* mgflags for altering map_glyphinfo() internal behavior */ +#define MG_FLAG_NORMAL 0x00 +#define MG_FLAG_NOOVERRIDE 0x01 /* disregard accessibility override values */ + +/* Special mapped glyphflags encoded by reset_glyphmap() + map_glyphinfo() */ +#define MG_HERO 0x00001 /* represents the hero */ +#define MG_CORPSE 0x00002 /* represents a body */ +#define MG_INVIS 0x00004 /* represents invisible monster */ +#define MG_DETECT 0x00008 /* represents a detected monster */ +#define MG_PET 0x00010 /* represents a pet */ +#define MG_RIDDEN 0x00020 /* represents a ridden monster */ +#define MG_STATUE 0x00040 /* represents a statue */ +#define MG_OBJPILE 0x00080 /* more than one stack of objects */ +#define MG_BW_LAVA 0x00100 /* 'black & white lava': highlight lava if it + * can't be distinguished from water by color */ +#define MG_BW_ICE 0x00200 /* similar for ice vs floor */ +#define MG_BW_SINK 0x00200 /* identical for sink vs fountain [note: someday + * this may become a distinct flag */ +#define MG_BW_ENGR 0x00200 /* likewise for corridor engravings */ +#define MG_NOTHING 0x00400 /* char represents GLYPH_NOTHING */ +#define MG_UNEXPL 0x00800 /* char represents GLYPH_UNEXPLORED */ +#define MG_MALE 0x01000 /* represents a male mon or statue of one */ +#define MG_FEMALE 0x02000 /* represents a female mon or statue of one */ +#define MG_BADXY 0x04000 /* bad coordinates were passed */ + +/* docrt(): re-draw whole screen; docrt_flags(): docrt() with more control */ +enum docrt_flags_bits { + docrtRecalc = 0, /* full docrt(), recalculate what the map should show */ + docrtRefresh = 1, /* redraw_map(), draw what we think the map shows */ + docrtMapOnly = 2, /* ORed with Recalc or Refresh; draw the map but not + * status or perminv */ + docrtNocls = 4, +}; + +typedef struct { + xint8 gnew; /* perhaps move this bit into the rm structure. */ + glyph_info glyphinfo; +} gbuf_entry; + +extern const int altarcolors[]; +extern const int zapcolors[]; +extern const int explodecolors[]; +extern int wallcolors[]; + +/* If TILES_IN_GLYPHMAP is defined during build, this is defined + * in the generated tile.c, complete with appropriate tile references in + * the initialization. Otherwise, it gets defined in display.c. + */ +extern const glyph_info nul_glyphinfo; #endif /* DISPLAY_H */ diff --git a/include/dlb.h b/include/dlb.h index e8b9fd253..b090a6f8d 100644 --- a/include/dlb.h +++ b/include/dlb.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 dlb.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ +/* NetHack 5.0 dlb.h $NHDT-Date: 1596498534 2020/08/03 23:48:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.12 $ */ /* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,7 +9,7 @@ #ifdef DLB /* implementations */ -#ifdef MAC +#if defined(MACOS9) && !defined(MACOS9_CROSS) #define DLBRSRC /* use Mac resources */ #else #define DLBLIB /* use a set of external files */ @@ -44,7 +44,7 @@ typedef struct dlb_library { #define DLBFILE dlbfilename #define DLBBASENAME "nhdat" extern char dlbfilename[MAX_DLB_FILENAME]; -extern char *FDECL(build_dlb_filename, (const char *)); +extern char *build_dlb_filename(const char *); #endif #endif #ifndef FILENAME_CMP @@ -75,16 +75,16 @@ typedef struct dlb_handle { #define DLB_P dlb * #endif -boolean NDECL(dlb_init); -void NDECL(dlb_cleanup); +boolean dlb_init(void); +void dlb_cleanup(void); -dlb *FDECL(dlb_fopen, (const char *, const char *)); -int FDECL(dlb_fclose, (DLB_P)); -int FDECL(dlb_fread, (char *, int, int, DLB_P)); -int FDECL(dlb_fseek, (DLB_P, long, int)); -char *FDECL(dlb_fgets, (char *, int, DLB_P)); -int FDECL(dlb_fgetc, (DLB_P)); -long FDECL(dlb_ftell, (DLB_P)); +dlb *dlb_fopen(const char *, const char *); +int dlb_fclose(DLB_P); +int dlb_fread(char *, int, int, DLB_P); +int dlb_fseek(DLB_P, long, int); +char *dlb_fgets(char *, int, DLB_P); +int dlb_fgetc(DLB_P); +long dlb_ftell(DLB_P); /* Resource DLB entry points */ #ifdef DLBRSRC diff --git a/include/dungeon.h b/include/dungeon.h index 1d476ff7a..a19e6e40e 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.h $NHDT-Date: 1447755969 2015/11/17 10:26:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.24 $ */ +/* NetHack 5.0 dungeon.h $NHDT-Date: 1685863327 2023/06/04 07:22:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,20 +6,22 @@ #ifndef DUNGEON_H #define DUNGEON_H +typedef struct d_level { /* basic dungeon level element */ + xint16 dnum; /* dungeon number */ + xint16 dlevel; /* level number */ +} d_level; + +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) + typedef struct d_flags { /* dungeon/level type flags */ Bitfield(town, 1); /* is this a town? (levels only) */ Bitfield(hellish, 1); /* is this part of hell? */ Bitfield(maze_like, 1); /* is this a maze? */ Bitfield(rogue_like, 1); /* is this an old-fashioned presentation? */ Bitfield(align, 3); /* dungeon alignment. */ - Bitfield(unused, 1); /* etc... */ + Bitfield(unconnected, 1); /* dungeon not connected to any branch */ } d_flags; -typedef struct d_level { /* basic dungeon level element */ - xchar dnum; /* dungeon number */ - xchar dlevel; /* level number */ -} d_level; - typedef struct s_level { /* special dungeon level element */ struct s_level *next; d_level dlevel; /* dungeon & level numbers */ @@ -29,12 +31,6 @@ typedef struct s_level { /* special dungeon level element */ d_flags flags; /* type flags */ } s_level; -typedef struct stairway { /* basic stairway identifier */ - xchar sx, sy; /* x / y location of the stair */ - d_level tolev; /* where does it go */ - char up; /* what type of stairway (up/down) */ -} stairway; - /* level region types */ enum level_region_types { LR_DOWNSTAIR = 0, @@ -43,24 +39,35 @@ enum level_region_types { LR_BRANCH, LR_TELE, LR_UPTELE, - LR_DOWNTELE + LR_DOWNTELE, + LR_MONGEN, }; typedef struct dest_area { /* non-stairway level change identifier */ - xchar lx, ly; /* "lower" left corner (near [0,0]) */ - xchar hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */ - xchar nlx, nly; /* outline of invalid area */ - xchar nhx, nhy; /* opposite corner of invalid area */ + coordxy lx, ly; /* "lower" left corner (near [0,0]) */ + coordxy hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */ + coordxy nlx, nly; /* outline of invalid area */ + coordxy nhx, nhy; /* opposite corner of invalid area */ } dest_area; +/* teleportation exclusion zones in the level */ +typedef struct exclusion_zone { + xint16 zonetype; /* level_region_types */ + coordxy lx, ly; + coordxy hx, hy; + struct exclusion_zone *next; +} exclusion_zone; + typedef struct dungeon { /* basic dungeon identifier */ char dname[24]; /* name of the dungeon (eg. "Hell") */ char proto[15]; /* name of prototype file (eg. "tower") */ + char fill_lvl[15]; /* name of "fill" level protype file */ + char themerms[15]; /* lua file name containing themed rooms */ char boneid; /* character to id dungeon in bones files */ d_flags flags; /* dungeon flags */ - xchar entry_lev; /* entry level */ - xchar num_dunlevs; /* number of levels in this dungeon */ - xchar dunlev_ureached; /* how deep you have been in this dungeon */ + xint16 entry_lev; /* entry level */ + xint16 num_dunlevs; /* number of levels in this dungeon */ + xint16 dunlev_ureached; /* how deep you have been in this dungeon */ int ledger_start, /* the starting depth in "real" terms */ depth_start; /* the starting depth in "logical" terms */ } dungeon; @@ -132,6 +139,7 @@ typedef struct branch { #define In_sokoban(x) ((x)->dnum == sokoban_dnum) #define Inhell In_hell(&u.uz) /* now gehennom */ #define In_endgame(x) ((x)->dnum == astral_level.dnum) +#define In_tutorial(x) ((x)->dnum == tutorial_dnum) #define within_bounded_area(X, Y, LX, LY, HX, HY) \ ((X) >= (LX) && (X) <= (HX) && (Y) >= (LY) && (Y) <= (HY)) @@ -151,27 +159,18 @@ typedef struct branch { #define MIGR_WITH_HERO 9 /* mon: followers; obj: trap door */ #define MIGR_NOBREAK 1024 /* bitmask: don't break on delivery */ #define MIGR_NOSCATTER 2048 /* don't scatter on delivery */ -#define MIGR_TO_SPECIES 4096 /* migrating to species as they are made */ +#define MIGR_TO_SPECIES 4096 /* migrating to species as they are made */ #define MIGR_LEFTOVERS 8192 /* grab remaining MIGR_TO_SPECIES objects */ /* level information (saved via ledger number) */ struct linfo { unsigned char flags; #define VISITED 0x01 /* hero has visited this level */ -#define FORGOTTEN 0x02 /* hero will forget this level when reached */ +/* 0x02 was FORGOTTEN, when amnesia made you forget maps */ #define LFILE_EXISTS 0x04 /* a level file exists for this level */ /* Note: VISITED and LFILE_EXISTS are currently almost always - * set at the same time. However they _mean_ different things. + * set at the same time. However, they _mean_ different things. */ -#ifdef MFLOPPY -#define FROMPERM 1 /* for ramdisk use */ -#define TOPERM 2 /* for ramdisk use */ -#define ACTIVE 1 -#define SWAPPED 2 - int where; - long time; - long size; -#endif /* MFLOPPY */ }; /* types and structures for dungeon map recording @@ -187,71 +186,77 @@ struct linfo { * fountains"). This makes it also subject to player conditions (amnesia). */ -/* Because clearly Nethack needs more ways to specify alignment */ -#define Amask2msa(x) ((x) == 4 ? 3 : (x) &AM_MASK) -#define Msa2amask(x) ((x) == 3 ? 4 : (x)) -#define MSA_NONE 0 /* unaligned or multiple alignments */ -#define MSA_LAWFUL 1 -#define MSA_NEUTRAL 2 -#define MSA_CHAOTIC 3 - /* what the player knows about a single dungeon level */ /* initialized in mklev() */ -typedef struct mapseen { - struct mapseen *next; /* next map in the chain */ - branch *br; /* knows about branch via taking it in goto_level */ - d_level lev; /* corresponding dungeon level */ - struct mapseen_feat { - /* feature knowledge that must be calculated from levl array */ - Bitfield(nfount, 2); - Bitfield(nsink, 2); - Bitfield(naltar, 2); - Bitfield(nthrone, 2); +struct mapseen_feat { + /* feature knowledge that must be calculated from levl array */ + Bitfield(nfount, 2); + Bitfield(nsink, 2); + Bitfield(naltar, 2); + Bitfield(nthrone, 2); + + Bitfield(ngrave, 2); + Bitfield(ntree, 2); + Bitfield(water, 2); + Bitfield(lava, 2); - Bitfield(ngrave, 2); - Bitfield(ntree, 2); - Bitfield(water, 2); - Bitfield(lava, 2); + Bitfield(ice, 2); + /* calculated from rooms array */ + Bitfield(nshop, 2); + Bitfield(ntemple, 2); + /* altar alignment; MSA_NONE if there is more than one and + they aren't all the same */ + Bitfield(msalign, 2); - Bitfield(ice, 2); - /* calculated from rooms array */ - Bitfield(nshop, 2); - Bitfield(ntemple, 2); - /* altar alignment; MSA_NONE if there is more than one and - they aren't all the same */ - Bitfield(msalign, 2); + Bitfield(shoptype, 5); +}; +struct mapseen_flags { + Bitfield(notreachable, 1); /* can't get back to this level */ + Bitfield(forgot, 1); /* player has forgotten about this level */ + Bitfield(knownbones, 1); /* player aware of bones */ + Bitfield(oracle, 1); + Bitfield(sokosolved, 1); + Bitfield(bigroom, 1); + Bitfield(castle, 1); + Bitfield(castletune, 1); /* add tune hint to castle annotation */ + + Bitfield(valley, 1); + Bitfield(msanctum, 1); + Bitfield(ludios, 1); + Bitfield(roguelevel, 1); + /* quest annotations: quest_summons is for main dungeon level + with entry portal and is reset once quest has been finished; + questing is for quest home (level 1) */ + Bitfield(quest_summons, 1); /* heard summons from leader */ + Bitfield(questing, 1); /* quest leader has unlocked quest stairs */ + /* "gateway to sanctum" */ + Bitfield(vibrating_square, 1); /* found vibrating square 'trap'; + * flag cleared once the msanctum + * annotation has been added (on + * the next dungeon level; temple + * entered or high altar mapped) */ + Bitfield(spare1, 1); /* not used */ +}; - Bitfield(shoptype, 5); - } feat; - struct mapseen_flags { - Bitfield(unreachable, 1); /* can't get back to this level */ - Bitfield(forgot, 1); /* player has forgotten about this level */ - Bitfield(knownbones, 1); /* player aware of bones */ - Bitfield(oracle, 1); - Bitfield(sokosolved, 1); - Bitfield(bigroom, 1); - Bitfield(castle, 1); - Bitfield(castletune, 1); /* add tune hint to castle annotation */ +struct mapseen_rooms { + Bitfield(seen, 1); + Bitfield(untended, 1); /* flag for shop without shk */ +}; - Bitfield(valley, 1); - Bitfield(msanctum, 1); - Bitfield(ludios, 1); - Bitfield(roguelevel, 1); - /* quest annotations: quest_summons is for main dungeon level - with entry portal and is reset once quest has been finished; - questing is for quest home (level 1) */ - Bitfield(quest_summons, 1); /* heard summons from leader */ - Bitfield(questing, 1); /* quest leader has unlocked quest stairs */ - } flags; +typedef struct mapseen { + struct mapseen *next; /* next map in the chain */ + branch *br; /* knows about branch via taking it in goto_level */ + d_level lev; /* corresponding dungeon level */ + struct mapseen_feat feat; + struct mapseen_flags flags; /* custom naming */ char *custom; unsigned custom_lth; - struct mapseen_rooms { - Bitfield(seen, 1); - Bitfield(untended, 1); /* flag for shop without shk */ - } msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as rooms[] */ + struct mapseen_rooms msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as svr.rooms[] */ /* dead heroes; might not have graves or ghosts */ struct cemetery *final_resting_place; /* same as level.bonesinfo */ } mapseen; +#endif /* !MAKEDEFS_C && !MDLIB_C */ + #endif /* DUNGEON_H */ diff --git a/include/engrave.h b/include/engrave.h index 86f6fcdb8..2437d4e44 100644 --- a/include/engrave.h +++ b/include/engrave.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 engrave.h $NHDT-Date: 1432512777 2015/05/25 00:12:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ +/* NetHack 5.0 engrave.h $NHDT-Date: 1596498535 2020/08/03 23:48:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.10 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,13 +6,23 @@ #ifndef ENGRAVE_H #define ENGRAVE_H +enum engraving_texts { + actual_text, + remembered_text, + pristine_text, + text_states +}; + +#define engr_text_space(ep) ((char *) ((ep) + 1)) + struct engr { struct engr *nxt_engr; - char *engr_txt; - xchar engr_x, engr_y; - unsigned engr_lth; /* for save & restore; not length of text */ + char *engr_txt[text_states]; + coordxy engr_x, engr_y; + unsigned engr_szeach; /* length of text including trailing NUL */ + unsigned engr_alloc; /* for save & restore; not length of text */ long engr_time; /* moment engraving was (will be) finished */ - xchar engr_type; + xint8 engr_type; #define DUST 1 #define ENGRAVE 2 #define BURN 3 @@ -20,10 +30,26 @@ struct engr { #define ENGR_BLOOD 5 #define HEADSTONE 6 #define N_ENGRAVE 6 + Bitfield(guardobjects, 1); /* if engr_txt is "Elbereth", it is effective + * against monsters when an object is present + * even when hero isn't (so behaves similarly + * to how Elbereth did in 3.4.3) */ + Bitfield(nowipeout, 1); /* this engraving will not degrade */ + Bitfield(eread, 1); /* refers to the engaving text: read or felt */ + Bitfield(erevealed, 1); /* refers to engraving map symbol: revealed */ + /* 4 free bits */ }; #define newengr(lth) \ - (struct engr *) alloc((unsigned)(lth) + sizeof(struct engr)) -#define dealloc_engr(engr) free((genericptr_t)(engr)) + (struct engr *) alloc((unsigned) (lth) + (unsigned) sizeof (struct engr)) +#define dealloc_engr(engr) free((genericptr_t) (engr)) + +#define engraving_to_defsym(ep) \ + ((levl[(ep)->engr_x][(ep)->engr_y].typ == CORR) ? S_engrcorr : S_engroom) + +#define spot_shows_engravings(x,y) \ + (levl[(x)][(y)].typ == CORR \ + || levl[(x)][(y)].typ == ICE \ + || levl[(x)][(y)].typ == ROOM) #endif /* ENGRAVE_H */ diff --git a/include/flag.h b/include/flag.h index f10dc9ca2..541343d41 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 flag.h $NHDT-Date: 1574900824 2019/11/28 00:27:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.160 $ */ +/* NetHack 5.0 flag.h $NHDT-Date: 1744860497 2025/04/16 19:28:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.251 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -16,82 +16,65 @@ */ struct flag { - boolean acoustics; /* allow dungeon sound messages */ - boolean autodig; /* MRKR: Automatically dig */ - boolean autoquiver; /* Automatically fill quiver */ - boolean autoopen; /* open doors by walking into them */ - boolean beginner; - boolean biff; /* enable checking for mail */ - boolean bones; /* allow saving/loading bones */ - boolean confirm; /* confirm before hitting tame monsters */ - boolean dark_room; /* show shadows in lit rooms */ - boolean debug; /* in debugging mode */ + boolean acoustics; /* allow dungeon sound messages */ + boolean armorstatus; /* show armor info on status lines */ + boolean autodig; /* MRKR: Automatically dig */ + boolean autoquiver; /* Automatically fill quiver */ + boolean autoopen; /* open doors by walking into them */ + boolean beginner; /* True early in each game; affects feedback */ + boolean biff; /* enable checking for mail */ + boolean bones; /* allow saving/loading bones */ + boolean confirm; /* confirm before hitting tame monsters */ + boolean dark_room; /* show shadows in lit rooms */ + boolean debug; /* in debugging mode (aka wizard mode) */ #define wizard flags.debug - boolean end_own; /* list all own scores */ - boolean explore; /* in exploration mode */ + boolean end_own; /* list all own scores */ + boolean explore; /* in exploration mode (aka discover mode) */ #define discover flags.explore boolean female; boolean friday13; /* it's Friday the 13th */ + boolean goldX; /* for BUCX filtering, whether gold is X or U */ boolean help; /* look in data file for info about stuff */ + boolean tips; /* show helpful hints? */ + boolean tutorial; /* ask if player wants tutorial level? */ boolean ignintr; /* ignore interrupts */ + boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */ boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */ boolean invlet_constant; /* let objects keep their inventory symbol */ boolean legacy; /* print game entry "story" */ boolean lit_corridor; /* show a dark corr as lit if it is in sight */ + boolean mention_decor; /* give feedback for unobscured furniture */ + boolean mention_walls; /* give feedback when bumping walls */ boolean nap; /* `timed_delay' option for display effects */ + boolean nopick_dropped; /* items you dropped may be autopicked */ boolean null; /* OK to send nulls to the terminal */ - boolean p__obsolete; /* [3.6.2: perm_invent moved to iflags] */ boolean pickup; /* whether you pickup or move and look */ + boolean pickup_stolen; /* auto-pickup items stolen by a monster */ boolean pickup_thrown; /* auto-pickup items you threw */ boolean pushweapon; /* When wielding, push old weapon into second slot */ + boolean quick_farsight; /* True disables map browsing during random + * clairvoyance */ boolean rest_on_space; /* space means rest */ boolean safe_dog; /* give complete protection to the dog */ + boolean safe_wait; /* prevent wait or search next to hostile */ boolean showexp; /* show experience points */ boolean showscore; /* show score */ + boolean showvers; /* show version on status lines */ boolean silent; /* whether the bell rings or not */ - /* The story so far: - * 'sortloot' originally took a True/False value but was changed - * to use a letter instead. 3.6.0 was released without changing its - * type from 'boolean' to 'char'. A compiler was smart enough to - * complain that assigning any of the relevant letters was not 0 or 1 - * so not appropriate for boolean (by a configuration which used - * SKIP_BOOLEAN to bypass nethack's 'boolean' and use a C++-compatible - * one). So the type was changed to 'xchar', which is guaranteed to - * match the size of 'boolean' (this guarantee only applies for the - * !SKIP_BOOLEAN config, unfortunately). Since xchar does not match - * actual use, the type was later changed to 'char'. But that would - * break 3.6.0 savefile compatibility for configurations which typedef - * 'schar' to 'short int' instead of to 'char'. (Needed by pre-ANSI - * systems that use unsigned characters without a way to force them - * to be signed.) So, the type has been changed back to 'xchar' for - * 3.6.x. - * - * TODO: change to 'char' (and move out of this block of booleans, - * and get rid of these comments...) once 3.6.0 savefile compatibility - * eventually ends. - */ -#ifndef SKIP_BOOLEAN - /* this is the normal configuration; assigning a character constant - for a normal letter to an 'xchar' variable should always work even - if 'char' is unsigned since character constants are actually 'int' - and letters are within the range where signedness shouldn't matter */ - xchar sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ -#else - /* with SKIP_BOOLEAN, we have no idea what underlying type is being - used, other than it isn't 'xchar' (although its size might match - that) or a bitfield (because it must be directly addressable); - it's probably either 'char' for compactness or 'int' for access, - but we don't know which and it might be something else anyway; - flip a coin here and guess 'char' for compactness */ - char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ -#endif boolean sortpack; /* sorted inventory */ boolean sparkle; /* show "resisting" special FX (Scott Bigham) */ boolean standout; /* use standout for --More-- */ + boolean terrainstatus; /* show terrain info on status lines */ boolean time; /* display elapsed 'time' */ boolean tombstone; /* print tombstone */ boolean verbose; /* max battle info */ + boolean weaponstatus; /* show weapon info on status lines */ int end_top, end_around; /* describe desired score list */ + unsigned autounlock; /* locked door/chest action */ +#define AUTOUNLOCK_UNTRAP 1 +#define AUTOUNLOCK_APPLY_KEY 2 +#define AUTOUNLOCK_KICK 4 +#define AUTOUNLOCK_FORCE 8 unsigned moonphase; unsigned long suppress_alert; #define NEW_MOON 0 @@ -107,8 +90,20 @@ struct flag { #define PARANOID_BREAKWAND 0x0080 #define PARANOID_WERECHANGE 0x0100 #define PARANOID_EATING 0x0200 +#define PARANOID_SWIM 0x0400 +#define PARANOID_TRAP 0x0800 +#define PARANOID_AUTOALL 0x1000 + unsigned versinfo; /* flag mask for 'showvers' option */ + /* mask bits for 'versinfo'; numeric order does not match display order + which is "name branch number" */ +#define VI_NUMBER 1 /* x.y.z */ +#define VI_NAME 2 /* game's name (ie, "nethack") */ +#define VI_BRANCH 4 /* development branch (from git, via Makefile -CFLAGS) */ int pickup_burden; /* maximum burden before prompt */ int pile_limit; /* controls feedback when walking over objects */ + char discosort; /* order of dodiscovery/doclassdisco output: o,s,c,a */ + char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ + uchar vanq_sortmode; /* [uint_8] order of vanquished monsters: 0..7 */ char inv_order[MAXOCLASSES]; char pickup_types[MAXOCLASSES]; #define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */ @@ -121,8 +116,7 @@ struct flag { char end_disclose[NUM_DISCLOSURE_OPTIONS + 1]; /* disclose various info upon exit */ char menu_style; /* User interface style setting */ - boolean made_fruit; /* don't easily let the user overflow the number of - fruits */ + boolean made_fruit; /* don't easily let user overflow fruit limit */ /* KMH, role patch -- Variables used during startup. * @@ -162,44 +156,16 @@ struct flag { boolean showrace; /* show hero glyph by race rather than by role */ boolean travelcmd; /* allow travel command */ int runmode; /* update screen display during run moves */ -}; - -/* - * System-specific flags that are saved with the game if SYSFLAGS is defined. - */ -#if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP) -#define SYSFLAGS -#else -#if defined(MFLOPPY) || defined(MAC) -#define SYSFLAGS -#endif -#endif - -#ifdef SYSFLAGS -struct sysflag { - char sysflagsid[10]; -#ifdef AMIFLUSH - boolean altmeta; /* use ALT keys as META */ - boolean amiflush; /* kill typeahead */ -#endif -#ifdef AMII_GRAPHICS - int numcols; - unsigned short - amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */ - AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */ -#endif -#ifdef OPT_DISPMAP - boolean fast_map; /* use optimized, less flexible map display */ -#endif -#ifdef MFLOPPY - boolean asksavedisk; -#endif -#ifdef MAC - boolean page_wait; /* put up a --More-- after a page of messages */ -#endif + int reserved1; + int reserved2; + int reserved3; + int reserved4; + int reserved5; + int reserved6; + int reserved7; + int reserved8; }; -#endif /* * Flags that are set each time the game is started. @@ -241,41 +207,109 @@ struct debug_flags { #endif }; +enum windowcolors_windows { + wcolor_menu, wcolor_message, wcolor_status, wcolor_text, + WC_COUNT +}; + +struct windowcolors_struct { + char *fg; + char *bg; +}; + +struct accessibility_data { + boolean accessiblemsg; /* use msg_loc for plined messages */ + coord msg_loc; /* accessiblemsg: location */ + boolean mon_notices; /* msg when hero notices a monster */ + int mon_notices_blocked; /* temp disable mon_notices */ + boolean mon_movement; /* msg when hero sees monster move */ + boolean glyph_updates; /* msg when map glyphs change */ +}; + +/* Use notice_mon_off() / notice_mon_on() to temporarily disable + noticing the monsters in the vision code - perhaps the game + needs to output some other messages in between. + Call notice_all_mons() afterwards to catch up. */ +#define notice_mon_off() do { a11y.mon_notices_blocked++; } while(0) +#define notice_mon_on() do { if (--a11y.mon_notices_blocked < 0) { \ + impossible("mon_notices_blocked<0"); \ + a11y.mon_notices_blocked = 0; \ + } } while(0) + +enum debug_fuzzer_states { + fuzzer_off, + fuzzer_impossible_panic, + fuzzer_impossible_continue +}; + +/* + * Stuff that really isn't option or platform related and does not + * get saved and restored. They are set and cleared during the game + * to control the internal behavior of various NetHack functions + * and probably warrant a structure of their own elsewhere some day. + */ struct instance_flags { - /* stuff that really isn't option or platform related. They are - * set and cleared during the game to control the internal - * behaviour of various NetHack functions and probably warrant - * a structure of their own elsewhere some day. - */ - boolean debug_fuzzer; /* fuzz testing */ - boolean defer_plname; /* X11 hack: askname() might not set plname */ + boolean defer_plname; /* X11 hack: askname() might not set svp.plname */ + boolean fuzzerpending; /* fuzzing requested on command line but not active + * yet (to allow interactive initialization prior + * to input becoming taken over); + * True => enable fuzzer when entering moveloop */ boolean herecmd_menu; /* use menu when mouseclick on yourself */ + boolean idlecheckpoint; /* platform should perform a checkpoint update + * if waiting for input longer than 10 seconds */ boolean invis_goldsym; /* gold symbol is ' '? */ + boolean in_lua; /* executing a lua script */ + boolean lua_testing; /* doing lua tests */ + boolean term_gone; /* terminal is gone, abort abort abort */ + boolean nofollowers; /* level change ignores pets (for tutorial) */ + boolean partly_eaten_hack; /* extra flag for xname() used when it's called + * indirectly so we can't use xname_flags() */ + boolean query_menu; /* use a menu for yes/no queries */ + boolean remember_getpos; /* save getpos() positioning in do-again queue */ + boolean sad_feeling; /* unseen pet is dying */ + boolean showdamage; /* extra message reporting damage hero has taken */ + boolean pending_customizations; /* at least one custom. was specified */ + xint8 debug_fuzzer; /* fuzz testing */ int at_midnight; /* only valid during end of game disclosure */ int at_night; /* also only valid during end of game disclosure */ int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */ + int getdir_click; /* as input to getdir(): non-zero, accept simulated + * click that's not adjacent to or on hero; + * as output from getdir(): simulated button used + * 0 (none) or CLICK_1 (left) or CLICK_2 (right) */ + int getloc_filter; /* GFILTER_foo */ int in_lava_effects; /* hack for Boots_off() */ int last_msg; /* indicator of last message player saw */ + int menuobjsyms; /* value of 'menu_objsyms' option; + * ought to be in flags rather than iflags */ int override_ID; /* true to force full identification of objects */ int parse_config_file_src; /* hack for parse_config_line() */ int purge_monsters; /* # of dead monsters still on fmon list */ + int raw_printed; /* count of messages issued before window_inited */ int suppress_price; /* controls doname() for unpaid objects */ - int terrainmode; /* for getpos()'s autodescribe when #terrain is active */ -#define TER_MAP 0x01 -#define TER_TRP 0x02 -#define TER_OBJ 0x04 -#define TER_MON 0x08 -#define TER_DETECT 0x10 /* detect_foo magic rather than #terrain */ + unsigned terrainmode; /* for getpos()'s autodescribe during #terrain */ +#define TER_MAP 0x01U +#define TER_TRP 0x02U +#define TER_OBJ 0x04U +#define TER_MON 0x08U +#define TER_FULL 0x10U /* explore|wizard mode view full map */ +#define TER_DETECT 0x20U /* detect_foo magic rather than #terrain */ + boolean bgcolors; /* display background colors on a map position */ + boolean getloc_moveskip; boolean getloc_travelmode; - int getloc_filter; /* GFILTER_foo */ boolean getloc_usemenu; - boolean getloc_moveskip; coord travelcc; /* coordinates for travel_cache */ boolean trav_debug; /* display travel path (#if DEBUG only) */ boolean window_inited; /* true if init_nhwindows() completed */ boolean vision_inited; /* true if vision is ready */ boolean sanity_check; /* run sanity checks */ + boolean sanity_no_check; /* skip next sanity check */ + boolean debug_overwrite_stairs; /* debug: allow overwriting stairs */ + boolean debug_mongen; /* debug: prevent monster generation */ + boolean debug_hunger; /* debug: prevent hunger */ + boolean debug_prevent_pline; /* debug: prevent pline going to UI */ boolean mon_polycontrol; /* debug: control monster polymorphs */ + boolean mon_telecontrol; /* debug: control monster teleports */ boolean in_dumplog; /* doing the dumplog right now? */ boolean in_parse; /* is a command being parsed? */ /* suppress terminate during options parsing, for --showpaths */ @@ -285,79 +319,73 @@ struct instance_flags { */ unsigned msg_history; /* hint: # of top lines to save */ int getpos_coords; /* show coordinates when getting cursor position */ - int menu_headings; /* ATR for menu headings */ - int *opt_booldup; /* for duplication of boolean opts in config file */ - int *opt_compdup; /* for duplication of compound opts in conf file */ + int menuinvertmode; /* 0 = invert toggles every item; + * 1 = invert skips 'all items' item */ + int terrain_typ; /* index into terrain_descr[] for botl */ + color_attr menu_headings; /* CLR_ and ATR_ for menu headings */ + uint32_t colorcount; /* store how many colors terminal is capable of */ + boolean use_truecolor; /* force use of truecolor */ #ifdef ALTMETA - boolean altmeta; /* Alt-c sends ESC c rather than M-c */ + boolean altmeta; /* Alt+c sends ESC c rather than M-c */ #endif boolean autodescribe; /* autodescribe mode in getpos() */ boolean cbreak; /* in cbreak mode, rogue format */ boolean deferred_X; /* deferred entry into explore mode */ + boolean defer_decor; /* terrain change message vs slipping on ice */ boolean echo; /* 1 to echo characters */ boolean force_invmenu; /* always menu when handling inventory */ - /* FIXME: goldX belongs in flags, but putting it in iflags avoids - breaking 3.6.[01] save files */ - boolean goldX; /* for BUCX filtering, whether gold is X or U */ boolean hilite_pile; /* mark piles of objects with a hilite */ - boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */ - boolean mention_walls; /* give feedback when bumping walls */ - boolean menu_head_objsym; /* Show obj symbol in menu headings */ + boolean menu_head_objsym; /* Show obj symbol in menu headings; controlled + * by 'menuobjsyms' */ boolean menu_overlay; /* Draw menus over the map */ boolean menu_requested; /* Flag for overloaded use of 'm' prefix * on some non-move commands */ boolean menu_tab_sep; /* Use tabs to separate option menu fields */ boolean news; /* print news */ boolean num_pad; /* use numbers for movement commands */ - boolean perm_invent; /* keep full inventories up until dismissed */ + boolean perm_invent; /* display persistent inventory window */ + boolean perm_invent_pending; /* need to try again */ + boolean pricequotes; /* display price quotes on unIDd objects */ boolean renameallowed; /* can change hero name during role selection */ boolean renameinprogress; /* we are changing hero name */ + boolean sounds; /* master on/off switch for using soundlib */ boolean status_updates; /* allow updates to bottom status lines; * disable to avoid excessive noise when using * a screen reader (use ^X to review status) */ boolean toptenwin; /* ending list in window instead of stdout */ + boolean tux_penalty; /* True iff hero is a monk and wearing a suit */ boolean use_background_glyph; /* use background glyph when appropriate */ boolean use_menu_color; /* use color in menus; only if wc_color */ + boolean use_menu_glyphs; /* use object glyphs in menus, if the port + * supports it; controlled by 'menuobjsyms' */ #ifdef STATUS_HILITES - long hilite_delta; /* number of moves to leave a temp hilite lit */ + long hilite_delta; /* number of moves to leave a temp hilite lit */ long unhilite_deadline; /* time when oldest temp hilite should be unlit */ #endif + boolean voices; /* enable text-to-speech or other talking */ boolean zerocomp; /* write zero-compressed save files */ boolean rlecomp; /* alternative to zerocomp; run-length encoding * compression of levels when writing savefile */ - uchar num_pad_mode; - boolean cursesgraphics; /* Use portable curses extended characters */ -#if 0 /* XXXgraphics superseded by symbol sets */ - boolean DECgraphics; /* use DEC VT-xxx extended character set */ - boolean IBMgraphics; /* use IBM extended character set */ -#ifdef MAC_GRAPHICS_ENV - boolean MACgraphics; /* use Macintosh extended character set, as - as defined in the special font HackFont */ -#endif -#endif - uchar bouldersym; /* symbol for boulder display */ - char prevmsg_window; /* type of old message window to use */ - boolean extmenu; /* extended commands use menu interface */ -#ifdef MFLOPPY - boolean checkspace; /* check disk space before writing files */ - /* (in iflags to allow restore after moving - * to >2GB partition) */ -#endif + schar ice_rating; /* ice_descr()'s classification of ice terrain */ + schar prev_decor; /* 'mention_decor' just mentioned this */ + uchar num_pad_mode; /* for num_pad==True, controls how 5 behaves + * and/or 789456123 vs phone-style 123456789; + * for False, qwertY vs qwertZ */ + uchar perminv_mode; /* what to display in persistent invent window + * 0: nothing, 1: all inventory except gold, + * 2: full including gold, 8: in-use items only, + * 5|6: 1|2 with invent letters shown in empty + * slots (TTY only: 'sparse' modes) */ + uchar bouldersym; /* symbol for boulder display */ + char prevmsg_window; /* type of old message window to use */ + boolean extmenu; /* extended commands use menu interface */ #ifdef MICRO boolean BIOS; /* use IBM or ST BIOS calls when appropriate */ #endif #if defined(MICRO) || defined(WIN32) boolean rawio; /* whether can use rawio (IOCTL call) */ #endif -#ifdef MAC_GRAPHICS_ENV - boolean MACgraphics; /* use Macintosh extended character set, as - as defined in the special font HackFont */ - unsigned use_stone; /* use the stone ppats */ -#endif #if defined(MSDOS) || defined(WIN32) - boolean hassound; /* has a sound card */ - boolean usesound; /* use the sound card */ - boolean usepcspeaker; /* use the pc speaker */ boolean tile_view; boolean over_view; boolean traditional_view; @@ -376,10 +404,15 @@ struct instance_flags { #ifdef TTY_TILES_ESCCODES boolean vt_tiledata; /* output console codes for tile support in TTY */ #endif - boolean clicklook; /* allow right-clicking for look */ +#ifdef TTY_SOUND_ESCCODES + boolean vt_sounddata; /* output console codes for sound support in TTY*/ +#endif boolean cmdassist; /* provide detailed assistance for some comnds */ - boolean time_botl; /* context.botl for 'time' (moves) only */ + boolean fireassist; /* autowield launcher when using fire-command */ boolean wizweight; /* display weight of everything in wizard mode */ + boolean wizmgender; /* test gender info from core in window port */ + boolean customcolors; /* support customcolors defined in glyphmap */ + boolean customsymbols; /* support customsymbols defined in glyphmap */ /* * Window capability support. */ @@ -395,6 +428,7 @@ struct instance_flags { int wc_align_status; /* status win at top|bot|right|left */ int wc_align_message; /* message win at top|bot|right|left */ int wc_vary_msgcount; /* show more old messages at a time */ +#if 0 char *wc_foregrnd_menu; /* points to foregrnd color name for menu win */ char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */ char *wc_foregrnd_message; /* points to foregrnd color name for msg win */ @@ -403,6 +437,9 @@ struct instance_flags { char *wc_backgrnd_status; /* points to backgrnd color name for status */ char *wc_foregrnd_text; /* points to foregrnd color name for text win */ char *wc_backgrnd_text; /* points to backgrnd color name for text win */ +#else + struct windowcolors_struct wcolors[WC_COUNT]; +#endif char *wc_font_map; /* points to font name for the map win */ char *wc_font_message; /* points to font name for message win */ char *wc_font_status; /* points to font name for status win */ @@ -418,6 +455,10 @@ struct instance_flags { int wc_map_mode; /* specify map viewing options, mostly * for backward compatibility */ int wc_player_selection; /* method of choosing character */ +#if defined(MSDOS) + unsigned wc_video_width; /* X resolution of screen */ + unsigned wc_video_height; /* Y resolution of screen */ +#endif boolean wc_splash_screen; /* display an opening splash screen or not */ boolean wc_popup_dialog; /* put queries in pop up dialogs instead of * in the message window */ @@ -430,10 +471,10 @@ struct instance_flags { boolean wc2_hitpointbar; /* show graphical bar representing hit points */ boolean wc2_guicolor; /* allow colours in gui (outside map) */ int wc_mouse_support; /* allow mouse support */ - int wc2_term_cols; /* terminal width, in characters */ - int wc2_term_rows; /* terminal height, in characters */ + int wc2_term_cols; /* terminal width, in characters */ + int wc2_term_rows; /* terminal height, in characters */ int wc2_statuslines; /* default = 2, curses can handle 3 */ - int wc2_windowborders; /* display borders on NetHack windows */ + int wc2_windowborders; /* display borders on NetHack windows */ int wc2_petattr; /* text attributes for pet */ #ifdef WIN32 #define MAX_ALTKEYHANDLING 25 @@ -446,22 +487,19 @@ struct instance_flags { Bitfield(save_uswallow, 1); Bitfield(save_uinwater, 1); Bitfield(save_uburied, 1); - /* item types used to acomplish "special achievements"; find the target - object and you'll be flagged as having achieved something... */ - short mines_prize_type; /* luckstone */ - short soko_prize_type1; /* bag of holding or */ - short soko_prize_type2; /* amulet of reflection */ struct debug_flags debug; - boolean windowtype_locked; /* windowtype can't change from configfile */ + boolean windowtype_locked; /* windowtype can't change from configfile */ boolean windowtype_deferred; /* pick a windowport and store it in chosen_windowport[], but do not switch to it in the midst of options processing */ genericptr_t returning_missile; /* 'struct obj *'; Mjollnir or aklys */ + boolean wiz_error_flag; /* flag for tracking failed wizmode auth */ + boolean explore_error_flag; /* ditto for explore mode */ boolean obsolete; /* obsolete options can point at this, it isn't used */ }; /* - * Old deprecated names + * Old, deprecated names */ #ifdef TTY_GRAPHICS #define eight_bit_tty wc_eight_bit_input @@ -472,16 +510,14 @@ struct instance_flags { #ifdef MAC_GRAPHICS_ENV #define large_font obsolete #endif -#ifdef MAC +#ifdef MACOS9 #define popup_dialog wc_popup_dialog #endif #define preload_tiles wc_preload_tiles extern NEARDATA struct flag flags; -#ifdef SYSFLAGS -extern NEARDATA struct sysflag sysflags; -#endif extern NEARDATA struct instance_flags iflags; +extern NEARDATA struct accessibility_data a11y; /* last_msg values * Usage: @@ -496,9 +532,15 @@ enum plnmsg_types { PLNMSG_ONE_ITEM_HERE, /* "you see here" */ PLNMSG_TOWER_OF_FLAME, /* scroll of fire */ PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */ + PLNMSG_ENVELOPED_IN_GAS, /* create_gas_cloud() feedback */ PLNMSG_OBJ_GLOWS, /* "the glows " */ PLNMSG_OBJNAM_ONLY, /* xname/doname only, for #tip */ - PLNMSG_OK_DONT_DIE /* overriding death in explore/wizard mode */ + PLNMSG_OK_DONT_DIE, /* overriding death in explore/wizard mode */ + PLNMSG_BACK_ON_GROUND, /* leaving water */ + PLNMSG_GROWL, /* growl() gave some message */ + PLNMSG_HIDE_UNDER, /* hero saw a monster hide under something */ + PLNMSG_MON_TAKES_OFF_ITEM, /* thief (nymph, monkey) taking worn item */ + PLNMSG_enum /* 'none of the above' */ }; /* runmode options */ @@ -534,6 +576,12 @@ enum runmode_types { /* continue eating: prompt given _after_first_bite_ when eating something while satiated */ #define ParanoidEating ((flags.paranoia_bits & PARANOID_EATING) != 0) +/* Prevent going into lava or water without explicitly forcing it */ +#define ParanoidSwim ((flags.paranoia_bits & PARANOID_SWIM) != 0) +/* Prevent going onto/into known trap unless it is harmless */ +#define ParanoidTrap ((flags.paranoia_bits & PARANOID_TRAP) != 0) +/* Require confirmation for choosing 'A' in class menu for menustyle:Full */ +#define ParanoidAutoAll ((flags.paranoia_bits & PARANOID_AUTOALL) != 0U) /* command parsing, mainly dealing with number_pad handling; not saved and restored */ @@ -543,58 +591,6 @@ enum runmode_types { struct ext_func_tab; /* from func_tab.h */ #endif -/* special key functions */ -enum nh_keyfunc { - NHKF_ESC = 0, - NHKF_DOAGAIN, - - NHKF_REQMENU, - - /* run ... clicklook need to be in a continuous block */ - NHKF_RUN, - NHKF_RUN2, - NHKF_RUSH, - NHKF_FIGHT, - NHKF_FIGHT2, - NHKF_NOPICKUP, - NHKF_RUN_NOPICKUP, - NHKF_DOINV, - NHKF_TRAVEL, - NHKF_CLICKLOOK, - - NHKF_REDRAW, - NHKF_REDRAW2, - NHKF_GETDIR_SELF, - NHKF_GETDIR_SELF2, - NHKF_GETDIR_HELP, - NHKF_COUNT, - NHKF_GETPOS_SELF, - NHKF_GETPOS_PICK, - NHKF_GETPOS_PICK_Q, /* quick */ - NHKF_GETPOS_PICK_O, /* once */ - NHKF_GETPOS_PICK_V, /* verbose */ - NHKF_GETPOS_SHOWVALID, - NHKF_GETPOS_AUTODESC, - NHKF_GETPOS_MON_NEXT, - NHKF_GETPOS_MON_PREV, - NHKF_GETPOS_OBJ_NEXT, - NHKF_GETPOS_OBJ_PREV, - NHKF_GETPOS_DOOR_NEXT, - NHKF_GETPOS_DOOR_PREV, - NHKF_GETPOS_UNEX_NEXT, - NHKF_GETPOS_UNEX_PREV, - NHKF_GETPOS_INTERESTING_NEXT, - NHKF_GETPOS_INTERESTING_PREV, - NHKF_GETPOS_VALID_NEXT, - NHKF_GETPOS_VALID_PREV, - NHKF_GETPOS_HELP, - NHKF_GETPOS_MENU, - NHKF_GETPOS_LIMITVIEW, - NHKF_GETPOS_MOVESKIP, - - NUM_NHKF -}; - enum gloctypes { GLOC_MONS = 0, GLOC_OBJS, @@ -606,26 +602,4 @@ enum gloctypes { NUM_GLOCS }; -/* commands[] is used to directly access cmdlist[] instead of looping - through it to find the entry for a given input character; - move_X is the character used for moving one step in direction X; - alphadirchars corresponds to old sdir, - dirchars corresponds to ``iflags.num_pad ? ndir : sdir''; - pcHack_compat and phone_layout only matter when num_pad is on, - swap_yz only matters when it's off */ -struct cmd { - unsigned serialno; /* incremented after each update */ - boolean num_pad; /* same as iflags.num_pad except during updates */ - boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */ - boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */ - boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */ - char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW; - const char *dirchars; /* current movement/direction characters */ - const char *alphadirchars; /* same as dirchars if !numpad */ - const struct ext_func_tab *commands[256]; /* indexed by input character */ - char spkeys[NUM_NHKF]; -}; - -extern NEARDATA struct cmd Cmd; - #endif /* FLAG_H */ diff --git a/include/fnamesiz.h b/include/fnamesiz.h new file mode 100644 index 000000000..338f55292 --- /dev/null +++ b/include/fnamesiz.h @@ -0,0 +1,79 @@ +/* NetHack 5.0 fnamesiz.h $NHDT-Date: 1580310580 2020/01/29 15:09:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1 $ */ +/*-Copyright (c) Michael Allison, 2020. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef FNAMESIZ_H +#define FNAMESIZ_H + +/* + * Declarations for some file name sizes, some of which need to be shared + * between NetHack and recover. By placing them in here, there is less + * chance of deviation between the two. + */ + +#if !defined(MICRO) && !defined(VMS) && !defined(WIN32) +#define LOCKNAMESIZE (PL_NSIZ + 14) /* long enough for uid+name+.99 */ +#define LOCKNAMEINIT "1lock" +#define BONESINIT "bonesnn.xxx.le" +#define BONESSIZE sizeof(BONESINIT) +#else +#if defined(MICRO) +#define LOCKNAMESIZE FILENAME +#define LOCKNAMEINIT "" +#define BONESINIT "" +#define BONESSIZE FILENAME +#endif +#if defined(VMS) +#define LOCKNAMESIZE (PL_NSIZ + 17) /* long enough for _uid+name+.99;1 */ +#define LOCKNAMEINIT "1lock" +#define BONESINIT "bonesnn.xxx_le;1" +#define BONESSIZE sizeof(BONESINIT) +#endif +#if defined(WIN32) +#define LOCKNAMESIZE (PL_NSIZ + 25) /* long enough for username+-+name+.99 */ +#define LOCKNAMEINIT "" +#define BONESINIT "bonesnn.xxx.le" +#define BONESSIZE sizeof(BONESINIT) +#endif +#endif + +#define INDEXT ".xxxxxx" /* largest indicator suffix */ +#define INDSIZE sizeof(INDEXT) + +#if defined(UNIX) || defined(__BEOS__) +#define SAVEX "save/99999.e" +#ifndef SAVE_EXTENSION +#define SAVE_EXTENSION "" +#endif +#else /* UNIX || __BEOS__ */ +#ifdef VMS +#define SAVEX "[.save]nnnnn.e;1" +#ifndef SAVE_EXTENSION +#define SAVE_EXTENSION "" +#endif +#else /* VMS */ +#if defined(WIN32) || defined(MICRO) +#define SAVEX "" +#if !defined(SAVE_EXTENSION) +#ifdef MICRO +#define SAVE_EXTENSION ".svh" +#endif +#ifdef WIN32 +#define SAVE_EXTENSION ".NetHack-saved-game" +#endif +#endif /* !SAVE_EXTENSION */ +#endif /* WIN32 || MICRO */ +#endif /* else !VMS */ +#endif /* else !(UNIX || __BEOS__) */ + +#ifndef SAVE_EXTENSION +#define SAVE_EXTENSION "" +#endif + +#ifndef MICRO +#define SAVESIZE (PL_NSIZ + sizeof(SAVEX) + sizeof(SAVE_EXTENSION) + INDSIZE) +#else +#define SAVESIZE FILENAME +#endif + +#endif /* FNAMESIZ_H */ diff --git a/include/func_tab.h b/include/func_tab.h index 79daef1de..7992a55c0 100644 --- a/include/func_tab.h +++ b/include/func_tab.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 func_tab.h $NHDT-Date: 1543797823 2018/12/03 00:43:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.11 $ */ +/* NetHack 5.0 func_tab.h $NHDT-Date: 1684791775 2023/05/22 21:42:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.24 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -7,17 +7,43 @@ #define FUNC_TAB_H /* extended command flags */ -#define IFBURIED 0x01 /* can do command when buried */ -#define AUTOCOMPLETE 0x02 /* command autocompletes */ -#define WIZMODECMD 0x04 /* wizard-mode command */ -#define GENERALCMD 0x08 /* general command, does not take game time */ -#define CMD_NOT_AVAILABLE 0x10 /* recognized but non-functional (!SHELL,&c) */ +#define IFBURIED 0x0001 /* can do command when buried */ +#define AUTOCOMPLETE 0x0002 /* command autocompletes */ +#define WIZMODECMD 0x0004 /* wizard-mode command */ +#define GENERALCMD 0x0008 /* general command, does not take game time */ +#define CMD_NOT_AVAILABLE 0x0010 /* recognized but non-functional (!SHELL,&c)*/ +#define NOFUZZERCMD 0x0020 /* fuzzer cannot execute this command */ +#define INTERNALCMD 0x0040 /* only for internal use, not for user */ +#define CMD_M_PREFIX 0x0080 /* accepts menu prefix */ +#define CMD_gGF_PREFIX 0x0100 /* accepts g/G/F prefix */ +#define CMD_MOVE_PREFIXES (CMD_M_PREFIX | CMD_gGF_PREFIX) +#define PREFIXCMD 0x0200 /* prefix command, requires another one after it */ +#define MOVEMENTCMD 0x0400 /* used to move hero/cursor */ +#define MOUSECMD 0x0800 /* cmd allowed to be bound to mouse button */ +#define CMD_INSANE 0x1000 /* suppress sanity check (for ^P and ^R) */ +#define AUTOCOMP_ADJ 0x2000 /* user changed command autocompletion */ +#define CMD_PARAM 0x4000 /* command requires a param from key bind */ + +/* flags for extcmds_match() */ +#define ECM_NOFLAGS 0 +#define ECM_IGNOREAC 0x01 /* ignore !autocomplete commands */ +#define ECM_EXACTMATCH 0x02 /* needs exact match of findstr */ +#define ECM_NO1CHARCMD 0x04 /* ignore commands like '?' and '#' */ + +/* a key bound to ext_func_tab */ +struct Cmd_bind { + uchar key; + boolean userbind; /* added by user */ + char *param; + const struct ext_func_tab *cmd; + struct Cmd_bind *next; +}; struct ext_func_tab { uchar key; const char *ef_txt, *ef_desc; - int NDECL((*ef_funct)); - int flags; + int (*ef_funct)(void); /* must return ECMD_foo flags */ + unsigned flags; const char *f_text; }; diff --git a/include/global.h b/include/global.h index a2b70d258..d5e3981c8 100644 --- a/include/global.h +++ b/include/global.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 global.h $NHDT-Date: 1557510460 2019/05/10 17:47:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.72 $ */ +/* NetHack 5.0 global.h $NHDT-Date: 1704225560 2024/01/02 19:59:20 $ $NHDT-Branch: keni-luabits2 $:$NHDT-Revision: 1.159 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,27 +6,9 @@ #ifndef GLOBAL_H #define GLOBAL_H -#include - -/* - * Development status possibilities. - */ -#define NH_STATUS_RELEASED 0 /* Released */ -#define NH_STATUS_WIP 1 /* Work in progress */ -#define NH_STATUS_BETA 2 /* BETA testing */ -#define NH_STATUS_POSTRELEASE 3 /* patch commit point only */ - /* - * Development status of this NetHack version. - */ -#define NH_DEVEL_STATUS NH_STATUS_RELEASED - -#ifndef DEBUG /* allow tool chains to define without causing warnings */ -#define DEBUG -#endif - -/* - * Files expected to exist in the playground directory. + * Files expected to exist in the playground directory (possibly inside + * a dlb container file). */ #define RECORD "record" /* file containing list of topscorers */ @@ -41,13 +23,23 @@ #define HISTORY "history" /* file giving nethack's history */ #define LICENSE "license" /* file with license information */ #define OPTIONFILE "opthelp" /* file explaining runtime options */ +#define OPTMENUHELP "optmenu" /* file explaining #options command */ +#define USAGEHELP "usagehlp" /* file explaining command line use */ #define OPTIONS_USED "options" /* compile-time options, for #version */ #define SYMBOLS "symbols" /* replacement symbol sets */ #define EPITAPHFILE "epitaph" /* random epitaphs on graves */ #define ENGRAVEFILE "engrave" /* random engravings on the floor */ #define BOGUSMONFILE "bogusmon" /* hallucinatory monsters */ #define TRIBUTEFILE "tribute" /* 3.6 tribute to Terry Pratchett */ -#define LEV_EXT ".lev" /* extension for special level files */ +#define LEV_EXT ".lua" /* extension for special level files */ + +/* padding amounts for files that have lines chosen by fseek to random spot, + advancing to the next line, and using that line; makedefs forces shorter + lines to be padded to these lengths; value of 0 will inhibit any padding, + avoiding an increase in files' sizes, but resulting in biased selection; + used by makedefs while building and by core's callers of get_rnd_text() */ +#define MD_PAD_RUMORS 60u /* for RUMORFILE, EPITAPHFILE, and ENGRAVEFILE */ +#define MD_PAD_BOGONS 20u /* for BOGUSMONFILE */ /* Assorted definitions that may depend on selections in config.h. */ @@ -66,25 +58,49 @@ #endif /* DUMB */ /* - * type xchar: small integers in the range 0 - 127, usually coordinates - * although they are nonnegative they must not be declared unsigned - * since otherwise comparisons with signed quantities are done incorrectly + * type xint8: small integers (typedef'd as signed, + * in the range -127 - 127). + */ +typedef int8_t xint8; +/* + * type coordxy: integers (typedef'd as signed, + * in the range -32768 to 32767), mostly coordinates. + * Note that in 2022, screen coordinates easily + * surpass an upper limit of 127. + */ +typedef int16_t coordxy; +/* + * type xint16: integers (typedef'd as signed, + * in the range -32768 to 32767), non-coordinates. */ -typedef schar xchar; +typedef int16_t xint16; #ifdef __MINGW32__ /* Resolve conflict with Qt 5 and MinGW-w32 */ typedef unsigned char boolean; /* 0 or 1 */ #else #ifndef SKIP_BOOLEAN -typedef xchar boolean; /* 0 or 1 */ +typedef schar boolean; /* 0 or 1 */ #endif #endif +/* vision seen vectors: viz_array[][] and levl[][].seenv, which use different + values from each other but are close enough in size to share a type; + viz_array contains 8-bit bitmasks, lev->seenv is a 5-bit bitfield */ +typedef unsigned char seenV; /* no need for uint8_t */ + +/* Type for third parameter of read(2) */ +#if defined(BSD) || defined(ULTRIX) +typedef int readLenType; +#else /* e.g. SYSV, __TURBOC__ */ +typedef unsigned readLenType; +#endif + #ifndef TRUE /* defined in some systems' native include files */ #define TRUE ((boolean) 1) #define FALSE ((boolean) 0) #endif +#define BOOL_RANDOM (-1) /* * type nhsym: loadable symbols go into this type @@ -92,17 +108,13 @@ typedef xchar boolean; /* 0 or 1 */ typedef uchar nhsym; #ifndef STRNCMPI -#ifndef __SASC_60 /* SAS/C already shifts to stricmp */ +/* SAS/C already shifts to stricmp */ +#if !defined(__SASC_60) && !defined(CROSS_TO_AMIGA) #define strcmpi(a, b) strncmpi((a), (b), -1) #endif #endif - -/* comment out to test effects of each #define -- these will probably - * disappear eventually - */ -#ifdef INTERNAL_COMP -#define RLECOMP /* run-length compression of levl array - JLee */ -#define ZEROCOMP /* zero-run compression of everything - Olaf Seibert */ +#ifdef CROSS_TO_AMIGA +#define strcmpi(a, b) stricmp(a, b) #endif /* #define SPECIALIZATION */ /* do "specialized" version of new topology */ @@ -123,6 +135,22 @@ typedef uchar nhsym; #define LARGEST_INT 32767 #include "coord.h" + +/* define USING_ADDRESS_SANITIZER if ASAN is in use */ +#if defined(__clang__) +#if defined(__has_feature) +#if __has_feature(address_sanitizer) +#define USING_ADDRESS_SANITIZER +#endif /* __has_feature */ +#endif /* __has_feature(address_sanitizer) */ +#else /* ?__clang__ */ +#if defined(__GNUC__) || defined(_MSC_VER) +#ifdef __SANITIZE_ADDRESS__ +#define USING_ADDRESS_SANITIZER +#endif /* __SANITIZE_ADDRESS__ */ +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !__clang__ */ + /* * Automatic inclusions for the subsidiary files. * Please don't change the order. It does matter. @@ -136,48 +164,32 @@ typedef uchar nhsym; #include "unixconf.h" #endif -#ifdef OS2 -#include "os2conf.h" -#endif - #ifdef MSDOS #include "pcconf.h" #endif -#ifdef TOS -#include "tosconf.h" +#ifdef WIN32 +#include "windconf.h" #endif +#include "warnings.h" + +/* amiconf.h needs to be the last nested #include of config.h because + 'make depend' will turn it into a comment, hiding anything after it */ #ifdef AMIGA #include "amiconf.h" #endif -#ifdef MAC -#include "macconf.h" -#endif - -#ifdef __BEOS__ -#include "beconf.h" -#endif - -#ifdef WIN32 -#ifdef WIN_CE -#include "wceconf.h" -#else -#include "ntconf.h" -#endif -#endif - /* Displayable name of this port; don't redefine if defined in *conf.h */ #ifndef PORT_ID #ifdef AMIGA #define PORT_ID "Amiga" #endif -#ifdef MAC +#ifdef MACOS9 #define PORT_ID "Mac" #endif #ifdef __APPLE__ -#define PORT_ID "MacOSX" +#define PORT_ID "MacOS" #endif #ifdef MSDOS #ifdef PC9800 @@ -215,11 +227,15 @@ typedef uchar nhsym; #endif #endif +#if !defined(CROSSCOMPILE) #if defined(MICRO) #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS) #define SHORT_FILENAMES /* filenames are 8.3 */ #endif #endif +#endif + +#include "fnamesiz.h" /* file sizes shared between nethack and recover */ #ifdef VMS /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below. @@ -243,14 +259,18 @@ typedef uchar nhsym; #endif #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \ - || defined(WIN32) -#ifndef USE_TILES -#define USE_TILES /* glyph2tile[] will be available */ + || defined(MSWIN_GRAPHICS) +#ifndef NO_TILE_C +#ifndef TILES_IN_GLYPHMAP +#define TILES_IN_GLYPHMAP +#endif #endif #endif #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS) -#ifndef USE_TILES -#define USE_TILES +#ifndef NO_TILE_C +#ifndef TILES_IN_GLYPHMAP +#define TILES_IN_GLYPHMAP +#endif #endif #endif @@ -265,30 +285,63 @@ typedef uchar nhsym; #define Sprintf (void) sprintf #define Strcat (void) strcat #define Strcpy (void) strcpy +#define Strlen(s) Strlen_(s,__func__,__LINE__) #ifdef NEED_VARARGS #define Vprintf (void) vprintf #define Vfprintf (void) vfprintf #define Vsprintf (void) vsprintf #endif -/* primitive memory leak debugging; see alloc.c */ +/* + * Memory allocation. Functions are declared here rather than in + * extern.h so that source files which use config.h instead of hack.h + * will see the declarations. + * + * NetHack does not use malloc() [except to implement alloc() in alloc.c] + * or realloc() or calloc(). They return Null if memory runs out and + * nethack's code relies on alloc() to intercept that so that a zillion + * callers don't need to test for Null result. alloc() never returns + * Null; if memory runs out, it calls panic() and does not return at all. + */ + +/* dupstr() is unconditional in alloc.c but not used when MONITOR_HEAP + is enabled; some utility programs link with alloc.{o,obj} and need it + if nethack is built with MONITOR_HEAP enabled and they aren't; this + declaration has been moved out of the '#else' below to avoid getting + a complaint from -Wmissing-prototypes when building with MONITOR_HEAP */ +extern char *dupstr(const char *) NONNULL NONNULLARG1; +/* same, but return strlen(string) in extra argument */ +extern char *dupstr_n(const char *string, + unsigned *lenout) NONNULL NONNULLPTRS; + +/* + * MONITOR_HEAP is conditionally used for primitive memory leak debugging. + * When enabled, NH_HEAPLOG (if defined in the environment) is used as the + * name of a log file to create for capturing allocations and releases. + * [The 'heaputil' program to analyze that file isn't included in releases.] + * + * See alloc.c. + */ #ifdef MONITOR_HEAP -extern long *FDECL(nhalloc, (unsigned int, const char *, int)); -extern void FDECL(nhfree, (genericptr_t, const char *, int)); -extern char *FDECL(nhdupstr, (const char *, const char *, int)); -#ifndef __FILE__ -#define __FILE__ "" -#endif -#ifndef __LINE__ -#define __LINE__ 0 -#endif +/* plain alloc() is not declared except in alloc.c */ +extern long *nhalloc(unsigned int, const char *, int) NONNULL NONNULLARG2; +extern long *nhrealloc(long *, unsigned int, const char *, + int) NONNULL NONNULLARG3; +extern void nhfree(genericptr_t, const char *, int) NONNULLARG2; +extern char *nhdupstr(const char *, const char *, int) NONNULL NONNULLPTRS; +/* this predates C99's __func__; that is trickier to use conditionally + because it is not implemented as a preprocessor macro; MONITOR_HEAP + wouldn't gain much benefit from it anyway so continue to live without it; + if func's caller were accessible, that would be a very different issue */ #define alloc(a) nhalloc(a, __FILE__, (int) __LINE__) +#define re_alloc(a,n) nhrealloc(a, n, __FILE__, (int) __LINE__) #define free(a) nhfree(a, __FILE__, (int) __LINE__) #define dupstr(s) nhdupstr(s, __FILE__, (int) __LINE__) #else /* !MONITOR_HEAP */ -extern long *FDECL(alloc, (unsigned int)); /* alloc.c */ -extern char *FDECL(dupstr, (const char *)); /* ditto */ -#endif +/* declare alloc.c's alloc(); allocations made with it use ordinary free() */ +extern long *alloc(unsigned int) NONNULL; /* alloc.c */ +extern long *re_alloc(long *, unsigned int) NONNULL; +#endif /* ?MONITOR_HEAP */ /* Used for consistency checks of various data files; declare it here so that utility programs which include config.h but not hack.h can see it. */ @@ -296,24 +349,26 @@ struct version_info { unsigned long incarnation; /* actual version number */ unsigned long feature_set; /* bitmask of config settings */ unsigned long entity_count; /* # of monsters and objects */ - unsigned long struct_sizes1; /* size of key structs */ - unsigned long struct_sizes2; /* size of more key structs */ }; -struct savefile_info { - unsigned long sfi1; /* compression etc. */ - unsigned long sfi2; /* miscellaneous */ - unsigned long sfi3; /* thirdparty */ +/* This is used to store some build-info data that used + to be present in makedefs-generated header file date.h */ + +struct nomakedefs_s { + const char *build_date; + const char *copyright_banner_c; + const char *git_sha; + const char *git_branch; + const char *git_prefix; + const char *version_string; + const char *version_id; + unsigned long version_number; + unsigned long version_features; + unsigned long ignored_features; + unsigned long version_sanity1; + unsigned long build_time; }; -#ifdef NHSTDC -#define SFI1_EXTERNALCOMP (1UL) -#define SFI1_RLECOMP (1UL << 1) -#define SFI1_ZEROCOMP (1UL << 2) -#else -#define SFI1_EXTERNALCOMP (1L) -#define SFI1_RLECOMP (1L << 1) -#define SFI1_ZEROCOMP (1L << 2) -#endif +extern struct nomakedefs_s nomakedefs; /* * Configurable internal parameters. @@ -329,17 +384,26 @@ struct savefile_info { #define MAXNROFROOMS 40 /* max number of rooms per level */ #define MAX_SUBROOMS 24 /* max # of subrooms in a given room */ -#define DOORMAX 120 /* max number of doors per level */ +#define DOORINC 20 /* number of doors per level, increment */ #define BUFSZ 256 /* for getlin buffers */ #define QBUFSZ 128 /* for building question text */ -#define TBUFSZ 300 /* toplines[] buffer max msg: 3 81char names */ -/* plus longest prefix plus a few extra words */ +#define TBUFSZ 300 /* gt.toplines[] buffer max msg: 3 81-char names + * plus longest prefix plus a few extra words */ + +/* COLBUFSZ is the larger of BUFSZ and COLNO */ +#if BUFSZ > COLNO +#define COLBUFSZ BUFSZ +#else +#define COLBUFSZ COLNO +#endif #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ #define PL_CSIZ 32 /* sizeof pl_character */ #define PL_FSIZ 32 /* fruit name */ #define PL_PSIZ 63 /* player-given names for pets, other monsters, objects */ +/* room for "name-role-race-gend-algn" plus 1 character playmode code */ +#define PL_NSIZ_PLUS (PL_NSIZ + 4 * (1 + 3) + 1) /* 49 */ #define MAXDUNGEON 16 /* current maximum number of dungeons */ #define MAXLEVEL 32 /* max number of levels in one dungeon */ @@ -351,31 +415,203 @@ struct savefile_info { #define MAXMONNO 120 /* extinct monst after this number created */ #define MHPMAX 500 /* maximum monster hp */ +#ifndef MAX_MSG_HISTORY +#define MAX_MSG_HISTORY 128 /* max # of lines in msg_history */ +#endif + +#include "color.h" + +/* + * Version 5.0.x has aspirations of portable file formats. We + * make a distinction between MAIL functionality and MAIL_STRUCTURES + * so that the underlying structures are consistent, whether MAIL is + * defined or not. + */ +#define MAIL_STRUCTURES + /* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED but only for supported platforms. */ +#ifndef NOPANICTRACE #ifdef UNIX #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) /* see end.c */ +#if !defined(CROSS_TO_WASM) && !defined(CROSS_TO_MSDOS) #ifndef PANICTRACE #define PANICTRACE -#endif -#endif -#endif +#endif /* PANICTRACE */ +#endif /* CROSS_TO_WASM | CROSS_TO_MSDOS */ +#endif /* NH_DEVEL_STATUS != NH_STATUS_RELEASED */ +#endif /* UNIX */ +#endif /* !NOPANICTRACE */ + /* The following are meaningless if PANICTRACE is not defined: */ #if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2) #define PANICTRACE_LIBC #endif -#if defined(MACOSX) +#if defined(MACOS) #define PANICTRACE_LIBC #endif #ifdef UNIX +#if !defined(CROSS_TO_WASM) /* no popen in WASM */ #define PANICTRACE_GDB #endif +#ifdef CROSS_TO_WASM +#undef COMPRESS +#endif +#endif /* Supply nethack_enter macro if not supplied by port */ #ifndef nethack_enter #define nethack_enter(argc, argv) ((void) 0) #endif +/* Supply nhassert macro if not supplied by port */ +#ifndef nhassert +#define nhassert(expression) (void)((!!(expression)) || \ + (nhassert_failed(#expression, __FILE__, __LINE__), 0)) +#endif + +/* Macros for meta and ctrl modifiers: + * M and C return the meta/ctrl code for the given character; + * e.g., (C('c') is ctrl-c + */ +#ifndef M +#ifndef NHSTDC +#define M(c) (0x80 | (c)) +#else +#define M(c) ((c) - 128) +#endif /* NHSTDC */ +#endif + +#ifndef C +#define C(c) (0x1f & (c)) +#endif + +#define unmeta(c) (0x7f & (c)) + +/* Game log message type flags */ +#define LL_NONE 0x0000L /* No message is livelogged */ +#define LL_WISH 0x0001L /* Report stuff people type at the wish prompt */ +#define LL_ACHIEVE 0x0002L /* Achievements bitfield + invocation, planes */ +#define LL_UMONST 0x0004L /* defeated unique monster */ +#define LL_DIVINEGIFT 0x0008L /* Sacrifice gifts, crowning */ +#define LL_LIFESAVE 0x0010L /* Use up amulet of lifesaving */ +#define LL_CONDUCT 0x0020L /* Break conduct - not reported early-game */ +#define LL_ARTIFACT 0x0040L /* bestowed, found, or manufactured */ +#define LL_GENOCIDE 0x0080L /* Logging of genocides */ +#define LL_KILLEDPET 0x0100L /* Killed a tame monster */ +#define LL_ALIGNMENT 0x0200L /* changed alignment, temporary or permanent */ +#define LL_DUMP_ASC 0x0400L /* Log URL for dumplog if ascended */ +#define LL_DUMP_ALL 0x0800L /* Log dumplog url for all games */ +#define LL_MINORAC 0x1000L /* Log 'minor' achievements - can be spammy */ +#define LL_SPOILER 0x2000L /* reveals information so don't show in-game + * via #chronicle unless in wizard mode */ +#define LL_DUMP 0x4000L /* none of the above but should be in dumplog */ +#define LL_DEBUG 0x8000L /* For debugging messages and other spam */ + +/* + * Lua sandbox + */ +/* Control block for setting up a Lua state with nhl_init(). */ +typedef struct nhl_sandbox_info { + uint32_t flags; /* see below */ + uint32_t memlimit; /* approximate memory limit */ + uint32_t steps; /* instruction limit for state OR ... */ + uint32_t perpcall; /* ... instruction limit per nhl_pcall */ +} nhl_sandbox_info; + +/* For efficiency, we only check every NHL_SB_STEPSIZE instructions. */ +#ifndef NHL_SB_STEPSIZE +#define NHL_SB_STEPSIZE 1000 +#endif + +/* High level groups. Use these flags. */ + /* Safe functions. */ +#define NHL_SB_SAFE 0x80000000 + /* Access to Lua version information. */ +#define NHL_SB_VERSION 0x40000000 + /* Debugging library - mostly unsafe. */ +#define NHL_SB_DEBUGGING 0x08000000 + +/* Low level groups. If you need these, you probably need to define + * a new high level group instead. */ +#define NHL_SB_STRING 0x00000001 +#define NHL_SB_TABLE 0x00000002 +#define NHL_SB_COROUTINE 0x00000004 +#define NHL_SB_MATH 0x00000008 +#define NHL_SB_UTF8 0x00000010 +#ifdef notyet +#define NHL_SB_IO 0x00000020 +#endif +#define NHL_SB_OS 0x00000040 + +#define NHL_SB_BASEMASK 0x00000f80 +#define NHL_SB_BASE_BASE 0x00000080 +#define NHL_SB_BASE_ERROR 0x00000100 +#define NHL_SB_BASE_META 0x00000200 +#define NHL_SB_BASE_GC 0x00000400 +#define NHL_SB_BASE_UNSAFE 0x00000800 + +#define NHL_SB_DBMASK 0x00003000 +#define NHL_SB_DB_DB 0x00001000 +#define NHL_SB_DB_SAFE 0x00002000 + +#define NHL_SB_OSMASK 0x0000c000 +#define NHL_SB_OS_TIME 0x00004000 +#define NHL_SB_OS_FILES 0x00008000 + +#define NHL_SB_ALL 0x0000ffff + +/* return codes */ +#define NHL_SBRV_DENY 1 +#define NHL_SBRV_ACCEPT 2 +#define NHL_SBRV_FAIL 3 + +/* NHL_pcall_handle action values */ +typedef enum NHL_pcall_action { + NHLpa_panic, + NHLpa_impossible +} NHL_pcall_action; + +enum optchoice { opt_in, opt_out}; +/* + * option setting restrictions + */ +enum optset_restrictions { + set_in_sysconf = 0, /* system config file option only */ + set_in_config = 1, /* config file option only */ + set_viaprog = 2, /* may be set via extern program, not seen in game */ + set_gameview = 3, /* may be set via extern program, displayed in game */ + set_in_game = 4, /* may be set via extern program or set in the game */ + set_wizonly = 5, /* may be set in the game if wizmode */ + set_wiznofuz = 6, /* wizard-mode only, but not by fuzzer */ + set_hidden = 7 /* placeholder for prefixed entries, never show it */ +}; + +/* these aren't the same as set_xxx */ +enum option_phases { + phase_not_set = 0, + builtin_opt = 1, /* compiled-in default value of an option */ + syscf_opt, /* sysconf setting of an option, overrides builtin */ + rc_file_opt, /* player's run-time config file setting, overrides syscf */ + environ_opt, /* player's environment NETHACKOPTIONS, overrides rc_file */ + cmdline_opt, /* program invocation command-line, overrides environ */ + play_opt, /* 'O' command, interactively set so overrides all */ + num_opt_phases +}; + +#define SET__IS_VALUE_VALID(s) ((s < set_in_sysconf) || (s > set_wiznofuz)) +#include "optlist.h" +enum opt { + opt_prefix_only = -1, +#define NHOPT_ENUM +#include "optlist.h" +#undef NHOPT_ENUM + OPTCOUNT +}; + + + +#define SFCTOOL_BIT (1UL << 30) #endif /* GLOBAL_H */ diff --git a/include/hack.h b/include/hack.h index b0e44dde6..acf93509b 100644 --- a/include/hack.h +++ b/include/hack.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.h $NHDT-Date: 1561019041 2019/06/20 08:24:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.106 $ */ +/* NetHack 5.0 hack.h $NHDT-Date: 1736530208 2025/01/10 09:30:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.266 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -11,83 +11,273 @@ #endif #include "lint.h" +#include "align.h" +#include "weight.h" +#include "dungeon.h" +#include "stairs.h" +#include "objclass.h" +#include "wintype.h" +#include "flag.h" +#include "rect.h" +#include "sym.h" +#include "trap.h" +#include "youprop.h" +#include "display.h" + +#include "botl.h" +#include "context.h" +#include "engrave.h" +#include "mkroom.h" +#include "obj.h" +#include "quest.h" +#include "region.h" +#include "rm.h" +#include "selvar.h" +#include "sndprocs.h" +#include "spell.h" +#include "sys.h" +#include "timeout.h" +#include "winprocs.h" +#include "wintype.h" +#include "vision.h" +#include "you.h" + #define TELL 1 #define NOTELL 0 #define ON 1 #define OFF 0 #define BOLT_LIM 8 /* from this distance ranged attacks will be made */ -#define MAX_CARR_CAP 1000 /* so that boulders can be heavier */ #define DUMMY { 0 } /* array initializer, letting [1..N-1] default */ +#define DEF_NOTHING ' ' /* default symbol for NOTHING and UNEXPLORED */ -/* symbolic names for capacity levels */ -enum encumbrance_types { - UNENCUMBERED = 0, - SLT_ENCUMBER = 1, /* Burdened */ - MOD_ENCUMBER = 2, /* Stressed */ - HVY_ENCUMBER = 3, /* Strained */ - EXT_ENCUMBER = 4, /* Overtaxed */ - OVERLOADED = 5 /* Overloaded */ -}; +/* Macros for how a rumor was delivered in outrumor() */ +#define BY_ORACLE 0 +#define BY_COOKIE 1 +#define BY_PAPER 2 +#define BY_OTHER 9 -/* weight increment of heavy iron ball */ -#define IRON_BALL_W_INCR 160 +/* bitmask flags for corpse_xname(); + PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */ +#define CXN_NORMAL 0 /* no special handling */ +#define CXN_SINGULAR 1 /* override quantity if greater than 1 */ +#define CXN_NO_PFX 2 /* suppress "the" from "the Unique Monst */ +#define CXN_PFX_THE 4 /* prefix with "the " (unless pname) */ +#define CXN_ARTICLE 8 /* include a/an/the prefix */ +#define CXN_NOCORPSE 16 /* suppress " corpse" suffix */ /* number of turns it takes for vault guard to show up */ #define VAULT_GUARD_TIME 30 +/* sellobj_state() states */ +#define SELL_NORMAL (0) +#define SELL_DELIBERATE (1) +#define SELL_DONTSELL (2) + #define SHOP_DOOR_COST 400L /* cost of a destroyed shop door */ #define SHOP_BARS_COST 300L /* cost of iron bars */ #define SHOP_HOLE_COST 200L /* cost of making hole/trapdoor */ #define SHOP_WALL_COST 200L /* cost of destroying a wall */ #define SHOP_WALL_DMG (10L * ACURRSTR) /* damaging a wall */ +#define SHOP_PIT_COST 100L /* cost of making a pit */ +#define SHOP_WEB_COST 30L /* cost of removing a web */ + +/* flags for look_here() */ +#define LOOKHERE_NOFLAGS 0U +#define LOOKHERE_PICKED_SOME 1U +#define LOOKHERE_SKIP_DFEATURE 2U + +/* max size of a windowtype option */ +#define WINTYPELEN 16 + +/* str_or_len from sp_lev.h */ +typedef union str_or_len { + char *str; + int len; +} Str_or_Len; + +enum artifacts_nums { +#define ARTI_ENUM +#include "artilist.h" +#undef ARTI_ENUM + AFTER_LAST_ARTIFACT +}; -/* hunger states - see hu_stat in eat.c */ -enum hunger_state_types { - SATIATED = 0, - NOT_HUNGRY = 1, - HUNGRY = 2, - WEAK = 3, - FAINTING = 4, - FAINTED = 5, - STARVED = 6 +enum misc_arti_nums { + NROFARTIFACTS = (AFTER_LAST_ARTIFACT - 1) }; -/* Macros for how a rumor was delivered in outrumor() */ -#define BY_ORACLE 0 -#define BY_COOKIE 1 -#define BY_PAPER 2 -#define BY_OTHER 9 +/* related to breadcrumb struct */ +enum bcargs {override_restriction = -1}; -/* Macros for why you are no longer riding */ -enum dismount_types { - DISMOUNT_GENERIC = 0, - DISMOUNT_FELL = 1, - DISMOUNT_THROWN = 2, - DISMOUNT_POLY = 3, - DISMOUNT_ENGULFED = 4, - DISMOUNT_BONES = 5, - DISMOUNT_BYCHOICE = 6 -}; - -/* mgflags for mapglyph() */ -#define MG_FLAG_NORMAL 0x00 -#define MG_FLAG_NOOVERRIDE 0x01 - -/* Special returns from mapglyph() */ -#define MG_CORPSE 0x01 -#define MG_INVIS 0x02 -#define MG_DETECT 0x04 -#define MG_PET 0x08 -#define MG_RIDDEN 0x10 -#define MG_STATUE 0x20 -#define MG_OBJPILE 0x40 /* more than one stack of objects */ -#define MG_BW_LAVA 0x80 /* 'black & white lava': highlight lava if it - can't be distringuished from water by color */ +struct breadcrumbs { + const char *funcnm; + int linenum; + boolean in_effect; +}; -/* sellobj_state() states */ -#define SELL_NORMAL (0) -#define SELL_DELIBERATE (1) -#define SELL_DONTSELL (2) +/* types of calls to bhit() */ +enum bhit_call_types { + ZAPPED_WAND = 0, + THROWN_WEAPON = 1, + THROWN_TETHERED_WEAPON = 2, + KICKED_WEAPON = 3, + FLASHED_LIGHT = 4, + INVIS_BEAM = 5 +}; + +/* Macros for messages referring to hands, eyes, feet, etc... */ +enum bodypart_types { + NO_PART = -1, + ARM = 0, + EYE = 1, + FACE = 2, + FINGER = 3, + FINGERTIP = 4, + FOOT = 5, + HAND = 6, + HANDED = 7, + HEAD = 8, + LEG = 9, + LIGHT_HEADED = 10, + NECK = 11, + SPINE = 12, + TOE = 13, + HAIR = 14, + BLOOD = 15, + LUNG = 16, + NOSE = 17, + STOMACH = 18 +}; + +#define MAX_BMASK 4 + +struct bubble { + coordxy x, y; /* coordinates of the upper left corner */ + schar dx, dy; /* the general direction of the bubble's movement */ + uchar bm[MAX_BMASK + 2]; /* bubble bit mask */ + struct bubble *prev, *next; /* need to traverse the list up and down */ + struct container *cons; +}; + +enum bubble_contains_types { + CONS_OBJ = 0, + CONS_MON, + CONS_HERO, + CONS_TRAP +}; + +/* + * Rudimentary command queue. + * Allows the code to put keys and extended commands into the queue, + * and they're executed just as if the user did them. Time passes + * normally when doing queued actions. The queue will get cleared + * if hero is interrupted. + */ +enum cmdq_cmdtypes { + CMDQ_KEY = 0, /* a literal character, cmdq_add_key() */ + CMDQ_EXTCMD, /* extended command, cmdq_add_ec() */ + CMDQ_DIR, /* direction, cmdq_add_dir() */ + CMDQ_USER_INPUT, /* placeholder for user input, cmdq_add_userinput() */ + CMDQ_INT, /* integer value, cmdq_add_int() */ +}; + +struct _cmd_queue { + int typ; + char key; + schar dirx, diry, dirz; + int intval; + const struct ext_func_tab *ec_entry; + struct _cmd_queue *next; +}; + +enum { + CQ_CANNED = 0, /* internal canned sequence */ + CQ_REPEAT, /* user-inputted, if gi.in_doagain, replayed */ + NUM_CQS +}; + +typedef long cmdcount_nht; /* Command counts */ + + +/* special key functions */ +enum nh_keyfunc { + NHKF_ESC = 0, + + NHKF_GETDIR_SELF, + NHKF_GETDIR_SELF2, + NHKF_GETDIR_HELP, + NHKF_GETDIR_MOUSE, /* simulated click for #therecmdmenu; use '_' as + * direction to initiate, then getpos() finishing + * with ',' (left click) or '.' (right click) */ + NHKF_COUNT, + NHKF_GETPOS_SELF, + NHKF_GETPOS_PICK, + NHKF_GETPOS_PICK_Q, /* quick */ + NHKF_GETPOS_PICK_O, /* once */ + NHKF_GETPOS_PICK_V, /* verbose */ + NHKF_GETPOS_SHOWVALID, + NHKF_GETPOS_AUTODESC, + NHKF_GETPOS_MON_NEXT, + NHKF_GETPOS_MON_PREV, + NHKF_GETPOS_OBJ_NEXT, + NHKF_GETPOS_OBJ_PREV, + NHKF_GETPOS_DOOR_NEXT, + NHKF_GETPOS_DOOR_PREV, + NHKF_GETPOS_UNEX_NEXT, + NHKF_GETPOS_UNEX_PREV, + NHKF_GETPOS_INTERESTING_NEXT, + NHKF_GETPOS_INTERESTING_PREV, + NHKF_GETPOS_VALID_NEXT, + NHKF_GETPOS_VALID_PREV, + NHKF_GETPOS_HELP, + NHKF_GETPOS_MENU, + NHKF_GETPOS_LIMITVIEW, + NHKF_GETPOS_MOVESKIP, + + NUM_NHKF +}; + +/* commands[] is used to directly access cmdlist[] instead of looping + through it to find the entry for a given input character; + move_X is the character used for moving one step in direction X; + alphadirchars corresponds to old sdir, + dirchars corresponds to ``iflags.num_pad ? ndir : sdir''; + pcHack_compat and phone_layout only matter when num_pad is on, + swap_yz only matters when it's off */ +struct cmd { + unsigned serialno; /* incremented after each update */ + boolean num_pad; /* same as iflags.num_pad except during updates */ + boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */ + boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */ + boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */ + const char *dirchars; /* current movement/direction characters */ + const char *alphadirchars; /* same as dirchars if !numpad */ + struct Cmd_bind *cmdbinds; + const struct ext_func_tab *mousebtn[NUM_MOUSE_BUTTONS]; + char spkeys[NUM_NHKF]; + char extcmd_char; /* key that starts an extended command ('#') */ +}; + +struct c_color_names { + const char *const c_black, *const c_amber, *const c_golden, + *const c_light_blue, *const c_red, *const c_green, *const c_silver, + *const c_blue, *const c_purple, *const c_white, *const c_orange; +}; + +struct c_common_strings { + const char *const c_nothing_happens, *const c_nothing_seems_to_happen, + *const c_thats_enough_tries, *const c_silly_thing_to, + *const c_shudder_for_moment, *const c_something, *const c_Something, + *const c_You_can_move_again, *const c_Never_mind, + *const c_vision_clears, *const c_the_your[2], *const c_fakename[2]; +}; + +struct container { + struct container *next; + coordxy x, y; + short what; + genericptr_t list; +}; /* alteration types--keep in synch with costly_alteration(mkobj.c) */ enum cost_alteration_types { @@ -109,30 +299,185 @@ enum cost_alteration_types { COST_BRKLCK = 15, /* break box/chest's lock */ COST_RUST = 16, /* rust damage */ COST_ROT = 17, /* rotting attack */ - COST_CORRODE = 18 /* acid damage */ + COST_CORRODE = 18, /* acid damage */ + COST_CRACK = 19, /* damage to crystal armor */ }; -/* bitmask flags for corpse_xname(); - PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */ -#define CXN_NORMAL 0 /* no special handling */ -#define CXN_SINGULAR 1 /* override quantity if greather than 1 */ -#define CXN_NO_PFX 2 /* suppress "the" from "the Unique Monst */ -#define CXN_PFX_THE 4 /* prefix with "the " (unless pname) */ -#define CXN_ARTICLE 8 /* include a/an/the prefix */ -#define CXN_NOCORPSE 16 /* suppress " corpse" suffix */ +/* used by unpaid_cost(shk.h) */ +enum unpaid_cost_flags { + COST_NOCONTENTS = 0, + COST_CONTENTS = 1, + COST_SINGLEOBJ = 2, +}; -/* getpos() return values */ -enum getpos_retval { - LOOK_TRADITIONAL = 0, /* '.' -- ask about "more info?" */ - LOOK_QUICK = 1, /* ',' -- skip "more info?" */ - LOOK_ONCE = 2, /* ';' -- skip and stop looping */ - LOOK_VERBOSE = 3 /* ':' -- show more info w/o asking */ +/* read.c, create_particular() & create_particular_parse() */ +struct _create_particular_data { + int quan; + int which; + int fem; /* -1, MALE, FEMALE, NEUTRAL */ + int genderconf; /* conflicting gender */ + char monclass; + boolean randmonst; + boolean maketame, makepeaceful, makehostile; + boolean sleeping, saddled, invisible, hidden; +}; + +/* dig_check() results */ + +enum digcheck_result { + DIGCHECK_PASSED = 1, + DIGCHECK_PASSED_DESTROY_TRAP = 2, + DIGCHECK_PASSED_PITONLY = 3, + DIGCHECK_FAILED = 4, + DIGCHECK_FAIL_ONSTAIRS = DIGCHECK_FAILED, + DIGCHECK_FAIL_ONLADDER, + DIGCHECK_FAIL_THRONE, + DIGCHECK_FAIL_ALTAR, + DIGCHECK_FAIL_AIRLEVEL, + DIGCHECK_FAIL_WATERLEVEL, + DIGCHECK_FAIL_TOOHARD, + DIGCHECK_FAIL_UNDESTROYABLETRAP, + DIGCHECK_FAIL_CANTDIG, + DIGCHECK_FAIL_BOULDER, + DIGCHECK_FAIL_OBJ_POOL_OR_TRAP +}; + + +/* Dismount: causes for why you are no longer riding */ +enum dismount_types { + DISMOUNT_GENERIC = 0, + DISMOUNT_FELL = 1, + DISMOUNT_THROWN = 2, + DISMOUNT_KNOCKED = 3, /* hero hit for knockback effect */ + DISMOUNT_POLY = 4, + DISMOUNT_ENGULFED = 5, + DISMOUNT_BONES = 6, + DISMOUNT_BYCHOICE = 7 +}; + +struct dgn_topology { /* special dungeon levels for speed */ + d_level d_oracle_level; + d_level d_bigroom_level; /* unused */ + d_level d_rogue_level; + d_level d_medusa_level; + d_level d_stronghold_level; + d_level d_valley_level; + d_level d_wiz1_level; + d_level d_wiz2_level; + d_level d_wiz3_level; + d_level d_juiblex_level; + d_level d_orcus_level; + d_level d_baalzebub_level; /* unused */ + d_level d_asmodeus_level; /* unused */ + d_level d_portal_level; /* only in goto_level() [do.c] */ + d_level d_sanctum_level; + d_level d_earth_level; + d_level d_water_level; + d_level d_fire_level; + d_level d_air_level; + d_level d_astral_level; + xint16 d_tower_dnum; + xint16 d_sokoban_dnum; + xint16 d_mines_dnum, d_quest_dnum; + xint16 d_tutorial_dnum; + d_level d_qstart_level, d_qlocate_level, d_nemesis_level; + d_level d_knox_level; + d_level d_mineend_level; + d_level d_sokoend_level; +}; + +/* macros for accessing the dungeon levels by their old names */ +/* clang-format off */ +#define oracle_level (svd.dungeon_topology.d_oracle_level) +#define bigroom_level (svd.dungeon_topology.d_bigroom_level) +#define rogue_level (svd.dungeon_topology.d_rogue_level) +#define medusa_level (svd.dungeon_topology.d_medusa_level) +#define stronghold_level (svd.dungeon_topology.d_stronghold_level) +#define valley_level (svd.dungeon_topology.d_valley_level) +#define wiz1_level (svd.dungeon_topology.d_wiz1_level) +#define wiz2_level (svd.dungeon_topology.d_wiz2_level) +#define wiz3_level (svd.dungeon_topology.d_wiz3_level) +#define juiblex_level (svd.dungeon_topology.d_juiblex_level) +#define orcus_level (svd.dungeon_topology.d_orcus_level) +#define baalzebub_level (svd.dungeon_topology.d_baalzebub_level) +#define asmodeus_level (svd.dungeon_topology.d_asmodeus_level) +#define portal_level (svd.dungeon_topology.d_portal_level) +#define sanctum_level (svd.dungeon_topology.d_sanctum_level) +#define earth_level (svd.dungeon_topology.d_earth_level) +#define water_level (svd.dungeon_topology.d_water_level) +#define fire_level (svd.dungeon_topology.d_fire_level) +#define air_level (svd.dungeon_topology.d_air_level) +#define astral_level (svd.dungeon_topology.d_astral_level) +#define tower_dnum (svd.dungeon_topology.d_tower_dnum) +#define sokoban_dnum (svd.dungeon_topology.d_sokoban_dnum) +#define mines_dnum (svd.dungeon_topology.d_mines_dnum) +#define quest_dnum (svd.dungeon_topology.d_quest_dnum) +#define tutorial_dnum (svd.dungeon_topology.d_tutorial_dnum) +#define qstart_level (svd.dungeon_topology.d_qstart_level) +#define qlocate_level (svd.dungeon_topology.d_qlocate_level) +#define nemesis_level (svd.dungeon_topology.d_nemesis_level) +#define knox_level (svd.dungeon_topology.d_knox_level) +#define mineend_level (svd.dungeon_topology.d_mineend_level) +#define sokoend_level (svd.dungeon_topology.d_sokoend_level) +/* clang-format on */ + +#define dunlev_reached(x) (svd.dungeons[(x)->dnum].dunlev_ureached) +#define MAXLINFO (MAXDUNGEON * MAXLEVEL) + +enum lua_theme_group { + all_themes = 1, /* for end of game */ + most_themes = 2, /* for entering endgame */ + tut_themes = 3, /* for leaving tutorial */ +}; + +enum earlyarg { + ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS +#ifndef NODUMPENUMS + , ARG_DUMPENUMS +#endif + , ARG_DUMPGLYPHIDS + , ARG_DUMPMONGEN + , ARG_DUMPWEIGHTS +#ifdef WIN32 + , ARG_WINDOWS +#endif +#if defined(CRASHREPORT) + , ARG_BIDSHOW +#endif +}; + +struct early_opt { + enum earlyarg e; + const char *name; + int minlength; + boolean valallowed; +}; + +/* symbolic names for capacity levels */ +enum encumbrance_types { + UNENCUMBERED = 0, + SLT_ENCUMBER = 1, /* Burdened */ + MOD_ENCUMBER = 2, /* Stressed */ + HVY_ENCUMBER = 3, /* Strained */ + EXT_ENCUMBER = 4, /* Overtaxed */ + OVERLOADED = 5 /* Overloaded */ +}; + +struct entity { + struct monst *emon; /* youmonst for the player */ + struct permonst *edata; /* must be non-zero for record to be valid */ + int ex, ey; +}; + +struct enum_dump { + int val; + const char *nm; }; /* * This is the way the game ends. If these are rearranged, the arrays * in end.c and topten.c will need to be changed. Some parts of the - * code assume that PANIC separates the deaths from the non-deaths. + * code assume that PANICKED separates the deaths from the non-deaths. */ enum game_end_types { DIED = 0, @@ -153,33 +498,57 @@ enum game_end_types { ASCENDED = 15 }; -typedef struct strbuf { - int len; - char * str; - char buf[256]; -} strbuf_t; +/* game events log */ +struct gamelog_line { + long turn; /* turn when this happened */ + long flags; /* LL_foo flags */ + char *text; + struct gamelog_line *next; +}; -#include "align.h" -#include "dungeon.h" -#include "monsym.h" -#include "mkroom.h" -#include "objclass.h" -#include "youprop.h" -#include "wintype.h" -#include "context.h" -#include "decl.h" -#include "timeout.h" -NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ +/* values returned from getobj() callback functions */ +enum getobj_callback_returns { + /* generally invalid - can't be used for this purpose. will give a "silly + * thing" message if the player tries to pick it, unless a more specific + * failure message is in getobj itself - e.g. "You cannot foo gold". */ + GETOBJ_EXCLUDE = -3, + /* invalid because it is not in inventory; used when the hands/self + * possibility is queried and the player passed up something on the + * floor before getobj. */ + GETOBJ_EXCLUDE_NONINVENT = -2, + /* invalid because it is an inaccessible or unwanted piece of gear, but + * pseudo-valid for the purposes of allowing the player to select it and + * getobj to return it if there is a prompt instead of getting "silly + * thing", in order for the getobj caller to present a specific failure + * message. Other than that, the only thing this does differently from + * GETOBJ_EXCLUDE is that it inserts an "else" in "You don't have anything + * else to foo". */ + GETOBJ_EXCLUDE_INACCESS = -1, + /* invalid for purposes of not showing a prompt if nothing is valid but + * pseudo-valid for selecting - identical to GETOBJ_EXCLUDE_INACCESS but + * without the "else" in "You don't have anything else to foo". */ + GETOBJ_EXCLUDE_SELECTABLE = 0, + /* valid - invlet not presented in the summary or the ? menu as a + * recommendation, but is selectable if the player enters it anyway. + * Used for objects that are actually valid but unimportantly so, such + * as shirts for reading. */ + GETOBJ_DOWNPLAY = 1, + /* valid - will be shown in summary and ? menu */ + GETOBJ_SUGGEST = 2, +}; -/* types of calls to bhit() */ -enum bhit_call_types { - ZAPPED_WAND = 0, - THROWN_WEAPON = 1, - THROWN_TETHERED_WEAPON = 2, - KICKED_WEAPON = 3, - FLASHED_LIGHT = 4, - INVIS_BEAM = 5 +/* getpos() return values */ +enum getpos_retval { + LOOK_TRADITIONAL = 0, /* '.' -- ask about "more info?" */ + LOOK_QUICK = 1, /* ',' -- skip "more info?" */ + LOOK_ONCE = 2, /* ';' -- skip and stop looping */ + LOOK_VERBOSE = 3 /* ':' -- show more info w/o asking */ +}; + +struct h2o_ctx { + int dkn_boom, unk_boom; /* track dknown, !dknown separately */ + boolean ctx_valid; }; /* attack mode for hmon() */ @@ -191,89 +560,665 @@ enum hmon_atkmode_types { HMON_DRAGGED = 4 /* attached iron ball, pulled into mon */ }; +/* hunger states - see hu_stat in eat.c */ +enum hunger_state_types { + SATIATED = 0, + NOT_HUNGRY = 1, + HUNGRY = 2, + WEAK = 3, + FAINTING = 4, + FAINTED = 5, + STARVED = 6 +}; + +/* fake inventory letters, not 'a'..'z' or 'A'..'Z' */ +#define NOINVSYM '#' /* overflow because all 52 letters are in use */ +#define CONTAINED_SYM '>' /* designator for inside a container */ +#define HANDS_SYM '-' /* hands|fingers|self depending on context */ + +/* inventory counts (slots in tty parlance) + * a...zA..Z invlet_basic (52) + * $a...zA..Z# 2 special additions + */ +enum inventory_counts { + invlet_basic = 52, + invlet_gold = 1, + invlet_overflow = 1, + invlet_max = invlet_basic + invlet_gold + invlet_overflow, + /* 2023/11/30 invlet_max is not yet used anywhere */ +}; + +#ifndef IDLECHECKPOINT_WAIT_TIME +#define IDLECHECKPOINT_WAIT_TIME 10 /* seconds to wait before executing a checkpoint; + * always #define'd but only has meaning if + * IDLECHECKPOINT is defined. + */ +#endif + +struct kinfo { + struct kinfo *next; /* chain of delayed killers */ + int id; /* uprop keys to ID a delayed killer */ + int format; /* one of the killer formats */ +#define KILLED_BY_AN 0 +#define KILLED_BY 1 +#define NO_KILLER_PREFIX 2 + char name[BUFSZ]; /* actual killer name */ +}; + +struct launchplace { + struct obj *obj; + coordxy x, y; +}; + +/* light source */ +typedef struct ls_t { + struct ls_t *next; + coordxy x, y; /* source's position */ + short range; /* source's current range */ + short flags; + short type; /* type of light source */ + anything id; /* source's identifier */ +} light_source; + +struct menucoloring { + struct nhregex *match; + char *origstr; + int color, attr; + struct menucoloring *next; +}; + +enum movemodes { + MV_ANY = -1, + MV_WALK, + MV_RUN, + MV_RUSH, + + N_MOVEMODES +}; + +enum movementdirs { + DIR_ERR = -1, + DIR_W, + DIR_NW, + DIR_N, + DIR_NE, + DIR_E, + DIR_SE, + DIR_S, + DIR_SW, + DIR_DOWN, + DIR_UP, + + N_DIRS_Z +}; +/* N_DIRS_Z, minus up & down */ +#define N_DIRS (N_DIRS_Z - 2) +/* direction adjustments */ +#define DIR_180(dir) (((dir) + 4) % N_DIRS) +#define DIR_LEFT(dir) (((dir) + 7) % N_DIRS) +#define DIR_RIGHT(dir) (((dir) + 1) % N_DIRS) +#define DIR_LEFT2(dir) (((dir) + 6) % N_DIRS) +#define DIR_RIGHT2(dir) (((dir) + 2) % N_DIRS) +#define DIR_CLAMP(dir) (((dir) + N_DIRS) % N_DIRS) + +struct multishot { + int n, i; + short o; + boolean s; +}; + +struct musable { + struct obj *offensive; + struct obj *defensive; + struct obj *misc; + int has_offense, has_defense, has_misc; + /* =0, no capability; otherwise, different numbers. + * If it's an object, the object is also set (it's 0 otherwise). + */ +}; + +struct mvitals { + uchar born; + uchar died; + uchar mvflags; + Bitfield(seen_close, 1); + Bitfield(photographed, 1); +}; + + +/* Lua callback functions */ +enum nhcore_calls { + NHCORE_START_NEW_GAME = 0, + NHCORE_RESTORE_OLD_GAME, + NHCORE_MOVELOOP_TURN, + NHCORE_GAME_EXIT, + NHCORE_GETPOS_TIP, + NHCORE_ENTER_TUTORIAL, + NHCORE_LEAVE_TUTORIAL, + + NUM_NHCORE_CALLS +}; + +/* Lua callbacks. TODO: Merge with NHCORE */ +enum nhcb_calls { + NHCB_CMD_BEFORE = 0, + NHCB_LVL_ENTER, + NHCB_LVL_LEAVE, + NHCB_END_TURN, + + NUM_NHCB +}; + +#define NHUUIDSZ 37 + +struct plinemsg_type { + xint16 msgtype; /* one of MSGTYP_foo */ + struct nhregex *regex; + char *pattern; + struct plinemsg_type *next; +}; + +#define MSGTYP_NORMAL 0 +#define MSGTYP_NOREP 1 +#define MSGTYP_NOSHOW 2 +#define MSGTYP_STOP 3 +/* bitmask for callers of hide_unhide_msgtypes() */ +#define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW)) + +/* polyself flags */ +enum polyself_flags { + POLY_NOFLAGS = 0x00, + POLY_CONTROLLED = 0x01, + POLY_MONSTER = 0x02, + POLY_REVERT = 0x04, + POLY_LOW_CTRL = 0x08 +}; + +struct repo { /* repossession context */ + struct monst *shopkeeper; + coord location; +}; + +struct restore_info { + const char *name; + int mread_flags; +}; + +enum restore_stages { + REST_GSTATE = 1, /* restoring game state + first pass of current level */ + REST_LEVELS = 2, /* restoring remainder of dungeon */ + REST_CURRENT_LEVEL = 3, /* final pass of restoring current level */ +}; + +struct rogueroom { + coordxy rlx, rly; + coordxy dx, dy; + boolean real; + uchar doortable; + int nroom; /* Only meaningful for "real" rooms */ +}; + +#define NUM_ROLES (13) +struct role_filter { + boolean roles[NUM_ROLES + 1]; + short mask; +}; +#define NUM_RACES (5) + +struct selectionvar { + int wid, hei; + boolean bounds_dirty; + NhRect bounds; /* use selection_getbounds() */ + char *map; +}; + +/* structure for 'program_state'; not saved and restored */ +struct sinfo { + int gameover; /* self-explanatory? */ + int stopprint; /* inhibit further end of game disclosure */ +#ifdef HANGUPHANDLING + volatile int done_hup; /* SIGHUP or moral equivalent received + * -- no more screen output */ + int preserve_locks; /* don't remove level files prior to exit */ +#endif + int something_worth_saving; /* in case of panic */ + int panicking; /* `panic' is in progress */ + int exiting; /* an exit handler is executing */ + int saving; /* creating a save file */ + int restoring; /* reloading a save file */ + int freeingdata; /* in saveobjchn(), mode FREEING */ + int in_getlev; /* in getlev() */ + int in_moveloop; /* normal gameplay in progress */ + int in_impossible; /* reporting a warning */ + int in_docrt; /* in docrt(): redrawing the whole screen */ + int in_self_recover; /* processing orphaned level files */ + int in_checkpoint; /* saving insurance checkpoint */ + int in_parseoptions; /* in parseoptions */ + int in_role_selection; /* role/race/&c selection menus in progress */ + int in_getlin; /* inside interface getlin routine */ + int in_sanity_check; /* for impossible() during sanity checking */ + int config_error_ready; /* config_error_add is ready, available */ + int beyond_savefile_load; /* set when past savefile loading */ + int savefile_completed; /* savefile has completed writing */ + int reading_bonesfile; /* in the midst of trying to read bones file */ +#ifdef PANICLOG + int in_paniclog; /* writing a panicloc entry */ +#endif + int wizkit_wishing; /* starting wizard mode game w/ WIZKIT file */ + /* input_state: used in the core for the 'altmeta' option to process ESC; + used in the curses interface to avoid arrow keys when user is doing + something other than entering a command or direction and in the Qt + interface to suppress menu commands in similar conditions; + readchar() always resets it to 'otherInp' prior to returning */ + int input_state; /* whether next key pressed will be entering a command */ + int early_options; /* inside early_options processing */ +#ifdef TTY_GRAPHICS + /* resize_pending only matters when handling a SIGWINCH signal for tty; + getting_char is used along with that and also separately for UNIX; + we minimize #if conditionals for them to avoid unnecessary clutter */ + volatile int resize_pending; /* set by signal handler */ + volatile int getting_char; /* referenced during signal handling */ +#endif +}; + +/* value of program_state.input_state, significant during readchar(); + get_count() expects digits then a command so sets it to commandInp */ +enum InputState { + otherInp = 0, /* 'other' */ + commandInp = 1, /* readchar() */ + getposInp = 2, /* getpos() */ + getdirInp = 3, /* getdir() */ +}; + /* sortloot() return type; needed before extern.h */ struct sortloot_item { struct obj *obj; char *str; /* result of loot_xname(obj) in some cases, otherwise null */ - int indx; /* signed int, because sortloot()'s qsort comparison routine - assumes (a->indx - b->indx) might yield a negative result */ - xchar orderclass; /* order rather than object class; 0 => not yet init'd */ - xchar subclass; /* subclass for some classes */ - xchar disco; /* discovery status */ + /* these need to be signed; 'indx' should be big enough to hold a count + of the largest pile of items, the others fit within char */ + int indx; /* index into original list (used as tie-breaker) */ + int8 orderclass; /* order rather than object class; 0 => not yet init'd */ + int8 subclass; /* subclass for some classes */ + int8 disco; /* discovery status */ + int8 inuse; /* 0: not in-use or not sorting by inuse_only; + * 1: lit candle/lamp or attached leash; 2: worn armor; + * 3: wielded weapon (including uswapwep and uquiver); + * 4: worn accessory (amulet, rings, blindfold). */ }; typedef struct sortloot_item Loot; -#define MATCH_WARN_OF_MON(mon) \ - (Warn_of_mon && ((context.warntype.obj \ - && (context.warntype.obj & (mon)->data->mflags2)) \ - || (context.warntype.polyd \ - && (context.warntype.polyd & (mon)->data->mflags2)) \ - || (context.warntype.species \ - && (context.warntype.species == (mon)->data)))) +typedef struct strbuf { + int len; + char *str; + char buf[256]; +} strbuf_t; -#include "trap.h" -#include "flag.h" -#include "rm.h" -#include "vision.h" -#include "display.h" -#include "engrave.h" -#include "rect.h" -#include "region.h" +enum stoning_checks { + st_gloves = 0x1, /* wearing gloves? */ + st_corpse = 0x2, /* is it a corpse obj? */ + st_petrifies = 0x4, /* does the corpse petrify on touch? */ + st_resists = 0x8, /* do you have stoning resistance? */ + st_all = (st_gloves | st_corpse | st_petrifies | st_resists) +}; + +struct throw_and_return_weapon { + short otyp; + int range; + Bitfield(tethered, 1); +}; + +struct trapinfo { + struct obj *tobj; + coordxy tx, ty; + int time_needed; + boolean force_bungle; +}; + +/* values for rtype are defined in dungeon.h */ +/* lev_region from sp_lev.h */ +typedef struct { + struct { + coordxy x1, y1, x2, y2; + } inarea; + struct { + coordxy x1, y1, x2, y2; + } delarea; + boolean in_islev, del_islev; + coordxy rtype, padding; + Str_or_Len rname; +} lev_region; + +/* Flags for controlling uptodate */ +#define UTD_CHECKSIZES 0x01 +#define UTD_CHECKFIELDCOUNTS 0x02 +#define UTD_SKIP_SANITY1 0x04 +#define UTD_SKIP_SAVEFILEINFO 0x08 +#define UTD_WITHOUT_WAITSYNCH_PERFILE 0x10 +#define UTD_QUIETLY 0x20 + +/* Values for savefile status */ +#define SF_UPTODATE 0 +#define SF_OUTDATED 1 +#define SF_CRITICAL_BYTE_COUNT_MISMATCH 2 +#define SF_DM_IL32LLP64_ON_ILP32LL64 3 /* Wind x64 savefile on x86 */ +#define SF_DM_I32LP64_ON_ILP32LL64 4 /* Unix 64 savefile on x86 */ +#define SF_DM_ILP32LL64_ON_I32LP64 5 /* x86 savefile on Unix 64 */ +#define SF_DM_ILP32LL64_ON_IL32LLP64 6 /* x86 savefile on Wind x64 */ +#define SF_DM_I32LP64_ON_IL32LLP64 7 /* Unix 64 savefile on Wind x64 */ +#define SF_DM_IL32LLP64_ON_I32LP64 8 /* Wind x64 savefile on Unix 64 */ +#define SF_DM_MISMATCH 9 /* generic savefile byte mismatch */ + +#define ENTITIES 2 +struct valuable_data { + long count; + int typ; +}; + +struct val_list { + struct valuable_data *list; + int size; +}; + +enum vanq_order_modes { + VANQ_MLVL_MNDX = 0, /* t - traditional: by monster level */ + VANQ_MSTR_MNDX, /* d - by difficulty rating */ + VANQ_ALPHA_SEP, /* a - alphabetical, first uniques, then ordinary */ + VANQ_ALPHA_MIX, /* A - alpha with uniques and ordinary intermixed */ + VANQ_MCLS_HTOL, /* C - by class, high to low within class */ + VANQ_MCLS_LTOH, /* c - by class, low to high within class */ + VANQ_COUNT_H_L, /* n - by count, high to low */ + VANQ_COUNT_L_H, /* z - by count, low to high */ + + NUM_VANQ_ORDER_MODES +}; + +struct autopickup_exception { + struct nhregex *regex; + char *pattern; + boolean grab; + struct autopickup_exception *next; +}; + +/* at most one of `door' and `box' should be non-null at any given time */ +struct xlock_s { + struct rm *door; + struct obj *box; + int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */ + chance, usedtime; + boolean magic_key; +}; + +#define MAX_BMASK 4 + +/* NetHack ftypes */ +#define NHF_LEVELFILE 1 +#define NHF_SAVEFILE 2 +#define NHF_BONESFILE 3 +/* modes */ +#define READING 0x0 +#define COUNTING 0x01 +#define WRITING 0x02 +#define FREEING 0x04 +#define CONVERTING 0x08 +#define UNCONVERTING 0x10 +#if 0 +/* operations of the various saveXXXchn & co. routines */ +#define perform_bwrite(nhfp) ((nhfp)->mode & (COUNTING | WRITING)) +#define release_data(nhfp) ((nhfp)->mode & FREEING) +#endif + +/* operations of the various saveXXXchn & co. routines */ +#define update_file(nhfp) ((nhfp)->mode & (COUNTING | WRITING)) +#define release_data(nhfp) ((nhfp)->mode & FREEING) + +enum saveformats { + invalid = 0, + historical = 1, /* entire struct, binary, as-is */ + exportascii = 2, /* each field written out as ascii text */ + NUM_SAVEFORMATS +}; + +/* Content types for fieldlevel files */ +struct fieldlevel_content { + boolean deflt; /* individual fields */ + boolean binary; /* binary rather than text */ +}; + +struct nh_file { + int fd; /* for traditional structlevel binary writes */ + int mode; /* holds READING, WRITING, FREEING, CONVERTING modes */ + int ftype; /* NHF_LEVELFILE, NHF_SAVEFILE, or NHF_BONESFILE */ + int fnidx; /* index of procs for fieldlevel saves */ + long rcount, /* read count since opening */ + wcount; /* write count since opening */ + boolean structlevel; /* traditional structure binary saves */ + boolean fieldlevel; /* fieldlevel saves each field individually */ + boolean addinfo; /* if set, some additional context info from core */ + boolean eof; /* place to mark eof reached */ + boolean bendian; /* set to true if executing on big-endian machine */ + FILE *fpdef; /* file pointer for fieldlevel default style */ + FILE *fpdefmap; /* file pointer mapfile for def format */ + FILE *fplog; /* file pointer logfile */ + FILE *fpdebug; /* file pointer debug info */ + struct fieldlevel_content style; + struct nh_file *nhfpconvert; +}; + +typedef struct nh_file NHFILE; + +/* Monster name articles */ +#define ARTICLE_NONE 0 +#define ARTICLE_THE 1 +#define ARTICLE_A 2 +#define ARTICLE_YOUR 3 + +/* x_monnam() monster name suppress masks */ +#define SUPPRESS_IT 0x01 +#define SUPPRESS_INVISIBLE 0x02 +#define SUPPRESS_HALLUCINATION 0x04 +#define SUPPRESS_SADDLE 0x08 +#define SUPPRESS_MAPPEARANCE 0x10 +#define EXACT_NAME 0x1F +#define SUPPRESS_NAME 0x20 +#define AUGMENT_IT 0x40 /* use "someone" or "something" instead of "it" */ + +/* pline (et al) for a single string argument (suppress compiler warning) */ +#define pline1(cstr) pline("%s", cstr) +#define Your1(cstr) Your("%s", cstr) +#define You1(cstr) You("%s", cstr) +#define verbalize1(cstr) verbalize("%s", cstr) +#define You_hear1(cstr) You_hear("%s", cstr) +#define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr) +#define panic1(cstr) panic("%s", cstr) + +/* Some systems want to use full pathnames for some subsets of file names, + * rather than assuming that they're all in the current directory. This + * provides all the subclasses that seem reasonable, and sets up for all + * prefixes being null. Port code can set those that it wants. + */ +#define HACKPREFIX 0 /* shared, RO */ +#define LEVELPREFIX 1 /* per-user, RW */ +#define SAVEPREFIX 2 /* per-user, RW */ +#define BONESPREFIX 3 /* shared, RW */ +#define DATAPREFIX 4 /* dungeon/dlb; must match value in dlb.c */ +#define SCOREPREFIX 5 /* shared, RW */ +#define LOCKPREFIX 6 /* shared, RW */ +#define SYSCONFPREFIX 7 /* shared, RO */ +#define CONFIGPREFIX 8 +#define TROUBLEPREFIX 9 /* shared or per-user, RW (append-only) */ +#define PREFIX_COUNT 10 +/* used in files.c; xxconf.h can override if needed */ +#ifndef FQN_MAX_FILENAME +#define FQN_MAX_FILENAME 512 +#endif + +#if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND) +/* the bare-bones stuff is unconditional above to simplify coding; for + * ports that actually use prefixes, add some more localized things + */ +#define PREFIXES_IN_USE +#endif + +/* from options.c */ +#define MAX_MENU_MAPPED_CMDS 32 /* some number */ + +/* player selection constants */ +#define BP_ALIGN 0 +#define BP_GEND 1 +#define BP_RACE 2 +#define BP_ROLE 3 +#define NUM_BP 4 + +/* some array sizes for 'g?' */ +#define WIZKIT_MAX 128 +#define CVT_BUF_SIZE 64 + +#define LUA_VER_BUFSIZ 20 +#define LUA_COPYRIGHT_BUFSIZ 120 /* Symbol offsets */ #define SYM_OFF_P (0) -#define SYM_OFF_O (SYM_OFF_P + MAXPCHARS) -#define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES) -#define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES) +#define SYM_OFF_O (SYM_OFF_P + MAXPCHARS) /* MAXPCHARS from sym.h */ +#define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES) /* MAXOCLASSES from objclass.h */ +#define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES) /* MAXMCLASSES from sym.h*/ #define SYM_OFF_X (SYM_OFF_W + WARNCOUNT) #define SYM_MAX (SYM_OFF_X + MAXOTHER) -#ifdef USE_TRAMPOLI /* this doesn't belong here, but we have little choice */ -#undef NDECL -#define NDECL(f) f() -#endif - -#include "extern.h" -#include "winprocs.h" -#include "sys.h" - -#ifdef USE_TRAMPOLI -#include "wintty.h" -#undef WINTTY_H -#include "trampoli.h" -#undef EXTERN_H -#include "extern.h" -#endif /* USE_TRAMPOLI */ - -/* flags to control makemon(); goodpos() uses some plus has some of its own */ -#define NO_MM_FLAGS 0x00000 /* use this rather than plain 0 */ -#define NO_MINVENT 0x00001 /* suppress minvent when creating mon */ -#define MM_NOWAIT 0x00002 /* don't set STRAT_WAITMASK flags */ -#define MM_NOCOUNTBIRTH 0x00004 /* don't increment born count (for revival) */ -#define MM_IGNOREWATER 0x00008 /* ignore water when positioning */ -#define MM_ADJACENTOK 0x00010 /* acceptable to use adjacent coordinates */ -#define MM_ANGRY 0x00020 /* monster is created angry */ -#define MM_NONAME 0x00040 /* monster is not christened */ -#define MM_EGD 0x00100 /* add egd structure */ -#define MM_EPRI 0x00200 /* add epri structure */ -#define MM_ESHK 0x00400 /* add eshk structure */ -#define MM_EMIN 0x00800 /* add emin structure */ -#define MM_EDOG 0x01000 /* add edog structure */ -#define MM_ASLEEP 0x02000 /* monsters should be generated asleep */ -#define MM_NOGRP 0x04000 /* suppress creation of monster groups */ +/* The UNDEFINED macros are used to initialize variables whose + initialized value is not relied upon. + UNDEFINED_VALUE: used to initialize any scalar type except pointers. + UNDEFINED_VALUES: used to initialize any non scalar type without pointers. + UNDEFINED_PTR: can be used only on pointer types. */ +#define UNDEFINED_VALUE 0 +#define UNDEFINED_VALUES { 0 } +#define UNDEFINED_PTR NULL + +/* The UNDEFINED_ROLE macro is used to initialize Role variables */ +#define UNDEFINED_ROLE \ + { \ + /* role name, set of rank names */ \ + { NULL, NULL }, { { NULL, NULL } }, \ + /* strings: pantheon deity names */ \ + NULL, NULL, NULL, \ + /* file code, quest home+goal names */ \ + NULL, NULL, NULL, \ + /* indices: base mon type, pet */ \ + NON_PM, NON_PM, \ + /* quest leader, guardians, nemesis */ \ + NON_PM, NON_PM, NON_PM, \ + /* quest enemy types (index, symbol) */ \ + NON_PM, NON_PM, '\0', '\0', \ + /* quest artifact object index */ \ + STRANGE_OBJECT, \ + /* Bitmasks */ \ + 0, \ + /* Attributes */ \ + {0}, {0}, {0}, {0}, 0, 0, \ + /* spell statistics */ \ + 0, 0, 0, 0, 0, 0, 0 } + +/* The UNDEFINED_RACE macro is used to initialize Race variables */ +#define UNDEFINED_RACE \ + { \ + /* strings */ \ + NULL, NULL, NULL, NULL, { NULL, NULL }, \ + /* Indices: base race, mummy, zombie */ \ + NON_PM, NON_PM, NON_PM, \ + /* Bitmasks */ \ + 0, 0, 0, 0, \ + /* Characteristic limits */ \ + {0}, {0}, \ + /* Level change HP and Pw adjustments */ \ + {0}, {0} \ + } + +#define MATCH_WARN_OF_MON(mon) \ + (Warn_of_mon \ + && ((svc.context.warntype.obj & (mon)->data->mflags2) != 0 \ + || (svc.context.warntype.polyd & (mon)->data->mflags2) != 0 \ + || (svc.context.warntype.species \ + && (svc.context.warntype.species == (mon)->data)))) + +typedef uint32_t mmflags_nht; /* makemon MM_ flags */ + + +/* flags to control makemon(); goodpos() uses some plus has some of its own*/ +#define NO_MM_FLAGS 0x00000000L /* use this rather than plain 0 */ +#define NO_MINVENT 0x00000001L /* suppress minvent when creating mon */ +#define MM_NOWAIT 0x00000002L /* don't set STRAT_WAITMASK flags */ +#define MM_NOCOUNTBIRTH 0x00000004L /* don't incr born count (for revival) */ +#define MM_IGNOREWATER 0x00000008L /* ignore water when positioning */ +#define MM_ADJACENTOK 0x00000010L /* ok to use adjacent coordinates */ +#define MM_ANGRY 0x00000020L /* monster is created angry */ +#define MM_NONAME 0x00000040L /* monster is not christened */ +#define MM_EGD 0x00000080L /* add egd structure */ +#define MM_EPRI 0x00000100L /* add epri structure */ +#define MM_ESHK 0x00000200L /* add eshk structure */ +#define MM_EMIN 0x00000400L /* add emin structure */ +#define MM_EDOG 0x00000800L /* add edog structure */ +#define MM_ASLEEP 0x00001000L /* monsters should be generated asleep */ +#define MM_NOGRP 0x00002000L /* suppress creation of monster groups */ +#define MM_NOTAIL 0x00004000L /* if a long worm, don't give it a tail */ +#define MM_MALE 0x00008000L /* male variation */ +#define MM_FEMALE 0x00010000L /* female variation */ +#define MM_NOMSG 0x00020000L /* no appear message */ +#define MM_NOEXCLAM 0x00040000L /* more sedate " appears." + * mesg for ^G */ +#define MM_IGNORELAVA 0x00080000L /* ignore lava when positioning */ +#define MM_MINVIS 0x00100000L /* for ^G/create_particular */ /* if more MM_ flag masks are added, skip or renumber the GP_ one(s) */ -#define GP_ALLOW_XY 0x08000 /* [actually used by enexto() to decide whether - * to make an extra call to goodpos()] */ - -/* flags for make_corpse() and mkcorpstat() */ -#define CORPSTAT_NONE 0x00 -#define CORPSTAT_INIT 0x01 /* pass init flag to mkcorpstat */ -#define CORPSTAT_BURIED 0x02 /* bury the corpse or statue */ +#define GP_ALLOW_XY 0x00200000L /* [actually used by enexto() to decide + * whether to make an extra call to + * goodpos()] */ +#define GP_ALLOW_U 0x00400000L /* don't reject hero's location */ +#define GP_CHECKSCARY 0x00800000L /* check monster for onscary() */ +#define GP_AVOID_MONPOS 0x01000000L /* don't accept existing mon location */ +/* 25 bits used */ + +/* flags for mhidden_description() (pager.c; used for mimics and hiders) */ +#define MHID_PREFIX 1 /* include ", mimicking " prefix */ +#define MHID_ARTICLE 2 /* include "a " or "an " after prefix */ +#define MHID_ALTMON 4 /* if mimicking a monster, include that */ +#define MHID_REGION 8 /* include region when mon is in one */ + +/* flags for that_is_a_mimic() */ +#define MIM_REVEAL 1 /* seemimic() */ +#define MIM_OMIT_WAIT 2 /* strip beginning from "Wait! That is a " */ + +/* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */ +#define CORPSTAT_NONE 0x00 +#define CORPSTAT_GENDER 0x03 /* 0x01 | 0x02 */ +#define CORPSTAT_HISTORIC 0x04 /* historic statue; not used for corpse */ +#define CORPSTAT_SPE_VAL 0x07 /* 0x03 | 0x04 */ +#define CORPSTAT_INIT 0x08 /* pass init flag to mkcorpstat */ +#define CORPSTAT_BURIED 0x10 /* bury the corpse or statue */ +/* note: gender flags have different values from those used for monsters + so that 0 can be unspecified/random instead of male */ +#define CORPSTAT_RANDOM 0 +#define CORPSTAT_FEMALE 1 +#define CORPSTAT_MALE 2 +#define CORPSTAT_NEUTER 3 + +/* flag bits for collect_coords(); combining ring_pairs with unshuffled + makes no sense--if both are specified unshuffled takes precedence */ +#define CC_NO_FLAGS 0x00 /* skip center, collect in distinct rings and + * shuffle each ring, ignore monster occupants */ +#define CC_INCL_CENTER 0x01 /* include center point as ring #0 */ +#define CC_UNSHUFFLED 0x02 /* don't shuffle the rings */ +#define CC_RING_PAIRS 0x04 /* shuffle w/ odd and next even rings together */ +#define CC_SKIP_MONS 0x08 /* skip locations occupied by monsters */ +#define CC_SKIP_INACCS 0x10 /* skip !ZAP_POS: reject rock and wall locations + * but allow pools, unlike !ACCESSIBLE */ /* flags for decide_to_shift() */ #define SHIFT_SEENMSG 0x01 /* put out a message if in sight */ #define SHIFT_MSG 0x02 /* always put out a message */ +/* m_poisongas_ok() return values */ +#define M_POISONGAS_BAD 0 /* poison gas is bad */ +#define M_POISONGAS_MINOR 1 /* poison gas is ok, maybe causes coughing */ +#define M_POISONGAS_OK 2 /* ignores poison gas completely */ + /* flags for deliver_obj_to_mon */ #define DF_NONE 0x00 #define DF_RANDOM 0x01 @@ -295,49 +1240,77 @@ typedef struct sortloot_item Loot; #define ALL_FINISHED 0x01 /* called routine already finished the job */ /* flags to control query_objlist() */ -#define BY_NEXTHERE 0x01 /* follow objlist by nexthere field */ -#define AUTOSELECT_SINGLE 0x02 /* if only 1 object, don't ask */ -#define USE_INVLET 0x04 /* use object's invlet */ -#define INVORDER_SORT 0x08 /* sort objects by packorder */ -#define SIGNAL_NOMENU 0x10 /* return -1 rather than 0 if none allowed */ -#define SIGNAL_ESCAPE 0x20 /* return -2 rather than 0 for ESC */ -#define FEEL_COCKATRICE 0x40 /* engage cockatrice checks and react */ -#define INCLUDE_HERO 0x80 /* show hero among engulfer's inventory */ +#define BY_NEXTHERE 0x0001 /* follow objlist by nexthere field */ +#define INCLUDE_VENOM 0x0002 /* include venom objects if present */ +#define AUTOSELECT_SINGLE 0x0004 /* if only 1 object, don't ask */ +#define USE_INVLET 0x0008 /* use object's invlet */ +#define INVORDER_SORT 0x0010 /* sort objects by packorder */ +#define SIGNAL_NOMENU 0x0020 /* return -1 rather than 0 if none allowed */ +#define SIGNAL_ESCAPE 0x0040 /* return -2 rather than 0 for ESC */ +#define FEEL_COCKATRICE 0x0080 /* engage cockatrice checks and react */ +#define INCLUDE_HERO 0x0100 /* show hero among engulfer's inventory */ /* Flags to control query_category() */ -/* BY_NEXTHERE used by query_category() too, so skip 0x01 */ -#define UNPAID_TYPES 0x002 -#define GOLD_TYPES 0x004 -#define WORN_TYPES 0x008 -#define ALL_TYPES 0x010 -#define BILLED_TYPES 0x020 -#define CHOOSE_ALL 0x040 -#define BUC_BLESSED 0x080 -#define BUC_CURSED 0x100 -#define BUC_UNCURSED 0x200 -#define BUC_UNKNOWN 0x400 +/* BY_NEXTHERE and INCLUDE_VENOM are used by query_category() too, so + skip 0x0001 and 0x0002 */ +#define UNPAID_TYPES 0x0004 +#define GOLD_TYPES 0x0008 +#define WORN_TYPES 0x0010 +#define ALL_TYPES 0x0020 +#define BILLED_TYPES 0x0040 +#define CHOOSE_ALL 0x0080 +#define BUC_BLESSED 0x0100 +#define BUC_CURSED 0x0200 +#define BUC_UNCURSED 0x0400 +#define BUC_UNKNOWN 0x0800 +#define JUSTPICKED 0x1000 #define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED) #define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN) #define ALL_TYPES_SELECTED -2 -/* Flags to control find_mid() */ +/* Flags for oname(), artifact_exists(), artifact_origin() */ +#define ONAME_NO_FLAGS 0U /* none of the below; they apply to artifacts */ +/* 0x0001U is reserved for 'exists' */ +/* flags indicating where an artifact came from */ +#define ONAME_VIA_NAMING 0x0002U /* oname() is being called by do_oname(); + * only matters if creating Sting|Orcrist */ +#define ONAME_WISH 0x0004U /* created via wish */ +#define ONAME_GIFT 0x0008U /* created as a divine reward after #offer or + * special #pray result of being crowned */ +#define ONAME_VIA_DIP 0x0010U /* created Excalibur in a fountain */ +#define ONAME_LEVEL_DEF 0x0020U /* placed by a special level's definition */ +#define ONAME_BONES 0x0040U /* object came from bones; in its original + * game it had one of the other bits but we + * don't care which one */ +#define ONAME_RANDOM 0x0080U /* something created an artifact randomly + * with mk_artifact() (mksboj or mk_player) + * or m_initweap() (lawful Angel) */ +/* flag controlling potential livelog event of finding an artifact */ +#define ONAME_KNOW_ARTI 0x0100U /* hero is already aware of this artifact */ +/* flag for suppressing perm_invent update when name gets assigned */ +#define ONAME_SKIP_INVUPD 0x0200U /* don't call update_inventory() */ + +/* Flags to control find_mid() and whereis_mon() */ #define FM_FMON 0x01 /* search the fmon chain */ #define FM_MIGRATE 0x02 /* search the migrating monster chain */ -#define FM_MYDOGS 0x04 /* search mydogs */ -#define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS) +#define FM_MYDOGS 0x04 /* search gm.mydogs */ +#define FM_YOU 0x08 /* check for gy.youmonst */ +#define FM_EVERYWHERE (FM_YOU | FM_FMON | FM_MIGRATE | FM_MYDOGS) /* Flags to control pick_[race,role,gend,align] routines in role.c */ #define PICK_RANDOM 0 #define PICK_RIGID 1 -/* Flags to control dotrap() in trap.c */ -#define FORCETRAP 0x01 /* triggering not left to chance */ -#define NOWEBMSG 0x02 /* suppress stumble into web message */ -#define FORCEBUNGLE 0x04 /* adjustments appropriate for bungling */ -#define RECURSIVETRAP 0x08 /* trap changed into another type this same turn */ -#define TOOKPLUNGE 0x10 /* used '>' to enter pit below you */ -#define VIASITTING 0x20 /* #sit while at trap location (affects message) */ -#define FAILEDUNTRAP 0x40 /* trap activated by failed untrap attempt */ +/* Flags to control dotrap() and mintrap() in trap.c */ +#define NO_TRAP_FLAGS 0x00U +#define FORCETRAP 0x01U /* triggering not left to chance */ +#define NOWEBMSG 0x02U /* suppress stumble into web message */ +#define FORCEBUNGLE 0x04U /* adjustments appropriate for bungling */ +#define RECURSIVETRAP 0x08U /* trap changed into another type this same turn */ +#define TOOKPLUNGE 0x10U /* used '>' to enter pit below you */ +#define VIASITTING 0x20U /* #sit while at trap location (affects message) */ +#define FAILEDUNTRAP 0x40U /* trap activated by failed untrap attempt */ +#define HURTLING 0x80U /* monster is hurtling through air */ /* Flags to control test_move in hack.c */ #define DO_MOVE 0 /* really doing the move */ @@ -345,13 +1318,22 @@ typedef struct sortloot_item Loot; #define TEST_TRAV 2 /* test a future travel location */ #define TEST_TRAP 3 /* check if a future travel loc is a trap */ +/* m_move return values */ +#define MMOVE_NOTHING 0 +#define MMOVE_MOVED 1 /* monster moved */ +#define MMOVE_DIED 2 /* monster died */ +#define MMOVE_DONE 3 /* monster used up all actions */ +#define MMOVE_NOMOVES 4 /* monster has no valid locations to move to */ + /*** some utility macros ***/ -#define yn(query) yn_function(query, ynchars, 'n') -#define ynq(query) yn_function(query, ynqchars, 'q') -#define ynaq(query) yn_function(query, ynaqchars, 'y') -#define nyaq(query) yn_function(query, ynaqchars, 'n') -#define nyNaq(query) yn_function(query, ynNaqchars, 'n') -#define ynNaq(query) yn_function(query, ynNaqchars, 'y') +#define y_n(query) yn_function(query, ynchars, 'n', TRUE) +#define ynq(query) yn_function(query, ynqchars, 'q', TRUE) +#define ynaq(query) yn_function(query, ynaqchars, 'y', TRUE) +#define nyaq(query) yn_function(query, ynaqchars, 'n', TRUE) +#define nyNaq(query) yn_function(query, ynNaqchars, 'n', TRUE) +#define ynNaq(query) yn_function(query, ynNaqchars, 'y', TRUE) +/* YN() is same as y_n() except doesn't save the response in do-again buffer */ +#define YN(query) yn_function(query, ynchars, 'n', FALSE) /* Macros for scatter */ #define VIS_EFFECTS 0x01 /* display visual effects */ @@ -363,22 +1345,10 @@ typedef struct sortloot_item Loot; /* Macros for launching objects */ #define ROLL 0x01 /* the object is rolling */ -#define FLING 0x02 /* the object is flying thru the air */ +#define FLING 0x02 /* the object is flying through the air */ #define LAUNCH_UNSEEN 0x40 /* hero neither caused nor saw it */ #define LAUNCH_KNOWN 0x80 /* the hero caused this by explicit action */ -/* Macros for explosion types */ -enum explosion_types { - EXPL_DARK = 0, - EXPL_NOXIOUS = 1, - EXPL_MUDDY = 2, - EXPL_WET = 3, - EXPL_MAGICAL = 4, - EXPL_FIERY = 5, - EXPL_FROSTY = 6, - EXPL_MAX = 7 -}; - /* enlightenment control flags */ #define BASICENLIGHTENMENT 1 /* show mundane stuff */ #define MAGICENLIGHTENMENT 2 /* show intrinsics and such */ @@ -390,6 +1360,7 @@ enum explosion_types { #define SORTLOOT_PACK 0x01 #define SORTLOOT_INVLET 0x02 #define SORTLOOT_LOOT 0x04 +#define SORTLOOT_INUSE 0x08 /* for inventory, in-use items first */ #define SORTLOOT_PETRIFY 0x20 /* override filter func for c-trice corpses */ /* flags for xkilled() [note: meaning of first bit used to be reversed, @@ -405,29 +1376,22 @@ enum explosion_types { #define OVERRIDE_MSGTYPE 2 #define SUPPRESS_HISTORY 4 #define URGENT_MESSAGE 8 - -/* Macros for messages referring to hands, eyes, feet, etc... */ -enum bodypart_types { - ARM = 0, - EYE = 1, - FACE = 2, - FINGER = 3, - FINGERTIP = 4, - FOOT = 5, - HAND = 6, - HANDED = 7, - HEAD = 8, - LEG = 9, - LIGHT_HEADED = 10, - NECK = 11, - SPINE = 12, - TOE = 13, - HAIR = 14, - BLOOD = 15, - LUNG = 16, - NOSE = 17, - STOMACH = 18 -}; +#define PLINE_VERBALIZE 16 +#define PLINE_SPEECH 32 +#define NO_CURS_ON_U 64 + +/* get_count flags */ +#define GC_NOFLAGS 0 +#define GC_SAVEHIST 1 /* save "Count: 123" in message history */ +#define GC_CONDHIST 2 /* save "Count: N" in message history unless the + * first digit is passed in and N matches it */ +#define GC_ECHOFIRST 4 /* echo "Count: 1" even when there's only one digit */ + +/* rloc() flags */ +#define RLOC_NONE 0x00 +#define RLOC_ERR 0x01 /* allow impossible() if no rloc */ +#define RLOC_MSG 0x02 /* show vanish/appear msg */ +#define RLOC_NOMSG 0x04 /* prevent appear msg, even for STRAT_APPEARMSG */ /* indices for some special tin types */ #define ROTTEN_TIN 0 @@ -436,9 +1400,15 @@ enum bodypart_types { #define RANDOM_TIN (-2) #define HEALTHY_TIN (-3) +/* Corpse aging */ +#define TAINT_AGE (50L) /* age when corpses go bad */ +#define TROLL_REVIVE_CHANCE 37 /* 1/37 chance for 50 turns ~ 75% chance */ +#define ROT_AGE (250L) /* age when corpses rot away */ + /* Some misc definitions */ #define POTION_OCCUPANT_CHANCE(n) (13 + 2 * (n)) #define WAND_BACKFIRE_CHANCE 100 +#define WAND_WREST_CHANCE 121 #define BALL_IN_MON (u.uswallow && uball && uball->where == OBJ_FREE) #define CHAIN_IN_MON (u.uswallow && uchain && uchain->where == OBJ_FREE) #define NODIAG(monnum) ((monnum) == PM_GRID_BUG) @@ -450,23 +1420,86 @@ enum bodypart_types { #define MENU_FULL 2 #define MENU_PARTIAL 3 -#define MENU_SELECTED TRUE -#define MENU_UNSELECTED FALSE - -/* - * Option flags - * Each higher number includes the characteristics of the numbers - * below it. - */ -/* XXX This should be replaced with a bitmap. */ -#define SET_IN_SYS 0 /* system config file option only */ -#define SET_IN_FILE 1 /* config file option only */ -#define SET_VIA_PROG 2 /* may be set via extern program, not seen in game */ -#define DISP_IN_GAME 3 /* may be set via extern program, displayed in game \ - */ -#define SET_IN_GAME 4 /* may be set via extern program or set in the game */ -#define SET_IN_WIZGAME 5 /* may be set set in the game if wizmode */ -#define SET__IS_VALUE_VALID(s) ((s < SET_IN_SYS) || (s > SET_IN_WIZGAME)) +/* flags to control teleds() */ +#define TELEDS_NO_FLAGS 0 +#define TELEDS_ALLOW_DRAG 1 +#define TELEDS_TELEPORT 2 + +/* flags for mktrap() */ +#define MKTRAP_NOFLAGS 0x0U +#define MKTRAP_SEEN 0x1U /* trap is seen */ +#define MKTRAP_MAZEFLAG 0x2U /* choose random coords instead of room */ +#define MKTRAP_NOSPIDERONWEB 0x4U /* web will not generate a spider */ +#define MKTRAP_NOVICTIM 0x8U /* no victim corpse or items on it */ + +#define MON_POLE_DIST 5 /* How far monsters can use pole-weapons */ +#define PET_MISSILE_RANGE2 36 /* Square of distance within which pets shoot */ + +/* flags passed to getobj() to control how it responds to player input */ +#define GETOBJ_NOFLAGS 0x0 +#define GETOBJ_ALLOWCNT 0x1 /* is a count allowed with this command? */ +#define GETOBJ_PROMPT 0x2 /* should it force a prompt for input? (prevents + * it exiting early with "You don't have anything + * to foo" if nothing in inventory is valid) */ + +/* flags for hero_breaks() and hits_bars(); BRK_KNOWN* let callers who have + already called breaktest() prevent it from being called again since it + has a random factor which makes it be non-deterministic */ +#define BRK_BY_HERO 0x01 +#define BRK_FROM_INV 0x02 +#define BRK_KNOWN2BREAK 0x04 +#define BRK_KNOWN2NOTBREAK 0x08 +#define BRK_KNOWN_OUTCOME (BRK_KNOWN2BREAK | BRK_KNOWN2NOTBREAK) +#define BRK_MELEE 0x10 + +/* extended command return values */ +#define ECMD_OK 0x00 /* cmd done successfully */ +#define ECMD_TIME 0x01 /* cmd took time, uses up a turn */ +#define ECMD_CANCEL 0x02 /* cmd canceled by user */ +#define ECMD_FAIL 0x04 /* cmd failed to finish, maybe with a yafm */ + +/* flags for newcham() */ +#define NO_NC_FLAGS 0U +#define NC_SHOW_MSG 0x01U +#define NC_VIA_WAND_OR_SPELL 0x02U + +/* Constant passed to explode() for gas spores because gas spores are weird. + * Specifically, this is an exception to whole "explode() uses dobuzz types" + * system (the range -1 to -9 isn't used by it, for some reason), where this + * is effectively an extra dobuzz type, and some zap.c code needs to be aware + * of it. */ +#define PHYS_EXPL_TYPE -1 + +/* macros for dobuzz() type */ +#define BZ_VALID_ADTYP(adtyp) ((adtyp) >= AD_MAGM && (adtyp) <= AD_SPC2) + +#define BZ_OFS_AD(adtyp) (abs((adtyp) - AD_MAGM) % 10) +#define BZ_OFS_WAN(otyp) (abs((otyp) - WAN_MAGIC_MISSILE) % 10) +#define BZ_OFS_SPE(otyp) (abs((otyp) - SPE_MAGIC_MISSILE) % 10) +/* hero shooting a wand */ +#define BZ_U_WAND(bztyp) (0 + (bztyp)) /* 0..9 */ +/* hero casting a spell */ +#define BZ_U_SPELL(bztyp) (10 + (bztyp)) /* 10..19 */ +/* hero breathing as a monster */ +#define BZ_U_BREATH(bztyp) (20 + (bztyp)) /* 20..29 */ +/* monster casting a spell */ +#define BZ_M_SPELL(bztyp) (-10 - (bztyp)) /* -19..-10 */ +/* monster breathing */ +#define BZ_M_BREATH(bztyp) (-20 - (bztyp)) /* -29..-20 */ +/* monster shooting a wand; note: not -9 to -0 because -0 is ambiguous */ +#define BZ_M_WAND(bztyp) (-30 - (bztyp)) /* -39..-30 */ + +/* pick a random entry from array */ +#define ROLL_FROM(array) array[rn2(SIZE(array))] +/* array with terminator variation */ +/* #define ROLL_FROMT(array) array[rn2(SIZE(array) - 1)] */ + +/* validate index of array */ +#define IndexOk(idx, array) \ + ((idx) >= 0 && (idx) < SIZE(array)) +/* array with terminator variation */ +#define IndexOkT(idx, array) \ + ((idx) >= 0 && (idx) < (SIZE(array) - 1)) #define FEATURE_NOTICE_VER(major, minor, patch) \ (((unsigned long) major << 24) | ((unsigned long) minor << 16) \ @@ -486,13 +1519,18 @@ enum bodypart_types { #endif #define plur(x) (((x) == 1) ? "" : "s") -#define ARM_BONUS(obj) \ - (objects[(obj)->otyp].a_ac + (obj)->spe \ +/* Cast to int, but limit value to range. */ +#define LIMIT_TO_RANGE_INT(lo, hi, var) \ + ((int) ((var) < (lo) ? (lo) : (var) > (hi) ? (hi) : (var))) + +#define ARM_BONUS(obj) \ + (objects[(obj)->otyp].a_ac + (obj)->spe \ - min((int) greatest_erosion(obj), objects[(obj)->otyp].a_ac)) -#define makeknown(x) discover_object((x), TRUE, TRUE) -#define distu(xx, yy) dist2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy) -#define onlineu(xx, yy) online2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy) +#define makeknown(x) discover_object((x), TRUE, TRUE, TRUE) +#define distu(xx, yy) dist2((coordxy) (xx), (coordxy) (yy), u.ux, u.uy) +#define mdistu(mon) distu((mon)->mx, (mon)->my) +#define onlineu(xx, yy) online2((coordxy)(xx), (coordxy)(yy), u.ux, u.uy) #define rn1(x, y) (rn2(x) + (y)) @@ -504,38 +1542,31 @@ enum bodypart_types { #define getlogin() ((char *) 0) #endif /* MICRO */ -#if defined(OVERLAY) -#define USE_OVLx -#define STATIC_DCL extern -#define STATIC_OVL -#define STATIC_VAR - -#else /* !OVERLAY */ +/* These may have been defined to platform-specific values in *conf.h + * or on the compiler command line from a hints file or Makefile */ -#define STATIC_DCL static -#define STATIC_OVL static -#define STATIC_VAR static - -#endif /* OVERLAY */ - -/* Macro for a few items that are only static if we're not overlaid.... */ -#if defined(USE_TRAMPOLI) || defined(USE_OVLx) -#define STATIC_PTR -#else -#define STATIC_PTR static +#ifndef QSORTCALLBACK +#define QSORTCALLBACK #endif -/* The function argument to qsort() requires a particular - * calling convention under WINCE which is not the default - * in that environment. - */ -#if defined(WIN_CE) -#define CFDECLSPEC __cdecl -#else -#define CFDECLSPEC +#ifndef SIG_RET_TYPE +#define SIG_RET_TYPE void (*)(int) #endif #define DEVTEAM_EMAIL "devteam@nethack.org" #define DEVTEAM_URL "https://www.nethack.org/" +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +#include "nhlua.h" +#endif + +#if !defined(RECOVER_C) + +#include "extern.h" +#include "savefile.h" +#include "decl.h" + +#endif /* RECOVER_C */ + #endif /* HACK_H */ + diff --git a/include/hacklib.h b/include/hacklib.h new file mode 100644 index 000000000..2e3ac679a --- /dev/null +++ b/include/hacklib.h @@ -0,0 +1,86 @@ +/* NetHack 5.0 hacklib.h $NHDT-Date: 1725653010 2024/09/06 20:03:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */ +/* Copyright (c) Steve Creps, 1988. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef HACKLIB_H +#define HACKLIB_H + +/* + * hacklib true library functions + */ +extern boolean digit(char); +extern boolean letter(char); +extern char highc(char); +extern char lowc(char); +extern char *lcase(char *) NONNULL NONNULLARG1; +extern char *ucase(char *) NONNULL NONNULLARG1; +extern char *upstart(char *); /* ought to be changed to NONNULL NONNULLARG1 + * and the code changed to not allow NULL arg */ +extern char *upwords(char *) NONNULL NONNULLARG1; +extern char *mungspaces(char *) NONNULL NONNULLARG1; +extern char *trimspaces(char *) NONNULL NONNULLARG1; +extern char *strip_newline(char *) NONNULL NONNULLARG1; +extern char *eos(char *) NONNULL NONNULLARG1; +extern const char *c_eos(const char *) NONNULL NONNULLARG1; +extern boolean str_start_is(const char *, const char *, boolean) NONNULLPTRS; +extern boolean str_end_is(const char *, const char *) NONNULLPTRS; +extern int str_lines_maxlen(const char *); +extern char *strkitten(char *, char) NONNULL NONNULLARG1; +extern void copynchars(char *, const char *, int) NONNULLARG12; +extern char chrcasecpy(int, int); +extern char *strcasecpy(char *, const char *) NONNULL NONNULLPTRS; +extern char *s_suffix(const char *) NONNULL NONNULLARG1; +extern char *ing_suffix(const char *) NONNULL NONNULLARG1; +extern char *xcrypt(const char *, char *) NONNULL NONNULLPTRS; +extern boolean onlyspace(const char *) NONNULLARG1; +extern char *tabexpand(char *) NONNULL NONNULLARG1; +extern char *visctrl(char) NONNULL; +extern char *stripchars(char *, const char *, + const char *) NONNULL NONNULLPTRS; +extern char *stripdigits(char *) NONNULL NONNULLARG1; +extern char *strsubst(char *, const char *, const char *) NONNULL NONNULLPTRS; +extern int strNsubst(char *, const char *, const char *, int) NONNULLPTRS; +extern const char *findword(const char *, const char *, int, + boolean) NONNULLARG2; +extern const char *ordin(int) NONNULL; +extern char *sitoa(int) NONNULL; +extern int sgn(int); +extern int distmin(coordxy, coordxy, coordxy, coordxy); +extern int dist2(coordxy, coordxy, coordxy, coordxy); +extern int isqrt(int); +extern boolean online2(coordxy, coordxy, coordxy, coordxy); +#ifndef STRNCMPI +extern int strncmpi(const char *, const char *, int) NONNULLPTRS; +#endif +#ifndef STRSTRI +extern char *strstri(const char *, const char *) NONNULLPTRS; +#endif +#define FITSint(x) FITSint_(x, __func__, __LINE__) +extern int FITSint_(long long, const char *, int); +#define FITSuint(x) FITSuint_(x, __func__, __LINE__) +extern unsigned FITSuint_(unsigned long long, const char *, int); +extern int case_insensitive_comp(const char *, const char *); +extern boolean fuzzymatch(const char *, const char *, + const char *, boolean) NONNULLPTRS; +extern int swapbits(int, int, int); +/* note: the snprintf CPP wrapper includes the "fmt" argument in "..." + (__VA_ARGS__) to allow for zero arguments after fmt */ +extern void nh_snprintf(const char *func, int line, char *str, + size_t size, const char *fmt, ...) PRINTF_F(5, 6); +extern void nh_snprintf_w_impossible(const char *func, int line, char *str, + size_t size, const char *fmt, ...) PRINTF_F(5, 6); + +#define Snprintf(str, size, ...) \ + nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__) + +#if 0 +/*#define Strlen(s) Strlen_(s, __func__, __LINE__)*/ +extern unsigned Strlen_(const char *, const char *, int) NONNULLPTRS; +#endif +extern int unicodeval_to_utf8str(int, uint8 *, size_t); +extern boolean copy_bytes(int, int); +extern const char *datamodel(int); +extern const char *what_datamodel_is_this(int, int, int, int, int, int); + +#endif /* HACKLIB_H */ + diff --git a/include/integer.h b/include/integer.h index 322c2f5e3..479ccc9bd 100644 --- a/include/integer.h +++ b/include/integer.h @@ -1,11 +1,11 @@ -/* NetHack 3.6 integer.h $NHDT-Date: 1551901047 2019/03/06 19:37:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.7 $ */ +/* NetHack 5.0 integer.h $NHDT-Date: 1720397754 2024/07/08 00:15:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.13 $ */ /* Copyright (c) 2016 by Michael Allison */ /* NetHack may be freely redistributed. See license for details. */ /* integer.h -- provide sized integer types * * We try to sort out a way to provide sized integer types - * in here. The strong preference is to try and let a + * in here. The strong preference is to try to let a * compiler-supplied header file set up the types. * * If your compiler is C99 conforming and sets a value of @@ -39,31 +39,35 @@ #define HAS_INTTYPES_H #else /*!__DECC*/ -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - && !defined(HAS_STDINT_H) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +#if !defined(HAS_STDINT_H) /* The compiler claims to conform to C99. Use stdint.h */ #define HAS_STDINT_H -#endif +#endif /* !HAS_STDINT_H */ +#if !defined(HAS_INTTYPES_H) +/* The compiler claims to conform to C99. Use inttypes.h */ +#define HAS_INTTYPES_H +#endif /* !HAS_INTTYPES_H */ #if defined(__GNUC__) && defined(__INT64_MAX__) && !defined(HAS_STDINT_H) #define HAS_STDINT_H -#endif +#endif +#endif /* claims to be C99 */ #endif /*?__DECC*/ #ifdef HAS_STDINT_H #include #define SKIP_STDINT_WORKAROUND -#else /*!stdint*/ +#endif #ifdef HAS_INTTYPES_H #include -#define SKIP_STDINT_WORKAROUND -#endif -#endif /*?stdint*/ +#endif /* HAS_INTTYPES_H */ #ifndef SKIP_STDINT_WORKAROUND /* !C99 */ /* * STDINT_WORKAROUND section begins here */ +typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; @@ -85,12 +89,18 @@ typedef unsigned int uint32_t; 64-bit integers, you should comment out USE_ISAAC64 in config.h so that the previous RNG gets used instead. Then this file will be inhibited and it won't matter what the int64_t and uint64_t lines are. */ + +#if defined(__cplusplus) +#include +#else typedef long long int int64_t; typedef unsigned long long int uint64_t; +#endif #endif /* !C99 */ -/* Provide uint8, int16, uint16, int32, uint32, int64 and uint64 */ +/* Provide int8, uint8, int16, uint16, int32, uint32, int64 and uint64 */ +typedef int8_t int8; typedef uint8_t uint8; typedef int16_t int16; typedef uint16_t uint16; @@ -99,4 +109,23 @@ typedef uint32_t uint32; typedef int64_t int64; typedef uint64_t uint64; +/* Also provide ushort, uint, ulong */ +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +/* for non-negative L, calculate L * 10 + D, avoiding signed overflow; + yields -1 if overflow would have happened; + assumes compiler will optimize the constants */ +#define AppendLongDigit(L,D) \ + (((L) < LONG_MAX / 10L \ + || ((L) == LONG_MAX / 10L && (D) <= LONG_MAX % 10L)) \ + ? (L) * 10L + (D) \ + : -1L) + +/* add a and b, return max long value if overflow would have occurred; + assumes that both a and b are non-negative; caller should apply + cast(s) to (long) in the arguments if any are needed */ +#define nowrap_add(a,b) ((a) <= (LONG_MAX - (b)) ? ((a) + (b)) : LONG_MAX) + #endif /* INTEGER_H */ diff --git a/include/isaac64.h b/include/isaac64.h index da9d5a046..4b53467b1 100644 --- a/include/isaac64.h +++ b/include/isaac64.h @@ -1,7 +1,6 @@ /* CC0 (Public domain) - see http://creativecommons.org/publicdomain/zero/1.0/ for details */ #if !defined(_isaac64_H) # define _isaac64_H (1) -# include "integer.h" @@ -37,7 +36,7 @@ struct isaac64_ctx{ /** - * isaac64_init - Initialize an instance of the ISAAC64 random number generator. + * isaac64_init - Initialize an instance of ISAAC64 random number generator. * @_ctx: The ISAAC64 instance to initialize. * @_seed: The specified seed bytes. * This may be NULL if _nseed is less than or equal to zero. @@ -78,8 +77,8 @@ uint64_t isaac64_next_uint(isaac64_ctx *_ctx,uint64_t _n); * @_ctx: The ISAAC64 instance to generate the value with. * Returns a high-quality float uniformly distributed between 0 (inclusive) * and 1 (exclusive). - * All of the float's mantissa bits are random, e.g., the least significant bit - * may still be non-zero even if the value is less than 0.5, and any + * All of the float's mantissa bits are random, e.g., the least significant + * bit may still be non-zero even if the value is less than 0.5, and any * representable float in the range [0,1) has a chance to be returned, though * values very close to zero become increasingly unlikely. * To generate cheaper float values that do not have these properties, use diff --git a/include/lint.h b/include/lint.h index 93a33776b..235f05fc2 100644 --- a/include/lint.h +++ b/include/lint.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 lint.h $NHDT-Date: 1524689514 2018/04/25 20:51:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.5 $ */ +/* NetHack 5.0 lint.h $NHDT-Date: 1655631029 2022/06/19 09:30:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ */ /* Copyright (c) 2016 by Robert Patrick Rankin */ /* NetHack may be freely redistributed. See license for details. */ @@ -15,19 +15,7 @@ (also caller's responsibility to ensure it isn't actually modified!) */ #define nhStr(str) ((char *) str) -#if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE) -#define FORCE_ARG_USAGE -#endif - -#ifdef FORCE_ARG_USAGE -/* force an unused function argument to become used in an arbitrary - manner in order to suppress warning about unused function arguments; - viable for scalar and pointer arguments */ -#define nhUse(arg) nhUse_dummy += (unsigned) !(arg) -extern unsigned nhUse_dummy; -#else -#define nhUse(arg) /*empty*/ -#endif +#define nhUse(arg) ((void) (arg)) /* * This stuff isn't related to lint suppression but lives here to @@ -37,21 +25,28 @@ extern unsigned nhUse_dummy; #ifdef DEBUG #define showdebug(file) debugcore(file, TRUE) #define explicitdebug(file) debugcore(file, FALSE) -#define ifdebug(stmt) \ - do { \ - if (showdebug(__FILE__)) { \ - stmt; \ - } \ + /* in case 'stmt' is pline() or something which calls pline(), + save and restore previous plnmsg code so that use of debugpline() + doesn't change message semantics */ +#define ifdebug(stmt) \ + do { \ + if (showdebug(__FILE__)) { \ + int save_plnmsg = iflags.last_msg; \ + stmt; \ + iflags.last_msg = save_plnmsg; \ + } \ } while (0) #ifdef _MSC_VER /* if we have microsoft's C runtime we can use these instead */ #include -#define crtdebug(stmt) \ - do { \ - if (showdebug(__FILE__)) { \ - stmt; \ - } \ - _RPT0(_CRT_WARN, "\n"); \ +#define crtdebug(stmt) \ + do { \ + if (showdebug(__FILE__)) { \ + int save_plnmsg = iflags.last_msg; \ + stmt; \ + iflags.last_msg = save_plnmsg; \ + } \ + _RPT0(_CRT_WARN, "\n"); \ } while (0) #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str)) #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg)) diff --git a/include/mail.h b/include/mail.h index 3b7772b8c..3564c020f 100644 --- a/include/mail.h +++ b/include/mail.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mail.h $NHDT-Date: 1524689515 2018/04/25 20:51:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.9 $ */ +/* NetHack 5.0 mail.h $NHDT-Date: 1596498544 2020/08/03 23:49:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.10 $ */ /* Copyright (c) 2015 by Kenneth Lorber */ /* NetHack may be freely redistributed. See license for details. */ diff --git a/include/mcastu.h b/include/mcastu.h new file mode 100644 index 000000000..53a37070e --- /dev/null +++ b/include/mcastu.h @@ -0,0 +1,39 @@ + + +#define MCF_NONE 0x0000 +#define MCF_INDIRECT 0x0001 /* untargeted/indirect spell */ +#define MCF_SIGHT 0x0002 /* monster needs to see hero */ +#define MCF_HOSTILE 0x0004 /* cast by hostile monsters only */ + +#if defined(MCASTU_ENUM) +#define MONSPELL(def, lvl, flags) MCAST_##def +#elif defined(MCASTU_INIT) +#define MONSPELL(def, lvl, flags) { lvl, flags } +#elif defined(DUMP_MCASTU_ENUM1) +#define MONSPELL(def, lvl, flags) MCAST_DUMPENUM_##def +#elif defined(DUMP_MCASTU_ENUM2) +#define MONSPELL(def, lvl, flags) { MCAST_DUMPENUM_##def, #def } +#endif + +MONSPELL(PSI_BOLT, 0, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(OPEN_WOUNDS, 0, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(CURE_SELF, 1, MCF_INDIRECT), +MONSPELL(HASTE_SELF, 2, MCF_INDIRECT), +MONSPELL(CONFUSE_YOU, 2, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(STUN_YOU, 3, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(DISAPPEAR, 4, MCF_INDIRECT), +MONSPELL(PARALYZE, 4, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(BLIND_YOU, 6, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(WEAKEN_YOU, 6, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(DESTRY_ARMR, 8, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(INSECTS, 8, MCF_HOSTILE|MCF_INDIRECT|MCF_SIGHT), +MONSPELL(CURSE_ITEMS, 10, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(LIGHTNING, 11, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(FIRE_PILLAR, 12, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(GEYSER, 13, MCF_HOSTILE|MCF_SIGHT), +MONSPELL(AGGRAVATION, 13, MCF_INDIRECT|MCF_HOSTILE|MCF_SIGHT), +MONSPELL(SUMMON_MONS, 15, MCF_HOSTILE|MCF_INDIRECT|MCF_SIGHT), +MONSPELL(CLONE_WIZ, 18, MCF_HOSTILE|MCF_INDIRECT|MCF_SIGHT), +MONSPELL(DEATH_TOUCH, 20, MCF_HOSTILE|MCF_SIGHT), + +#undef MONSPELL diff --git a/include/mextra.h b/include/mextra.h index 2fd27472a..546c94c71 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mextra.h $NHDT-Date: 1574722861 2019/11/25 23:01:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.24 $ */ +/* NetHack 5.0 mextra.h $NHDT-Date: 1720717969 2024/07/11 17:12:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.40 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -18,13 +18,16 @@ * 2. Add a pointer to your new struct to the mextra struct in this * file. * 3. Add a referencing macro at bottom of this file after the mextra - * struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples). - * 4. Create a newXX(mtmp) function and possibly a free_XX(mtmp) + * struct (see MGIVENNAME, EGD, EPRI, ESHK, EMIN, or EDOG for + * examples). + * 4. If your new field isn't a pointer and requires a non-zero value + * on initialization, add code to init_mextra() in src/makemon.c + * 5. Create a newXX(mtmp) function and possibly a free_XX(mtmp) * function in an appropriate new or existing source file and add * a prototype for it to include/extern.h. * - * void FDECL(newXX, (struct monst *)); - * void FDECL(free_XX, (struct monst *)); + * void newXX(struct monst *); + * void free_XX(struct monst *); * * void * newXX(mtmp) @@ -39,7 +42,7 @@ * } * } * - * 5. Consider adding a new makemon flag MM_XX flag to include/hack.h + * 6. Consider adding a new makemon flag MM_XX flag to include/hack.h * and a corresponding change to makemon() if you require your * structure to be added at monster creation time. Initialize your * struct after a successful return from makemon(). @@ -47,14 +50,14 @@ * src/makemon.c: if (mmflags & MM_XX) newXX(mtmp); * your new code: mon = makemon(&mons[mnum], x, y, MM_XX); * - * 6. Adjust size_monst() in src/cmd.c appropriately. - * 7. Adjust dealloc_mextra() in src/mon.c to clean up + * 7. Adjust size_monst() in src/wizcmds.c appropriately. + * 8. Adjust dealloc_mextra() in src/mon.c to clean up * properly during monst deallocation. - * 8. Adjust copy_mextra() in src/mon.c to make duplicate + * 9. Adjust copy_mextra() in src/mon.c to make duplicate * copies of your struct or data on another monst struct. - * 9. Adjust restmon() in src/restore.c to deal with your + * 10. Adjust restmon() in src/restore.c to deal with your * struct or data during a restore. - * 10. Adjust savemon() in src/save.c to deal with your + * 11. Adjust savemon() in src/save.c to deal with your * struct or data during a save. */ @@ -66,16 +69,20 @@ #define GD_DESTROYGOLD 0x02 struct fakecorridor { - xchar fx, fy, ftyp; + coordxy fx, fy; + schar ftyp; /* from struct rm's typ */ + uchar flags; /* also from struct rm; an unsigned 5-bit field there */ }; struct egd { + unsigned parentmid; /* make clobber-detection possible */ int fcbeg, fcend; /* fcend: first unused pos */ int vroom; /* room number of the vault */ - xchar gdx, gdy; /* goal of guard's walk */ - xchar ogx, ogy; /* guard's last position */ + coordxy gdx, gdy; /* goal of guard's walk */ + coordxy ogx, ogy; /* guard's last position */ d_level gdlevel; /* level (& dungeon) guard was created in */ - xchar warncnt; /* number of warnings to follow */ + xint8 warncnt; /* number of warnings to follow */ + xint8 dropgoldcnt; /* number of demands to drop gold */ Bitfield(gddone, 1); /* true iff guard has released player */ Bitfield(witness, 2); /* the guard saw you do something */ Bitfield(unused, 5); @@ -86,10 +93,12 @@ struct egd { ** formerly epri.h -- temple priest extension */ struct epri { + unsigned parentmid; /* make clobber-detection possible */ aligntyp shralign; /* alignment of priest's shrine */ schar shroom; /* index in rooms */ coord shrpos; /* position of shrine */ d_level shrlevel; /* level (& dungeon) of shrine */ + unsigned cheapskate_count; /* number of cheapskate donations */ long intone_time, /* used to limit verbosity +*/ enter_time, /*+ of temple entry messages */ hostile_time, /* forbidding feeling */ @@ -112,12 +121,13 @@ struct bill_x { }; struct eshk { + unsigned parentmid; /* make clobber-detection possible */ long robbed; /* amount stolen by most recent customer */ long credit; /* amount credited to customer */ long debit; /* amount of debt for using unpaid items */ long loan; /* shop-gold picked (part of debit) */ - int shoptype; /* the value of rooms[shoproom].rtype */ - schar shoproom; /* index in rooms; set by inshop() */ + int shoptype; /* the value of svr.rooms[shoproom].rtype */ + schar shoproom; /* index in svr.rooms; set by inshop() */ schar unused; /* to force alignment for stupid compilers */ boolean following; /* following customer since he owes us sth */ boolean surcharge; /* angry shk inflates prices */ @@ -127,7 +137,9 @@ struct eshk { d_level shoplevel; /* level (& dungeon) of his shop */ int billct; /* no. of entries of bill[] in use */ struct bill_x bill[BILLSZ]; - struct bill_x *bill_p; + struct bill_x *bill_p; /* &(ESHK(shkp)->bill[0]) */ + long break_seq; /* hero_seq value at time of object breakage */ + boolean seq_peaceful; /* shkp->mpeaceful at start of break_seq */ int visitct; /* nr of visits by most recent customer */ char customer[PL_NSIZ]; /* most recent customer */ char shknam[PL_NSIZ]; @@ -137,6 +149,7 @@ struct eshk { ** formerly emin.h -- minion extension */ struct emin { + unsigned parentmid; /* make clobber-detection possible */ aligntyp min_align; /* alignment of minion */ boolean renegade; /* hostile co-aligned priest or Angel */ }; @@ -157,6 +170,7 @@ enum dogfood_types { }; struct edog { + unsigned parentmid; /* make clobber-detection possible */ long droptime; /* moment dog dropped object */ unsigned dropdist; /* dist of dropped obj from @ */ int apport; /* amount of training */ @@ -169,35 +183,54 @@ struct edog { Bitfield(killed_by_u, 1); /* you attempted to kill him */ }; +/*** + ** extension tracking a player's remnant monster (ghost, mummy etc.) + */ +struct ebones { + unsigned parentmid; /* make clobber-detection possible */ + uchar role; /* index into roles[] */ + uchar race; /* index into races[] */ + align oldalign; /* character alignment */ + uchar deathlevel; /* level when dying (m_lev may differ) */ + schar luck; /* luck when dying */ + short mnum; /* monster type */ + Bitfield(female, 1); /* was female */ + Bitfield(demigod, 1); /* had killed wiz or invoked */ + Bitfield(crowned, 1); /* had been crowned */ +}; + /*** ** mextra.h -- collection of all monster extensions */ struct mextra { - char *mname; + char *mgivenname; struct egd *egd; struct epri *epri; struct eshk *eshk; struct emin *emin; struct edog *edog; + struct ebones *ebones; int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse, * obj->spe (fruit index) for one posing as a slime mold, * or an alignment mask for one posing as an altar */ }; -#define MNAME(mon) ((mon)->mextra->mname) +#define MGIVENNAME(mon) ((mon)->mextra->mgivenname) #define EGD(mon) ((mon)->mextra->egd) #define EPRI(mon) ((mon)->mextra->epri) #define ESHK(mon) ((mon)->mextra->eshk) #define EMIN(mon) ((mon)->mextra->emin) #define EDOG(mon) ((mon)->mextra->edog) +#define EBONES(mon) ((mon)->mextra->ebones) #define MCORPSENM(mon) ((mon)->mextra->mcorpsenm) -#define has_mname(mon) ((mon)->mextra && MNAME(mon)) +#define has_mgivenname(mon) ((mon)->mextra && MGIVENNAME(mon)) #define has_egd(mon) ((mon)->mextra && EGD(mon)) #define has_epri(mon) ((mon)->mextra && EPRI(mon)) #define has_eshk(mon) ((mon)->mextra && ESHK(mon)) #define has_emin(mon) ((mon)->mextra && EMIN(mon)) #define has_edog(mon) ((mon)->mextra && EDOG(mon)) +#define has_ebones(mon) ((mon)->mextra && EBONES(mon)) #define has_mcorpsenm(mon) ((mon)->mextra && MCORPSENM(mon) != NON_PM) #endif /* MEXTRA_H */ diff --git a/include/mfndpos.h b/include/mfndpos.h index 18259c70c..d4eac8da5 100644 --- a/include/mfndpos.h +++ b/include/mfndpos.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mfndpos.h $NHDT-Date: 1432512776 2015/05/25 00:12:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ +/* NetHack 5.0 mfndpos.h $NHDT-Date: 1596498546 2020/08/03 23:49:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2005. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,26 +6,34 @@ #ifndef MFNDPOS_H #define MFNDPOS_H -#define ALLOW_MDISP 0x00001000L /* can displace a monster out of its way */ -#define ALLOW_TRAPS 0x00020000L /* can enter traps */ -#define ALLOW_U 0x00040000L /* can attack you */ -#define ALLOW_M 0x00080000L /* can attack other monsters */ -#define ALLOW_TM 0x00100000L /* can attack tame monsters */ +/* clang-format off */ +#define ALLOW_MDISP 0x00001000L /* can displace a monster out of its way */ +#define ALLOW_TRAPS 0x00020000L /* can enter traps */ +#define ALLOW_U 0x00040000L /* can attack you */ +#define ALLOW_M 0x00080000L /* can attack other monsters */ +#define ALLOW_TM 0x00100000L /* can attack tame monsters */ #define ALLOW_ALL (ALLOW_U | ALLOW_M | ALLOW_TM | ALLOW_TRAPS) -#define NOTONL 0x00200000L /* avoids direct line to player */ -#define OPENDOOR 0x00400000L /* opens closed doors */ -#define UNLOCKDOOR 0x00800000L /* unlocks locked doors */ -#define BUSTDOOR 0x01000000L /* breaks any doors */ -#define ALLOW_ROCK 0x02000000L /* pushes rocks */ -#define ALLOW_WALL 0x04000000L /* walks thru walls */ -#define ALLOW_DIG 0x08000000L /* digs */ -#define ALLOW_BARS 0x10000000L /* may pass thru iron bars */ -#define ALLOW_SANCT 0x20000000L /* enters temples */ -#define ALLOW_SSM 0x40000000L /* ignores scare monster */ +#define NOTONL 0x00200000L /* avoids direct line to player */ +#define OPENDOOR 0x00400000L /* opens closed doors */ +#define UNLOCKDOOR 0x00800000L /* unlocks locked doors */ +#define BUSTDOOR 0x01000000L /* breaks any doors */ +#define ALLOW_ROCK 0x02000000L /* pushes rocks */ +#define ALLOW_WALL 0x04000000L /* walks through walls */ +#define ALLOW_DIG 0x08000000L /* digs */ +#define ALLOW_BARS 0x10000000L /* may pass through iron bars */ +#define ALLOW_SANCT 0x20000000L /* enters temples */ +#define ALLOW_SSM 0x40000000L /* ignores scare monster */ #ifdef NHSTDC -#define NOGARLIC 0x80000000UL /* hates garlic */ +#define NOGARLIC 0x80000000UL /* hates garlic */ #else -#define NOGARLIC 0x80000000L /* hates garlic */ +#define NOGARLIC 0x80000000L /* hates garlic */ #endif +/* clang-format on */ + +struct mfndposdata { + int cnt; + coord poss[9]; + long info[9]; +}; #endif /* MFNDPOS_H */ diff --git a/include/micro.h b/include/micro.h index ea8249f24..02067b063 100644 --- a/include/micro.h +++ b/include/micro.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 micro.h $NHDT-Date: 1524689515 2018/04/25 20:51:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ */ +/* NetHack 5.0 micro.h $NHDT-Date: 1596498546 2020/08/03 23:49:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.12 $ */ /* Copyright (c) 2015 by Kenneth Lorber */ /* NetHack may be freely redistributed. See license for details. */ @@ -7,11 +7,6 @@ #ifndef MICRO_H #define MICRO_H -extern const char *alllevels, *allbones; -extern char levels[], bones[], permbones[], hackdir[]; - -extern int ramdisk; - #ifndef C #define C(c) (0x1f & (c)) #endif diff --git a/include/mkroom.h b/include/mkroom.h index 3439889a0..9b82807e8 100644 --- a/include/mkroom.h +++ b/include/mkroom.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkroom.h $NHDT-Date: 1560851014 2019/06/18 09:43:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.16 $ */ +/* NetHack 5.0 mkroom.h $NHDT-Date: 1725653011 2024/09/06 20:03:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,22 +9,24 @@ /* mkroom.h - types and structures for room and shop initialization */ struct mkroom { - schar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */ + coordxy lx, hx, ly, hy; /* usually coordxy, but hx may be -1 */ schar rtype; /* type of room (zoo, throne, etc...) */ schar orig_rtype; /* same as rtype, but not zeroed later */ schar rlit; /* is the room lit ? */ schar needfill; /* sp_lev: does the room need filling? */ - schar needjoining; /* sp_lev */ + boolean needjoining; /* sp_lev: should the room connect to others? */ schar doorct; /* door count */ - schar fdoor; /* index for the first door of the room */ + int fdoor; /* index for the first door of the room */ schar nsubrooms; /* number of subrooms */ boolean irregular; /* true if room is non-rectangular */ + schar roomnoidx; struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */ struct monst *resident; /* priest/shopkeeper/guard for this room */ }; struct shclass { const char *name; /* name of the shop type */ + const char *annotation; /* simpler name for #overview; Null if same */ char symb; /* this identifies the shop type */ int prob; /* the shop type probability in % */ schar shdist; /* object placement type */ @@ -34,26 +36,21 @@ struct shclass { struct itp { int iprob; /* probability of an item type */ int itype; /* item type: if >=0 a class, if < 0 a specific item */ - } iprobs[6]; + } iprobs[9]; const char *const *shknms; /* list of shopkeeper names for this type */ }; -extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2]; -extern NEARDATA struct mkroom *subrooms; -/* the normal rooms on the current level are described in rooms[0..n] for +/* the normal rooms on the current level are described in svr.rooms[0..n] for * some n= rooms && (x) < rooms + MAXNROFROOMS) +#define IS_ROOM_PTR(x) \ + ((x) >= svr.rooms && (x) < svr.rooms + MAXNROFROOMS) #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS) -#define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS) -#define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2)) -#define ROOM_INDEX(x) ((x) -rooms) -#define SUBROOM_INDEX(x) ((x) -subrooms) -#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom) -#define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom) +#define IS_SUBROOM_PTR(x) \ + ((x) >= gs.subrooms && (x) < gs.subrooms + MAXNROFROOMS) +#define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) <= (MAXNROFROOMS * 2)) +#define ROOM_INDEX(x) ((x) - svr.rooms) +#define SUBROOM_INDEX(x) ((x) - gs.subrooms) +#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == svn.nroom) +#define IS_LAST_SUBROOM_PTR(x) \ + (!gn.nsubroom || SUBROOM_INDEX(x) == gn.nsubroom) #endif /* MKROOM_H */ diff --git a/include/monattk.h b/include/monattk.h index 995e544a0..3e2d65690 100644 --- a/include/monattk.h +++ b/include/monattk.h @@ -1,12 +1,12 @@ -/* NetHack 3.6 monattk.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */ +/* NetHack 5.0 monattk.h $NHDT-Date: 1596498548 2020/08/03 23:49:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.13 $ */ /* NetHack may be freely redistributed. See license for details. */ /* Copyright 1988, M. Stephenson */ #ifndef MONATTK_H #define MONATTK_H -/* Add new attack types below - ordering affects experience (exper.c). - * Attacks > AT_BUTT are worth extra experience. +/* Add new attack types below - ordering affects experience (exper.c). + * Attacks > AT_BUTT are worth extra experience. */ #define AT_ANY (-1) /* fake attack; dmgtype_fromattack wildcard */ #define AT_NONE 0 /* passive monster (ex. acid blob) */ @@ -28,10 +28,15 @@ #define AT_WEAP 254 /* uses weapon */ #define AT_MAGC 255 /* uses magic spell(s) */ -/* Add new damage types below. +#define DISTANCE_ATTK_TYPE(atyp) ((atyp) == AT_SPIT \ + || (atyp) == AT_BREA \ + || (atyp) == AT_MAGC \ + || (atyp) == AT_GAZE) + +/* Add new damage types below. * - * Note that 1-10 correspond to the types of attack used in buzz(). - * Please don't disturb the order unless you rewrite the buzz() code. + * Note that 1-10 correspond to the types of attack used in buzz(). + * Please don't disturb the order unless you rewrite the buzz() code. */ #define AD_ANY (-1) /* fake damage; attacktype_fordmg wildcard */ #define AD_PHYS 0 /* ordinary physical */ @@ -48,7 +53,7 @@ #define AD_BLND 11 /* blinds (yellow light) */ #define AD_STUN 12 /* stuns */ #define AD_SLOW 13 /* slows */ -#define AD_PLYS 14 /* paralyses */ +#define AD_PLYS 14 /* paralyzes */ #define AD_DRLI 15 /* drains life levels (Vampire) */ #define AD_DREN 16 /* drains magic energy */ #define AD_LEGS 17 /* damages legs (xan) */ @@ -77,6 +82,7 @@ #define AD_SLIM 40 /* turns you into green slime */ #define AD_ENCH 41 /* remove enchantment (disenchanter) */ #define AD_CORR 42 /* corrode armor (black pudding) */ +#define AD_POLY 43 /* polymorph the target (genetic engineer) */ #define AD_CLRC 240 /* random clerical spell */ #define AD_SPEL 241 /* random magic spell */ @@ -85,14 +91,24 @@ #define AD_SAMU 252 /* hits, may steal Amulet (Wizard) */ #define AD_CURS 253 /* random curse (ex. gremlin) */ +struct mhitm_data { + int damage; + int hitflags; /* M_ATTK_DEF_DIED | M_ATTK_AGR_DIED | ... */ + boolean done; + boolean permdmg; + int specialdmg; + int dieroll; +}; + /* - * Monster to monster attacks. When a monster attacks another (mattackm), + * Monster-to-monster attacks. When a monster attacks another (mattackm), * any or all of the following can be returned. See mattackm() for more * details. */ -#define MM_MISS 0x0 /* aggressor missed */ -#define MM_HIT 0x1 /* aggressor hit defender */ -#define MM_DEF_DIED 0x2 /* defender died */ -#define MM_AGR_DIED 0x4 /* aggressor died */ +#define M_ATTK_MISS 0x0 /* aggressor missed */ +#define M_ATTK_HIT 0x1 /* aggressor hit defender */ +#define M_ATTK_DEF_DIED 0x2 /* defender died */ +#define M_ATTK_AGR_DIED 0x4 /* aggressor died */ +#define M_ATTK_AGR_DONE 0x8 /* aggressor is done with their turn */ #endif /* MONATTK_H */ diff --git a/include/mondata.h b/include/mondata.h index 155ebfa5b..05f276fa8 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -1,42 +1,31 @@ -/* NetHack 3.6 mondata.h $NHDT-Date: 1576626512 2019/12/17 23:48:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.39 $ */ -/* Copyright (c) 1989 Mike Threepoint */ +/* NetHack 5.0 mondata.h $NHDT-Date: 1703845738 2023/12/29 10:28:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.63 $ */ +/* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ #ifndef MONDATA_H #define MONDATA_H +/* The macros in here take a permonst * as an argument */ + +#define monsndx(ptr) ((ptr)->pmidx) #define verysmall(ptr) ((ptr)->msize < MZ_SMALL) #define bigmonst(ptr) ((ptr)->msize >= MZ_LARGE) #define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0) -#define resists_fire(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_FIRE) != 0) -#define resists_cold(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_COLD) != 0) -#define resists_sleep(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_SLEEP) != 0) -#define resists_disint(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_DISINT) != 0) -#define resists_elec(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_ELEC) != 0) -#define resists_poison(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_POISON) != 0) -#define resists_acid(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_ACID) != 0) -#define resists_ston(mon) \ - ((((mon)->data->mresists | (mon)->mextrinsics) & MR_STONE) != 0) - -#define is_lminion(mon) \ - (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) +#define immune_poisongas(ptr) ((ptr) == &mons[PM_HEZROU] \ + || (ptr) == &mons[PM_VROCK]) + #define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L) #define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT) /* clinger: piercers, mimics, wumpus -- generally don't fall down holes */ #define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L) +#define grounded(ptr) (!is_flyer(ptr) && !is_floater(ptr) \ + && (!is_clinger(ptr) || !has_ceiling(&u.uz))) #define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L) #define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L) -#define amphibious(ptr) \ - (((ptr)->mflags1 & (M1_AMPHIBIOUS | M1_BREATHLESS)) != 0L) +#define amphibious(ptr) (((ptr)->mflags1 & M1_AMPHIBIOUS) != 0L) +#define cant_drown(ptr) (is_swimmer(ptr) || amphibious(ptr) || breathless(ptr)) #define passes_walls(ptr) (((ptr)->mflags1 & M1_WALLWALK) != 0L) #define amorphous(ptr) (((ptr)->mflags1 & M1_AMORPHOUS) != 0L) #define noncorporeal(ptr) ((ptr)->mlet == S_GHOST) @@ -79,6 +68,10 @@ #define is_wooden(ptr) ((ptr) == &mons[PM_WOOD_GOLEM]) #define thick_skinned(ptr) (((ptr)->mflags1 & M1_THICK_HIDE) != 0L) #define hug_throttles(ptr) ((ptr) == &mons[PM_ROPE_GOLEM]) +#define digests(ptr) \ + (dmgtype_fromattack((ptr), AD_DGST, AT_ENGL) != 0) /* purple w*/ +#define enfolds(ptr) \ + (dmgtype_fromattack((ptr), AD_WRAP, AT_ENGL) != 0) /* 't' */ #define slimeproof(ptr) \ ((ptr) == &mons[PM_GREEN_SLIME] || flaming(ptr) || noncorporeal(ptr)) #define lays_eggs(ptr) (((ptr)->mflags1 & M1_OVIPAROUS) != 0L) @@ -106,7 +99,7 @@ #define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L) #define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L) #define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L) -#define your_race(ptr) (((ptr)->mflags2 & urace.selfmask) != 0L) +#define your_race(ptr) (((ptr)->mflags2 & gu.urace.selfmask) != 0L) #define is_bat(ptr) \ ((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \ || (ptr) == &mons[PM_VAMPIRE_BAT]) @@ -122,13 +115,21 @@ #define is_wanderer(ptr) (((ptr)->mflags2 & M2_WANDER) != 0L) #define always_hostile(ptr) (((ptr)->mflags2 & M2_HOSTILE) != 0L) #define always_peaceful(ptr) (((ptr)->mflags2 & M2_PEACEFUL) != 0L) -#define race_hostile(ptr) (((ptr)->mflags2 & urace.hatemask) != 0L) -#define race_peaceful(ptr) (((ptr)->mflags2 & urace.lovemask) != 0L) +#define race_hostile(ptr) (((ptr)->mflags2 & gu.urace.hatemask) != 0L) +#define race_peaceful(ptr) (((ptr)->mflags2 & gu.urace.lovemask) != 0L) #define extra_nasty(ptr) (((ptr)->mflags2 & M2_NASTY) != 0L) #define strongmonst(ptr) (((ptr)->mflags2 & M2_STRONG) != 0L) #define can_breathe(ptr) attacktype(ptr, AT_BREA) #define cantwield(ptr) (nohands(ptr) || verysmall(ptr)) -#define could_twoweap(ptr) ((ptr)->mattk[1].aatyp == AT_WEAP) +/* Does this type of monster have multiple weapon attacks? If so, + hero poly'd into this form can use two-weapon combat. It used + to just check mattk[1] and assume mattk[0], which was suitable + for mons[] at the time but somewhat fragile. This is more robust + without going to the extreme of checking all six slots. */ +#define could_twoweap(ptr) \ + (( ((ptr)->mattk[0].aatyp == AT_WEAP) \ + + ((ptr)->mattk[1].aatyp == AT_WEAP) \ + + ((ptr)->mattk[2].aatyp == AT_WEAP) ) > 1) #define cantweararm(ptr) (breakarm(ptr) || sliparm(ptr)) #define throws_rocks(ptr) (((ptr)->mflags2 & M2_ROCKTHROW) != 0L) #define type_is_pname(ptr) (((ptr)->mflags2 & M2_PNAME) != 0L) @@ -160,6 +161,8 @@ #define is_rider(ptr) \ ((ptr) == &mons[PM_DEATH] || (ptr) == &mons[PM_FAMINE] \ || (ptr) == &mons[PM_PESTILENCE]) +/* note: placeholder monsters are used for corpses of zombies and mummies; + PM_DWARF and PM_GNOME are normal monsters, not placeholders */ #define is_placeholder(ptr) \ ((ptr) == &mons[PM_ORC] || (ptr) == &mons[PM_GIANT] \ || (ptr) == &mons[PM_ELF] || (ptr) == &mons[PM_HUMAN]) @@ -170,15 +173,20 @@ as unique even though they really aren't; that's ok here */ #define unique_corpstat(ptr) (((ptr)->geno & G_UNIQ) != 0) -/* this returns the light's range, or 0 if none; if we add more light emitting +/* this returns the light's range, or 0 if none; if we add more light-emitting monsters, we'll likely have to add a new light range field to mons[] */ #define emits_light(ptr) \ (((ptr)->mlet == S_LIGHT || (ptr) == &mons[PM_FLAMING_SPHERE] \ || (ptr) == &mons[PM_SHOCKING_SPHERE] \ + || (ptr) == &mons[PM_BABY_GOLD_DRAGON] \ || (ptr) == &mons[PM_FIRE_VORTEX]) \ ? 1 \ - : ((ptr) == &mons[PM_FIRE_ELEMENTAL]) ? 1 : 0) -/* [note: the light ranges above were reduced to 1 for performance...] */ + : ((ptr) == &mons[PM_FIRE_ELEMENTAL] \ + || (ptr) == &mons[PM_GOLD_DRAGON]) ? 1 : 0) + /* [Note: the light ranges above were reduced to 1 for performance, + * otherwise screen updating on the plane of fire slowed to a crawl. + * Note too: that was with 1990s hardware and before fumarole smoke + * blocking line of sight was added, so might no longer be necessary.] */ #define likes_lava(ptr) \ (ptr == &mons[PM_FIRE_ELEMENTAL] || ptr == &mons[PM_SALAMANDER]) #define pm_invisible(ptr) \ @@ -191,6 +199,13 @@ #define touch_petrifies(ptr) \ ((ptr) == &mons[PM_COCKATRICE] || (ptr) == &mons[PM_CHICKATRICE]) +/* Medusa doesn't pass touch_petrifies() but does petrify if eaten */ +#define flesh_petrifies(pm) (touch_petrifies(pm) || (pm) == &mons[PM_MEDUSA]) + +/* missiles made of rocks don't harm these: xorns and earth elementals + (but not ghosts and shades because that would impact all missile use + and also require an exception for blessed rocks/gems/boulders) */ +#define passes_rocks(ptr) (passes_walls(ptr) && !unsolid(ptr)) #define is_mind_flayer(ptr) \ ((ptr) == &mons[PM_MIND_FLAYER] || (ptr) == &mons[PM_MASTER_MIND_FLAYER]) @@ -204,9 +219,12 @@ #define nonliving(ptr) \ (is_undead(ptr) || (ptr) == &mons[PM_MANES] || weirdnonliving(ptr)) -/* no corpse (ie, blank scrolls) if killed by fire */ +/* no corpse (ie, blank scrolls) if killed by fire; special case instakill */ #define completelyburns(ptr) \ ((ptr) == &mons[PM_PAPER_GOLEM] || (ptr) == &mons[PM_STRAW_GOLEM]) +#define completelyrots(ptr) \ + ((ptr) == &mons[PM_WOOD_GOLEM] || (ptr) == &mons[PM_LEATHER_GOLEM]) +#define completelyrusts(ptr) ((ptr) == &mons[PM_IRON_GOLEM]) /* Used for conduct with corpses, tins, and digestion attacks */ /* G_NOCORPSE monsters might still be swallowed as a purple worm */ @@ -222,7 +240,13 @@ (vegan(ptr) \ || ((ptr)->mlet == S_PUDDING && (ptr) != &mons[PM_BLACK_PUDDING])) -/* monkeys are tameable via bananas but not pacifiable via food, +#define corpse_eater(ptr) \ + (ptr == &mons[PM_PURPLE_WORM] \ + || ptr == &mons[PM_BABY_PURPLE_WORM] \ + || ptr == &mons[PM_GHOUL] \ + || ptr == &mons[PM_PIRANHA]) + +/* monkeys are tamable via bananas but not pacifiable via food, otherwise their theft attack could be nullified too easily; dogs and cats can be tamed by anything they like to eat and are pacified by any other food; @@ -236,4 +260,10 @@ || objects[(obj)->otyp].oc_material == VEGGY \ || ((obj)->otyp == CORPSE && (obj)->corpsenm == PM_LICHEN)))) +#ifdef PMNAME_MACROS +#define pmname(ptr,g) ((((g) == MALE || (g) == FEMALE) && (ptr)->pmnames[g]) \ + ? (ptr)->pmnames[g] : (ptr)->pmnames[NEUTRAL]) +#endif +#define monsym(ptr) (def_monsyms[(int) (ptr)->mlet].sym) + #endif /* MONDATA_H */ diff --git a/include/monflag.h b/include/monflag.h index f430ced30..602588b54 100644 --- a/include/monflag.h +++ b/include/monflag.h @@ -1,200 +1,219 @@ -/* NetHack 3.6 monflag.h $NHDT-Date: 1432512778 2015/05/25 00:12:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.14 $ */ -/* Copyright (c) 1989 Mike Threepoint */ +/* NetHack 5.0 monflag.h $NHDT-Date: 1596498549 2020/08/03 23:49:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.21 $ */ +/* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ #ifndef MONFLAG_H #define MONFLAG_H +/* clang-format off */ +/* *INDENT-OFF* */ -#define MS_SILENT 0 /* makes no sound */ -#define MS_BARK 1 /* if full moon, may howl */ -#define MS_MEW 2 /* mews or hisses */ -#define MS_ROAR 3 /* roars */ -#define MS_GROWL 4 /* growls */ -#define MS_SQEEK 5 /* squeaks, as a rodent */ -#define MS_SQAWK 6 /* squawks, as a bird */ -#define MS_HISS 7 /* hisses */ -#define MS_BUZZ 8 /* buzzes (killer bee) */ -#define MS_GRUNT 9 /* grunts (or speaks own language) */ -#define MS_NEIGH 10 /* neighs, as an equine */ -#define MS_WAIL 11 /* wails, as a tortured soul */ -#define MS_GURGLE 12 /* gurgles, as liquid or through saliva */ -#define MS_BURBLE 13 /* burbles (jabberwock) */ -#define MS_ANIMAL 13 /* up to here are animal noises */ -#define MS_SHRIEK 15 /* wakes up others */ -#define MS_BONES 16 /* rattles bones (skeleton) */ -#define MS_LAUGH 17 /* grins, smiles, giggles, and laughs */ -#define MS_MUMBLE 18 /* says something or other */ -#define MS_IMITATE 19 /* imitates others (leocrotta) */ -#define MS_ORC MS_GRUNT /* intelligent brutes */ -#define MS_HUMANOID 20 /* generic traveling companion */ -#define MS_ARREST 21 /* "Stop in the name of the law!" (Kops) */ -#define MS_SOLDIER 22 /* army and watchmen expressions */ -#define MS_GUARD 23 /* "Please drop that gold and follow me." */ -#define MS_DJINNI 24 /* "Thank you for freeing me!" */ -#define MS_NURSE 25 /* "Take off your shirt, please." */ -#define MS_SEDUCE 26 /* "Hello, sailor." (Nymphs) */ -#define MS_VAMPIRE 27 /* vampiric seduction, Vlad's exclamations */ -#define MS_BRIBE 28 /* asks for money, or berates you */ -#define MS_CUSS 29 /* berates (demons) or intimidates (Wiz) */ -#define MS_RIDER 30 /* astral level special monsters */ -#define MS_LEADER 31 /* your class leader */ -#define MS_NEMESIS 32 /* your nemesis */ -#define MS_GUARDIAN 33 /* your leader's guards */ -#define MS_SELL 34 /* demand payment, complain about shoplifters */ -#define MS_ORACLE 35 /* do a consultation */ -#define MS_PRIEST 36 /* ask for contribution; do cleansing */ -#define MS_SPELL 37 /* spellcaster not matching any of the above */ -#define MS_WERE 38 /* lycanthrope in human form */ -#define MS_BOAST 39 /* giants */ - -#define MR_FIRE 0x01 /* resists fire */ -#define MR_COLD 0x02 /* resists cold */ -#define MR_SLEEP 0x04 /* resists sleep */ -#define MR_DISINT 0x08 /* resists disintegration */ -#define MR_ELEC 0x10 /* resists electricity */ -#define MR_POISON 0x20 /* resists poison */ -#define MR_ACID 0x40 /* resists acid */ -#define MR_STONE 0x80 /* resists petrification */ +enum ms_sounds { + MS_SILENT = 0, /* makes no sound */ + MS_BARK = 1, /* if full moon, may howl */ + MS_MEW = 2, /* mews or hisses */ + MS_ROAR = 3, /* roars */ + MS_BELLOW = 4, /* adult male crocodiles; hatchlings 'chirp' */ + MS_GROWL = 5, /* growls */ + MS_SQEEK = 6, /* squeaks, as a rodent */ + MS_SQAWK = 7, /* squawks, as a bird */ + MS_CHIRP = 8, /* baby crocodile */ + MS_HISS = 9, /* hisses */ + MS_BUZZ = 10, /* buzzes (killer bee) */ + MS_GRUNT = 11, /* grunts (or speaks own language) */ + MS_NEIGH = 12, /* neighs, as an equine */ + MS_MOO = 13, /* minotaurs, rothes */ + MS_WAIL = 14, /* wails, as a tortured soul */ + MS_GURGLE = 15, /* gurgles, as liquid or through saliva */ + MS_BURBLE = 16, /* burbles (jabberwock) */ + MS_TRUMPET = 17, /* trumpets (elephant) */ + MS_ANIMAL = 17, /* up to here are animal noises */ + /* FIXME? the grunt "speaks own language" case above + shouldn't be classified as animal */ + MS_SHRIEK = 18, /* wakes up others */ + MS_BONES = 19, /* rattles bones (skeleton) */ + MS_LAUGH = 20, /* grins, smiles, giggles, and laughs */ + MS_MUMBLE = 21, /* says something or other */ + MS_IMITATE = 22, /* imitates others (leocrotta) */ + MS_WERE = 23, /* lycanthrope in human form */ + MS_ORC = 24, /* intelligent brutes */ + /* from here onward, speech can be comprehended */ + MS_HUMANOID = 25, /* generic traveling companion */ + MS_ARREST = 26, /* "Stop in the name of the law!" (Kops) */ + MS_SOLDIER = 27, /* army and watchmen expressions */ + MS_GUARD = 28, /* "Please drop that gold and follow me." */ + MS_DJINNI = 29, /* "Thank you for freeing me!" */ + MS_NURSE = 30, /* "Take off your shirt, please." */ + MS_SEDUCE = 31, /* "Hello, sailor." (Nymphs) */ + MS_VAMPIRE = 32, /* vampiric seduction, Vlad's exclamations */ + MS_BRIBE = 33, /* asks for money, or berates you */ + MS_CUSS = 34, /* berates (demons) or intimidates (Wiz) */ + MS_RIDER = 35, /* astral level special monsters */ + MS_LEADER = 36, /* your class leader */ + MS_NEMESIS = 37, /* your nemesis */ + MS_GUARDIAN = 38, /* your leader's guards */ + MS_SELL = 39, /* demand payment, complain about shoplifters */ + MS_ORACLE = 40, /* do a consultation */ + MS_PRIEST = 41, /* ask for contribution; do cleansing */ + MS_SPELL = 42, /* spellcaster not matching any of the above */ + MS_BOAST = 43, /* giants */ + MS_GROAN = 44, /* zombies groan */ +}; + +#define MR_FIRE 0x01 /* resists fire */ +#define MR_COLD 0x02 /* resists cold */ +#define MR_SLEEP 0x04 /* resists sleep */ +#define MR_DISINT 0x08 /* resists disintegration */ +#define MR_ELEC 0x10 /* resists electricity */ +#define MR_POISON 0x20 /* resists poison */ +#define MR_ACID 0x40 /* resists acid */ +#define MR_STONE 0x80 /* resists petrification */ +/* NB: the above resistances correspond to the first 8 hero properties in + prop_types (FIRE_RES through STONE_RES), which can be converted to their + MR_foo equivalents with the macro res_to_mr() defined in prop.h */ /* other resistances: magic, sickness */ /* other conveyances: teleport, teleport control, telepathy */ /* individual resistances */ -#define MR2_SEE_INVIS 0x0100 /* see invisible */ -#define MR2_LEVITATE 0x0200 /* levitation */ -#define MR2_WATERWALK 0x0400 /* water walking */ -#define MR2_MAGBREATH 0x0800 /* magical breathing */ -#define MR2_DISPLACED 0x1000 /* displaced */ -#define MR2_STRENGTH 0x2000 /* gauntlets of power */ -#define MR2_FUMBLING 0x4000 /* clumsy */ - -#define M1_FLY 0x00000001L /* can fly or float */ -#define M1_SWIM 0x00000002L /* can traverse water */ -#define M1_AMORPHOUS 0x00000004L /* can flow under doors */ -#define M1_WALLWALK 0x00000008L /* can phase thru rock */ -#define M1_CLING 0x00000010L /* can cling to ceiling */ -#define M1_TUNNEL 0x00000020L /* can tunnel thru rock */ -#define M1_NEEDPICK 0x00000040L /* needs pick to tunnel */ -#define M1_CONCEAL 0x00000080L /* hides under objects */ -#define M1_HIDE 0x00000100L /* mimics, blends in with ceiling */ -#define M1_AMPHIBIOUS 0x00000200L /* can survive underwater */ -#define M1_BREATHLESS 0x00000400L /* doesn't need to breathe */ -#define M1_NOTAKE 0x00000800L /* cannot pick up objects */ -#define M1_NOEYES 0x00001000L /* no eyes to gaze into or blind */ -#define M1_NOHANDS 0x00002000L /* no hands to handle things */ -#define M1_NOLIMBS 0x00006000L /* no arms/legs to kick/wear on */ -#define M1_NOHEAD 0x00008000L /* no head to behead */ -#define M1_MINDLESS 0x00010000L /* has no mind--golem, zombie, mold */ -#define M1_HUMANOID 0x00020000L /* has humanoid head/arms/torso */ -#define M1_ANIMAL 0x00040000L /* has animal body */ -#define M1_SLITHY 0x00080000L /* has serpent body */ -#define M1_UNSOLID 0x00100000L /* has no solid or liquid body */ -#define M1_THICK_HIDE 0x00200000L /* has thick hide or scales */ -#define M1_OVIPAROUS 0x00400000L /* can lay eggs */ -#define M1_REGEN 0x00800000L /* regenerates hit points */ -#define M1_SEE_INVIS 0x01000000L /* can see invisible creatures */ -#define M1_TPORT 0x02000000L /* can teleport */ -#define M1_TPORT_CNTRL 0x04000000L /* controls where it teleports to */ -#define M1_ACID 0x08000000L /* acidic to eat */ -#define M1_POIS 0x10000000L /* poisonous to eat */ -#define M1_CARNIVORE 0x20000000L /* eats corpses */ -#define M1_HERBIVORE 0x40000000L /* eats fruits */ -#define M1_OMNIVORE 0x60000000L /* eats both */ +#define MR2_SEE_INVIS 0x0100 /* see invisible */ +#define MR2_LEVITATE 0x0200 /* levitation */ +#define MR2_WATERWALK 0x0400 /* water walking */ +#define MR2_MAGBREATH 0x0800 /* magical breathing */ +#define MR2_DISPLACED 0x1000 /* displaced */ +#define MR2_STRENGTH 0x2000 /* gauntlets of power */ +#define MR2_FUMBLING 0x4000 /* clumsy */ + +#define M1_FLY 0x00000001L /* can fly or float */ +#define M1_SWIM 0x00000002L /* can traverse water */ +#define M1_AMORPHOUS 0x00000004L /* can flow under doors */ +#define M1_WALLWALK 0x00000008L /* can phase through rock */ +#define M1_CLING 0x00000010L /* can cling to ceiling */ +#define M1_TUNNEL 0x00000020L /* can tunnel through rock */ +#define M1_NEEDPICK 0x00000040L /* needs pick to tunnel */ +#define M1_CONCEAL 0x00000080L /* hides under objects */ +#define M1_HIDE 0x00000100L /* mimics, blends in with ceiling */ +#define M1_AMPHIBIOUS 0x00000200L /* can survive underwater */ +#define M1_BREATHLESS 0x00000400L /* doesn't need to breathe */ +#define M1_NOTAKE 0x00000800L /* cannot pick up objects */ +#define M1_NOEYES 0x00001000L /* no eyes to gaze into or blind */ +#define M1_NOHANDS 0x00002000L /* no hands to handle things */ +#define M1_NOLIMBS 0x00006000L /* no arms/legs to kick/wear on */ +#define M1_NOHEAD 0x00008000L /* no head to behead */ +#define M1_MINDLESS 0x00010000L /* has no mind--golem, zombie, mold */ +#define M1_HUMANOID 0x00020000L /* has humanoid head/arms/torso */ +#define M1_ANIMAL 0x00040000L /* has animal body */ +#define M1_SLITHY 0x00080000L /* has serpent body */ +#define M1_UNSOLID 0x00100000L /* has no solid or liquid body */ +#define M1_THICK_HIDE 0x00200000L /* has thick hide or scales */ +#define M1_OVIPAROUS 0x00400000L /* can lay eggs */ +#define M1_REGEN 0x00800000L /* regenerates hit points */ +#define M1_SEE_INVIS 0x01000000L /* can see invisible creatures */ +#define M1_TPORT 0x02000000L /* can teleport */ +#define M1_TPORT_CNTRL 0x04000000L /* controls where it teleports to */ +#define M1_ACID 0x08000000L /* acidic to eat */ +#define M1_POIS 0x10000000L /* poisonous to eat */ +#define M1_CARNIVORE 0x20000000L /* eats corpses */ +#define M1_HERBIVORE 0x40000000L /* eats fruits */ +#define M1_OMNIVORE 0x60000000L /* eats both */ #ifdef NHSTDC -#define M1_METALLIVORE 0x80000000UL /* eats metal */ +#define M1_METALLIVORE 0x80000000UL /* eats metal */ #else -#define M1_METALLIVORE 0x80000000L /* eats metal */ +#define M1_METALLIVORE 0x80000000L /* eats metal */ #endif -#define M2_NOPOLY 0x00000001L /* players mayn't poly into one */ -#define M2_UNDEAD 0x00000002L /* is walking dead */ -#define M2_WERE 0x00000004L /* is a lycanthrope */ -#define M2_HUMAN 0x00000008L /* is a human */ -#define M2_ELF 0x00000010L /* is an elf */ -#define M2_DWARF 0x00000020L /* is a dwarf */ -#define M2_GNOME 0x00000040L /* is a gnome */ -#define M2_ORC 0x00000080L /* is an orc */ -#define M2_DEMON 0x00000100L /* is a demon */ -#define M2_MERC 0x00000200L /* is a guard or soldier */ -#define M2_LORD 0x00000400L /* is a lord to its kind */ -#define M2_PRINCE 0x00000800L /* is an overlord to its kind */ -#define M2_MINION 0x00001000L /* is a minion of a deity */ -#define M2_GIANT 0x00002000L /* is a giant */ +#define M2_NOPOLY 0x00000001L /* players mayn't poly into one */ +#define M2_UNDEAD 0x00000002L /* is walking dead */ +#define M2_WERE 0x00000004L /* is a lycanthrope */ +#define M2_HUMAN 0x00000008L /* is a human */ +#define M2_ELF 0x00000010L /* is an elf */ +#define M2_DWARF 0x00000020L /* is a dwarf */ +#define M2_GNOME 0x00000040L /* is a gnome */ +#define M2_ORC 0x00000080L /* is an orc */ +#define M2_DEMON 0x00000100L /* is a demon */ +#define M2_MERC 0x00000200L /* is a guard or soldier */ +#define M2_LORD 0x00000400L /* is a lord to its kind */ +#define M2_PRINCE 0x00000800L /* is an overlord to its kind */ +#define M2_MINION 0x00001000L /* is a minion of a deity */ +#define M2_GIANT 0x00002000L /* is a giant */ #define M2_SHAPESHIFTER 0x00004000L /* is a shapeshifting species */ -#define M2_MALE 0x00010000L /* always male */ -#define M2_FEMALE 0x00020000L /* always female */ -#define M2_NEUTER 0x00040000L /* neither male nor female */ -#define M2_PNAME 0x00080000L /* monster name is a proper name */ -#define M2_HOSTILE 0x00100000L /* always starts hostile */ -#define M2_PEACEFUL 0x00200000L /* always starts peaceful */ -#define M2_DOMESTIC 0x00400000L /* can be tamed by feeding */ -#define M2_WANDER 0x00800000L /* wanders randomly */ -#define M2_STALK 0x01000000L /* follows you to other levels */ -#define M2_NASTY 0x02000000L /* extra-nasty monster (more xp) */ -#define M2_STRONG 0x04000000L /* strong (or big) monster */ -#define M2_ROCKTHROW 0x08000000L /* throws boulders */ -#define M2_GREEDY 0x10000000L /* likes gold */ -#define M2_JEWELS 0x20000000L /* likes gems */ -#define M2_COLLECT 0x40000000L /* picks up weapons and food */ +#define M2_MALE 0x00010000L /* always male */ +#define M2_FEMALE 0x00020000L /* always female */ +#define M2_NEUTER 0x00040000L /* neither male nor female */ +#define M2_PNAME 0x00080000L /* monster name is a proper name */ +#define M2_HOSTILE 0x00100000L /* always starts hostile */ +#define M2_PEACEFUL 0x00200000L /* always starts peaceful */ +#define M2_DOMESTIC 0x00400000L /* can be tamed by feeding */ +#define M2_WANDER 0x00800000L /* wanders randomly */ +#define M2_STALK 0x01000000L /* follows you to other levels */ +#define M2_NASTY 0x02000000L /* extra-nasty monster (more xp) */ +#define M2_STRONG 0x04000000L /* strong (or big) monster */ +#define M2_ROCKTHROW 0x08000000L /* throws boulders */ +#define M2_GREEDY 0x10000000L /* likes gold */ +#define M2_JEWELS 0x20000000L /* likes gems */ +#define M2_COLLECT 0x40000000L /* picks up weapons and food */ #ifdef NHSTDC -#define M2_MAGIC 0x80000000UL /* picks up magic items */ +#define M2_MAGIC 0x80000000UL /* picks up magic items */ #else -#define M2_MAGIC 0x80000000L /* picks up magic items */ +#define M2_MAGIC 0x80000000L /* picks up magic items */ #endif -#define M3_WANTSAMUL 0x0001 /* would like to steal the amulet */ -#define M3_WANTSBELL 0x0002 /* wants the bell */ -#define M3_WANTSBOOK 0x0004 /* wants the book */ -#define M3_WANTSCAND 0x0008 /* wants the candelabrum */ -#define M3_WANTSARTI 0x0010 /* wants the quest artifact */ -#define M3_WANTSALL 0x001f /* wants any major artifact */ -#define M3_WAITFORU 0x0040 /* waits to see you or get attacked */ -#define M3_CLOSE 0x0080 /* lets you close unless attacked */ +#define M3_WANTSAMUL 0x0001 /* would like to steal the amulet */ +#define M3_WANTSBELL 0x0002 /* wants the bell */ +#define M3_WANTSBOOK 0x0004 /* wants the book */ +#define M3_WANTSCAND 0x0008 /* wants the candelabrum */ +#define M3_WANTSARTI 0x0010 /* wants the quest artifact */ +#define M3_WANTSALL 0x001f /* wants any major artifact */ +#define M3_WAITFORU 0x0040 /* waits to see you or get attacked */ +#define M3_CLOSE 0x0080 /* lets you close unless attacked */ -#define M3_COVETOUS 0x001f /* wants something */ -#define M3_WAITMASK 0x00c0 /* waiting... */ +#define M3_COVETOUS 0x001f /* wants something */ +#define M3_WAITMASK 0x00c0 /* waiting... */ /* Infravision is currently implemented for players only */ -#define M3_INFRAVISION 0x0100 /* has infravision */ +#define M3_INFRAVISION 0x0100 /* has infravision */ #define M3_INFRAVISIBLE 0x0200 /* visible by infravision */ -#define M3_DISPLACES 0x0400 /* moves monsters out of its way */ +#define M3_DISPLACES 0x0400 /* moves monsters out of its way */ -#define MZ_TINY 0 /* < 2' */ -#define MZ_SMALL 1 /* 2-4' */ -#define MZ_MEDIUM 2 /* 4-7' */ -#define MZ_HUMAN MZ_MEDIUM /* human-sized */ -#define MZ_LARGE 3 /* 7-12' */ -#define MZ_HUGE 4 /* 12-25' */ -#define MZ_GIGANTIC 7 /* off the scale */ +#define MZ_TINY 0 /* < 2' */ +#define MZ_SMALL 1 /* 2-4' */ +#define MZ_MEDIUM 2 /* 4-7' */ +#define MZ_HUMAN MZ_MEDIUM /* human-sized */ +#define MZ_LARGE 3 /* 7-12' */ +#define MZ_HUGE 4 /* 12-25' */ +#define MZ_GIGANTIC 7 /* off the scale */ /* Monster races -- must stay within ROLE_RACEMASK */ /* Eventually this may become its own field */ -#define MH_HUMAN M2_HUMAN -#define MH_ELF M2_ELF -#define MH_DWARF M2_DWARF -#define MH_GNOME M2_GNOME -#define MH_ORC M2_ORC +#define MH_HUMAN M2_HUMAN +#define MH_ELF M2_ELF +#define MH_DWARF M2_DWARF +#define MH_GNOME M2_GNOME +#define MH_ORC M2_ORC /* for mons[].geno (constant during game) */ -#define G_UNIQ 0x1000 /* generated only once */ -#define G_NOHELL 0x0800 /* not generated in "hell" */ -#define G_HELL 0x0400 /* generated only in "hell" */ -#define G_NOGEN 0x0200 /* generated only specially */ -#define G_SGROUP 0x0080 /* appear in small groups normally */ -#define G_LGROUP 0x0040 /* appear in large groups normally */ -#define G_GENO 0x0020 /* can be genocided */ -#define G_NOCORPSE 0x0010 /* no corpse left ever */ -#define G_FREQ 0x0007 /* creation frequency mask */ - -/* for mvitals[].mvflags (variant during game), along with G_NOCORPSE */ -#define G_KNOWN 0x0004 /* have been encountered */ -#define G_GONE (G_GENOD | G_EXTINCT) -#define G_GENOD 0x0002 /* have been genocided */ -#define G_EXTINCT \ - 0x0001 /* have been extinguished as \ - population control */ -#define MV_KNOWS_EGG \ - 0x0008 /* player recognizes egg of this \ - monster type */ +#define G_UNIQ 0x1000 /* generated only once */ +#define G_NOHELL 0x0800 /* not generated in "hell" */ +#define G_HELL 0x0400 /* generated only in "hell" */ +#define G_NOGEN 0x0200 /* generated only specially */ +#define G_SGROUP 0x0080 /* appear in small groups normally */ +#define G_LGROUP 0x0040 /* appear in large groups normally */ +#define G_GENO 0x0020 /* can be genocided */ +#define G_NOCORPSE 0x0010 /* no corpse left ever */ +#define G_FREQ 0x0007 /* creation frequency mask */ +/* note: G_IGNORE controls handling of mvitals[].mvflags bits but is + passed to mkclass() as if it dealt with mons[].geno bits */ +#define G_IGNORE 0x8000 /* for mkclass(), ignore G_GENOD|G_EXTINCT */ + +/* for svm.mvitals[].mvflags (variant during game), along with G_NOCORPSE */ +#define G_KNOWN 0x04 /* have been encountered */ +#define G_GENOD 0x02 /* have been genocided */ +#define G_EXTINCT 0x01 /* population control; create no more */ +#define G_GONE (G_GENOD | G_EXTINCT) +#define MV_KNOWS_EGG 0x08 /* player recognizes egg of this monster type */ + +enum mgender { MALE, FEMALE, NEUTRAL, + NUM_MGENDERS }; +/* *INDENT-ON* */ +/* clang-format on */ #endif /* MONFLAG_H */ diff --git a/include/monst.h b/include/monst.h index 3a2c40ccc..a94bf2bc7 100644 --- a/include/monst.h +++ b/include/monst.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 monst.h $NHDT-Date: 1561053561 2019/06/20 17:59:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.33 $ */ +/* NetHack 5.0 monst.h $NHDT-Date: 1738640524 2025/02/03 19:42:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,6 +6,11 @@ #ifndef MONST_H #define MONST_H +/* start with incomplete types in case these aren't defined yet; + basic pointers to them don't need to know their details */ +struct monst; +struct obj; + #ifndef MEXTRA_H #include "mextra.h" #endif @@ -36,7 +41,7 @@ enum wpn_chk_flags { * PICK_NONE, PICK_ONE, PICK_ANY (wintype.h) 0, 1, 2 * MINV_NOLET If set, don't display inventory letters on monster's inventory. * MINV_ALL If set, display all items in monster's inventory, otherwise - * just display wielded weapons and worn items. + * just display wielded weapons and worn items. */ #define MINV_PICKMASK 0x03 /* 1|2 */ #define MINV_NOLET 0x04 @@ -59,15 +64,35 @@ enum m_ap_types { #define MON_ENDGAME_FREE 0x20 #define MON_ENDGAME_MIGR 0x40 #define MON_OBLITERATE 0x80 -#define MSTATE_MASK 0xFF +#define MON_STILL_ARRIVING 0x100 #define M_AP_TYPMASK 0x7 #define M_AP_F_DKNOWN 0x8 -#define U_AP_TYPE (youmonst.m_ap_type & M_AP_TYPMASK) -#define U_AP_FLAG (youmonst.m_ap_type & ~M_AP_TYPMASK) +#define U_AP_TYPE (gy.youmonst.m_ap_type & M_AP_TYPMASK) +#define U_AP_FLAG (gy.youmonst.m_ap_type & ~M_AP_TYPMASK) #define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK) #define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK) +enum m_seen_resistance { + M_SEEN_NOTHING = 0x0000, + M_SEEN_MAGR = 0x0001, /* Antimagic, AD_MAGM */ + M_SEEN_FIRE = 0x0002, /* Fire_resistance, AD_FIRE */ + M_SEEN_COLD = 0x0004, /* Cold_resistance, AD_COLD */ + M_SEEN_SLEEP = 0x0008, /* Sleep_resistance, AD_SLEE */ + M_SEEN_DISINT = 0x0010, /* Disint_resistance, AD_DISN */ + M_SEEN_ELEC = 0x0020, /* Shock_resistance, AD_ELEC */ + M_SEEN_POISON = 0x0040, /* AD_DRST */ + M_SEEN_ACID = 0x0080, /* Acid_resistance, AD_ACID */ + M_SEEN_REFL = 0x0100, /* reflection, no corresponding AD_foo */ +}; + +#define m_seenres(mon, mask) ((mon)->seen_resistance & (mask)) +#define m_setseenres(mon, mask) ((mon)->seen_resistance |= (mask)) +#define m_clearseenres(mon, mask) ((mon)->seen_resistance &= ~(mask)) +#define monstseesu_ad(adtyp) monstseesu(cvt_adtyp_to_mseenres(adtyp)) +#define monstunseesu_ad(adtyp) monstunseesu(cvt_adtyp_to_mseenres(adtyp)) +#define monstunseesu_prop(prop) monstunseesu(cvt_prop_to_mseenres(prop)) + struct monst { struct monst *nmon; struct permonst *data; @@ -75,21 +100,24 @@ struct monst { short mnum; /* permanent monster index number */ short cham; /* if shapeshifter, orig mons[] idx goes here */ short movement; /* movement points (derived from permonst definition - and added effects */ + * and added effects */ uchar m_lev; /* adjusted difficulty level of monster */ aligntyp malign; /* alignment of this monster, relative to the - player (positive = good to kill) */ - xchar mx, my; - xchar mux, muy; /* where the monster thinks you are */ + * player (positive = good to kill) */ + coordxy mx, my; + coordxy mux, muy; /* where the monster thinks you are */ #define MTSZ 4 + /* mtrack[0..2] is used to keep extra data when migrating the monster */ coord mtrack[MTSZ]; /* monster track */ int mhp, mhpmax; unsigned mappearance; /* for undetected mimics and the wiz */ uchar m_ap_type; /* what mappearance is describing, m_ap_types */ - schar mtame; /* level of tameness, implies peaceful */ + schar mtame; /* level of tameness, implies peaceful */ + unsigned short mintrinsics; /* low 8 correspond to mresists */ unsigned short mextrinsics; /* low 8 correspond to mresists */ - int mspec_used; /* monster's special ability attack timeout */ + unsigned long seen_resistance; /* M_SEEN_x; saw you resist an effect */ + int mspec_used; /* monster's special ability attack timeout */ Bitfield(female, 1); /* is female */ Bitfield(minvis, 1); /* currently invisible */ @@ -97,9 +125,6 @@ struct monst { Bitfield(perminvis, 1); /* intrinsic minvis value */ Bitfield(mcan, 1); /* has been cancelled */ Bitfield(mburied, 1); /* has been buried */ -#define mtemplit mburied /* since buried isn't implemented, use bit for - * monsters shown by transient light source; - * only valid during bhit() execution */ Bitfield(mundetected, 1); /* not seen in present hiding place; * implies one of M1_CONCEAL or M1_HIDE, * but not mimic (that is, snake, spider, @@ -132,10 +157,15 @@ struct monst { Bitfield(ispriest, 1); /* is an aligned priest or high priest */ Bitfield(iswiz, 1); /* is the Wizard of Yendor */ +#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ Bitfield(wormno, 5); /* at most 31 worms on any level */ - /* 2 free bits */ + Bitfield(mtemplit, 1); /* temporarily seen; only valid during bhit() */ + Bitfield(meverseen, 1); /* mon has been seen at some point */ -#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ + Bitfield(mspotted, 1); /* mon is currently seen by hero */ + Bitfield(mwandexp, 1); /* mon has experience with wands */ + Bitfield(mgenmklev, 1); /* made by the level generation */ + /* 5 spare bits */ unsigned long mstrategy; /* for monsters with mflag3: current strategy */ #ifdef NHSTDC @@ -153,20 +183,19 @@ struct monst { #define STRAT_PLAYER 0x01000000L #define STRAT_NONE 0x00000000L #define STRAT_STRATMASK 0x0f000000L -#define STRAT_XMASK 0x00ff0000L -#define STRAT_YMASK 0x0000ff00L + /* mstrategy unused 0x00ffff00L */ #define STRAT_GOAL 0x000000ffL -#define STRAT_GOALX(s) ((xchar) ((s & STRAT_XMASK) >> 16)) -#define STRAT_GOALY(s) ((xchar) ((s & STRAT_YMASK) >> 8)) + coord mgoal; /* monster strategy, target location */ long mtrapseen; /* bitmap of traps we've been trapped in */ long mlstmv; /* for catching up with lost time */ + long mstate; /* debugging info on monsters stored here */ + long migflags; /* migrating flags */ long mspare1; -#define mstate mspare1 /* only for debug exam right now, not code flow */ struct obj *minvent; /* mon's inventory */ struct obj *mw; /* mon's weapon */ long misc_worn_check; /* mon's wornmask */ - xchar weapon_check; /* flag for whether to try switching weapons */ + xint16 weapon_check; /* flag for whether to try switching weapons */ int meating; /* monster is eating timeout */ struct mextra *mextra; /* point to mextra struct */ @@ -181,16 +210,29 @@ struct monst { #define MON_WEP(mon) ((mon)->mw) #define MON_NOWEP(mon) ((mon)->mw = (struct obj *) 0) +/* dead monsters stay on the fmon list until dmonsfree() at end of turn */ #define DEADMONSTER(mon) ((mon)->mhp < 1) -#define is_starting_pet(mon) ((mon)->m_id == context.startingpet_mid) -#define is_vampshifter(mon) \ - ((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LORD \ + +#define is_starting_pet(mon) ((mon)->m_id == svc.context.startingpet_mid) +#define is_vampshifter(mon) \ + ((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LEADER \ || (mon)->cham == PM_VLAD_THE_IMPALER) +#define vampshifted(mon) (is_vampshifter((mon)) && !is_vampire((mon)->data)) +/* Vlad might be vampshifted so just checking monst->data is insufficient */ +#define is_Vlad(m) ((m)->data == &mons[PM_VLAD_THE_IMPALER] \ + || (m)->cham == PM_VLAD_THE_IMPALER) + +/* monsters which cannot be displaced: temple priests, shopkeepers, + vault guards, the Oracle, quest leader */ +#define mundisplaceable(mon) \ + ((mon)->ispriest || (mon)->isshk \ + || (mon)->isgd || (mon)->data == &mons[PM_ORACLE] \ + || (mon)->m_id == svq.quest_status.leader_m_id) /* mimic appearances that block vision/light */ -#define is_lightblocker_mappear(mon) \ +#define is_lightblocker_mappear(mon) \ (is_obj_mappear(mon, BOULDER) \ - || (M_AP_TYPE(mon) == M_AP_FURNITURE \ + || (M_AP_TYPE(mon) == M_AP_FURNITURE \ && ((mon)->mappearance == S_hcdoor \ || (mon)->mappearance == S_vcdoor \ || (mon)->mappearance < S_ndoor /* = walls */ \ @@ -201,4 +243,45 @@ struct monst { #define is_obj_mappear(mon,otyp) (M_AP_TYPE(mon) == M_AP_OBJECT \ && (mon)->mappearance == (otyp)) +/* is mon m (presumably just killed) a troll and obj o Trollsbane? */ +#define troll_baned(m,o) \ + ((m)->data->mlet == S_TROLL && (o) && (o)->oartifact == ART_TROLLSBANE) + +#define engulfing_u(mon) (u.uswallow && (u.ustuck == (mon))) +#define helpless(mon) ((mon)->msleeping || !(mon)->mcanmove) + +#define mon_perma_blind(mon) (!mon->mcansee && !mon->mblinded) + +#define mon_offmap(mon) ((mon)->mstate != MON_FLOOR) + +/* Get the maximum difficulty monsters that can currently be generated, + given the current level difficulty and the hero's level. */ +#define monmax_difficulty(levdif) (((levdif) + u.ulevel) / 2) +#define monmin_difficulty(levdif) ((levdif) / 6) +#define monmax_difficulty_lev() (monmax_difficulty(level_difficulty())) + +/* Macros for whether a type of monster is too strong for a specific level. */ +#define montoostrong(monindx, lev) (mons[monindx].difficulty > lev) +#define montooweak(monindx, lev) (mons[monindx].difficulty < lev) + +#ifdef PMNAME_MACROS +#define Mgender(mon) ((mon)->female ? FEMALE : MALE) +#endif +#define mon_resistancebits(mon) \ + ((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics) +#define resists_fire(mon) Resists_Elem(mon, FIRE_RES) +#define resists_cold(mon) Resists_Elem(mon, COLD_RES) +#define resists_sleep(mon) Resists_Elem(mon, SLEEP_RES) +#define resists_disint(mon) Resists_Elem(mon, DISINT_RES) +#define resists_elec(mon) Resists_Elem(mon, SHOCK_RES) +#define resists_poison(mon) Resists_Elem(mon, POISON_RES) +#define resists_acid(mon) Resists_Elem(mon, ACID_RES) +#define resists_ston(mon) Resists_Elem(mon, STONE_RES) + +#define is_lminion(mon) \ + (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) + +/* x is a valid index into mons[] array */ +#define ismnum(x) ((x) >= LOW_PM && (x) < NUMMONS) + #endif /* MONST_H */ diff --git a/include/monsters.h b/include/monsters.h new file mode 100644 index 000000000..202411128 --- /dev/null +++ b/include/monsters.h @@ -0,0 +1,3927 @@ +/* NetHack 5.0 monsters.h $NHDT-Date: 1723945838 2024/08/18 01:50:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.124 $ */ +/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ +/*-Copyright (c) Michael Allison, 2006. */ +/* NetHack may be freely redistributed. See license for details. */ + +#if defined(MONS_ENUM) +#define MON(nam, sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, \ + col, bn) PM_##bn + +#elif defined(DUMP_ENUMS) +#define MON(nam, sym, lvl, gen, atk, siz, mr1, mr2, flg1, flg2, flg3, d, \ + col, bn) { PM_##bn, #bn} + +#elif !defined(MON) +#error Non-productive inclusion of monsters.h +#endif + +/* + * Entry Format: (from permonst.h) + * + * name, symbol (S_* defines), + * base monster level, move rate, armor class, magic resistance, + * alignment, creation/geno flags (G_* defines), + * 6 * attack structs ( type , damage-type, # dice, # sides ), + * weight (WT_* defines), nutritional value, extension length, + * sounds made (MS_* defines), physical size (MZ_* defines), + * resistances, resistances conferred (both MR_* defines), + * 3 * flag bitmaps (M1_*, M2_*, and M3_* defines respectively), + * difficulty, symbol color. + * + * The difficulty was generated in separate array monstr[] with + * values calculated by makedefs, but has been moved into mons[] + * since it rarely changes. If a new monster is added or an old + * one undergoes significant change, 'makedefs -m' can be used to + * create a dummy monstr.c containing the calculated difficulty + * (of everything in mons[], not just any new or changed ones), + * then the value(s) can be plugged in here and monstr.c deleted. + * [Note that some monsters might warrant manually calculated + * difficulty, on a case by case basis, instead of blindly using + * the default value produced by makedefs. Or fix the algorithm + * used by makedefs to generate a more appropriate value....] + * + * TODO: difficulty is closely related to level; its field ought + * to be moved sooner in the permonst struct so that it can become + * part of LVL() instead of remaining an orphan near the end. + * + * Rule #1: monsters of a given class are contiguous in the + * mons[] array. + * + * Rule #2: monsters of a given class are generally kept in + * the same order as in previous versions of NetHack + * (they used to be presented in ascending order of + * strength, but this rule no longer applies). + * + * Rule #3: monster frequency is included in the geno mask; + * the frequency can be from 0 to 7. 0's will also + * be skipped during generation. + * + * Rule #4: monster subclasses (e.g. giants) should be kept + * together, unless it violates Rule 2. NOGEN monsters + * won't violate Rule 2. + * + * Guidelines for color assignment: + * + * * Use the same color for all `growth stages' of a monster (ex. + * little dog/big dog, baby naga/full-grown naga. + * + * * Use colors given in names wherever possible. If the class has `real' + * members with strong color associations, use those. + * + * * Favor `cool' colors for cold-resistant monsters, `warm' ones for + * fire-resistant ones. + * + * * Try to reserve purple (magenta) for powerful `ruler' monsters (queen + * bee, kobold lord, &c.). + * + * * Subject to all these constraints, try to use color to make as many + * distinctions as the / command (that is, within a monster letter + * distinct names should map to distinct colors). + * + * The aim in assigning colors is to be consistent enough so a player can + * become `intuitive' about them, deducing some or all of these rules + * unconsciously. Use your common sense. + */ + + /* + * ants + */ + MON(NAM("giant ant"), S_ANT, + LVL(2, 18, 3, 0, 0), (G_GENO | G_SGROUP | 3), + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_SILENT, MZ_TINY), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_CARNIVORE, M2_HOSTILE, 0, + 4, CLR_BROWN, GIANT_ANT), + MON(NAM("killer bee"), S_ANT, + LVL(1, 18, -1, 0, 0), (G_GENO | G_LGROUP | 2), + A(ATTK(AT_STNG, AD_DRST, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1, 5, MS_BUZZ, MZ_TINY), MR_POISON, MR_POISON, + M1_ANIMAL | M1_FLY | M1_NOHANDS | M1_POIS, M2_HOSTILE | M2_FEMALE, 0, + 6, CLR_YELLOW, KILLER_BEE), + MON(NAM("soldier ant"), S_ANT, + LVL(3, 18, 3, 0, 0), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_STNG, AD_DRST, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(20, 5, MS_SILENT, MZ_TINY), MR_POISON, MR_POISON, + M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS | M1_CARNIVORE, + M2_HOSTILE, 0, + 7, CLR_BLUE, SOLDIER_ANT), + MON(NAM("fire ant"), S_ANT, + LVL(3, 18, 3, 10, 0), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_BITE, AD_FIRE, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 10, MS_SILENT, MZ_TINY), MR_FIRE, MR_FIRE, + M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_CARNIVORE, M2_HOSTILE, + M3_INFRAVISIBLE, + 6, CLR_RED, FIRE_ANT), + MON(NAM("giant beetle"), S_ANT, + LVL(5, 6, 4, 0, 0), (G_GENO | 3), + A(ATTK(AT_BITE, AD_PHYS, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 50, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, + M1_ANIMAL | M1_NOHANDS | M1_POIS | M1_CARNIVORE, M2_HOSTILE, 0, + 6, CLR_BLACK, GIANT_BEETLE), + MON(NAM("queen bee"), S_ANT, + LVL(9, 24, -4, 0, 0), (G_GENO | G_NOGEN), + A(ATTK(AT_STNG, AD_DRST, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1, 5, MS_BUZZ, MZ_TINY), MR_POISON, MR_POISON, + M1_ANIMAL | M1_FLY | M1_NOHANDS | M1_OVIPAROUS | M1_POIS, + M2_HOSTILE | M2_FEMALE | M2_PRINCE, 0, + 12, HI_LORD, QUEEN_BEE), + /* + * blobs + */ + MON(NAM("acid blob"), S_BLOB, + LVL(1, 3, 8, 0, 0), (G_GENO | 2), + A(ATTK(AT_NONE, AD_ACID, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 10, MS_SILENT, MZ_TINY), + MR_SLEEP | MR_POISON | MR_ACID | MR_STONE, MR_ACID | MR_STONE, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_ACID, + M2_WANDER | M2_NEUTER, 0, + 2, CLR_GREEN, ACID_BLOB), + MON(NAM("quivering blob"), S_BLOB, + LVL(5, 1, 8, 0, 0), (G_GENO | 2), + A(ATTK(AT_TUCH, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 100, MS_SILENT, MZ_SMALL), MR_SLEEP | MR_POISON, MR_POISON, + M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS, + M2_WANDER | M2_HOSTILE | M2_NEUTER, 0, + 6, CLR_WHITE, QUIVERING_BLOB), + MON(NAM("gelatinous cube"), S_BLOB, + LVL(6, 6, 8, 0, 0), (G_GENO | 2), + A(ATTK(AT_TUCH, AD_PLYS, 2, 4), ATTK(AT_NONE, AD_PLYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 150, MS_SILENT, MZ_LARGE), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON | MR_ACID + | MR_STONE, + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP, + M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS | M1_OMNIVORE + | M1_ACID, + M2_WANDER | M2_HOSTILE | M2_NEUTER, 0, + 8, CLR_CYAN, GELATINOUS_CUBE), + /* + * cockatrice + */ + MON(NAM("chickatrice"), S_COCKATRICE, + LVL(4, 4, 8, 30, 0), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 2), ATTK(AT_TUCH, AD_STON, 0, 0), + ATTK(AT_NONE, AD_STON, 0, 0), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_HISS, MZ_TINY), MR_POISON | MR_STONE, + MR_POISON | MR_STONE, M1_ANIMAL | M1_NOHANDS | M1_OMNIVORE, + M2_HOSTILE, M3_INFRAVISIBLE, + 7, CLR_BROWN, CHICKATRICE), + MON(NAM("cockatrice"), S_COCKATRICE, + LVL(5, 6, 6, 30, 0), (G_GENO | 5), + A(ATTK(AT_BITE, AD_PHYS, 1, 3), ATTK(AT_TUCH, AD_STON, 0, 0), + ATTK(AT_NONE, AD_STON, 0, 0), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_HISS, MZ_SMALL), MR_POISON | MR_STONE, + MR_POISON | MR_STONE, + M1_ANIMAL | M1_NOHANDS | M1_OMNIVORE | M1_OVIPAROUS, M2_HOSTILE, + M3_INFRAVISIBLE, + 8, CLR_YELLOW, COCKATRICE), + MON(NAM("pyrolisk"), S_COCKATRICE, + LVL(6, 6, 6, 30, 0), (G_GENO | 1), + A(ATTK(AT_GAZE, AD_FIRE, 2, 6), ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_HISS, MZ_SMALL), MR_POISON | MR_FIRE, + MR_POISON | MR_FIRE, + M1_ANIMAL | M1_NOHANDS | M1_OMNIVORE | M1_OVIPAROUS, M2_HOSTILE, + M3_INFRAVISIBLE, + 8, CLR_RED, PYROLISK), + /* + * dogs & other canines + */ + MON(NAM("jackal"), S_DOG, + LVL(0, 12, 7, 0, 0), (G_GENO | G_SGROUP | 3), + A(ATTK(AT_BITE, AD_PHYS, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 250, MS_BARK, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 1, CLR_BROWN, JACKAL), + MON(NAM("fox"), S_DOG, + LVL(0, 15, 7, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 250, MS_BARK, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 1, CLR_RED, FOX), + MON(NAM("coyote"), S_DOG, + LVL(1, 12, 7, 0, 0), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 250, MS_BARK, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 2, CLR_BROWN, COYOTE), + MON(NAM("werejackal"), S_DOG, + LVL(2, 12, 7, 10, -7), (G_NOGEN | G_NOCORPSE), + A(ATTK(AT_BITE, AD_WERE, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 250, MS_BARK, MZ_SMALL), MR_POISON, 0, + M1_NOHANDS | M1_POIS | M1_REGEN | M1_CARNIVORE, + M2_NOPOLY | M2_WERE | M2_HOSTILE, M3_INFRAVISIBLE, + 4, CLR_BROWN, WEREJACKAL), + MON(NAM("little dog"), S_DOG, + LVL(2, 18, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(150, 150, MS_BARK, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_DOMESTIC, M3_INFRAVISIBLE, + 3, HI_DOMESTIC, LITTLE_DOG), + MON(NAM("dingo"), S_DOG, + LVL(4, 16, 5, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 200, MS_BARK, MZ_MEDIUM), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 5, CLR_YELLOW, DINGO), + MON(NAM("dog"), S_DOG, + LVL(4, 16, 5, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 200, MS_BARK, MZ_MEDIUM), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_DOMESTIC, M3_INFRAVISIBLE, + 5, HI_DOMESTIC, DOG), + MON(NAM("large dog"), S_DOG, + LVL(6, 15, 4, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(800, 250, MS_BARK, MZ_MEDIUM), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_STRONG | M2_DOMESTIC, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, LARGE_DOG), + MON(NAM("wolf"), S_DOG, + LVL(5, 12, 4, 0, 0), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 250, MS_BARK, MZ_MEDIUM), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 6, CLR_GRAY, WOLF), + /* werewolf in wolf form; one in human form uses a different monster + type (in the S_HUMAN section below); switching back and forth is + a shape-change that sets monst->data to the appropriate monster */ + MON(NAM("werewolf"), S_DOG, + LVL(5, 12, 4, 20, -7), (G_NOGEN | G_NOCORPSE), + A(ATTK(AT_BITE, AD_WERE, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 250, MS_BARK, MZ_MEDIUM), MR_POISON, 0, + M1_NOHANDS | M1_POIS | M1_REGEN | M1_CARNIVORE, + M2_NOPOLY | M2_WERE | M2_HOSTILE, M3_INFRAVISIBLE, + 7, CLR_GRAY, WEREWOLF), + MON(NAM("winter wolf cub"), S_DOG, + LVL(5, 12, 4, 0, 0), + (G_NOHELL | G_GENO | G_SGROUP | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 8), ATTK(AT_BREA, AD_COLD, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(250, 200, MS_BARK, MZ_SMALL), MR_COLD, MR_COLD, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, 0, + 7, CLR_CYAN, WINTER_WOLF_CUB), + MON(NAM("warg"), S_DOG, + LVL(7, 12, 4, 0, -5), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(850, 350, MS_BARK, MZ_MEDIUM), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 8, CLR_BLACK, WARG), + MON(NAM("winter wolf"), S_DOG, + LVL(7, 12, 4, 20, -5), (G_NOHELL | G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_BREA, AD_COLD, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(700, 300, MS_BARK, MZ_LARGE), MR_COLD, MR_COLD, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE | M2_STRONG, 0, + 9, CLR_CYAN, WINTER_WOLF), + MON(NAM("hell hound pup"), S_DOG, + LVL(7, 12, 4, 20, 0), (G_HELL | G_GENO | G_SGROUP | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_BREA, AD_FIRE, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 200, MS_BARK, MZ_SMALL), MR_FIRE, MR_FIRE, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 9, CLR_RED, HELL_HOUND_PUP), + MON(NAM("hell hound"), S_DOG, + LVL(12, 14, 2, 20, -5), (G_HELL | G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 3, 6), ATTK(AT_BREA, AD_FIRE, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 300, MS_BARK, MZ_MEDIUM), MR_FIRE, MR_FIRE, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE | M2_STRONG, + M3_INFRAVISIBLE, 14, CLR_RED, HELL_HOUND), +#ifdef CHARON + MON(NAM("Cerberus"), S_DOG, + LVL(12, 10, 2, 20, -7), (G_NOGEN | G_UNIQ | G_HELL), + A(ATTK(AT_BITE, AD_PHYS, 3, 6), ATTK(AT_BITE, AD_PHYS, 3, 6), + ATTK(AT_BITE, AD_PHYS, 3, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 350, MS_BARK, MZ_LARGE), MR_FIRE, MR_FIRE, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, + M2_NOPOLY | M2_HOSTILE | M2_STRONG | M2_PNAME | M2_MALE, + M3_INFRAVISIBLE, + 14, CLR_RED, CERBERUS), +#endif + /* + * eyes + */ + MON(NAM("gas spore"), S_EYE, + LVL(1, 3, 10, 0, 0), (G_NOCORPSE | G_GENO | 1), + A(ATTK(AT_BOOM, AD_PHYS, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_SILENT, MZ_SMALL), 0, 0, + M1_FLY | M1_BREATHLESS | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS, + M2_HOSTILE | M2_NEUTER, 0, + 2, CLR_GRAY, GAS_SPORE), + MON(NAM("floating eye"), S_EYE, + LVL(2, 1, 9, 10, 0), (G_GENO | 5), + A(ATTK(AT_NONE, AD_PLYS, 0, 70), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_SILENT, MZ_SMALL), 0, 0, + M1_FLY | M1_AMPHIBIOUS | M1_NOLIMBS | M1_NOHEAD | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 3, CLR_BLUE, FLOATING_EYE), + MON(NAM("freezing sphere"), S_EYE, + LVL(6, 13, 4, 0, 0), (G_NOCORPSE | G_NOHELL | G_GENO | 2), + A(ATTK(AT_EXPL, AD_COLD, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_SILENT, MZ_SMALL), MR_COLD, MR_COLD, + M1_FLY | M1_BREATHLESS | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 9, CLR_WHITE, FREEZING_SPHERE), + MON(NAM("flaming sphere"), S_EYE, + LVL(6, 13, 4, 0, 0), (G_NOCORPSE | G_GENO | 2), + A(ATTK(AT_EXPL, AD_FIRE, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_SILENT, MZ_SMALL), MR_FIRE, MR_FIRE, + M1_FLY | M1_BREATHLESS | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, 9, CLR_RED, FLAMING_SPHERE), + MON(NAM("shocking sphere"), S_EYE, + LVL(6, 13, 4, 0, 0), (G_NOCORPSE | G_GENO | 2), + A(ATTK(AT_EXPL, AD_ELEC, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 10, MS_SILENT, MZ_SMALL), MR_ELEC, MR_ELEC, + M1_FLY | M1_BREATHLESS | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 10, HI_ZAP, SHOCKING_SPHERE), +#if 0 /* not yet implemented */ + MON(NAM("beholder"), S_EYE, + LVL(6, 3, 4, 0, -10), (G_GENO | 2), + A(ATTK(AT_GAZE, AD_SLOW, 0, 0), ATTK(AT_GAZE, AD_SLEE, 2,25), + ATTK(AT_GAZE, AD_DISN, 0, 0), ATTK(AT_GAZE, AD_STON, 0, 0), + ATTK(AT_GAZE, AD_CNCL, 2, 4), ATTK(AT_BITE, AD_PHYS, 2, 4)), + SIZ(10, 10, MS_SILENT, MZ_SMALL), MR_COLD, 0, + M1_FLY | M1_BREATHLESS | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS, + M2_NOPOLY | M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 13, CLR_BROWN, BEHOLDER), +#endif + /* + * felines + */ + MON(NAM("kitten"), S_FELINE, + LVL(2, 18, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(150, 150, MS_MEW, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_WANDER | M2_DOMESTIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 3, HI_DOMESTIC, KITTEN), + MON(NAM("housecat"), S_FELINE, + LVL(4, 16, 5, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 200, MS_MEW, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_DOMESTIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 5, HI_DOMESTIC, HOUSECAT), + MON(NAM("jaguar"), S_FELINE, + LVL(4, 15, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_BITE, AD_PHYS, 1, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 300, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, + M3_INFRAVISIBLE | M3_INFRAVISION, + 6, CLR_BROWN, JAGUAR), + MON(NAM("lynx"), S_FELINE, + LVL(5, 15, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_BITE, AD_PHYS, 1, 10), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 300, MS_GROWL, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, + M3_INFRAVISIBLE | M3_INFRAVISION, + 7, CLR_CYAN, LYNX), + MON(NAM("panther"), S_FELINE, + LVL(5, 15, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), + ATTK(AT_BITE, AD_PHYS, 1, 10), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 300, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, + M3_INFRAVISIBLE | M3_INFRAVISION, + 7, CLR_BLACK, PANTHER), + MON(NAM("large cat"), S_FELINE, + LVL(6, 15, 4, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(250, 250, MS_MEW, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_STRONG | M2_DOMESTIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 7, HI_DOMESTIC, LARGE_CAT), + MON(NAM("tiger"), S_FELINE, + LVL(6, 12, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 2, 4), + ATTK(AT_BITE, AD_PHYS, 1, 10), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 300, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, + M3_INFRAVISIBLE | M3_INFRAVISION, + 8, CLR_YELLOW, TIGER), + MON(NAM("displacer beast"), S_FELINE, + LVL(12, 12, -10, 0, -3), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 4, 4), ATTK(AT_CLAW, AD_PHYS, 4, 4), + ATTK(AT_BITE, AD_PHYS, 2, 10), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(750, 400, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION | M3_DISPLACES, + 14, CLR_BLUE, DISPLACER_BEAST), + /* + * gremlins and gargoyles + */ + MON(NAM("gremlin"), S_GREMLIN, + LVL(5, 12, 2, 25, -9), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), + ATTK(AT_BITE, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_CURS, 0, 0), + NO_ATTK, NO_ATTK), + SIZ(100, 20, MS_LAUGH, MZ_SMALL), MR_POISON, MR_POISON, + M1_SWIM | M1_HUMANOID | M1_POIS, M2_STALK, M3_INFRAVISIBLE, + 8, CLR_GREEN, GREMLIN), + /* gargoyle and winged gargoyle are inspired by a cheesy made-for-TV + horror movie (starring Cornel Wilde and Jennifer Salt, 1972) */ + MON(NAM("gargoyle"), S_GREMLIN, + LVL(6, 10, -4, 0, -9), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 2, 6), ATTK(AT_CLAW, AD_PHYS, 2, 6), + ATTK(AT_BITE, AD_PHYS, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 200, MS_GRUNT, MZ_HUMAN), MR_STONE, MR_STONE, + M1_HUMANOID | M1_THICK_HIDE | M1_BREATHLESS, + M2_HOSTILE | M2_STRONG, 0, + 8, CLR_BROWN, GARGOYLE), + MON(NAM("winged gargoyle"), S_GREMLIN, + LVL(9, 15, -2, 0, -12), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 3, 6), ATTK(AT_CLAW, AD_PHYS, 3, 6), + ATTK(AT_BITE, AD_PHYS, 3, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 300, MS_GRUNT, MZ_HUMAN), MR_STONE, MR_STONE, + M1_FLY | M1_HUMANOID | M1_THICK_HIDE | M1_BREATHLESS | M1_OVIPAROUS, + M2_LORD | M2_HOSTILE | M2_STRONG | M2_MAGIC, 0, + 11, HI_LORD, WINGED_GARGOYLE), + /* + * humanoids + */ + MON(NAM("hobbit"), S_HUMANOID, + LVL(1, 9, 10, 0, 6), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 200, MS_HUMANOID, MZ_SMALL), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_COLLECT, M3_INFRAVISIBLE | M3_INFRAVISION, + 2, CLR_GREEN, HOBBIT), + /* unlike plain human|elf|orc, plain "dwarf" is an ordinary monster */ + MON(NAM("dwarf"), S_HUMANOID, + LVL(2, 6, 10, 10, 4), (G_GENO | 3), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 300, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_TUNNEL | M1_NEEDPICK | M1_HUMANOID | M1_OMNIVORE, + M2_DWARF | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 4, CLR_RED, DWARF), + MON(NAM("bugbear"), S_HUMANOID, + LVL(3, 9, 5, 0, -6), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1250, 250, MS_GROWL, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 5, CLR_BROWN, BUGBEAR), + MON(NAMS("dwarf lord", "dwarf lady", "dwarf leader"), S_HUMANOID, + LVL(4, 6, 10, 10, 5), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 300, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_TUNNEL | M1_NEEDPICK | M1_HUMANOID | M1_OMNIVORE, + M2_DWARF | M2_STRONG | M2_LORD | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 6, CLR_BLUE, DWARF_LEADER), + MON(NAMS("dwarf king", "dwarf queen", "dwarf ruler"), + S_HUMANOID, LVL(6, 6, 10, 20, 6), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_WEAP, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 300, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_TUNNEL | M1_NEEDPICK | M1_HUMANOID | M1_OMNIVORE, + M2_DWARF | M2_STRONG | M2_PRINCE | M2_GREEDY | M2_JEWELS + | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 8, HI_LORD, DWARF_RULER), + MON(NAM("mind flayer"), S_HUMANOID, + LVL(9, 12, 5, 90, -8), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), ATTK(AT_TENT, AD_DRIN, 2, 1), + ATTK(AT_TENT, AD_DRIN, 2, 1), ATTK(AT_TENT, AD_DRIN, 2, 1), + NO_ATTK, NO_ATTK), + SIZ(1450, 400, MS_HISS, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_FLY | M1_SEE_INVIS | M1_OMNIVORE, + M2_HOSTILE | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 13, CLR_BRIGHT_MAGENTA, MIND_FLAYER), + MON(NAM("master mind flayer"), S_HUMANOID, + LVL(13, 12, 0, 90, -8), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_TENT, AD_DRIN, 2, 1), + ATTK(AT_TENT, AD_DRIN, 2, 1), ATTK(AT_TENT, AD_DRIN, 2, 1), + ATTK(AT_TENT, AD_DRIN, 2, 1), ATTK(AT_TENT, AD_DRIN, 2, 1)), + SIZ(1450, 400, MS_HISS, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_FLY | M1_SEE_INVIS | M1_OMNIVORE, + M2_HOSTILE | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 19, CLR_BRIGHT_MAGENTA, MASTER_MIND_FLAYER), + /* + * imps & other minor demons/devils + */ + MON(NAM("manes"), S_IMP, + LVL(1, 3, 7, 0, -7), (G_GENO | G_LGROUP | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), + ATTK(AT_BITE, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 100, MS_SILENT, MZ_SMALL), MR_SLEEP | MR_POISON, 0, M1_POIS, + M2_HOSTILE | M2_STALK, M3_INFRAVISIBLE | M3_INFRAVISION, + 3, CLR_RED, MANES), + MON(NAM("homunculus"), S_IMP, + LVL(2, 12, 6, 10, -7), (G_GENO | 2), + A(ATTK(AT_BITE, AD_SLEE, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(60, 100, MS_SILENT, MZ_TINY), MR_SLEEP | MR_POISON, + MR_SLEEP | MR_POISON, M1_FLY | M1_POIS, M2_STALK, + M3_INFRAVISIBLE | M3_INFRAVISION, + 3, CLR_GREEN, HOMUNCULUS), + MON(NAM("imp"), S_IMP, + LVL(3, 12, 2, 20, -7), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(20, 10, MS_CUSS, MZ_TINY), 0, 0, M1_REGEN, M2_WANDER | M2_STALK, + M3_INFRAVISIBLE | M3_INFRAVISION, + 4, CLR_RED, IMP), + MON(NAM("lemure"), S_IMP, + LVL(3, 3, 7, 0, -7), (G_HELL | G_GENO | G_LGROUP | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(150, 100, MS_SILENT, MZ_MEDIUM), MR_SLEEP | MR_POISON, MR_SLEEP, + M1_POIS | M1_REGEN, M2_HOSTILE | M2_WANDER | M2_STALK | M2_NEUTER, + M3_INFRAVISIBLE | M3_INFRAVISION, + 5, CLR_BROWN, LEMURE), + MON(NAM("quasit"), S_IMP, + LVL(3, 15, 2, 20, -7), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_DRDX, 1, 2), ATTK(AT_CLAW, AD_DRDX, 1, 2), + ATTK(AT_BITE, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 200, MS_SILENT, MZ_SMALL), MR_POISON, MR_POISON, M1_REGEN, + M2_STALK, M3_INFRAVISIBLE | M3_INFRAVISION, + 7, CLR_BLUE, QUASIT), + MON(NAM("tengu"), S_IMP, + LVL(6, 13, 5, 30, 7), (G_GENO | 3), + A(ATTK(AT_BITE, AD_PHYS, 1, 7), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 200, MS_SQAWK, MZ_SMALL), MR_POISON, MR_POISON, + M1_TPORT | M1_TPORT_CNTRL, M2_STALK, M3_INFRAVISIBLE | M3_INFRAVISION, + 7, CLR_CYAN, TENGU), + /* + * jellies + */ + MON(NAM("blue jelly"), S_JELLY, + LVL(4, 0, 8, 10, 0), (G_GENO | 2), + A(ATTK(AT_NONE, AD_COLD, 0, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_JELLY, 20, MS_SILENT, MZ_MEDIUM), MR_COLD | MR_POISON, + MR_COLD | MR_POISON, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 5, CLR_BLUE, BLUE_JELLY), + MON(NAM("spotted jelly"), S_JELLY, + LVL(5, 0, 8, 10, 0), (G_GENO | 1), + A(ATTK(AT_NONE, AD_ACID, 0, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_JELLY, 20, MS_SILENT, MZ_MEDIUM), + MR_ACID | MR_STONE, MR_ACID | MR_STONE, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_ACID | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 6, CLR_GREEN, SPOTTED_JELLY), + MON(NAM("ochre jelly"), S_JELLY, + LVL(6, 3, 8, 20, 0), (G_GENO | 2), + A(ATTK(AT_ENGL, AD_ACID, 3, 6), ATTK(AT_NONE, AD_ACID, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_JELLY, 20, MS_SILENT, MZ_MEDIUM), + MR_ACID | MR_STONE, MR_ACID | MR_STONE, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_ACID | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 8, CLR_BROWN, OCHRE_JELLY), + /* + * kobolds + */ + MON(NAM("kobold"), S_KOBOLD, + LVL(0, 6, 10, 0, -2), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 100, MS_ORC, MZ_SMALL), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_OMNIVORE, M2_HOSTILE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 1, CLR_BROWN, KOBOLD), + MON(NAM("large kobold"), S_KOBOLD, + LVL(1, 6, 10, 0, -3), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(450, 150, MS_ORC, MZ_SMALL), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_OMNIVORE, M2_HOSTILE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 2, CLR_RED, LARGE_KOBOLD), + MON(NAMS("kobold lord", "kobold lady", "kobold leader"), S_KOBOLD, + LVL(2, 6, 10, 0, -4), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 200, MS_ORC, MZ_SMALL), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_OMNIVORE, + M2_HOSTILE | M2_LORD | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 3, HI_LORD, KOBOLD_LEADER), + MON(NAM("kobold shaman"), S_KOBOLD, + LVL(2, 6, 6, 10, -4), (G_GENO | 1), + A(ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(450, 150, MS_ORC, MZ_SMALL), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_OMNIVORE, M2_HOSTILE | M2_MAGIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 4, HI_ZAP, KOBOLD_SHAMAN), + /* + * leprechauns + */ + MON(NAM("leprechaun"), S_LEPRECHAUN, + LVL(5, 15, 8, 20, 0), (G_GENO | 4), + A(ATTK(AT_CLAW, AD_SGLD, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(60, 30, MS_LAUGH, MZ_TINY), 0, 0, M1_HUMANOID | M1_TPORT, + M2_HOSTILE | M2_GREEDY, M3_INFRAVISIBLE, + 4, CLR_GREEN, LEPRECHAUN), + /* + * mimics + */ + MON(NAM("small mimic"), S_MIMIC, + LVL(7, 3, 7, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 200, MS_SILENT, MZ_MEDIUM), MR_ACID, 0, + M1_BREATHLESS | M1_AMORPHOUS | M1_HIDE | M1_ANIMAL | M1_NOEYES + | M1_NOHEAD | M1_NOLIMBS | M1_THICK_HIDE | M1_CARNIVORE, + M2_HOSTILE, 0, + 8, CLR_BROWN, SMALL_MIMIC), + MON(NAM("large mimic"), S_MIMIC, + LVL(8, 3, 7, 10, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_STCK, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 400, MS_SILENT, MZ_LARGE), MR_ACID, 0, + M1_CLING | M1_BREATHLESS | M1_AMORPHOUS | M1_HIDE | M1_ANIMAL + | M1_NOEYES | M1_NOHEAD | M1_NOLIMBS | M1_THICK_HIDE + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG, 0, + 9, CLR_RED, LARGE_MIMIC), + MON(NAM("giant mimic"), S_MIMIC, + LVL(9, 3, 7, 20, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_STCK, 3, 6), ATTK(AT_CLAW, AD_STCK, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(800, 500, MS_SILENT, MZ_LARGE), MR_ACID, 0, + M1_CLING | M1_BREATHLESS | M1_AMORPHOUS | M1_HIDE | M1_ANIMAL + | M1_NOEYES | M1_NOHEAD | M1_NOLIMBS | M1_THICK_HIDE + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG, 0, + 11, HI_LORD, GIANT_MIMIC), + /* + * nymphs + */ + MON(NAM("wood nymph"), S_NYMPH, + LVL(3, 12, 9, 20, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_SITM, 0, 0), ATTK(AT_CLAW, AD_SEDU, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_NYMPH, 300, MS_SEDUCE, MZ_HUMAN), 0, 0, M1_HUMANOID | M1_TPORT, + M2_HOSTILE | M2_FEMALE | M2_COLLECT, M3_INFRAVISIBLE, + 5, CLR_GREEN, WOOD_NYMPH), + MON(NAM("water nymph"), S_NYMPH, + LVL(3, 12, 9, 20, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_SITM, 0, 0), ATTK(AT_CLAW, AD_SEDU, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_NYMPH, 300, MS_SEDUCE, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_TPORT | M1_SWIM, M2_HOSTILE | M2_FEMALE | M2_COLLECT, + M3_INFRAVISIBLE, + 5, CLR_BLUE, WATER_NYMPH), + MON(NAM("mountain nymph"), S_NYMPH, + LVL(3, 12, 9, 20, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_SITM, 0, 0), ATTK(AT_CLAW, AD_SEDU, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_NYMPH, 300, MS_SEDUCE, MZ_HUMAN), 0, 0, M1_HUMANOID | M1_TPORT, + M2_HOSTILE | M2_FEMALE | M2_COLLECT, M3_INFRAVISIBLE, + 5, CLR_BROWN, MOUNTAIN_NYMPH), + /* + * orcs + */ + MON(NAM("goblin"), S_ORC, + LVL(0, 6, 10, 0, -3), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 100, MS_ORC, MZ_SMALL), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_COLLECT, M3_INFRAVISIBLE | M3_INFRAVISION, + 1, CLR_GRAY, GOBLIN), + MON(NAM("hobgoblin"), S_ORC, LVL(1, 9, 10, 0, -4), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 200, MS_ORC, MZ_HUMAN), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE | M3_INFRAVISION, + 3, CLR_BROWN, HOBGOBLIN), + /* Plain "orc" for zombie and mummy corpses only; not created at random. + * Orcs (but not goblins and hobgoblins) are granted poison resistance; + * however, their corpses don't confer it. */ + MON(NAM("orc"), S_ORC, + LVL(1, 9, 10, 0, -3), (G_GENO | G_NOGEN | G_LGROUP), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(850, 150, MS_ORC, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_ORC | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 3, CLR_RED, ORC), + MON(NAM("hill orc"), S_ORC, + LVL(2, 9, 10, 0, -4), (G_GENO | G_LGROUP | 2), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 200, MS_ORC, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 4, CLR_YELLOW, HILL_ORC), + MON(NAM("Mordor orc"), S_ORC, + LVL(3, 5, 10, 0, -5), (G_GENO | G_LGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 200, MS_ORC, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 5, CLR_BLUE, MORDOR_ORC), + MON(NAM("Uruk-hai"), S_ORC, + LVL(3, 7, 10, 0, -4), (G_GENO | G_LGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1300, 300, MS_ORC, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 5, CLR_BLACK, URUK_HAI), + MON(NAM("orc shaman"), S_ORC, + LVL(3, 9, 5, 10, -5), (G_GENO | 1), + A(ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 300, MS_ORC, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_GREEDY | M2_JEWELS | M2_MAGIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 5, HI_ZAP, ORC_SHAMAN), + MON(NAM("orc-captain"), S_ORC, + LVL(5, 5, 10, 0, -5), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1350, 350, MS_ORC, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_ORC | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 7, HI_LORD, ORC_CAPTAIN), + /* + * piercers + */ + MON(NAM("rock piercer"), S_PIERCER, + LVL(3, 1, 3, 0, 0), (G_GENO | 4), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 200, MS_SILENT, MZ_SMALL), 0, 0, + M1_CLING | M1_HIDE | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_CARNIVORE + | M1_NOTAKE, + M2_HOSTILE, 0, + 4, CLR_GRAY, ROCK_PIERCER), + MON(NAM("iron piercer"), S_PIERCER, + LVL(5, 1, 0, 0, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 300, MS_SILENT, MZ_MEDIUM), 0, 0, + M1_CLING | M1_HIDE | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_CARNIVORE + | M1_NOTAKE, + M2_HOSTILE, 0, + 6, CLR_CYAN, IRON_PIERCER), + MON(NAM("glass piercer"), S_PIERCER, + LVL(7, 1, 0, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 300, MS_SILENT, MZ_MEDIUM), MR_ACID, 0, + M1_CLING | M1_HIDE | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_CARNIVORE + | M1_NOTAKE, + M2_HOSTILE, 0, + 9, CLR_WHITE, GLASS_PIERCER), + /* + * quadrupeds + * (note: horses are grouped with unicorns in another section below) + */ + MON(NAM("rothe"), S_QUADRUPED, + LVL(2, 9, 7, 0, 0), (G_GENO | G_SGROUP | 4), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_BITE, AD_PHYS, 1, 3), + ATTK(AT_BITE, AD_PHYS, 1, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 100, MS_MOO, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_OMNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 4, CLR_BROWN, ROTHE), + MON(NAM("mumak"), S_QUADRUPED, + LVL(5, 9, 0, 0, -2), (G_GENO | 1), + A(ATTK(AT_BUTT, AD_PHYS, 4, 12), ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2500, 500, MS_TRUMPET, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_THICK_HIDE | M1_NOHANDS | M1_HERBIVORE, + M2_HOSTILE | M2_STRONG, M3_INFRAVISIBLE, + 7, CLR_GRAY, MUMAK), + MON(NAM("leocrotta"), S_QUADRUPED, + LVL(6, 18, 4, 10, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 2, 6), ATTK(AT_BITE, AD_PHYS, 2, 6), + ATTK(AT_CLAW, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 500, MS_IMITATE, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_OMNIVORE, M2_HOSTILE | M2_STRONG, + M3_INFRAVISIBLE, + 8, CLR_RED, LEOCROTTA), + MON(NAM("wumpus"), S_QUADRUPED, + LVL(8, 3, 2, 10, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2500, 500, MS_BURBLE, MZ_LARGE), 0, 0, + M1_CLING | M1_ANIMAL | M1_NOHANDS | M1_OMNIVORE, + M2_HOSTILE | M2_STRONG, M3_INFRAVISIBLE, + 9, CLR_CYAN, WUMPUS), + MON(NAM("titanothere"), S_QUADRUPED, + LVL(12, 12, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2650, 650, MS_BELLOW, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_THICK_HIDE | M1_NOHANDS | M1_HERBIVORE, + M2_HOSTILE | M2_STRONG, M3_INFRAVISIBLE, + 13, CLR_GRAY, TITANOTHERE), + MON(NAM("baluchitherium"), S_QUADRUPED, + LVL(14, 12, 5, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 5, 4), ATTK(AT_CLAW, AD_PHYS, 5, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(3800, 800, MS_BELLOW, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_THICK_HIDE | M1_NOHANDS | M1_HERBIVORE, + M2_HOSTILE | M2_STRONG, M3_INFRAVISIBLE, + 15, CLR_GRAY, BALUCHITHERIUM), + MON(NAM("mastodon"), S_QUADRUPED, + LVL(20, 12, 5, 0, 0), (G_GENO | 1), + A(ATTK(AT_BUTT, AD_PHYS, 4, 8), ATTK(AT_BUTT, AD_PHYS, 4, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(3800, 800, MS_TRUMPET, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_THICK_HIDE | M1_NOHANDS | M1_HERBIVORE, + M2_HOSTILE | M2_STRONG, M3_INFRAVISIBLE, + 22, CLR_BLACK, MASTODON), + /* + * rodents + */ + MON(NAM("sewer rat"), S_RODENT, + LVL(0, 12, 7, 0, 0), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(20, 12, MS_SQEEK, MZ_TINY), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 1, CLR_BROWN, SEWER_RAT), + MON(NAM("giant rat"), S_RODENT, + LVL(1, 10, 7, 0, 0), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_SQEEK, MZ_TINY), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, M3_INFRAVISIBLE, + 2, CLR_BROWN, GIANT_RAT), + MON(NAM("rabid rat"), S_RODENT, + LVL(2, 12, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_DRCO, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 5, MS_SQEEK, MZ_TINY), MR_POISON, 0, + M1_ANIMAL | M1_NOHANDS | M1_POIS | M1_CARNIVORE, M2_HOSTILE, + M3_INFRAVISIBLE, + 4, CLR_BROWN, RABID_RAT), + MON(NAM("wererat"), S_RODENT, + LVL(2, 12, 6, 10, -7), (G_NOGEN | G_NOCORPSE), + A(ATTK(AT_BITE, AD_WERE, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(40, 30, MS_SQEEK, MZ_TINY), MR_POISON, 0, + M1_NOHANDS | M1_POIS | M1_REGEN | M1_CARNIVORE, + M2_NOPOLY | M2_WERE | M2_HOSTILE, M3_INFRAVISIBLE, + 4, CLR_BROWN, WERERAT), + MON(NAM("rock mole"), S_RODENT, + LVL(3, 3, 0, 20, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_SILENT, MZ_SMALL), 0, 0, + M1_TUNNEL | M1_ANIMAL | M1_NOHANDS | M1_METALLIVORE, + M2_HOSTILE | M2_GREEDY | M2_JEWELS | M2_COLLECT, M3_INFRAVISIBLE, + 4, CLR_GRAY, ROCK_MOLE), + MON(NAM("woodchuck"), S_RODENT, + LVL(3, 3, 0, 20, 0), (G_NOGEN | G_GENO), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_SILENT, MZ_SMALL), 0, 0, + M1_TUNNEL /*LOGGING*/ | M1_ANIMAL | M1_NOHANDS | M1_SWIM + | M1_HERBIVORE, + /* In reality, they tunnel instead of cutting lumber. Oh, well. */ + M2_WANDER | M2_HOSTILE, M3_INFRAVISIBLE, + 4, CLR_BROWN, WOODCHUCK), + /* + * spiders & scorpions (keep webmaker() in sync if new critters are added) + */ + MON(NAM("cave spider"), S_SPIDER, + LVL(1, 12, 3, 0, 0), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 50, MS_SILENT, MZ_TINY), MR_POISON, MR_POISON, + M1_CONCEAL | M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_CARNIVORE, + M2_HOSTILE, 0, + 3, CLR_GRAY, CAVE_SPIDER), + MON(NAM("centipede"), S_SPIDER, + LVL(2, 4, 3, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_DRST, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 50, MS_SILENT, MZ_TINY), MR_POISON, MR_POISON, + M1_CONCEAL | M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_CARNIVORE, + M2_HOSTILE, 0, + 4, CLR_YELLOW, CENTIPEDE), + MON(NAM("giant spider"), S_SPIDER, + LVL(5, 15, 4, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_DRST, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 100, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, + M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG, 0, + 7, CLR_MAGENTA, GIANT_SPIDER), + MON(NAM("scorpion"), S_SPIDER, + LVL(5, 15, 3, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 2), ATTK(AT_CLAW, AD_PHYS, 1, 2), + ATTK(AT_STNG, AD_DRST, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 100, MS_SILENT, MZ_SMALL), MR_POISON, MR_POISON, + M1_CONCEAL | M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS + | M1_CARNIVORE, + M2_HOSTILE, 0, + 8, CLR_RED, SCORPION), + /* + * trappers, lurkers, &c + * Note: prior to 5.0, these were defined to do AD_DGST damage, + * but they don't swallow their victims into their stomachs and + * digest, they enfold and crush or suffocate. + * The Monster Manual states that someone engulfed by a trapper + * can't use weapons but we do not enforce that. + */ + MON(NAM("lurker above"), S_TRAPPER, + LVL(10, 3, 3, 0, 0), (G_GENO | 2), + A(ATTK(AT_ENGL, AD_WRAP, 1, 6), ATTK(AT_ENGL, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(800, 350, MS_SILENT, MZ_HUGE), 0, 0, + M1_HIDE | M1_FLY | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_CARNIVORE, + M2_HOSTILE | M2_STALK | M2_STRONG, 0, + 12, CLR_GRAY, LURKER_ABOVE), + MON(NAM("trapper"), S_TRAPPER, + LVL(12, 3, 3, 0, 0), (G_GENO | 2), + A(ATTK(AT_ENGL, AD_WRAP, 1, 8), ATTK(AT_ENGL, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(800, 350, MS_SILENT, MZ_HUGE), 0, 0, + M1_HIDE | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_CARNIVORE, + M2_HOSTILE | M2_STALK | M2_STRONG, 0, + 14, CLR_GREEN, TRAPPER), + /* + * unicorns and horses + */ + MON(NAM("pony"), S_UNICORN, + LVL(3, 16, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_KICK, AD_PHYS, 1, 6), ATTK(AT_BITE, AD_PHYS, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1300, 250, MS_NEIGH, MZ_MEDIUM), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_HERBIVORE, + M2_WANDER | M2_STRONG | M2_DOMESTIC, M3_INFRAVISIBLE, + 4, CLR_BROWN, PONY), + MON(NAM("white unicorn"), S_UNICORN, + LVL(4, 24, 2, 70, 7), (G_GENO | 2), + A(ATTK(AT_BUTT, AD_PHYS, 1, 12), ATTK(AT_KICK, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1300, 300, MS_NEIGH, MZ_LARGE), MR_POISON, MR_POISON, + M1_NOHANDS | M1_HERBIVORE, M2_WANDER | M2_STRONG | M2_JEWELS, + M3_INFRAVISIBLE, + 6, CLR_WHITE, WHITE_UNICORN), + MON(NAM("gray unicorn"), S_UNICORN, + LVL(4, 24, 2, 70, 0), (G_GENO | 1), + A(ATTK(AT_BUTT, AD_PHYS, 1, 12), ATTK(AT_KICK, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1300, 300, MS_NEIGH, MZ_LARGE), MR_POISON, MR_POISON, + M1_NOHANDS | M1_HERBIVORE, M2_WANDER | M2_STRONG | M2_JEWELS, + M3_INFRAVISIBLE, + 6, CLR_GRAY, GRAY_UNICORN), + MON(NAM("black unicorn"), S_UNICORN, + LVL(4, 24, 2, 70, -7), (G_GENO | 1), + A(ATTK(AT_BUTT, AD_PHYS, 1, 12), ATTK(AT_KICK, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1300, 300, MS_NEIGH, MZ_LARGE), MR_POISON, MR_POISON, + M1_NOHANDS | M1_HERBIVORE, M2_WANDER | M2_STRONG | M2_JEWELS, + M3_INFRAVISIBLE, + 6, CLR_BLACK, BLACK_UNICORN), + MON(NAM("horse"), S_UNICORN, + LVL(5, 20, 5, 0, 0), (G_GENO | 2), + A(ATTK(AT_KICK, AD_PHYS, 1, 8), ATTK(AT_BITE, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 300, MS_NEIGH, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_HERBIVORE, + M2_WANDER | M2_STRONG | M2_DOMESTIC, M3_INFRAVISIBLE, + 7, CLR_BROWN, HORSE), + MON(NAM("warhorse"), S_UNICORN, + LVL(7, 24, 4, 0, 0), (G_GENO | 2), + A(ATTK(AT_KICK, AD_PHYS, 1, 10), ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1800, 350, MS_NEIGH, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_HERBIVORE, + M2_WANDER | M2_STRONG | M2_DOMESTIC, M3_INFRAVISIBLE, + 9, CLR_BROWN, WARHORSE), + /* + * vortices + */ + MON(NAM("fog cloud"), S_VORTEX, + LVL(3, 1, 0, 0, 0), (G_GENO | G_NOCORPSE | 2), + A(ATTK(AT_ENGL, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_AMORPHOUS | M1_UNSOLID, + M2_HOSTILE | M2_NEUTER, 0, + 4, CLR_GRAY, FOG_CLOUD), + MON(NAM("dust vortex"), S_VORTEX, + LVL(4, 20, 2, 30, 0), (G_GENO | G_NOCORPSE | 2), + A(ATTK(AT_ENGL, AD_BLND, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS, + M2_HOSTILE | M2_NEUTER, 0, + 6, CLR_BROWN, DUST_VORTEX), + MON(NAM("ice vortex"), S_VORTEX, + LVL(5, 20, 2, 30, 0), (G_NOHELL | G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_ENGL, AD_COLD, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), + MR_COLD | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 7, CLR_CYAN, ICE_VORTEX), + MON(NAM("energy vortex"), S_VORTEX, + LVL(6, 20, 2, 30, 0), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_ENGL, AD_ELEC, 1, 6), ATTK(AT_ENGL, AD_DREN, 2, 6), + ATTK(AT_NONE, AD_ELEC, 0, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), + MR_ELEC | MR_SLEEP | MR_DISINT | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_UNSOLID, + M2_HOSTILE | M2_NEUTER, 0, + 9, HI_ZAP, ENERGY_VORTEX), + MON(NAM("steam vortex"), S_VORTEX, + LVL(7, 22, 2, 30, 0), (G_HELL | G_GENO | G_NOCORPSE | 2), + A(ATTK(AT_ENGL, AD_FIRE, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), + MR_FIRE | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_UNSOLID, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 9, CLR_BLUE, STEAM_VORTEX), + MON(NAM("fire vortex"), S_VORTEX, + LVL(8, 22, 2, 30, 0), (G_HELL | G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_ENGL, AD_FIRE, 1, 10), ATTK(AT_NONE, AD_FIRE, 0, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), + MR_FIRE | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_UNSOLID, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 10, CLR_YELLOW, FIRE_VORTEX), + /* + * worms + */ + MON(NAM("baby long worm"), S_WORM, + LVL(5, 3, 5, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 250, MS_SILENT, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_SLITHY | M1_NOLIMBS | M1_CARNIVORE | M1_NOTAKE, + M2_HOSTILE, 0, + 6, CLR_BROWN, BABY_LONG_WORM), + MON(NAM("baby purple worm"), S_WORM, + LVL(8, 3, 5, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 250, MS_SILENT, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_SLITHY | M1_NOLIMBS | M1_CARNIVORE, M2_HOSTILE, 0, + 9, CLR_MAGENTA, BABY_PURPLE_WORM), + MON(NAM("long worm"), S_WORM, + LVL(9, 3, 5, 10, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 500, MS_SILENT, MZ_GIGANTIC), 0, 0, + M1_ANIMAL | M1_SLITHY | M1_NOLIMBS | M1_OVIPAROUS | M1_CARNIVORE + | M1_NOTAKE, + M2_HOSTILE | M2_STRONG | M2_NASTY, 0, + 10, CLR_BROWN, LONG_WORM), + MON(NAM("purple worm"), S_WORM, + LVL(15, 9, 6, 20, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 2, 8), ATTK(AT_ENGL, AD_DGST, 1, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2700, 700, MS_SILENT, MZ_GIGANTIC), 0, 0, + M1_ANIMAL | M1_SLITHY | M1_NOLIMBS | M1_OVIPAROUS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY, 0, + 17, CLR_MAGENTA, PURPLE_WORM), + /* + * xan, &c + */ + MON(NAM("grid bug"), S_XAN, + LVL(0, 12, 9, 0, 0), (G_GENO | G_SGROUP | G_NOCORPSE | 3), + A(ATTK(AT_BITE, AD_ELEC, 1, 1), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(15, 10, MS_BUZZ, MZ_TINY), MR_ELEC | MR_POISON, 0, + M1_ANIMAL | M1_NOHANDS, + M2_HOSTILE, M3_INFRAVISIBLE, + 1, CLR_MAGENTA, GRID_BUG), + MON(NAM("xan"), S_XAN, + LVL(7, 18, -4, 0, 0), (G_GENO | 3), + A(ATTK(AT_STNG, AD_LEGS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 300, MS_BUZZ, MZ_TINY), MR_POISON, MR_POISON, + M1_FLY | M1_ANIMAL | M1_NOHANDS | M1_POIS, M2_HOSTILE, + M3_INFRAVISIBLE, + 9, CLR_RED, XAN), + /* + * lights + */ + /* yellow light is visible and its suicidal explosion causes blindness */ + MON(NAM("yellow light"), S_LIGHT, + LVL(3, 15, 0, 0, 0), (G_NOCORPSE | G_GENO | 4), + A(ATTK(AT_EXPL, AD_BLND, 10, 20), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_SMALL), + MR_FIRE | MR_COLD | MR_ELEC | MR_DISINT | MR_SLEEP | MR_POISON + | MR_ACID | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS + | M1_NOHEAD | M1_MINDLESS | M1_UNSOLID | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 5, CLR_YELLOW, YELLOW_LIGHT), + /* black light is invisible and causes hallucination */ + MON(NAM("black light"), S_LIGHT, + LVL(5, 15, 0, 0, 0), (G_NOCORPSE | G_GENO | 2), + A(ATTK(AT_EXPL, AD_HALU, 10, 12), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_SMALL), + MR_FIRE | MR_COLD | MR_ELEC | MR_DISINT | MR_SLEEP | MR_POISON + | MR_ACID | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS + | M1_NOHEAD | M1_MINDLESS | M1_UNSOLID | M1_SEE_INVIS | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 7, CLR_BLACK, BLACK_LIGHT), + /* + * zruty + */ + MON(NAM("zruty"), S_ZRUTY, + LVL(9, 8, 3, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 3, 4), ATTK(AT_CLAW, AD_PHYS, 3, 4), + ATTK(AT_BITE, AD_PHYS, 3, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 600, MS_SILENT, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_CARNIVORE, M2_HOSTILE | M2_STRONG, + M3_INFRAVISIBLE, + 11, CLR_BROWN, ZRUTY), + /* + * Angels and other lawful minions + */ + MON(NAM("couatl"), S_ANGEL, + LVL(8, 10, 5, 30, 7), (G_NOHELL | G_SGROUP | G_NOCORPSE | 1), + A(ATTK(AT_BITE, AD_DRST, 2, 4), ATTK(AT_BITE, AD_PHYS, 1, 3), + ATTK(AT_HUGS, AD_WRAP, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 400, MS_HISS, MZ_LARGE), MR_POISON, 0, + M1_FLY | M1_NOHANDS | M1_SLITHY | M1_POIS, + M2_MINION | M2_STALK | M2_STRONG | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_GREEN, COUATL), + MON(NAM("Aleax"), S_ANGEL, + LVL(10, 8, 0, 30, 7), (G_NOHELL | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + ATTK(AT_KICK, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_IMITATE, MZ_HUMAN), + MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_HUMANOID | M1_SEE_INVIS, + M2_MINION | M2_STALK | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 12, CLR_YELLOW, ALEAX), + /* Angels start with the emin extension attached, and usually have + the isminion flag set; however, non-minion Angels can be tamed + and will switch to edog (guardian Angel is handled specially and + always sticks with emin) */ + MON(NAM("Angel"), S_ANGEL, + LVL(14, 10, -4, 55, 12), (G_NOHELL | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_MAGC, AD_MAGM, 2, 6), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_CUSS, MZ_HUMAN), + MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_HUMANOID | M1_SEE_INVIS, + M2_NOPOLY | M2_MINION | M2_STALK | M2_STRONG | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 19, CLR_WHITE, ANGEL), + /* the AD&D Monster Manual depicts ki-rin as very similar to unicorns + except that they fly (without wings) and can cast spells; nethack's + ki-rin doesn't leave its horn when killed, but it can use the horn + while alive to cure itself of various maladies */ + MON(NAM("ki-rin"), S_ANGEL, + LVL(16, 18, -5, 90, 15), (G_NOHELL | G_NOCORPSE | 1), + A(ATTK(AT_KICK, AD_PHYS, 2, 4), ATTK(AT_KICK, AD_PHYS, 2, 4), + ATTK(AT_BUTT, AD_PHYS, 3, 6), ATTK(AT_MAGC, AD_SPEL, 2, 6), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SPELL, MZ_LARGE), MR_POISON, 0, + M1_FLY | M1_NOHANDS | M1_SEE_INVIS, + M2_NOPOLY | M2_MINION | M2_STALK | M2_STRONG | M2_NASTY | M2_LORD, + M3_INFRAVISIBLE | M3_INFRAVISION, + 21, HI_GOLD, KI_RIN), + MON(NAM("Archon"), S_ANGEL, + LVL(19, 16, -6, 80, 15), (G_NOHELL | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_WEAP, AD_PHYS, 2, 4), + ATTK(AT_GAZE, AD_BLND, 2, 6), ATTK(AT_CLAW, AD_PHYS, 1, 8), + ATTK(AT_MAGC, AD_SPEL, 4, 6), NO_ATTK), + SIZ(WT_HUMAN, 400, MS_CUSS, MZ_LARGE), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_HUMANOID | M1_SEE_INVIS | M1_REGEN, + M2_NOPOLY | M2_MINION | M2_STALK | M2_STRONG | M2_NASTY | M2_LORD + | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 26, HI_LORD, ARCHON), + /* + * Bats and birds + */ + MON(NAM("bat"), S_BAT, + LVL(0, 22, 8, 0, 0), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(20, 20, MS_SQEEK, MZ_TINY), 0, 0, + M1_FLY | M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_WANDER, + M3_INFRAVISIBLE, 2, CLR_BROWN, BAT), + MON(NAM("giant bat"), S_BAT, + LVL(2, 22, 7, 0, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_SQEEK, MZ_SMALL), 0, 0, + M1_FLY | M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, + M2_WANDER | M2_HOSTILE, M3_INFRAVISIBLE, + 3, CLR_RED, GIANT_BAT), + MON(NAM("raven"), S_BAT, + LVL(4, 20, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_BLND, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(40, 20, MS_SQAWK, MZ_SMALL), 0, 0, + M1_FLY | M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_CARNIVORE, + M2_WANDER | M2_HOSTILE, M3_INFRAVISIBLE, 6, CLR_BLACK, RAVEN), + MON(NAM("vampire bat"), S_BAT, LVL(5, 20, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), ATTK(AT_BITE, AD_DRST, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 20, MS_SQEEK, MZ_SMALL), MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_ANIMAL | M1_NOHANDS | M1_POIS | M1_REGEN | M1_OMNIVORE, + M2_HOSTILE, M3_INFRAVISIBLE, + 7, CLR_BLACK, VAMPIRE_BAT), + /* + * Centaurs + */ + MON(NAM("plains centaur"), S_CENTAUR, + LVL(4, 18, 4, 0, 0), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_KICK, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2500, 500, MS_HUMANOID, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_STRONG | M2_GREEDY | M2_COLLECT, + M3_INFRAVISIBLE, 6, CLR_BROWN, PLAINS_CENTAUR), + MON(NAM("forest centaur"), S_CENTAUR, + LVL(5, 18, 3, 10, -1), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_KICK, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2550, 600, MS_HUMANOID, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_STRONG | M2_GREEDY | M2_COLLECT, + M3_INFRAVISIBLE, + 8, CLR_GREEN, FOREST_CENTAUR), + MON(NAM("mountain centaur"), S_CENTAUR, + LVL(6, 20, 2, 10, -3), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 10), ATTK(AT_KICK, AD_PHYS, 1, 6), + ATTK(AT_KICK, AD_PHYS, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2550, 500, MS_HUMANOID, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_STRONG | M2_GREEDY | M2_COLLECT, + M3_INFRAVISIBLE, + 9, CLR_CYAN, MOUNTAIN_CENTAUR), + /* + * Dragons + */ + /* The order of the dragons is VERY IMPORTANT. Quite a few + * pieces of code depend on gray being first and yellow being last. + * The code also depends on the *order* being the same as that for + * dragon scale mail and dragon scales in objects.c. [Also, + * 'tilemap' assumes that shimmering dragon follows silver dragon.] + * + * Adult dragons are all lawful or chaotic; baby dragons are all + * neutral. This affects monster generation on some special levels. + * Baby dragons cannot confer intrinsics, to avoid polyself/egg abuse. + * + * As reptiles, dragons are cold-blooded and thus aren't seen with + * infravision. Red and gold dragons (also Chromatic Dragon) are + * the exceptions because they breathe fire. + */ + MON(NAM("baby gray dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), 0, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_GRAY, BABY_GRAY_DRAGON), + MON(NAM("baby gold dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), 0, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, M3_INFRAVISIBLE, + 13, HI_GOLD, BABY_GOLD_DRAGON), + MON(NAM("baby silver dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), 0, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, DRAGON_SILVER, BABY_SILVER_DRAGON), +#if 0 /* DEFERRED */ + /* [see "shimmering dragon" below] */ + MON(NAM("baby shimmering dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), 0, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_CYAN, BABY_SHIMMERING_DRAGON), +#endif + MON(NAM("baby red dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_FIRE, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, M3_INFRAVISIBLE, + 13, CLR_RED, BABY_RED_DRAGON), + MON(NAM("baby white dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_COLD, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_WHITE, BABY_WHITE_DRAGON), + MON(NAM("baby orange dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_SLEEP, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_ORANGE, BABY_ORANGE_DRAGON), + MON(NAM("baby black dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_DISINT, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_BLACK, BABY_BLACK_DRAGON), + MON(NAM("baby blue dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_ELEC, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_BLUE, BABY_BLUE_DRAGON), + MON(NAM("baby green dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_POISON, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE | M1_POIS, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_GREEN, BABY_GREEN_DRAGON), + MON(NAM("baby yellow dragon"), S_DRAGON, + LVL(12, 9, 2, 10, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_BABY_DRAGON, 500, MS_ROAR, MZ_HUGE), MR_ACID | MR_STONE, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE | M1_ACID, + M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, + 13, CLR_YELLOW, BABY_YELLOW_DRAGON), + MON(NAM("gray dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 4), (G_GENO | 1), + A(ATTK(AT_BREA, AD_MAGM, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), 0, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_GRAY, GRAY_DRAGON), + /* gold dragon can be seen via infravision but doesn't have infravision */ + MON(NAM("gold dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 4), (G_GENO | 1), + A(ATTK(AT_BREA, AD_FIRE, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_FIRE, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + M3_INFRAVISIBLE, + 20, HI_GOLD, GOLD_DRAGON), + MON(NAM("silver dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 4), (G_GENO | 1), + A(ATTK(AT_BREA, AD_COLD, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_COLD, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, DRAGON_SILVER, SILVER_DRAGON), +#if 0 /* DEFERRED */ + /* shimmering scales/scale-mail would confer displacement when worn by + the hero, so shimmering dragon ought to be displaced (hero who can + see one might misjudge its location) but monster displacement hasn't + been implemented so we don't include it */ + MON(NAM("shimmering dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 4), (G_GENO | 1), + A(ATTK(AT_BREA, AD_MAGM, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), 0, 0, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_CYAN, SHIMMERING_DRAGON), +#endif + /* red dragon has infravision and can be seen via infravision */ + MON(NAM("red dragon"), S_DRAGON, + LVL(15, 9, -1, 20, -4), (G_GENO | 1), + A(ATTK(AT_BREA, AD_FIRE, 6, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_FIRE, MR_FIRE, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + M3_INFRAVISION | M3_INFRAVISIBLE, + 20, CLR_RED, RED_DRAGON), + MON(NAM("white dragon"), S_DRAGON, + LVL(15, 9, -1, 20, -5), (G_GENO | 1), + A(ATTK(AT_BREA, AD_COLD, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_COLD, MR_COLD, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_WHITE, WHITE_DRAGON), + MON(NAM("orange dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 5), (G_GENO | 1), + A(ATTK(AT_BREA, AD_SLEE, 4, 25), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_SLEEP, MR_SLEEP, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_ORANGE, ORANGE_DRAGON), + /* disintegration breath is actually all or nothing, not 1d255 */ + MON(NAM("black dragon"), S_DRAGON, + LVL(15, 9, -1, 20, -6), (G_GENO | 1), + A(ATTK(AT_BREA, AD_DISN, 1, 255), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_DISINT, MR_DISINT, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_BLACK, BLACK_DRAGON), + MON(NAM("blue dragon"), S_DRAGON, + LVL(15, 9, -1, 20, -7), (G_GENO | 1), + A(ATTK(AT_BREA, AD_ELEC, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_ELEC, MR_ELEC, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_BLUE, BLUE_DRAGON), + MON(NAM("green dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 6), (G_GENO | 1), + A(ATTK(AT_BREA, AD_DRST, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), MR_POISON, MR_POISON, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS + | M1_CARNIVORE | M1_POIS, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_GREEN, GREEN_DRAGON), + MON(NAM("yellow dragon"), S_DRAGON, + LVL(15, 9, -1, 20, 7), (G_GENO | 1), + A(ATTK(AT_BREA, AD_ACID, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), + MR_ACID | MR_STONE, MR_ACID | MR_STONE, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS + | M1_OVIPAROUS | M1_CARNIVORE | M1_ACID, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC, + 0, + 20, CLR_YELLOW, YELLOW_DRAGON), + /* + * Elementals + */ + MON(NAM("stalker"), S_ELEMENTAL, + LVL(8, 12, 3, 0, 0), (G_GENO | 3), + A(ATTK(AT_CLAW, AD_PHYS, 4, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 400, MS_SILENT, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_FLY | M1_SEE_INVIS, + M2_WANDER | M2_STALK | M2_HOSTILE | M2_STRONG, M3_INFRAVISION, + 9, CLR_WHITE, STALKER), + MON(NAM("air elemental"), S_ELEMENTAL, + LVL(8, 36, 2, 30, 0), (G_NOCORPSE | 1), + A(ATTK(AT_ENGL, AD_PHYS, 1, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), MR_POISON | MR_STONE, 0, + M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS | M1_BREATHLESS + | M1_UNSOLID | M1_FLY, + M2_STRONG | M2_NEUTER, 0, + 10, CLR_CYAN, AIR_ELEMENTAL), + MON(NAM("fire elemental"), S_ELEMENTAL, + LVL(8, 12, 2, 30, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_FIRE, 3, 6), ATTK(AT_NONE, AD_FIRE, 0, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUGE), MR_FIRE | MR_POISON | MR_STONE, 0, + M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS | M1_BREATHLESS + | M1_UNSOLID | M1_FLY | M1_NOTAKE, + M2_STRONG | M2_NEUTER, M3_INFRAVISIBLE, + 10, CLR_YELLOW, FIRE_ELEMENTAL), + MON(NAM("earth elemental"), S_ELEMENTAL, + LVL(8, 6, 2, 30, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2500, 0, MS_SILENT, MZ_HUGE), + MR_FIRE | MR_COLD | MR_POISON | MR_STONE, 0, + M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS | M1_BREATHLESS + | M1_WALLWALK | M1_THICK_HIDE, + M2_STRONG | M2_NEUTER, 0, + 10, CLR_BROWN, EARTH_ELEMENTAL), + MON(NAM("water elemental"), S_ELEMENTAL, + LVL(8, 5, 2, 30, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 5, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2500, 0, MS_SILENT, MZ_HUGE), MR_POISON | MR_STONE, 0, + M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS | M1_BREATHLESS + | M1_UNSOLID | M1_AMPHIBIOUS | M1_SWIM, + M2_STRONG | M2_NEUTER, 0, + 10, CLR_BLUE, WATER_ELEMENTAL), + /* + * Fungi + */ + MON(NAM("lichen"), S_FUNGUS, + LVL(0, 1, 9, 0, 0), (G_GENO | 4), + A(ATTK(AT_TUCH, AD_STCK, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(20, 200, MS_SILENT, MZ_SMALL), 0, 0, + M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 1, CLR_BRIGHT_GREEN, LICHEN), + MON(NAM("brown mold"), S_FUNGUS, + LVL(1, 0, 9, 0, 0), (G_GENO | 1), + A(ATTK(AT_NONE, AD_COLD, 0, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 30, MS_SILENT, MZ_SMALL), MR_COLD | MR_POISON, + MR_COLD | MR_POISON, M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS + | M1_NOHEAD | M1_MINDLESS | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 2, CLR_BROWN, BROWN_MOLD), + MON(NAM("yellow mold"), S_FUNGUS, + LVL(1, 0, 9, 0, 0), (G_GENO | 2), + A(ATTK(AT_NONE, AD_STUN, 0, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 30, MS_SILENT, MZ_SMALL), MR_POISON, MR_POISON, + M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_POIS | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 2, CLR_YELLOW, YELLOW_MOLD), + MON(NAM("green mold"), S_FUNGUS, + LVL(1, 0, 9, 0, 0), (G_GENO | 1), + A(ATTK(AT_NONE, AD_ACID, 0, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 30, MS_SILENT, MZ_SMALL), + MR_ACID | MR_STONE, MR_ACID | MR_STONE, + M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_ACID | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 2, CLR_GREEN, GREEN_MOLD), + MON(NAM("red mold"), S_FUNGUS, + LVL(1, 0, 9, 0, 0), (G_GENO | 1), + A(ATTK(AT_NONE, AD_FIRE, 0, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 30, MS_SILENT, MZ_SMALL), MR_FIRE | MR_POISON, + MR_FIRE | MR_POISON, M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS + | M1_NOHEAD | M1_MINDLESS | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, + 2, CLR_RED, RED_MOLD), + MON(NAM("shrieker"), S_FUNGUS, + LVL(3, 1, 7, 0, 0), (G_GENO | 1), + A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 100, MS_SHRIEK, MZ_SMALL), MR_POISON, MR_POISON, + M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 2, CLR_MAGENTA, SHRIEKER), + MON(NAM("violet fungus"), S_FUNGUS, + LVL(3, 1, 7, 0, 0), (G_GENO | 2), + A(ATTK(AT_TUCH, AD_PHYS, 1, 4), ATTK(AT_TUCH, AD_STCK, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 100, MS_SILENT, MZ_SMALL), MR_POISON, MR_POISON, + M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS + | M1_NOTAKE, + M2_HOSTILE | M2_NEUTER, 0, + 5, CLR_MAGENTA, VIOLET_FUNGUS), + /* + * Gnomes + * Unlike plain human|elf|orc, plain "gnome" is an ordinary monster. + */ + MON(NAM("gnome"), S_GNOME, + LVL(1, 6, 10, 4, 0), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(650, 100, MS_ORC, MZ_SMALL), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_GNOME | M2_COLLECT, M3_INFRAVISIBLE | M3_INFRAVISION, + 3, CLR_BROWN, GNOME), + MON(NAMS("gnome lord", "gnome lady", "gnome leader"), + S_GNOME, LVL(3, 8, 10, 4, 0), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(700, 120, MS_ORC, MZ_SMALL), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_GNOME | M2_LORD | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, 4, CLR_BLUE, GNOME_LEADER), + MON(NAM("gnomish wizard"), S_GNOME, + LVL(3, 10, 4, 10, 0), (G_GENO | 1), + A(ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(700, 120, MS_ORC, MZ_SMALL), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_GNOME | M2_MAGIC, M3_INFRAVISIBLE | M3_INFRAVISION, + 5, HI_ZAP, GNOMISH_WIZARD), + MON(NAMS("gnome king", "gnome queen", "gnome ruler"), + S_GNOME, LVL(5, 10, 10, 20, 0), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(750, 150, MS_ORC, MZ_SMALL), 0, 0, M1_HUMANOID | M1_OMNIVORE, + M2_GNOME | M2_PRINCE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 6, HI_LORD, GNOME_RULER), + /* + * giant Humanoids + */ + /* plain giant is a placeholder for zombie and mummy corpses */ + MON(NAM("giant"), S_GIANT, + LVL(6, 6, 0, 0, 2), (G_GENO | G_NOGEN | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2250, 750, MS_BOAST, MZ_HUGE), 0, 0, M1_HUMANOID | M1_CARNIVORE, + M2_GIANT | M2_STRONG | M2_ROCKTHROW | M2_NASTY | M2_COLLECT + | M2_JEWELS, + M3_INFRAVISIBLE | M3_INFRAVISION, 8, CLR_RED, GIANT), + MON(NAM("stone giant"), S_GIANT, + LVL(6, 6, 0, 0, 2), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2250, 750, MS_BOAST, MZ_HUGE), 0, 0, M1_HUMANOID | M1_CARNIVORE, + M2_GIANT | M2_STRONG | M2_ROCKTHROW | M2_NASTY | M2_COLLECT + | M2_JEWELS, + M3_INFRAVISIBLE | M3_INFRAVISION, + 8, CLR_GRAY, STONE_GIANT), + MON(NAM("hill giant"), S_GIANT, + LVL(8, 10, 6, 0, -2), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2200, 700, MS_BOAST, MZ_HUGE), 0, 0, M1_HUMANOID | M1_CARNIVORE, + M2_GIANT | M2_STRONG | M2_ROCKTHROW | M2_NASTY | M2_COLLECT + | M2_JEWELS, + M3_INFRAVISIBLE | M3_INFRAVISION, + 10, CLR_CYAN, HILL_GIANT), + MON(NAM("fire giant"), S_GIANT, + LVL(9, 12, 4, 5, 2), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2250, 750, MS_BOAST, MZ_HUGE), MR_FIRE, MR_FIRE, + M1_HUMANOID | M1_CARNIVORE, M2_GIANT | M2_STRONG | M2_ROCKTHROW + | M2_NASTY | M2_COLLECT | M2_JEWELS, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_YELLOW, FIRE_GIANT), + MON(NAM("frost giant"), S_GIANT, + LVL(10, 12, 3, 10, -3), (G_NOHELL | G_GENO | G_SGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 12), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2250, 750, MS_BOAST, MZ_HUGE), MR_COLD, MR_COLD, + M1_HUMANOID | M1_CARNIVORE, M2_GIANT | M2_STRONG | M2_ROCKTHROW + | M2_NASTY | M2_COLLECT | M2_JEWELS, + M3_INFRAVISIBLE | M3_INFRAVISION, + 13, CLR_WHITE, FROST_GIANT), + /* ettin is a two-headed giant but its corpse doesn't confer strength */ + MON(NAM("ettin"), S_GIANT, + LVL(10, 12, 3, 0, 0), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 8), ATTK(AT_WEAP, AD_PHYS, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1700, 500, MS_GRUNT, MZ_HUGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 13, CLR_BROWN, ETTIN), + MON(NAM("storm giant"), S_GIANT, + LVL(16, 12, 3, 10, -3), (G_GENO | G_SGROUP | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 12), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2250, 750, MS_BOAST, MZ_HUGE), MR_ELEC, MR_ELEC, + M1_HUMANOID | M1_CARNIVORE, M2_GIANT | M2_STRONG | M2_ROCKTHROW + | M2_NASTY | M2_COLLECT | M2_JEWELS, + M3_INFRAVISIBLE | M3_INFRAVISION, + 19, CLR_BLUE, STORM_GIANT), + MON(NAM("titan"), S_GIANT, + LVL(16, 18, -3, 70, 9), (1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 8), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2300, 900, MS_SPELL, MZ_HUGE), 0, 0, + M1_FLY | M1_HUMANOID | M1_OMNIVORE, + M2_STRONG | M2_ROCKTHROW | M2_NASTY | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE | M3_INFRAVISION, + 20, CLR_MAGENTA, TITAN), + MON(NAM("minotaur"), S_GIANT, + LVL(15, 15, 6, 0, 0), (G_GENO | G_NOGEN), + A(ATTK(AT_CLAW, AD_PHYS, 3, 10), ATTK(AT_CLAW, AD_PHYS, 3, 10), + ATTK(AT_BUTT, AD_PHYS, 2, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 700, MS_MOO, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY, M3_INFRAVISIBLE | M3_INFRAVISION, + 17, CLR_BROWN, MINOTAUR), + /* + * Invisible + * S_invisible=='I' is a visual marker for all invisible monsters + * and must be not be used for any specific monster types. Long + * time 'invisible stalker' was changed to 'stalker', an Elemental. + */ + + /* + * Jabberwock + */ + /* the illustration from _Through_the_Looking_Glass_ + depicts hands as well as wings */ + MON(NAM("jabberwock"), S_JABBERWOCK, + LVL(15, 12, -2, 50, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 10), ATTK(AT_BITE, AD_PHYS, 2, 10), + ATTK(AT_CLAW, AD_PHYS, 2, 10), ATTK(AT_CLAW, AD_PHYS, 2, 10), + NO_ATTK, NO_ATTK), + SIZ(1300, 600, MS_BURBLE, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_FLY | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_COLLECT, M3_INFRAVISIBLE, + 18, CLR_ORANGE, JABBERWOCK), +#if 0 /* DEFERRED */ + MON(NAM("vorpal jabberwock"), S_JABBERWOCK, + LVL(20, 12, -2, 50, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 3, 10), ATTK(AT_BITE, AD_PHYS, 3, 10), + ATTK(AT_CLAW, AD_PHYS, 3, 10), ATTK(AT_CLAW, AD_PHYS, 3, 10), + NO_ATTK, NO_ATTK), + SIZ(1300, 600, MS_BURBLE, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_FLY | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY | M2_COLLECT, M3_INFRAVISIBLE, + 25, HI_LORD, VORPAL_JABBERWOCK), +#endif + /* + * Kops + */ + MON(NAM("Keystone Kop"), S_KOP, + LVL(1, 6, 10, 10, 9), (G_GENO | G_LGROUP | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 200, MS_ARREST, MZ_HUMAN), 0, 0, M1_HUMANOID, + M2_HUMAN | M2_WANDER | M2_HOSTILE | M2_MALE | M2_COLLECT, + M3_INFRAVISIBLE, + 3, CLR_BLUE, KEYSTONE_KOP), + MON(NAM("Kop Sergeant"), S_KOP, + LVL(2, 8, 10, 10, 10), (G_GENO | G_SGROUP | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 200, MS_ARREST, MZ_HUMAN), 0, 0, M1_HUMANOID, + M2_HUMAN | M2_WANDER | M2_HOSTILE | M2_STRONG | M2_MALE | M2_COLLECT, + M3_INFRAVISIBLE, + 4, CLR_BLUE, KOP_SERGEANT), + MON(NAM("Kop Lieutenant"), S_KOP, + LVL(3, 10, 10, 20, 11), (G_GENO | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 200, MS_ARREST, MZ_HUMAN), 0, 0, M1_HUMANOID, + M2_HUMAN | M2_WANDER | M2_HOSTILE | M2_STRONG | M2_MALE | M2_COLLECT, + M3_INFRAVISIBLE, + 5, CLR_CYAN, KOP_LIEUTENANT), + MON(NAM("Kop Kaptain"), S_KOP, + LVL(4, 12, 10, 20, 12), (G_GENO | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 200, MS_ARREST, MZ_HUMAN), 0, 0, M1_HUMANOID, + M2_HUMAN | M2_WANDER | M2_HOSTILE | M2_STRONG | M2_MALE | M2_COLLECT, + M3_INFRAVISIBLE, + 6, HI_LORD, KOP_KAPTAIN), + /* + * Liches + */ + MON(NAM("lich"), S_LICH, + LVL(11, 6, 0, 30, -9), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_TUCH, AD_COLD, 1, 10), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 100, MS_MUMBLE, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, + MR_COLD, M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_HOSTILE | M2_MAGIC, M3_INFRAVISION, + 14, CLR_BROWN, LICH), + MON(NAM("demilich"), S_LICH, + LVL(14, 9, -2, 60, -12), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_TUCH, AD_COLD, 3, 4), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 100, MS_MUMBLE, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, + MR_COLD, M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_HOSTILE | M2_MAGIC, M3_INFRAVISION, + 18, CLR_RED, DEMILICH), + MON(NAM("master lich"), S_LICH, + LVL(17, 9, -4, 90, -15), (G_HELL | G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_TUCH, AD_COLD, 3, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 100, MS_MUMBLE, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_SLEEP | MR_POISON, MR_FIRE | MR_COLD, + M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_HOSTILE | M2_MAGIC, M3_WANTSBOOK | M3_INFRAVISION, + 21, HI_LORD, MASTER_LICH), + MON(NAM("arch-lich"), S_LICH, + LVL(25, 9, -6, 90, -15), (G_HELL | G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_TUCH, AD_COLD, 5, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 100, MS_MUMBLE, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_SLEEP | MR_ELEC | MR_POISON, MR_FIRE | MR_COLD, + M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_HOSTILE | M2_MAGIC, M3_WANTSBOOK | M3_INFRAVISION, + 29, HI_LORD, ARCH_LICH), + /* + * Mummies + */ + MON(NAM("kobold mummy"), S_MUMMY, + LVL(3, 8, 6, 20, -2), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 50, MS_SILENT, MZ_SMALL), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE, M3_INFRAVISION, + 4, CLR_BROWN, KOBOLD_MUMMY), + MON(NAM("gnome mummy"), S_MUMMY, + LVL(4, 10, 6, 20, -3), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(650, 50, MS_SILENT, MZ_SMALL), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE | M2_GNOME, M3_INFRAVISION, + 5, CLR_RED, GNOME_MUMMY), + MON(NAM("orc mummy"), S_MUMMY, + LVL(5, 10, 5, 20, -4), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(850, 75, MS_SILENT, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE | M2_STRONG | M2_ORC | M2_GREEDY | M2_JEWELS, + M3_INFRAVISION, + 6, CLR_GRAY, ORC_MUMMY), + MON(NAM("dwarf mummy"), S_MUMMY, + LVL(5, 10, 5, 20, -4), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 150, MS_SILENT, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE | M2_DWARF | M2_GREEDY | M2_JEWELS, + M3_INFRAVISION, + 6, CLR_RED, DWARF_MUMMY), + MON(NAM("elf mummy"), S_MUMMY, + LVL(6, 12, 4, 30, -5), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 175, MS_SILENT, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, + 0, M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE | M2_ELF, M3_INFRAVISION, + 7, CLR_GREEN, ELF_MUMMY), + MON(NAM("human mummy"), S_MUMMY, + LVL(6, 12, 4, 30, -5), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 200, MS_SILENT, MZ_HUMAN), + MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE, M3_INFRAVISION, + 7, CLR_GRAY, HUMAN_MUMMY), + MON(NAM("ettin mummy"), S_MUMMY, + LVL(7, 12, 4, 30, -6), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 6), ATTK(AT_CLAW, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1700, 250, MS_SILENT, MZ_HUGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE | M2_STRONG, M3_INFRAVISION, + 8, CLR_BLUE, ETTIN_MUMMY), + MON(NAM("giant mummy"), S_MUMMY, + LVL(8, 14, 3, 30, -7), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 3, 4), ATTK(AT_CLAW, AD_PHYS, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2050, 375, MS_SILENT, MZ_HUGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_HOSTILE | M2_GIANT | M2_STRONG | M2_JEWELS, + M3_INFRAVISION, + 10, CLR_CYAN, GIANT_MUMMY), + /* + * Nagas + */ + MON(NAM("red naga hatchling"), S_NAGA, + LVL(3, 10, 6, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 100, MS_MUMBLE, MZ_LARGE), MR_FIRE | MR_POISON, MR_POISON, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_NOTAKE | M1_OMNIVORE, + M2_STRONG, M3_INFRAVISIBLE, + 4, CLR_RED, RED_NAGA_HATCHLING), + MON(NAM("black naga hatchling"), S_NAGA, + LVL(3, 10, 6, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 100, MS_MUMBLE, MZ_LARGE), + MR_POISON | MR_ACID | MR_STONE, MR_POISON, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_ACID | M1_NOTAKE + | M1_CARNIVORE, + M2_STRONG, 0, + 4, CLR_BLACK, BLACK_NAGA_HATCHLING), + MON(NAM("golden naga hatchling"), S_NAGA, + LVL(3, 10, 6, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 100, MS_MUMBLE, MZ_LARGE), MR_POISON, MR_POISON, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_NOTAKE | M1_OMNIVORE, + M2_STRONG, 0, + 4, HI_GOLD, GOLDEN_NAGA_HATCHLING), + MON(NAM("guardian naga hatchling"), S_NAGA, + LVL(3, 10, 6, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 100, MS_MUMBLE, MZ_LARGE), MR_POISON, MR_POISON, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_NOTAKE | M1_OMNIVORE, + M2_STRONG, 0, + 4, CLR_GREEN, GUARDIAN_NAGA_HATCHLING), + MON(NAM("red naga"), S_NAGA, + LVL(6, 12, 4, 0, -4), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_BREA, AD_FIRE, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_FIRE | MR_POISON, + MR_FIRE | MR_POISON, M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE + | M1_OVIPAROUS | M1_NOTAKE | M1_OMNIVORE, + M2_STRONG, M3_INFRAVISIBLE, + 8, CLR_RED, RED_NAGA), + MON(NAM("black naga"), S_NAGA, + LVL(8, 14, 2, 10, 4), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_SPIT, AD_ACID, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), + MR_POISON | MR_ACID | MR_STONE, MR_POISON | MR_ACID | MR_STONE, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_ACID + | M1_NOTAKE | M1_CARNIVORE, + M2_STRONG, 0, + 10, CLR_BLACK, BLACK_NAGA), + MON(NAM("golden naga"), S_NAGA, + LVL(10, 14, 2, 70, 5), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_MAGC, AD_SPEL, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_POISON, MR_POISON, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_NOTAKE + | M1_OMNIVORE, + M2_STRONG, 0, + 13, HI_GOLD, GOLDEN_NAGA), + /* 5.0: guardian naga used to have three attacks: bite, spit, hug + but in order for the hug to succeed the two preceding attacks had + to have hit, and it's not possible to both bite and spit, hence + the hug never hit; change to spit, bite, touch, hug; if the bite + and touch hit, the hug will too */ + MON(NAM("guardian naga"), S_NAGA, + LVL(12, 16, 0, 50, 7), (G_GENO | 1), + A(ATTK(AT_SPIT, AD_DRST, 1, 6), ATTK(AT_BITE, AD_PLYS, 1, 6), + ATTK(AT_TUCH, AD_PHYS, 0, 0), ATTK(AT_HUGS, AD_WRAP, 2, 4), + NO_ATTK, NO_ATTK), + SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_POISON, MR_POISON, + M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_POIS + | M1_NOTAKE | M1_OMNIVORE, + M2_STRONG, 0, + 17, CLR_GREEN, GUARDIAN_NAGA), + /* + * Ogres + */ + MON(NAM("ogre"), S_OGRE, + LVL(5, 10, 5, 0, -3), (G_SGROUP | G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 5), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1600, 500, MS_GRUNT, MZ_LARGE), 0, 0, M1_HUMANOID | M1_CARNIVORE, + M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 7, CLR_BROWN, OGRE), + MON(NAMS("ogre lord", "ogre lady", "ogre leader"), S_OGRE, + LVL(7, 12, 3, 30, -5), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1700, 700, MS_GRUNT, MZ_LARGE), 0, 0, M1_HUMANOID | M1_CARNIVORE, + M2_STRONG | M2_LORD | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 9, CLR_RED, OGRE_LEADER), + MON(NAMS("ogre king", "ogre queen", "ogre tyrant"), S_OGRE, + LVL(9, 14, 4, 60, -7), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 3, 5), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1700, 750, MS_GRUNT, MZ_LARGE), 0, 0, M1_HUMANOID | M1_CARNIVORE, + M2_STRONG | M2_PRINCE | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, HI_LORD, OGRE_TYRANT), + /* + * Puddings + * + * must be in the same order as the pudding globs in objects.c + */ + MON(NAM("gray ooze"), S_PUDDING, + LVL(3, 1, 8, 0, 0), (G_GENO | G_NOCORPSE | 2), + A(ATTK(AT_BITE, AD_RUST, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 250, MS_SILENT, MZ_MEDIUM), + MR_FIRE | MR_COLD | MR_POISON | MR_ACID | MR_STONE, + MR_FIRE | MR_COLD | MR_POISON, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_OMNIVORE | M1_ACID, + M2_HOSTILE | M2_NEUTER, 0, + 4, CLR_GRAY, GRAY_OOZE), + MON(NAM("brown pudding"), S_PUDDING, + LVL(5, 3, 8, 0, 0), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_BITE, AD_DCAY, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 250, MS_SILENT, MZ_MEDIUM), + MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE, + MR_COLD | MR_ELEC | MR_POISON, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_OMNIVORE | M1_ACID, + M2_HOSTILE | M2_NEUTER, 0, + 6, CLR_BROWN, BROWN_PUDDING), + MON(NAM("green slime"), S_PUDDING, + LVL(6, 6, 6, 0, 0), (G_HELL | G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_TUCH, AD_SLIM, 1, 4), ATTK(AT_NONE, AD_SLIM, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 150, MS_SILENT, MZ_LARGE), + MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE, MR_ACID | MR_STONE, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_OMNIVORE | M1_ACID | M1_POIS, + M2_HOSTILE | M2_NEUTER, 0, + 8, CLR_GREEN, GREEN_SLIME), + MON(NAM("black pudding"), S_PUDDING, + LVL(10, 6, 6, 0, 0), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_BITE, AD_CORR, 3, 8), ATTK(AT_NONE, AD_CORR, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 250, MS_SILENT, MZ_LARGE), + MR_COLD | MR_ELEC | MR_POISON | MR_ACID | MR_STONE, + MR_COLD | MR_ELEC | MR_POISON, + M1_BREATHLESS | M1_AMORPHOUS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD + | M1_MINDLESS | M1_OMNIVORE | M1_ACID, + M2_HOSTILE | M2_NEUTER, 0, + 12, CLR_BLACK, BLACK_PUDDING), + /* + * Quantum mechanics + */ + MON(NAM("quantum mechanic"), S_QUANTMECH, + LVL(7, 12, 3, 10, 0), (G_GENO | 3), + A(ATTK(AT_CLAW, AD_TLPT, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 20, MS_HUMANOID, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE | M1_POIS | M1_TPORT, M2_HOSTILE, + M3_INFRAVISIBLE, + 9, CLR_CYAN, QUANTUM_MECHANIC), + /* 5.0: from slash'em, to expand Q class; hit polymorphs target */ + MON(NAM("genetic engineer"), S_QUANTMECH, + LVL(12, 12, 3, 10, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_POLY, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 20, MS_HUMANOID, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE | M1_POIS | M1_TPORT, M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE, + 14, CLR_GREEN, GENETIC_ENGINEER), + /* + * Rust monster or disenchanter + */ + MON(NAM("rust monster"), S_RUSTMONST, + LVL(5, 18, 2, 0, 0), (G_GENO | 2), + A(ATTK(AT_TUCH, AD_RUST, 0, 0), ATTK(AT_TUCH, AD_RUST, 0, 0), + ATTK(AT_NONE, AD_RUST, 0, 0), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 250, MS_SILENT, MZ_MEDIUM), 0, 0, + M1_SWIM | M1_ANIMAL | M1_NOHANDS | M1_METALLIVORE, M2_HOSTILE, + M3_INFRAVISIBLE, + 8, CLR_BROWN, RUST_MONSTER), + MON(NAM("disenchanter"), S_RUSTMONST, + LVL(12, 12, -10, 0, -3), (G_HELL | G_GENO | 2), + A(ATTK(AT_CLAW, AD_ENCH, 4, 4), ATTK(AT_NONE, AD_ENCH, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(750, 200, MS_GROWL, MZ_LARGE), 0, 0, M1_ANIMAL | M1_CARNIVORE, + M2_HOSTILE, M3_INFRAVISIBLE, + 14, CLR_BLUE, DISENCHANTER), + /* + * Snakes + * Note: in the real world, most snakes are oviparous but some aren't; + * we treat all of these as if they are. + */ + MON(NAM("garter snake"), S_SNAKE, + LVL(1, 8, 8, 0, 0), (G_LGROUP | G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(50, 60, MS_HISS, MZ_TINY), 0, 0, + M1_SWIM | M1_CONCEAL | M1_NOLIMBS | M1_ANIMAL | M1_SLITHY + | M1_OVIPAROUS | M1_CARNIVORE | M1_NOTAKE, + 0, 0, + 3, CLR_GREEN, GARTER_SNAKE), + MON(NAM("snake"), S_SNAKE, + LVL(4, 15, 3, 0, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_DRST, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 80, MS_HISS, MZ_SMALL), MR_POISON, MR_POISON, + M1_SWIM | M1_CONCEAL | M1_NOLIMBS | M1_ANIMAL | M1_SLITHY | M1_POIS + | M1_OVIPAROUS | M1_CARNIVORE | M1_NOTAKE, + M2_HOSTILE, 0, + 6, CLR_BROWN, SNAKE), + MON(NAM("water moccasin"), S_SNAKE, + LVL(4, 15, 3, 0, 0), (G_GENO | G_NOGEN | G_LGROUP), + A(ATTK(AT_BITE, AD_DRST, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(150, 80, MS_HISS, MZ_SMALL), MR_POISON, MR_POISON, + M1_SWIM | M1_CONCEAL | M1_NOLIMBS | M1_ANIMAL | M1_SLITHY | M1_POIS + | M1_CARNIVORE | M1_OVIPAROUS | M1_NOTAKE, + M2_HOSTILE, 0, + 7, CLR_RED, WATER_MOCCASIN), + MON(NAM("python"), S_SNAKE, + LVL(6, 3, 5, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 1, 4), ATTK(AT_TUCH, AD_PHYS, 0, 0), + ATTK(AT_HUGS, AD_WRAP, 1, 4), ATTK(AT_HUGS, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK), + SIZ(250, 100, MS_HISS, MZ_LARGE), 0, 0, + M1_SWIM | M1_NOLIMBS | M1_ANIMAL | M1_SLITHY | M1_CARNIVORE + | M1_OVIPAROUS | M1_NOTAKE, + M2_HOSTILE | M2_STRONG, M3_INFRAVISION, + 8, CLR_MAGENTA, PYTHON), + MON(NAM("pit viper"), S_SNAKE, + LVL(6, 15, 2, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_DRST, 1, 4), ATTK(AT_BITE, AD_DRST, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 60, MS_HISS, MZ_MEDIUM), MR_POISON, MR_POISON, + M1_SWIM | M1_CONCEAL | M1_NOLIMBS | M1_ANIMAL | M1_SLITHY | M1_POIS + | M1_CARNIVORE | M1_OVIPAROUS | M1_NOTAKE, + M2_HOSTILE, M3_INFRAVISION, + 9, CLR_BLUE, PIT_VIPER), + MON(NAM("cobra"), S_SNAKE, + LVL(6, 18, 2, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_DRST, 2, 4), ATTK(AT_SPIT, AD_BLND, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(250, 100, MS_HISS, MZ_MEDIUM), MR_POISON, MR_POISON, + M1_SWIM | M1_CONCEAL | M1_NOLIMBS | M1_ANIMAL | M1_SLITHY | M1_POIS + | M1_CARNIVORE | M1_OVIPAROUS | M1_NOTAKE, + M2_HOSTILE, 0, + 10, CLR_BLUE, COBRA), + /* + * Trolls + */ + MON(NAM("troll"), S_TROLL, + LVL(7, 12, 4, 0, -3), (G_GENO | 2), + A(ATTK(AT_WEAP, AD_PHYS, 4, 2), ATTK(AT_CLAW, AD_PHYS, 4, 2), + ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(800, 350, MS_GRUNT, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_REGEN | M1_CARNIVORE, + M2_STRONG | M2_STALK | M2_HOSTILE, M3_INFRAVISIBLE | M3_INFRAVISION, + 9, CLR_BROWN, TROLL), + MON(NAM("ice troll"), S_TROLL, + LVL(9, 10, 2, 20, -3), (G_NOHELL | G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_CLAW, AD_COLD, 2, 6), + ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1000, 300, MS_GRUNT, MZ_LARGE), MR_COLD, MR_COLD, + M1_HUMANOID | M1_REGEN | M1_CARNIVORE, + M2_STRONG | M2_STALK | M2_HOSTILE, M3_INFRAVISIBLE | M3_INFRAVISION, + 12, CLR_WHITE, ICE_TROLL), + MON(NAM("rock troll"), S_TROLL, + LVL(9, 12, 0, 0, -3), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 3, 6), ATTK(AT_CLAW, AD_PHYS, 2, 8), + ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 300, MS_GRUNT, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_REGEN | M1_CARNIVORE, + M2_STRONG | M2_STALK | M2_HOSTILE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 12, CLR_CYAN, ROCK_TROLL), + MON(NAM("water troll"), S_TROLL, + LVL(11, 14, 4, 40, -3), (G_NOGEN | G_GENO), + A(ATTK(AT_WEAP, AD_PHYS, 2, 8), ATTK(AT_CLAW, AD_PHYS, 2, 8), + ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1200, 350, MS_GRUNT, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_REGEN | M1_CARNIVORE | M1_SWIM, + M2_STRONG | M2_STALK | M2_HOSTILE, M3_INFRAVISIBLE | M3_INFRAVISION, + 13, CLR_BLUE, WATER_TROLL), + MON(NAM("Olog-hai"), S_TROLL, + LVL(13, 12, -4, 0, -7), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 3, 6), ATTK(AT_CLAW, AD_PHYS, 2, 8), + ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 400, MS_GRUNT, MZ_LARGE), 0, 0, + M1_HUMANOID | M1_REGEN | M1_CARNIVORE, + M2_STRONG | M2_STALK | M2_HOSTILE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 16, HI_LORD, OLOG_HAI), + /* + * Umber hulk + */ + MON(NAM("umber hulk"), S_UMBER, + LVL(9, 6, 2, 25, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 3, 4), ATTK(AT_CLAW, AD_PHYS, 3, 4), + ATTK(AT_BITE, AD_PHYS, 2, 5), ATTK(AT_GAZE, AD_CONF, 0, 0), + NO_ATTK, NO_ATTK), + SIZ(1200, 500, MS_SILENT, MZ_LARGE), 0, 0, M1_TUNNEL | M1_CARNIVORE, + M2_STRONG, M3_INFRAVISIBLE, + 12, CLR_BROWN, UMBER_HULK), + /* + * Vampires + */ + MON(NAM("vampire"), S_VAMPIRE, + LVL(10, 12, 1, 25, -8), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_BITE, AD_DRLI, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_VAMPIRE, MZ_HUMAN), MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY + | M2_SHAPESHIFTER, + M3_INFRAVISIBLE, + 12, CLR_RED, VAMPIRE), + MON(NAMS("vampire lord", "vampire lady", "vampire leader"), S_VAMPIRE, + LVL(12, 14, 0, 50, -9), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 8), ATTK(AT_BITE, AD_DRLI, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_VAMPIRE, MZ_HUMAN), MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY | M2_LORD + | M2_SHAPESHIFTER, + M3_INFRAVISIBLE, + 14, CLR_BLUE, VAMPIRE_LEADER), +#if 0 /* DEFERRED */ + MON(NAM("vampire mage"), S_VAMPIRE, + LVL(20, 14, -4, 50, -9), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_DRLI, 2, 8), ATTK(AT_BITE, AD_DRLI, 1, 8), + ATTK(AT_MAGC, AD_SPEL, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_VAMPIRE, MZ_HUMAN), MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY | M2_LORD + | M2_MALE | M2_MAGIC | M2_SHAPESHIFTER, + M3_INFRAVISIBLE, + 26, HI_ZAP, VAMPIRE_MAGE), +#endif + MON(NAM("Vlad the Impaler"), S_VAMPIRE, + LVL(28, 26, -6, 80, -10), (G_NOGEN | G_NOCORPSE | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 2, 10), ATTK(AT_BITE, AD_DRLI, 1, 12), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_VAMPIRE, MZ_HUMAN), MR_SLEEP | MR_POISON, 0, + M1_FLY | M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN, + M2_NOPOLY | M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_PNAME | M2_STRONG + | M2_NASTY | M2_PRINCE | M2_MALE | M2_SHAPESHIFTER, + M3_WAITFORU | M3_WANTSCAND | M3_INFRAVISIBLE, + 32, HI_LORD, VLAD_THE_IMPALER), + /* + * Wraiths + */ + MON(NAM("barrow wight"), S_WRAITH, + LVL(3, 12, 5, 5, -3), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_DRLI, 0, 0), ATTK(AT_MAGC, AD_SPEL, 0, 0), + ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_TUCH, AD_COLD, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(1200, 0, MS_SPELL, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_HUMANOID, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_COLLECT, 0, + 8, CLR_GRAY, BARROW_WIGHT), + /* wraiths weigh 0 but can leave corpses */ + MON(NAM("wraith"), S_WRAITH, + LVL(6, 12, 4, 15, -6), (G_GENO | 2), + A(ATTK(AT_TUCH, AD_DRLI, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ETHEREAL, 0, MS_SILENT, MZ_HUMAN), + MR_COLD | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_BREATHLESS | M1_FLY | M1_HUMANOID | M1_UNSOLID, + M2_UNDEAD | M2_STALK | M2_HOSTILE, 0, + 8, CLR_BLACK, WRAITH), + MON(NAM("Nazgul"), S_WRAITH, + LVL(13, 12, 0, 25, -17), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_DRLI, 1, 4), ATTK(AT_BREA, AD_SLEE, 2, 25), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 0, MS_SPELL, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, + 0, M1_BREATHLESS | M1_HUMANOID | M1_SEE_INVIS, + M2_NOPOLY | M2_UNDEAD | M2_STALK | M2_STRONG | M2_HOSTILE | M2_MALE + | M2_COLLECT, + 0, 17, HI_LORD, NAZGUL), + /* + * Xorn + */ + MON(NAM("xorn"), S_XORN, + LVL(8, 9, -2, 20, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), + ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_BITE, AD_PHYS, 4, 6), + NO_ATTK, NO_ATTK), + SIZ(1200, 700, MS_ROAR, MZ_MEDIUM), MR_FIRE | MR_COLD | MR_STONE, + MR_STONE, + M1_BREATHLESS | M1_WALLWALK | M1_THICK_HIDE | M1_METALLIVORE, + M2_HOSTILE | M2_STRONG, 0, + 11, CLR_BROWN, XORN), + /* + * Apelike beasts + */ + /* tameable via banana; does not grow up into ape... + not flagged as domestic, so no guilt penalty for eating non-pet one */ + MON(NAM("monkey"), S_YETI, + LVL(2, 12, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_SITM, 0, 0), ATTK(AT_BITE, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 50, MS_GROWL, MZ_SMALL), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_OMNIVORE, 0, M3_INFRAVISIBLE, + 4, CLR_GRAY, MONKEY), + MON(NAM("ape"), S_YETI, + LVL(4, 12, 6, 0, 0), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), + ATTK(AT_BITE, AD_PHYS, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1100, 500, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_OMNIVORE, M2_STRONG, M3_INFRAVISIBLE, + 6, CLR_BROWN, APE), + MON(NAM("owlbear"), S_YETI, + LVL(5, 12, 5, 0, 0), (G_GENO | 3), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), + ATTK(AT_HUGS, AD_PHYS, 2, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1700, 700, MS_ROAR, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_CARNIVORE, + M2_HOSTILE | M2_STRONG | M2_NASTY, M3_INFRAVISIBLE, + 7, CLR_BROWN, OWLBEAR), + MON(NAM("yeti"), S_YETI, + LVL(5, 15, 6, 0, 0), (G_GENO | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), + ATTK(AT_BITE, AD_PHYS, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1600, 700, MS_GROWL, MZ_LARGE), MR_COLD, MR_COLD, + M1_ANIMAL | M1_HUMANOID | M1_CARNIVORE, M2_HOSTILE | M2_STRONG, + M3_INFRAVISIBLE, + 7, CLR_WHITE, YETI), + MON(NAM("carnivorous ape"), S_YETI, + LVL(6, 12, 6, 0, 0), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_HUGS, AD_PHYS, 1, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1250, 550, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_CARNIVORE, M2_HOSTILE | M2_STRONG, + M3_INFRAVISIBLE, + 8, CLR_BLACK, CARNIVOROUS_APE), + MON(NAM("sasquatch"), S_YETI, + LVL(7, 15, 6, 0, 2), (G_GENO | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), + ATTK(AT_KICK, AD_PHYS, 1, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1550, 750, MS_GROWL, MZ_LARGE), 0, 0, + M1_ANIMAL | M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, M2_STRONG, + M3_INFRAVISIBLE, + 9, CLR_GRAY, SASQUATCH), + /* + * Zombies + */ + MON(NAM("kobold zombie"), S_ZOMBIE, + LVL(0, 6, 10, 0, -2), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 50, MS_GROAN, MZ_SMALL), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_STALK | M2_HOSTILE, M3_INFRAVISION, + 1, CLR_BROWN, KOBOLD_ZOMBIE), + MON(NAM("gnome zombie"), S_ZOMBIE, + LVL(1, 6, 10, 0, -2), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 5), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(650, 50, MS_GROAN, MZ_SMALL), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_GNOME, M3_INFRAVISION, + 2, CLR_BROWN, GNOME_ZOMBIE), + MON(NAM("orc zombie"), S_ZOMBIE, + LVL(2, 6, 9, 0, -3), (G_GENO | G_SGROUP | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(850, 75, MS_GROAN, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_ORC, M3_INFRAVISION, + 3, CLR_GRAY, ORC_ZOMBIE), + MON(NAM("dwarf zombie"), S_ZOMBIE, + LVL(2, 6, 9, 0, -3), (G_GENO | G_SGROUP | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 150, MS_GROAN, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_DWARF, M3_INFRAVISION, + 3, CLR_RED, DWARF_ZOMBIE), + MON(NAM("elf zombie"), S_ZOMBIE, + LVL(3, 6, 9, 0, -3), (G_GENO | G_SGROUP | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 7), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 175, MS_GROAN, MZ_HUMAN), MR_COLD | MR_SLEEP | MR_POISON, + 0, M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_ELF, M3_INFRAVISION, + 4, CLR_GREEN, ELF_ZOMBIE), + MON(NAM("human zombie"), S_ZOMBIE, + LVL(4, 6, 8, 0, -3), (G_GENO | G_SGROUP | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 200, MS_GROAN, MZ_HUMAN), + MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, + M2_UNDEAD | M2_STALK | M2_HOSTILE, M3_INFRAVISION, + 5, HI_DOMESTIC, HUMAN_ZOMBIE), + MON(NAM("ettin zombie"), S_ZOMBIE, + LVL(6, 8, 6, 0, -4), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 10), ATTK(AT_CLAW, AD_PHYS, 1, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1700, 250, MS_GROAN, MZ_HUGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_STRONG, M3_INFRAVISION, + 7, CLR_BLUE, ETTIN_ZOMBIE), + MON(NAM("ghoul"), S_ZOMBIE, + LVL(3, 6, 10, 0, -2), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PLYS, 1, 2), ATTK(AT_CLAW, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 50, MS_SILENT, MZ_SMALL), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_POIS | M1_OMNIVORE, + M2_UNDEAD | M2_WANDER | M2_HOSTILE, M3_INFRAVISION, + 5, CLR_BLACK, GHOUL), + MON(NAM("giant zombie"), S_ZOMBIE, + LVL(8, 8, 6, 0, -4), (G_GENO | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 8), ATTK(AT_CLAW, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2050, 375, MS_GROAN, MZ_HUGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, + M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_GIANT | M2_STRONG, + M3_INFRAVISION, + 9, CLR_CYAN, GIANT_ZOMBIE), + MON(NAM("skeleton"), S_ZOMBIE, + LVL(12, 8, 4, 0, 0), (G_NOCORPSE | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_TUCH, AD_SLOW, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(300, 5, MS_BONES, MZ_HUMAN), + MR_COLD | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE, + M2_UNDEAD | M2_WANDER | M2_HOSTILE | M2_STRONG | M2_COLLECT + | M2_NASTY, + M3_INFRAVISION, + 14, CLR_WHITE, SKELETON), + /* + * golems + */ + MON(NAM("straw golem"), S_GOLEM, + LVL(3, 12, 10, 0, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 2), ATTK(AT_CLAW, AD_PHYS, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 0, MS_SILENT, MZ_LARGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_NEUTER, 0, + 4, CLR_YELLOW, STRAW_GOLEM), + MON(NAM("paper golem"), S_GOLEM, + LVL(3, 12, 10, 0, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(400, 0, MS_SILENT, MZ_LARGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_NEUTER, 0, + 4, HI_PAPER, PAPER_GOLEM), + MON(NAM("rope golem"), S_GOLEM, + LVL(4, 9, 8, 0, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_HUGS, AD_PHYS, 6, 1), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(450, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_NEUTER, 0, + 6, CLR_BROWN, ROPE_GOLEM), + MON(NAM("gold golem"), S_GOLEM, + LVL(5, 9, 6, 0, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 3), ATTK(AT_CLAW, AD_PHYS, 2, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(450, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON | MR_ACID, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE, + M2_HOSTILE | M2_NEUTER, 0, + 6, HI_GOLD, GOLD_GOLEM), + MON(NAM("leather golem"), S_GOLEM, + LVL(6, 6, 6, 0, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 6), ATTK(AT_CLAW, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(800, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_NEUTER, 0, + 7, HI_LEATHER, LEATHER_GOLEM), + MON(NAM("wood golem"), S_GOLEM, + LVL(7, 3, 4, 0, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(900, 0, MS_SILENT, MZ_LARGE), MR_COLD | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE, + M2_HOSTILE | M2_NEUTER, 0, + 8, HI_WOOD, WOOD_GOLEM), + MON(NAM("flesh golem"), S_GOLEM, + LVL(9, 8, 9, 30, 0), (1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 8), ATTK(AT_CLAW, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1400, 600, MS_SILENT, MZ_LARGE), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON, + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID, M2_HOSTILE | M2_STRONG, 0, + 10, CLR_RED, FLESH_GOLEM), + MON(NAM("clay golem"), S_GOLEM, + LVL(11, 7, 7, 40, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 3, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1550, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE, + M2_HOSTILE | M2_STRONG, 0, + 12, CLR_BROWN, CLAY_GOLEM), + MON(NAM("stone golem"), S_GOLEM, + LVL(14, 6, 5, 50, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 3, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1900, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE, + M2_HOSTILE | M2_STRONG, 0, + 15, CLR_GRAY, STONE_GOLEM), + MON(NAM("glass golem"), S_GOLEM, + LVL(16, 6, 1, 50, 0), (G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 2, 8), ATTK(AT_CLAW, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1800, 0, MS_SILENT, MZ_LARGE), MR_SLEEP | MR_POISON | MR_ACID, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE, + M2_HOSTILE | M2_STRONG, 0, + 18, CLR_CYAN, GLASS_GOLEM), + MON(NAM("iron golem"), S_GOLEM, + LVL(18, 6, 3, 60, 0), (G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_BREA, AD_DRST, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2000, 0, MS_SILENT, MZ_LARGE), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_BREATHLESS | M1_MINDLESS | M1_HUMANOID | M1_THICK_HIDE | M1_POIS, + M2_HOSTILE | M2_STRONG | M2_COLLECT, 0, + 22, HI_METAL, IRON_GOLEM), + /* + * humans, including elves and were-critters; + * the '@' class does not obey rule #2. + * Plain "human" is a placeholder, not a normal monster. + */ + MON(NAM("human"), S_HUMAN, /* for corpses */ + LVL(0, 12, 10, 0, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 2, HI_DOMESTIC, HUMAN), + MON(NAM("wererat"), S_HUMAN, + LVL(2, 12, 10, 10, -7), (1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_WERE, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_REGEN | M1_OMNIVORE, + M2_NOPOLY | M2_WERE | M2_HOSTILE | M2_HUMAN | M2_COLLECT, + M3_INFRAVISIBLE, + 3, CLR_BROWN, HUMAN_WERERAT), + MON(NAM("werejackal"), S_HUMAN, + LVL(2, 12, 10, 10, -7), (1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_WERE, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_REGEN | M1_OMNIVORE, + M2_NOPOLY | M2_WERE | M2_HOSTILE | M2_HUMAN | M2_COLLECT, + M3_INFRAVISIBLE, + 3, CLR_RED, HUMAN_WEREJACKAL), + MON(NAM("werewolf"), S_HUMAN, + LVL(5, 12, 10, 20, -7), (1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_WERE, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_REGEN | M1_OMNIVORE, + M2_NOPOLY | M2_WERE | M2_HOSTILE | M2_HUMAN | M2_COLLECT, + M3_INFRAVISIBLE, + 6, CLR_ORANGE, HUMAN_WEREWOLF), + /* plain "elf" is a placeholder, not a normal monster */ + MON(NAM("elf"), S_HUMAN, /* for corpses */ + LVL(0, 12, 10, 2, -3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_HUMANOID, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS, + M2_NOPOLY | M2_ELF | M2_COLLECT, + M3_INFRAVISION | M3_INFRAVISIBLE, + 1, HI_DOMESTIC, ELF), + MON(NAM("Woodland-elf"), S_HUMAN, + LVL(4, 12, 10, 10, -5), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), NO_ATTK, + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_HUMANOID, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS, M2_ELF | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 6, CLR_GREEN, WOODLAND_ELF), + MON(NAM("Green-elf"), S_HUMAN, + LVL(5, 12, 10, 10, -6), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_HUMANOID, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS, M2_ELF | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 7, CLR_BRIGHT_GREEN, GREEN_ELF), + MON(NAM("Grey-elf"), S_HUMAN, + LVL(6, 12, 10, 10, -7), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_HUMANOID, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS, M2_ELF | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 8, CLR_GRAY, GREY_ELF), + MON(NAMS("elf-lord", "elf-lady", "elf-noble"), S_HUMAN, + LVL(8, 12, 10, 20, -9), (G_GENO | G_SGROUP | 2), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_HUMANOID, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS, + M2_ELF | M2_STRONG | M2_LORD | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_BRIGHT_BLUE, ELF_NOBLE), + MON(NAMS("Elvenking", "Elvenqueen", "elven monarch"), S_HUMAN, + LVL(9, 12, 10, 25, -10), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_HUMANOID, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS, + M2_ELF | M2_STRONG | M2_PRINCE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, HI_LORD, ELVEN_MONARCH), + MON(NAM("doppelganger"), S_HUMAN, + LVL(9, 12, 5, 20, 0), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 12), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_IMITATE, MZ_HUMAN), MR_SLEEP, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_HOSTILE | M2_STRONG | M2_COLLECT + | M2_SHAPESHIFTER, + M3_INFRAVISIBLE, + 11, HI_DOMESTIC, DOPPELGANGER), + /* 5.0: shopkeepers used to have speed 18, but if/when they were + hasted they always got 2 moves per turn and had a tendency to move + away from blocking the door and then move right back; since they + might start with a potion of speed and drink that as soon as the + hero gets close, once inside the shop the hero could have trouble + getting out again; also, being slowed still guaranteed one move + per turn; reduce their innate speed from 18 to 16 for a hasted + speed of 22 rather than 24 and slowed speed of 11 rather than 12; + they will still block the shop door, but not as tenaciously */ + MON(NAM("shopkeeper"), S_HUMAN, + LVL(12, 16, 0, 50, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 4, 4), ATTK(AT_WEAP, AD_PHYS, 4, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SELL, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL + | M2_STRONG | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE, + 15, HI_DOMESTIC, SHOPKEEPER), + /* vault guard */ + MON(NAM("guard"), S_HUMAN, + LVL(12, 12, 10, 40, 10), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARD, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_MERC | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 14, CLR_BLUE, GUARD), + /* prisoner is used on some special levels */ + MON(NAM("prisoner"), S_HUMAN, + LVL(12, 12, 10, 0, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_DJINNI, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE | M3_CLOSE, + 14, HI_DOMESTIC, PRISONER), + /* the Oracle of Delphi doesn't move */ + MON(NAM("Oracle"), S_HUMAN, + LVL(12, 0, 0, 50, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_NONE, AD_MAGM, 0, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_ORACLE, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_FEMALE, M3_INFRAVISIBLE, + 13, HI_ZAP, ORACLE), + /* aligned priests always have the epri extension attached; + individual instantiations should always have either ispriest + or isminion set; role monster priests are separate (below) */ + MON(NAMS("priest", "priestess", "aligned cleric"), S_HUMAN, + LVL(12, 12, 10, 50, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_KICK, AD_PHYS, 1, 4), + ATTK(AT_MAGC, AD_CLRC, 0, 0), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_PRIEST, MZ_HUMAN), MR_ELEC, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_LORD | M2_PEACEFUL | M2_COLLECT, + M3_INFRAVISIBLE, + 15, CLR_WHITE, ALIGNED_CLERIC), + /* high priests always have epri and always have ispriest set; + they are flagged as unique even through they aren't */ + MON(NAMS("high priest", "high priestess", "high cleric"), S_HUMAN, + LVL(25, 15, 7, 70, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_KICK, AD_PHYS, 2, 8), + ATTK(AT_MAGC, AD_CLRC, 2, 8), ATTK(AT_MAGC, AD_CLRC, 2, 8), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_PRIEST, MZ_HUMAN), + MR_FIRE | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_MINION | M2_PRINCE | M2_NASTY | M2_COLLECT + | M2_MAGIC, + M3_INFRAVISIBLE, + 30, CLR_WHITE, HIGH_CLERIC), + MON(NAM("soldier"), S_HUMAN, + LVL(6, 10, 10, 0, -2), (G_SGROUP | G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SOLDIER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_MERC | M2_STALK + | M2_HOSTILE | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 8, CLR_GRAY, SOLDIER), + MON(NAM("sergeant"), S_HUMAN, + LVL(8, 10, 10, 5, -3), (G_SGROUP | G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SOLDIER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_MERC | M2_STALK + | M2_HOSTILE | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 10, CLR_RED, SERGEANT), + MON(NAM("nurse"), S_HUMAN, + LVL(11, 6, 0, 0, 0), (G_GENO | 3), + A(ATTK(AT_CLAW, AD_HEAL, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NURSE, MZ_HUMAN), MR_POISON, MR_POISON, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_HOSTILE, + M3_INFRAVISIBLE, + 13, HI_DOMESTIC, NURSE), + MON(NAM("lieutenant"), S_HUMAN, + LVL(10, 10, 10, 15, -4), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 3, 4), ATTK(AT_WEAP, AD_PHYS, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SOLDIER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_MERC | M2_STALK + | M2_HOSTILE | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 12, CLR_GREEN, LIEUTENANT), + MON(NAM("captain"), S_HUMAN, + LVL(12, 10, 10, 15, -5), (G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 4, 4), ATTK(AT_WEAP, AD_PHYS, 4, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SOLDIER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_MERC | M2_STALK + | M2_HOSTILE | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 14, CLR_BLUE, CAPTAIN), + MON(NAM("watchman"), S_HUMAN, + LVL(6, 10, 10, 0, -2), (G_SGROUP | G_NOGEN | G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SOLDIER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_MERC | M2_STALK + | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 8, CLR_GRAY, WATCHMAN), + MON(NAM("watch captain"), S_HUMAN, + LVL(10, 10, 10, 15, -4), (G_NOGEN | G_GENO | 1), + A(ATTK(AT_WEAP, AD_PHYS, 3, 4), ATTK(AT_WEAP, AD_PHYS, 3, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SOLDIER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_MERC | M2_STALK + | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 12, CLR_GREEN, WATCH_CAPTAIN), + /* Unique humans not tied to quests. + */ + MON(NAM("Medusa"), S_HUMAN, + LVL(20, 12, 2, 50, -15), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 1, 8), + ATTK(AT_GAZE, AD_STON, 0, 0), ATTK(AT_BITE, AD_DRST, 1, 6), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HISS, MZ_LARGE), + MR_POISON | MR_STONE, MR_POISON | MR_STONE, + M1_FLY | M1_SWIM | M1_AMPHIBIOUS | M1_HUMANOID | M1_POIS | M1_OMNIVORE, + M2_NOPOLY | M2_HOSTILE | M2_STRONG | M2_PNAME | M2_FEMALE, + M3_WAITFORU | M3_INFRAVISIBLE, + 25, CLR_BRIGHT_GREEN, MEDUSA), + MON(NAM("Wizard of Yendor"), S_HUMAN, + LVL(30, 12, -8, 100, A_NONE), (G_NOGEN | G_UNIQ), + A(ATTK(AT_CLAW, AD_SAMU, 2, 12), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_CUSS, MZ_HUMAN), MR_FIRE | MR_POISON, + MR_FIRE | MR_POISON, + M1_FLY | M1_BREATHLESS | M1_HUMANOID | M1_REGEN | M1_SEE_INVIS + | M1_TPORT | M1_TPORT_CNTRL | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_HOSTILE | M2_STRONG | M2_NASTY | M2_PRINCE + | M2_MALE | M2_MAGIC, + M3_COVETOUS | M3_WAITFORU | M3_INFRAVISIBLE, + 34, HI_OVERLORD, WIZARD_OF_YENDOR), + MON(NAM("Croesus"), S_HUMAN, + LVL(20, 15, 0, 40, 15), (G_UNIQ | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARD, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY + | M2_PNAME | M2_PRINCE | M2_MALE | M2_GREEDY | M2_JEWELS + | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE, + 22, HI_LORD, CROESUS), +#ifdef CHARON + MON(NAM("Charon"), S_HUMAN, + LVL(76, 18, -5, 120, 0), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_TUCH, AD_PLYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_FERRY, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_POISON | MR_STONE, 0, + M1_BREATHLESS | M1_SEE_INVIS | M1_HUMANOID, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_PNAME | M2_MALE | M2_GREEDY + | M2_COLLECT, + M3_INFRAVISIBLE, + 38, CLR_WHITE, CHARON), +#endif + /* + * ghosts + * ghosts and shades don't leave corpses; assigning human weight + * to them matters for statues + */ + MON(NAM("ghost"), S_GHOST, + LVL(10, 3, -5, 50, -5), (G_NOCORPSE | G_NOGEN), + A(ATTK(AT_TUCH, AD_PHYS, 1, 1), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 0, MS_SILENT, MZ_HUMAN), + MR_COLD | MR_DISINT | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_WALLWALK | M1_HUMANOID | M1_UNSOLID, + M2_NOPOLY | M2_UNDEAD | M2_STALK | M2_HOSTILE, M3_INFRAVISION, + 12, CLR_GRAY, GHOST), + MON(NAM("shade"), S_GHOST, + LVL(12, 10, 10, 0, 0), (G_NOCORPSE | G_NOGEN), + A(ATTK(AT_TUCH, AD_PLYS, 2, 6), ATTK(AT_TUCH, AD_SLOW, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 0, MS_WAIL, MZ_HUMAN), + MR_COLD | MR_DISINT | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_BREATHLESS | M1_WALLWALK | M1_HUMANOID | M1_UNSOLID + | M1_SEE_INVIS, + M2_NOPOLY | M2_UNDEAD | M2_WANDER | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISION, + 14, CLR_BLACK, SHADE), + /* + * (major) demons + */ + MON(NAM("water demon"), S_DEMON, + LVL(8, 12, -4, 30, -7), (G_NOCORPSE | G_NOGEN), + A(ATTK(AT_WEAP, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), + ATTK(AT_BITE, AD_PHYS, 1, 3), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_DJINNI, MZ_HUMAN), MR_FIRE | MR_POISON, 0, + M1_HUMANOID | M1_POIS | M1_SWIM, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_BLUE, WATER_DEMON), + /* standard demons & devils + */ +#define SEDUCTION_ATTACKS_YES \ + A(ATTK(AT_BITE, AD_SSEX, 0, 0), ATTK(AT_CLAW, AD_PHYS, 1, 3), \ + ATTK(AT_CLAW, AD_PHYS, 1, 3), NO_ATTK, NO_ATTK, NO_ATTK) +#define SEDUCTION_ATTACKS_NO \ + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), \ + ATTK(AT_BITE, AD_DRLI, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK) + /* incubus and succubus; prior to 5.0, succubus and incubus were + distinct monsters; "amorous demon" is considered to be a temporary + placeholder but may be here to stay... */ + MON(NAMS("incubus", "succubus", "amorous demon"), S_DEMON, + LVL(6, 12, 0, 70, -9), (G_NOCORPSE | 1), + SEDUCTION_ATTACKS_YES, + SIZ(WT_HUMAN, 400, MS_SEDUCE, MZ_HUMAN), + MR_FIRE | MR_POISON, 0, M1_HUMANOID | M1_FLY | M1_POIS, + M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 8, CLR_GRAY, AMOROUS_DEMON), + MON(NAM("horned devil"), S_DEMON, + LVL(6, 9, -5, 50, 11), (G_HELL | G_NOCORPSE | 2), + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_BITE, AD_PHYS, 2, 3), ATTK(AT_STNG, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_HUMAN), MR_FIRE | MR_POISON, 0, + M1_POIS | M1_THICK_HIDE, M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 9, CLR_BROWN, HORNED_DEVIL), + /* Used by AD&D for a type of demon, originally one of the Furies + and spelled this way; plural is erinyes */ + MON(NAM("erinys"), S_DEMON, + LVL(7, 12, 2, 30, 10), (G_HELL | G_NOCORPSE | G_SGROUP | 2), + /* erinys attacks (among other things) are variable depending on your + alignment abuse, can be increased from here by adj_erinys(mon.c) */ + A(ATTK(AT_WEAP, AD_DRST, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_HUMAN), MR_FIRE | MR_POISON, 0, + M1_HUMANOID | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_STRONG | M2_NASTY | M2_FEMALE + | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 10, CLR_RED, ERINYS), + MON(NAM("barbed devil"), S_DEMON, + LVL(8, 12, 0, 35, 8), (G_HELL | G_NOCORPSE | G_SGROUP | 2), + A(ATTK(AT_CLAW, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_STCK, 2, 4), + ATTK(AT_STNG, AD_PHYS, 3, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_HUMAN), MR_FIRE | MR_POISON, 0, + M1_POIS | M1_THICK_HIDE, M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_RED, BARBED_DEVIL), + MON(NAM("marilith"), S_DEMON, + LVL(7, 12, -6, 80, -12), (G_HELL | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_WEAP, AD_PHYS, 2, 4), + ATTK(AT_CLAW, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 2, 4), + ATTK(AT_CLAW, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 2, 4)), + SIZ(WT_HUMAN, 400, MS_CUSS, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_HUMANOID | M1_SLITHY | M1_SEE_INVIS | M1_POIS, + M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY | M2_FEMALE | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_RED, MARILITH), + MON(NAM("vrock"), S_DEMON, + LVL(8, 12, 0, 50, -9), (G_HELL | G_NOCORPSE | G_SGROUP | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_CLAW, AD_PHYS, 1, 8), ATTK(AT_CLAW, AD_PHYS, 1, 8), + ATTK(AT_BITE, AD_PHYS, 1, 6), NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_POIS, M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 11, CLR_GREEN, VROCK), + MON(NAM("hezrou"), S_DEMON, + LVL(9, 6, -2, 55, -10), (G_HELL | G_NOCORPSE | G_SGROUP | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), + ATTK(AT_BITE, AD_PHYS, 4, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_HUMANOID | M1_POIS, M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 12, CLR_GREEN, HEZROU), + MON(NAM("bone devil"), S_DEMON, + LVL(9, 15, -1, 40, -9), (G_HELL | G_NOCORPSE | G_SGROUP | 2), + A(ATTK(AT_WEAP, AD_PHYS, 3, 4), ATTK(AT_STNG, AD_DRST, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_POIS, M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 13, CLR_GRAY, BONE_DEVIL), + MON(NAM("ice devil"), S_DEMON, + LVL(11, 6, -4, 55, -12), (G_HELL | G_NOCORPSE | 2), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_STNG, AD_COLD, 3, 4), + ATTK(AT_TUCH, AD_SLOW, 1, 1), NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_LARGE), + MR_FIRE | MR_COLD | MR_POISON, 0, M1_SEE_INVIS | M1_POIS, + M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 15, CLR_WHITE, ICE_DEVIL), + MON(NAM("nalfeshnee"), S_DEMON, + LVL(11, 9, -1, 65, -11), (G_HELL | G_NOCORPSE | 1), + A(ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4), + ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SPELL, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_HUMANOID | M1_POIS, M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION, + 15, CLR_RED, NALFESHNEE), + MON(NAM("pit fiend"), S_DEMON, + LVL(13, 6, -3, 65, -13), (G_HELL | G_NOCORPSE | 2), + A(ATTK(AT_WEAP, AD_PHYS, 4, 2), ATTK(AT_WEAP, AD_PHYS, 4, 2), + ATTK(AT_HUGS, AD_PHYS, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GROWL, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_SEE_INVIS | M1_POIS, + M2_DEMON | M2_STALK | M2_HOSTILE | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 16, CLR_RED, PIT_FIEND), + /* from Jack Vance's _Rhialto_the_Marvellous_, one of the sequels + to _The_Dying_Earth_ */ + MON(NAM("sandestin"), S_DEMON, + LVL(13, 12, 4, 60, -5), (G_HELL | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_WEAP, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 400, MS_CUSS, MZ_HUMAN), MR_STONE, 0, M1_HUMANOID, + M2_NOPOLY | M2_STALK | M2_STRONG | M2_COLLECT | M2_SHAPESHIFTER, + M3_INFRAVISIBLE | M3_INFRAVISION, + 15, CLR_GRAY, SANDESTIN), + MON(NAM("balrog"), S_DEMON, + LVL(16, 5, -2, 75, -14), (G_HELL | G_NOCORPSE | 1), + A(ATTK(AT_WEAP, AD_PHYS, 8, 4), ATTK(AT_WEAP, AD_PHYS, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_SILENT, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_POIS, + M2_DEMON | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY | M2_COLLECT, + M3_INFRAVISIBLE | M3_INFRAVISION, + 20, CLR_RED, BALROG), + /* Named demon lords & princes plus Arch-Devils. + * (their order matters; see minion.c) + */ + MON(NAM("Juiblex"), S_DEMON, LVL(50, 3, -7, 65, -15), + (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_ENGL, AD_DISE, 4, 10), ATTK(AT_SPIT, AD_ACID, 3, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 0, MS_GURGLE, MZ_LARGE), + MR_FIRE | MR_POISON | MR_ACID | MR_STONE, 0, + M1_AMPHIBIOUS | M1_AMORPHOUS | M1_NOHEAD | M1_FLY | M1_SEE_INVIS + | M1_ACID | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_LORD | M2_MALE, + M3_WAITFORU | M3_WANTSAMUL | M3_INFRAVISION, + 26, CLR_BRIGHT_GREEN, JUIBLEX), + MON(NAM("Yeenoghu"), S_DEMON, + LVL(56, 18, -5, 80, -15), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 3, 6), ATTK(AT_WEAP, AD_CONF, 2, 8), + ATTK(AT_CLAW, AD_PLYS, 1, 6), ATTK(AT_MAGC, AD_MAGM, 2, 6), + NO_ATTK, NO_ATTK), + SIZ(900, 500, MS_ORC, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_LORD | M2_MALE | M2_COLLECT, + M3_WANTSAMUL | M3_INFRAVISIBLE | M3_INFRAVISION, + 31, HI_LORD, YEENOGHU), + MON(NAM("Orcus"), S_DEMON, + LVL(66, 9, -6, 85, -20), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 3, 6), ATTK(AT_CLAW, AD_PHYS, 3, 4), + ATTK(AT_CLAW, AD_PHYS, 3, 4), ATTK(AT_MAGC, AD_SPEL, 8, 6), + ATTK(AT_STNG, AD_DRST, 2, 4), NO_ATTK), + SIZ(1500, 500, MS_ORC, MZ_HUGE), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_PRINCE | M2_MALE | M2_COLLECT, + M3_WAITFORU | M3_WANTSBOOK | M3_WANTSAMUL | M3_INFRAVISIBLE + | M3_INFRAVISION, + 36, HI_LORD, ORCUS), + MON(NAM("Geryon"), S_DEMON, + LVL(72, 3, -3, 75, 15), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_CLAW, AD_PHYS, 3, 6), ATTK(AT_CLAW, AD_PHYS, 3, 6), + ATTK(AT_STNG, AD_DRST, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 500, MS_BRIBE, MZ_HUGE), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_POIS | M1_SLITHY, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_PRINCE | M2_MALE, + M3_WANTSAMUL | M3_INFRAVISIBLE | M3_INFRAVISION, + 36, HI_LORD, GERYON), + MON(NAM("Dispater"), S_DEMON, + LVL(78, 15, -2, 80, 15), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 6), ATTK(AT_MAGC, AD_SPEL, 6, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 500, MS_BRIBE, MZ_HUMAN), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_POIS | M1_HUMANOID, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_PRINCE | M2_MALE | M2_COLLECT, + M3_WANTSAMUL | M3_INFRAVISIBLE | M3_INFRAVISION, + 40, HI_LORD, DISPATER), + MON(NAM("Baalzebub"), S_DEMON, + LVL(89, 9, -5, 85, 20), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_BITE, AD_DRST, 2, 6), ATTK(AT_GAZE, AD_STUN, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 500, MS_BRIBE, MZ_LARGE), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_PRINCE | M2_MALE, + M3_WANTSAMUL | M3_WAITFORU | M3_INFRAVISIBLE | M3_INFRAVISION, + 45, HI_LORD, BAALZEBUB), + MON(NAM("Asmodeus"), S_DEMON, + LVL(105, 12, -7, 90, 20), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_CLAW, AD_PHYS, 4, 4), ATTK(AT_MAGC, AD_COLD, 6, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 500, MS_BRIBE, MZ_HUGE), MR_FIRE | MR_COLD | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_HUMANOID | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_STRONG + | M2_NASTY | M2_PRINCE | M2_MALE, + M3_WANTSAMUL | M3_WAITFORU | M3_INFRAVISIBLE | M3_INFRAVISION, + 53, HI_LORD, ASMODEUS), + MON(NAM("Demogorgon"), S_DEMON, + LVL(106, 15, -8, 95, -20), (G_HELL | G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_MAGC, AD_SPEL, 8, 6), ATTK(AT_STNG, AD_DRLI, 1, 4), + ATTK(AT_CLAW, AD_DISE, 1, 6), ATTK(AT_CLAW, AD_DISE, 1, 6), + NO_ATTK, NO_ATTK), + SIZ(1500, 500, MS_GROWL, MZ_HUGE), MR_FIRE | MR_POISON, 0, + M1_FLY | M1_SEE_INVIS | M1_NOHANDS | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_PNAME | M2_NASTY + | M2_PRINCE | M2_MALE, + M3_WANTSAMUL | M3_INFRAVISIBLE | M3_INFRAVISION, + 57, HI_LORD, DEMOGORGON), + /* Riders -- the Four Horsemen of the Apocalypse ("War" == player); + * depicted with '&' but do not have M2_DEMON set. + */ + MON(NAM("Death"), S_DEMON, + LVL(30, 12, -5, 100, 0), (G_UNIQ | G_NOGEN), + A(ATTK(AT_TUCH, AD_DETH, 8, 8), ATTK(AT_TUCH, AD_DETH, 8, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 1, MS_RIDER, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_HUMANOID | M1_REGEN | M1_SEE_INVIS | M1_TPORT_CNTRL, + M2_NOPOLY | M2_STALK | M2_HOSTILE | M2_PNAME | M2_STRONG | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION | M3_DISPLACES, + 34, HI_OVERLORD, DEATH), + MON(NAM("Pestilence"), S_DEMON, + LVL(30, 12, -5, 100, 0), (G_UNIQ | G_NOGEN), + A(ATTK(AT_TUCH, AD_PEST, 8, 8), ATTK(AT_TUCH, AD_PEST, 8, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 1, MS_RIDER, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_HUMANOID | M1_REGEN | M1_SEE_INVIS | M1_TPORT_CNTRL, + M2_NOPOLY | M2_STALK | M2_HOSTILE | M2_PNAME | M2_STRONG | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION | M3_DISPLACES, + 34, HI_OVERLORD, PESTILENCE), + MON(NAM("Famine"), S_DEMON, + LVL(30, 12, -5, 100, 0), (G_UNIQ | G_NOGEN), + A(ATTK(AT_TUCH, AD_FAMN, 8, 8), ATTK(AT_TUCH, AD_FAMN, 8, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 1, MS_RIDER, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_HUMANOID | M1_REGEN | M1_SEE_INVIS | M1_TPORT_CNTRL, + M2_NOPOLY | M2_STALK | M2_HOSTILE | M2_PNAME | M2_STRONG | M2_NASTY, + M3_INFRAVISIBLE | M3_INFRAVISION | M3_DISPLACES, + 34, HI_OVERLORD, FAMINE), + /* other demons + */ +#ifdef MAIL_STRUCTURES + MON(NAM("mail daemon"), S_DEMON, + LVL(56, 24, 10, 127, 0), (G_NOGEN | G_NOCORPSE), + A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(600, 300, MS_SILENT, MZ_HUMAN), + MR_FIRE | MR_COLD | MR_ELEC | MR_SLEEP | MR_POISON | MR_STONE, 0, + M1_FLY | M1_SWIM | M1_BREATHLESS | M1_SEE_INVIS | M1_HUMANOID + | M1_POIS, + M2_NOPOLY | M2_STALK | M2_PEACEFUL, M3_INFRAVISIBLE | M3_INFRAVISION, + 26, CLR_BRIGHT_BLUE, MAIL_DAEMON), +#endif + /* djinni is singular; plural is djinn */ + MON(NAM("djinni"), S_DEMON, + LVL(7, 12, 4, 30, 0), (G_NOGEN | G_NOCORPSE), + A(ATTK(AT_WEAP, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1500, 400, MS_DJINNI, MZ_HUMAN), MR_POISON | MR_STONE, 0, + M1_HUMANOID | M1_FLY | M1_POIS, M2_NOPOLY | M2_STALK | M2_COLLECT, + M3_INFRAVISIBLE, 8, CLR_YELLOW, DJINNI), + /* + * sea monsters + * + * 5.0: all the fish except kraken used to specify M1_SLITHY, presumably + * cloned from giant eel. Using "slither" to describe their movement + * wasn't appropriate. Unfortunately, locomotion() isn't able to choose + * "swim" as their movement description because it is only passed a + * monster type, not a specific monster (for ) or the relevant + * location, and therefore doesn't know whether water is involved. + */ + MON(NAM("jellyfish"), S_EEL, + LVL(3, 3, 6, 0, 0), (G_GENO | G_NOGEN), + A(ATTK(AT_STNG, AD_DRST, 3, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(80, 20, MS_SILENT, MZ_SMALL), MR_POISON, MR_POISON, + M1_SWIM | M1_AMPHIBIOUS | M1_NOLIMBS | M1_NOHEAD + | M1_NOTAKE | M1_POIS, M2_HOSTILE, 0, + 5, CLR_BLUE, JELLYFISH), + MON(NAM("piranha"), S_EEL, + LVL(5, 18, 4, 0, 0), (G_GENO | G_NOGEN | G_SGROUP), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_BITE, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(60, 30, MS_SILENT, MZ_SMALL), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_NOLIMBS + | M1_CARNIVORE | M1_OVIPAROUS | M1_NOTAKE, M2_HOSTILE, 0, + 7, CLR_RED, PIRANHA), + MON(NAM("shark"), S_EEL, + LVL(7, 12, 2, 0, 0), (G_GENO | G_NOGEN), + A(ATTK(AT_BITE, AD_PHYS, 5, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(500, 350, MS_SILENT, MZ_LARGE), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_NOLIMBS + | M1_CARNIVORE | M1_OVIPAROUS | M1_THICK_HIDE | M1_NOTAKE, + M2_HOSTILE, 0, + 9, CLR_GRAY, SHARK), + MON(NAM("giant eel"), S_EEL, + LVL(5, 9, -1, 0, 0), (G_GENO | G_NOGEN), + A(ATTK(AT_BITE, AD_PHYS, 3, 6), ATTK(AT_TUCH, AD_WRAP, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 250, MS_SILENT, MZ_HUGE), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_SLITHY | M1_NOLIMBS + | M1_CARNIVORE | M1_OVIPAROUS | M1_NOTAKE, + M2_HOSTILE, M3_INFRAVISIBLE, + 7, CLR_CYAN, GIANT_EEL), + MON(NAM("electric eel"), S_EEL, + LVL(7, 10, -3, 0, 0), (G_GENO | G_NOGEN), + A(ATTK(AT_BITE, AD_ELEC, 4, 6), ATTK(AT_TUCH, AD_WRAP, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 250, MS_SILENT, MZ_HUGE), MR_ELEC, MR_ELEC, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_SLITHY | M1_NOLIMBS + | M1_CARNIVORE | M1_OVIPAROUS | M1_NOTAKE, + M2_HOSTILE, M3_INFRAVISIBLE, + 10, CLR_BRIGHT_BLUE, ELECTRIC_EEL), + MON(NAM("kraken"), S_EEL, + LVL(20, 3, 6, 0, -3), (G_GENO | G_NOGEN), + A(ATTK(AT_CLAW, AD_PHYS, 2, 4), ATTK(AT_CLAW, AD_PHYS, 2, 4), + ATTK(AT_HUGS, AD_WRAP, 2, 6), ATTK(AT_BITE, AD_PHYS, 5, 4), + NO_ATTK, NO_ATTK), + SIZ(1800, 1000, MS_SILENT, MZ_HUGE), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, + M2_NOPOLY | M2_HOSTILE | M2_STRONG, M3_INFRAVISIBLE, + 22, CLR_RED, KRAKEN), + /* + * lizards, &c + */ + MON(NAM("newt"), S_LIZARD, + LVL(0, 6, 8, 0, 0), (G_GENO | 5), + A(ATTK(AT_BITE, AD_PHYS, 1, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 20, MS_SILENT, MZ_TINY), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE, 0, + 1, CLR_YELLOW, NEWT), + MON(NAM("gecko"), S_LIZARD, + LVL(1, 6, 8, 0, 0), (G_GENO | 5), + A(ATTK(AT_BITE, AD_PHYS, 1, 3), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 20, MS_SQEEK, MZ_TINY), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, 0, + 2, CLR_GREEN, GECKO), + MON(NAM("iguana"), S_LIZARD, + LVL(2, 6, 7, 0, 0), (G_GENO | 5), + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(30, 30, MS_SILENT, MZ_TINY), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, 0, + 3, CLR_BROWN, IGUANA), + MON(NAM("baby crocodile"), S_LIZARD, + LVL(3, 6, 7, 0, 0), G_GENO, + A(ATTK(AT_BITE, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(200, 200, MS_CHIRP, MZ_MEDIUM), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, + M2_HOSTILE, 0, + 4, CLR_BROWN, BABY_CROCODILE), + /* trivia: before monster corpses were implemented, "lizard corpse" + was a specific type of item */ + MON(NAM("lizard"), S_LIZARD, + LVL(5, 6, 6, 10, 0), (G_GENO | 5), + A(ATTK(AT_BITE, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(10, 40, MS_SILENT, MZ_TINY), MR_STONE, MR_STONE, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, M2_HOSTILE, 0, + 6, CLR_GREEN, LIZARD), + MON(NAM("chameleon"), S_LIZARD, + LVL(6, 5, 6, 10, 0), (G_GENO | 2), + A(ATTK(AT_BITE, AD_PHYS, 4, 2), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(100, 100, MS_SILENT, MZ_TINY), 0, 0, + M1_ANIMAL | M1_NOHANDS | M1_CARNIVORE, + M2_NOPOLY | M2_HOSTILE | M2_SHAPESHIFTER, 0, + 7, CLR_BROWN, CHAMELEON), + MON(NAM("crocodile"), S_LIZARD, + LVL(6, 9, 5, 0, 0), (G_GENO | 1), + A(ATTK(AT_BITE, AD_PHYS, 4, 2), ATTK(AT_CLAW, AD_PHYS, 1, 12), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_BELLOW, MZ_LARGE), 0, 0, + M1_SWIM | M1_AMPHIBIOUS | M1_ANIMAL | M1_THICK_HIDE | M1_NOHANDS + | M1_OVIPAROUS | M1_CARNIVORE, + M2_STRONG | M2_HOSTILE, 0, + 7, CLR_BROWN, CROCODILE), + MON(NAM("salamander"), S_LIZARD, + LVL(8, 12, -1, 0, -9), (G_HELL | 1), + A(ATTK(AT_WEAP, AD_PHYS, 2, 8), ATTK(AT_TUCH, AD_FIRE, 1, 6), + ATTK(AT_HUGS, AD_PHYS, 2, 6), ATTK(AT_HUGS, AD_FIRE, 3, 6), + NO_ATTK, NO_ATTK), + SIZ(1500, 400, MS_MUMBLE, MZ_HUMAN), MR_SLEEP | MR_FIRE, MR_FIRE, + M1_HUMANOID | M1_SLITHY | M1_THICK_HIDE | M1_POIS, + M2_STALK | M2_HOSTILE | M2_COLLECT | M2_MAGIC, M3_INFRAVISIBLE, + 12, CLR_ORANGE, SALAMANDER), + + /* + * dummy monster needed for visual interface + * (marking it unique prevents figurines) + */ + MON(NAM("long worm tail"), S_WORM_TAIL, + LVL(0, 0, 0, 0, 0), (G_NOGEN | G_NOCORPSE | G_UNIQ), + A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(0, 0, 0, 0), 0, 0, 0L, M2_NOPOLY, 0, + 1, CLR_BROWN, LONG_WORM_TAIL), + /* Note: + * Worm tail must be between the normal monsters and the special + * quest & pseudo-character ones because an optimization in the + * random monster selection code assumes everything beyond here + * has the G_NOGEN and M2_NOPOLY attributes. + */ + + /* + * character classes + */ + MON(NAM("archeologist"), S_HUMAN, + LVL(10, 12, 10, 1, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_TUNNEL | M1_NEEDPICK | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, ARCHEOLOGIST), + MON(NAM("barbarian"), S_HUMAN, + LVL(10, 12, 10, 1, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, BARBARIAN), + MON(NAMS("caveman", "cavewoman", "cave dweller"), S_HUMAN, + LVL(10, 12, 10, 0, 1), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 12, HI_DOMESTIC, CAVE_DWELLER), + MON(NAM("healer"), S_HUMAN, + LVL(10, 12, 10, 1, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, HEALER), + MON(NAM("knight"), S_HUMAN, + LVL(10, 12, 10, 1, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, KNIGHT), + MON(NAM("monk"), S_HUMAN, + LVL(10, 12, 10, 2, 0), G_NOGEN, + A(ATTK(AT_CLAW, AD_PHYS, 1, 8), ATTK(AT_KICK, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_HERBIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 11, HI_DOMESTIC, MONK), + /* monster priests are separate monsters (above; "aligned cleric") */ + MON(NAMS("priest", "priestess", "cleric"), S_HUMAN, + LVL(10, 12, 10, 2, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_CLRC, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 12, HI_DOMESTIC, CLERIC), + MON(NAM("ranger"), S_HUMAN, + LVL(10, 12, 10, 2, -3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, RANGER), + MON(NAM("rogue"), S_HUMAN, + LVL(10, 12, 10, 1, -3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_GREEDY | M2_JEWELS | M2_COLLECT, + M3_INFRAVISIBLE, + 12, HI_DOMESTIC, ROGUE), + MON(NAM("samurai"), S_HUMAN, + LVL(10, 12, 10, 1, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, SAMURAI), + MON(NAM("tourist"), S_HUMAN, + LVL(10, 12, 10, 1, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT, M3_INFRAVISIBLE, + 12, HI_DOMESTIC, TOURIST), + /* valk is lawful by default; player valk can be neutral, in which case + role_init() will change this monster and 'warrior' to be neutral too; + if a neutral valk leaves a bones file containing neutral warriors, + the latter will magically turn lawful if encountered by a lawful valk + or any non-valk (for bones on the dungeon side of the portal) */ + MON(NAM("valkyrie"), S_HUMAN, + LVL(10, 12, 10, 1, 1), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), MR_COLD, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_FEMALE | M2_COLLECT, + M3_INFRAVISIBLE, + 12, HI_DOMESTIC, VALKYRIE), + MON(NAM("wizard"), S_HUMAN, + LVL(10, 12, 10, 3, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE, + 12, HI_DOMESTIC, WIZARD), + /* + * quest leaders + */ + MON(NAM("Lord Carnarvon"), S_HUMAN, + LVL(20, 15, 0, 90, 20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_MAGC, AD_SPEL, 4, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), 0, 0, + M1_TUNNEL | M1_NEEDPICK | M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, LORD_CARNARVON), + MON(NAM("Pelias"), S_HUMAN, + LVL(20, 15, 0, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, PELIAS), + MON(NAM("Shaman Karnov"), S_HUMAN, + LVL(20, 15, 0, 90, 20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_MAGC, AD_CLRC, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, SHAMAN_KARNOV), +#if 0 /* OBSOLETE -- leaders for 3.1.x/3.2.x elf quest when elf was a role */ + /* Two for elves - one of each sex. + */ + MON(NAM("Earendil"), S_HUMAN, + LVL(20, 12, 0, 50, -20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_LEADER, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_ELF | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG + | M2_MALE | M2_COLLECT | M2_MAGIC, + M3_CLOSE | M3_INFRAVISION | M3_INFRAVISIBLE, + 22, HI_LORD, EARENDIL), + MON(NAM("Elwing"), S_HUMAN, + LVL(20, 12, 0, 50, -20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_LEADER, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_ELF | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG + | M2_FEMALE | M2_COLLECT | M2_MAGIC, + M3_CLOSE | M3_INFRAVISION | M3_INFRAVISIBLE, + 22, HI_LORD, ELWING), +#endif + MON(NAM("Hippocrates"), S_HUMAN, + LVL(20, 15, 0, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_CLRC, 3, 8), + ATTK(AT_MAGC, AD_CLRC, 3, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 26, HI_LORD, HIPPOCRATES), + MON(NAM("King Arthur"), S_HUMAN, + LVL(20, 15, 0, 90, 20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, KING_ARTHUR), + MON(NAM("Grand Master"), S_HUMAN, + LVL(25, 15, 0, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_CLAW, AD_PHYS, 4, 10), ATTK(AT_KICK, AD_PHYS, 2, 8), + ATTK(AT_MAGC, AD_CLRC, 2, 8), ATTK(AT_MAGC, AD_CLRC, 2, 8), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), + MR_FIRE | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_HUMANOID | M1_SEE_INVIS | M1_HERBIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_MALE | M2_NASTY + | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 30, CLR_BLACK, GRAND_MASTER), + MON(NAM("Arch Priest"), S_HUMAN, + LVL(25, 15, 7, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_KICK, AD_PHYS, 2, 8), + ATTK(AT_MAGC, AD_CLRC, 2, 8), ATTK(AT_MAGC, AD_CLRC, 2, 8), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), + MR_FIRE | MR_ELEC | MR_SLEEP | MR_POISON, 0, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_MALE | M2_COLLECT + | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 30, CLR_WHITE, ARCH_PRIEST), + MON(NAM("Orion"), S_HUMAN, LVL(20, 15, 0, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_MAGC, AD_SPEL, 4, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2200, 700, MS_LEADER, MZ_HUGE), 0, 0, + M1_HUMANOID | M1_OMNIVORE | M1_SEE_INVIS | M1_SWIM | M1_AMPHIBIOUS, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, + M3_CLOSE | M3_INFRAVISION | M3_INFRAVISIBLE, + 24, HI_LORD, ORION), + /* Note: Master of Thieves is also the Tourist's nemesis. + */ + MON(NAM("Master of Thieves"), S_HUMAN, + LVL(20, 15, 0, 90, -20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_WEAP, AD_PHYS, 2, 6), + ATTK(AT_CLAW, AD_SAMU, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), MR_STONE, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_MALE | M2_GREEDY + | M2_JEWELS | M2_COLLECT | M2_MAGIC, + M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, MASTER_OF_THIEVES), + MON(NAM("Lord Sato"), S_HUMAN, LVL(20, 15, 0, 90, 20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, LORD_SATO), + MON(NAM("Twoflower"), S_HUMAN, + LVL(20, 15, 10, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG | M2_MALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 22, HI_DOMESTIC, TWOFLOWER), + /* for a valkyrie hero, Norn's alignment will be changed to match hero's + starting alignment */ + MON(NAM("Norn"), S_HUMAN, + LVL(20, 15, 0, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_WEAP, AD_PHYS, 4, 10), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1800, 550, MS_LEADER, MZ_HUGE), MR_COLD, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_FEMALE + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 24, HI_LORD, NORN), + MON(NAM("Neferet the Green"), S_HUMAN, + LVL(20, 15, 0, 90, 0), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 10), ATTK(AT_MAGC, AD_SPEL, 2, 8), + ATTK(AT_MAGC, AD_SPEL, 2, 8), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_LEADER, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_FEMALE | M2_PNAME | M2_PEACEFUL | M2_STRONG + | M2_COLLECT | M2_MAGIC, M3_CLOSE | M3_INFRAVISIBLE, + 25, CLR_GREEN, NEFERET_THE_GREEN), + /* + * quest nemeses + */ + MON(NAM("Minion of Huhetotl"), S_DEMON, + LVL(16, 12, -2, 75, -14), (G_NOCORPSE | G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 8, 4), ATTK(AT_WEAP, AD_PHYS, 4, 6), + ATTK(AT_MAGC, AD_SPEL, 0, 0), ATTK(AT_CLAW, AD_SAMU, 2, 6), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_LARGE), + MR_FIRE | MR_POISON | MR_STONE, 0, M1_FLY | M1_SEE_INVIS | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY + | M2_COLLECT, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE, + 23, CLR_ORANGE, MINION_OF_HUHETOTL), + MON(NAM("Thoth Amon"), S_HUMAN, + LVL(16, 12, 0, 10, -14), (G_NOGEN | G_UNIQ | G_NOCORPSE), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), + ATTK(AT_MAGC, AD_SPEL, 0, 0), ATTK(AT_CLAW, AD_SAMU, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_HUMAN), MR_POISON | MR_STONE, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_STRONG | M2_MALE | M2_STALK + | M2_HOSTILE | M2_NASTY | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, + 22, HI_LORD, THOTH_AMON), + /* Multi-headed, possessing the breath attacks of all the other dragons + * (selected at random when attacking). Despite being a superset of + * gold dragon, does not emit light. Also does not fly. + */ + MON(NAM("Chromatic Dragon"), S_DRAGON, + LVL(16, 12, 0, 30, -14), (G_NOGEN | G_UNIQ), + A(ATTK(AT_BREA, AD_RBRE, 6, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), + ATTK(AT_CLAW, AD_SAMU, 2, 8), ATTK(AT_BITE, AD_PHYS, 4, 8), + ATTK(AT_BITE, AD_PHYS, 4, 8), ATTK(AT_STNG, AD_PHYS, 1, 6)), + SIZ(WT_DRAGON, 1700, MS_NEMESIS, MZ_GIGANTIC), + MR_FIRE | MR_COLD | MR_SLEEP | MR_DISINT | MR_ELEC | MR_POISON + | MR_ACID | MR_STONE, + MR_FIRE | MR_COLD | MR_SLEEP | MR_DISINT | MR_ELEC | MR_POISON + | MR_ACID | MR_STONE, + M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE | M1_SEE_INVIS | M1_POIS, + M2_NOPOLY | M2_HOSTILE | M2_FEMALE | M2_STALK | M2_STRONG | M2_NASTY + | M2_GREEDY | M2_JEWELS | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE, + 23, HI_LORD, CHROMATIC_DRAGON), +#if 0 /* OBSOLETE -- nemesis for 3.1.x/3.2.x elf quest when elf was a role */ + MON(NAM("Goblin King"), S_ORC, + LVL(15, 12, 10, 0, -15), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_WEAP, AD_PHYS, 2, 6), + ATTK(AT_CLAW, AD_SAMU, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(750, 350, MS_NEMESIS, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_ORC | M2_HOSTILE | M2_STRONG | M2_STALK | M2_NASTY + | M2_MALE | M2_GREEDY | M2_JEWELS | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE, + 18, HI_LORD, GOBLIN_KING), +#endif + MON(NAM("Cyclops"), S_GIANT, + LVL(18, 12, 0, 0, -15), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 4, 8), ATTK(AT_WEAP, AD_PHYS, 4, 8), + ATTK(AT_CLAW, AD_SAMU, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(1900, 700, MS_NEMESIS, MZ_HUGE), MR_STONE, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_GIANT | M2_STRONG | M2_ROCKTHROW | M2_STALK + | M2_HOSTILE | M2_NASTY | M2_MALE | M2_JEWELS | M2_COLLECT, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE, + 23, CLR_GRAY, CYCLOPS), + MON(NAM("Ixoth"), S_DRAGON, + LVL(15, 12, -1, 20, -14), (G_NOGEN | G_UNIQ), + A(ATTK(AT_BREA, AD_FIRE, 8, 6), ATTK(AT_BITE, AD_PHYS, 4, 8), + ATTK(AT_MAGC, AD_SPEL, 0, 0), ATTK(AT_CLAW, AD_PHYS, 2, 4), + ATTK(AT_CLAW, AD_SAMU, 2, 4), NO_ATTK), + SIZ(WT_DRAGON, 1600, MS_NEMESIS, MZ_GIGANTIC), MR_FIRE | MR_STONE, + MR_FIRE, + M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE | M1_SEE_INVIS, + M2_NOPOLY | M2_MALE | M2_PNAME | M2_HOSTILE | M2_STRONG | M2_NASTY + | M2_STALK | M2_GREEDY | M2_JEWELS | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, + 22, CLR_RED, IXOTH), + MON(NAM("Master Kaen"), S_HUMAN, + LVL(25, 12, -10, 10, -20), (G_NOGEN | G_UNIQ), + A(ATTK(AT_CLAW, AD_PHYS, 16, 2), ATTK(AT_CLAW, AD_PHYS, 16, 2), + ATTK(AT_MAGC, AD_CLRC, 0, 0), ATTK(AT_CLAW, AD_SAMU, 1, 4), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_HUMAN), MR_POISON | MR_STONE, + MR_POISON, M1_HUMANOID | M1_HERBIVORE | M1_SEE_INVIS, + M2_NOPOLY | M2_HUMAN | M2_MALE | M2_PNAME | M2_HOSTILE | M2_STRONG + | M2_NASTY | M2_STALK | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, + 31, HI_LORD, MASTER_KAEN), + MON(NAM("Nalzok"), S_DEMON, LVL(16, 12, -2, 85, -127), + (G_NOGEN | G_UNIQ | G_NOCORPSE), + A(ATTK(AT_WEAP, AD_PHYS, 8, 4), ATTK(AT_WEAP, AD_PHYS, 4, 6), + ATTK(AT_MAGC, AD_SPEL, 0, 0), ATTK(AT_CLAW, AD_SAMU, 2, 6), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_LARGE), + MR_FIRE | MR_POISON | MR_STONE, 0, M1_FLY | M1_SEE_INVIS | M1_POIS, + M2_NOPOLY | M2_DEMON | M2_MALE | M2_PNAME | M2_HOSTILE | M2_STRONG + | M2_STALK | M2_NASTY | M2_COLLECT, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE, + 23, CLR_ORANGE, NALZOK), + MON(NAM("Scorpius"), S_SPIDER, + LVL(15, 12, 10, 0, -15), (G_NOGEN | G_UNIQ), + A(ATTK(AT_CLAW, AD_PHYS, 2, 6), ATTK(AT_CLAW, AD_SAMU, 2, 6), + ATTK(AT_STNG, AD_DISE, 1, 4), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(750, 350, MS_NEMESIS, MZ_HUMAN), MR_POISON | MR_STONE, MR_POISON, + M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS | M1_CARNIVORE, + M2_NOPOLY | M2_MALE | M2_PNAME | M2_HOSTILE | M2_STRONG | M2_STALK + | M2_NASTY | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU, + 17, HI_LORD, SCORPIUS), + MON(NAM("Master Assassin"), S_HUMAN, + LVL(15, 12, 0, 30, 18), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_DRST, 2, 6), ATTK(AT_WEAP, AD_PHYS, 2, 8), + ATTK(AT_CLAW, AD_SAMU, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_HUMAN), MR_STONE, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_MALE | M2_HOSTILE | M2_STALK + | M2_NASTY | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, + 20, HI_LORD, MASTER_ASSASSIN), + /* A renegade daimyo who led a 13 year civil war against the shogun + * of his time. + */ + MON(NAM("Ashikaga Takauji"), S_HUMAN, + LVL(15, 12, 0, 40, -13), (G_NOGEN | G_UNIQ | G_NOCORPSE), + A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_WEAP, AD_PHYS, 2, 6), + ATTK(AT_CLAW, AD_SAMU, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_HUMAN), MR_STONE, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PNAME | M2_HOSTILE | M2_STRONG | M2_STALK + | M2_NASTY | M2_MALE | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, + 19, HI_LORD, ASHIKAGA_TAKAUJI), + /* + * Note: the Master of Thieves was defined above. + */ + MON(NAM("Lord Surtur"), S_GIANT, + LVL(15, 12, 2, 50, 12), (G_NOGEN | G_UNIQ), + A(ATTK(AT_WEAP, AD_PHYS, 2, 10), ATTK(AT_WEAP, AD_PHYS, 2, 10), + ATTK(AT_CLAW, AD_SAMU, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(2250, 850, MS_NEMESIS, MZ_HUGE), MR_FIRE | MR_STONE, MR_FIRE, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_GIANT | M2_MALE | M2_PNAME | M2_HOSTILE | M2_STALK + | M2_STRONG | M2_NASTY | M2_ROCKTHROW | M2_JEWELS | M2_COLLECT, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE, + 19, HI_LORD, LORD_SURTUR), + MON(NAM("Dark One"), S_HUMAN, + LVL(15, 12, 0, 80, -10), (G_NOGEN | G_UNIQ | G_NOCORPSE), + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + ATTK(AT_CLAW, AD_SAMU, 1, 4), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_NEMESIS, MZ_HUMAN), MR_STONE, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_STRONG | M2_HOSTILE | M2_STALK | M2_NASTY + | M2_COLLECT | M2_MAGIC, + M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, + 20, CLR_BLACK, DARK_ONE), + /* + * quest "guardians" + */ + MON(NAM("student"), S_HUMAN, + LVL(5, 12, 10, 10, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_TUNNEL | M1_NEEDPICK | M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, STUDENT), + MON(NAM("chieftain"), S_HUMAN, + LVL(5, 12, 10, 10, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, CHIEFTAIN), + MON(NAM("neanderthal"), S_HUMAN, + LVL(5, 12, 10, 10, 1), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, NEANDERTHAL), +#if 0 /* OBSOLETE -- guardian for 3.1.x/3.2.x elf quest when elf was a role */ + MON(NAM("High-elf"), S_HUMAN, + LVL(5, 12, 10, 10, -7), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_MAGC, AD_CLRC, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_ELF, 350, MS_GUARDIAN, MZ_HUMAN), MR_SLEEP, MR_SLEEP, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_ELF | M2_PEACEFUL | M2_COLLECT, + M3_INFRAVISION | M3_INFRAVISIBLE, + 7, HI_DOMESTIC, HIGH_ELF), +#endif + /* attendants used to be lawful but have been changed to neutral because + grow_up() promotes them to healer and the latter is always neutral */ + MON(NAM("attendant"), S_HUMAN, + LVL(5, 12, 10, 10, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), MR_POISON, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, ATTENDANT), + MON(NAM("page"), S_HUMAN, + LVL(5, 12, 10, 10, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, PAGE), + MON(NAM("abbot"), S_HUMAN, + LVL(5, 12, 10, 20, 0), G_NOGEN, + A(ATTK(AT_CLAW, AD_PHYS, 8, 2), ATTK(AT_KICK, AD_STUN, 3, 2), + ATTK(AT_MAGC, AD_CLRC, 0, 0), NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_HERBIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 8, HI_DOMESTIC, ABBOT), + MON(NAM("acolyte"), S_HUMAN, + LVL(5, 12, 10, 20, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_CLRC, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 8, HI_DOMESTIC, ACOLYTE), + MON(NAM("hunter"), S_HUMAN, + LVL(5, 12, 10, 10, -7), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 4), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISION | M3_INFRAVISIBLE, + 7, HI_DOMESTIC, HUNTER), + MON(NAM("thug"), S_HUMAN, + LVL(5, 12, 10, 10, -3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_WEAP, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_PEACEFUL + | M2_STRONG | M2_GREEDY | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, THUG), + MON(NAM("ninja"), S_HUMAN, + LVL(5, 12, 10, 10, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_HOSTILE | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, NINJA), + MON(NAM("roshi"), S_HUMAN, + LVL(5, 12, 10, 10, 3), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, + M2_NOPOLY | M2_HUMAN | M2_PEACEFUL | M2_STRONG | M2_COLLECT, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, ROSHI), + MON(NAM("guide"), S_HUMAN, + LVL(5, 12, 10, 20, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), NO_ATTK, + NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_PEACEFUL + | M2_STRONG | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE, + 8, HI_DOMESTIC, GUIDE), + /* warriors used to be chaotic but have been changed to lawful because + grow_up() promotes them to valkyrie; for a valkyrie hero, they might + be changed to neutral at game start; see the valkyrie comment above */ + MON(NAM("warrior"), S_HUMAN, + LVL(5, 12, 10, 10, 1), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 8), ATTK(AT_WEAP, AD_PHYS, 1, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_PEACEFUL + | M2_STRONG | M2_COLLECT | M2_FEMALE, + M3_INFRAVISIBLE, + 7, HI_DOMESTIC, WARRIOR), + MON(NAM("apprentice"), S_HUMAN, + LVL(5, 12, 10, 30, 0), G_NOGEN, + A(ATTK(AT_WEAP, AD_PHYS, 1, 6), ATTK(AT_MAGC, AD_SPEL, 0, 0), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + SIZ(WT_HUMAN, 400, MS_GUARDIAN, MZ_HUMAN), 0, 0, + M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_HUMAN | M2_PEACEFUL + | M2_STRONG | M2_COLLECT | M2_MAGIC, + M3_INFRAVISIBLE, + 8, HI_DOMESTIC, APPRENTICE), + + /* + * mons_init() in monst.c adds a terminator here, mons[NUMMONS]. + * It is part of the mons[] array without introducing another type + * of monster. + */ + +#if defined(MONS_ENUM) || defined(DUMP_ENUMS) +#undef MON +#undef MON3 +#endif + +/*monsters.h*/ diff --git a/include/nhmd4.h b/include/nhmd4.h new file mode 100644 index 000000000..d9751b56d --- /dev/null +++ b/include/nhmd4.h @@ -0,0 +1,37 @@ +/* NetHack 5.0 nhmd4.h $NHDT-Date: 1708811386 2024/02/24 21:49:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */ +/*- Copyright (c) Kenneth Lorber, Kensington, Maryland, 2024 */ +/* NetHack may be freely redistributed. See license for details. */ + +// Derived from: +/* + * This is an OpenSSL-compatible implementation of the RSA Data Security, + * Inc. MD4 Message-Digest Algorithm. + * + * Written by Solar Designer in 2001, and placed in + * the public domain. See md4.c for more information. + */ + +#ifndef NHMD4_H +#define NHMD4_H + +#define NHMD4_DIGEST_LENGTH 128 +#define NHMD4_RESULTLEN (128 / 8) /* 16 */ + +typedef uint32_t quint32; + +struct nhmd4_context { + quint32 lo, hi; + quint32 a, b, c, d; + unsigned char buffer[64]; + quint32 block[NHMD4_RESULTLEN]; +}; +typedef struct nhmd4_context NHMD4_CTX; + +extern void nhmd4_init(NHMD4_CTX *ctx); +extern void nhmd4_update(NHMD4_CTX *, const unsigned char *, size_t); +extern void nhmd4_final(NHMD4_CTX *, unsigned char result[NHMD4_RESULTLEN]); + +#endif /* NHMD4_H */ + +/*nhmd4.h*/ + diff --git a/include/nhregex.h b/include/nhregex.h new file mode 100644 index 000000000..5f6c4c2ca --- /dev/null +++ b/include/nhregex.h @@ -0,0 +1,17 @@ +/* NetHack 5.0 nhregex.h $NHDT-Date: $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: $ */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef NHREGEX_H +#define NHREGEX_H + +/* ### {cpp,pmatch,posix}regex.c ### */ + +extern struct nhregex *regex_init(void); +extern boolean regex_compile(const char *, struct nhregex *) NONNULLARG1; +extern char *regex_error_desc(struct nhregex *, char *) NONNULLARG2; +extern boolean regex_match(const char *, struct nhregex *) NO_NNARGS; +extern void regex_free(struct nhregex *) NONNULLARG1; + +#endif /* NHREGEX_H */ + +/*extern.h*/ diff --git a/include/obj.h b/include/obj.h index 62e20b7e4..8d95bb007 100644 --- a/include/obj.h +++ b/include/obj.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 obj.h $NHDT-Date: 1508827590 2017/10/24 06:46:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.60 $ */ +/* NetHack 5.0 obj.h $NHDT-Date: 1718999845 2024/06/21 19:57:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.116 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,6 +9,11 @@ /* #define obj obj_nh */ /* uncomment for SCO UNIX, which has a conflicting * typedef for "obj" in */ +/* start with incomplete types in case these aren't defined yet; + basic pointers to them don't need to know their details */ +struct obj; +struct monst; + union vptrs { struct obj *v_nexthere; /* floor location lists */ struct obj *v_ocontainer; /* point back to container */ @@ -16,15 +21,15 @@ union vptrs { }; /**** - *** oextra -- collection of all object extensions - ** (see the note at the bottom of this file before adding oextra fields) + *** oextra -- collection of all object extensions + ** (see the note at the bottom of this file before adding oextra fields) */ struct oextra { char *oname; /* ptr to name of object */ struct monst *omonst; /* ptr to attached monst struct */ - unsigned *omid; /* ptr to m_id */ - long *olong; /* ptr to misc long (temporary gold object) */ - char *omailcmd; /* response_cmd for mail deliver */ + char *omailcmd; /* response_cmd for mail delivery */ + unsigned omid; /* for corpse: m_id of corpse's ghost; overloaded + * for glob: owt at time added to shop's bill */ }; struct obj { @@ -36,28 +41,37 @@ struct obj { struct obj *cobj; /* contents list for containers */ unsigned o_id; - xchar ox, oy; + coordxy ox, oy; short otyp; /* object class number */ unsigned owt; long quan; /* number of items */ - schar spe; /* quality of weapon, weptool, armor or ring (+ or -); - number of charges for wand or charged tool ( >= -1 ); - number of candles attached to candelabrum; - marks your eggs, tin variety and spinach tins; - Schroedinger's Box (1) or royal coffers for a court (2); - tells which fruit a fruit is; - special for uball and amulet; - scroll of mail (normal==0, bones or wishing==1, written==2); - historic and gender for statues */ -#define STATUE_HISTORIC 0x01 -#define STATUE_MALE 0x02 -#define STATUE_FEMALE 0x04 +#define SPE_LIM 99 /* abs(obj->spe) <= 99, cap for enchanted and charged + * objects (and others; named fruit index excepted) */ + schar spe; /* quality of weapon, weptool, armor, or some rings (+ or -); + * number of charges for wand or charged tool ( >= -1 ); + * number of candles attached to candelabrum (0..7); + * magic lamp (1 iff djinni inside => lamp is lightable); + * oil lamp, tallow/wax candle (1 for no apparent reason?); + * marks spinach tins (1 iff corpsenm==NON_PM); + * marks tin variety (various: homemade, stir fried, &c); + * eggs laid by you (1), eggs upgraded with royal jelly (2); + * Schroedinger's Box (1) or royal coffers for a court (2); + * named fruit index; + * candy bar wrapper index; + * scroll of scare monster (when uncursed: never picked up==0, + * has been picked up==1, turns to dust if picked up again; + * when blessed|cursed: flag not checked, set, or cleared); + * scroll of mail (normal==0, bones or wishing==1, written==2); + * splash of venom (normal==0, wishing==1); + * gender for corpses, statues, and figurines (0..3, + * CORPSTAT_GENDER), + * historic flag for statues (4, CORPSTAT_HISTORIC) */ char oclass; /* object class */ char invlet; /* designation in inventory */ char oartifact; /* artifact array index */ - xchar where; /* where the object thinks it is */ + xint8 where; /* where the object thinks it is */ #define OBJ_FREE 0 /* object not attached to anything */ #define OBJ_FLOOR 1 /* object on floor */ #define OBJ_CONTAINED 2 /* object in a container */ @@ -66,17 +80,46 @@ struct obj { #define OBJ_MIGRATING 5 /* object sent off to another level */ #define OBJ_BURIED 6 /* object buried */ #define OBJ_ONBILL 7 /* object on shk bill */ -#define NOBJ_STATES 8 - xchar timed; /* # of fuses (timers) attached to this obj */ - - Bitfield(cursed, 1); +#define OBJ_LUAFREE 8 /* object has been dealloc'd, but is ref'd by lua */ +#define OBJ_DELETED 9 /* object is marked for deletion by dobjsfree() */ + /* note: OBJ_xxx values are used in obj_state_names[] in mkobj.c + so adding, removing, or renumbering these needs to change that too */ +#define NOBJ_STATES 10 + xint16 timed; /* # of fuses (timers) attached to this obj */ + + /* Bitfields currently require 5 bytes minimum */ + Bitfield(cursed, 1); /* uncursed when neither cursed nor blessed */ Bitfield(blessed, 1); - Bitfield(unpaid, 1); /* on some bill */ - Bitfield(no_charge, 1); /* if shk shouldn't charge for this */ - Bitfield(known, 1); /* exact nature known */ - Bitfield(dknown, 1); /* color or text known */ - Bitfield(bknown, 1); /* blessing or curse known */ - Bitfield(rknown, 1); /* rustproof or not known */ + Bitfield(unpaid, 1); /* owned by shop; valid for objects in hero's + * inventory or inside containers there; also, + * used for items on the floor only on the shop + * boundary (including "free spot") or if moved + * from there to inside by wall repairs */ + Bitfield(no_charge, 1); /* if shk shouldn't charge for this; valid for + * items on shop floor or in containers there; + * implicit for items at any other location + * unless carried and explicitly flagged unpaid */ + Bitfield(recharged, 3); /* number of times it's been recharged */ +#define on_ice recharged /* corpse on ice */ + Bitfield(lamplit, 1); /* a light-source -- can be lit */ + + Bitfield(known, 1); /* exact nature known (for instance, charge count + * or enchantment); many items have this preset if + * they lack anything interesting to discover */ + Bitfield(dknown, 1); /* description known (item seen "up close"); + * some types of items always have dknown set; + * use observe_object to set to TRUE so that the + * discoveries list is still correct */ + Bitfield(bknown, 1); /* BUC (blessed/uncursed/cursed) known */ + Bitfield(rknown, 1); /* rustproofing status known */ + Bitfield(cknown, 1); /* for containers (including statues): the contents + * are known; also applicable to tins; also applies + * to horn of plenty but only for empty/non-empty */ + Bitfield(lknown, 1); /* locked/unlocked status is known; assigned for bags + * and for horn of plenty (when tipping) even though + * they have no locks */ + Bitfield(tknown, 1); /* trap status known for chests */ + Bitfield(nomerge, 1); /* set temporarily to prevent merging */ Bitfield(oeroded, 2); /* rusted/burnt weapon/armor */ Bitfield(oeroded2, 2); /* corroded/rotted weapon/armor */ @@ -86,7 +129,7 @@ struct obj { #define MAX_ERODE 3 #define orotten oeroded /* rotten food */ #define odiluted oeroded /* diluted potions */ -#define norevive oeroded2 +#define norevive oeroded2 /* frozen corpse */ Bitfield(oerodeproof, 1); /* erodeproof weapon/armor */ Bitfield(olocked, 1); /* object is locked */ Bitfield(obroken, 1); /* lock has been broken */ @@ -95,62 +138,77 @@ struct obj { /* or accidental tripped rolling boulder trap */ #define opoisoned otrapped /* object (weapon) is coated with poison */ - Bitfield(recharged, 3); /* number of times it's been recharged */ -#define on_ice recharged /* corpse on ice */ - Bitfield(lamplit, 1); /* a light-source -- can be lit */ Bitfield(globby, 1); /* combines with like types on adjacent squares */ - Bitfield(greased, 1); /* covered with grease */ - Bitfield(nomerge, 1); /* set temporarily to prevent merging */ - Bitfield(was_thrown, 1); /* thrown by hero since last picked up */ - + Bitfield(greased, 1); /* covered with grease */ Bitfield(in_use, 1); /* for magic items before useup items */ Bitfield(bypass, 1); /* mark this as an object to be skipped by bhito() */ - Bitfield(cknown, 1); /* contents of container assumed to be known */ - Bitfield(lknown, 1); /* locked/unlocked status is known */ - /* 4 free bits */ + Bitfield(pickup_prev, 1); /* was picked up previously */ + Bitfield(ghostly, 1); /* it just got placed into a bones file */ + Bitfield(how_lost, 3); /* stolen by mon or thrown, dropped by hero, etc */ + + Bitfield(named_how, 1); /* source of name per TODO in resetobjs() */ +#if 0 + /* not implemented */ + Bitfield(eknown, 1); /* effect known for wands zapped or rings worn when + * not seen yet after being picked up while blind + * [maybe for remaining stack of used potion too] */ + /* 5 free bits */ +#else + /* 6 free bits */ +#endif int corpsenm; /* type of corpse is mons[corpsenm] */ #define leashmon corpsenm /* gets m_id of attached pet */ #define fromsink corpsenm /* a potion from a sink */ #define novelidx corpsenm /* 3.6 tribute - the index of the novel title */ -#define record_achieve_special corpsenm +#define migr_species corpsenm /* species to endow for MIGR_TO_SPECIES */ +#define next_boulder corpsenm /* flag for xname() when pushing a pile of + * boulders, 0 for first (top of pile), + * 1 for others (format as "next boulder") */ int usecount; /* overloaded for various things that tally */ #define spestudied usecount /* # of times a spellbook has been studied */ +#define wishedfor usecount /* flag for hold_another_object() if from wish */ unsigned oeaten; /* nutrition left in food, if partly eaten */ long age; /* creation date */ - long owornmask; + long owornmask; /* bit mask indicating which equipment slot(s) an + * item is worn in [by hero or by monster; could + * indicate more than one bit: attached iron ball + * that's also wielded]; + * overloaded for the destination of migrating + * objects (which can't be worn at same time) */ + unsigned lua_ref_cnt; /* # of lua script references for this object */ + xint16 omigr_from_dnum; /* where obj is migrating from */ + xint16 omigr_from_dlevel; /* where obj is migrating from */ struct oextra *oextra; /* pointer to oextra struct */ }; -#define newobj() (struct obj *) alloc(sizeof(struct obj)) +#define newobj() (struct obj *) alloc(sizeof (struct obj)) /*** - ** oextra referencing and testing macros + ** oextra referencing and testing macros */ #define ONAME(o) ((o)->oextra->oname) -#define OMID(o) ((o)->oextra->omid) #define OMONST(o) ((o)->oextra->omonst) -#define OLONG(o) ((o)->oextra->olong) #define OMAILCMD(o) ((o)->oextra->omailcmd) +#define OMID(o) ((o)->oextra->omid) /* non-zero => set, zero => not set */ #define has_oname(o) ((o)->oextra && ONAME(o)) -#define has_omid(o) ((o)->oextra && OMID(o)) #define has_omonst(o) ((o)->oextra && OMONST(o)) -#define has_olong(o) ((o)->oextra && OLONG(o)) #define has_omailcmd(o) ((o)->oextra && OMAILCMD(o)) +#define has_omid(o) ((o)->oextra && OMID(o)) /* Weapons and weapon-tools */ /* KMH -- now based on skill categories. Formerly: - * #define is_sword(otmp) (otmp->oclass == WEAPON_CLASS && \ - * objects[otmp->otyp].oc_wepcat == WEP_SWORD) - * #define is_blade(otmp) (otmp->oclass == WEAPON_CLASS && \ - * (objects[otmp->otyp].oc_wepcat == WEP_BLADE || \ - * objects[otmp->otyp].oc_wepcat == WEP_SWORD)) - * #define is_weptool(o) ((o)->oclass == TOOL_CLASS && \ - * objects[(o)->otyp].oc_weptool) - * #define is_multigen(otyp) (otyp <= SHURIKEN) - * #define is_poisonable(otyp) (otyp <= BEC_DE_CORBIN) + * #define is_sword(otmp) (otmp->oclass == WEAPON_CLASS && \ + * objects[otmp->otyp].oc_wepcat == WEP_SWORD) + * #define is_blade(otmp) (otmp->oclass == WEAPON_CLASS && \ + * (objects[otmp->otyp].oc_wepcat == WEP_BLADE || \ + * objects[otmp->otyp].oc_wepcat == WEP_SWORD)) + * #define is_weptool(o) ((o)->oclass == TOOL_CLASS && \ + * objects[(o)->otyp].oc_weptool) + * #define is_multigen(otyp) (otyp <= SHURIKEN) + * #define is_poisonable(otyp) (otyp <= BEC_DE_CORBIN) */ #define is_blade(otmp) \ (otmp->oclass == WEAPON_CLASS \ @@ -166,10 +224,12 @@ struct obj { (otmp->oclass == WEAPON_CLASS \ && objects[otmp->otyp].oc_skill >= P_SHORT_SWORD \ && objects[otmp->otyp].oc_skill <= P_SABER) +/* Snickersnee is not a polearm, but can hit from distance */ #define is_pole(otmp) \ ((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \ && (objects[otmp->otyp].oc_skill == P_POLEARMS \ - || objects[otmp->otyp].oc_skill == P_LANCE)) + || objects[otmp->otyp].oc_skill == P_LANCE \ + || is_art(otmp, ART_SNICKERSNEE))) #define is_spear(otmp) \ (otmp->oclass == WEAPON_CLASS && objects[otmp->otyp].oc_skill == P_SPEAR) #define is_launcher(otmp) \ @@ -190,6 +250,9 @@ struct obj { ((o)->oclass == TOOL_CLASS && objects[(o)->otyp].oc_skill != P_NONE) /* towel is not a weptool: spe isn't an enchantment, cursed towel doesn't weld to hand, and twoweapon won't work with one */ +#define is_blunt_weapon(o) \ + (((o)->oclass == WEAPON_CLASS || is_weptool(o)) \ + && ((objects[(o)->otyp].oc_dir & WHACK) != 0)) #define is_wet_towel(o) ((o)->otyp == TOWEL && (o)->spe > 0) #define bimanual(otmp) \ ((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \ @@ -198,13 +261,20 @@ struct obj { (otmp->oclass == WEAPON_CLASS \ && objects[otmp->otyp].oc_skill >= -P_SHURIKEN \ && objects[otmp->otyp].oc_skill <= -P_BOW) -#define is_poisonable(otmp) \ - (otmp->oclass == WEAPON_CLASS \ - && objects[otmp->otyp].oc_skill >= -P_SHURIKEN \ - && objects[otmp->otyp].oc_skill <= -P_BOW) +#define is_poisonable(otmp) \ + ((otmp->oclass == WEAPON_CLASS \ + && objects[otmp->otyp].oc_skill >= -P_SHURIKEN \ + && objects[otmp->otyp].oc_skill <= -P_BOW) \ + || permapoisoned(otmp)) #define uslinging() (uwep && objects[uwep->otyp].oc_skill == P_SLING) /* 'is_quest_artifact()' only applies to the current role's artifact */ #define any_quest_artifact(o) ((o)->oartifact >= ART_ORB_OF_DETECTION) +/* 'missile' aspect is up to the caller and does not imply is_missile(); + rings might be launched as missiles when being scattered by an explosion */ +#define stone_missile(o) \ + ((objects[(o)->otyp].oc_material == GEMSTONE \ + || (objects[(o)->otyp].oc_material == MINERAL)) \ + && (o)->oclass != RING_CLASS) /* Armor */ #define is_shield(otmp) \ @@ -244,13 +314,18 @@ struct obj { /* Eggs and other food */ #define MAX_EGG_HATCH_TIME 200 /* longest an egg can remain unhatched */ #define stale_egg(egg) \ - ((monstermoves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME)) + ((svm.moves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME)) #define ofood(o) ((o)->otyp == CORPSE || (o)->otyp == EGG || (o)->otyp == TIN) -#define polyfodder(obj) (ofood(obj) && pm_to_cham((obj)->corpsenm) != NON_PM) + /* note: sometimes eggs and tins have special corpsenm values that + shouldn't be used as an index into mons[] */ +#define polyfood(obj) \ + (ofood(obj) && (obj)->corpsenm >= LOW_PM \ + && (pm_to_cham((obj)->corpsenm) != NON_PM \ + || dmgtype(&mons[(obj)->corpsenm], AD_POLY))) #define mlevelgain(obj) (ofood(obj) && (obj)->corpsenm == PM_WRAITH) #define mhealup(obj) (ofood(obj) && (obj)->corpsenm == PM_NURSE) -#define Is_pudding(o) \ - (o->otyp == GLOB_OF_GRAY_OOZE || o->otyp == GLOB_OF_BROWN_PUDDING \ +#define Is_pudding(o) \ + (o->otyp == GLOB_OF_GRAY_OOZE || o->otyp == GLOB_OF_BROWN_PUDDING \ || o->otyp == GLOB_OF_GREEN_SLIME || o->otyp == GLOB_OF_BLACK_PUDDING) /* Containers */ @@ -260,10 +335,13 @@ struct obj { (/* (Is_container(o) || (o)->otyp == STATUE) && */ \ (o)->cobj != (struct obj *) 0) #define Is_container(o) ((o)->otyp >= LARGE_BOX && (o)->otyp <= BAG_OF_TRICKS) -#define Is_box(otmp) (otmp->otyp == LARGE_BOX || otmp->otyp == CHEST) -#define Is_mbag(otmp) \ - (otmp->otyp == BAG_OF_HOLDING || otmp->otyp == BAG_OF_TRICKS) +#define Is_box(o) ((o)->otyp == LARGE_BOX || (o)->otyp == CHEST) +#define Is_mbag(o) ((o)->otyp == BAG_OF_HOLDING || (o)->otyp == BAG_OF_TRICKS) #define SchroedingersBox(o) ((o)->otyp == LARGE_BOX && (o)->spe == 1) +/* usually waterproof; random chance to be subjected to leakage if cursed; + excludes statues, which aren't vulnerable to water even when cursed */ +#define Waterproof_container(o) \ + ((o)->otyp == OILSKIN_SACK || (o)->otyp == ICE_BOX || Is_box(o)) /* dragon gear */ #define Is_dragon_scales(obj) \ @@ -305,27 +383,31 @@ struct obj { (otmp->otyp == TALLOW_CANDLE || otmp->otyp == WAX_CANDLE) #define MAX_OIL_IN_FLASK 400 /* maximum amount of oil in a potion of oil */ -/* MAGIC_LAMP intentionally excluded below */ -/* age field of this is relative age rather than absolute */ -#define age_is_relative(otmp) \ +/* age field of this is relative age rather than absolute; does not include + magic lamp */ +#define age_is_relative(otmp) \ ((otmp)->otyp == BRASS_LANTERN || (otmp)->otyp == OIL_LAMP \ || (otmp)->otyp == CANDELABRUM_OF_INVOCATION \ || (otmp)->otyp == TALLOW_CANDLE || (otmp)->otyp == WAX_CANDLE \ || (otmp)->otyp == POT_OIL) -/* object can be ignited */ -#define ignitable(otmp) \ +/* object can be ignited; magic lamp used to excluded here too but all + usage of this macro ended up testing + (ignitable(obj) || obj->otyp == MAGIC_LAMP) + so include it; brass lantern can be lit but not by fire */ +#define ignitable(otmp) \ ((otmp)->otyp == BRASS_LANTERN || (otmp)->otyp == OIL_LAMP \ + || ((otmp)->otyp == MAGIC_LAMP && (otmp)->spe > 0) \ || (otmp)->otyp == CANDELABRUM_OF_INVOCATION \ || (otmp)->otyp == TALLOW_CANDLE || (otmp)->otyp == WAX_CANDLE \ || (otmp)->otyp == POT_OIL) /* things that can be read */ -#define is_readable(otmp) \ +#define is_readable(otmp) \ ((otmp)->otyp == FORTUNE_COOKIE || (otmp)->otyp == T_SHIRT \ || (otmp)->otyp == ALCHEMY_SMOCK || (otmp)->otyp == CREDIT_CARD \ || (otmp)->otyp == CAN_OF_GREASE || (otmp)->otyp == MAGIC_MARKER \ || (otmp)->oclass == COIN_CLASS || (otmp)->oartifact == ART_ORB_OF_FATE \ - || (otmp)->otyp == CANDY_BAR) + || (otmp)->otyp == CANDY_BAR || (otmp)->otyp == HAWAIIAN_SHIRT) /* special stones */ #define is_graystone(obj) \ @@ -344,29 +426,37 @@ struct obj { && !undiscovered_artifact(ART_EYES_OF_THE_OVERWORLD))) #define pair_of(o) ((o)->otyp == LENSES || is_gloves(o) || is_boots(o)) -/* 'PRIZE' values override obj->corpsenm so prizes mustn't be object types - which use that field for monster type (or other overloaded purpose) */ -#define MINES_PRIZE 1 -#define SOKO_PRIZE1 2 -#define SOKO_PRIZE2 3 -#define is_mines_prize(o) \ - ((o)->otyp == iflags.mines_prize_type \ - && (o)->record_achieve_special == MINES_PRIZE) -#define is_soko_prize(o) \ - (((o)->otyp == iflags.soko_prize_type1 \ - && (o)->record_achieve_special == SOKO_PRIZE1) \ - || ((o)->otyp == iflags.soko_prize_type2 \ - && (o)->record_achieve_special == SOKO_PRIZE2)) +#define unpolyable(o) ((o)->otyp == WAN_POLYMORPH \ + || (o)->otyp == SPE_POLYMORPH \ + || (o)->otyp == POT_POLYMORPH \ + || (o)->otyp == AMULET_OF_UNCHANGING) + +/* achievement tracking; 3.6.x did this differently */ +#define is_mines_prize(o) ((o)->o_id == svc.context.achieveo.mines_prize_oid) +#define is_soko_prize(o) ((o)->o_id == svc.context.achieveo.soko_prize_oid) + +/* is_art() is now a function in artifact.c */ +/* #define is_art(o,art) ((o) && (o)->oartifact == (art)) */ + +#define u_wield_art(art) is_art(uwep, art) + +/* mummy wrappings are more versatile sizewise than other cloaks */ +#define WrappingAllowed(mptr) \ + (humanoid(mptr) && (mptr)->msize >= MZ_SMALL && (mptr)->msize <= MZ_HUGE \ + && !noncorporeal(mptr) && (mptr)->mlet != S_CENTAUR \ + && (mptr) != &mons[PM_WINGED_GARGOYLE] && (mptr) != &mons[PM_MARILITH]) /* Flags for get_obj_location(). */ #define CONTAINED_TOO 0x1 #define BURIED_TOO 0x2 /* object erosion types */ +#define ERODE_NONE -1 #define ERODE_BURN 0 #define ERODE_RUST 1 #define ERODE_ROT 2 #define ERODE_CORRODE 3 +#define ERODE_CRACK 4 /* crystal armor */ /* erosion flags for erode_obj() */ #define EF_NONE 0 @@ -387,46 +477,61 @@ struct obj { #define POTHIT_MONST_THROW 2 /* thrown by a monster */ #define POTHIT_OTHER_THROW 3 /* propelled by some other means [scatter()] */ +/* tracking how an item left your inventory via how_lost field */ +#define LOST_NONE 0 /* still in inventory, or method not covered below */ +#define LOST_THROWN 1 /* thrown or fired by the hero */ +#define LOST_DROPPED 2 /* dropped or tipped out of a container by the hero */ +#define LOST_STOLEN 3 /* stolen from hero's inventory by a monster */ +#define LOSTOVERRIDEMASK 0x3 +#define LOST_EXPLODING 4 /* the object is exploding (i.e. POT_OIL) */ + +/* tracking how a name got acquired by an object in named_how field */ +#define NAMED_PLAIN 0 /* nothing special, typical naming */ +#define NAMED_KEEP 1 /* historic statue, or stoned/killed monster */ + /* * Notes for adding new oextra structures: * - * 1. Add the structure definition and any required macros in an + * 1. Add the structure definition and any required macros in an * appropriate header file that precedes this one. - * 2. Add a pointer to your new struct to oextra struct in this file. - * 3. Add a referencing macro to this file after the newobj macro above - * (see ONAME, OMONST, OMIN, OLONG, or OMAILCMD for examples). - * 4. Add a testing macro after the set of referencing macros - * (see has_oname(), has_omonst(), has_omin(), has_olong(), - * has_omailcmd() for examples). - * 5. Create newXX(otmp) function and possibly free_XX(otmp) function - * in an appropriate new or existing source file and add a prototype - * for it to include/extern.h. The majority of these are currently - * located in mkobj.c for convenience. + * 2. Add a pointer to your new struct to oextra struct in this file. + * 3. Add a referencing macro to this file after the newobj macro above + * (see ONAME, OMONST, OMAILCMD, or OMIN for examples). + * 4. Add a testing macro after the set of referencing macros + * (see has_oname(), has_omonst(), has_omailcmd(), and has_omin(), + * for examples). + * 5. If your new field isn't a pointer and requires a non-zero value + * on initialization, add code to init_oextra() in src/mkobj.c. + * 6. Create newXX(otmp) function and possibly free_XX(otmp) function + * in an appropriate new or existing source file and add a prototype + * for it to include/extern.h. The majority of these are currently + * located in mkobj.c for convenience. * - * void FDECL(newXX, (struct obj *)); - * void FDECL(free_XX, (struct obj *)); + * void newXX(struct obj *); + * void free_XX(struct obj *); * - * void - * newxx(otmp) - * struct obj *otmp; - * { - * if (!otmp->oextra) otmp->oextra = newoextra(); - * if (!XX(otmp)) { - * XX(otmp) = (struct XX *)alloc(sizeof(struct xx)); - * (void) memset((genericptr_t) XX(otmp), - * 0, sizeof(struct xx)); - * } - * } + * void + * newxx(otmp) + * struct obj *otmp; + * { + * if (!otmp->oextra) + * otmp->oextra = newoextra(); + * if (!XX(otmp)) { + * XX(otmp) = (struct XX *) alloc(sizeof (struct xx)); + * (void) memset((genericptr_t) XX(otmp), + * 0, sizeof (struct xx)); + * } + * } * - * 6. Adjust size_obj() in src/cmd.c appropriately. - * 7. Adjust dealloc_oextra() in src/mkobj.c to clean up - * properly during obj deallocation. - * 8. Adjust copy_oextra() in src/mkobj.c to make duplicate - * copies of your struct or data onto another obj struct. - * 9. Adjust restobj() in src/restore.c to deal with your - * struct or data during a restore. - * 10. Adjust saveobj() in src/save.c to deal with your - * struct or data during a save. + * 7. Adjust size_obj() in src/cmd.c appropriately. + * 8. Adjust dealloc_oextra() in src/mkobj.c to clean up + * properly during obj deallocation. + * 9. Adjust copy_oextra() in src/mkobj.c to make duplicate + * copies of your struct or data onto another obj struct. + * 10. Adjust restobj() in src/restore.c to deal with your + * struct or data during a restore. + * 11. Adjust saveobj() in src/save.c to deal with your + * struct or data during a save. */ #endif /* OBJ_H */ diff --git a/include/objclass.h b/include/objclass.h index a74526c78..96468187a 100644 --- a/include/objclass.h +++ b/include/objclass.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 objclass.h $NHDT-Date: 1547255901 2019/01/12 01:18:21 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ */ +/* NetHack 5.0 objclass.h $NHDT-Date: 1596498553 2020/08/03 23:49:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,6 +10,7 @@ (liquid potion inside glass bottle, metal arrowhead on wooden shaft) and object definitions only specify one type on a best-fit basis */ enum obj_material_types { + NO_MATERIAL = 0, LIQUID = 1, /* currently only for venom */ WAX = 2, VEGGY = 3, /* foodstuffs */ @@ -50,11 +51,11 @@ struct objclass { Bitfield(oc_name_known, 1); /* discovered */ Bitfield(oc_merge, 1); /* merge otherwise equal objects */ Bitfield(oc_uses_known, 1); /* obj->known affects full description; - otherwise, obj->dknown and obj->bknown - tell all, and obj->known should always - be set for proper merging behavior. */ - Bitfield(oc_pre_discovered, 1); /* Already known at start of game; - won't be listed as a discovery. */ + * otherwise, obj->dknown and obj->bknown + * tell all, and obj->known should always + * be set for proper merging behavior. */ + Bitfield(oc_encountered, 1); /* hero has observed such an item at least + once (perhaps without naming it) */ Bitfield(oc_magic, 1); /* inherently magical object */ Bitfield(oc_charged, 1); /* may have +n or (n) charges */ Bitfield(oc_unique, 1); /* special one-of-a-kind object */ @@ -65,39 +66,21 @@ struct objclass { #define oc_bulky oc_big /* for armor */ Bitfield(oc_tough, 1); /* hard gems/rings */ - Bitfield(oc_dir, 2); -#define NODIR 1 /* for wands/spells: non-directional */ -#define IMMEDIATE 2 /* directional */ -#define RAY 3 /* zap beams */ - -#define PIERCE 1 /* for weapons & tools used as weapons */ -#define SLASH 2 /* (latter includes iron ball & chain) */ -#define WHACK 0 - - /* 4 free bits */ - + Bitfield(oc_spare1, 6); /* padding to align oc_dir + oc_material; + * can be cannibalized for other use; + * aka 6 free bits */ + + Bitfield(oc_dir, 3); + /* oc_dir: zap style for wands and spells */ +#define NODIR 1 /* non-directional */ +#define IMMEDIATE 2 /* directional beam that doesn't ricochet */ +#define RAY 3 /* beam that does bounce off walls */ + /* overloaded oc_dir: strike mode bit mask for weapons and weptools */ +#define PIERCE 1 /* pointed weapon punctures target */ +#define SLASH 2 /* sharp weapon cuts target */ +#define WHACK 4 /* blunt weapon bashes target */ Bitfield(oc_material, 5); /* one of obj_material_types */ -#define is_organic(otmp) (objects[otmp->otyp].oc_material <= WOOD) -#define is_metallic(otmp) \ - (objects[otmp->otyp].oc_material >= IRON \ - && objects[otmp->otyp].oc_material <= MITHRIL) - -/* primary damage: fire/rust/--- */ -/* is_flammable(otmp), is_rottable(otmp) in mkobj.c */ -#define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON) - -/* secondary damage: rot/acid/acid */ -#define is_corrodeable(otmp) \ - (objects[otmp->otyp].oc_material == COPPER \ - || objects[otmp->otyp].oc_material == IRON) - -#define is_damageable(otmp) \ - (is_rustprone(otmp) || is_flammable(otmp) || is_rottable(otmp) \ - || is_corrodeable(otmp)) - - /* 3 free bits */ - schar oc_subtyp; #define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */ #define oc_armcat oc_subtyp /* for armor (enum obj_armor_types) */ @@ -108,7 +91,7 @@ struct objclass { uchar oc_color; /* color of the object */ short oc_prob; /* probability, used in mkobj() */ - unsigned short oc_weight; /* encumbrance (1 cn = 0.1 lb.) */ + unsigned oc_weight; /* encumbrance (1 cn = 0.1 lb.) */ short oc_cost; /* base cost in shops */ /* Check the AD&D rules! The FIRST is small monster damage. */ /* for weapons, and tools, rocks, and gems useful as weapons */ @@ -121,6 +104,11 @@ struct objclass { #define oc_level oc_oc2 /* books: spell level */ unsigned short oc_nutrition; /* food value */ + + unsigned long oc_sell_minseen; + unsigned long oc_sell_maxseen; + unsigned long oc_buy_minseen; + unsigned long oc_buy_maxseen; }; struct class_sym { @@ -134,42 +122,38 @@ struct objdescr { const char *oc_descr; /* description when name unknown */ }; -extern NEARDATA struct objclass objects[]; -extern NEARDATA struct objdescr obj_descr[]; - /* * All objects have a class. Make sure that all classes have a corresponding * symbol below. */ -enum obj_class_types { + +enum objclass_defchars { +#define OBJCLASS_DEFCHAR_ENUM +#include "defsym.h" +#undef OBJCLASS_DEFCHAR_ENUM +}; + +enum objclass_classes { RANDOM_CLASS = 0, /* used for generating random objects */ - ILLOBJ_CLASS = 1, - WEAPON_CLASS = 2, - ARMOR_CLASS = 3, - RING_CLASS = 4, - AMULET_CLASS = 5, - TOOL_CLASS = 6, - FOOD_CLASS = 7, - POTION_CLASS = 8, - SCROLL_CLASS = 9, - SPBOOK_CLASS = 10, /* actually SPELL-book */ - WAND_CLASS = 11, - COIN_CLASS = 12, - GEM_CLASS = 13, - ROCK_CLASS = 14, - BALL_CLASS = 15, - CHAIN_CLASS = 16, - VENOM_CLASS = 17, - - MAXOCLASSES = 18 +#define OBJCLASS_CLASS_ENUM +#include "defsym.h" +#undef OBJCLASS_CLASS_ENUM + MAXOCLASSES +}; + +/* Default characters for object classes */ +enum objclass_syms { +#define OBJCLASS_S_ENUM +#include "defsym.h" +#undef OBJCLASS_S_ENUM }; -#define ALLOW_COUNT (MAXOCLASSES + 1) /* Can be used in the object class */ -#define ALL_CLASSES (MAXOCLASSES + 2) /* input to getobj(). */ -#define ALLOW_NONE (MAXOCLASSES + 3) +/* for mkobj() use ONLY! odd '-SPBOOK_CLASS' is in case of unsigned enums */ +#define SPBOOK_no_NOVEL (0 - (int) SPBOOK_CLASS) -#define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode. */ +#define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode */ #define MON_EXPLODE (MAXOCLASSES + 2) /* Exploding monster (e.g. gas spore) */ +#define TRAP_EXPLODE (MAXOCLASSES + 3) #if 0 /* moved to decl.h so that makedefs.c won't see them */ extern const struct class_sym @@ -177,26 +161,6 @@ extern const struct class_sym extern uchar oc_syms[MAXOCLASSES]; /* current class symbols */ #endif -/* Default definitions of all object-symbols (must match classes above). */ - -#define ILLOBJ_SYM ']' /* also used for mimics */ -#define WEAPON_SYM ')' -#define ARMOR_SYM '[' -#define RING_SYM '=' -#define AMULET_SYM '"' -#define TOOL_SYM '(' -#define FOOD_SYM '%' -#define POTION_SYM '!' -#define SCROLL_SYM '?' -#define SPBOOK_SYM '+' -#define WAND_SYM '/' -#define GOLD_SYM '$' -#define GEM_SYM '*' -#define ROCK_SYM '`' -#define BALL_SYM '0' -#define CHAIN_SYM '_' -#define VENOM_SYM '.' - struct fruit { char fname[PL_FSIZ]; int fid; @@ -205,6 +169,46 @@ struct fruit { #define newfruit() (struct fruit *) alloc(sizeof(struct fruit)) #define dealloc_fruit(rind) free((genericptr_t)(rind)) +enum objects_nums { +#define OBJECTS_ENUM +#include "objects.h" +#undef OBJECTS_ENUM + NUM_OBJECTS +}; + +enum misc_object_nums { + NUM_REAL_GEMS = (LAST_REAL_GEM - FIRST_REAL_GEM + 1), + NUM_GLASS_GEMS = (LAST_GLASS_GEM - FIRST_GLASS_GEM + 1), + /* LAST_SPELL is SPE_BLANK_PAPER, guaranteeing that spl_book[] will + have at least one unused slot at end to be used as a terminator */ + MAXSPELL = (LAST_SPELL - FIRST_SPELL + 1), +}; + +extern NEARDATA struct objclass objects[NUM_OBJECTS + 1]; +extern NEARDATA struct objdescr obj_descr[NUM_OBJECTS + 1]; + #define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name) #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr) + +#define is_organic(otmp) (objects[otmp->otyp].oc_material <= WOOD) +#define is_metallic(otmp) \ + (objects[otmp->otyp].oc_material >= IRON \ + && objects[otmp->otyp].oc_material <= MITHRIL) + +/* primary damage: fire/rust/--- */ +/* is_flammable(otmp), is_rottable(otmp) in mkobj.c */ +#define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON) +#define is_crackable(otmp) \ + (objects[(otmp)->otyp].oc_material == GLASS \ + && (otmp)->oclass == ARMOR_CLASS) /* erosion_matters() */ +/* secondary damage: rot/acid/acid */ +#define is_corrodeable(otmp) \ + (objects[otmp->otyp].oc_material == COPPER \ + || objects[otmp->otyp].oc_material == IRON) +/* subject to any damage */ +#define is_damageable(otmp) \ + (is_rustprone(otmp) || is_flammable(otmp) \ + || is_rottable(otmp) || is_corrodeable(otmp) \ + || is_crackable(otmp)) + #endif /* OBJCLASS_H */ diff --git a/include/objects.h b/include/objects.h new file mode 100644 index 000000000..f5d42510e --- /dev/null +++ b/include/objects.h @@ -0,0 +1,1659 @@ +/* NetHack 5.0 objects.h $NHDT-Date: 1749097644 2025/06/04 20:27:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ */ +/* Copyright (c) Mike Threepoint, 1989. */ +/* NetHack may be freely redistributed. See license for details. */ + +/* + The data in this file is processed multiple times by its inclusion + in several places in the code. The results depend on the definition + of the following: + OBJECTS_ENUM to construct object onames enum entries (decl.h). + OBJECTS_DESCR_INIT to construct obj_descr[] array entries (objects.c). + OBJECTS_INIT to construct objects[] array entries (objects.c). +*/ + +#ifndef NoDes +#define NoDes (char *) 0 /* less visual distraction for 'no description' */ +#endif + +#ifndef lint +#define HARDGEM(n) (n >= 8) +#else +#define HARDGEM(n) (0) +#endif + +/* + * Note... + * OBJECTS() currently has 15 parameters; it more become needed, some + * will need to be combined the way BITS() is used, because compilers + * are allowed to impose a limit of 15. + */ + +#if defined(OBJECTS_DESCR_INIT) +#define OBJ(name,desc) name, desc +#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \ + cost,sdam,ldam,oc1,oc2,nut,color,sn) { obj } +#define MARKER(tag,sn) /*empty*/ + +#elif defined(OBJECTS_INIT) +/* notes: 'sub' was once a bitfield but got changed to separate schar when + it was overloaded to hold negative weapon skill indices; the first zero + is padding for oc_prediscovered which has variable init at run-time; + the second zero is oc_spare1 for padding between oc_tough and oc_dir */ +#define BITS(nmkn,mrg,uskn,ctnr,mgc,chrg,uniq,nwsh,big,tuf,dir,sub,mtrl) \ + nmkn,mrg,uskn,0,mgc,chrg,uniq,nwsh,big,tuf,0,dir,mtrl,sub /*cpp fodder*/ +/* note: 0UL-1UL is a method of expressing the largest possible + unsigned long value whilst working around a false-positive warning + in Microsoft Visual C (which assumes that a negative number was + intended despite the explicit U suffix) */ +#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \ + cost,sdam,ldam,oc1,oc2,nut,color,sn) \ + { 0, 0, (char *) 0, bits, prp, sym, dly, color, prob, wt, \ + cost, sdam, ldam, oc1, oc2, nut, (0UL-1UL), 0, (0UL-1UL), 0 } +#define MARKER(tag,sn) /*empty*/ + +#elif defined(OBJECTS_ENUM) +#define OBJ(name,desc) +#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \ + cost,sdam,ldam,oc1,oc2,nut,color,sn) \ + sn +#define MARKER(tag,sn) tag = sn, + +#elif defined(DUMP_ENUMS) +#define OBJ(name,desc) +#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \ + cost,sdam,ldam,oc1,oc2,nut,color,sn) \ + { sn, #sn } +#define MARKER(tag,sn) /*empty*/ + +#else +#error Unproductive inclusion of objects.h +#endif /* OBJECTS_DESCR_INIT || OBJECTS_INIT || OBJECTS_ENUM */ + +#define GENERIC(desc, class, gen_enum) \ + OBJECT(OBJ("generic " desc, desc), \ + BITS(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, P_NONE, 0), \ + 0, class, 0, 0, 0, 0, 0, 0, 0, 0, 0, CLR_GRAY, gen_enum) + +/* dummy object[0] -- description [2nd arg] *must* be NULL */ +OBJECT(OBJ("strange object", NoDes), + BITS(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, 0), + 0, ILLOBJ_CLASS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, STRANGE_OBJECT), +/* slots [1] through [MAXOCLASSES-1] are indexed by class; some are + used for display purposes, most aren't used; none are actual objects; + note that 'real' strange object is in slot [0] but ILLOBJ_CLASS is 1 + so we add a dummy for it in slot [1] to simplify accessing the rest; + there isn't any entry for RANDOM_CLASS (0) */ +GENERIC("strange", ILLOBJ_CLASS, GENERIC_ILLOBJ), /* [1] */ +GENERIC("weapon", WEAPON_CLASS, GENERIC_WEAPON), /* [2] */ +GENERIC("armor", ARMOR_CLASS, GENERIC_ARMOR), /* [3] */ +GENERIC("ring", RING_CLASS, GENERIC_RING), /* [4] */ +GENERIC("amulet", AMULET_CLASS, GENERIC_AMULET), /* [5] */ +GENERIC("tool", TOOL_CLASS, GENERIC_TOOL), /* [6] */ +GENERIC("food", FOOD_CLASS, GENERIC_FOOD), /* [7] */ +GENERIC("potion", POTION_CLASS, GENERIC_POTION), /* [8] */ +GENERIC("scroll", SCROLL_CLASS, GENERIC_SCROLL), /* [9] */ +GENERIC("spellbook", SPBOOK_CLASS, GENERIC_SPBOOK), /* [10] */ +GENERIC("wand", WAND_CLASS, GENERIC_WAND), /* [11] */ +GENERIC("coin", COIN_CLASS, GENERIC_COIN), /* [12] */ +GENERIC("gem", GEM_CLASS, GENERIC_GEM), /* [13] */ +GENERIC("large rock", ROCK_CLASS, GENERIC_ROCK), /* [14] bldr+statue */ +GENERIC("iron ball", BALL_CLASS, GENERIC_BALL), /* [15] */ +GENERIC("iron chain", CHAIN_CLASS, GENERIC_CHAIN), /* [16] */ +GENERIC("venom", VENOM_CLASS, GENERIC_VENOM), /* [17] */ +#undef GENERIC +/* FIRST_OBJECT: it would be simpler just to use MARKER(FIRST_OBJECT,ARROW) + below but that is vulnerable to neglecting to update the marker enum + after inserting something in front of arrow */ +MARKER(LAST_GENERIC, GENERIC_VENOM) +MARKER(FIRST_OBJECT, LAST_GENERIC + 1) +/* this definition of FIRST_OBJECT advances the default value for next enum; + backtrack to fix that, otherwise ARROW and the rest would be off by 1 */ +MARKER(OBJCLASS_HACK, FIRST_OBJECT - 1) + +/* weapons ... */ +#define WEAPON(name,desc,kn,mg,bi,prob,wt, \ + cost,sdam,ldam,hitbon,typ,sub,metal,color,sn) \ + OBJECT(OBJ(name,desc), \ + BITS(kn, mg, 1, 0, 0, 1, 0, 0, bi, 0, typ, sub, metal), \ + 0, WEAPON_CLASS, prob, 0, wt, \ + cost, sdam, ldam, hitbon, 0, wt, color,sn) +#define PROJECTILE(name,desc,kn,prob,wt, \ + cost,sdam,ldam,hitbon,metal,sub,color,sn) \ + OBJECT(OBJ(name,desc), \ + BITS(kn, 1, 1, 0, 0, 1, 0, 0, 0, 0, PIERCE, sub, metal), \ + 0, WEAPON_CLASS, prob, 0, wt, \ + cost, sdam, ldam, hitbon, 0, wt, color, sn) +#define BOW(name,desc,kn,prob,wt,cost,hitbon,metal,sub,color,sn) \ + OBJECT(OBJ(name,desc), \ + BITS(kn, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, sub, metal), \ + 0, WEAPON_CLASS, prob, 0, wt, \ + cost, 2, 2, hitbon, 0, wt, color, sn) + +/* Note: for weapons that don't do an even die of damage (ex. 2-7 or 3-18) + the extra damage is added on in weapon.c, not here! */ + +/* weapon strike mode overloads the oc_dir field */ +#define P PIERCE +#define S SLASH +#define B WHACK + +/* missiles; materiel reflects the arrowhead, not the shaft */ +PROJECTILE("arrow", NoDes, + 1, 55, 1, 2, 6, 6, 0, IRON, -P_BOW, HI_METAL, + ARROW), +PROJECTILE("elven arrow", "runed arrow", + 0, 20, 1, 2, 7, 6, 0, WOOD, -P_BOW, HI_WOOD, + ELVEN_ARROW), +PROJECTILE("orcish arrow", "crude arrow", + 0, 20, 1, 2, 5, 6, 0, IRON, -P_BOW, CLR_BLACK, + ORCISH_ARROW), +PROJECTILE("silver arrow", NoDes, + 1, 12, 1, 5, 6, 6, 0, SILVER, -P_BOW, HI_SILVER, + SILVER_ARROW), +PROJECTILE("ya", "bamboo arrow", + 0, 15, 1, 4, 7, 7, 1, METAL, -P_BOW, HI_METAL, YA), +PROJECTILE("crossbow bolt", NoDes, + 1, 55, 1, 2, 4, 6, 0, IRON, -P_CROSSBOW, HI_METAL, + CROSSBOW_BOLT), + +/* missiles that don't use a launcher */ +WEAPON("dart", NoDes, + 1, 1, 0, 60, 1, 2, 3, 2, 0, P, -P_DART, IRON, HI_METAL, + DART), +WEAPON("shuriken", "throwing star", + 0, 1, 0, 35, 1, 5, 8, 6, 2, P, -P_SHURIKEN, IRON, HI_METAL, + SHURIKEN), +WEAPON("boomerang", NoDes, + 1, 1, 0, 15, 5, 20, 9, 9, 0, 0, -P_BOOMERANG, WOOD, HI_WOOD, + BOOMERANG), + +/* spears [note: javelin used to have a separate skill from spears, + because the latter are primarily stabbing weapons rather than + throwing ones; but for playability, they've been merged together + under spear skill and spears can now be thrown like javelins] */ +WEAPON("spear", NoDes, + 1, 1, 0, 50, 30, 3, 6, 8, 0, P, P_SPEAR, IRON, HI_METAL, + SPEAR), +WEAPON("elven spear", "runed spear", + 0, 1, 0, 10, 30, 3, 7, 8, 0, P, P_SPEAR, WOOD, HI_WOOD, + ELVEN_SPEAR), +WEAPON("orcish spear", "crude spear", + 0, 1, 0, 13, 30, 3, 5, 8, 0, P, P_SPEAR, IRON, CLR_BLACK, + ORCISH_SPEAR), +WEAPON("dwarvish spear", "stout spear", + 0, 1, 0, 12, 35, 3, 8, 8, 0, P, P_SPEAR, IRON, HI_METAL, + DWARVISH_SPEAR), +WEAPON("silver spear", NoDes, + 1, 1, 0, 2, 36, 40, 6, 8, 0, P, P_SPEAR, SILVER, HI_SILVER, + SILVER_SPEAR), +WEAPON("javelin", "throwing spear", + 0, 1, 0, 10, 20, 3, 6, 6, 0, P, P_SPEAR, IRON, HI_METAL, + JAVELIN), + +/* spearish; doesn't stack, not intended to be thrown */ +WEAPON("trident", NoDes, + 1, 0, 0, 8, 25, 5, 6, 4, 0, P, P_TRIDENT, IRON, HI_METAL, + TRIDENT), + /* +1 small, +2d4 large */ + +/* blades; all stack */ +WEAPON("dagger", NoDes, + 1, 1, 0, 30, 10, 4, 4, 3, 2, P, P_DAGGER, IRON, HI_METAL, + DAGGER), +WEAPON("elven dagger", "runed dagger", + 0, 1, 0, 10, 10, 4, 5, 3, 2, P, P_DAGGER, WOOD, HI_WOOD, + ELVEN_DAGGER), +WEAPON("orcish dagger", "crude dagger", + 0, 1, 0, 12, 10, 4, 3, 3, 2, P, P_DAGGER, IRON, CLR_BLACK, + ORCISH_DAGGER), +WEAPON("silver dagger", NoDes, + 1, 1, 0, 3, 12, 40, 4, 3, 2, P, P_DAGGER, SILVER, HI_SILVER, + SILVER_DAGGER), +WEAPON("athame", NoDes, + 1, 1, 0, 0, 10, 4, 4, 3, 2, S, P_DAGGER, IRON, HI_METAL, + ATHAME), +WEAPON("scalpel", NoDes, + 1, 1, 0, 0, 5, 6, 3, 3, 2, S, P_KNIFE, METAL, HI_METAL, + SCALPEL), +WEAPON("knife", NoDes, + 1, 1, 0, 20, 5, 4, 3, 2, 0, P|S, P_KNIFE, IRON, HI_METAL, + KNIFE), +WEAPON("stiletto", NoDes, + 1, 1, 0, 5, 5, 4, 3, 2, 0, P|S, P_KNIFE, IRON, HI_METAL, + STILETTO), +/* 3.6: worm teeth and crysknives now stack; + when a stack of teeth is enchanted at once, they fuse into one crysknife; + when a stack of crysknives drops, the whole stack reverts to teeth */ +/* 5.0: change crysknife from MINERAL to BONE and worm tooth from 0 to BONE */ +WEAPON("worm tooth", NoDes, + 1, 1, 0, 0, 20, 2, 2, 2, 0, 0, P_KNIFE, BONE, CLR_WHITE, + WORM_TOOTH), +WEAPON("crysknife", NoDes, + 1, 1, 0, 0, 20, 100, 10, 10, 3, P, P_KNIFE, BONE, CLR_WHITE, + CRYSKNIFE), + +/* axes */ +WEAPON("axe", NoDes, + 1, 0, 0, 40, 60, 8, 6, 4, 0, S, P_AXE, IRON, HI_METAL, + AXE), +WEAPON("battle-axe", "double-headed axe", /* "double-bitted"? */ + 0, 0, 1, 10, 120, 40, 8, 6, 0, S, P_AXE, IRON, HI_METAL, + BATTLE_AXE), + +/* swords */ +WEAPON("short sword", NoDes, + 1, 0, 0, 8, 30, 10, 6, 8, 0, P, P_SHORT_SWORD, IRON, HI_METAL, + SHORT_SWORD), +WEAPON("elven short sword", "runed short sword", + 0, 0, 0, 2, 30, 10, 8, 8, 0, P, P_SHORT_SWORD, WOOD, HI_WOOD, + ELVEN_SHORT_SWORD), +WEAPON("orcish short sword", "crude short sword", + 0, 0, 0, 3, 30, 10, 5, 8, 0, P, P_SHORT_SWORD, IRON, CLR_BLACK, + ORCISH_SHORT_SWORD), +WEAPON("dwarvish short sword", "broad short sword", + 0, 0, 0, 2, 30, 10, 7, 8, 0, P, P_SHORT_SWORD, IRON, HI_METAL, + DWARVISH_SHORT_SWORD), +WEAPON("scimitar", "curved sword", + 0, 0, 0, 15, 40, 15, 8, 8, 0, S, P_SABER, IRON, HI_METAL, + SCIMITAR), +WEAPON("silver saber", NoDes, + 1, 0, 0, 6, 40, 75, 8, 8, 0, S, P_SABER, SILVER, HI_SILVER, + SILVER_SABER), +WEAPON("broadsword", NoDes, + 1, 0, 0, 8, 70, 10, 4, 6, 0, S, P_BROAD_SWORD, IRON, HI_METAL, + BROADSWORD), + /* +d4 small, +1 large */ +WEAPON("elven broadsword", "runed broadsword", + 0, 0, 0, 4, 70, 10, 6, 6, 0, S, P_BROAD_SWORD, WOOD, HI_WOOD, + ELVEN_BROADSWORD), + /* +d4 small, +1 large */ +WEAPON("long sword", NoDes, + 1, 0, 0, 50, 40, 15, 8, 12, 0, S, P_LONG_SWORD, IRON, HI_METAL, + LONG_SWORD), +WEAPON("two-handed sword", NoDes, + 1, 0, 1, 22, 150, 50, 12, 6, 0, S, P_TWO_HANDED_SWORD, + IRON, HI_METAL, + TWO_HANDED_SWORD), + /* +2d6 large */ +WEAPON("katana", "samurai sword", + 0, 0, 0, 4, 40, 80, 10, 12, 1, S, P_LONG_SWORD, IRON, HI_METAL, + KATANA), +/* special swords set up for artifacts */ +WEAPON("tsurugi", "long samurai sword", + 0, 0, 1, 0, 60, 500, 16, 8, 2, S, P_TWO_HANDED_SWORD, + METAL, HI_METAL, + TSURUGI), + /* +2d6 large */ +WEAPON("runesword", "runed broadsword", + 0, 0, 0, 0, 40, 300, 4, 6, 0, S, P_BROAD_SWORD, IRON, CLR_BLACK, + RUNESWORD), + /* +d4 small, +1 large; Stormbringer: +5d2 +d8 from level drain */ + +/* polearms */ +/* spear-type */ +WEAPON("partisan", "vulgar polearm", + 0, 0, 1, 5, 80, 10, 6, 6, 0, P, P_POLEARMS, IRON, HI_METAL, + PARTISAN), + /* +1 large */ +WEAPON("ranseur", "hilted polearm", + 0, 0, 1, 5, 50, 6, 4, 4, 0, P, P_POLEARMS, IRON, HI_METAL, + RANSEUR), + /* +d4 both */ +WEAPON("spetum", "forked polearm", + 0, 0, 1, 5, 50, 5, 6, 6, 0, P, P_POLEARMS, IRON, HI_METAL, + SPETUM), + /* +1 small, +d6 large */ +WEAPON("glaive", "single-edged polearm", + 0, 0, 1, 8, 75, 6, 6, 10, 0, S, P_POLEARMS, IRON, HI_METAL, + GLAIVE), +/* axe-type */ +WEAPON("halberd", "angled poleaxe", + 0, 0, 1, 8, 150, 10, 10, 6, 0, P|S, P_POLEARMS, IRON, HI_METAL, + HALBERD), + /* +1d6 large */ +WEAPON("bardiche", "long poleaxe", + 0, 0, 1, 4, 120, 7, 4, 4, 0, S, P_POLEARMS, IRON, HI_METAL, + BARDICHE), + /* +1d4 small, +2d4 large */ +WEAPON("voulge", "pole cleaver", + 0, 0, 1, 4, 125, 5, 4, 4, 0, S, P_POLEARMS, IRON, HI_METAL, + VOULGE), + /* +d4 both */ +/* curved/hooked */ +WEAPON("fauchard", "pole sickle", + 0, 0, 1, 6, 60, 5, 6, 8, 0, P|S, P_POLEARMS, IRON, HI_METAL, + FAUCHARD), +WEAPON("guisarme", "pruning hook", + 0, 0, 1, 6, 80, 5, 4, 8, 0, S, P_POLEARMS, IRON, HI_METAL, + GUISARME), + /* +1d4 small */ +WEAPON("bill-guisarme", "hooked polearm", + 0, 0, 1, 4, 120, 7, 4, 10, 0, P|S, P_POLEARMS, IRON, HI_METAL, + BILL_GUISARME), + /* +1d4 small */ +/* other */ +WEAPON("lucern hammer", "pronged polearm", + 0, 0, 1, 5, 150, 7, 4, 6, 0, B|P, P_POLEARMS, IRON, HI_METAL, + LUCERN_HAMMER), + /* +1d4 small */ +WEAPON("bec de corbin", "beaked polearm", + 0, 0, 1, 4, 100, 8, 8, 6, 0, B|P, P_POLEARMS, IRON, HI_METAL, + BEC_DE_CORBIN), + +/* formerly grouped with the polearms but don't use polearms skill; + lance isn't even two-handed */ +WEAPON("dwarvish mattock", "broad pick", + 0, 0, 1, 13, 120, 50, 12, 8, -1, B, P_PICK_AXE, IRON, HI_METAL, + DWARVISH_MATTOCK), +WEAPON("lance", NoDes, + 1, 0, 0, 4, 180, 10, 6, 8, 0, P, P_LANCE, IRON, HI_METAL, + LANCE), + /* +2d10 when jousting with lance as primary weapon, + +2d2 when jousting with it as secondary when dual wielding */ + +/* bludgeons */ +WEAPON("mace", NoDes, + 1, 0, 0, 40, 30, 5, 6, 6, 0, B, P_MACE, IRON, HI_METAL, + MACE), + /* +1 small */ +WEAPON("silver mace", NoDes, + 1, 0, 0, 2, 36, 60, 6, 6, 0, B, P_MACE, SILVER, HI_SILVER, + SILVER_MACE), + /* +1 small */ +WEAPON("morning star", NoDes, + 1, 0, 0, 12, 120, 10, 4, 6, 0, B, P_MORNING_STAR, IRON, HI_METAL, + MORNING_STAR), + /* +d4 small, +1 large */ +WEAPON("war hammer", NoDes, + 1, 0, 0, 15, 50, 5, 4, 4, 0, B, P_HAMMER, IRON, HI_METAL, + WAR_HAMMER), + /* +1 small */ +WEAPON("club", NoDes, + 1, 0, 0, 12, 30, 3, 6, 3, 0, B, P_CLUB, WOOD, HI_WOOD, + CLUB), +WEAPON("rubber hose", NoDes, + 1, 0, 0, 0, 20, 3, 4, 3, 0, B, P_WHIP, PLASTIC, CLR_BROWN, + RUBBER_HOSE), +WEAPON("quarterstaff", "staff", + 0, 0, 1, 11, 40, 5, 6, 6, 0, B, P_QUARTERSTAFF, WOOD, HI_WOOD, + QUARTERSTAFF), +/* two-piece */ +WEAPON("aklys", "thonged club", + 0, 0, 0, 8, 15, 4, 6, 3, 0, B, P_CLUB, IRON, HI_METAL, + AKLYS), +WEAPON("flail", NoDes, + 1, 0, 0, 40, 15, 4, 6, 4, 0, B, P_FLAIL, IRON, HI_METAL, + FLAIL), + /* +1 small, +1d4 large */ + +/* misc */ +WEAPON("bullwhip", NoDes, + 1, 0, 0, 2, 20, 4, 2, 1, 0, 0, P_WHIP, LEATHER, CLR_BROWN, + BULLWHIP), + +/* bows */ +BOW("bow", NoDes, 1, 24, 30, 60, 0, WOOD, P_BOW, HI_WOOD, + BOW), +BOW("elven bow", "runed bow", 0, 12, 30, 60, 0, WOOD, P_BOW, HI_WOOD, + ELVEN_BOW), +BOW("orcish bow", "crude bow", 0, 12, 30, 60, 0, WOOD, P_BOW, CLR_BLACK, + ORCISH_BOW), +BOW("yumi", "long bow", 0, 0, 30, 60, 0, WOOD, P_BOW, HI_WOOD, + YUMI), +BOW("sling", NoDes, 1, 40, 3, 20, 0, LEATHER, P_SLING, HI_LEATHER, + SLING), +BOW("crossbow", NoDes, 1, 45, 50, 40, 0, WOOD, P_CROSSBOW, HI_WOOD, + CROSSBOW), + +#undef P +#undef S +#undef B + +#undef WEAPON +#undef PROJECTILE +#undef BOW + +/* armor ... */ + /* IRON denotes ferrous metals, including steel. + * Only IRON weapons and armor can rust. + * Only COPPER (including brass) corrodes. + * Some creatures are vulnerable to SILVER. + */ +#define ARMOR(name,desc,kn,mgc,blk,power,prob,delay,wt, \ + cost,ac,can,sub,metal,c,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(kn, 0, 1, 0, mgc, 1, 0, 0, blk, 0, 0, sub, metal), \ + power, ARMOR_CLASS, prob, delay, wt, \ + cost, 0, 0, 10 - ac, can, wt, c, sn) +#define HELM(name,desc,kn,mgc,power,prob,delay,wt,cost,ac,can,metal,c,sn) \ + ARMOR(name, desc, kn, mgc, 0, power, prob, delay, wt, \ + cost, ac, can, ARM_HELM, metal, c, sn) +#define CLOAK(name,desc,kn,mgc,power,prob,delay,wt,cost,ac,can,metal,c,sn) \ + ARMOR(name, desc, kn, mgc, 0, power, prob, delay, wt, \ + cost, ac, can, ARM_CLOAK, metal, c,sn) +#define SHIELD(name,desc,kn,mgc,blk,pow,prob,delay,wt,cost,ac,can,metal,c,sn) \ + ARMOR(name, desc, kn, mgc, blk, pow, prob, delay, wt, \ + cost, ac, can, ARM_SHIELD, metal, c,sn) +#define GLOVES(name,desc,kn,mgc,power,prob,delay,wt,cost,ac,can,metal,c,sn) \ + ARMOR(name, desc, kn, mgc, 0, power, prob, delay, wt, \ + cost, ac, can, ARM_GLOVES, metal, c,sn) +#define BOOTS(name,desc,kn,mgc,power,prob,delay,wt,cost,ac,can,metal,c,sn) \ + ARMOR(name, desc, kn, mgc, 0, power, prob, delay, wt, \ + cost, ac, can, ARM_BOOTS, metal, c,sn) + +/* helmets */ +HELM("elven leather helm", "leather hat", + 0, 0, 0, 6, 1, 3, 8, 9, 0, LEATHER, HI_LEATHER, + ELVEN_LEATHER_HELM), +HELM("orcish helm", "iron skull cap", + 0, 0, 0, 6, 1, 30, 10, 9, 0, IRON, CLR_BLACK, + ORCISH_HELM), +HELM("dwarvish iron helm", "hard hat", + 0, 0, 0, 6, 1, 40, 20, 8, 0, IRON, HI_METAL, + DWARVISH_IRON_HELM), +HELM("fedora", NoDes, + 1, 0, 0, 0, 0, 3, 1, 10, 0, CLOTH, CLR_BROWN, + FEDORA), +HELM("cornuthaum", "conical hat", + 0, 1, CLAIRVOYANT, 5, 1, 4, 80, 10, 1, CLOTH, CLR_BLUE, + /* name coined by devteam; confers clairvoyance for wizards, + blocks clairvoyance if worn by role other than wizard */ + CORNUTHAUM), +HELM("dunce cap", "conical hat", + 0, 1, 0, 5, 1, 4, 1, 10, 0, CLOTH, CLR_BLUE, + /* sets Int and Wis to fixed value of 6, so actually provides + protection against death caused by Int being drained below 3 */ + DUNCE_CAP), +HELM("dented pot", NoDes, + 1, 0, 0, 2, 0, 10, 8, 9, 0, IRON, CLR_BLACK, + DENTED_POT), +HELM("helm of brilliance", "crystal helmet", + 0, 1, 0, 6, 1, 40, 50, 9, 0, GLASS, CLR_WHITE, + /* used to be iron and shuffled as "etched helmet" but required + special case for the effect of iron armor on spell casting */ + HELM_OF_BRILLIANCE), +/* with shuffled appearances... */ +HELM("helmet", "plumed helmet", + 0, 0, 0, 10, 1, 30, 10, 9, 0, IRON, HI_METAL, + HELMET), +HELM("helm of caution", "etched helmet", + 0, 1, WARNING, 6, 1, 50, 50, 9, 0, IRON, CLR_GREEN, + HELM_OF_CAUTION), +HELM("helm of opposite alignment", "crested helmet", + 0, 1, 0, 10, 1, 50, 50, 9, 0, IRON, HI_METAL, + HELM_OF_OPPOSITE_ALIGNMENT), +HELM("helm of telepathy", "visored helmet", + 0, 1, TELEPAT, 4, 1, 50, 50, 9, 0, IRON, HI_METAL, + HELM_OF_TELEPATHY), + +/* suits of armor */ +/* + * There is code in polyself.c that assumes (1) and (2). + * There is code in obj.h, objnam.c, mon.c, read.c that assumes (2). + * (1) The dragon scale mails and the dragon scales are together. + * (2) That the order of the dragon scale mail and dragon scales + * is the same as order of dragons defined in monst.c. + */ +#define DRGN_ARMR(name,mgc,power,cost,ac,color,snam) \ + ARMOR(name, NoDes, 1, mgc, 1, power, 0, 5, 40, \ + cost, ac, 0, ARM_SUIT, DRAGON_HIDE, color,snam) +/* 3.4.1: dragon scale mail reclassified as "magic" since magic is + needed to create them */ +DRGN_ARMR("gray dragon scale mail", 1, ANTIMAGIC, 1200, 1, CLR_GRAY, + GRAY_DRAGON_SCALE_MAIL), + /* gold DSM is a light source; there's no property for that */ +DRGN_ARMR("gold dragon scale mail", 1, 0, 900, 1, HI_GOLD, + GOLD_DRAGON_SCALE_MAIL), +DRGN_ARMR("silver dragon scale mail", 1, REFLECTING, 1200, 1, DRAGON_SILVER, + SILVER_DRAGON_SCALE_MAIL), +#if 0 /* DEFERRED */ +DRGN_ARMR("shimmering dragon scale mail", 1, DISPLACED, 1200, 1, CLR_CYAN, + SHIMMERING_DRAGON_SCALE_MAIL), +#endif +DRGN_ARMR("red dragon scale mail", 1, FIRE_RES, 900, 1, CLR_RED, + RED_DRAGON_SCALE_MAIL), +DRGN_ARMR("white dragon scale mail", 1, COLD_RES, 900, 1, CLR_WHITE, + WHITE_DRAGON_SCALE_MAIL), +DRGN_ARMR("orange dragon scale mail", 1, SLEEP_RES, 900, 1, CLR_ORANGE, + ORANGE_DRAGON_SCALE_MAIL), +DRGN_ARMR("black dragon scale mail", 1, DISINT_RES, 1200, 1, CLR_BLACK, + BLACK_DRAGON_SCALE_MAIL), +DRGN_ARMR("blue dragon scale mail", 1, SHOCK_RES, 900, 1, CLR_BLUE, + BLUE_DRAGON_SCALE_MAIL), +DRGN_ARMR("green dragon scale mail", 1, POISON_RES, 900, 1, CLR_GREEN, + GREEN_DRAGON_SCALE_MAIL), +DRGN_ARMR("yellow dragon scale mail", 1, ACID_RES, 900, 1, CLR_YELLOW, + YELLOW_DRAGON_SCALE_MAIL), +/* For now, only dragons leave these. */ +/* 3.4.1: dragon scales left classified as "non-magic"; they confer magical + properties but are produced "naturally"; affects use as polypile fodder */ +DRGN_ARMR("gray dragon scales", 0, ANTIMAGIC, 700, 7, CLR_GRAY, + GRAY_DRAGON_SCALES), +DRGN_ARMR("gold dragon scales", 0, 0, 500, 7, HI_GOLD, + GOLD_DRAGON_SCALES), +DRGN_ARMR("silver dragon scales", 0, REFLECTING, 700, 7, DRAGON_SILVER, + SILVER_DRAGON_SCALES), +#if 0 /* DEFERRED */ +DRGN_ARMR("shimmering dragon scales", 0, DISPLACED, 700, 7, CLR_CYAN, + SHIMMERING_DRAGON_SCALES), +#endif +DRGN_ARMR("red dragon scales", 0, FIRE_RES, 500, 7, CLR_RED, + RED_DRAGON_SCALES), +DRGN_ARMR("white dragon scales", 0, COLD_RES, 500, 7, CLR_WHITE, + WHITE_DRAGON_SCALES), +DRGN_ARMR("orange dragon scales", 0, SLEEP_RES, 500, 7, CLR_ORANGE, + ORANGE_DRAGON_SCALES), +DRGN_ARMR("black dragon scales", 0, DISINT_RES, 700, 7, CLR_BLACK, + BLACK_DRAGON_SCALES), +DRGN_ARMR("blue dragon scales", 0, SHOCK_RES, 500, 7, CLR_BLUE, + BLUE_DRAGON_SCALES), +DRGN_ARMR("green dragon scales", 0, POISON_RES, 500, 7, CLR_GREEN, + GREEN_DRAGON_SCALES), +DRGN_ARMR("yellow dragon scales", 0, ACID_RES, 500, 7, CLR_YELLOW, + YELLOW_DRAGON_SCALES), +#undef DRGN_ARMR +/* other suits */ +ARMOR("plate mail", NoDes, + 1, 0, 1, 0, 40, 5, 450, 600, 3, 2, ARM_SUIT, IRON, HI_METAL, + PLATE_MAIL), +ARMOR("crystal plate mail", NoDes, + 1, 0, 1, 0, 10, 5, 415, 820, 3, 2, ARM_SUIT, GLASS, CLR_WHITE, + CRYSTAL_PLATE_MAIL), +ARMOR("bronze plate mail", NoDes, + 1, 0, 1, 0, 23, 5, 450, 400, 4, 1, ARM_SUIT, COPPER, HI_COPPER, + BRONZE_PLATE_MAIL), +ARMOR("splint mail", NoDes, + 1, 0, 1, 0, 57, 5, 400, 80, 4, 1, ARM_SUIT, IRON, HI_METAL, + SPLINT_MAIL), +ARMOR("banded mail", NoDes, + 1, 0, 1, 0, 66, 5, 350, 90, 4, 1, ARM_SUIT, IRON, HI_METAL, + BANDED_MAIL), +ARMOR("dwarvish mithril-coat", NoDes, + 1, 0, 0, 0, 10, 1, 150, 240, 4, 2, ARM_SUIT, MITHRIL, HI_SILVER, + DWARVISH_MITHRIL_COAT), +ARMOR("elven mithril-coat", NoDes, + 1, 0, 0, 0, 15, 1, 150, 240, 5, 2, ARM_SUIT, MITHRIL, HI_SILVER, + ELVEN_MITHRIL_COAT), +ARMOR("chain mail", NoDes, + 1, 0, 0, 0, 66, 5, 300, 75, 5, 1, ARM_SUIT, IRON, HI_METAL, + CHAIN_MAIL), +ARMOR("orcish chain mail", "crude chain mail", + 0, 0, 0, 0, 19, 5, 300, 75, 6, 1, ARM_SUIT, IRON, CLR_BLACK, + ORCISH_CHAIN_MAIL), +ARMOR("scale mail", NoDes, + 1, 0, 0, 0, 66, 5, 250, 45, 6, 1, ARM_SUIT, IRON, HI_METAL, + SCALE_MAIL), +ARMOR("studded leather armor", NoDes, + 1, 0, 0, 0, 66, 3, 200, 15, 7, 1, ARM_SUIT, LEATHER, HI_LEATHER, + STUDDED_LEATHER_ARMOR), +ARMOR("ring mail", NoDes, + 1, 0, 0, 0, 66, 5, 250, 100, 7, 1, ARM_SUIT, IRON, HI_METAL, + RING_MAIL), +ARMOR("orcish ring mail", "crude ring mail", + 0, 0, 0, 0, 19, 5, 250, 80, 8, 1, ARM_SUIT, IRON, CLR_BLACK, + ORCISH_RING_MAIL), +ARMOR("leather armor", NoDes, + 1, 0, 0, 0, 75, 3, 150, 5, 8, 1, ARM_SUIT, LEATHER, HI_LEATHER, + LEATHER_ARMOR), +ARMOR("leather jacket", NoDes, + 1, 0, 0, 0, 11, 0, 30, 10, 9, 0, ARM_SUIT, LEATHER, CLR_BLACK, + LEATHER_JACKET), + +/* shirts */ +ARMOR("Hawaiian shirt", NoDes, + 1, 0, 0, 0, 8, 0, 5, 3, 10, 0, ARM_SHIRT, CLOTH, CLR_MAGENTA, + HAWAIIAN_SHIRT), +ARMOR("T-shirt", NoDes, + 1, 0, 0, 0, 2, 0, 5, 2, 10, 0, ARM_SHIRT, CLOTH, CLR_WHITE, + T_SHIRT), + +/* cloaks */ +CLOAK("mummy wrapping", NoDes, + 1, 0, 0, 0, 0, 3, 2, 10, 1, CLOTH, CLR_GRAY, + MUMMY_WRAPPING), + /* worn mummy wrapping blocks invisibility */ +CLOAK("elven cloak", "faded pall", + 0, 1, STEALTH, 8, 0, 10, 60, 9, 1, CLOTH, CLR_BLACK, ELVEN_CLOAK), +CLOAK("orcish cloak", "coarse mantelet", + 0, 0, 0, 8, 0, 10, 40, 10, 1, CLOTH, CLR_BLACK, + ORCISH_CLOAK), +CLOAK("dwarvish cloak", "hooded cloak", + 0, 0, 0, 8, 0, 10, 50, 10, 1, CLOTH, HI_CLOTH, + DWARVISH_CLOAK), +CLOAK("oilskin cloak", "slippery cloak", + 0, 0, 0, 8, 0, 10, 50, 9, 2, CLOTH, HI_CLOTH, + OILSKIN_CLOAK), +CLOAK("robe", NoDes, + 1, 1, 0, 6, 0, 15, 50, 8, 2, CLOTH, CLR_RED, ROBE), + /* robe was adopted from slash'em, where it's worn as a suit + rather than as a cloak and there are several variations */ +CLOAK("alchemy smock", "apron", + 0, 1, POISON_RES, 11, 0, 10, 50, 9, 1, CLOTH, CLR_WHITE, + ALCHEMY_SMOCK), +CLOAK("leather cloak", NoDes, + 1, 0, 0, 8, 0, 15, 40, 9, 1, LEATHER, CLR_BROWN, + LEATHER_CLOAK), +/* with shuffled appearances... */ +CLOAK("cloak of protection", "tattered cape", + 0, 1, PROTECTION, 11, 0, 10, 50, 7, 3, CLOTH, HI_CLOTH, + CLOAK_OF_PROTECTION), + /* cloak of protection is now the only item conferring MC 3 */ +CLOAK("cloak of invisibility", "opera cloak", + 0, 1, INVIS, 12, 0, 10, 60, 9, 1, CLOTH, CLR_BRIGHT_MAGENTA, + CLOAK_OF_INVISIBILITY), +CLOAK("cloak of magic resistance", "ornamental cope", + 0, 1, ANTIMAGIC, 6, 0, 10, 60, 9, 1, CLOTH, CLR_WHITE, + CLOAK_OF_MAGIC_RESISTANCE), + /* 'cope' is not a spelling mistake... leave it be */ +CLOAK("cloak of displacement", "piece of cloth", + 0, 1, DISPLACED, 12, 0, 10, 50, 9, 1, CLOTH, HI_CLOTH, + CLOAK_OF_DISPLACEMENT), + +/* shields */ +SHIELD("small shield", "wooden shield", + 0, 0, 0, 0, 6, 0, 30, 3, 9, 0, WOOD, HI_WOOD, + SMALL_SHIELD), +SHIELD("shield of drain resistance", "wooden shield", + 0, 1, 0, DRAIN_RES, 12, 0, 30, 50, 9, 0, WOOD, HI_WOOD, + SHIELD_OF_DRAIN_RESISTANCE), +SHIELD("shield of shock resistance", "wooden shield", + 0, 1, 0, SHOCK_RES, 12, 0, 30, 50, 9, 0, WOOD, HI_WOOD, + SHIELD_OF_SHOCK_RESISTANCE), +SHIELD("elven shield", "blue and green shield", + 0, 0, 0, 0, 2, 0, 40, 7, 8, 0, WOOD, CLR_GREEN, + ELVEN_SHIELD), +SHIELD("Uruk-hai shield", "white-handed shield", + 0, 0, 0, 0, 2, 0, 50, 7, 9, 0, IRON, HI_METAL, + URUK_HAI_SHIELD), +SHIELD("orcish shield", "red-eyed shield", + 0, 0, 0, 0, 2, 0, 50, 7, 9, 0, IRON, CLR_RED, + ORCISH_SHIELD), +SHIELD("large shield", NoDes, + 1, 0, 1, 0, 4, 0, 100, 10, 8, 0, IRON, HI_METAL, + LARGE_SHIELD), +SHIELD("dwarvish roundshield", "large round shield", + 0, 0, 0, 0, 3, 0, 100, 10, 8, 0, IRON, HI_METAL, + DWARVISH_ROUNDSHIELD), +SHIELD("shield of reflection", "polished silver shield", + 0, 1, 0, REFLECTING, 7, 0, 50, 50, 8, 0, SILVER, HI_SILVER, + SHIELD_OF_REFLECTION), + +/* gloves */ +/* These have their color but not material shuffled, so the IRON must + * stay CLR_BROWN (== HI_LEATHER) even though it's normally either + * HI_METAL or CLR_BLACK. All have shuffled descriptions. + */ +GLOVES("leather gloves", "old gloves", + 0, 0, 0, 15, 1, 10, 8, 9, 0, LEATHER, HI_LEATHER, + LEATHER_GLOVES), +GLOVES("gauntlets of fumbling", "padded gloves", + 0, 1, FUMBLING, 8, 1, 10, 50, 9, 0, LEATHER, HI_LEATHER, + GAUNTLETS_OF_FUMBLING), +GLOVES("gauntlets of power", "riding gloves", + 0, 1, 0, 8, 1, 30, 50, 9, 0, IRON, CLR_BROWN, + GAUNTLETS_OF_POWER), +GLOVES("gauntlets of dexterity", "fencing gloves", + 0, 1, 0, 8, 1, 10, 50, 9, 0, LEATHER, HI_LEATHER, + GAUNTLETS_OF_DEXTERITY), + +/* boots */ +BOOTS("low boots", "walking shoes", + 0, 0, 0, 23, 2, 10, 8, 9, 0, LEATHER, HI_LEATHER, LOW_BOOTS), +BOOTS("iron shoes", "hard shoes", + 0, 0, 0, 7, 2, 50, 16, 8, 0, IRON, HI_METAL, IRON_SHOES), +BOOTS("high boots", "jackboots", + 0, 0, 0, 14, 2, 20, 12, 8, 0, LEATHER, HI_LEATHER, HIGH_BOOTS), +/* with shuffled appearances... */ +BOOTS("speed boots", "combat boots", + 0, 1, FAST, 12, 2, 20, 50, 9, 0, LEATHER, HI_LEATHER, SPEED_BOOTS), +BOOTS("water walking boots", "jungle boots", + 0, 1, WWALKING, 12, 2, 15, 50, 9, 0, LEATHER, HI_LEATHER, + WATER_WALKING_BOOTS), +BOOTS("jumping boots", "hiking boots", + 0, 1, JUMPING, 12, 2, 20, 50, 9, 0, LEATHER, HI_LEATHER, + JUMPING_BOOTS), +BOOTS("elven boots", "mud boots", + 0, 1, STEALTH, 12, 2, 15, 8, 9, 0, LEATHER, HI_LEATHER, + ELVEN_BOOTS), +BOOTS("kicking boots", "buckled boots", + 0, 1, 0, 12, 2, 50, 8, 9, 0, IRON, CLR_BROWN, + KICKING_BOOTS), + /* CLR_BROWN for same reason as gauntlets of power */ +BOOTS("fumble boots", "riding boots", + 0, 1, FUMBLING, 12, 2, 20, 30, 9, 0, LEATHER, HI_LEATHER, + FUMBLE_BOOTS), +BOOTS("levitation boots", "snow boots", + 0, 1, LEVITATION, 12, 2, 15, 30, 9, 0, LEATHER, HI_LEATHER, + LEVITATION_BOOTS), +#undef HELM +#undef CLOAK +#undef SHIELD +#undef GLOVES +#undef BOOTS +#undef ARMOR + +/* rings ... */ +#define RING(name,stone,power,cost,mgc,spec,mohs,metal,color,sn) \ + OBJECT(OBJ(name, stone), \ + BITS(0, 0, spec, 0, mgc, spec, 0, 0, 0, \ + HARDGEM(mohs), 0, P_NONE, metal), \ + power, RING_CLASS, 1, 0, 3, cost, 0, 0, 0, 0, 15, color,sn) +RING("adornment", "wooden", + ADORNED, 100, 1, 1, 2, WOOD, HI_WOOD, RIN_ADORNMENT), +RING("gain strength", "granite", + 0, 150, 1, 1, 7, MINERAL, HI_MINERAL, + RIN_GAIN_STRENGTH), +RING("gain constitution", "opal", + 0, 150, 1, 1, 7, MINERAL, HI_MINERAL, + RIN_GAIN_CONSTITUTION), +RING("increase accuracy", "clay", + 0, 150, 1, 1, 4, MINERAL, CLR_RED, + RIN_INCREASE_ACCURACY), +RING("increase damage", "coral", + 0, 150, 1, 1, 4, MINERAL, CLR_ORANGE, + RIN_INCREASE_DAMAGE), +RING("protection", "black onyx", + PROTECTION, 100, 1, 1, 7, MINERAL, CLR_BLACK, + RIN_PROTECTION), + /* 'PROTECTION' intrinsic enhances MC from worn armor by +1, + regardless of ring's enchantment; wearing a second ring of + protection (or even one ring of protection combined with + cloak of protection) doesn't give a second MC boost */ +RING("regeneration", "moonstone", + REGENERATION, 200, 1, 0, 6, MINERAL, HI_MINERAL, + RIN_REGENERATION), +RING("searching", "tiger eye", + SEARCHING, 200, 1, 0, 6, GEMSTONE, CLR_BROWN, + RIN_SEARCHING ), +RING("stealth", "jade", + STEALTH, 100, 1, 0, 6, GEMSTONE, CLR_GREEN, + RIN_STEALTH), +RING("sustain ability", "bronze", + FIXED_ABIL, 100, 1, 0, 4, COPPER, HI_COPPER, + RIN_SUSTAIN_ABILITY), +RING("levitation", "agate", + LEVITATION, 200, 1, 0, 7, GEMSTONE, CLR_RED, + RIN_LEVITATION), +RING("hunger", "topaz", + HUNGER, 100, 1, 0, 8, GEMSTONE, CLR_CYAN, + RIN_HUNGER), +RING("aggravate monster", "sapphire", + AGGRAVATE_MONSTER, 150, 1, 0, 9, GEMSTONE, CLR_BLUE, + RIN_AGGRAVATE_MONSTER), +RING("conflict", "ruby", + CONFLICT, 300, 1, 0, 9, GEMSTONE, CLR_RED, + RIN_CONFLICT), +RING("warning", "diamond", + WARNING, 100, 1, 0, 10, GEMSTONE, CLR_WHITE, + RIN_WARNING), +RING("poison resistance", "pearl", + POISON_RES, 150, 1, 0, 4, BONE, CLR_WHITE, + RIN_POISON_RESISTANCE), +RING("fire resistance", "iron", + FIRE_RES, 200, 1, 0, 5, IRON, HI_METAL, + RIN_FIRE_RESISTANCE), +RING("cold resistance", "brass", + COLD_RES, 150, 1, 0, 4, COPPER, HI_COPPER, + RIN_COLD_RESISTANCE), +RING("shock resistance", "copper", + SHOCK_RES, 150, 1, 0, 3, COPPER, HI_COPPER, + RIN_SHOCK_RESISTANCE), +RING("free action", "twisted", + FREE_ACTION, 200, 1, 0, 6, IRON, HI_METAL, + RIN_FREE_ACTION), +RING("slow digestion", "steel", + SLOW_DIGESTION, 200, 1, 0, 8, IRON, HI_METAL, + RIN_SLOW_DIGESTION), +RING("teleportation", "silver", + TELEPORT, 200, 1, 0, 3, SILVER, HI_SILVER, + RIN_TELEPORTATION), +RING("teleport control", "gold", + TELEPORT_CONTROL, 300, 1, 0, 3, GOLD, HI_GOLD, + RIN_TELEPORT_CONTROL), +RING("polymorph", "ivory", + POLYMORPH, 300, 1, 0, 4, BONE, CLR_WHITE, + RIN_POLYMORPH), +RING("polymorph control", "emerald", + POLYMORPH_CONTROL, 300, 1, 0, 8, GEMSTONE, CLR_BRIGHT_GREEN, + RIN_POLYMORPH_CONTROL), +RING("invisibility", "wire", + INVIS, 150, 1, 0, 5, IRON, HI_METAL, + RIN_INVISIBILITY), +RING("see invisible", "engagement", + SEE_INVIS, 150, 1, 0, 5, IRON, HI_METAL, + RIN_SEE_INVISIBLE), +RING("protection from shape changers", "shiny", + PROT_FROM_SHAPE_CHANGERS, 100, 1, 0, 5, IRON, CLR_BRIGHT_CYAN, + RIN_PROTECTION_FROM_SHAPE_CHAN), +#undef RING + +/* amulets ... - THE Amulet comes last because it is special */ +#define AMULET(name,desc,power,prob,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, P_NONE, IRON), \ + power, AMULET_CLASS, prob, 0, 20, 150, 0, 0, 0, 0, 20, HI_METAL, sn) +AMULET("amulet of ESP", "circular", TELEPAT, 120, + AMULET_OF_ESP), +MARKER(FIRST_AMULET, AMULET_OF_ESP) +AMULET("amulet of life saving", "spherical", LIFESAVED, 75, + AMULET_OF_LIFE_SAVING), +AMULET("amulet of strangulation", "oval", STRANGLED, 115, + AMULET_OF_STRANGULATION), +AMULET("amulet of restful sleep", "triangular", SLEEPY, 115, + AMULET_OF_RESTFUL_SLEEP), +AMULET("amulet versus poison", "pyramidal", POISON_RES, 115, + AMULET_VERSUS_POISON), +AMULET("amulet of change", "square", 0, 115, + AMULET_OF_CHANGE), +AMULET("amulet of unchanging", "concave", UNCHANGING, 60, + AMULET_OF_UNCHANGING), +AMULET("amulet of reflection", "hexagonal", REFLECTING, 75, + AMULET_OF_REFLECTION), +AMULET("amulet of magical breathing", "octagonal", MAGICAL_BREATHING, 75, + AMULET_OF_MAGICAL_BREATHING), + /* +2 AC and +2 MC; +2 takes naked hero past 'warded' to 'guarded' */ +AMULET("amulet of guarding", "perforated", PROTECTION, 75, + AMULET_OF_GUARDING), + /* cubical: some descriptions are already three dimensional and + parallelogrammatical (real word!) would be way over the top */ +AMULET("amulet of flying", "cubical", FLYING, 60, + AMULET_OF_FLYING), +/* fixed descriptions; description duplication is deliberate; + * fake one must come before real one because selection for + * description shuffling stops when a non-magic amulet is encountered + */ +OBJECT(OBJ("cheap plastic imitation of the Amulet of Yendor", + "Amulet of Yendor"), + BITS(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, PLASTIC), + 0, AMULET_CLASS, 0, 0, 20, 0, 0, 0, 0, 0, 1, HI_METAL, + FAKE_AMULET_OF_YENDOR), +OBJECT(OBJ("Amulet of Yendor", /* note: description == name */ + "Amulet of Yendor"), + BITS(0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, MITHRIL), + 0, AMULET_CLASS, 0, 0, 20, 30000, 0, 0, 0, 0, 20, HI_METAL, + AMULET_OF_YENDOR), +MARKER(LAST_AMULET, AMULET_OF_YENDOR) +#undef AMULET + +/* tools ... */ +/* tools with weapon characteristics come last */ +#define TOOL(name,desc,kn,mrg,mgc,chg,prob,wt,cost,mat,color,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(kn, mrg, chg, 0, mgc, chg, 0, 0, 0, 0, 0, P_NONE, mat), \ + 0, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn) +#define CONTAINER(name,desc,kn,mgc,chg,prob,wt,cost,mat,color,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(kn, 0, chg, 1, mgc, chg, 0, 0, 0, 0, 0, P_NONE, mat), \ + 0, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn) +#define EYEWEAR(name,desc,kn,prop,prob,wt,cost,mat,color,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(kn, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, mat), \ + prop, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn) +#define WEPTOOL(name,desc,kn,mgc,bi,prob,wt,cost,sdam,ldam,hitbon,sub, \ + mat,clr,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(kn, 0, 1, 0, mgc, 1, 0, 0, bi, 0, hitbon, sub, mat), \ + 0, TOOL_CLASS, prob, 0, wt, cost, sdam, ldam, hitbon, 0, wt, \ + clr, sn) +/* containers */ +CONTAINER("large box", NoDes, 1, 0, 0, 40, 350, 8, WOOD, HI_WOOD, + LARGE_BOX), +CONTAINER("chest", NoDes, 1, 0, 0, 35, 600, 16, WOOD, HI_WOOD, + CHEST), +CONTAINER("ice box", NoDes, 1, 0, 0, 5, 900, 42, PLASTIC, CLR_WHITE, + ICE_BOX), +CONTAINER("sack", "bag", 0, 0, 0, 35, 15, 2, CLOTH, HI_CLOTH, + SACK), +CONTAINER("oilskin sack", "bag", 0, 0, 0, 5, 15, 100, CLOTH, HI_CLOTH, + OILSKIN_SACK), +CONTAINER("bag of holding", "bag", 0, 1, 0, 20, 15, 100, CLOTH, HI_CLOTH, + BAG_OF_HOLDING), +CONTAINER("bag of tricks", "bag", 0, 1, 1, 20, 15, 100, CLOTH, HI_CLOTH, + BAG_OF_TRICKS), +#undef CONTAINER + +/* lock opening tools */ +TOOL("skeleton key", "key", 0, 0, 0, 0, 80, 3, 10, IRON, HI_METAL, + SKELETON_KEY), +TOOL("lock pick", NoDes, 1, 0, 0, 0, 60, 4, 20, IRON, HI_METAL, + LOCK_PICK), +TOOL("credit card", NoDes, 1, 0, 0, 0, 15, 1, 10, PLASTIC, CLR_WHITE, + CREDIT_CARD), +/* light sources */ +TOOL("tallow candle", "candle", 0, 1, 0, 0, 20, 2, 10, WAX, CLR_WHITE, + TALLOW_CANDLE), +TOOL("wax candle", "candle", 0, 1, 0, 0, 5, 2, 20, WAX, CLR_WHITE, + WAX_CANDLE), +TOOL("brass lantern", NoDes, 1, 0, 0, 0, 30, 30, 12, COPPER, CLR_YELLOW, + BRASS_LANTERN), +TOOL("oil lamp", "lamp", 0, 0, 0, 0, 45, 20, 10, COPPER, CLR_YELLOW, + OIL_LAMP), +TOOL("magic lamp", "lamp", 0, 0, 1, 0, 15, 20, 50, COPPER, CLR_YELLOW, + MAGIC_LAMP), +/* other tools */ +TOOL("expensive camera", NoDes, 1, 0, 0, 1, 15, 12,200, PLASTIC, CLR_BLACK, + EXPENSIVE_CAMERA), +TOOL("mirror", "looking glass", 0, 0, 0, 0, 45, 13, 10, GLASS, HI_SILVER, + MIRROR), +TOOL("crystal ball", "glass orb", 0, 0, 1, 1, 15,150, 60, GLASS, HI_GLASS, + CRYSTAL_BALL), +/* eyewear - tools which can be worn on the face; (!mrg, !chg, !mgc) + worn lenses don't confer the Blinded property, blindfolds and towels do; + wet towel can be used as a weapon but is not a weptool and uses obj->spe + differently from weapons and weptools */ +EYEWEAR("lenses", NoDes, 1, 0, 5, 3, 80, GLASS, HI_GLASS, + LENSES), +EYEWEAR("blindfold", NoDes, 1, BLINDED, 50, 2, 20, CLOTH, CLR_BLACK, + BLINDFOLD), +EYEWEAR("towel", NoDes, 1, BLINDED, 50, 5, 50, CLOTH, CLR_MAGENTA, + TOWEL), +#undef EYEWEAR + +/* still other tools */ +TOOL("saddle", NoDes, 1, 0, 0, 0, 5,200,150, LEATHER, HI_LEATHER, + SADDLE), +TOOL("leash", NoDes, 1, 0, 0, 0, 65, 12, 20, LEATHER, HI_LEATHER, + LEASH), +TOOL("stethoscope", NoDes, 1, 0, 0, 0, 25, 4, 75, IRON, HI_METAL, + STETHOSCOPE), +TOOL("tinning kit", NoDes, 1, 0, 0, 1, 15,100, 30, IRON, HI_METAL, + TINNING_KIT), +TOOL("tin opener", NoDes, 1, 0, 0, 0, 35, 4, 30, IRON, HI_METAL, + TIN_OPENER), +TOOL("can of grease", NoDes, 1, 0, 0, 1, 15, 15, 20, IRON, HI_METAL, + CAN_OF_GREASE), +TOOL("figurine", NoDes, 1, 0, 1, 0, 25, 50, 80, MINERAL, HI_MINERAL, + FIGURINE), + /* monster type specified by obj->corpsenm */ +TOOL("magic marker", NoDes, 1, 0, 1, 1, 15, 2, 50, PLASTIC, CLR_RED, + MAGIC_MARKER), +/* traps */ +TOOL("land mine", NoDes, 1, 0, 0, 0, 0, 200,180, IRON, CLR_RED, + LAND_MINE), +TOOL("beartrap", NoDes, 1, 0, 0, 0, 0, 200, 60, IRON, HI_METAL, + BEARTRAP), +/* instruments; + "If tin whistles are made out of tin, what do they make foghorns out of?" */ +TOOL("tin whistle", "whistle", 0, 0, 0, 0,100, 3, 10, METAL, HI_METAL, + TIN_WHISTLE), +TOOL("magic whistle", "whistle", 0, 0, 1, 0, 30, 3, 10, METAL, HI_METAL, + MAGIC_WHISTLE), +TOOL("wooden flute", "flute", 0, 0, 0, 0, 4, 5, 12, WOOD, HI_WOOD, + WOODEN_FLUTE), +TOOL("magic flute", "flute", 0, 0, 1, 1, 2, 5, 36, WOOD, HI_WOOD, + MAGIC_FLUTE), +TOOL("tooled horn", "horn", 0, 0, 0, 0, 5, 18, 15, BONE, CLR_WHITE, + TOOLED_HORN), +TOOL("frost horn", "horn", 0, 0, 1, 1, 2, 18, 50, BONE, CLR_WHITE, + FROST_HORN), +TOOL("fire horn", "horn", 0, 0, 1, 1, 2, 18, 50, BONE, CLR_WHITE, + FIRE_HORN), +TOOL("horn of plenty", "horn", 0, 0, 1, 1, 2, 18, 50, BONE, CLR_WHITE, + HORN_OF_PLENTY), + /* horn, but not an instrument */ +TOOL("wooden harp", "harp", 0, 0, 0, 0, 4, 30, 50, WOOD, HI_WOOD, + WOODEN_HARP), +TOOL("magic harp", "harp", 0, 0, 1, 1, 2, 30, 50, WOOD, HI_WOOD, + MAGIC_HARP), +TOOL("bell", NoDes, 1, 0, 0, 0, 2, 30, 50, COPPER, HI_COPPER, + BELL), +TOOL("bugle", NoDes, 1, 0, 0, 0, 4, 10, 15, COPPER, HI_COPPER, + BUGLE), +TOOL("leather drum", "drum", 0, 0, 0, 0, 4, 25, 25, LEATHER, HI_LEATHER, + LEATHER_DRUM), +TOOL("drum of earthquake","drum", 0, 0, 1, 1, 2, 25, 25, LEATHER, HI_LEATHER, + DRUM_OF_EARTHQUAKE), +/* tools useful as weapons */ +WEPTOOL("pick-axe", NoDes, + 1, 0, 0, 20, 100, 50, 6, 3, WHACK, P_PICK_AXE, IRON, HI_METAL, + PICK_AXE), +WEPTOOL("grappling hook", NoDes, + 1, 0, 0, 5, 30, 50, 2, 6, WHACK, P_FLAIL, IRON, HI_METAL, + GRAPPLING_HOOK), +WEPTOOL("unicorn horn", NoDes, + 1, 1, 1, 0, 20, 100, 12, 12, PIERCE, P_UNICORN_HORN, + BONE, CLR_WHITE, + UNICORN_HORN), + /* 3.4.1: unicorn horn left classified as "magic" */ +/* two unique tools; + * not artifacts, despite the comment which used to be here + */ +OBJECT(OBJ("Candelabrum of Invocation", "candelabrum"), + BITS(0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, P_NONE, GOLD), + 0, TOOL_CLASS, 0, 0, 10, 5000, 0, 0, 0, 0, 200, HI_GOLD, + CANDELABRUM_OF_INVOCATION), +OBJECT(OBJ("Bell of Opening", "silver bell"), + BITS(0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, P_NONE, SILVER), + 0, TOOL_CLASS, 0, 0, 10, 5000, 0, 0, 0, 0, 50, HI_SILVER, + BELL_OF_OPENING), +#undef TOOL +#undef WEPTOOL + +/* Comestibles ... */ +#define FOOD(name, prob, delay, wt, unk, tin, nutrition, color, sn) \ + OBJECT(OBJ(name, NoDes), \ + BITS(1, 1, unk, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, tin), 0, \ + FOOD_CLASS, prob, delay, wt, nutrition / 20 + 5, 0, 0, 0, 0, \ + nutrition, color, sn) +/* All types of food (except tins & corpses) must have a delay of at least 1. + * Delay on corpses is computed and is weight dependent. + * Domestic pets prefer tripe rations above all others. + * Fortune cookies can be read, using them up without ingesting them. + * Carrots improve your vision. + * +0 tins contain monster meat. + * +1 tins (of spinach) make you stronger (like Popeye). + * Meatballs/sticks/rings are only created from objects via stone to flesh. + */ +/* meat */ +FOOD("tripe ration", 140, 2, 10, 0, FLESH, 200, CLR_BROWN, + TRIPE_RATION), +FOOD("corpse", 0, 1, 0, 0, FLESH, 0, CLR_BROWN, + CORPSE), +FOOD("egg", 85, 1, 1, 1, FLESH, 80, CLR_WHITE, + EGG), +FOOD("meatball", 0, 1, 1, 0, FLESH, 5, CLR_BROWN, + MEATBALL), +FOOD("meat stick", 0, 1, 1, 0, FLESH, 5, CLR_BROWN, + MEAT_STICK), +/* formerly "huge chunk of meat" */ +FOOD("enormous meatball", 0, 20,400, 0, FLESH,2000, CLR_BROWN, + ENORMOUS_MEATBALL), +/* special case because it's not mergeable */ +OBJECT(OBJ("meat ring", NoDes), + BITS(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FLESH), + 0, FOOD_CLASS, 0, 1, 5, 1, 0, 0, 0, 0, 5, CLR_BROWN, MEAT_RING), +/* pudding 'corpses' will turn into these and combine; + must be in same order as the pudding monsters */ +FOOD("glob of gray ooze", 0, 2, 20, 0, FLESH, 20, CLR_GRAY, + GLOB_OF_GRAY_OOZE), +FOOD("glob of brown pudding", 0, 2, 20, 0, FLESH, 20, CLR_BROWN, + GLOB_OF_BROWN_PUDDING), +FOOD("glob of green slime", 0, 2, 20, 0, FLESH, 20, CLR_GREEN, + GLOB_OF_GREEN_SLIME), +FOOD("glob of black pudding", 0, 2, 20, 0, FLESH, 20, CLR_BLACK, + GLOB_OF_BLACK_PUDDING), + +/* fruits & veggies */ +FOOD("kelp frond", 0, 1, 1, 0, VEGGY, 30, CLR_GREEN, KELP_FROND), +FOOD("eucalyptus leaf", 3, 1, 1, 0, VEGGY, 1, CLR_GREEN, + EUCALYPTUS_LEAF), +FOOD("apple", 15, 1, 2, 0, VEGGY, 50, CLR_RED, APPLE), +FOOD("orange", 10, 1, 2, 0, VEGGY, 80, CLR_ORANGE, ORANGE), +FOOD("pear", 10, 1, 2, 0, VEGGY, 50, CLR_BRIGHT_GREEN, + PEAR), +FOOD("melon", 10, 1, 5, 0, VEGGY, 100, CLR_BRIGHT_GREEN, + MELON), +FOOD("banana", 10, 1, 2, 0, VEGGY, 80, CLR_YELLOW, BANANA), +FOOD("carrot", 15, 1, 2, 0, VEGGY, 50, CLR_ORANGE, CARROT), +FOOD("sprig of wolfsbane", 7, 1, 1, 0, VEGGY, 40, CLR_GREEN, + SPRIG_OF_WOLFSBANE), +FOOD("clove of garlic", 7, 1, 1, 0, VEGGY, 40, CLR_WHITE, + CLOVE_OF_GARLIC), +/* name of slime mold is changed based on player's OPTION=fruit:something + and bones data might have differently named ones from prior games */ +FOOD("slime mold", 75, 1, 5, 0, VEGGY, 250, HI_ORGANIC, + SLIME_MOLD), + +/* people food */ +FOOD("lump of royal jelly", 0, 1, 2, 0, VEGGY, 200, CLR_YELLOW, + LUMP_OF_ROYAL_JELLY), +FOOD("cream pie", 25, 1, 10, 0, VEGGY, 100, CLR_WHITE, CREAM_PIE), +FOOD("candy bar", 13, 1, 2, 0, VEGGY, 100, CLR_BRIGHT_BLUE, + CANDY_BAR), +FOOD("fortune cookie", 55, 1, 1, 0, VEGGY, 40, CLR_YELLOW, + FORTUNE_COOKIE), +FOOD("pancake", 25, 2, 2, 0, VEGGY, 200, CLR_YELLOW, PANCAKE), +FOOD("lembas wafer", 20, 2, 5, 0, VEGGY, 800, CLR_WHITE, + LEMBAS_WAFER), +FOOD("cram ration", 20, 3, 15, 0, VEGGY, 600, HI_ORGANIC, + CRAM_RATION), +FOOD("food ration", 380, 5, 20, 0, VEGGY, 800, HI_ORGANIC, + FOOD_RATION), +FOOD("K-ration", 0, 1, 10, 0, VEGGY, 400, HI_ORGANIC, K_RATION), +FOOD("C-ration", 0, 1, 10, 0, VEGGY, 300, HI_ORGANIC, C_RATION), +/* tins have type specified by obj->spe (+1 for spinach, other implies + flesh; negative specifies preparation method {homemade,boiled,&c}) + and by obj->corpsenm (type of monster flesh) */ +FOOD("tin", 75, 0, 10, 1, METAL, 0, HI_METAL, TIN), +#undef FOOD + +/* potions ... */ +#define POTION(name,desc,mgc,power,prob,cost,color,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(0, 1, 0, 0, mgc, 0, 0, 0, 0, 0, 0, P_NONE, GLASS), \ + power, POTION_CLASS, prob, 0, 20, cost, 0, 0, 0, 0, 10, color, sn) +POTION("gain ability", "ruby", 1, 0, 40, 300, CLR_RED, + POT_GAIN_ABILITY), +POTION("restore ability", "pink", 1, 0, 40, 100, CLR_BRIGHT_MAGENTA, + POT_RESTORE_ABILITY), +POTION("confusion", "orange", 1, CONFUSION, 40, 100, CLR_ORANGE, + POT_CONFUSION), +POTION("blindness", "yellow", 1, BLINDED, 30, 150, CLR_YELLOW, + POT_BLINDNESS), +POTION("paralysis", "emerald", 1, 0, 40, 300, CLR_BRIGHT_GREEN, + POT_PARALYSIS), +POTION("speed", "dark green", 1, FAST, 40, 200, CLR_GREEN, + POT_SPEED), +POTION("levitation", "cyan", 1, LEVITATION, 40, 200, CLR_CYAN, + POT_LEVITATION), +POTION("hallucination", "sky blue", 1, HALLUC, 30, 100, CLR_CYAN, + POT_HALLUCINATION), +POTION("invisibility", "brilliant blue", 1, INVIS, 40, 150, CLR_BRIGHT_BLUE, + POT_INVISIBILITY), +POTION("see invisible", "magenta", 1, SEE_INVIS, 40, 50, CLR_MAGENTA, + POT_SEE_INVISIBLE), +POTION("healing", "purple-red", 1, 0, 115, 20, CLR_MAGENTA, + POT_HEALING), +POTION("extra healing", "puce", 1, 0, 45, 100, CLR_RED, + POT_EXTRA_HEALING), +POTION("gain level", "milky", 1, 0, 20, 300, CLR_WHITE, + POT_GAIN_LEVEL), +POTION("enlightenment", "swirly", 1, 0, 20, 200, CLR_BROWN, + POT_ENLIGHTENMENT), +POTION("monster detection", "bubbly", 1, 0, 40, 150, CLR_WHITE, + POT_MONSTER_DETECTION), +POTION("object detection", "smoky", 1, 0, 40, 150, CLR_GRAY, + POT_OBJECT_DETECTION), +POTION("gain energy", "cloudy", 1, 0, 40, 150, CLR_WHITE, + POT_GAIN_ENERGY), +POTION("sleeping", "effervescent", 1, 0, 40, 100, CLR_GRAY, + POT_SLEEPING), +POTION("full healing", "black", 1, 0, 10, 200, CLR_BLACK, + POT_FULL_HEALING), +POTION("polymorph", "golden", 1, 0, 10, 200, CLR_YELLOW, + POT_POLYMORPH), +POTION("booze", "brown", 0, 0, 40, 50, CLR_BROWN, + POT_BOOZE), +POTION("sickness", "fizzy", 0, 0, 40, 50, CLR_CYAN, + POT_SICKNESS), +POTION("fruit juice", "dark", 0, 0, 40, 50, CLR_BLACK, + POT_FRUIT_JUICE), +POTION("acid", "white", 0, 0, 10, 250, CLR_WHITE, + POT_ACID), +POTION("oil", "murky", 0, 0, 30, 250, CLR_BROWN, + POT_OIL), +/* fixed description + */ +POTION("water", "clear", 0, 0, 80, 100, CLR_CYAN, + POT_WATER), +#undef POTION + +/* scrolls ... */ +#define SCROLL(name,text,mgc,prob,cost,sn) \ + OBJECT(OBJ(name, text), \ + BITS(0, 1, 0, 0, mgc, 0, 0, 0, 0, 0, 0, P_NONE, PAPER), \ + 0, SCROLL_CLASS, prob, 0, 5, cost, 0, 0, 0, 0, 6, \ + HI_PAPER, sn) +SCROLL("enchant armor", "ZELGO MER", 1, 63, 80, + SCR_ENCHANT_ARMOR), +SCROLL("destroy armor", "JUYED AWK YACC", 1, 45, 100, + SCR_DESTROY_ARMOR), +SCROLL("confuse monster", "NR 9", 1, 53, 100, + SCR_CONFUSE_MONSTER), +SCROLL("scare monster", "XIXAXA XOXAXA XUXAXA", 1, 35, 100, + SCR_SCARE_MONSTER), +SCROLL("remove curse", "PRATYAVAYAH", 1, 65, 80, + SCR_REMOVE_CURSE), +SCROLL("enchant weapon", "DAIYEN FOOELS", 1, 80, 60, + SCR_ENCHANT_WEAPON), +SCROLL("create monster", "LEP GEX VEN ZEA", 1, 45, 200, + SCR_CREATE_MONSTER), +SCROLL("taming", "PRIRUTSENIE", 1, 15, 200, + SCR_TAMING), +SCROLL("genocide", "ELBIB YLOH", 1, 15, 300, + SCR_GENOCIDE), +SCROLL("light", "VERR YED HORRE", 1, 90, 50, + SCR_LIGHT), +SCROLL("teleportation", "VENZAR BORGAVVE", 1, 55, 100, + SCR_TELEPORTATION), +SCROLL("gold detection", "THARR", 1, 33, 100, + SCR_GOLD_DETECTION), +SCROLL("food detection", "YUM YUM", 1, 25, 100, + SCR_FOOD_DETECTION), +SCROLL("identify", "KERNOD WEL", 1, 180, 20, + SCR_IDENTIFY), +SCROLL("magic mapping", "ELAM EBOW", 1, 45, 100, + SCR_MAGIC_MAPPING), +SCROLL("amnesia", "DUAM XNAHT", 1, 35, 200, + SCR_AMNESIA), +SCROLL("fire", "ANDOVA BEGARIN", 1, 30, 100, + SCR_FIRE), +SCROLL("earth", "KIRJE", 1, 18, 200, + SCR_EARTH), +SCROLL("punishment", "VE FORBRYDERNE", 1, 15, 300, + SCR_PUNISHMENT), +SCROLL("charging", "HACKEM MUCHE", 1, 15, 300, + SCR_CHARGING), +SCROLL("stinking cloud", "VELOX NEB", 1, 15, 300, + SCR_STINKING_CLOUD), + /* Extra descriptions, shuffled into use at start of new game. + * Code in win/share/tilemap.c depends on SCR_STINKING_CLOUD preceding + * these and on how many of them there are. If a real scroll gets added + * after stinking cloud or the number of extra descriptions changes, + * tilemap.c must be modified to match. Mgc,Prob,Cost are superfluous. + * SC values must be distinct but are only used by 'nethack --dumpenums'. + */ +#define XTRA_SCROLL_LABEL(text, sn) SCROLL(NoDes, text, 1, 0, 100, sn) +XTRA_SCROLL_LABEL( "FOOBIE BLETCH", SC01), +XTRA_SCROLL_LABEL( "TEMOV", SC02), +XTRA_SCROLL_LABEL( "GARVEN DEH", SC03), +XTRA_SCROLL_LABEL( "READ ME", SC04), +XTRA_SCROLL_LABEL( "ETAOIN SHRDLU", SC05), +XTRA_SCROLL_LABEL( "LOREM IPSUM", SC06), +XTRA_SCROLL_LABEL( "FNORD", SC07), /* Illuminati */ +XTRA_SCROLL_LABEL( "KO BATE", SC08), /* Kurd Lasswitz */ +XTRA_SCROLL_LABEL( "ABRA KA DABRA", SC09), /* traditional incantation */ +XTRA_SCROLL_LABEL( "ASHPD SODALG", SC10), /* Portal */ +XTRA_SCROLL_LABEL( "ZLORFIK", SC11), /* Zak McKracken */ +XTRA_SCROLL_LABEL( "GNIK SISI VLE", SC12), /* Zak McKracken */ +XTRA_SCROLL_LABEL( "HAPAX LEGOMENON", SC13), +XTRA_SCROLL_LABEL( "EIRIS SAZUN IDISI", SC14), /* Merseburg Incantations */ +XTRA_SCROLL_LABEL( "PHOL ENDE WODAN", SC15), /* Merseburg Incantations */ +XTRA_SCROLL_LABEL( "GHOTI", SC16), /* pronounced as 'fish', + * George Bernard Shaw */ +XTRA_SCROLL_LABEL("MAPIRO MAHAMA DIROMAT", SC17), /* Wizardry */ +XTRA_SCROLL_LABEL( "VAS CORP BET MANI", SC18), /* Ultima */ +XTRA_SCROLL_LABEL( "XOR OTA", SC19), /* Aarne Haapakoski */ +XTRA_SCROLL_LABEL("STRC PRST SKRZ KRK", SC20), /* Czech and Slovak + * tongue-twister */ +#undef XTRA_SCROLL_LABEL + /* These must come last because they have special fixed descriptions. + */ +#ifdef MAIL_STRUCTURES +SCROLL("mail", "stamped", 0, 0, 0, SCR_MAIL), +#endif +SCROLL("blank paper", "unlabeled", 0, 28, 60, SCR_BLANK_PAPER), +#undef SCROLL + +/* spellbooks ... */ + /* Expanding beyond 52 spells would require changes in spellcasting + * or imposition of a limit on number of spells hero can know because + * they are currently assigned successive letters, a-zA-Z, when learned. + * [The existing spell sorting capability could conceivably be extended + * to enable moving spells from beyond Z to within it, bumping others + * out in the process, allowing more than 52 spells be known but keeping + * only 52 be castable at any given time.] + */ +#define SPELL(name,desc,sub,prob,delay,level,mgc,dir,color,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(0, 0, 0, 0, mgc, 0, 0, 0, 0, 0, dir, sub, PAPER), \ + 0, SPBOOK_CLASS, prob, delay, 50, level * 100, \ + 0, 0, 0, level, 20, color, sn) +/* Spellbook description normally refers to book covers (primarily color). + Parchment and vellum would never be used for such, but rather than + eliminate those, finagle their definitions to refer to the pages + rather than the cover. They are made from animal skin (typically of + a goat or sheep) and books using them for pages generally need heavy + covers with straps or clamps to tightly close the book in order to + keep the pages flat. (However, a wooden cover might itself be covered + by a sheet of parchment, making this become less of an exception. Also, + changing the internal composition from paper to leather makes eating a + parchment or vellum spellbook break vegetarian conduct, as it should.) */ +#define PAPER LEATHER /* override enum for use in SPELL() expansion */ +SPELL("dig", "parchment", + P_MATTER_SPELL, 20, 6, 5, 1, RAY, HI_LEATHER, SPE_DIG), +MARKER(FIRST_SPELL, SPE_DIG) +/* magic missile ... finger of death must be in this order; see buzz() */ +SPELL("magic missile", "vellum", + P_ATTACK_SPELL, 45, 2, 2, 1, RAY, HI_LEATHER, SPE_MAGIC_MISSILE), +#undef PAPER /* revert to normal material */ +SPELL("fireball", "ragged", + P_ATTACK_SPELL, 20, 4, 4, 1, RAY, HI_PAPER, SPE_FIREBALL), +SPELL("cone of cold", "dog eared", + P_ATTACK_SPELL, 10, 7, 4, 1, RAY, HI_PAPER, SPE_CONE_OF_COLD), +SPELL("sleep", "mottled", + P_ENCHANTMENT_SPELL, 30, 1, 3, 1, RAY, HI_PAPER, SPE_SLEEP), +SPELL("finger of death", "stained", + P_ATTACK_SPELL, 5, 10, 7, 1, RAY, HI_PAPER, SPE_FINGER_OF_DEATH), +SPELL("light", "cloth", + P_DIVINATION_SPELL, 45, 1, 1, 1, NODIR, HI_CLOTH, SPE_LIGHT), +SPELL("detect monsters", "leathery", + P_DIVINATION_SPELL, 43, 1, 1, 1, NODIR, HI_LEATHER, + SPE_DETECT_MONSTERS), +SPELL("healing", "white", + P_HEALING_SPELL, 40, 2, 1, 1, IMMEDIATE, CLR_WHITE, + SPE_HEALING), +SPELL("knock", "pink", + P_MATTER_SPELL, 25, 1, 1, 1, IMMEDIATE, CLR_BRIGHT_MAGENTA, + SPE_KNOCK), +SPELL("force bolt", "red", + P_ATTACK_SPELL, 30, 2, 1, 1, IMMEDIATE, CLR_RED, + SPE_FORCE_BOLT), +SPELL("confuse monster", "orange", + P_ENCHANTMENT_SPELL, 49, 2, 1, 1, IMMEDIATE, CLR_ORANGE, + SPE_CONFUSE_MONSTER), +SPELL("cure blindness", "yellow", + P_HEALING_SPELL, 25, 2, 2, 1, IMMEDIATE, CLR_YELLOW, + SPE_CURE_BLINDNESS), +SPELL("drain life", "velvet", + P_ATTACK_SPELL, 10, 2, 2, 1, IMMEDIATE, CLR_MAGENTA, + SPE_DRAIN_LIFE), +SPELL("slow monster", "light green", + P_ENCHANTMENT_SPELL, 30, 2, 2, 1, IMMEDIATE, CLR_BRIGHT_GREEN, + SPE_SLOW_MONSTER), +SPELL("wizard lock", "dark green", + P_MATTER_SPELL, 25, 3, 2, 1, IMMEDIATE, CLR_GREEN, + SPE_WIZARD_LOCK), +SPELL("create monster", "turquoise", + P_CLERIC_SPELL, 35, 3, 2, 1, NODIR, CLR_BRIGHT_CYAN, + SPE_CREATE_MONSTER), +SPELL("detect food", "cyan", + P_DIVINATION_SPELL, 30, 3, 2, 1, NODIR, CLR_CYAN, + SPE_DETECT_FOOD), +SPELL("cause fear", "light blue", + P_ENCHANTMENT_SPELL, 25, 3, 3, 1, NODIR, CLR_BRIGHT_BLUE, + SPE_CAUSE_FEAR), +SPELL("clairvoyance", "dark blue", + P_DIVINATION_SPELL, 15, 3, 3, 1, NODIR, CLR_BLUE, + SPE_CLAIRVOYANCE), +SPELL("cure sickness", "indigo", + P_HEALING_SPELL, 32, 3, 3, 1, NODIR, CLR_BLUE, + SPE_CURE_SICKNESS), +SPELL("charm monster", "magenta", + P_ENCHANTMENT_SPELL, 20, 3, 5, 1, IMMEDIATE, CLR_MAGENTA, + SPE_CHARM_MONSTER), +SPELL("haste self", "purple", + P_ESCAPE_SPELL, 33, 4, 3, 1, NODIR, CLR_MAGENTA, + SPE_HASTE_SELF), +SPELL("detect unseen", "violet", + P_DIVINATION_SPELL, 20, 4, 3, 1, NODIR, CLR_MAGENTA, + SPE_DETECT_UNSEEN), +SPELL("levitation", "tan", + P_ESCAPE_SPELL, 20, 4, 4, 1, NODIR, CLR_BROWN, + SPE_LEVITATION), +SPELL("extra healing", "plaid", + P_HEALING_SPELL, 27, 5, 3, 1, IMMEDIATE, CLR_GREEN, + SPE_EXTRA_HEALING), +SPELL("restore ability", "light brown", + P_HEALING_SPELL, 25, 5, 4, 1, NODIR, CLR_BROWN, + SPE_RESTORE_ABILITY), +SPELL("invisibility", "dark brown", + P_ESCAPE_SPELL, 20, 5, 4, 1, NODIR, CLR_BROWN, + SPE_INVISIBILITY), +SPELL("detect treasure", "gray", + P_DIVINATION_SPELL, 20, 5, 4, 1, NODIR, CLR_GRAY, + SPE_DETECT_TREASURE), +SPELL("remove curse", "wrinkled", + P_CLERIC_SPELL, 25, 5, 3, 1, NODIR, HI_PAPER, + SPE_REMOVE_CURSE), +SPELL("magic mapping", "dusty", + P_DIVINATION_SPELL, 18, 7, 5, 1, NODIR, HI_PAPER, + SPE_MAGIC_MAPPING), +SPELL("identify", "bronze", + P_DIVINATION_SPELL, 20, 6, 3, 1, NODIR, HI_COPPER, + SPE_IDENTIFY), +SPELL("turn undead", "copper", + P_CLERIC_SPELL, 16, 8, 6, 1, IMMEDIATE, HI_COPPER, + SPE_TURN_UNDEAD), +SPELL("polymorph", "silver", + P_MATTER_SPELL, 10, 8, 6, 1, IMMEDIATE, HI_SILVER, + SPE_POLYMORPH), +SPELL("teleport away", "gold", + P_ESCAPE_SPELL, 15, 6, 6, 1, IMMEDIATE, HI_GOLD, + SPE_TELEPORT_AWAY), +SPELL("create familiar", "glittering", + P_CLERIC_SPELL, 10, 7, 6, 1, NODIR, CLR_WHITE, + SPE_CREATE_FAMILIAR), +SPELL("cancellation", "shining", + P_MATTER_SPELL, 15, 8, 7, 1, IMMEDIATE, CLR_WHITE, + SPE_CANCELLATION), +SPELL("protection", "dull", + P_CLERIC_SPELL, 18, 3, 1, 1, NODIR, HI_PAPER, + SPE_PROTECTION), +SPELL("jumping", "thin", + P_ESCAPE_SPELL, 20, 3, 1, 1, IMMEDIATE, HI_PAPER, + SPE_JUMPING), +SPELL("stone to flesh", "thick", + P_HEALING_SPELL, 15, 1, 3, 1, IMMEDIATE, HI_PAPER, + SPE_STONE_TO_FLESH), +SPELL("chain lightning", "checkered", + P_ATTACK_SPELL, 25, 4, 2, 1, NODIR, CLR_GRAY, + SPE_CHAIN_LIGHTNING), + +#if 0 /* DEFERRED */ +/* from slash'em, create a tame critter which explodes when attacking, + damaging adjacent creatures--friend or foe--and dying in the process */ +SPELL("flame sphere", "canvas", + P_MATTER_SPELL, 20, 2, 1, 1, NODIR, CLR_BROWN, + SPE_FLAME_SPHERE), +SPELL("freeze sphere", "hardcover", + P_MATTER_SPELL, 20, 2, 1, 1, NODIR, CLR_BROWN, + SPE_FREEZE_SPHERE), +#endif +/* books with fixed descriptions + */ +SPELL("blank paper", "plain", P_NONE, 18, 0, 0, 0, 0, HI_PAPER, + SPE_BLANK_PAPER), +/* LAST_SPELL is used to calculate MAXSPELL, allocation size of spl_book[]; + by including blank paper, which has no actual spell, we ensure that + even if hero learns every spell, spl_book[] will have at least one + unused slot at end; an unused slot is needed for use as terminator */ +MARKER(LAST_SPELL, SPE_BLANK_PAPER) +/* tribute book added in 3.6 */ +OBJECT(OBJ("novel", "paperback"), + BITS(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, PAPER), + 0, SPBOOK_CLASS, 1, 0, 10, 20, 0, 0, 0, 1, 20, CLR_BRIGHT_BLUE, + SPE_NOVEL), +/* a special, one of a kind, spellbook */ +OBJECT(OBJ("Book of the Dead", "papyrus"), + BITS(0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, P_NONE, PAPER), + 0, SPBOOK_CLASS, 0, 0, 50, 10000, 0, 0, 0, 7, 20, HI_PAPER, + SPE_BOOK_OF_THE_DEAD), +#undef SPELL + +/* wands ... */ +#define WAND(name,typ,prob,cost,mgc,dir,metal,color,sn) \ + OBJECT(OBJ(name, typ), \ + BITS(0, 0, 1, 0, mgc, 1, 0, 0, 0, 0, dir, P_NONE, metal), \ + 0, WAND_CLASS, prob, 0, 7, cost, 0, 0, 0, 0, 30, color, sn) +WAND("light", "glass", 95, 100, 1, NODIR, GLASS, HI_GLASS, + WAN_LIGHT), +WAND("secret door detection", + "balsa", 50, 150, 1, NODIR, WOOD, HI_WOOD, + WAN_SECRET_DOOR_DETECTION), +WAND("enlightenment", "crystal", 15, 150, 1, NODIR, GLASS, HI_GLASS, + WAN_ENLIGHTENMENT), +WAND("create monster", "maple", 50, 200, 1, NODIR, WOOD, HI_WOOD, + WAN_CREATE_MONSTER), +WAND("wishing", "pine", 5, 500, 1, NODIR, WOOD, HI_WOOD, + WAN_WISHING), +WAND("stasis", "redwood", 45, 150, 1, NODIR, WOOD, CLR_RED, + WAN_STASIS), +WAND("nothing", "oak", 25, 100, 0, IMMEDIATE, WOOD, HI_WOOD, + WAN_NOTHING), +WAND("striking", "ebony", 30, 150, 1, IMMEDIATE, WOOD, HI_WOOD, + WAN_STRIKING), +WAND("make invisible", "marble", 45, 150, 1, IMMEDIATE, MINERAL, HI_MINERAL, + WAN_MAKE_INVISIBLE), +WAND("slow monster", "tin", 50, 150, 1, IMMEDIATE, METAL, HI_METAL, + WAN_SLOW_MONSTER), +WAND("speed monster", "brass", 50, 150, 1, IMMEDIATE, COPPER, HI_COPPER, + WAN_SPEED_MONSTER), +WAND("undead turning", "copper", 50, 150, 1, IMMEDIATE, COPPER, HI_COPPER, + WAN_UNDEAD_TURNING), +WAND("polymorph", "silver", 45, 200, 1, IMMEDIATE, SILVER, HI_SILVER, + WAN_POLYMORPH), +WAND("cancellation", "platinum", 45, 200, 1, IMMEDIATE, PLATINUM, CLR_WHITE, + WAN_CANCELLATION), +WAND("teleportation", "iridium", 45, 200, 1, IMMEDIATE, METAL, + CLR_BRIGHT_CYAN, WAN_TELEPORTATION), +WAND("opening", "zinc", 30, 150, 1, IMMEDIATE, METAL, HI_METAL, + WAN_OPENING), +WAND("locking", "aluminum", 30, 150, 1, IMMEDIATE, METAL, HI_METAL, + WAN_LOCKING), +WAND("probing", "uranium", 30, 150, 1, IMMEDIATE, METAL, HI_METAL, + WAN_PROBING), +WAND("digging", "iron", 40, 150, 1, RAY, IRON, HI_METAL, + WAN_DIGGING), +/* magic missile ... lightning must be in this order; see buzz() */ +WAND("magic missile", "steel", 50, 150, 1, RAY, IRON, HI_METAL, + WAN_MAGIC_MISSILE), +WAND("fire", "hexagonal", 40, 175, 1, RAY, IRON, HI_METAL, + WAN_FIRE), +WAND("cold", "short", 40, 175, 1, RAY, IRON, HI_METAL, + WAN_COLD), +WAND("sleep", "runed", 50, 175, 1, RAY, IRON, HI_METAL, + WAN_SLEEP), +WAND("death", "long", 5, 500, 1, RAY, IRON, HI_METAL, + WAN_DEATH), +WAND("lightning", "curved", 40, 175, 1, RAY, IRON, HI_METAL, + WAN_LIGHTNING), +/* extra descriptions, shuffled into use at start of new game */ +WAND(NoDes, "forked", 0, 150, 1, 0, WOOD, HI_WOOD, WAN1), +WAND(NoDes, "spiked", 0, 150, 1, 0, IRON, HI_METAL, WAN2), +WAND(NoDes, "jeweled", 0, 150, 1, 0, IRON, HI_MINERAL, WAN3), +#undef WAND + +/* coins ... - so far, gold is all there is */ +#define COIN(name,prob,metal,worth,sn) \ + OBJECT(OBJ(name, NoDes), \ + BITS(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, metal), \ + 0, COIN_CLASS, prob, 0, 1, worth, 0, 0, 0, 0, 0, HI_GOLD, sn) +COIN("gold piece", 1000, GOLD, 1, GOLD_PIECE), +#undef COIN + +/* gems ... - includes stones and rocks but not boulders */ +#define GEM(name,desc,prob,wt,gval,nutr,mohs,glass,color,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(0, 1, 0, 0, 0, 0, 0, 0, 0, \ + HARDGEM(mohs), 0, -P_SLING, glass), \ + 0, GEM_CLASS, prob, 0, wt, gval, 3, 3, 0, 0, nutr, color, sn) +#define ROCK(name,desc,kn,prob,wt,gval,sdam,ldam,mgc,nutr,mohs,glass,colr,sn) \ + OBJECT(OBJ(name, desc), \ + BITS(kn, 1, 0, 0, mgc, 0, 0, 0, 0, \ + HARDGEM(mohs), 0, -P_SLING, glass), \ + 0, GEM_CLASS, prob, 0, wt, gval, sdam, ldam, 0, 0, nutr, colr, sn) +GEM("dilithium crystal", "white", 2, 1, 4500, 15, 5, GEMSTONE, CLR_WHITE, + DILITHIUM_CRYSTAL), +MARKER(FIRST_REAL_GEM, DILITHIUM_CRYSTAL) +GEM("diamond", "white", 3, 1, 4000, 15, 10, GEMSTONE, CLR_WHITE, + DIAMOND), +GEM("ruby", "red", 4, 1, 3500, 15, 9, GEMSTONE, CLR_RED, + RUBY), +GEM("jacinth", "orange", 3, 1, 3250, 15, 9, GEMSTONE, CLR_ORANGE, + JACINTH), +GEM("sapphire", "blue", 4, 1, 3000, 15, 9, GEMSTONE, CLR_BLUE, + SAPPHIRE), +GEM("black opal", "black", 3, 1, 2500, 15, 8, GEMSTONE, CLR_BLACK, + BLACK_OPAL), +GEM("emerald", "green", 5, 1, 2500, 15, 8, GEMSTONE, CLR_GREEN, + EMERALD), +GEM("turquoise", "green", 6, 1, 2000, 15, 6, GEMSTONE, CLR_GREEN, + TURQUOISE), +GEM("citrine", "yellow", 4, 1, 1500, 15, 6, GEMSTONE, CLR_YELLOW, + CITRINE), +GEM("aquamarine", "green", 6, 1, 1500, 15, 8, GEMSTONE, CLR_GREEN, + AQUAMARINE), +GEM("amber", "yellowish brown", 8, 1, 1000, 15, 2, GEMSTONE, CLR_BROWN, + AMBER), +GEM("topaz", "yellowish brown", 10, 1, 900, 15, 8, GEMSTONE, CLR_BROWN, + TOPAZ), +GEM("jet", "black", 6, 1, 850, 15, 7, GEMSTONE, CLR_BLACK, + JET), +GEM("opal", "white", 12, 1, 800, 15, 6, GEMSTONE, CLR_WHITE, + OPAL), +GEM("chrysoberyl", "yellow", 8, 1, 700, 15, 5, GEMSTONE, CLR_YELLOW, + CHRYSOBERYL), +GEM("garnet", "red", 12, 1, 700, 15, 7, GEMSTONE, CLR_RED, + GARNET), +GEM("amethyst", "violet", 14, 1, 600, 15, 7, GEMSTONE, CLR_MAGENTA, + AMETHYST), +GEM("jasper", "red", 15, 1, 500, 15, 7, GEMSTONE, CLR_RED, + JASPER), +GEM("fluorite", "violet", 15, 1, 400, 15, 4, GEMSTONE, CLR_MAGENTA, + FLUORITE), +GEM("obsidian", "black", 9, 1, 200, 15, 6, GEMSTONE, CLR_BLACK, + OBSIDIAN), +GEM("agate", "orange", 12, 1, 200, 15, 6, GEMSTONE, CLR_ORANGE, + AGATE), +GEM("jade", "green", 10, 1, 300, 15, 6, GEMSTONE, CLR_GREEN, + JADE), +MARKER(LAST_REAL_GEM, JADE) +GEM("worthless piece of white glass", "white", + 77, 1, 0, 6, 5, GLASS, CLR_WHITE, WORTHLESS_WHITE_GLASS), +MARKER(FIRST_GLASS_GEM, WORTHLESS_WHITE_GLASS) +GEM("worthless piece of blue glass", "blue", + 77, 1, 0, 6, 5, GLASS, CLR_BLUE, WORTHLESS_BLUE_GLASS), +GEM("worthless piece of red glass", "red", + 77, 1, 0, 6, 5, GLASS, CLR_RED, WORTHLESS_RED_GLASS), +GEM("worthless piece of yellowish brown glass", "yellowish brown", + 77, 1, 0, 6, 5, GLASS, CLR_BROWN, WORTHLESS_YELLOWBROWN_GLASS), +GEM("worthless piece of orange glass", "orange", + 76, 1, 0, 6, 5, GLASS, CLR_ORANGE, WORTHLESS_ORANGE_GLASS), +GEM("worthless piece of yellow glass", "yellow", + 77, 1, 0, 6, 5, GLASS, CLR_YELLOW, WORTHLESS_YELLOW_GLASS), +GEM("worthless piece of black glass", "black", + 76, 1, 0, 6, 5, GLASS, CLR_BLACK, WORTHLESS_BLACK_GLASS), +GEM("worthless piece of green glass", "green", + 77, 1, 0, 6, 5, GLASS, CLR_GREEN, WORTHLESS_GREEN_GLASS), +GEM("worthless piece of violet glass", "violet", + 77, 1, 0, 6, 5, GLASS, CLR_MAGENTA, WORTHLESS_VIOLET_GLASS), +MARKER(LAST_GLASS_GEM, WORTHLESS_VIOLET_GLASS) + +/* Placement note: there is a wishable subrange for + * "gray stones" in the o_ranges[] array in objnam.c + * that is currently everything between luckstones and flint + * (inclusive). + */ +ROCK("luckstone", "gray", 0, 10, 10, 60, 3, 3, 1, 10, 7, MINERAL, CLR_GRAY, + LUCKSTONE), +ROCK("loadstone", "gray", 0, 10, 500, 1, 3, 3, 1, 10, 6, MINERAL, CLR_GRAY, + LOADSTONE), +ROCK("touchstone", "gray", 0, 8, 10, 45, 3, 3, 1, 10, 6, MINERAL, CLR_GRAY, + TOUCHSTONE), +ROCK("flint", "gray", 0, 10, 10, 1, 6, 6, 0, 10, 7, MINERAL, CLR_GRAY, + FLINT), +ROCK("rock", NoDes, 1, 100, 10, 0, 3, 3, 0, 10, 7, MINERAL, CLR_GRAY, + ROCK), +#undef GEM +#undef ROCK + +/* miscellaneous ... */ +/* Note: boulders and rocks are not normally created at random; the + * probabilities only come into effect when you try to polymorph them. + * Boulders weigh more than MAX_CARR_CAP; statues use corpsenm to take + * on a specific type and may act as containers (both affect weight). + */ +OBJECT(OBJ("boulder", NoDes), + BITS(1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, P_NONE, MINERAL), 0, + ROCK_CLASS, 100, 0, 6000, 0, 20, 20, 0, 0, 2000, HI_MINERAL, BOULDER), +OBJECT(OBJ("statue", NoDes), + BITS(1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, P_NONE, MINERAL), 0, + ROCK_CLASS, 900, 0, 2500, 0, 20, 20, 0, 0, 2500, CLR_WHITE, STATUE), + +OBJECT(OBJ("heavy iron ball", NoDes), + BITS(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, WHACK, P_NONE, IRON), 0, + BALL_CLASS, 1000, 0, 480, 10, 25, 25, 0, 0, 200, HI_METAL, + HEAVY_IRON_BALL), + /* +d4 when "very heavy" */ +OBJECT(OBJ("iron chain", NoDes), + BITS(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, WHACK, P_NONE, IRON), 0, + CHAIN_CLASS, 1000, 0, 120, 0, 4, 4, 0, 0, 200, HI_METAL, IRON_CHAIN), + /* +1 both l & s */ + +/* Venom is normally a transitory missile (spit by various creatures) + * but can be wished for in wizard mode so could occur in bones data. + */ +OBJECT(OBJ("splash of blinding venom", "splash of venom"), + BITS(0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, P_NONE, LIQUID), 0, + VENOM_CLASS, 500, 0, 1, 0, 0, 0, 0, 0, 0, HI_ORGANIC, BLINDING_VENOM), +OBJECT(OBJ("splash of acid venom", "splash of venom"), + BITS(0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, P_NONE, LIQUID), 0, + VENOM_CLASS, 500, 0, 1, 0, 6, 6, 0, 0, 0, HI_ORGANIC, ACID_VENOM), + /* +d6 small or large */ + +#if defined(OBJECTS_DESCR_INIT) || defined(OBJECTS_INIT) +/* fencepost, the deadly Array Terminator -- name [1st arg] *must* be NULL */ +OBJECT(OBJ(NoDes, NoDes), + BITS(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, 0), 0, + ILLOBJ_CLASS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +#undef BITS +#endif + +#undef OBJ +#undef OBJECT +#undef MARKER +#undef HARDGEM +#undef NoDes + +/*objects.c*/ diff --git a/include/optlist.h b/include/optlist.h new file mode 100644 index 000000000..c723e4981 --- /dev/null +++ b/include/optlist.h @@ -0,0 +1,928 @@ +/* NetHack 5.0 optlist.h */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef OPTLIST_H +#define OPTLIST_H + +/* + * NOTE: If you add (or delete) an option, please review: + * doc/options.txt + * + * It contains how-to info and outlines some required/suggested + * updates that should accompany your change. + */ + +#define BACKWARD_COMPAT + +extern int optfn_boolean(int, int, boolean, char *, char *); + +enum OptType { BoolOpt, CompOpt, OthrOpt }; +enum Y_N { No, Yes }; +enum Off_On { Off, On }; +/* Advanced options are only shown in the full, traditional options menu */ +enum OptSection { + OptS_General, OptS_Behavior, OptS_Map, OptS_Status, OptS_Advanced +}; +enum menu_terminology_preference { + Term_False, Term_Off, Term_Disabled, Term_Excluded, num_terms +}; + +struct allopt_t { + const char *name; + enum OptSection section; + int minmatch; + int expectedbuf; + int idx; + enum optset_restrictions setwhere; + enum OptType opttyp; + enum Y_N negateok; + enum Y_N valok; + enum Y_N dupeok; + enum Y_N pfx; + enum menu_terminology_preference termpref; + boolean opt_in_out, *addr; + int (*optfn)(int, int, boolean, char *, char *); + const char *alias; + const char *descr; + const char *prefixgw; + boolean initval, has_handler, dupdetected, disregarded; +}; + +#endif /* OPTLIST_H */ + +#if defined(NHOPT_PROTO) || defined(NHOPT_ENUM) || defined(NHOPT_PARSE) +/* clang-format off */ +/* *INDENT-OFF* */ + +#define NoAlias ((const char *) 0) + +#if defined(NHOPT_PROTO) +#define NHOPTB(a, sec, b, c, s, i, n, v, d, al, bp, termp, desc) /*empty*/ +#define NHOPTC(a, sec, b, c, s, n, v, d, h, al, z) \ +static int optfn_##a(int, int, boolean, char *, char *); +#define NHOPTP(a, sec, b, c, s, n, v, d, h, al, z) \ +static int pfxfn_##a(int, int, boolean, char *, char *); +#define NHOPTO(m, sec, a, b, c, s, n, v, d, al, z) \ +static int optfn_##a(int, int, boolean, char *, char *); + +#elif defined(NHOPT_ENUM) +#define NHOPTB(a, sec, b, c, s, i, n, v, d, al, bp, termp, desc) opt_##a, +#define NHOPTC(a, sec, b, c, s, n, v, d, h, al, z) opt_##a, +#define NHOPTP(a, sec, b, c, s, n, v, d, h, al, z) pfx_##a, +#define NHOPTO(m, sec, a, b, c, s, n, v, d, al, z) opt_##a, + +#elif defined(NHOPT_PARSE) +#define NHOPTB(a, sec, b, c, s, i, n, v, d, al, bp, termp, desc) \ + { #a, OptS_##sec, 0, b, opt_##a, s, BoolOpt, n, v, d, No, termp, c, \ + bp, &optfn_boolean, al, desc, (const char *) 0, i, 0, 0 , 0 }, +#define NHOPTC(a, sec, b, c, s, n, v, d, h, al, z) \ + { #a, OptS_##sec, 0, b, opt_##a, s, CompOpt, n, v, d, No, 0, c, \ + (boolean *) 0, &optfn_##a, al, z, (const char *) 0, Off, h, 0, 0 }, +#define NHOPTP(a, sec, b, c, s, n, v, d, h, al, z) \ + { #a, OptS_##sec, 0, b, pfx_##a, s, CompOpt, n, v, d, Yes, 0, c, \ + (boolean *) 0, &pfxfn_##a, al, z, #a, Off, h, 0, 0 }, +#define NHOPTO(m, sec, a, b, c, s, n, v, d, al, z) \ + { m, OptS_##sec, 0, b, opt_##a, s, OthrOpt, n, v, d, No, 0, c, \ + (boolean *) 0, &optfn_##a, al, z, (const char *) 0, On, On, 0, 0 }, + +/* this is not reliable because TILES_IN_GLYPHMAP might be defined + * in a multi-interface binary but not apply to the current interface */ +#ifdef TILES_IN_GLYPHMAP +#define tiled_map_Def On +#define ascii_map_Def Off +#else +#define ascii_map_Def On +#define tiled_map_Def Off +#endif +#endif + +/* B:nm, sec, ln, opt_*, setwhere?, on?, negat?, val?, dup?, hndlr? Alias, + bool_p, term */ +/* C:nm, sec, ln, opt_*, setwhere?, negateok?, valok?, dupok?, hndlr? Alias, + desc */ +/* P:pfx, sec, ln, opt_*, setwhere?, negateok?, valok?, dupok?, hndlr? Alias, + desc*/ + /* + * Most of the options are in alphabetical order; a few are forced + * to the top of list so that doset() will list them first and + * all_options_str() will gather them first to write to the top of + * a new RC file by #saveoptions. + * + * windowtype comes first because its value can affect how wc_ and + * wc2_ options are processed; playmode (for players who can't or + * don't know how to specify a command line) and name (ditto, more + * or less) come next; then role, race, gender, align. Those will + * be at the top of the file for #saveoptions constructed RC file. + */ + NHOPTC(windowtype, Advanced, WINTYPELEN, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "windowing system to use (should be specified first)") + NHOPTC(playmode, Advanced, 8, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "normal play, non-scoring explore mode, or debug mode") + NHOPTC(name, Advanced, PL_NSIZ, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "your character's name (e.g., name:Merlin-W)") + NHOPTC(role, Advanced, PL_CSIZ, opt_in, set_gameview, + Yes, Yes, Yes, No, "character", + "your starting role (e.g., Barbarian, Valkyrie)") + NHOPTC(race, Advanced, PL_CSIZ, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, + "your starting race (e.g., Human, Elf)") + NHOPTC(gender, Advanced, 8, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, + "your starting gender (male or female)") + NHOPTC(alignment, Advanced, 8, opt_in, set_gameview, + Yes, Yes, Yes, No, "align", + "your starting alignment (lawful, neutral, or chaotic)") + /* end of special ordering; remainder of entries are in alphabetical order + */ + NHOPTB(accessiblemsg, Advanced, 0, opt_out, set_in_game, + Off, Yes, No, No, NoAlias, &a11y.accessiblemsg, Term_False, + "add location information to messages") + NHOPTB(acoustics, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.acoustics, Term_False, + "can your character hear anything") + /* NHOPTC(align) -- moved to top */ + NHOPTC(align_message, Advanced, 20, opt_in, set_gameview, + Yes, Yes, No, Yes, NoAlias, "message window alignment") + NHOPTC(align_status, Advanced, 20, opt_in, set_gameview, + No, Yes, No, Yes, NoAlias, "status window alignment") +#ifdef WIN32 + NHOPTC(altkeyhandling, Advanced, 20, opt_in, set_in_game, + No, Yes, No, Yes, "altkeyhandler", "alternative key handling") +#else + NHOPTC(altkeyhandling, Advanced, 20, opt_in, set_in_config, + No, Yes, No, Yes, "altkeyhandler", "(not applicable)") +#endif +#ifdef ALTMETA + NHOPTB(altmeta, Advanced, 0, opt_out, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.altmeta, Term_False, + "treat \"ESC c\" as M-c (Meta+c, 8th bit set)") +#elif defined(AMIGA_INTUITION) + NHOPTB(altmeta, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &sysflags.altmeta, Term_False, + "treat ALT+c as M-c (Meta+c, 8th bit set)") +#else + NHOPTB(altmeta, Advanced, 0, opt_out, set_in_config, + Off, Yes, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(armorstatus, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.armorstatus, Term_False, + "summarize currently worn armor in a status field") + NHOPTB(ascii_map, Advanced, 0, opt_in, set_in_game, + ascii_map_Def, Yes, No, No, NoAlias, &iflags.wc_ascii_map, + Term_False, "show map as text") + NHOPTO("autocompletions", Advanced, o_autocomplete, BUFSZ, opt_in, + set_in_game, No, Yes, No, NoAlias, "edit autocompletions") + NHOPTB(autodescribe, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.autodescribe, Term_False, + "describe terrain under cursor") + NHOPTB(autodig, Behavior, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.autodig, Term_False, + "dig if moving and wielding a digging tool") + NHOPTB(autoopen, Behavior, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.autoopen, Term_False, + "walking into a door attempts to open it") + NHOPTB(autopickup, Behavior, 0, opt_out, set_in_game, + Off, Yes, No, No, NoAlias, &flags.pickup, Term_False, + "automatically pick up objects") + NHOPTO("autopickup exceptions", Behavior, o_autopickup_exceptions, BUFSZ, + opt_in, set_in_game, + No, Yes, No, NoAlias, "edit autopickup exceptions") + NHOPTB(autoquiver, Behavior, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.autoquiver, Term_False, + "fill empty quiver automatically when firing") + NHOPTC(autounlock, Behavior, 80, opt_out, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "action to take when encountering locked door or chest") + NHOPTB(bgcolors, Map, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.bgcolors, Term_Off, + "use background color for some map hilighting") + NHOPTO("bind keys", Advanced, o_bind_keys, BUFSZ, opt_in, set_in_game, + No, Yes, No, NoAlias, "edit key binds") +#if defined(MICRO) && !defined(AMIGA) + NHOPTB(BIOS, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.BIOS, Term_False, + "use IBM ROM BIOS calls") +#else + NHOPTB(BIOS, Advanced, 0, opt_in, set_in_config, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(blind, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, "permablind", &u.uroleplay.blind, Term_False, + "your character is permanently blind") + NHOPTB(bones, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &flags.bones, Term_False, + "allow loading bones files") +#ifdef BACKWARD_COMPAT + NHOPTC(boulder, Advanced, 1, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "deprecated (use S_boulder in sym file instead)") +#endif + NHOPTC(catname, Advanced, PL_PSIZ, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "name of your starting pet if it is a kitten") +#ifdef INSURANCE + NHOPTB(checkpoint, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.ins_chkpt, Term_False, + "save game state after each level change") +#else + NHOPTB(checkpoint, Advanced, 0, opt_out, set_in_config, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(cmdassist, Behavior, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.cmdassist, Term_False, + "give help for errors on direction input") + NHOPTB(color, Map, 0, opt_in, set_in_game, + On, Yes, No, No, "colour", &iflags.wc_color, Term_False, + "use color in map") + NHOPTB(confirm, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.confirm, Term_False, + "ask before hitting tame or peaceful monsters") +#ifdef CRASHREPORT + NHOPTC(crash_email, Advanced, PL_NSIZ, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "email address for reporting") + NHOPTC(crash_name, Advanced, PL_NSIZ, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "your name for reporting") + NHOPTC(crash_urlmax, Advanced, PL_NSIZ, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "length of longest url we can generate") +#endif +#ifdef CURSES_GRAPHICS + NHOPTC(cursesgraphics, Advanced, 70, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "load curses display symbols into symset") +#endif + NHOPTB(customcolors, Map, 0, opt_out, set_in_game, + On, Yes, No, No, "customcolours", &iflags.customcolors, + Term_False, "use custom colors in map") + NHOPTB(customsymbols, Map, 0, opt_out, set_in_game, + On, Yes, No, No, "customsymbols", &iflags.customsymbols, + Term_False, "use custom utf8 symbols in map") + NHOPTB(dark_room, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.dark_room, Term_False, + "show floor outside line of sight differently") + NHOPTB(deaf, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, "permadeaf", &u.uroleplay.deaf, Term_False, + "your character is permanently deaf") +#ifdef BACKWARD_COMPAT + NHOPTC(DECgraphics, Advanced, 70, opt_in, set_in_config, + Yes, Yes, No, No, NoAlias, + "load DECGraphics display symbols into symset") +#endif + NHOPTB(debug_hunger, Advanced, 0, opt_in, set_wiznofuz, + Off, Yes, No, No, NoAlias, &iflags.debug_hunger, Term_False, + "no hunger") + NHOPTB(debug_mongen, Advanced, 0, opt_in, set_wiznofuz, + Off, Yes, No, No, NoAlias, &iflags.debug_mongen, Term_False, + "no random monster generation") + NHOPTB(debug_overwrite_stairs, Advanced, 0, opt_in, set_wiznofuz, + Off, Yes, No, No, NoAlias, &iflags.debug_overwrite_stairs, + Term_False, "level generation can overwrite stairs") + NHOPTC(disclose, Advanced, sizeof flags.end_disclose * 2, + opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "the kinds of information to disclose at end of game") + NHOPTC(dogname, Advanced, PL_PSIZ, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "name of your starting pet if it is a little dog") + NHOPTB(dropped_nopick, Behavior, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.nopick_dropped, Term_False, + "don't autopickup dropped items") + NHOPTC(dungeon, Advanced, MAXDCHARS + 1,opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "list of symbols to use in drawing the dungeon map") + NHOPTC(effects, Advanced, MAXECHARS + 1, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "list of symbols to use in drawing special effects") + NHOPTB(eight_bit_tty, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.wc_eight_bit_input, + Term_False, "send 8-bit characters directly to terminal") + NHOPTB(extmenu, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.extmenu, Term_False, + "use menu for getting extended commands") + NHOPTB(female, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, "male", &flags.female, Term_False, + "deprecated; use gender:female") + NHOPTB(fireassist, Behavior, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.fireassist, Term_False, + "fire-command tries to be helpful") + NHOPTB(fixinv, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.invlet_constant, Term_False, + "inventory items keep their letters") + NHOPTC(font_map, Advanced, 40, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "font to use in the map window") + NHOPTC(font_menu, Advanced, 40, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "font to use in menus") + NHOPTC(font_message, Advanced, 40, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, + "font to use in the message window") + NHOPTC(font_size_map, Advanced, 20, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "size of the map font") + NHOPTC(font_size_menu, Advanced, 20, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "size of the menu font") + NHOPTC(font_size_message, Advanced, 20, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "size of the message font") + NHOPTC(font_size_status, Advanced, 20, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "size of the status font") + NHOPTC(font_size_text, Advanced, 20, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "size of the text font") + NHOPTC(font_status, Advanced, 40, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "font to use in status window") + NHOPTC(font_text, Advanced, 40, opt_in, set_gameview, + Yes, Yes, Yes, No, NoAlias, "font to use in text windows") + NHOPTB(force_invmenu, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.force_invmenu, Term_False, + "commands asking for inventory item show a menu") + NHOPTC(fruit, General, PL_FSIZ, opt_in, set_in_game, + No, Yes, No, No, NoAlias, "name of a fruit you enjoy eating") + NHOPTB(fullscreen, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.wc2_fullscreen, Term_False, + "toggle fullscreen") + /* NHOPTC(gender) -- moved to top */ + NHOPTC(glyph, Advanced, 40, opt_in, set_in_game, + No, Yes, Yes, No, NoAlias, + "set representation of a glyph to a unicode value and color") + NHOPTB(goldX, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.goldX, Term_False, + "classify gold as unknown or uncursed") + NHOPTB(guicolor, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.wc2_guicolor, Term_False, + "use color for UI") + NHOPTB(help, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.help, Term_False, + "show all available info when using whatis-command") + NHOPTB(herecmd_menu, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.herecmd_menu, Term_False, + "show commands available in this location") +#if defined(MACOS9) + NHOPTC(hicolor, Advanced, 15, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "same as palette, only order is reversed") +#endif + NHOPTB(hilite_pet, Map, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.wc_hilite_pet, Term_False, + "use highlight for pets") + NHOPTB(hilite_pile, Map, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.hilite_pile, Term_False, + "highlight piles of items") +#ifdef STATUS_HILITES + NHOPTC(hilite_status, Advanced, 13, opt_out, set_in_game, + Yes, Yes, Yes, No, NoAlias, + "a status highlighting rule (can occur multiple times)") +#else + NHOPTC(hilite_status, Advanced, 13, opt_out, set_in_config, + Yes, Yes, Yes, No, NoAlias, "(not available)") +#endif + NHOPTB(hitpointbar, Status, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.wc2_hitpointbar, Term_False, + "show colored bar for hit points") + NHOPTC(horsename, Advanced, PL_PSIZ, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "name of your starting pet if it is a pony") +#ifdef BACKWARD_COMPAT + NHOPTC(IBMgraphics, Advanced, 70, opt_in, set_in_config, + Yes, Yes, No, No, NoAlias, + "load IBMGraphics display symbols into symset") +#endif + NHOPTB(idlecheckpoint, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.idlecheckpoint, Term_Off, + "update checkpoint file if input is idle for 10 seconds") +#ifndef MACOS9 + NHOPTB(ignintr, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.ignintr, Term_False, + "ignore interrupt signals") +#else + NHOPTB(ignintr, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(implicit_uncursed, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.implicit_uncursed, Term_False, + "omit \"uncursed\" from inventory") +#if 0 /* obsolete - pre-OSX Mac */ + NHOPTB(large_font, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.obsolete, + (char *)0) +#endif + NHOPTB(legacy, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &flags.legacy, Term_False, + "show introductory message") + NHOPTB(lit_corridor, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.lit_corridor, Term_False, + "show dark corridors as lit if in sight") + NHOPTB(lootabc, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.lootabc, Term_False, + "use a/b/c rather than o/i/c when looting") + NHOPTB(mail, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.biff, Term_False, + "enable the mail daemon") + NHOPTC(map_mode, Advanced, 20, opt_in, set_gameview, + Yes, Yes, No, No, NoAlias, "map display mode under Windows") + NHOPTB(mention_decor, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.mention_decor, Term_False, + "give feedback when walking over interesting features") + NHOPTB(mention_map, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &a11y.glyph_updates, Term_False, + "give feedback when interesting map locations change") + NHOPTB(mention_walls, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.mention_walls, Term_False, + "give feedback when walking into walls") + NHOPTC(menu_deselect_all, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "deselect all items in a menu") + NHOPTC(menu_deselect_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "deselect all items on this page of a menu") + NHOPTC(menu_first_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "jump to the first page in a menu") + NHOPTC(menu_headings, Advanced, 4, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, "display style for menu headings") + NHOPTC(menu_invert_all, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "invert all items in a menu") + NHOPTC(menu_invert_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "invert all items on this page of a menu") + NHOPTC(menu_last_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "jump to the last page in a menu") + NHOPTC(menu_next_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "go to the next menu page") + NHOPTC(menu_objsyms, Advanced, 12, opt_in, set_in_game, + Yes, Yes, No, Yes, "use_menu_glyphs", + "show object symbols in menus") +#ifdef TTY_GRAPHICS + NHOPTB(menu_overlay, Advanced, 0, opt_in, set_in_game, + On, Yes, No, No, NoAlias, &iflags.menu_overlay, Term_False, + "menus overlay and align to right") +#else + NHOPTB(menu_overlay, Advanced, 0, opt_in, set_in_config, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTC(menu_previous_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "go to the previous menu page") + NHOPTC(menu_search, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "search for a menu item") + NHOPTC(menu_select_all, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "select all items in a menu") + NHOPTC(menu_select_page, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "select all items on this page of a menu") + NHOPTC(menu_shift_left, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "pan current menu page left") + NHOPTC(menu_shift_right, Advanced, 4, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "pan current menu page right") + NHOPTB(menu_tab_sep, Advanced, 0, opt_in, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.menu_tab_sep, Term_False, + "menu formatting") + NHOPTB(menucolors, Advanced, 0, opt_in, set_in_game, + Off, Yes, Yes, No, NoAlias, &iflags.use_menu_color, Term_False, + "use colors in menus") + NHOPTO("menu colors", Status, o_menu_colors, BUFSZ, opt_in, set_in_game, + No, Yes, No, NoAlias, "change colors used in menus") + NHOPTC(menuinvertmode, Advanced, 5, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "experimental behavior of menu inverts") + NHOPTC(menustyle, Advanced, MENUTYPELEN, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "user interface for object selection") + NHOPTO("message types", Advanced, o_message_types, BUFSZ, + opt_in, set_in_game, + No, Yes, No, NoAlias, "edit message types") + NHOPTB(mon_movement, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &a11y.mon_movement, Term_False, + "message when hero sees monster movement") + NHOPTB(monpolycontrol, Advanced, 0, opt_in, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.mon_polycontrol, Term_False, + "control monster polymorphs") + NHOPTB(montelecontrol, Advanced, 0, opt_in, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.mon_telecontrol, Term_False, + "control monster teleport destinations") + NHOPTC(monsters, Advanced, MAXMCLASSES, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "list of symbols to use for monsters") + NHOPTC(mouse_support, Advanced, 0, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "game receives click info from mouse") +#if PREV_MSGS /* tty or curses */ + NHOPTC(msg_window, Advanced, 1, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "control of \"view previous message(s)\" (^P) behavior") +#else + NHOPTC(msg_window, Advanced, 1, opt_in, set_in_config, + Yes, Yes, No, Yes, NoAlias, "(not applicable)") +#endif + NHOPTC(msghistory, Advanced, 5, opt_in, set_gameview, + Yes, Yes, No, No, NoAlias, + "number of top line messages to save") + /* NHOPTC(name) -- moved to top */ +#ifdef NEWS + NHOPTB(news, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.news, Term_False, + "show any news at game start") +#else + NHOPTB(news, Advanced, 0, opt_in, set_in_config, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(nudist, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &u.uroleplay.nudist, Term_False, + "start your character without armor") + NHOPTB(null, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.null, Term_False, + "allow nulls to be sent to terminal") + NHOPTC(number_pad, General, 1, opt_in, set_in_game, + No, Yes, No, Yes, NoAlias, + "use the number pad for movement") + NHOPTC(objects, Advanced, MAXOCLASSES, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "list of symbols to use for objects") + NHOPTC(packorder, Advanced, MAXOCLASSES, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "the inventory order of the items in your pack") +#ifdef CHANGE_COLOR +#ifndef MACOS9 /* not old Mac OS9 */ + NHOPTC(palette, Advanced, 15, opt_in, set_gameview, + No, Yes, Yes, No, "hicolor", + "palette (adjust an RGB color in palette (color/R-G-B)") +#else + NHOPTC(palette, Advanced, 15, opt_in, set_in_game, + No, Yes, Yes, No, "hicolor", + "palette (00c/880/-fff is blue/yellow/reverse white)") +#endif +#endif + /* prior to paranoid_confirmation, 'prayconfirm' was a distinct option */ + NHOPTC(paranoid_confirmation, Advanced, 28, opt_in, set_in_game, + Yes, Yes, Yes, Yes, "prayconfirm", + "extra prompting in certain situations") + NHOPTB(pauper, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &u.uroleplay.pauper, Term_False, + "start your character without any items") + NHOPTB(perm_invent, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.perm_invent, Term_Off, + "show persistent inventory window") + NHOPTC(perminv_mode, Advanced, 20, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "what to show in persistent inventory window") + NHOPTC(petattr, Advanced, 88, opt_in, set_in_game, /* tty/curses only */ + No, Yes, No, Yes, NoAlias, "attributes for highlighting pets") + /* pettype is ignored for some roles */ + NHOPTC(pettype, Advanced, 4, opt_in, set_gameview, + Yes, Yes, No, No, "pet", "your preferred initial pet type") + NHOPTC(pickup_burden, Advanced, 20, opt_in, set_in_game, + No, Yes, No, Yes, NoAlias, + "maximum burden picked up before prompt") + NHOPTB(pickup_stolen, Behavior, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.pickup_stolen, Term_False, + "autopickup stolen items") + NHOPTB(pickup_thrown, Behavior, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.pickup_thrown, Term_False, + "autopickup thrown items") + NHOPTC(pickup_types, Behavior, MAXOCLASSES, opt_in, set_in_game, + No, Yes, No, Yes, NoAlias, + "types of objects to pick up automatically") + NHOPTC(pile_limit, Advanced, 24, opt_in, set_in_game, + Yes, Yes, No, No, NoAlias, + "threshold for \"there are many objects here\"") + NHOPTC(player_selection, Advanced, 12, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "choose character via dialog or prompts") + /* NHOPTC(playmode) -- moved to top */ + NHOPTB(popup_dialog, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.wc_popup_dialog, Term_False, + (char *)0) + NHOPTB(preload_tiles, Advanced, 0, opt_out, set_in_config, /* MSDOS only */ + On, Yes, No, No, NoAlias, &iflags.wc_preload_tiles, Term_False, + (char *)0) + NHOPTB(price_quotes, General, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.pricequotes, Term_False, + "display prices you have seen for unidentified objects") + NHOPTB(pushweapon, Behavior, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.pushweapon, Term_False, + "previous weapon goes to secondary slot") + NHOPTB(query_menu, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.query_menu, Term_False, + "use a menu for yes/no queries") + NHOPTB(quick_farsight, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.quick_farsight, Term_False, + "skip map browse when forced to looked at map") + /* NHOPTC(race) -- moved to top */ +#ifdef MICRO + NHOPTB(rawio, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.rawio, Term_False, + "allow use to raw I/O") +#else + NHOPTB(rawio, Advanced, 0, opt_in, set_in_config, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(reroll, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &u.uroleplay.reroll, Term_False, + "allow rerolling of starting inventory and items") + NHOPTB(rest_on_space, Advanced, 0, opt_in, set_in_game, Off, + Yes, No, No, NoAlias, &flags.rest_on_space, Term_False, + "space bar is bound to the rest-command") + NHOPTC(roguesymset, Advanced, 70, opt_in, set_in_game, + No, Yes, No, Yes, NoAlias, + "load a set of rogue display symbols from symbols file") + /* NHOPTC(role) -- moved to top */ + NHOPTC(runmode, Advanced, sizeof "teleport", opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "display frequency when `running' or `travelling'") + NHOPTB(safe_pet, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.safe_dog, Term_False, + "prevent you from hitting pets") + NHOPTB(safe_wait, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.safe_wait, Term_False, + "prevent waiting next to hostiles") + NHOPTB(sanity_check, Advanced, 0, opt_in, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.sanity_check, Term_False, + "perform data sanity checks") + NHOPTC(scores, Advanced, 32, opt_in, set_in_game, + No, Yes, No, No, NoAlias, + "the parts of the score list you wish to see") + NHOPTC(scroll_amount, Advanced, 20, opt_in, set_gameview, + Yes, Yes, No, No, NoAlias, + "amount to scroll map when scroll_margin is reached") + NHOPTC(scroll_margin, Advanced, 20, opt_in, set_gameview, + Yes, Yes, No, No, NoAlias, + "scroll map when this far from the edge") + NHOPTB(selectsaved, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &iflags.wc2_selectsaved, Term_False, + (char *)0) + NHOPTB(showdamage, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.showdamage, Term_False, + "show damage hero takes in message line") + NHOPTB(showexp, Status, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.showexp, Term_False, + "show experience points in status line") + NHOPTB(showrace, Map, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.showrace, Term_False, + "show your character by race rather than role") +#ifdef SCORE_ON_BOTL + NHOPTB(showscore, Status, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.showscore, Term_False, + "show current score in status line") +#else + NHOPTB(showscore, Status, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(showvers, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.showvers, Term_False, + "show version info on status line") + NHOPTB(silent, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.silent, Term_False, + "don't use terminal bell") + NHOPTB(softkeyboard, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.wc2_softkeyboard, + Term_False, (char *)0) + NHOPTC(sortdiscoveries, Advanced, 0, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "preferred order when displaying discovered objects") + NHOPTC(sortloot, Advanced, 4, opt_in, set_in_game, + No, Yes, No, Yes, NoAlias, + "sort object selection lists by description") + NHOPTB(sortpack, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.sortpack, Term_False, + "group inventory items by type") + NHOPTC(sortvanquished, Advanced, 0, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "preferred order when displaying vanquished monsters") + NHOPTC(soundlib, Advanced, WINTYPELEN, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "soundlib interface to use (if any)") +#ifdef SND_LIB_INTEGRATED + NHOPTB(sounds, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.sounds, Term_Off, + "use integrated sound effects") +#else + NHOPTB(sounds, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.sounds, Term_Off, + "use sounds") +#endif + NHOPTB(sparkle, Map, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.sparkle, Term_False, + "display sparkly effect when resisting magic") + NHOPTB(spot_monsters, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &a11y.mon_notices, Term_False, + "message when hero spots a monster") + NHOPTB(splash_screen, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &iflags.wc_splash_screen, Term_False, + (char *)0) + NHOPTB(standout, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.standout, Term_False, + "use standout for --more--") + NHOPTB(status_updates, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &iflags.status_updates, Term_False, + "allow the status lines to update") + NHOPTO("status condition fields", Status, o_status_cond, BUFSZ, + opt_in, set_in_game, + No, Yes, No, NoAlias, "change status condition highlighting") +#ifdef STATUS_HILITES + NHOPTC(statushilites, Advanced, 20, opt_in, set_in_game, + Yes, Yes, Yes, No, NoAlias, + "0=no status highlighting, N=show highlights for N turns") + NHOPTO("status highlight rules", Status, o_status_hilites, BUFSZ, + opt_in, set_in_game, + No, Yes, No, NoAlias, "change status line highlighting") +#else + NHOPTC(statushilites, Advanced, 20, opt_in, set_in_config, + Yes, Yes, Yes, No, NoAlias, "highlight control") +#endif + NHOPTC(statuslines, Status, 20, opt_in, set_in_game, + No, Yes, No, No, NoAlias, "2 or 3 lines for status display") +#ifdef WIN32CON + NHOPTC(subkeyvalue, Advanced, 7, opt_in, set_in_config, + No, Yes, Yes, No, NoAlias, "override keystroke value") +#endif + NHOPTC(suppress_alert, Advanced, 8, opt_in, set_in_game, + No, Yes, Yes, No, NoAlias, + "suppress alerts about version-specific features") + NHOPTC(symset, Map, 70, opt_in, set_in_game, + No, Yes, No, Yes, NoAlias, + "load a set of display symbols from symbols file") + NHOPTC(term_cols, Advanced, 6, opt_in, set_in_config, + No, Yes, No, No, "termcolumns", "number of columns") + NHOPTC(term_rows, Advanced, 6, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "number of rows") + NHOPTB(terrainstatus, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.terrainstatus, Term_False, + "show hero's location as a status field") + NHOPTC(tile_file, Advanced, 70, opt_in, set_gameview, + No, Yes, No, No, NoAlias, "name of tile file") + NHOPTC(tile_height, Advanced, 20, opt_in, set_gameview, + Yes, Yes, No, No, NoAlias, "height of tiles") + NHOPTC(tile_width, Advanced, 20, opt_in, set_gameview, + Yes, Yes, No, No, NoAlias, "width of tiles") + NHOPTB(tiled_map, Advanced, 0, opt_in, set_in_game, + tiled_map_Def, Yes, No, No, NoAlias, &iflags.wc_tiled_map, + Term_False, (char *)0) + NHOPTB(time, Status, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.time, Term_False, + "display game turns in status line") +#ifdef TIMED_DELAY + NHOPTB(timed_delay, Map, 0, opt_out, set_in_game, + Off, Yes, No, No, NoAlias, &flags.nap, Term_False, + "use delay when pausing for display effects") +#else + NHOPTB(timed_delay, Map, 0, opt_in, set_in_config, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(tips, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.tips, Term_False, + "show some helpful tips during gameplay") + NHOPTB(tombstone, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.tombstone, Term_False, + "show tombstone when your character dies") + NHOPTB(toptenwin, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.toptenwin, Term_False, + "show top scores in window") + NHOPTC(traps, Advanced, MAXTCHARS + 1, opt_in, set_in_config, + No, Yes, No, No, NoAlias, + "list of symbols to use in drawing traps") + NHOPTB(travel, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.travelcmd, Term_False, + "enable traveling via mouse click") +#ifdef DEBUG + NHOPTB(travel_debug, Advanced, 0, opt_out, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.trav_debug, Term_False, + (char *)0) +#else + NHOPTB(travel_debug, Advanced, 0, opt_out, set_wizonly, + Off, No, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTB(tutorial, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &flags.tutorial, Term_False, + "ask if you want the tutorial") + NHOPTB(use_darkgray, Advanced, 0, opt_out, set_in_config, + On, Yes, No, No, NoAlias, &iflags.wc2_darkgray, Term_False, + "use bold black color instead of blue") + NHOPTB(use_inverse, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &iflags.wc_inverse, Term_False, + "display detected monsters in inverse") + NHOPTB(use_truecolor, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, "use_truecolour", + &iflags.use_truecolor, Term_False, + (char *)0) + NHOPTC(vary_msgcount, Advanced, 20, opt_in, set_gameview, + No, Yes, No, No, NoAlias, "show more old messages at a time") + NHOPTB(verbose, Advanced, 0, opt_out, set_in_game, + On, Yes, No, No, NoAlias, &flags.verbose, Term_False, + (char *)0) + NHOPTC(versinfo, Advanced, 80, opt_out, set_in_game, + No, Yes, No, Yes, NoAlias, "extra information for 'showvers'") +#ifdef MSDOS + NHOPTC(video, Advanced, 20, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "method of video updating") +#endif +#ifdef VIDEOSHADES + NHOPTC(videocolors, Advanced, 40, opt_in, set_gameview, + No, Yes, No, No, "videocolours", + "color mappings for internal screen routines") + NHOPTC(videoshades, Advanced, 32, opt_in, set_gameview, + No, Yes, No, No, NoAlias, + "gray shades to map to black/gray/white") +#endif +#ifdef MSDOS + NHOPTC(video_width, Advanced, 10, opt_in, set_gameview, + No, Yes, No, No, NoAlias, "video width") + NHOPTC(video_height, Advanced, 10, opt_in, set_gameview, + No, Yes, No, No, NoAlias, "video height") +#endif +#ifdef SND_SPEECH + NHOPTB(voices, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.voices, Term_Off, + (char *)0) +#else + NHOPTB(voices, Advanced, 0, opt_in, set_gameview, + Off, Yes, No, No, NoAlias, &iflags.voices, Term_Excluded, + (char *)0) +#endif +#ifdef TTY_TILES_ESCCODES + NHOPTB(vt_tiledata, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.vt_tiledata, Term_False, + "output special escape codes") +#else + NHOPTB(vt_tiledata, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif +#ifdef TTY_SOUND_ESCCODES + NHOPTB(vt_sounddata, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, &iflags.vt_sounddata, Term_False, + "output sound data in special escape codes") +#else + NHOPTB(vt_sounddata, Advanced, 0, opt_in, set_in_config, + Off, Yes, No, No, NoAlias, (boolean *) 0, Term_False, + (char *)0) +#endif + NHOPTC(warnings, Advanced, 10, opt_in, set_in_config, + No, Yes, No, No, NoAlias, "display characters for warnings") + NHOPTB(weaponstatus, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &flags.weaponstatus, Term_False, + "show currently wielded weapon in a status field") + NHOPTC(whatis_coord, Advanced, 1, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "show coordinates when auto-describing cursor position") + NHOPTC(whatis_filter, Advanced, 1, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, + "filter coordinate locations when targeting next or previous") + NHOPTB(whatis_menu, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.getloc_usemenu, Term_False, + "show menu when getting a map location") + NHOPTB(whatis_moveskip, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.getloc_moveskip, Term_False, + "skip same glyph when getting map location") + NHOPTC(windowborders, Advanced, 9, opt_in, set_in_game, + Yes, Yes, No, Yes, NoAlias, "0 (off), 1 (on), 2 (auto)") +#ifdef WINCHAIN + NHOPTC(windowchain, Advanced, WINTYPELEN, opt_in, set_in_sysconf, + No, Yes, No, No, NoAlias, "window processor to use") +#endif + NHOPTC(windowcolors, Advanced, 80, opt_in, set_gameview, + No, Yes, Yes, No, NoAlias, + "the foreground/background colors of windows") + /* NHOPTC(windowtype) -- moved to top */ + NHOPTB(wizmgender, Advanced, 0, opt_in, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.wizmgender, Term_False, + (char *)0) + NHOPTB(wizweight, Advanced, 0, opt_in, set_wizonly, + Off, Yes, No, No, NoAlias, &iflags.wizweight, Term_False, + (char *)0) + NHOPTB(wraptext, Advanced, 0, opt_in, set_in_game, + Off, Yes, No, No, NoAlias, &iflags.wc2_wraptext, Term_False, + (char *)0) + + /* + * Prefix-based Options + */ + + NHOPTP(cond_, Advanced, 0, opt_in, set_hidden, + Yes, No, Yes, Yes, NoAlias, "prefix for cond_ options") + NHOPTP(font, Advanced, 0, opt_in, set_hidden, + Yes, Yes, Yes, No, NoAlias, "prefix for font options") +#if defined(MICRO) && !defined(AMIGA) + /* included for compatibility with old NetHack.cnf files */ + NHOPTP(IBM_, Advanced, 0, opt_in, set_hidden, + No, No, Yes, No, NoAlias, "prefix for old micro IBM_ options") +#endif /* MICRO */ + +#undef NoAlias +#undef NHOPTB +#undef NHOPTC +#undef NHOPTP +#undef NHOPTO + +/* *INDENT-ON* */ +/* clang-format on */ +#endif /* NHOPT_PROTO || NHOPT_ENUM || NHOPT_PARSE */ + +/*optlist.h*/ diff --git a/include/patchlevel.h b/include/patchlevel.h index a52c7156b..94bfacf74 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,25 +1,46 @@ -/* NetHack 3.6 patchlevel.h $NHDT-Date: 1674867524 2023/01/28 00:58:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.141 $ */ +/* NetHack 5.0 patchlevel.h $NHDT-Date: 1753856387 2025/07/29 22:19:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.288 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ -/* NetHack 3.6.x */ -#define VERSION_MAJOR 3 -#define VERSION_MINOR 6 +#ifndef PATCHLEVEL_H +#define PATCHLEVEL_H + +/* NetHack 5.0.x */ +#define VERSION_MAJOR 5 +#define VERSION_MINOR 0 /* * PATCHLEVEL is updated for each release. */ -#define PATCHLEVEL 7 +#define PATCHLEVEL 0 /* * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ #define EDITLEVEL 0 -#define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2023" +/* + * Development status possibilities. + */ +#define NH_STATUS_RELEASED 0 /* Released */ +#define NH_STATUS_WIP 1 /* Work in progress */ +#define NH_STATUS_BETA 2 /* BETA testing */ +#define NH_STATUS_POSTRELEASE 3 /* patch commit point only */ + +/* + * Development status of this NetHack version. + */ +#define NH_DEVEL_STATUS NH_STATUS_POSTRELEASE + +#ifndef DEBUG /* allow tool chains to define without causing warnings */ +#define DEBUG +#endif + +#define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2026" #define COPYRIGHT_BANNER_B \ " By Stichting Mathematisch Centrum and M. Stephenson." -/* COPYRIGHT_BANNER_C is generated by makedefs into date.h */ +/* nomakedefs.copyright_banner_c is generated at runtime */ +#define COPYRIGHT_BANNER_C nomakedefs.copyright_banner_c #define COPYRIGHT_BANNER_D " See license for details." /* @@ -30,8 +51,28 @@ * 0x = literal prefix "0x", MM = major version, mm = minor version, * PP = patch level, ee = edit level, L = literal suffix "L", * with all four numbers specified as two hexadecimal digits. + * + * When developing a new version, VERSION_COMPATIBILITY should be + * commented out so that increments of EDITLEVEL can be used to forcibly + * invalidate existing save files whenever incompatible changes are made + * to saved data. [Bones files should be less sensitive (only changes + * to individual level files matter; changes to general game state don't) + * but the extra complexity to support that is not worth the effort.] + */ +/*#define VERSION_COMPATIBILITY 0x05000000L*/ + +/****************************************************************************/ +/* Version 5.0.x */ + +/* + * NetHack 5.0.0, May 2, 2026 + * + * Sources changed to be compliant with the C99 standard. + * level compiler, dungeon compiler, and quest text all replaced with + * Lua alternatives. + * Refer to doc/fixes5-0-0.txt for a complete list of fixes and changes. + * */ -#define VERSION_COMPATIBILITY 0x03060002L /****************************************************************************/ /* Version 3.6.x */ @@ -39,7 +80,7 @@ /* Patch 7, February 16, 2023 * * during engraving, spaces were counted instead of non-space (cherry-pick of - * 4e0a1e04 from NetHack-3.7) + * 4e0a1e04 from NetHack WIP) * avoid potential buffer overflow in append_str() * resolve missing dependency in NetHack.sln * code in include/tradstdc.h was trying to suppress warn_unused result by @@ -48,17 +89,18 @@ * ubuntu impish 21.10; disable that for any Linux unless GCC_URWARN is * defined to force it back into effect * update_inventory() after leash goes slack - * player assigned name for monsters, specific objects, or object types could be - longer than what was intented to be allowed; for 'curses', much longer - * windows: added winflexbison to travis-ci configuration to permit full build of - * levcomp and dgncomp - * windows: a bad chdir specified in win/win32/dgnstuff.mak caused full build to - * abort - * windows: the console.rc file had outdated information stating 3.6.3 when the - * official 3.6.6 binary was built. - * windows: switch from using keyhandling dll's to incorporating the three + * player assigned name for monsters, specific objects, or object types + * could be longer than what was intended to be allowed; for 'curses', + * it could be much longer + * windows: added winflexbison to travis-ci configuration to permit full + * build of levcomp and dgncomp + * windows: a bad chdir specified in win/win32/dgnstuff.mak caused full build + * to abort + * windows: the console.rc file had outdated information stating 3.6.3 when + * the official 3.6.6 binary was built. + * windows: switch from using keyhandling dll's to incorporating the three * variations (default, ray, 340) in sys/winnt/nttty.c - * curses: cherry-picked selectsaved code from 3.7 for menu of save files + * curses: cherry-picked selectsaved code from 5.0 for menu of save files * NetHackW: fix delayed rendering of cursor when using farlook */ @@ -67,7 +109,8 @@ * invalid status highlight color could be maliciously used to corrupt memory * formatting corpse names used internal buffers differently from formatting * other objects and could potentially clobber memory - * avoid divide by 0 crash if 'bogusmon' (file of bogus monster types) is empty + * avoid divide by 0 crash if 'bogusmon' (file of bogus monster types) is + * empty * avoid #wizrumorcheck crash if either 'rumors.tru' or 'rumors.fal' or both * were empty when makedefs built 'rumors' */ @@ -77,13 +120,15 @@ * fix accessing mons[-1] when trying to gate in a non-valid demon * fix accessing mons[-1] when monster figures out if a tin cures stoning * have string_for_opt() return empty_optstr on failure - * ensure existing callers of string_for_opt() check return value before using it + * ensure existing callers of string_for_opt() check return value before + * using it * fix potential buffer overflow in add_menu_coloring() * fix potential buffer overflow in sym_val() - * fix potential buffer overflow in pline(), raw_printf(), and config_error_add() + * fix potential buffer overflow in pline(), raw_printf(), and + * config_error_add() * fix potential buffer overflow in choose_windows() * use vsnprintf instead of vsprintf in pline.c where possible - * Windows: incldues a fix from a 3.6.4 post-release update where + * Windows: includes a fix from a 3.6.4 post-release update where * OPTIONS=map_mode:fit_to_screen could cause a game start failure * Windows: users with C-locale unmappable names could get game start failure */ @@ -91,24 +136,24 @@ /* Patch 4, December 18, 2019 * * fix potential buffer overflow when parsing run-time configuration file - * GDBPATH and GREPPATH from sysconf or -D... on compilation command line were - * being processed even if PANICTRACE was disabled but only being freed - * at end of game when that was enabled + * GDBPATH and GREPPATH from sysconf or -D... on compilation command line + * were being processed even if PANICTRACE was disabled but only being + * freed at end of game when that was enabled * fix the article used in the message when your steed encounters a polymorph * trap * allow teleporting onto the vibrating square - * message "your knapsack can't accomodate any more items" when picking stuff - * up or removing such from container was inaccurate if there was some - * gold pending; vary the message rather than add more convoluted pickup - * code + * message "your knapsack can't accommodate any more items" when picking + * stuff up or removing such from container was inaccurate if there was + * some gold pending; vary the message rather than add more convoluted + * pickup code * dozen-ish assorted spelling/typo fixes in messages and source comments * wizard mode wishing for terrain would leave it unmapped if done while blind * wizard mode terrain wish could leave hero in water (severe vision limits) * or in lava (trapped, sinking) which wasn't there any more * flying hero can go down (via '>') holes or trap doors instead of escaping * trap - * polymorphed hero hiding on the ceiling can now use '>' to unhide instead of - * being told "you can't go down here" + * polymorphed hero hiding on the ceiling can now use '>' to unhide instead + * of being told "you can't go down here" * fix compilation on platforms that split the ncurses and tinfo libraries * Windows: allow all game files to be on a portable device via the sysconf * option 'portable_device_paths' @@ -119,9 +164,10 @@ * Fixed stale 'thrownobj' pointer for returning thrown aklys while engulfed * Fixed uarmh null pointer dereference if a helm of opposite alignment came * off due to being polymorphed - * Fixed 'object lost' panic when attempting to crawl of of the water during + * Fixed 'object lost' panic when attempting to crawl out of the water during * emergency disrobing/dropping - * Running now stops when moving over engravings so you can tell where they are + * Running now stops when moving over engravings so you can tell where they + * are * Fixed detection of unseen/secret doors which failed to find monsters hiding * under objects and failed to find monsters hiding at trap locations * Ensured fatal status conditions made it to disclosure and/or dumplog @@ -146,13 +192,14 @@ * Improved performance of some tty versions by reducing the number of * function calls made from mapglyph * Allowed the msdos implementation to build with curses and PDCurses - * Included over 100 other fixes and improvements as outlined in doc/fixes36.3 + * Included over 100 other fixes and improvements as outlined in + * doc/fixes36.3 (later renamed doc/fixes3-6-3.txt) */ /* Patch 2, May 7, 2019 * * Over 320 bug fixes including a couple of crash bug fixes as outlined in - * doc/fixes36.2 + * doc/fixes36.2 (later renamed to doc/fixes-3-6-2.txt) * More than 15 enhancements or improvements * Ensuring that unix Makefiles do not rely on features unique to gnu make * Improvements to hilite_status parsing in an effort to ensure that expected @@ -166,13 +213,13 @@ /* Patch 1, April 27, 2018 * * Over four hundred and seventy bug fixes and improvements as outlined in - * doc/fixes36.1 + * doc/fixes36.1 (later renamed to doc/fixes3-6-1.txt) */ /* * NetHack 3.6.0, December 7, 2015 * - * Hundreds of bug fixes as outlined in doc/fixes36.0. + * Hundreds of bug fixes as outlined in doc/fixes36.0 (doc/fixes3-6-0.txt). * Some code reorganization. * Some new features. * Variations of some community patches rolled in. @@ -362,7 +409,7 @@ * NetHack 3.2.0, April 11, 1996 * enhancements to the windowing systems including "tiles" or icons to * visually represent monsters and objects (courtesy Warwick Allison) - * window based menu system introduced for inventory and selection + * window-based menu system introduced for inventory and selection * moving light sources besides the player * improved #untrap (courtesy Helge Hafting) * spellcasting logic changes to balance spellcasting towards magic-using @@ -551,4 +598,5 @@ /****************************************************************************/ +#endif /* PATHLEVEL_H */ /*patchlevel.h*/ diff --git a/include/pcconf.h b/include/pcconf.h index b22d3e70d..e1fd14cfe 100644 --- a/include/pcconf.h +++ b/include/pcconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 pcconf.h $NHDT-Date: 1457207019 2016/03/05 19:43:39 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.19 $ */ +/* NetHack 5.0 pcconf.h $NHDT-Date: 1596498554 2020/08/03 23:49:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.28 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -18,12 +18,12 @@ * _MSC_VER is defined automatically by Microsoft C. * __BORLANDC__ is defined automatically by Borland C. * __SC__ is defined automatically by Symantec C. - * Note: 3.6.x was not verified with Symantec C. + * Note: 3.6.x was not verified with Symantec C. */ #define CONFIG_FILE "defaults.nh" #define GUIDEBOOK_FILE "Guidebook.txt" - + /* * The following options are somewhat configurable depending on * your compiler. @@ -35,24 +35,18 @@ /*#define OVERLAY */ /* Manual overlay definition (MSC 6.0ax only) */ -#ifndef __GO32__ -#define MFLOPPY /* Support for floppy drives and ramdisks by dgk */ -#endif - +#ifndef CROSS_TO_AMIGA #define SHELL /* via exec of COMMAND.COM */ - -#ifdef __BORLANDC__ -#define PCMUSIC /* Music option, enable very basic pc speaker music notes */ #endif /* * Screen control options * * You may uncomment: - * ANSI_DEFAULT - * or TERMLIB - * or ANSI_DEFAULT and TERMLIB - * or NO_TERMS + * ANSI_DEFAULT + * or TERMLIB + * or ANSI_DEFAULT and TERMLIB + * or NO_TERMS */ /* # define TERMLIB */ /* enable use of termcap file /etc/termcap */ @@ -67,7 +61,7 @@ #ifdef NO_TERMS /* if NO_TERMS select one screen package below */ #define SCREEN_BIOS /* Use bios calls for all screen control */ -/* #define SCREEN_DJGPPFAST */ /* Use djgpp fast screen routines */ +/* #define SCREEN_DJGPPFAST */ /* Use djgpp fast screen routines */ #endif /* # define PC9800 */ /* Allows NetHack to run on NEC PC-9800 machines */ @@ -81,8 +75,8 @@ */ #ifndef SUPPRESS_GRAPHICS #if (defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)) && !defined(PC9800) -#ifdef USE_TILES -#define SCREEN_VGA /* Include VGA graphics routines in the build */ +#ifdef TILES_IN_GLYPHMAP +#define SCREEN_VGA /* Include VGA graphics routines in the build */ #define SCREEN_VESA #endif #endif @@ -96,11 +90,13 @@ #define ANSI_DEFAULT #endif +#ifndef CROSS_TO_AMIGA #define RANDOM /* have Berkeley random(3) */ +#endif #define MAIL /* Allows for fake mail daemon to deliver mail */ /* in the MSDOS version. (For AMIGA MAIL see */ - /* amiconf.h). In the future this will be the */ + /* amiconf.h). In the future this will be the */ /* hook for mail reader implementation. */ /* The following is needed for prototypes of certain functions */ @@ -109,35 +105,27 @@ #include /* Provides prototypes of exit(), spawn() */ #endif +#ifdef CROSS_TO_AMIGA +#include +#endif + #if defined(_MSC_VER) && (_MSC_VER >= 7) #include -#include #ifdef strcmpi #undef strcmpi #endif -#include /* Provides prototypes of strncmpi(), etc. */ #include #include #include #define SIG_RET_TYPE void(__cdecl *)(int) -#define M(c) ((char) (0x80 | (c))) #define vprintf printf #define vfprintf fprintf #define vsprintf sprintf #endif -#if defined(__BORLANDC__) && defined(STRNCMPI) -#include /* Provides prototypes of strncmpi(), etc. */ -#endif - -#if defined(__DJGPP__) -#define _NAIVE_DOS_REGS -#include -#include /* Provides prototypes of strncmpi(), etc. */ #ifndef M #define M(c) ((char) (0x80 | (c))) #endif -#endif /* * On the VMS and unix, this option controls whether a delay is done by @@ -156,9 +144,6 @@ #define TIMED_DELAY /* enable the `timed_delay' run-time option */ -#ifdef PCMUSIC -#define TIMED_DELAY /* need it anyway */ -#endif #define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR, \ LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \ SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR. \ @@ -166,7 +151,9 @@ #endif /* MSDOS configuration stuff */ +#ifndef PATHLEN #define PATHLEN 64 /* maximum pathlength */ +#endif #define FILENAME 80 /* maximum filename length (conservative) */ #ifndef MICRO_H #include "micro.h" /* contains necessary externs for [os_name].c */ @@ -178,7 +165,7 @@ #ifndef SYSTEM_H #if !defined(_MSC_VER) -#include "system.h" +/* #include "system.h" */ #endif #endif @@ -190,7 +177,6 @@ #undef lock #include /* kbhit() */ #define PC_LOCKING -#define HOLD_LOCKFILE_OPEN #define SELF_RECOVER /* NetHack itself can recover games */ #endif @@ -217,9 +203,9 @@ #define VROOMM /* Borland's VROOMM overlay system */ #endif #if !defined(STKSIZ) -#define STKSIZ 5 * 1024 /* Use a default of 5K stack for Borland C */ +#define STKSIZ 5 * 1024 /* Use a default of 5K stack for Borland C */ /* This macro is used in any file that contains */ - /* a main() function. */ + /* a main() function. */ #endif #define PC_LOCKING #endif @@ -228,17 +214,6 @@ #define HLOCK "NHPERM" #endif -#ifndef index -#define index strchr -#endif -#ifndef rindex -#define rindex strrchr -#endif - -#ifndef AMIGA -#include -#endif - /* the high quality random number routines */ #ifndef USE_ISAAC64 # ifdef RANDOM @@ -255,28 +230,11 @@ #include #ifdef MSDOS -#define TEXTCOLOR /* */ #define PORT_HELP "msdoshlp.txt" /* msdos port specific help file */ #endif /* Sanity check, do not modify these blocks. */ -/* OVERLAY must be defined with MOVERLAY or VROOMM */ -#if (defined(MOVERLAY) || defined(VROOMM)) -#ifndef OVERLAY -#define OVERLAY -#endif -#endif - -#if defined(FUNCTION_LEVEL_LINKING) -#define OVERLAY -#endif - -#if defined(OVERLAY) && !defined(MOVERLAY) && !defined(VROOMM) \ - && !defined(FUNCTION_LEVEL_LINKING) -#define USE_TRAMPOLI -#endif - #if defined(MSDOS) && defined(NO_TERMS) #ifdef TERMLIB #if defined(_MSC_VER) || defined(__SC__) @@ -306,16 +264,14 @@ */ #endif #else -/* djgpp C compiler */ +/* djgpp C compiler */ #if defined(SCREEN_BIOS) #undef SCREEN_BIOS #endif #endif #endif #define ASCIIGRAPH -#ifdef TEXTCOLOR #define VIDEOSHADES -#endif /* SCREEN_8514, SCREEN_VESA are only placeholders presently - sub VGA instead */ #if defined(SCREEN_8514) diff --git a/include/permonst.h b/include/permonst.h index b22269e68..895e4f964 100644 --- a/include/permonst.h +++ b/include/permonst.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 permonst.h $NHDT-Date: 1539804913 2018/10/17 19:35:13 $ $NHDT-Branch: keni-makedefsm $:$NHDT-Revision: 1.12 $ */ +/* NetHack 5.0 permonst.h $NHDT-Date: 1725653014 2024/09/06 20:03:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.26 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,16 +6,35 @@ #ifndef PERMONST_H #define PERMONST_H -/* This structure covers all attack forms. - * aatyp is the gross attack type (eg. claw, bite, breath, ...) - * adtyp is the damage type (eg. physical, fire, cold, spell, ...) - * damn is the number of hit dice of damage from the attack. - * damd is the number of sides on each die. +enum monnums { +#define MONS_ENUM +#include "monsters.h" +#undef MONS_ENUM + NUMMONS, + NON_PM = -1, /* "not a monster" */ + LOW_PM = NON_PM + 1, /* first monster in mons */ + LEAVESTATUE = NON_PM - 1, /* leave statue instead of corpse; + * there are two lower values assigned + * in end.c so that (x == LEAVESTATUE) + * will test FALSE in bones.c: + * (NON_PM - 2) for no corpse + * (NON_PM - 3) for no corpse, no grave */ + HIGH_PM = NUMMONS - 1, + SPECIAL_PM = PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */ + /* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are + never generated randomly and cannot be polymorphed into */ +}; + +/* This structure covers all attack forms. + * aatyp is the gross attack type (eg. claw, bite, breath, ...) + * adtyp is the damage type (eg. physical, fire, cold, spell, ...) + * damn is the number of hit dice of damage from the attack. + * damd is the number of sides on each die. * - * Some attacks can do no points of damage. Additionally, some can - * have special effects *and* do damage as well. If damn and damd - * are set, they may have a special meaning. For example, if set - * for a blinding attack, they determine the amount of time blinded. + * Some attacks can do no points of damage. Additionally, some can + * have special effects *and* do damage as well. If damn and damd + * are set, they may have a special meaning. For example, if set + * for a blinding attack, they determine the amount of time blinded. */ struct attack { @@ -23,16 +42,11 @@ struct attack { uchar adtyp, damn, damd; }; -/* Max # of attacks for any given monster. +/* Max # of attacks for any given monster. */ #define NATTK 6 -/* Weight of a human body - */ - -#define WT_HUMAN 1450 - #ifndef ALIGN_H #include "align.h" #endif @@ -40,7 +54,8 @@ struct attack { #include "monflag.h" struct permonst { - const char *mname; /* full name */ + const char *pmnames[NUM_MGENDERS]; + const enum monnums pmidx; /* mons array index aka PM_ identifier */ char mlet; /* symbol */ schar mlevel, /* base monster level */ mmove, /* move speed */ @@ -49,8 +64,8 @@ struct permonst { aligntyp maligntyp; /* basic monster alignment */ unsigned short geno; /* creation/geno mask value */ struct attack mattk[NATTK]; /* attacks matrix */ - unsigned short cwt, /* weight of corpse */ - cnutrit; /* its nutritional value */ + unsigned cwt; /* weight of corpse */ + unsigned short cnutrit; /* its nutritional value */ uchar msound; /* noise it makes (6 bits) */ uchar msize; /* physical size (3 bits) */ uchar mresists; /* resistances */ @@ -58,24 +73,13 @@ struct permonst { unsigned long mflags1, /* boolean bitflags */ mflags2; /* more boolean bitflags */ unsigned short mflags3; /* yet more boolean bitflags */ - uchar difficulty; /* toughness (formerly from makedefs -m) */ -#ifdef TEXTCOLOR - uchar mcolor; /* color to use */ -#endif + uchar difficulty; /* toughness (formerly from makedefs -m) */ + uchar mcolor; /* color to use */ }; -extern NEARDATA struct permonst mons[]; /* the master list of monster types */ - -#define VERY_SLOW 3 -#define SLOW_SPEED 9 -#define NORMAL_SPEED 12 /* movement rates */ -#define FAST_SPEED 15 -#define VERY_FAST 24 +#define NORMAL_SPEED 12 -#define NON_PM (-1) /* "not a monster" */ -#define LOW_PM (NON_PM + 1) /* first monster in mons[] */ -#define SPECIAL_PM PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */ -/* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are - never generated randomly and cannot be polymorphed into */ +extern NEARDATA struct permonst mons[NUMMONS + 1]; /* the master list of + * monster types */ #endif /* PERMONST_H */ diff --git a/include/prop.h b/include/prop.h index 570f3f2fa..5b846698e 100644 --- a/include/prop.h +++ b/include/prop.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 prop.h $NHDT-Date: 1570566360 2019/10/08 20:26:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.21 $ */ -/* Copyright (c) 1989 Mike Threepoint */ +/* NetHack 5.0 prop.h $NHDT-Date: 1702274027 2023/12/11 05:53:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.24 $ */ +/* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ #ifndef PROP_H @@ -20,7 +20,10 @@ enum prop_types { POISON_RES = 6, ACID_RES = 7, STONE_RES = 8, - /* note: for the first eight properties, MR_xxx == (1 << (xxx_RES - 1)) */ + /* note: the first eight properties above are equivalent to MR_xxx bits + * MR_FIRE through MR_STONE, and can be directly converted to them: */ +#define res_to_mr(r) \ + ((FIRE_RES <= (r) && (r) <= STONE_RES) ? (uchar) (1 << ((r) - 1)) : 0x00) DRAIN_RES = 9, SICK_RES = 10, INVULNERABLE = 11, @@ -52,41 +55,42 @@ enum prop_types { CLAIRVOYANT = 35, INFRAVISION = 36, DETECT_MONSTERS = 37, + BLND_RES = 38, /* Appearance and behavior */ - ADORNED = 38, - INVIS = 39, - DISPLACED = 40, - STEALTH = 41, - AGGRAVATE_MONSTER = 42, - CONFLICT = 43, + ADORNED = 39, + INVIS = 40, + DISPLACED = 41, + STEALTH = 42, + AGGRAVATE_MONSTER = 43, + CONFLICT = 44, /* Transportation */ - JUMPING = 44, - TELEPORT = 45, - TELEPORT_CONTROL = 46, - LEVITATION = 47, - FLYING = 48, - WWALKING = 49, - SWIMMING = 50, - MAGICAL_BREATHING = 51, - PASSES_WALLS = 52, + JUMPING = 45, + TELEPORT = 46, + TELEPORT_CONTROL = 47, + LEVITATION = 48, + FLYING = 49, + WWALKING = 50, + SWIMMING = 51, + MAGICAL_BREATHING = 52, + PASSES_WALLS = 53, /* Physical attributes */ - SLOW_DIGESTION = 53, - HALF_SPDAM = 54, - HALF_PHDAM = 55, - REGENERATION = 56, - ENERGY_REGENERATION = 57, - PROTECTION = 58, - PROT_FROM_SHAPE_CHANGERS = 59, - POLYMORPH = 60, - POLYMORPH_CONTROL = 61, - UNCHANGING = 62, - FAST = 63, - REFLECTING = 64, - FREE_ACTION = 65, - FIXED_ABIL = 66, - LIFESAVED = 67 + SLOW_DIGESTION = 54, + HALF_SPDAM = 55, + HALF_PHDAM = 56, + REGENERATION = 57, + ENERGY_REGENERATION = 58, + PROTECTION = 59, + PROT_FROM_SHAPE_CHANGERS = 60, + POLYMORPH = 61, + POLYMORPH_CONTROL = 62, + UNCHANGING = 63, + FAST = 64, + REFLECTING = 65, + FREE_ACTION = 66, + FIXED_ABIL = 67, + LIFESAVED = 68, + LAST_PROP = LIFESAVED }; -#define LAST_PROP (LIFESAVED) /*** Where the properties come from ***/ /* Definitions were moved here from obj.h and you.h */ @@ -129,14 +133,14 @@ struct prop { long intrinsic; /* Timed properties */ #define TIMEOUT 0x00ffffffL /* Up to 16 million turns */ - /* Permanent properties */ -#define FROMEXPER 0x01000000L /* Gain/lose with experience, for role */ -#define FROMRACE 0x02000000L /* Gain/lose with experience, for race */ +/* Permanent properties */ +#define FROMEXPER 0x01000000L /* Gain/lose with experience, for role */ +#define FROMRACE 0x02000000L /* Gain/lose with experience, for race */ #define FROMOUTSIDE 0x04000000L /* By corpses, prayer, thrones, etc. */ -#define INTRINSIC (FROMOUTSIDE | FROMRACE | FROMEXPER) +#define INTRINSIC (FROMOUTSIDE | FROMRACE | FROMEXPER) /* Control flags */ -#define FROMFORM 0x10000000L /* Polyd; conferred by monster form */ -#define I_SPECIAL 0x20000000L /* Property is controllable */ +#define FROMFORM 0x10000000L /* Polyd; conferred by monster form */ +#define I_SPECIAL 0x20000000L /* Property is controllable */ }; /*** Definitions for backwards compatibility ***/ diff --git a/include/quest.h b/include/quest.h index 0042de7f0..5ab48a756 100644 --- a/include/quest.h +++ b/include/quest.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 quest.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ -/* Copyright (c) Mike Stephenson 1991. */ +/* NetHack 5.0 quest.h $NHDT-Date: 1596498556 2020/08/03 23:49:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $ */ +/* Copyright (c) Mike Stephenson 1991. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef QUEST_H @@ -11,9 +11,10 @@ struct q_score { /* Quest "scorecard" */ Bitfield(not_ready, 3); /* rejected due to alignment, etc. */ Bitfield(pissed_off, 1); /* got the leader angry */ Bitfield(got_quest, 1); /* got the quest assignment */ + Bitfield(killed_leader, 1); /* killed the quest leader */ Bitfield(first_locate, 1); /* only set the first time */ - Bitfield(met_intermed, 1); /* used if the locate is a person. */ + Bitfield(met_intermed, 1); /* used if the locate is a person */ Bitfield(got_final, 1); /* got the final quest assignment */ Bitfield(made_goal, 3); /* # of times on goal level */ @@ -39,7 +40,6 @@ struct q_score { /* Quest "scorecard" */ unsigned leader_m_id; }; -#define MAX_QUEST_TRIES 7 /* exceed this and you "fail" */ #define MIN_QUEST_ALIGN 20 /* at least this align.record to start */ /* note: align 20 matches "pious" as reported by enlightenment (cmd.c) */ #define MIN_QUEST_LEVEL 14 /* at least this u.ulevel to start */ diff --git a/include/rect.h b/include/rect.h index efbf253d5..b8395c5f4 100644 --- a/include/rect.h +++ b/include/rect.h @@ -1,13 +1,13 @@ -/* NetHack 3.6 rect.h $NHDT-Date: 1432512778 2015/05/25 00:12:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) 1990 by Jean-Christophe Collet */ +/* NetHack 5.0 rect.h $NHDT-Date: 1596498557 2020/08/03 23:49:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */ +/* Copyright (c) 1990 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ #ifndef RECT_H #define RECT_H typedef struct nhrect { - xchar lx, ly; - xchar hx, hy; + coordxy lx, ly; + coordxy hx, hy; } NhRect; #endif /* RECT_H */ diff --git a/include/region.h b/include/region.h index dd1534fc2..ba82dd710 100644 --- a/include/region.h +++ b/include/region.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 region.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */ -/* Copyright (c) 1996 by Jean-Christophe Collet */ +/* NetHack 5.0 region.h $NHDT-Date: 1596498557 2020/08/03 23:49:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */ +/* Copyright (c) 1996 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ #ifndef REGION_H @@ -7,7 +7,7 @@ /* generic callback function */ -typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t)); +typedef boolean (*callback_proc)(genericptr_t, genericptr_t); /* * player_flags @@ -30,37 +30,36 @@ typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t)); */ typedef struct { - NhRect bounding_box; /* Bounding box of the region */ - NhRect *rects; /* Rectangles composing the region */ - short nrects; /* Number of rectangles */ - boolean attach_2_u; /* Region attached to player ? */ - unsigned int attach_2_m; /* Region attached to monster ? */ + NhRect bounding_box; /* Bounding box of the region */ + NhRect *rects; /* Rectangles composing the region */ + short nrects; /* Number of rectangles */ + boolean attach_2_u; /* Region attached to player ? */ + unsigned attach_2_m; /* Region attached to monster ? */ /*struct obj *attach_2_o;*/ /* Region attached to object ? UNUSED YET */ - const char *enter_msg; /* Message when entering */ - const char *leave_msg; /* Message when leaving */ - long ttl; /* Time to live. -1 is forever */ - short expire_f; /* Function to call when region's ttl expire */ - short can_enter_f; /* Function to call to check whether the player - can, or can not, enter the region */ - short enter_f; /* Function to call when the player enters*/ - short can_leave_f; /* Function to call to check whether the player - can, or can not, leave the region */ - short leave_f; /* Function to call when the player leaves */ - short inside_f; /* Function to call every turn if player's - inside */ - unsigned int player_flags; /* (see above) */ - unsigned int *monsters; /* Monsters currently inside this region */ - short n_monst; /* Number of monsters inside this region */ - short max_monst; /* Maximum number of monsters that can be - listed without having to grow the array */ + const char *enter_msg; /* Message when entering */ + const char *leave_msg; /* Message when leaving */ + long ttl; /* Time to live. -1 is forever */ + short expire_f; /* Function to call when region's ttl expire */ + short can_enter_f; /* Function to call to check whether the player + * can, or can not, enter the region */ + short enter_f; /* Function to call when the player enters*/ + short can_leave_f; /* Function to call to check whether the player + * can, or can not, leave the region */ + short leave_f; /* Function to call when the player leaves */ + short inside_f; /* Function to call every turn if player's inside */ + unsigned player_flags; /* (see above) */ + unsigned *monsters; /* Monsters currently inside this region */ + short n_monst; /* Number of monsters inside this region */ + short max_monst; /* Maximum number of monsters that can be + * listed without having to grow the array */ #define MONST_INC 5 /* Should probably do the same thing about objects */ - boolean visible; /* Is the region visible ? */ - int glyph; /* Which glyph to use if visible */ - anything arg; /* Optional user argument (Ex: strength of - force field, damage of a fire zone, ...*/ + boolean visible; /* Is the region visible? */ + int glyph; /* Which glyph to use if visible */ + anything arg; /* Optional user argument (Ex: strength of + * force field, damage of a fire zone, ...*/ } NhRegion; #endif /* REGION_H */ diff --git a/include/rm.h b/include/rm.h index 37b3fff7d..e97822b4c 100644 --- a/include/rm.h +++ b/include/rm.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 rm.h $NHDT-Date: 1573943499 2019/11/16 22:31:39 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */ +/* NetHack 5.0 rm.h $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.120 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,11 +9,11 @@ /* * The dungeon presentation graphics code and data structures were rewritten * and generalized for NetHack's release 2 by Eric S. Raymond (eric@snark) - * building on Don G. Kneller's MS-DOS implementation. See drawing.c for + * building on Don G Kneller's MS-DOS implementation. See drawing.c for * the code that permits the user to set the contents of the symbol structure. * - * The door representation was changed by Ari - * Huttunen(ahuttune@niksula.hut.fi) + * The door representation was changed by + * Ari Huttunen(ahuttune@niksula.hut.fi). */ /* @@ -31,10 +31,27 @@ * +- -+- -+ | */ -/* Level location types. [Some debugging code in src/display.c - defines array type_names[] which contains an entry for each of - these, so needs to be kept in sync if any new types are added - or existing ones renumbered.] */ +/* + * Level location types, values for 'level.locations[x][y].typ'. + * + * These are different from display symbols and while there is + * similarity between the cmap subset of those, there isn't any + * one-to-one correspondence between the two encodings. For instance, + * the DOOR type has multiple symbols (closed|open|gone); so does the + * STAIRS type (down|up). Conversely, DRAWBRIDGE_UP represents the + * location of the projected span if the drawbridge were down but + * there is no symbol for that; it is displayed as water, ice, lava, or + * floor depending on what is at that spot when the bridge is 'closed'. + * + * [Some debugging code in src/display.c defines array type_names[] + * which contains an entry for each of these, so needs to be kept in + * sync if any new types are added or existing ones renumbered. The + * #terrain command also has a menu choice to display each map spot by + * a letter derived from these numeric values and another choice to + * display a legend showing the letter-to-type correspondence. If any + * types are added, removed, or reordered, that needs to be updated to + * keep in synch.] + */ enum levl_typ_types { STONE = 0, VWALL = 1, @@ -57,23 +74,38 @@ enum levl_typ_types { WATER = 18, DRAWBRIDGE_UP = 19, LAVAPOOL = 20, - IRONBARS = 21, /* KMH */ - DOOR = 22, - CORR = 23, - ROOM = 24, - STAIRS = 25, - LADDER = 26, - FOUNTAIN = 27, - THRONE = 28, - SINK = 29, - GRAVE = 30, - ALTAR = 31, - ICE = 32, - DRAWBRIDGE_DOWN = 33, - AIR = 34, - CLOUD = 35, - - MAX_TYPE = 36, + LAVAWALL = 21, + IRONBARS = 22, /* KMH */ + DOOR = 23, + CORR = 24, + ROOM = 25, + STAIRS = 26, + LADDER = 27, + FOUNTAIN = 28, + THRONE = 29, + SINK = 30, + GRAVE = 31, + ALTAR = 32, + ICE = 33, + DRAWBRIDGE_DOWN = 34, + AIR = 35, + CLOUD = 36, + + MAX_TYPE = 37, + /* for special levels */ + MATCH_WALL = 38, + + /* these aren't levl[][].typ values, they're additional indices + into terrain_descr[] for status feedback */ + xFLOOR = 39, + xGROUND = 40, + xOPENDOOR = 41, + xSHUTDOOR = 42, + xSWAMP = 43, + xSUBMERGED = 44, + xSEA = 45, + xWATERWALL = 46, + INVALID_TYPE = 127 }; @@ -84,16 +116,18 @@ enum levl_typ_types { */ #define IS_WALL(typ) ((typ) && (typ) <= DBWALL) #define IS_STWALL(typ) ((typ) <= DBWALL) /* STONE <= (typ) <= DBWALL */ -#define IS_ROCK(typ) ((typ) < POOL) /* absolutely nonaccessible */ +#define IS_OBSTRUCTED(typ) ((typ) < POOL) /* absolutely nonaccessible */ +#define IS_SDOOR(typ) ((typ) == SDOOR) #define IS_DOOR(typ) ((typ) == DOOR) -#define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS) +#define IS_DOORJOIN(typ) (IS_OBSTRUCTED(typ) || (typ) == IRONBARS) #define IS_TREE(typ) \ - ((typ) == TREE || (level.flags.arboreal && (typ) == STONE)) + ((typ) == TREE || (svl.level.flags.arboreal && (typ) == STONE)) #define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */ #define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM, STAIRS, furniture.. */ #define ZAP_POS(typ) ((typ) >= POOL) #define SPACE_POS(typ) ((typ) > DOOR) #define IS_POOL(typ) ((typ) >= POOL && (typ) <= DRAWBRIDGE_UP) +#define IS_LAVA(typ) ((typ) == LAVAPOOL || (typ) == LAVAWALL) #define IS_THRONE(typ) ((typ) == THRONE) #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN) #define IS_SINK(typ) ((typ) == SINK) @@ -104,234 +138,106 @@ enum levl_typ_types { #define IS_FURNITURE(typ) ((typ) >= STAIRS && (typ) <= ALTAR) #define IS_AIR(typ) ((typ) == AIR || (typ) == CLOUD) #define IS_SOFT(typ) ((typ) == AIR || (typ) == CLOUD || IS_POOL(typ)) +#define IS_WATERWALL(typ) ((typ) == WATER) +/* for surface checks when it's unknown whether a drawbridge is involved; + drawbridge_up is the spot in front of a closed drawbridge and not the + current surface at that spot; caveat: this evaluates its arguments more + than once and might make a function call */ +#define SURFACE_AT(x,y) \ + ((levl[x][y].typ == DRAWBRIDGE_UP) \ + ? db_under_typ(levl[x][y].drawbridgemask) \ + : levl[x][y].typ) /* - * The screen symbols may be the default or defined at game startup time. - * See drawing.c for defaults. - * Note: {ibm|dec|curses}_graphics[] arrays (also in drawing.c) must be kept in - * synch. + * The structure describing a coordinate position. + * Before adding fields, remember that this will significantly affect + * the size of temporary files and save files. + * + * Also remember that the run-length encoding for some ports in save.c + * must be updated to consider the field. */ +struct rm { + int glyph; /* what the hero thinks is there */ + schar typ; /* what is really there [why is this signed?] */ + uchar seenv; /* seen vector */ + Bitfield(flags, 5); /* extra information for typ */ + Bitfield(horizontal, 1); /* wall/door/etc is horiz. (more typ info) */ + Bitfield(lit, 1); /* speed hack for lit rooms */ + Bitfield(waslit, 1); /* remember if a location was lit */ -/* begin dungeon characters */ -enum screen_symbols { - S_stone = 0, - S_vwall = 1, - S_hwall = 2, - S_tlcorn = 3, - S_trcorn = 4, - S_blcorn = 5, - S_brcorn = 6, - S_crwall = 7, - S_tuwall = 8, - S_tdwall = 9, - S_tlwall = 10, - S_trwall = 11, - S_ndoor = 12, - S_vodoor = 13, - S_hodoor = 14, - S_vcdoor = 15, /* closed door, vertical wall */ - S_hcdoor = 16, /* closed door, horizontal wall */ - S_bars = 17, /* KMH -- iron bars */ - S_tree = 18, /* KMH */ - S_room = 19, - S_darkroom = 20, - S_corr = 21, - S_litcorr = 22, - S_upstair = 23, - S_dnstair = 24, - S_upladder = 25, - S_dnladder = 26, - S_altar = 27, - S_grave = 28, - S_throne = 29, - S_sink = 30, - S_fountain = 31, - S_pool = 32, - S_ice = 33, - S_lava = 34, - S_vodbridge = 35, - S_hodbridge = 36, - S_vcdbridge = 37, /* closed drawbridge, vertical wall */ - S_hcdbridge = 38, /* closed drawbridge, horizontal wall */ - S_air = 39, - S_cloud = 40, - S_water = 41, - -/* end dungeon characters, begin traps */ - - S_arrow_trap = 42, - S_dart_trap = 43, - S_falling_rock_trap = 44, - S_squeaky_board = 45, - S_bear_trap = 46, - S_land_mine = 47, - S_rolling_boulder_trap = 48, - S_sleeping_gas_trap = 49, - S_rust_trap = 50, - S_fire_trap = 51, - S_pit = 52, - S_spiked_pit = 53, - S_hole = 54, - S_trap_door = 55, - S_teleportation_trap = 56, - S_level_teleporter = 57, - S_magic_portal = 58, - S_web = 59, - S_statue_trap = 60, - S_magic_trap = 61, - S_anti_magic_trap = 62, - S_polymorph_trap = 63, - S_vibrating_square = 64, /* for display rather than any trap effect */ - -/* end traps, begin special effects */ - - S_vbeam = 65, /* The 4 zap beam symbols. Do NOT separate. */ - S_hbeam = 66, /* To change order or add, see function */ - S_lslant = 67, /* zapdir_to_glyph() in display.c. */ - S_rslant = 68, - S_digbeam = 69, /* dig beam symbol */ - S_flashbeam = 70, /* camera flash symbol */ - S_boomleft = 71, /* thrown boomerang, open left, e.g ')' */ - S_boomright = 72, /* thrown boomerang, open right, e.g. '(' */ - S_ss1 = 73, /* 4 magic shield ("resistance sparkle") glyphs */ - S_ss2 = 74, - S_ss3 = 75, - S_ss4 = 76, - S_poisoncloud = 77, - S_goodpos = 78, /* valid position for targeting via getpos() */ - -/* The 8 swallow symbols. Do NOT separate. To change order or add, */ -/* see the function swallow_to_glyph() in display.c. */ - S_sw_tl = 79, /* swallow top left [1] */ - S_sw_tc = 80, /* swallow top center [2] Order: */ - S_sw_tr = 81, /* swallow top right [3] */ - S_sw_ml = 82, /* swallow middle left [4] 1 2 3 */ - S_sw_mr = 83, /* swallow middle right [6] 4 5 6 */ - S_sw_bl = 84, /* swallow bottom left [7] 7 8 9 */ - S_sw_bc = 85, /* swallow bottom center [8] */ - S_sw_br = 86, /* swallow bottom right [9] */ - - S_explode1 = 87, /* explosion top left */ - S_explode2 = 88, /* explosion top center */ - S_explode3 = 89, /* explosion top right Ex. */ - S_explode4 = 90, /* explosion middle left */ - S_explode5 = 91, /* explosion middle center /-\ */ - S_explode6 = 92, /* explosion middle right |@| */ - S_explode7 = 93, /* explosion bottom left \-/ */ - S_explode8 = 94, /* explosion bottom center */ - S_explode9 = 95, /* explosion bottom right */ - -/* end effects */ - - MAXPCHARS = 96 /* maximum number of mapped characters */ -}; - -#define MAXDCHARS (S_water - S_stone + 1) /* mapped dungeon characters */ -#define MAXTCHARS (S_vibrating_square - S_arrow_trap + 1) /* trap chars */ -#define MAXECHARS (S_explode9 - S_vbeam + 1) /* mapped effects characters */ -#define MAXEXPCHARS 9 /* number of explosion characters */ - -#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom) - -#define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) <= S_polymorph_trap) -#define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge) -#define is_cmap_door(i) ((i) >= S_vodoor && (i) <= S_hcdoor) -#define is_cmap_wall(i) ((i) >= S_stone && (i) <= S_trwall) -#define is_cmap_room(i) ((i) >= S_room && (i) <= S_darkroom) -#define is_cmap_corr(i) ((i) >= S_corr && (i) <= S_litcorr) -#define is_cmap_furniture(i) ((i) >= S_upstair && (i) <= S_fountain) -#define is_cmap_water(i) ((i) == S_pool || (i) == S_water) -#define is_cmap_lava(i) ((i) == S_lava) - - -struct symdef { - uchar sym; - const char *explanation; -#ifdef TEXTCOLOR - uchar color; -#endif -}; - -struct symparse { - unsigned range; -#define SYM_CONTROL 1 /* start/finish markers */ -#define SYM_PCHAR 2 /* index into showsyms */ -#define SYM_OC 3 /* index into oc_syms */ -#define SYM_MON 4 /* index into monsyms */ -#define SYM_OTH 5 /* misc */ - int idx; - const char *name; -}; - -/* misc symbol definitions */ -#define SYM_BOULDER 0 -#define SYM_INVISIBLE 1 -#define SYM_PET_OVERRIDE 2 -#define SYM_HERO_OVERRIDE 3 -#define MAXOTHER 4 - -/* linked list of symsets and their characteristics */ -struct symsetentry { - struct symsetentry *next; /* next in list */ - char *name; /* ptr to symset name */ - char *desc; /* ptr to description */ - int idx; /* an index value */ - int handling; /* known handlers value */ - Bitfield(nocolor, 1); /* don't use color if set */ - Bitfield(primary, 1); /* restricted for use as primary set */ - Bitfield(rogue, 1); /* restricted for use as rogue lev set */ - Bitfield(explicitly, 1); /* explicit symset set */ - /* 4 free bits */ + Bitfield(roomno, 6); /* room # for special rooms */ + Bitfield(edge, 1); /* marks boundaries for special rooms*/ + Bitfield(candig, 1); /* Exception to Can_dig_down; was a trapdoor */ }; /* - * Graphics sets for display symbols + * rm flags field overloads: + * + * +-------------+-------------+------------+------------+------------+ + * | bit5 | bit4 | bit3 | bit2 | bit1 | + * | 0x10 | 0x8 | 0x4 | 0x2 | 0x1 | + * +-------------+-------------+------------+------------+------------+ + * wall |W_NONPASSWALL|W_NONDIGGABLE| W_MASK | W_MASK | W_MASK | + * door |D_TRAPPED | D_LOCKED | D_CLOSED | D_ISOPEN | D_BROKEN | + * |D_WARNED | | | | | + * sdoor |D_TRAPPED | D_LOCKED | W_MASK | W_MASK | W_MASK | + * drawbr. |DB_FLOOR | DB_ICE | DB_LAVA | DB_DIR | DB_DIR | + * sink | | | S_LRING | S_LDWASHER | S_LPUDDING | + * tree | | | | TREE_SWARM | TREE_LOOTED| + * throne | | | | | T_LOOTED | + * fountain| | | | F_WARNED | F_LOOTED | + * ladder | | | | LA_DOWN | LA_UP | + * pool |ICED_MOAT | ICED_POOL | | | | + * grave | | | | | emptygrave | + * altar |AM_SANCTUM | AM_SHRINE | AM_MASK | AM_MASK | AM_MASK | + * | | | | | | + * +-------------+-------------+------------+------------+------------+ + * + * + * If these get changed or expanded, make sure wizard-mode wishing becomes + * aware of the new usage + * + * Note: secret doors (SDOOR) want to use both rm.doormask and + * rm.wall_info but those both overload rm.flags. SDOOR only + * has 2 states (closed or locked). However, it can't specify + * D_CLOSED due to that conflicting with WM_MASK (below). When + * a secret door is revealed, the door gets set to D_CLOSED iff + * it isn't set to D_LOCKED (see cvt_sdoor_to_door() in detect.c). + * + * D_LOCKED conflicts with W_NONDIGGABLE but the latter is not + * expected to be used on door locations. + * D_TRAPPED conflicts with W_NONPASSWALL. + * D_SECRET would not fit within struct rm's 5-bit 'flags' field. */ -#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */ -#define PRIMARY 0 /* primary graphics set */ -#define ROGUESET 1 /* rogue graphics set */ -#define NUM_GRAPHICS 2 -/* - * special symbol set handling types ( for invoking callbacks, etc.) - * Must match the order of the known_handlers strings - * in drawing.c - */ -#define H_UNK 0 -#define H_IBM 1 -#define H_DEC 2 -#define H_CURS 3 -#define H_MAC 4 /* obsolete; needed so that the listing of available - * symsets by 'O' can skip it for !MAC_GRAPHICS_ENV */ - -extern const struct symdef defsyms[MAXPCHARS]; /* defaults */ -extern const struct symdef def_warnsyms[WARNCOUNT]; -extern int currentgraphics; /* from drawing.c */ -extern nhsym showsyms[]; -extern nhsym primary_syms[]; -extern nhsym rogue_syms[]; -extern nhsym ov_primary_syms[]; -extern nhsym ov_rogue_syms[]; - -extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ -#define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht)) +#define doormask flags /* door, sdoor (note conflict with wall_info) */ +#define altarmask flags /* alignment and maybe temple */ +#define wall_info flags /* wall, sdoor (note conflict with doormask) */ +#define ladder flags /* up or down */ +#define drawbridgemask flags /* what's underneath when the span is open */ +#define looted flags /* used for throne, tree, fountain, sink, door */ +#define icedpool flags /* used for ice (in case it melts) */ +#define emptygrave flags /* no corpse in grave */ -/* - * The 5 possible states of doors - */ - -#define D_NODOOR 0 -#define D_BROKEN 1 -#define D_ISOPEN 2 -#define D_CLOSED 4 -#define D_LOCKED 8 -#define D_TRAPPED 16 -#define D_SECRET 32 /* only used by sp_lev.c, NOT in rm-struct */ +/* candig is used for floor trap locations so is available for overload + on walls, doors, secret doors, and furniture */ +#define arboreal_sdoor candig /* - * Some altars are considered as shrines, so we need a flag. + * The 5 possible states of doors. + * For historical reasons they are numbered as mask bits rather than 0..4. + * The trapped flag is OR'd onto the state and only valid if that state + * is closed or locked. + * The no-door state allows egress when moving diagonally, others do not. */ -#define AM_SHRINE 8 +#define D_NODOOR 0x00 +#define D_BROKEN 0x01 +#define D_ISOPEN 0x02 +#define D_CLOSED 0x04 +#define D_LOCKED 0x08 + +#define D_TRAPPED 0x10 +#define D_SECRET 0x20 /* only used by sp_lev.c, NOT in rm-struct */ /* * Thrones should only be looted once. @@ -357,7 +263,7 @@ extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ #define CLEAR_FOUNTAIN_LOOTED(x, y) levl[x][y].looted &= ~F_LOOTED; /* - * Doors are even worse :-) The special warning has a side effect + * doors are even worse :-) The special warning has a side effect * of instantly trapping the door, and if it was defined as trapped, * the guards consider that you have already been warned! */ @@ -407,47 +313,16 @@ extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ #define ICED_POOL 8 #define ICED_MOAT 16 -/* - * The structure describing a coordinate position. - * Before adding fields, remember that this will significantly affect - * the size of temporary files and save files. - * - * Also remember that the run-length encoding for some ports in save.c - * must be updated to consider the field. - */ -struct rm { - int glyph; /* what the hero thinks is there */ - schar typ; /* what is really there */ - uchar seenv; /* seen vector */ - Bitfield(flags, 5); /* extra information for typ */ - Bitfield(horizontal, 1); /* wall/door/etc is horiz. (more typ info) */ - Bitfield(lit, 1); /* speed hack for lit rooms */ - Bitfield(waslit, 1); /* remember if a location was lit */ +/* light states for terrain replacements, for set_levltyp_lit */ +#define SET_LIT_RANDOM -1 +#define SET_LIT_NOCHANGE -2 - Bitfield(roomno, 6); /* room # for special rooms */ - Bitfield(edge, 1); /* marks boundaries for special rooms*/ - Bitfield(candig, 1); /* Exception to Can_dig_down; was a trapdoor */ -}; - -#define SET_TYPLIT(x, y, ttyp, llit) \ - { \ - if ((x) >= 0 && (y) >= 0 && (x) < COLNO && (y) < ROWNO) { \ - if ((ttyp) < MAX_TYPE) \ - levl[(x)][(y)].typ = (ttyp); \ - if ((ttyp) == LAVAPOOL) \ - levl[(x)][(y)].lit = 1; \ - else if ((schar)(llit) != -2) { \ - if ((schar)(llit) == -1) \ - levl[(x)][(y)].lit = rn2(2); \ - else \ - levl[(x)][(y)].lit = (llit); \ - } \ - } \ - } +#define CAN_OVERWRITE_TERRAIN(ttyp) \ + (iflags.debug_overwrite_stairs || !((ttyp) == LADDER || (ttyp) == STAIRS)) /* * Add wall angle viewing by defining "modes" for each wall type. Each - * mode describes which parts of a wall are finished (seen as as wall) + * mode describes which parts of a wall are finished (seen as wall) * and which are unfinished (seen as rock). * * We use the bottom 3 bits of the flags field for the mode. This comes @@ -514,46 +389,42 @@ struct rm { * directions. If we know the type of wall and the directions from which * it has been seen, then we can determine what it looks like to the hero. */ -#define SV0 0x01 -#define SV1 0x02 -#define SV2 0x04 -#define SV3 0x08 -#define SV4 0x10 -#define SV5 0x20 -#define SV6 0x40 -#define SV7 0x80 -#define SVALL 0xFF - -#define doormask flags -#define altarmask flags -#define wall_info flags -#define ladder flags -#define drawbridgemask flags -#define looted flags -#define icedpool flags - +#define SV0 ((seenV) 0x01) +#define SV1 ((seenV) 0x02) +#define SV2 ((seenV) 0x04) +#define SV3 ((seenV) 0x08) +#define SV4 ((seenV) 0x10) +#define SV5 ((seenV) 0x20) +#define SV6 ((seenV) 0x40) +#define SV7 ((seenV) 0x80) +#define SVALL ((seenV) 0xFF) + +/* horizontal applies to walls, doors (including sdoor); also to iron bars + even though they don't have separate symbols for horizontal and vertical */ #define blessedftn horizontal /* a fountain that grants attribs */ -#define disturbed horizontal /* a grave that has been disturbed */ +#define disturbed horizontal /* kicking or engraving on a grave's headstone + * has summoned a ghoul */ struct damage { struct damage *next; long when, cost; coord place; - schar typ; + schar typ; /* from struct rm */ + uchar flags; /* also from struct rm; an unsigned 5-bit field there */ }; /* for bones levels: identify the dead character, who might have died on an existing bones level; if so, most recent victim will be first in list */ struct cemetery { struct cemetery *next; /* next struct is previous dead character... */ - /* "plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */ + /* "svp.plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */ char who[PL_NSIZ + 4 * (1 + 3) + 1]; /* death reason, same as in score/log file */ char how[100 + 1]; /* [DTHSZ+1] */ /* date+time in string of digits rather than binary */ char when[4 + 2 + 2 + 2 + 2 + 2 + 1]; /* "YYYYMMDDhhmmss\0" */ /* final resting place spot */ - schar frpx, frpy; + coordxy frpx, frpy; boolean bonesknown; }; @@ -582,24 +453,27 @@ struct levelflags { Bitfield(is_maze_lev, 1); Bitfield(is_cavernous_lev, 1); Bitfield(arboreal, 1); /* Trees replace rock */ + Bitfield(has_town, 1); /* level contains a town */ Bitfield(wizard_bones, 1); /* set if level came from a bones file - which was created in wizard mode (or - normal mode descendant of such) */ + * which was created in wizard mode (or + * normal mode descendant of such) */ Bitfield(corrmaze, 1); /* Whether corridors are used for the maze - rather than ROOM */ + * rather than ROOM */ + Bitfield(rndmongen, 1); /* random monster generation allowed? */ + Bitfield(deathdrops, 1); /* monsters may drop corpses/death drops */ + + Bitfield(noautosearch, 1); /* automatic searching disabled */ + Bitfield(fumaroles, 1); /* lava emits poison gas at random */ + Bitfield(stormy, 1); /* clouds create lightning bolts at random */ + + schar temperature; /* +1 == hot, -1 == cold */ + long stasis_until; /* wand of stasis effect lasts until when? */ }; typedef struct { struct rm locations[COLNO][ROWNO]; -#ifndef MICROPORT_BUG struct obj *objects[COLNO][ROWNO]; struct monst *monsters[COLNO][ROWNO]; -#else - struct obj *objects[1][ROWNO]; - char *yuk1[COLNO - 1][ROWNO]; - struct monst *monsters[1][ROWNO]; - char *yuk2[COLNO - 1][ROWNO]; -#endif struct obj *objlist; struct obj *buriedobjlist; struct monst *monlist; @@ -608,61 +482,68 @@ typedef struct { struct levelflags flags; } dlevel_t; -extern schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */ - -extern dlevel_t level; /* structure describing the current level */ - /* * Macros for compatibility with old code. Someday these will go away. */ -#define levl level.locations -#define fobj level.objlist -#define fmon level.monlist +#define levl svl.level.locations +#define fobj svl.level.objlist +#define fmon svl.level.monlist /* - * Covert a trap number into the defsym graphics array. + * Convert a trap number into the defsym graphics array. * Convert a defsym number into a trap number. * Assumes that arrow trap will always be the first trap. */ -#define trap_to_defsym(t) (S_arrow_trap + (t) -1) -#define defsym_to_trap(d) ((d) -S_arrow_trap + 1) +#define trap_to_defsym(t) (S_arrow_trap + (t) - 1) +#define defsym_to_trap(d) ((d) - S_arrow_trap + 1) -#define OBJ_AT(x, y) (level.objects[x][y] != (struct obj *) 0) +#define OBJ_AT(x, y) (svl.level.objects[x][y] != (struct obj *) 0) /* * Macros for encapsulation of level.monsters references. */ #if 0 -#define MON_AT(x, y) \ - (level.monsters[x][y] != (struct monst *) 0 \ - && !(level.monsters[x][y])->mburied) -#define MON_BURIED_AT(x, y) \ - (level.monsters[x][y] != (struct monst *) 0 \ - && (level.monsters[x][y])->mburied) +/* these wouldn't allow buried monster and surface monster at same location */ +#define MON_AT(x, y) \ + (svl.level.monsters[x][y] && !svl.level.monsters[x][y]->mburied) +#define MON_BURIED_AT(x, y) \ + (svl.level.monsters[x][y] && svl.level.monsters[x][y]->mburied) +#define m_at(x, y) \ + (MON_AT(x, y) ? svl.level.monsters[x][y] : (struct monst *) 0) +#define m_buried_at(x, y) \ + (MON_BURIED_AT(x, y) ? svl.level.monsters[x][y] : (struct monst *) 0) #else /* without 'mburied' */ -#define MON_AT(x, y) (level.monsters[x][y] != (struct monst *) 0) +#define MON_AT(x, y) (svl.level.monsters[x][y] != (struct monst *) 0) +#define m_at(x, y) (svl.level.monsters[x][y]) +#define m_buried_at(x, y) ((struct monst *) 0) #endif #ifdef EXTRA_SANITY_CHECKS #define place_worm_seg(m, x, y) \ - do { \ - if (level.monsters[x][y] && level.monsters[x][y] != m) \ - impossible("place_worm_seg over mon"); \ - level.monsters[x][y] = m; \ + do { \ + if (svl.level.monsters[x][y] && svl.level.monsters[x][y] != m) \ + impossible("place_worm_seg over mon"); \ + svl.level.monsters[x][y] = m; \ } while(0) #define remove_monster(x, y) \ - do { \ - if (!level.monsters[x][y]) \ - impossible("no monster to remove"); \ - level.monsters[x][y] = (struct monst *) 0; \ + do { \ + if (!svl.level.monsters[x][y]) \ + impossible("no monster to remove"); \ + svl.level.monsters[x][y] = (struct monst *) 0; \ } while(0) #else -#define place_worm_seg(m, x, y) level.monsters[x][y] = m -#define remove_monster(x, y) level.monsters[x][y] = (struct monst *) 0 +#define place_worm_seg(m, x, y) svl.level.monsters[x][y] = m +#define remove_monster(x, y) svl.level.monsters[x][y] = (struct monst *) 0 #endif -#define m_at(x, y) (MON_AT(x, y) ? level.monsters[x][y] : (struct monst *) 0) -#define m_buried_at(x, y) \ - (MON_BURIED_AT(x, y) ? level.monsters[x][y] : (struct monst *) 0) /* restricted movement, potential luck penalties */ -#define Sokoban level.flags.sokoban_rules +#define Sokoban svl.level.flags.sokoban_rules + +/* + * These prototypes are in extern.h but some of the code which uses them + * includes config.h instead of hack.h so doesn't see extern.h. + */ +/* ### drawing.c ### */ +extern int def_char_to_objclass(char); +extern int def_char_to_monclass(char); +extern int def_char_is_furniture(char); #endif /* RM_H */ diff --git a/include/savefile.h b/include/savefile.h new file mode 100644 index 000000000..bfaea951d --- /dev/null +++ b/include/savefile.h @@ -0,0 +1,594 @@ +/* NetHack 5.0 savefile.h $NHDT-Date: 1738638877 2025/02/03 19:14:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1476 $ */ +/* Copyright (c) Michael Allison, 2025. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef SAVEFILE_H +#define SAVEFILE_H + +/* #define SAVEFILE_DEBUGGING */ + +extern void sf_init(void); +/* sfbase.c output functions */ +extern void sfo_aligntyp(NHFILE *, aligntyp *, const char *); +extern void sfo_any(NHFILE *, anything *, const char *); +extern void sfo_boolean(NHFILE *, boolean *, const char *); +extern void sfo_char(NHFILE *, char *, const char *, int); +extern void sfo_genericptr(NHFILE *, genericptr_t *, const char *); +extern void sfo_int16(NHFILE *, int16 *, const char *); +extern void sfo_int32(NHFILE *, int32 *, const char *); +extern void sfo_int64(NHFILE *, int64 *, const char *); +extern void sfo_uchar(NHFILE *, uchar *, const char *); +extern void sfo_uint16(NHFILE *, uint16 *, const char *); +extern void sfo_uint32(NHFILE *, uint32 *, const char *); +extern void sfo_uint64(NHFILE *, uint64 *, const char *); +extern void sfo_size_t(NHFILE *, size_t *, const char *); +extern void sfo_time_t(NHFILE *, time_t *, const char *); +//extern void sfo_str(NHFILE *, char *, const char *, int); +extern void sfo_arti_info(NHFILE *nhfp, + struct arti_info *d_arti_info, + const char *myname); +extern void sfo_dgn_topology(NHFILE *nhfp, + struct dgn_topology *d_dgn_topology, + const char *myname); +extern void sfo_dungeon(NHFILE *nhfp, struct dungeon *d_dungeon, + const char *myname); +extern void sfo_branch(NHFILE *nhfp, struct branch *d_branch, + const char *myname); +extern void sfo_linfo(NHFILE *nhfp, struct linfo *d_linfo, + const char *myname); +extern void sfo_nhcoord(NHFILE *nhfp, struct nhcoord *d_nhcoord, + const char *myname); +extern void sfo_d_level(NHFILE *nhfp, struct d_level *d_d_level, + const char *myname); +extern void sfo_mapseen_feat(NHFILE *nhfp, + struct mapseen_feat *d_mapseen_feat, + const char *myname); +extern void sfo_mapseen_flags(NHFILE *nhfp, + struct mapseen_flags *d_mapseen_flags, + const char *myname); +extern void sfo_mapseen_rooms(NHFILE *nhfp, + struct mapseen_rooms *d_mapseen_rooms, + const char *myname); +extern void sfo_kinfo(NHFILE *nhfp, + struct kinfo *d_kinfo, + const char *myname); +extern void sfo_engr(NHFILE *, struct engr *, const char *); +extern void sfo_ls_t(NHFILE *, struct ls_t *, const char *); +extern void sfo_bubble(NHFILE *, struct bubble *, const char *); +extern void sfo_mkroom(NHFILE *, struct mkroom *, const char *); +extern void sfo_objclass(NHFILE *, struct objclass *, const char *); +extern void sfo_nhrect(NHFILE *, struct nhrect *, const char *); +extern void sfo_fe(NHFILE *, struct fe *, const char *); +extern void sfo_version_info(NHFILE *, struct version_info *, + const char *); +extern void sfo_context_info(NHFILE *, struct context_info *, + const char *); +extern void sfo_flag(NHFILE *, struct flag *, const char *); +extern void sfo_you(NHFILE *, struct you *, const char *); +extern void sfo_mvitals(NHFILE *, struct mvitals *, const char *); +extern void sfo_q_score(NHFILE *, struct q_score *, const char *); +extern void sfo_spell(NHFILE *, struct spell *, const char *); +extern void sfo_dest_area(NHFILE *, struct dest_area *, const char *); +extern void sfo_levelflags(NHFILE *, struct levelflags *, const char *); +extern void sfo_rm(NHFILE *, struct rm *, const char *); +extern void sfo_cemetery(NHFILE *, struct cemetery *, const char *); +extern void sfo_damage(NHFILE *, struct damage *, const char *); +extern void sfo_stairway(NHFILE *, struct stairway *, const char *); +extern void sfo_obj(NHFILE *, struct obj *, const char *); +extern void sfo_monst(NHFILE *, struct monst *, const char *); +extern void sfo_ebones(NHFILE *, struct ebones *, const char *); +extern void sfo_edog(NHFILE *, struct edog *, const char *); +extern void sfo_egd(NHFILE *, struct egd *, const char *); +extern void sfo_emin(NHFILE *, struct emin *, const char *); +extern void sfo_engr(NHFILE *, struct engr *, const char *); +extern void sfo_epri(NHFILE *, struct epri *, const char *); +extern void sfo_eshk(NHFILE *, struct eshk *, const char *); +extern void sfo_trap(NHFILE *, struct trap *, const char *); +extern void sfo_gamelog_line(NHFILE *, struct gamelog_line *, const char *); +extern void sfo_fruit(NHFILE *, struct fruit *, const char *); +extern void sfo_s_level(NHFILE *, struct s_level *, const char *); +extern void sfo_xint8(NHFILE *, xint8 *, const char *); +extern void sfo_xint16(NHFILE *, xint16 *, const char *); +extern void sfo_schar(NHFILE *, schar *, const char *); +extern void sfo_short(NHFILE *, short *, const char *); +extern void sfo_ushort(NHFILE *, ushort *, const char *); +extern void sfo_int(NHFILE *, int *, const char *); +extern void sfo_unsigned(NHFILE *, unsigned *, const char *); +extern void sfo_long(NHFILE *, long *, const char *); +extern void sfo_ulong(NHFILE *, ulong *, const char *); +/* sfbase.c input functions */ +extern void sfi_addinfo(NHFILE *, const char *, const char *); +extern void sfi_aligntyp(NHFILE *, aligntyp *, const char *); +extern void sfi_any(NHFILE *, anything *, const char *); +extern void sfi_boolean(NHFILE *, boolean *, const char *); +extern void sfi_genericptr(NHFILE *, genericptr_t *, const char *); +extern void sfi_char(NHFILE *, char *, const char *, int); +extern void sfi_int16(NHFILE *, int16 *, const char *); +extern void sfi_int32(NHFILE *, int32 *, const char *); +extern void sfi_int64(NHFILE *, int64 *, const char *); +extern void sfi_uchar(NHFILE *, uchar *, const char *); +extern void sfi_uint16(NHFILE *, uint16 *, const char *); +extern void sfi_uint32(NHFILE *, uint32 *, const char *); +extern void sfi_uint64(NHFILE *, uint64 *, const char *); +extern void sfi_size_t(NHFILE *, size_t *, const char *); +extern void sfi_time_t(NHFILE *, time_t *, const char *); +extern void sfi_arti_info(NHFILE *nhfp, + struct arti_info *d_arti_info, + const char *myname); +extern void sfi_dungeon(NHFILE *nhfp, struct dungeon *d_dungeon, + const char *myname); +extern void sfi_dgn_topology(NHFILE *nhfp, + struct dgn_topology *d_dgn_topology, + const char *myname); +extern void sfi_branch(NHFILE *nhfp, struct branch *d_branch, + const char *myname); +extern void sfi_linfo(NHFILE *nhfp, struct linfo *d_linfo, + const char *myname); +extern void sfi_nhcoord(NHFILE *nhfp, struct nhcoord *d_nhcoord, + const char *myname); +extern void sfi_d_level(NHFILE *nhfp, struct d_level *d_d_level, + const char *myname); +extern void sfi_mapseen_feat(NHFILE *nhfp, + struct mapseen_feat *d_mapseen_feat, + const char *myname); +extern void sfi_mapseen_flags(NHFILE *nhfp, + struct mapseen_flags *d_mapseen_flags, + const char *myname); +extern void sfi_mapseen_rooms(NHFILE *nhfp, + struct mapseen_rooms *d_mapseen_rooms, + const char *myname); +extern void sfi_kinfo(NHFILE *nhfp, + struct kinfo *d_kinfo, + const char *myname); +extern void sfi_engr(NHFILE *, struct engr *, const char *); +extern void sfi_ls_t(NHFILE *, struct ls_t *, const char *); +extern void sfi_bubble(NHFILE *, struct bubble *, const char *); +extern void sfi_mkroom(NHFILE *, struct mkroom *, const char *); +extern void sfi_objclass(NHFILE *, struct objclass *, const char *); +extern void sfi_nhrect(NHFILE *, struct nhrect *, const char *); +extern void sfi_fe(NHFILE *, struct fe *, const char *); +extern void sfi_version_info(NHFILE *, struct version_info *, + const char *); +extern void sfi_context_info(NHFILE *, struct context_info *, + const char *); +extern void sfi_flag(NHFILE *, struct flag *, const char *); +extern void sfi_you(NHFILE *, struct you *, const char *); +extern void sfi_mvitals(NHFILE *, struct mvitals *, const char *); +extern void sfi_q_score(NHFILE *, struct q_score *, const char *); +extern void sfi_spell(NHFILE *, struct spell *, const char *); +extern void sfi_dest_area(NHFILE *, struct dest_area *, const char *); +extern void sfi_levelflags(NHFILE *, struct levelflags *, const char *); +extern void sfi_rm(NHFILE *, struct rm *, const char *); +extern void sfi_cemetery(NHFILE *, struct cemetery *, const char *); +extern void sfi_damage(NHFILE *, struct damage *, const char *); +extern void sfi_stairway(NHFILE *, struct stairway *, const char *); +extern void sfi_obj(NHFILE *, struct obj *, const char *); +extern void sfi_monst(NHFILE *, struct monst *, const char *); +extern void sfi_ebones(NHFILE *, struct ebones *, const char *); +extern void sfi_edog(NHFILE *, struct edog *, const char *); +extern void sfi_egd(NHFILE *, struct egd *, const char *); +extern void sfi_emin(NHFILE *, struct emin *, const char *); +extern void sfi_engr(NHFILE *, struct engr *, const char *); +extern void sfi_epri(NHFILE *, struct epri *, const char *); +extern void sfi_eshk(NHFILE *, struct eshk *, const char *); +extern void sfi_trap(NHFILE *, struct trap *, const char *); +extern void sfi_fruit(NHFILE *, struct fruit *, const char *); +extern void sfi_gamelog_line(NHFILE *, struct gamelog_line *, const char *); +extern void sfi_s_level(NHFILE *, struct s_level *, const char *); +extern void sfi_xint8(NHFILE *, xint8 *, const char *); +extern void sfi_xint16(NHFILE *, xint16 *, const char *); +extern void sfi_schar(NHFILE *, schar *, const char *); +extern void sfi_short(NHFILE *, short *, const char *); +extern void sfi_ushort(NHFILE *, ushort *, const char *); +extern void sfi_int(NHFILE *, int *, const char *); +extern void sfi_unsigned(NHFILE *, unsigned *, const char *); +extern void sfi_long(NHFILE *, long *, const char *); +extern void sfi_ulong(NHFILE *, ulong *, const char *); +#if NH_C < 202300L +#define Sfo_aligntyp(a,b,c) sfo_aligntyp(a, b, c) +#define Sfo_any(a,b,c) sfo_any(a, b, c) +#define Sfo_genericptr(a,b,c) sfo_genericptr(a, b, c) +#define Sfo_coordxy(a,b,c) sfo_int16(a, b, c) +#define Sfo_char(a,b,c,d) sfo_char(a, b, c, d) +#define Sfo_int16(a,b,c) sfo_int16(a, b, c) +#define Sfo_int32(a,b,c) sfo_int32(a, b, c) +#define Sfo_int64(a,b,c) sfo_int64(a, b, c) +#define Sfo_uchar(a,b,c) sfo_uchar(a, b, c) +#define Sfo_uint16(a,b,c) sfo_uint16(a, b, c) +#define Sfo_uint32(a,b,c) sfo_uint32(a, b, c) +#define Sfo_uint64(a,b,c) sfo_uint64(a, b, c) +#define Sfo_size_t(a,b,c) sfo_size_t(a, b, c) +#define Sfo_time_t(a,b,c) sfo_time_t(a, b, c) +#define Sfo_str(a,b,c) sfo_str(a, b, c) +#define Sfo_arti_info(a,b,c) sfo_arti_info(a, b, c) +#define Sfo_dgn_topology(a,b,c) sfo_dgn_topology(a, b, c) +#define Sfo_dungeon(a,b,c) sfo_dungeon(a, b, c) +#define Sfo_branch(a,b,c) sfo_branch(a, b, c) +#define Sfo_linfo(a,b,c) sfo_linfo(a, b, c) +#define Sfo_nhcoord(a,b,c) sfo_nhcoord(a, b, c) +#define Sfo_d_level(a,b,c) sfo_d_level(a, b, c) +#define Sfo_mapseen_feat(a,b,c) sfo_mapseen_feat(a, b, c) +#define Sfo_mapseen_flags(a,b,c) sfo_mapseen_flags(a, b, c) +#define Sfo_mapseen_rooms(a,b,c) sfo_mapseen_rooms(a, b, c) +#define Sfo_kinfo(a,b,c) sfo_kinfo(a, b, c) +#define Sfo_engr(a,b,c) sfo_engr(a, b, c) +#define Sfo_ls_t(a,b,c) sfo_ls_t(a, b, c) +#define Sfo_bubble(a,b,c) sfo_bubble(a, b, c) +#define Sfo_mkroom(a,b,c) sfo_mkroom(a, b, c) +#define Sfo_objclass(a,b,c) sfo_objclass(a, b, c) +#define Sfo_nhrect(a,b,c) sfo_nhrect(a, b, c) +#define Sfo_fe(a,b,c) sfo_fe(a, b, c) +#define Sfo_version_info(a,b,c) sfo_version_info(a, b, c) +#define Sfo_context_info(a,b,c) sfo_context_info(a, b, c) +#define Sfo_flag(a,b,c) sfo_flag(a, b, c) +#define Sfo_you(a,b,c) sfo_you(a, b, c) +#define Sfo_mvitals(a,b,c) sfo_mvitals(a, b, c) +#define Sfo_q_score(a,b,c) sfo_q_score(a, b, c) +#define Sfo_spell(a,b,c) sfo_spell(a, b, c) +#define Sfo_dest_area(a,b,c) sfo_dest_area(a, b, c) +#define Sfo_levelflags(a,b,c) sfo_levelflags(a, b, c) +#define Sfo_rm(a,b,c) sfo_rm(a, b, c) +#define Sfo_cemetery(a,b,c) sfo_cemetery(a, b, c) +#define Sfo_damage(a,b,c) sfo_damage(a, b, c) +#define Sfo_stairway(a,b,c) sfo_stairway(a, b, c) +#define Sfo_obj(a,b,c) sfo_obj(a, b, c) +#define Sfo_monst(a,b,c) sfo_monst(a, b, c) +#define Sfo_ebones(a,b,c) sfo_ebones(a, b, c) +#define Sfo_edog(a,b,c) sfo_edog(a, b, c) +#define Sfo_egd(a,b,c) sfo_egd(a, b, c) +#define Sfo_emin(a,b,c) sfo_emin(a, b, c) +#define Sfo_engr(a,b,c) sfo_engr(a, b, c) +#define Sfo_epri(a,b,c) sfo_epri(a, b, c) +#define Sfo_eshk(a,b,c) sfo_eshk(a, b, c) +#define Sfo_trap(a,b,c) sfo_trap(a, b, c) +#define Sfo_gamelog_line(a,b,c) sfo_gamelog_line(a, b, c) +#define Sfo_fruit(a,b,c) sfo_fruit(a, b, c) +#define Sfo_s_level(a,b,c) sfo_s_level(a, b, c) +#define Sfo_short(a, b, c) sfo_short(a, b, c) +#define Sfo_ushort(a, b, c) sfo_ushort(a, b, c) +#define Sfo_int(a, b, c) sfo_int(a, b, c) +#define Sfo_unsigned(a, b, c) sfo_unsigned(a, b, c) +#define Sfo_xint8(a, b, c) sfo_xint8(a, b, c); +#define Sfo_xint16(a, b, c) sfo_xint16(a, b, c) +/* sfbase.c input functions */ +#define Sfi_addinfo(a,b,c) sfi_addinfo(a, b, c) +#define Sfi_aligntyp(a,b,c) sfi_aligntyp(a, b, c) +#define Sfi_any(a,b,c) sfi_any(a, b, c) +#define Sfi_genericptr(a,b,c) sfi_genericptr(a, b, c) +#define Sfi_coordxy(a,b,c) sfi_int16(a, b, c) +#define Sfi_int16(a,b,c) sfi_int16(a, b, c) +#define Sfi_int32(a,b,c) sfi_int32(a, b, c) +#define Sfi_int64(a,b,c) sfi_int64(a, b, c) +#define Sfi_uchar(a,b,c) sfi_uchar(a, b, c) +#define Sfi_uint16(a,b,c) sfi_uint16(a, b, c) +#define Sfi_uint32(a,b,c) sfi_uint32(a, b, c) +#define Sfi_uint64(a,b,c) sfi_uint64(a, b, c) +#define Sfi_size_t(a,b,c) sfi_size_t(a, b, c) +#define Sfi_time_t(a,b,c) sfi_time_t(a, b, c) +#define Sfi_arti_info(a,b,c) sfi_arti_info(a, b, c) +#define Sfi_dungeon(a,b,c) sfi_dungeon(a, b, c) +#define Sfi_dgn_topology(a,b,c) sfi_dgn_topology(a, b, c) +#define Sfi_branch(a,b,c) sfi_branch(a, b, c) +#define Sfi_linfo(a,b,c) sfi_linfo(a, b, c) +#define Sfi_nhcoord(a,b,c) sfi_nhcoord(a, b, c) +#define Sfi_d_level(a,b,c) sfi_d_level(a, b, c) +#define Sfi_mapseen_feat(a,b,c) sfi_mapseen_feat(a, b, c) +#define Sfi_mapseen_flags(a,b,c) sfi_mapseen_flags(a, b, c) +#define Sfi_mapseen_rooms(a,b,c) sfi_mapseen_rooms(a, b, c) +#define Sfi_kinfo(a,b,c) sfi_kinfo(a, b, c) +#define Sfi_engr(a,b,c) sfi_engr(a, b, c) +#define Sfi_ls_t(a,b,c) sfi_ls_t(a, b, c) +#define Sfi_bubble(a,b,c) sfi_bubble(a, b, c) +#define Sfi_mkroom(a,b,c) sfi_mkroom(a, b, c) +#define Sfi_objclass(a,b,c) sfi_objclass(a, b, c) +#define Sfi_nhrect(a,b,c) sfi_nhrect(a, b, c) +#define Sfi_fe(a,b,c) sfi_fe(a, b, c) +#define Sfi_version_info(a,b,c) sfi_version_info(a, b, c) +#define Sfi_context_info(a,b,c) sfi_context_info(a, b, c) +#define Sfi_flag(a,b,c) sfi_flag(a, b, c) +#define Sfi_you(a,b,c) sfi_you(a, b, c) +#define Sfi_mvitals(a,b,c) sfi_mvitals(a, b, c) +#define Sfi_q_score(a,b,c) sfi_q_score(a, b, c) +#define Sfi_spell(a,b,c) sfi_spell(a, b, c) +#define Sfi_dest_area(a,b,c) sfi_dest_area(a, b, c) +#define Sfi_levelflags(a,b,c) sfi_levelflags(a, b, c) +#define Sfi_rm(a,b,c) sfi_rm(a, b, c) +#define Sfi_cemetery(a,b,c) sfi_cemetery(a, b, c) +#define Sfi_damage(a,b,c) sfi_damage(a, b, c) +#define Sfi_stairway(a,b,c) sfi_stairway(a, b, c) +#define Sfi_obj(a,b,c) sfi_obj(a, b, c) +#define Sfi_monst(a,b,c) sfi_monst(a, b, c) +#define Sfi_ebones(a,b,c) sfi_ebones(a, b, c) +#define Sfi_edog(a,b,c) sfi_edog(a, b, c) +#define Sfi_egd(a,b,c) sfi_egd(a, b, c) +#define Sfi_emin(a,b,c) sfi_emin(a, b, c) +#define Sfi_engr(a,b,c) sfi_engr(a, b, c) +#define Sfi_epri(a,b,c) sfi_epri(a, b, c) +#define Sfi_eshk(a,b,c) sfi_eshk(a, b, c) +#define Sfi_trap(a,b,c) sfi_trap(a, b, c) +#define Sfi_fruit(a,b,c) sfi_fruit(a, b, c) +#define Sfi_gamelog_line(a,b,c) sfi_gamelog_line(a, b, c) +#define Sfi_s_level(a,b,c) sfi_s_level(a, b, c) +#define Sfi_short(a, b, c) sfi_short(a, b, c) +#define Sfi_ushort(a, b, c) sfi_ushort(a, b, c) +#define Sfi_int(a, b, c) sfi_int(a, b, c); +#define Sfi_unsigned(a, b, c) sfi_unsigned(a, b, c); +#define Sfi_xint8(a, b, c) sfi_xint8(a, b, c); +#define Sfi_xint16(a, b, c) sfi_xint16(a, b, c); +#else + +#define sfo(nhfp, dt, tag) \ + _Generic( (dt), \ + anything * : sfo_any, \ + int16_t * : sfo_int16, \ + int32_t * : sfo_int32, \ + int64_t * : sfo_int64, \ + uchar * : sfo_uchar, \ + uint16_t * : sfo_uint16, \ + uint32_t * : sfo_uint32, \ + uint64_t * : sfo_uint64, \ + xint8 * : sfo_xint8, \ + struct arti_info * : sfo_arti_info, \ + struct nhrect * : sfo_nhrect, \ + struct branch * : sfo_branch, \ + struct bubble * : sfo_bubble, \ + struct cemetery * : sfo_cemetery, \ + struct context_info * : sfo_context_info, \ + coord * : sfo_nhcoord, \ + struct damage * : sfo_damage, \ + struct dgn_topology * : sfo_dgn_topology, \ + dungeon * : sfo_dungeon, \ + d_level * : sfo_d_level, \ + struct levelflags * : sfo_levelflags, \ + light_source * : sfo_ls_t, \ + struct dest_area * : sfo_dest_area, \ + struct ebones * : sfo_ebones, \ + struct edog * : sfo_edog, \ + struct egd * : sfo_egd, \ + struct emin * : sfo_emin, \ + struct engr * : sfo_engr, \ + struct epri * : sfo_epri, \ + struct eshk * : sfo_eshk, \ + struct fe * : sfo_fe, \ + struct flag * : sfo_flag, \ + struct fruit * : sfo_fruit, \ + struct gamelog_line * : sfo_gamelog_line, \ + struct kinfo * : sfo_kinfo, \ + struct linfo * : sfo_linfo, \ + struct mapseen_feat * : sfo_mapseen_feat, \ + struct mapseen_flags *: sfo_mapseen_flags, \ + struct mapseen_rooms *: sfo_mapseen_rooms, \ + struct mkroom * : sfo_mkroom, \ + struct monst * : sfo_monst, \ + struct mvitals * : sfo_mvitals, \ + struct obj * : sfo_obj, \ + struct objclass * : sfo_objclass, \ + struct q_score * : sfo_q_score, \ + struct rm * : sfo_rm, \ + struct spell * : sfo_spell, \ + struct stairway * : sfo_stairway, \ + struct s_level * : sfo_s_level, \ + struct trap * : sfo_trap, \ + struct version_info * : sfo_version_info, \ + struct you * : sfo_you \ + ) (nhfp, dt, tag) + +/* struct container * : sfo_container, */ +/* struct mapseen * : sfo_mapseen, */ +/* struct mextra * : sfo_mextra, */ +/* struct oextra * : sfo_oextra, */ +/* struct permonst * : sfo_permonst, */ + +#define sfi(nhfp, dt, tag) \ + _Generic( (dt), \ + anything * : sfi_any, \ + int16_t * : sfi_int16, \ + int32_t * : sfi_int32, \ + int64_t * : sfi_int64, \ + uchar * : sfi_uchar, \ + uint16_t * : sfi_uint16, \ + uint32_t * : sfi_uint32, \ + uint64_t * : sfi_uint64, \ + xint8 * : sfi_xint8, \ + struct arti_info * : sfi_arti_info, \ + struct nhrect * : sfi_nhrect, \ + struct branch * : sfi_branch, \ + struct bubble * : sfi_bubble, \ + struct cemetery * : sfi_cemetery, \ + struct context_info * : sfi_context_info, \ + coord * : sfi_nhcoord, \ + struct damage * : sfi_damage, \ + struct dgn_topology * : sfi_dgn_topology, \ + dungeon * : sfi_dungeon, \ + d_level * : sfi_d_level, \ + struct levelflags * : sfi_levelflags, \ + light_source * : sfi_ls_t, \ + struct dest_area * : sfi_dest_area, \ + struct ebones * : sfi_ebones, \ + struct edog * : sfi_edog, \ + struct egd * : sfi_egd, \ + struct emin * : sfi_emin, \ + struct engr * : sfi_engr, \ + struct epri * : sfi_epri, \ + struct eshk * : sfi_eshk, \ + struct fe * : sfi_fe, \ + struct flag * : sfi_flag, \ + struct fruit * : sfi_fruit, \ + struct gamelog_line * : sfi_gamelog_line, \ + struct kinfo * : sfi_kinfo, \ + struct linfo * : sfi_linfo, \ + struct mapseen_feat * : sfi_mapseen_feat, \ + struct mapseen_flags *: sfi_mapseen_flags, \ + struct mapseen_rooms *: sfi_mapseen_rooms, \ + struct mkroom * : sfi_mkroom, \ + struct monst * : sfi_monst, \ + struct mvitals * : sfi_mvitals, \ + struct obj * : sfi_obj, \ + struct objclass * : sfi_objclass, \ + struct q_score * : sfi_q_score, \ + struct rm * : sfi_rm, \ + struct spell * : sfi_spell, \ + struct stairway * : sfi_stairway, \ + struct s_level * : sfi_s_level, \ + struct trap * : sfi_trap, \ + struct version_info * : sfi_version_info, \ + struct you * : sfi_you \ + ) (nhfp, dt, tag) + +/* char * : sfo_char, */ +/* char * : sfi_char, */ +/* struct container * : sfi_container, */ +/* struct mapseen * : sfi_mapseen, */ +/* struct mextra * : sfi_mextra, */ +/* struct oextra * : sfi_oextra, */ +/* struct permonst * : sfi_permonst, */ + +#define Sfo_any(a,b,c) sfo(a, b, c) +#define Sfo_aligntyp(a,b,c) sfo(a, b, c) +#define Sfo_genericptr(a,b,c) sfo(a, b, c) +#define Sfo_coordxy(a,b,c) sfo(a, b, c) +#define Sfo_int16(a,b,c) sfo(a, b, c) +#define Sfo_int32(a,b,c) sfo(a, b, c) +#define Sfo_int64(a,b,c) sfo(a, b, c) +#define Sfo_uchar(a,b,c) sfo(a, b, c) +#define Sfo_unsigned(a,b,c) sfo(a, b, c) +#define Sfo_uchar(a,b,c) sfo(a, b, c) +#define Sfo_uint16(a,b,c) sfo(a, b, c) +#define Sfo_uint32(a,b,c) sfo(a, b, c) +#define Sfo_uint64(a,b,c) sfo(a, b, c) +#define Sfo_size_t(a,b,c) sfo(a, b, c) +#define Sfo_time_t(a,b,c) sfo(a, b, c) +#define Sfo_str(a,b,c) sfo(a, b, c) +#define Sfo_arti_info(a,b,c) sfo(a, b, c) +#define Sfo_dgn_topology(a,b,c) sfo(a, b, c) +#define Sfo_dungeon(a,b,c) sfo(a, b, c) +#define Sfo_branch(a,b,c) sfo(a, b, c) +#define Sfo_linfo(a,b,c) sfo(a, b, c) +#define Sfo_nhcoord(a,b,c) sfo(a, b, c) +#define Sfo_d_level(a,b,c) sfo(a, b, c) +#define Sfo_mapseen_feat(a,b,c) sfo(a, b, c) +#define Sfo_mapseen_flags(a,b,c) sfo(a, b, c) +#define Sfo_mapseen_rooms(a,b,c) sfo(a, b, c) +#define Sfo_kinfo(a,b,c) sfo(a, b, c) +#define Sfo_engr(a,b,c) sfo(a, b, c) +#define Sfo_ls_t(a,b,c) sfo(a, b, c) +#define Sfo_bubble(a,b,c) sfo(a, b, c) +#define Sfo_mkroom(a,b,c) sfo(a, b, c) +#define Sfo_objclass(a,b,c) sfo(a, b, c) +#define Sfo_nhrect(a,b,c) sfo(a, b, c) +#define Sfo_fe(a,b,c) sfo(a, b, c) +#define Sfo_version_info(a,b,c) sfo(a, b, c) +#define Sfo_context_info(a,b,c) sfo(a, b, c) +#define Sfo_flag(a,b,c) sfo(a, b, c) +#define Sfo_you(a,b,c) sfo(a, b, c) +#define Sfo_mvitals(a,b,c) sfo(a, b, c) +#define Sfo_q_score(a,b,c) sfo(a, b, c) +#define Sfo_spell(a,b,c) sfo(a, b, c) +#define Sfo_dest_area(a,b,c) sfo(a, b, c) +#define Sfo_levelflags(a,b,c) sfo(a, b, c) +#define Sfo_rm(a,b,c) sfo(a, b, c) +#define Sfo_cemetery(a,b,c) sfo(a, b, c) +#define Sfo_damage(a,b,c) sfo(a, b, c) +#define Sfo_stairway(a,b,c) sfo(a, b, c) +#define Sfo_obj(a,b,c) sfo(a, b, c) +#define Sfo_monst(a,b,c) sfo(a, b, c) +#define Sfo_ebones(a,b,c) sfo(a, b, c) +#define Sfo_edog(a,b,c) sfo(a, b, c) +#define Sfo_egd(a,b,c) sfo(a, b, c) +#define Sfo_emin(a,b,c) sfo(a, b, c) +#define Sfo_engr(a,b,c) sfo(a, b, c) +#define Sfo_epri(a,b,c) sfo(a, b, c) +#define Sfo_eshk(a,b,c) sfo(a, b, c) +#define Sfo_trap(a,b,c) sfo(a, b, c) +#define Sfo_gamelog_line(a,b,c) sfo(a, b, c) +#define Sfo_fruit(a,b,c) sfo(a, b, c) +#define Sfo_s_level(a,b,c) sfo(a, b, c) +#define Sfo_short(a, b, c) sfo(a, b, c) +#define Sfo_ushort(a, b, c) sfo(a, b, c) +#define Sfo_int(a, b, c) sfo(a, b, c) +#define Sfo_unsigned(a, b, c) sfo(a, b, c) +#define Sfo_xint8(a, b, c) sfo(a, b, c) +#define Sfo_xint16(a, b, c) sfo(a, b, c) + +/* sfbase.c input functions */ +#define Sfi_addinfo(a,b,c) sfi(a, b, c) +#define Sfi_aligntyp(a,b,c) sfi(a, b, c) +#define Sfi_any(a,b,c) sfi(a, b, c) +#define Sfi_genericptr(a,b,c) sfi(a, b, c) +#define Sfi_coordxy(a,b,c) sfi(a, b, c) +#define Sfi_int16(a,b,c) sfi(a, b, c) +#define Sfi_int32(a,b,c) sfi(a, b, c) +#define Sfi_int64(a,b,c) sfi(a, b, c) +#define Sfi_uchar(a,b,c) sfi(a, b, c) +#define Sfi_uint16(a,b,c) sfi(a, b, c) +#define Sfi_uint32(a,b,c) sfi(a, b, c) +#define Sfi_uint64(a,b,c) sfi(a, b, c) +#define Sfi_size_t(a,b,c) sfi(a, b, c) +#define Sfi_time_t(a,b,c) sfi(a, b, c) +#define Sfi_arti_info(a,b,c) sfi(a, b, c) +#define Sfi_dungeon(a,b,c) sfi(a, b, c) +#define Sfi_dgn_topology(a,b,c) sfi(a, b, c) +#define Sfi_branch(a,b,c) sfi(a, b, c) +#define Sfi_linfo(a,b,c) sfi(a, b, c) +#define Sfi_nhcoord(a,b,c) sfi(a, b, c) +#define Sfi_d_level(a,b,c) sfi(a, b, c) +#define Sfi_mapseen_feat(a,b,c) sfi(a, b, c) +#define Sfi_mapseen_flags(a,b,c) sfi(a, b, c) +#define Sfi_mapseen_rooms(a,b,c) sfi(a, b, c) +#define Sfi_kinfo(a,b,c) sfi(a, b, c) +#define Sfi_engr(a,b,c) sfi(a, b, c) +#define Sfi_ls_t(a,b,c) sfi(a, b, c) +#define Sfi_bubble(a,b,c) sfi(a, b, c) +#define Sfi_mkroom(a,b,c) sfi(a, b, c) +#define Sfi_objclass(a,b,c) sfi(a, b, c) +#define Sfi_nhrect(a,b,c) sfi(a, b, c) +#define Sfi_fe(a,b,c) sfi(a, b, c) +#define Sfi_version_info(a,b,c) sfi(a, b, c) +#define Sfi_context_info(a,b,c) sfi(a, b, c) +#define Sfi_flag(a,b,c) sfi(a, b, c) +#define Sfi_you(a,b,c) sfi(a, b, c) +#define Sfi_mvitals(a,b,c) sfi(a, b, c) +#define Sfi_q_score(a,b,c) sfi(a, b, c) +#define Sfi_spell(a,b,c) sfi(a, b, c) +#define Sfi_dest_area(a,b,c) sfi(a, b, c) +#define Sfi_levelflags(a,b,c) sfi(a, b, c) +#define Sfi_rm(a,b,c) sfi(a, b, c) +#define Sfi_cemetery(a,b,c) sfi(a, b, c) +#define Sfi_damage(a,b,c) sfi(a, b, c) +#define Sfi_stairway(a,b,c) sfi(a, b, c) +#define Sfi_obj(a,b,c) sfi(a, b, c) +#define Sfi_monst(a,b,c) sfi(a, b, c) +#define Sfi_ebones(a,b,c) sfi(a, b, c) +#define Sfi_edog(a,b,c) sfi(a, b, c) +#define Sfi_egd(a,b,c) sfi(a, b, c) +#define Sfi_emin(a,b,c) sfi(a, b, c) +#define Sfi_engr(a,b,c) sfi(a, b, c) +#define Sfi_epri(a,b,c) sfi(a, b, c) +#define Sfi_eshk(a,b,c) sfi(a, b, c) +#define Sfi_trap(a,b,c) sfi(a, b, c) +#define Sfi_fruit(a,b,c) sfi(a, b, c) +#define Sfi_gamelog_line(a,b,c) sfi(a, b, c) +#define Sfi_s_level(a,b,c) sfi(a, b, c) +#define Sfi_short(a, b, c) sfi(a, b, c) +#define Sfi_ushort(a, b, c) sfi(a, b, c) +#define Sfi_int(a,b,c) sfi(a, b, c) +#define Sfi_unsigned(a, b, c) sfi(a, b, c) +#define Sfi_xint8(a, b, c) sfi(a, b, c) +#define Sfi_xint16(a, b, c) sfi(a, b, c) +#endif + +/* not in _Generic */ +#define Sfo_long(a,b,c) sfo_long(a, b, c); +#define Sfo_ulong(a,b,c) sfo_ulong(a, b, c); +#define Sfo_char(a,b,c,d) sfo_char(a, b, c, d) +#define Sfo_boolean(a,b,c) sfo_boolean(a, b, c) +#define Sfo_schar(a,b,c) sfo_schar(a, b, c) + +#define Sfi_long(a,b,c) sfi_long(a, b, c); +#define Sfi_ulong(a,b,c) sfi_ulong(a, b, c); +#define Sfi_char(a,b,c,d) sfi_char(a, b, c, d) +#define Sfi_boolean(a,b,c) sfi_boolean(a, b, c) +#define Sfi_schar(a,b,c) sfi_schar(a, b, c) + +#endif /* SAVEFILE_H */ + diff --git a/include/seffects.h b/include/seffects.h new file mode 100644 index 000000000..bd62c9543 --- /dev/null +++ b/include/seffects.h @@ -0,0 +1,216 @@ +/* NetHack 5.0 seffects.h $NHDT-Date: 1693253118 2023/08/28 20:05:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $ */ +/* Copyright (c) Michael Allison, 2023 */ +/* NetHack may be freely redistributed. See license for details. */ + +#if defined(SEFFECTS_ENUM) || defined(SEFFECTS_AUTOMAP) + +#if defined(SEFFECTS_ENUM) +#define seffect(basename) se_##basename +#else +#if defined(SEFFECTS_AUTOMAP) +#define seffect(basename) \ + { se_##basename, #basename } +#endif +#endif + seffect(air_crackles), + seffect(alarm), + seffect(angry_drone), + seffect(angry_snakes), + seffect(angry_voice), + seffect(applause), + seffect(avian_screak), + seffect(bang_weapon_side), + seffect(bars_clink), + seffect(bars_clonk), + seffect(bars_flapp), + seffect(bars_whang), + seffect(bars_whap), + seffect(bees), + seffect(blast), + seffect(board_squeak), + seffect(board_squeaks_loudly), + seffect(boing), + seffect(bolt_of_lightning), + seffect(bone_rattle), + seffect(boomerang_klonk), + seffect(boulder_drop), + seffect(bovine_bellow), + seffect(bovine_moo), + seffect(bubble_rising), + seffect(bugle_playing_reveille), + seffect(buzz), + seffect(canine_bark), + seffect(canine_growl), + seffect(canine_howl), + seffect(canine_whine), + seffect(canine_yelp), + seffect(canine_yip), + seffect(canine_yowl), + seffect(chain_shatters), + seffect(chains_rattling_gears_turning), + seffect(chant), + seffect(chirp), + seffect(clanging_sound), + seffect(clank), + seffect(clanking_pipe), + seffect(clash), + seffect(cockatrice_hiss), + seffect(cough), + seffect(courtly_conversation), + seffect(cracking_sound), + seffect(crackling), + seffect(crackling_of_hellfire), + seffect(crash), + seffect(crash_door), + seffect(crash_something_broke), + seffect(crash_throne_destroyed), + seffect(crash_through_floor), + seffect(crashed_ceiling), + seffect(crashing_boulder), + seffect(crashing_rock), + seffect(crashing_sound), + seffect(croc_bellow), + seffect(crumbling_sound), + seffect(crunching_sound), + seffect(crushing_sound), + seffect(deafening_roar_atmospheric), + seffect(destroy_web), + seffect(distant_thunder), + seffect(divine_music), + seffect(door_crash_open), + seffect(door_open), + seffect(door_unlock_and_open), + seffect(drain_noises), + seffect(dry_throat_rattle), + seffect(egg_cracking), + seffect(egg_splatting), + seffect(elephant_trumpet), + seffect(equine_neigh), + seffect(equine_whicker), + seffect(equine_whinny), + seffect(explosion), + seffect(faint_chime), + seffect(faint_sloshing), + seffect(faint_splashing), + seffect(feline_meow), + seffect(feline_mew), + seffect(feline_purr), + seffect(feline_yelp), + seffect(feline_yip), + seffect(feline_yowl), + seffect(furious_bubbling), + seffect(gear_turn), + seffect(gears_turning_chains_rattling), + seffect(glass_crashing), + seffect(glass_shattering), + seffect(groan), + seffect(groans_and_moans), + seffect(growl), + seffect(grunt), + seffect(guards_footsteps), + seffect(gurgle), + seffect(gushing_sound), + seffect(heart_beat), + seffect(hiss), + seffect(hollow_sound), + seffect(horn_being_played), + seffect(iron_ball_dragging_you), + seffect(iron_ball_hits_you), + seffect(item_tumble_downwards), + seffect(jabberwock_burble), + seffect(kaablamm_of_mine), + seffect(kaboom), + seffect(kaboom_boom_boom), + seffect(kaboom_door_explodes), + seffect(kadoom_boulder_falls_in), + seffect(kerplunk_boulder_gone), + seffect(kick_door_it_crashes_open), + seffect(kick_door_it_shatters), + seffect(klick), + seffect(klunk), + seffect(klunk_pipe), + seffect(laughter), + seffect(lid_slams_open_falls_shut), + seffect(loud_click), + seffect(loud_crash), + seffect(loud_pop), + seffect(loud_splash), + seffect(low_buzzing), + seffect(low_hum), + seffect(maniacal_laughter), + seffect(masticating_sound), + seffect(mon_chugging_potion), + seffect(monster_behind_boulder), + seffect(mutter_imprecations), + seffect(mutter_incantation), + seffect(orc_grunt), + seffect(paranoid_confirmation), + seffect(potion_crash_and_break), + seffect(ring_in_drain), + seffect(ripping_sound), + seffect(snarl), + seffect(roar), + seffect(rumbling), + seffect(rumbling_of_earth), + seffect(rushing_wind_noise), + seffect(rustling_paper), + seffect(sad_wailing), + seffect(sceptor_pounding), + seffect(scratching), + seffect(scream), + seffect(screech), + seffect(sewer_song), + seffect(sharp_crack), + seffect(shriek), + seffect(shrill_whistle), + seffect(sinister_laughter), + seffect(sizzling), + seffect(slurping_sound), + seffect(smashing_and_crushing), + seffect(snake_rattle), + seffect(snakes_hissing), + seffect(soft_click), + seffect(soft_crackling), + seffect(someone_bowling), + seffect(someone_searching), + seffect(someone_summoning), + seffect(someone_yells), + seffect(splash), + seffect(splat_egg), + seffect(splat_from_engulf), + seffect(squawk), + seffect(squeak), + seffect(squeak_A), + seffect(squeak_B), + seffect(squeak_B_flat), + seffect(squeak_C), + seffect(squeak_D), + seffect(squeak_D_flat), + seffect(squeak_E), + seffect(squeak_E_flat), + seffect(squeak_F), + seffect(squeak_F_sharp), + seffect(squeak_G), + seffect(squeak_G_sharp), + seffect(squeal), + seffect(squelch), + seffect(stone_breaking), + seffect(stone_crumbling), + seffect(swoosh), + seffect(sword_blade_rings), + seffect(thud), + seffect(thump), + seffect(thunderclap), + seffect(tumbler_click), + seffect(typing_noise), + seffect(wail), + seffect(wailing_of_the_banshee), + seffect(wall_of_force), + seffect(yelp), + seffect(zap), + seffect(zap_then_explosion), +#undef seffect +#endif /* SEFFECTS_ENUM || SEFFECTS_AUTOMAP */ + +/* seffects.h */ + diff --git a/include/selvar.h b/include/selvar.h new file mode 100644 index 000000000..2854173f4 --- /dev/null +++ b/include/selvar.h @@ -0,0 +1,11 @@ +/* NetHack 5.0 selvar.h $NHDT-Date: 1709677544 2024/03/05 22:25:44 $ $NHDT-Branch: keni-mdlib-followup $:$NHDT-Revision: 1.0 $ */ +/* Copyright (c) 2024 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef SELVAR_H +#define SELVAR_H + +typedef void (*select_iter_func)(coordxy, coordxy, genericptr); + +#endif /* SELVAR_H */ + diff --git a/include/sfmacros.h b/include/sfmacros.h new file mode 100644 index 000000000..d0bedf69f --- /dev/null +++ b/include/sfmacros.h @@ -0,0 +1,81 @@ +/* NetHack 5.0 sfmacros.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* Copyright (c) Michael Allison, 2025. */ +/* NetHack may be freely redistributed. See license for details. */ + +/* This file is included by sfbase.c, sfstruct.c */ + +#if defined(SF_C) && defined(SF_A) + +SF_C(struct, arti_info) +SF_C(struct, nhrect) +SF_C(struct, branch) +SF_C(struct, bubble) +SF_C(struct, cemetery) +SF_C(struct, context_info) +SF_C(struct, nhcoord) +SF_C(struct, damage) +SF_C(struct, dest_area) +SF_C(struct, dgn_topology) +SF_C(struct, dungeon) +SF_C(struct, d_level) +SF_C(struct, ebones) +SF_C(struct, edog) +SF_C(struct, egd) +SF_C(struct, emin) +SF_C(struct, engr) +SF_C(struct, epri) +SF_C(struct, eshk) +SF_C(struct, fe) +SF_C(struct, flag) +SF_C(struct, fruit) +SF_C(struct, gamelog_line) +SF_C(struct, kinfo) +SF_C(struct, levelflags) +SF_C(struct, ls_t) +SF_C(struct, linfo) +SF_C(struct, mapseen_feat) +SF_C(struct, mapseen_flags) +SF_C(struct, mapseen_rooms) +SF_C(struct, mkroom) +SF_C(struct, monst) +SF_C(struct, mvitals) +SF_C(struct, obj) +SF_C(struct, objclass) +SF_C(struct, q_score) +SF_C(struct, rm) +SF_C(struct, spell) +SF_C(struct, stairway) +SF_C(struct, s_level) +SF_C(struct, trap) +SF_C(struct, you) +SF_C(union, any) + +SF_A(aligntyp) +SF_A(boolean) +SF_A(coordxy) +//SF_A(genericptr) +SF_A(int) +SF_A(int16) +SF_A(int32) +SF_A(int64) +SF_A(long) +SF_A(schar) +SF_A(short) +SF_A(size_t) +SF_A(time_t) +SF_A(uchar) +SF_A(uint16) +SF_A(uint32) +SF_A(uint64) +SF_A(ulong) +SF_A(unsigned) +SF_A(ushort) +SF_A(xint16) +SF_A(xint8) + +#else + +#error Non-productive inclusion of sfmacros.h + +#endif /* SF_C && SF_A */ + diff --git a/include/sfprocs.h b/include/sfprocs.h new file mode 100644 index 000000000..f544b04c9 --- /dev/null +++ b/include/sfprocs.h @@ -0,0 +1,202 @@ +/* NetHack 3.6 sfprocs.h Tue Nov 6 19:38:48 2018 */ +/* Copyright (c) NetHack Development Team 2025. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef SFPROCS_H +#define SFPROCS_H + +#define NHTYPE_SIMPLE 1 +#define NHTYPE_COMPLEX 2 + +#define SF_PROTO(dtyp) \ + extern void sfo_##dtyp(NHFILE *, dtyp *, const char *); \ + extern void sfi_##dtyp(NHFILE *, dtyp *, const char *); \ + extern void sfo_x_##dtyp(NHFILE *, dtyp *, const char *); \ + extern void sfi_x_##dtyp(NHFILE *, dtyp *, const char *) +#define SF_PROTO_C(keyw, dtyp) \ + extern void sfo_##dtyp(NHFILE *, keyw dtyp *, const char *); \ + extern void sfi_##dtyp(NHFILE *, keyw dtyp *, const char *); \ + extern void sfo_x_##dtyp(NHFILE *, keyw dtyp *, const char *); \ + extern void sfi_x_##dtyp(NHFILE *, keyw dtyp *, const char *) +#define SF_PROTO_X(xxx, dtyp) \ + extern void sfo_##dtyp(NHFILE *, xxx *, const char *, int bfsz); \ + extern void sfi_##dtyp(NHFILE *, xxx *, const char *, int bfsz); \ + extern void sfo_x_##dtyp(NHFILE *, xxx *, const char *, int bfsz); \ + extern void sfi_x_##dtyp(NHFILE *, xxx *, const char *, int bfsz) + +SF_PROTO_C(struct, arti_info); +SF_PROTO_C(struct, nhrect); +SF_PROTO_C(struct, branch); +SF_PROTO_C(struct, bubble); +SF_PROTO_C(struct, cemetery); +SF_PROTO_C(struct, context_info); +SF_PROTO_C(struct, nhcoord); +SF_PROTO_C(struct, damage); +SF_PROTO_C(struct, dest_area); +SF_PROTO_C(struct, dgn_topology); +SF_PROTO_C(struct, dungeon); +SF_PROTO_C(struct, d_level); +SF_PROTO_C(struct, ebones); +SF_PROTO_C(struct, edog); +SF_PROTO_C(struct, egd); +SF_PROTO_C(struct, emin); +SF_PROTO_C(struct, engr); +SF_PROTO_C(struct, epri); +SF_PROTO_C(struct, eshk); +SF_PROTO_C(struct, fe); +SF_PROTO_C(struct, flag); +SF_PROTO_C(struct, fruit); +SF_PROTO_C(struct, gamelog_line); +SF_PROTO_C(struct, kinfo); +SF_PROTO_C(struct, levelflags); +SF_PROTO_C(struct, ls_t); +SF_PROTO_C(struct, linfo); +SF_PROTO_C(struct, mapseen_feat); +SF_PROTO_C(struct, mapseen_flags); +SF_PROTO_C(struct, mapseen_rooms); +SF_PROTO_C(struct, mkroom); +SF_PROTO_C(struct, monst); +SF_PROTO_C(struct, mvitals); +SF_PROTO_C(struct, obj); +SF_PROTO_C(struct, objclass); +SF_PROTO_C(struct, q_score); +SF_PROTO_C(struct, rm); +SF_PROTO_C(struct, spell); +SF_PROTO_C(struct, stairway); +SF_PROTO_C(struct, s_level); +SF_PROTO_C(struct, trap); +SF_PROTO_C(struct, version_info); +SF_PROTO_C(struct, you); +SF_PROTO_C(union, any); +SF_PROTO(int16); +SF_PROTO(int32); +SF_PROTO(int64); +SF_PROTO(uchar); +SF_PROTO(uint16); +SF_PROTO(uint32); +SF_PROTO(uint64); +SF_PROTO(long); +SF_PROTO(ulong); +SF_PROTO(xint8); +SF_PROTO(boolean); +SF_PROTO(schar); +SF_PROTO(aligntyp); +SF_PROTO(genericptr); +SF_PROTO(size_t); +SF_PROTO(time_t); +SF_PROTO(int); +SF_PROTO(unsigned); +SF_PROTO(coordxy); +SF_PROTO(short); +SF_PROTO(xint16); +SF_PROTO(ushort); +SF_PROTO_X(uint8_t, bitfield); +SF_PROTO_X(char, char); + +#undef SF_PROTO +#undef SF_PROTO_C +#undef SF_PROTO_X + +#define SF_ENTRY(dtyp) \ + void (*sf_##dtyp)(NHFILE *, dtyp *, const char *) +#define SF_ENTRY_C(keyw, dtyp) \ + void (*sf_##dtyp)(NHFILE *, keyw dtyp *, const char *) +#define SF_ENTRY_X(xxx, dtyp) \ + void (*sf_##dtyp)(NHFILE *, xxx *, const char *, int bfsz) + +struct sf_procs { + SF_ENTRY_C(struct, arti_info); + SF_ENTRY_C(struct, nhrect); + SF_ENTRY_C(struct, branch); + SF_ENTRY_C(struct, bubble); + SF_ENTRY_C(struct, cemetery); + SF_ENTRY_C(struct, context_info); + SF_ENTRY_C(struct, nhcoord); + SF_ENTRY_C(struct, damage); + SF_ENTRY_C(struct, dest_area); + SF_ENTRY_C(struct, dgn_topology); + SF_ENTRY_C(struct, dungeon); + SF_ENTRY_C(struct, d_level); + SF_ENTRY_C(struct, ebones); + SF_ENTRY_C(struct, edog); + SF_ENTRY_C(struct, egd); + SF_ENTRY_C(struct, emin); + SF_ENTRY_C(struct, engr); + SF_ENTRY_C(struct, epri); + SF_ENTRY_C(struct, eshk); + SF_ENTRY_C(struct, fe); + SF_ENTRY_C(struct, flag); + SF_ENTRY_C(struct, fruit); + SF_ENTRY_C(struct, gamelog_line); + SF_ENTRY_C(struct, kinfo); + SF_ENTRY_C(struct, levelflags); + SF_ENTRY_C(struct, ls_t); + SF_ENTRY_C(struct, linfo); + SF_ENTRY_C(struct, mapseen_feat); + SF_ENTRY_C(struct, mapseen_flags); + SF_ENTRY_C(struct, mapseen_rooms); + SF_ENTRY_C(struct, mkroom); + SF_ENTRY_C(struct, monst); + SF_ENTRY_C(struct, mvitals); + SF_ENTRY_C(struct, obj); + SF_ENTRY_C(struct, objclass); + SF_ENTRY_C(struct, q_score); + SF_ENTRY_C(struct, rm); + SF_ENTRY_C(struct, spell); + SF_ENTRY_C(struct, stairway); + SF_ENTRY_C(struct, s_level); + SF_ENTRY_C(struct, trap); + SF_ENTRY_C(struct, version_info); + SF_ENTRY_C(struct, you); + SF_ENTRY_C(union, any); + + SF_ENTRY(aligntyp); + SF_ENTRY(boolean); + SF_ENTRY(coordxy); + SF_ENTRY(genericptr); + SF_ENTRY(int); + SF_ENTRY(int16); + SF_ENTRY(int32); + SF_ENTRY(int64); + SF_ENTRY(long); + SF_ENTRY(schar); + SF_ENTRY(short); + SF_ENTRY(size_t); + SF_ENTRY(time_t); + SF_ENTRY(uchar); + SF_ENTRY(uint16); + SF_ENTRY(uint32); + SF_ENTRY(uint64); + SF_ENTRY(ulong); + SF_ENTRY(unsigned); + SF_ENTRY(ushort); + SF_ENTRY(xint16); + SF_ENTRY(xint8); + SF_ENTRY_X(char, char); + SF_ENTRY_X(uint8_t, bitfield); +}; + +#undef SF_ENTRY +#undef SF_ENTRY_C +#undef SF_ENTRY_X + +struct sf_structlevel_procs { + const char *ext; + struct sf_procs fn; /* called for structlevel (historical) */ +}; +struct sf_fieldlevel_procs { + const char *ext; + struct sf_procs fn_x; /* called for fieldlevel */ +}; +extern struct sf_structlevel_procs sfoprocs[NUM_SAVEFORMATS], sfiprocs[NUM_SAVEFORMATS]; +extern void sf_setprocs(int, struct sf_structlevel_procs *, struct sf_structlevel_procs *); +extern void sf_setflprocs(int, struct sf_fieldlevel_procs *, struct sf_fieldlevel_procs *); +extern struct sf_structlevel_procs sfoprocs[NUM_SAVEFORMATS], sfiprocs[NUM_SAVEFORMATS]; +extern struct sf_fieldlevel_procs sfoflprocs[NUM_SAVEFORMATS], sfiflprocs[NUM_SAVEFORMATS]; +extern struct sf_structlevel_procs historical_sfo_procs; +extern struct sf_structlevel_procs historical_sfi_procs; +extern struct sf_fieldlevel_procs exportascii_sfo_procs; +extern struct sf_fieldlevel_procs exportascii_sfi_procs; + +#endif /* SFPROCS_H */ + diff --git a/include/skills.h b/include/skills.h index a7cdb5256..40204aa4f 100644 --- a/include/skills.h +++ b/include/skills.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 skills.h $NHDT-Date: 1547255911 2019/01/12 01:18:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ */ +/* NetHack 5.0 skills.h $NHDT-Date: 1596498559 2020/08/03 23:49:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.16 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */ /*-Copyright (c) Pasi Kallinen, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -29,42 +29,41 @@ enum p_skills { P_BROAD_SWORD = 6, P_LONG_SWORD = 7, P_TWO_HANDED_SWORD = 8, - P_SCIMITAR = 9, - P_SABER = 10, - P_CLUB = 11, /* Heavy-shafted bludgeon */ - P_MACE = 12, - P_MORNING_STAR = 13, /* Spiked bludgeon */ - P_FLAIL = 14, /* Two pieces hinged or chained together */ - P_HAMMER = 15, /* Heavy head on the end */ - P_QUARTERSTAFF = 16, /* Long-shafted bludgeon */ - P_POLEARMS = 17, /* attack two or three steps away */ - P_SPEAR = 18, /* includes javelin */ - P_TRIDENT = 19, - P_LANCE = 20, - P_BOW = 21, /* launchers */ - P_SLING = 22, - P_CROSSBOW = 23, - P_DART = 24, /* hand-thrown missiles */ - P_SHURIKEN = 25, - P_BOOMERANG = 26, - P_WHIP = 27, /* flexible, one-handed */ - P_UNICORN_HORN = 28, /* last weapon, two-handed */ + P_SABER = 9, /* Curved sword, includes scimitar */ + P_CLUB = 10, /* Heavy-shafted bludgeon */ + P_MACE = 11, + P_MORNING_STAR = 12, /* Spiked bludgeon */ + P_FLAIL = 13, /* Two pieces hinged or chained together */ + P_HAMMER = 14, /* Heavy head on the end */ + P_QUARTERSTAFF = 15, /* Long-shafted bludgeon */ + P_POLEARMS = 16, /* attack two or three steps away */ + P_SPEAR = 17, /* includes javelin */ + P_TRIDENT = 18, + P_LANCE = 19, + P_BOW = 20, /* launchers */ + P_SLING = 21, + P_CROSSBOW = 22, + P_DART = 23, /* hand-thrown missiles */ + P_SHURIKEN = 24, + P_BOOMERANG = 25, + P_WHIP = 26, /* flexible, one-handed */ + P_UNICORN_HORN = 27, /* last weapon, two-handed */ /* Spell Skills added by Larry Stewart-Zerba */ - P_ATTACK_SPELL = 29, - P_HEALING_SPELL = 30, - P_DIVINATION_SPELL = 31, - P_ENCHANTMENT_SPELL = 32, - P_CLERIC_SPELL = 33, - P_ESCAPE_SPELL = 34, - P_MATTER_SPELL = 35, + P_ATTACK_SPELL = 28, + P_HEALING_SPELL = 29, + P_DIVINATION_SPELL = 30, + P_ENCHANTMENT_SPELL = 31, + P_CLERIC_SPELL = 32, + P_ESCAPE_SPELL = 33, + P_MATTER_SPELL = 34, /* Other types of combat */ - P_BARE_HANDED_COMBAT = 36, /* actually weaponless; gloves are ok */ - P_TWO_WEAPON_COMBAT = 37, /* pair of weapons, one in each hand */ - P_RIDING = 38, /* How well you control your steed */ + P_BARE_HANDED_COMBAT = 35, /* actually weaponless; gloves are ok */ + P_TWO_WEAPON_COMBAT = 36, /* pair of weapons, one in each hand */ + P_RIDING = 37, /* How well you control your steed */ - P_NUM_SKILLS = 39 + P_NUM_SKILLS = 38 }; #define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */ @@ -83,7 +82,7 @@ enum p_skills { /* * These are the standard weapon skill levels. It is important that - * the lowest "valid" skill be be 1. The code calculates the + * the lowest "valid" skill be 1. The code calculates the * previous amount to practice by calling practice_needed_to_advance() * with the current skill-1. To work out for the UNSKILLED case, * a value of 0 needed. @@ -108,8 +107,8 @@ enum skill_levels { /* The hero's skill in various weapons. */ struct skills { - xchar skill; - xchar max_skill; + xint16 skill; + xint16 max_skill; unsigned short advance; }; @@ -122,8 +121,8 @@ struct skills { /* Initial skill matrix structure; used in u_init.c and weapon.c */ struct def_skill { - xchar skill; - xchar skmax; + xint16 skill; + xint16 skmax; }; #endif /* SKILLS_H */ diff --git a/include/sndprocs.h b/include/sndprocs.h new file mode 100755 index 000000000..d09e4e1e7 --- /dev/null +++ b/include/sndprocs.h @@ -0,0 +1,303 @@ +/* NetHack 5.0 sndprocs.h $NHDT-Date: 1725653015 2024/09/06 20:03:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.26 $ */ +/* Copyright (c) Michael Allison, 2022 */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef SNDPROCS_H +#define SNDPROCS_H + +enum soundlib_ids { + soundlib_nosound, +#ifdef SND_LIB_PORTAUDIO + soundlib_portaudio, +#endif +#ifdef SND_LIB_OPENAL + soundlib_openal, +#endif +#ifdef SND_LIB_SDL_MIXER + soundlib_sdl_mixer, +#endif +#ifdef SND_LIB_MINIAUDIO + soundlib_miniaudio, +#endif +#ifdef SND_LIB_FMOD + soundlib_fmod, +#endif +#ifdef SND_LIB_SOUND_ESCCODES + soundlib_sound_esccodes, +#endif +#ifdef SND_LIB_VISSOUND + soundlib_vissound, +#endif +#ifdef SND_LIB_WINDSOUND + soundlib_windsound, +#endif +#ifdef SND_LIB_MACSOUND + soundlib_macsound, +#endif +#ifdef SND_LIB_QTSOUND + soundlib_qtsound, +#endif + soundlib_notused +}; + +struct sound_procs { + const char *soundname; + enum soundlib_ids soundlib_id; + unsigned long sound_triggers; /* capabilities in the port */ + void (*sound_init_nhsound)(void); + void (*sound_exit_nhsound)(const char *); + void (*sound_achievement)(schar, schar, int32_t); + void (*sound_soundeffect)(char *desc, int32_t, int32_t volume); + void (*sound_hero_playnotes)(int32_t instrument, const char *str, + int32_t volume); + void (*sound_play_usersound)(char *filename, int32_t volume, int32_t idx); + void (*sound_ambience)(int32_t ambience_action, int32_t ambienceid, + int32_t proximity); + void (*sound_verbal)(char *text, int32_t gender, int32_t tone, + int32_t vol, int32_t moreinfo); +}; + +struct sound_voice { + int32_t serialno; + int32_t gender; + int32_t tone; + int32_t volume; + int32_t moreinfo; + struct monst *mon; + const char *nameid; +}; + +extern struct sound_procs sndprocs; + +#define SOUNDID(soundname) \ + #soundname, ((enum soundlib_ids) soundlib_##soundname) + +/* + * Types of triggers + */ +#define SOUND_TRIGGER_USERSOUNDS 0x0001L +#define SOUND_TRIGGER_HEROMUSIC 0x0002L +#define SOUND_TRIGGER_ACHIEVEMENTS 0x0004L +#define SOUND_TRIGGER_SOUNDEFFECTS 0x0008L +#define SOUND_TRIGGER_AMBIENCE 0x0010L +#define SOUND_TRIGGER_VERBAL 0x0020L + /* 26 free bits */ + +extern struct sound_procs soundprocs; + +/* subset for NetHack */ +enum instruments { + ins_cello = 43, ins_orchestral_harp = 47, ins_choir_aahs = 53, + ins_trumpet = 57, ins_trombone = 58, ins_french_horn = 61, + ins_baritone_sax = 68, ins_english_horn = 70, ins_piccolo = 73, + ins_flute = 74, ins_pan_flute = 76, ins_blown_bottle = 77, + ins_whistle = 79, ins_tinkle_bell = 113, ins_woodblock = 116, + ins_taiko_drum = 117, ins_melodic_tom = 118, ins_seashore = 123, + ins_no_instrument +}; + +#if 0 +enum instruments_broad { + ins_acoustic_grand_piano = 1, ins_bright_acoustic_piano = 2, + ins_electric_grand_piano = 3, ins_honkytonk_piano = 4, + ins_electric_piano_1 = 5, ins_electric_piano_2 = 6, + ins_harpsichord = 7, ins_clavinet = 8, ins_celesta = 9, + ins_glockenspiel = 10, ins_music_box = 11, ins_vibraphone = 12, + ins_marimba = 13, ins_xylophone = 14, ins_tubular_bells = 15, + ins_dulcimer = 16, ins_drawbar_organ = 17, + ins_percussive_organ = 18, ins_rock_organ = 19, ins_church_organ = 20, + ins_reed_organ = 21, ins_french_accordion = 22, ins_harmonica = 23, + ins_tango_accordion = 24, ins_acoustic_guitar__nylon = 25, + ins_acoustic_guitar_steel = 26, ins_electric_guitar_jazz = 27, + ins_electric_guitar_clean = 28, ins_electric_guitar_muted = 29, + ins_overdriven_guitar = 30, ins_distortion_guitar = 31, + ins_guitar_harmonics = 32, ins_acoustic_bass = 33, + ins_electric_bass__fingered = 34, ins_electric_bass_picked = 35, + ins_fretless_bass = 36, ins_slap_bass_1 = 37, ins_slap_bass_2 = 38, + ins_synth_bass_1 = 39, ins_synth_bass_2 = 40, ins_violin = 41, + ins_viola = 42, ins_cello = 43, ins_contrabass = 44, + ins_tremolo_strings = 45, ins_pizzicato_strings = 46, + ins_orchestral_harp = 47, ins_timpani = 48, + ins_string_ensemble_1 = 49, ins_string_ensemble_2 = 50, + ins_synthstrings_1 = 51, ins_synthstrings_2 = 52, ins_choir_aahs = 53, + ins_voice_oohs = 54, ins_synth_voice = 55, ins_orchestra_hit = 56, + ins_trumpet = 57, ins_trombone = 58, ins_tuba = 59, ins_muted_trumpet = 60, + ins_french_horn = 61, ins_brass_section = 62, ins_synthbrass_1 = 63, + ins_synthbrass_2 = 64, ins_soprano_sax = 65, ins_alto_sax = 66, + ins_tenor_sax = 67, ins_baritone_sax = 68, ins_oboe = 69, + ins_english_horn = 70, ins_bassoon = 71, ins_clarinet = 72, + ins_piccolo = 73, ins_flute = 74, ins_recorder = 75, + ins_pan_flute = 76, ins_blown_bottle = 77, ins_shakuhachi = 78, + ins_whistle = 79, ins_ocarina = 80, ins_sitar = 105, ins_banjo = 106, + ins_shamisen = 107, ins_koto = 108, ins_kalimba = 109, ins_bag_pipe = 110, + ins_fiddle = 111, ins_shanai = 112, ins_tinkle_bell = 113, ins_agogo = 114, + ins_steel_drums = 115, ins_woodblock = 116, ins_taiko_drum = 117, + ins_melodic_tom = 118, ins_synth_drum = 119, ins_reverse_cymbal = 120, + ins_guitar_fret_noise = 121, ins_breath_noise = 122, ins_seashore = 123, + ins_bird_tweet = 124, ins_telephone_ring = 125, ins_helicopter = 126, + ins_applause = 127, ins_gunshot = 128, + ins_no_instrument +}; +#endif + +#define SEFFECTS_ENUM +enum sound_effect_entries { + se_zero_invalid = 0, +#include "seffects.h" + number_of_se_entries +}; +#undef SEFFECTS_ENUM + +enum ambience_actions { + ambience_nothing, ambience_begin, ambience_end, ambience_update +}; + +enum ambiences { + amb_noambience, +}; + +enum voice_moreinfo { + voice_nothing_special, + voice_audioassistant = 0x0001, /* accessibility */ + voice_talking_artifact = 0x0002, + voice_deity = 0x0004, + voice_oracle = 0x0008, + voice_throne = 0x0010, + voice_death = 0x0020 +}; + +enum achievements_arg2 { + sa2_zero_invalid, sa2_splashscreen, sa2_newgame_nosplash, sa2_restoregame, + sa2_xplevelup, sa2_xpleveldown, number_of_sa2_entries +}; + +/* +Arguments for sound_achievement(schar arg1, schar arg2, int32_t aflags) + +Arguments for actual achievements, those in you.h, + arg1 = the achievement value. + arg2 = 0 (irrelevant). + aflags = 0 for first time, 1 for repeat. + +These next ones make use of arg2, and aflags may be +filled with additional int values dependent on arg2. +arg1 must always be 0 for these. + +SoundAchievement(0, sa2_splashscreen, 0); +SoundAchievement(0, sa2_newgame_nosplash, 0); +SoundAchievement(0, sa2_restoregame, 0); +SoundAchievement(0, sa2_levelup, level); +SoundAchievement(0, sa2_xpleveldown, level); +*/ + +#if defined(SND_LIB_QTSOUND) || defined(SND_LIB_PORTAUDIO) \ + || defined(SND_LIB_OPENAL) || defined(SND_LIB_SDL_MIXER) \ + || defined(SND_LIB_MINIAUDIO) || defined(SND_LIB_FMOD) \ + || defined(SND_LIB_SOUND_ESCCODES) || defined(SND_LIB_VISSOUND) \ + || defined(SND_LIB_WINDSOUND) || defined(SND_LIB_MACSOUND) + +/* shortcut for conditional code in other files */ +#define SND_LIB_INTEGRATED + +#define Play_usersound(filename, vol, idx) \ + do { \ + if (iflags.sounds && !Deaf && soundprocs.sound_play_usersound \ + && ((soundprocs.sound_triggers & SOUND_TRIGGER_USERSOUNDS) != 0)) \ + (*soundprocs.sound_play_usersound)((filename), (vol), (idx)); \ + } while(0) + +#define Soundeffect(seid, vol) \ + do { \ + if (iflags.sounds && !Deaf && soundprocs.sound_soundeffect \ + && ((soundprocs.sound_triggers & SOUND_TRIGGER_SOUNDEFFECTS) != 0)) \ + (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \ + } while(0) + +/* Player's perspective, not the hero's; no Deaf suppression */ +#define SoundeffectEvenIfDeaf(seid, vol) \ + do { \ + if (iflags.sounds && !soundprocs.sound_soundeffect \ + && ((soundprocs.sound_triggers & SOUND_TRIGGER_SOUNDEFFECTS) != 0)) \ + (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \ + } while(0) + +#define Hero_playnotes(instrument, str, vol) \ + do { \ + if (iflags.sounds && !Deaf && soundprocs.sound_hero_playnotes \ + && ((soundprocs.sound_triggers & SOUND_TRIGGER_HEROMUSIC) != 0)) \ + (*soundprocs.sound_hero_playnotes)((instrument), (str), (vol)); \ + } while(0) + +/* Player's perspective, not the hero's; no Deaf suppression */ +#define SoundAchievement(arg1, arg2, avals) \ + do { \ + if (iflags.sounds && soundprocs.sound_achievement \ + && ((soundprocs.sound_triggers & SOUND_TRIGGER_ACHIEVEMENTS) != 0)) \ + (*soundprocs.sound_achievement)((arg1), (arg2), (avals)); \ + } while(0) + +/* sound_speak is in sound.c */ +#define SoundSpeak(text) \ + do { \ + if ((gp.pline_flags & (PLINE_VERBALIZE | PLINE_SPEECH)) != 0 \ + && soundprocs.sound_verbal && iflags.voices \ + && ((soundprocs.sound_triggers & SOUND_TRIGGER_VERBAL) != 0)) \ + sound_speak(text); \ + } while(0) + +/* set_voice is in sound.c */ +#define SetVoice(mon, tone, vol, moreinfo) \ + do { \ + set_voice(mon, tone, vol, moreinfo); \ + } while(0) + +/* void (*sound_achievement)(schar, schar, int32_t); */ + +#ifdef SOUNDLIBONLY +#undef SOUNDLIBONLY +#endif +#define SOUNDLIBONLY +#ifdef SND_SPEECH +#define VOICEONLY +#else +#define VOICEONLY UNUSED +#endif + +#else /* NO SOUNDLIB IS INTEGRATED AFTER THIS */ + +#ifdef SND_LIB_INTEGRATED +#undef SND_LIB_INTEGRATED +#endif +#define Play_usersound(filename, vol, idx) +#define Soundeffect(seid, vol) +#define Hero_playnotes(instrument, str, vol) +#define SoundAchievement(arg1, arg2, avals) +#define SoundSpeak(text) +#define SetVoice(mon, tone, vol, moreinfo) +#ifdef SOUNDLIBONLY +#undef SOUNDLIBONLY +#endif +#define SOUNDLIBONLY UNUSED +#ifdef SND_SPEECH +#undef SND_SPEECH +#endif +#ifdef VOICEONLY +#undef VOICEONLY +#endif +#define VOICEONLY UNUSED + +#endif /* No SOUNDLIB */ + +enum findsound_approaches { + findsound_embedded, + findsound_soundfile +}; + +enum sound_file_flags { + sff_default, /* add dir prefix + '/' + sound + suffix */ + sff_base_only, /* base sound name only, no dir, no suffix */ + sff_havedir_append_rest, /* dir provided, append base sound name+suffix */ + sff_baseknown_add_rest /* base is already known, add dir and suffix */ +}; + +#endif /* SNDPROCS_H */ diff --git a/include/sp_lev.h b/include/sp_lev.h index e38244b34..3aec7c2cf 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -1,11 +1,12 @@ -/* NetHack 3.6 sp_lev.h $NHDT-Date: 1544930819 2018/12/16 03:26:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ +/* NetHack 5.0 sp_lev.h $NHDT-Date: 1622361649 2021/05/30 08:00:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */ +/* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ #ifndef SP_LEV_H #define SP_LEV_H /* wall directions */ +#define W_RANDOM -1 #define W_NORTH 1 #define W_SOUTH 2 #define W_EAST 4 @@ -38,155 +39,15 @@ enum lvlinit_types { LVLINIT_NONE = 0, LVLINIT_SOLIDFILL, LVLINIT_MAZEGRID, + LVLINIT_MAZE, LVLINIT_MINES, - LVLINIT_ROGUE + LVLINIT_ROGUE, + LVLINIT_SWAMP }; -/* max. layers of object containment */ -#define MAX_CONTAINMENT 10 - -/* max. # of random registers */ -#define MAX_REGISTERS 10 - /* max. nested depth of subrooms */ #define MAX_NESTED_ROOMS 5 -/* max. # of opcodes per special level */ -#define SPCODER_MAX_RUNTIME 65536 - -/* Opcodes for creating the level - * If you change these, also change opcodestr[] in util/lev_main.c - */ -enum opcode_defs { - SPO_NULL = 0, - SPO_MESSAGE, - SPO_MONSTER, - SPO_OBJECT, - SPO_ENGRAVING, - SPO_ROOM, - SPO_SUBROOM, - SPO_DOOR, - SPO_STAIR, - SPO_LADDER, - SPO_ALTAR, - SPO_FOUNTAIN, - SPO_SINK, - SPO_POOL, - SPO_TRAP, - SPO_GOLD, - SPO_CORRIDOR, - SPO_LEVREGION, - SPO_DRAWBRIDGE, - SPO_MAZEWALK, - SPO_NON_DIGGABLE, - SPO_NON_PASSWALL, - SPO_WALLIFY, - SPO_MAP, - SPO_ROOM_DOOR, - SPO_REGION, - SPO_MINERALIZE, - SPO_CMP, - SPO_JMP, - SPO_JL, - SPO_JLE, - SPO_JG, - SPO_JGE, - SPO_JE, - SPO_JNE, - SPO_TERRAIN, - SPO_REPLACETERRAIN, - SPO_EXIT, - SPO_ENDROOM, - SPO_POP_CONTAINER, - SPO_PUSH, - SPO_POP, - SPO_RN2, - SPO_DEC, - SPO_INC, - SPO_MATH_ADD, - SPO_MATH_SUB, - SPO_MATH_MUL, - SPO_MATH_DIV, - SPO_MATH_MOD, - SPO_MATH_SIGN, - SPO_COPY, - SPO_END_MONINVENT, - SPO_GRAVE, - SPO_FRAME_PUSH, - SPO_FRAME_POP, - SPO_CALL, - SPO_RETURN, - SPO_INITLEVEL, - SPO_LEVEL_FLAGS, - SPO_VAR_INIT, /* variable_name data */ - SPO_SHUFFLE_ARRAY, - SPO_DICE, - - SPO_SEL_ADD, - SPO_SEL_POINT, - SPO_SEL_RECT, - SPO_SEL_FILLRECT, - SPO_SEL_LINE, - SPO_SEL_RNDLINE, - SPO_SEL_GROW, - SPO_SEL_FLOOD, - SPO_SEL_RNDCOORD, - SPO_SEL_ELLIPSE, - SPO_SEL_FILTER, - SPO_SEL_GRADIENT, - SPO_SEL_COMPLEMENT, - - MAX_SP_OPCODES -}; - -/* MONSTER and OBJECT can take a variable number of parameters, - * they also pop different # of values from the stack. So, - * first we pop a value that tells what the _next_ value will - * mean. - */ -/* MONSTER */ -enum sp_mon_var_flags { - SP_M_V_PEACEFUL = 0, - SP_M_V_ALIGN, - SP_M_V_ASLEEP, - SP_M_V_APPEAR, - SP_M_V_NAME, - SP_M_V_FEMALE, - SP_M_V_INVIS, - SP_M_V_CANCELLED, - SP_M_V_REVIVED, - SP_M_V_AVENGE, - SP_M_V_FLEEING, - SP_M_V_BLINDED, - SP_M_V_PARALYZED, - SP_M_V_STUNNED, - SP_M_V_CONFUSED, - SP_M_V_SEENTRAPS, - - SP_M_V_END -}; - -/* OBJECT */ -enum sp_obj_var_flags { - SP_O_V_SPE = 0, - SP_O_V_CURSE, - SP_O_V_CORPSENM, - SP_O_V_NAME, - SP_O_V_QUAN, - SP_O_V_BURIED, - SP_O_V_LIT, - SP_O_V_ERODED, - SP_O_V_LOCKED, - SP_O_V_TRAPPED, - SP_O_V_RECHARGED, - SP_O_V_INVIS, - SP_O_V_GREASED, - SP_O_V_BROKEN, - SP_O_V_COORD, - - SP_O_V_END -}; - /* When creating objects, we need to know whether * it's a container and/or contents. */ @@ -202,25 +63,6 @@ enum sp_obj_var_flags { #define SEL_GRADIENT_RADIAL 0 #define SEL_GRADIENT_SQUARE 1 -/* variable types */ -#define SPOVAR_NULL 0x00 -#define SPOVAR_INT 0x01 /* l */ -#define SPOVAR_STRING 0x02 /* str */ -#define SPOVAR_VARIABLE 0x03 /* str (contains the variable name) */ -#define SPOVAR_COORD \ - 0x04 /* coordinate, encoded in l; use SP_COORD_X() and SP_COORD_Y() */ -#define SPOVAR_REGION 0x05 /* region, encoded in l; use SP_REGION_X1() etc \ - */ -#define SPOVAR_MAPCHAR 0x06 /* map char, in l */ -#define SPOVAR_MONST \ - 0x07 /* monster class & specific monster, encoded in l; use SP_MONST_... \ - */ -#define SPOVAR_OBJ \ - 0x08 /* object class & specific object type, encoded in l; use \ - SP_OBJ_... */ -#define SPOVAR_SEL 0x09 /* selection. char[COLNO][ROWNO] in str */ -#define SPOVAR_ARRAY 0x40 /* used in splev_var & lc_vardefs, not in opvar */ - #define SP_COORD_IS_RANDOM 0x01000000L /* Humidity flags for get_location() and friends, used with * SP_COORD_PACK_RANDOM() */ @@ -232,137 +74,81 @@ enum sp_obj_var_flags { #define NO_LOC_WARN 0x20 /* no complaints and set x & y to -1, if no loc */ #define SPACELOC 0x40 /* like DRY, but accepts furniture too */ +/* has_invent flags */ +#define NO_INVENT 0 /* monster doesn't get any invent */ +#define CUSTOM_INVENT 0x01 /* monster gets items specified in lua */ +#define DEFAULT_INVENT 0x02 /* monster gets items from makemon() */ + #define SP_COORD_X(l) (l & 0xff) #define SP_COORD_Y(l) ((l >> 16) & 0xff) #define SP_COORD_PACK(x, y) (((x) & 0xff) + (((y) & 0xff) << 16)) #define SP_COORD_PACK_RANDOM(f) (SP_COORD_IS_RANDOM | (f)) -#define SP_REGION_X1(l) (l & 0xff) -#define SP_REGION_Y1(l) ((l >> 8) & 0xff) -#define SP_REGION_X2(l) ((l >> 16) & 0xff) -#define SP_REGION_Y2(l) ((l >> 24) & 0xff) -#define SP_REGION_PACK(x1, y1, x2, y2) \ - (((x1) & 0xff) + (((y1) & 0xff) << 8) + (((x2) & 0xff) << 16) \ - + (((y2) & 0xff) << 24)) - -/* permonst index, object index, and lit value might be negative; - * add 10 to accept -1 through -9 while forcing non-negative for bit shift - */ -#define SP_MONST_CLASS(l) ((l) & 0xff) -#define SP_MONST_PM(l) ((((l) >> 8) & 0xffff) - 10) -#define SP_MONST_PACK(pm, cls) (((10 + (pm)) << 8) | ((cls) & 0xff)) - -#define SP_OBJ_CLASS(l) ((l) & 0xff) -#define SP_OBJ_TYP(l) ((((l) >> 8) & 0xffff) - 10) -#define SP_OBJ_PACK(ob, cls) (((10 + (ob)) << 8) | ((cls) & 0xff)) - -#define SP_MAPCHAR_TYP(l) ((l) & 0xff) -#define SP_MAPCHAR_LIT(l) ((((l) >> 8) & 0xffff) - 10) -#define SP_MAPCHAR_PACK(typ, lit) (((10 + (lit)) << 8) | ((typ) & 0xff)) - -struct splev_var { - struct splev_var *next; - char *name; - xchar svtyp; /* SPOVAR_foo */ - union { - struct opvar *value; - struct opvar **arrayvalues; - } data; - long array_len; -}; - -struct splevstack { - long depth; - long depth_alloc; - struct opvar **stackdata; -}; - -struct sp_frame { - struct sp_frame *next; - struct splevstack *stack; - struct splev_var *variables; - long n_opcode; -}; - struct sp_coder { - struct splevstack *stack; - struct sp_frame *frame; int premapped; boolean solidify; struct mkroom *croom; + int room_stack; struct mkroom *tmproomlist[MAX_NESTED_ROOMS + 1]; boolean failed_room[MAX_NESTED_ROOMS + 1]; int n_subroom; - boolean exit_script; - int lvl_is_joined; + boolean lvl_is_joined; boolean check_inaccessibles; - - int opcode; /* current opcode */ - struct opvar *opdat; /* current push data (req. opcode == SPO_PUSH) */ + int allow_flips; }; -/* special level coder CPU flags */ -#define SP_CPUFLAG_LT 1 -#define SP_CPUFLAG_GT 2 -#define SP_CPUFLAG_EQ 4 -#define SP_CPUFLAG_ZERO 8 - /* * Structures manipulated by the special levels loader & compiler */ #define packed_coord long +typedef uint32_t getloc_flags_t; typedef struct { - xchar is_random; - long getloc_flags; + xint16 is_random; + getloc_flags_t getloc_flags; int x, y; } unpacked_coord; typedef struct { - int cmp_what; - int cmp_val; -} opcmp; - -typedef struct { - long jmp_target; -} opjmp; - -typedef union str_or_len { - char *str; - int len; -} Str_or_Len; - -typedef struct { - xchar init_style; /* one of LVLINIT_foo */ + xint16 init_style; /* one of LVLINIT_foo */ long flags; schar filling; boolean init_present, padding; char fg, bg; boolean smoothed, joined; - xchar lit, walled; + xint16 lit, walled; boolean icedpools; + int corrwid, wallthick; + boolean rm_deadends; } lev_init; typedef struct { - xchar wall, pos, secret, mask; + xint16 wall, pos, secret, mask; } room_door; typedef struct { packed_coord coord; - xchar x, y, type; + coordxy x, y; + xint16 type; + boolean spider_on_web; + boolean seen; + boolean novictim; } spltrap; typedef struct { Str_or_Len name, appear_as; short id; - aligntyp align; + unsigned int sp_amask; /* splev amask */ packed_coord coord; - xchar x, y, class, appear; + coordxy x, y; + xint16 class, appear; schar peaceful, asleep; short female, invis, cancelled, revived, avenge, fleeing, blinded, - paralyzed, stunned, confused; + paralyzed, stunned, confused, waiting; + short m_lev_adj; long seentraps; short has_invent; + mmflags_nht mm_flags; /* makemon flags */ } monster; typedef struct { @@ -370,189 +156,53 @@ typedef struct { int corpsenm; short id, spe; packed_coord coord; - xchar x, y, class, containment; + coordxy x, y; + xint16 class, containment; schar curse_state; int quan; short buried; short lit; - short eroded, locked, trapped, recharged, invis, greased, broken; + short eroded, locked, trapped, tknown, recharged, invis, greased, broken, + achievement; } object; typedef struct { packed_coord coord; - xchar x, y; - aligntyp align; - xchar shrine; + coordxy x, y; + unsigned int sp_amask; /* splev amask */ + xint16 shrine; } altar; typedef struct { - xchar x1, y1, x2, y2; - xchar rtype, rlit, rirreg; + coordxy x1, y1, x2, y2; + xint16 rtype, rlit, rirreg; } region; typedef struct { - xchar ter, tlit; + xint16 ter, tlit; } terrain; -typedef struct { - xchar chance; - xchar x1, y1, x2, y2; - xchar fromter, toter, tolit; -} replaceterrain; - -/* values for rtype are defined in dungeon.h */ typedef struct { struct { - xchar x1, y1, x2, y2; - } inarea; - struct { - xchar x1, y1, x2, y2; - } delarea; - boolean in_islev, del_islev; - xchar rtype, padding; - Str_or_Len rname; -} lev_region; - -typedef struct { - struct { - xchar room; - xchar wall; - xchar door; + xint16 room; + xint16 wall; + xint16 door; } src, dest; } corridor; typedef struct _room { Str_or_Len name; Str_or_Len parent; - xchar x, y, w, h; - xchar xalign, yalign; - xchar rtype, chance, rlit, filled, joined; + coordxy x, y; + xint16 w, h; + xint16 xalign, yalign; + xint16 rtype, chance, rlit, needfill; + boolean joined; } room; -typedef struct { - schar zaligntyp; - schar keep_region; - schar halign, valign; - char xsize, ysize; - char **map; -} mazepart; - -typedef struct { - int opcode; - struct opvar *opdat; -} _opcode; - -typedef struct { - _opcode *opcodes; - long n_opcodes; -} sp_lev; - -typedef struct { - xchar x, y, direction, count, lit; - char typ; -} spill; - -/* only used by lev_comp */ -struct lc_funcdefs_parm { - char *name; - char parmtype; - struct lc_funcdefs_parm *next; -}; - -struct lc_funcdefs { - struct lc_funcdefs *next; - char *name; - long addr; - sp_lev code; - long n_called; - struct lc_funcdefs_parm *params; - long n_params; +struct mapfragment { + int wid, hei; + char *data; }; -struct lc_vardefs { - struct lc_vardefs *next; - char *name; - long var_type; /* SPOVAR_foo */ - long n_used; -}; - -struct lc_breakdef { - struct lc_breakdef *next; - struct opvar *breakpoint; - int break_depth; -}; - -/* - * Quick! Avert your eyes while you still have a chance! - */ -#ifdef SPEC_LEV -/* compiling lev_comp rather than nethack */ -/* clang format off */ -#ifdef USE_OLDARGS -#ifndef VA_TYPE -typedef const char *vA; -#define VA_TYPE -#endif -/* hack to avoid "warning: cast to 'vA' (aka 'const char *') from smaller - integer type 'int' [-Wint-to-pointer-cast]" */ -#define vA_(a) ((vA) (long) a) -#undef VA_ARGS /* redefine with the maximum number actually used */ -#undef VA_SHIFT /* ditto */ -#undef VA_PASS1 -#define VA_ARGS \ - arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, \ - arg12, arg13, arg14 -/* Unlike in the core, lev_comp's VA_SHIFT should be completely safe, - because callers always pass all these arguments. */ -#define VA_SHIFT() \ - (arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \ - arg6 = arg7, arg7 = arg8, arg8 = arg9, arg9 = arg10, arg10 = arg11, \ - arg11 = arg12, arg12 = arg13, arg13 = arg14, arg14 = 0) -/* standard NULL may be either (void *)0 or plain 0, both of - which would need to be explicitly cast to (char *) here */ -#define VA_PASS1(a1) \ - vA_(a1), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS2(a1,a2) \ - vA_(a1), vA_(a2), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS3(a1,a2,a3) \ - vA_(a1), vA_(a2), vA_(a3), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS4(a1,a2,a3,a4) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS5(a1,a2,a3,a4,a5) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS7(a1,a2,a3,a4,a5,a6,a7) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS8(a1,a2,a3,a4,a5,a6,a7,a8) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(a8), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS9(a1,a2,a3,a4,a5,a6,a7,a8,a9) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(a8), \ - vA_(a9), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS14(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(a8), \ - vA_(a9), vA_(a10), vA_(a11), vA_(a12), vA_(a13), vA_(a14) -#else /*!USE_OLDARGS*/ -/* USE_STDARG and USE_VARARGS don't need to pass dummy arguments - or cast real ones */ -#define VA_PASS1(a1) a1 -#define VA_PASS2(a1,a2) a1, a2 -#define VA_PASS3(a1,a2,a3) a1, a2, a3 -#define VA_PASS4(a1,a2,a3,a4) a1, a2, a3, a4 -#define VA_PASS5(a1,a2,a3,a4,a5) a1, a2, a3, a4, a5 -#define VA_PASS7(a1,a2,a3,a4,a5,a6,a7) a1, a2, a3, a4, a5, a6, a7 -#define VA_PASS8(a1,a2,a3,a4,a5,a6,a7,a8) a1, a2, a3, a4, a5, a6, a7, a8 -#define VA_PASS9(a1,a2,a3,a4,a5,a6,a7,a8,a9) a1, a2, a3, a4, a5, a6, a7, a8, a9 -#define VA_PASS14(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \ - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 -#endif /*?USE_OLDARGS*/ -/* clang format on */ -/* You were warned to avert your eyes.... */ -#endif /*SPEC_LEV*/ - #endif /* SP_LEV_H */ diff --git a/include/spell.h b/include/spell.h index dbb8171ff..8f68f5c94 100644 --- a/include/spell.h +++ b/include/spell.h @@ -1,27 +1,38 @@ -/* NetHack 3.6 spell.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */ -/* Copyright 1986, M. Stephenson */ +/* NetHack 5.0 spell.h $NHDT-Date: 1646838388 2022/03/09 15:06:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $ */ +/* Copyright 1986, M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ #ifndef SPELL_H #define SPELL_H #define NO_SPELL 0 +#define UNKNOWN_SPELL (-1) /* spellbook re-use control; used when reading and when polymorphing */ #define MAX_SPELL_STUDY 3 struct spell { short sp_id; /* spell id (== object.otyp) */ - xchar sp_lev; /* power level */ - int sp_know; /* knowlege of spell */ + xint16 sp_lev; /* power level */ + int sp_know; /* knowledge of spell */ +}; + +enum spellknowledge { + spe_Forgotten = -1, /* known but no longer castable */ + spe_Unknown = 0, /* not yet known */ + spe_Fresh = 1, /* castable if various casting criteria are met */ + spe_GoingStale = 2 /* still castable but nearly forgotten */ }; /* levels of memory destruction with a scroll of amnesia */ #define ALL_MAP 0x1 #define ALL_SPELLS 0x2 -#define decrnknow(spell) spl_book[spell].sp_know-- -#define spellid(spell) spl_book[spell].sp_id -#define spellknow(spell) spl_book[spell].sp_know +#define decrnknow(spell) svs.spl_book[spell].sp_know-- +#define spellid(spell) svs.spl_book[spell].sp_id +#define spellknow(spell) svs.spl_book[spell].sp_know + +/* how much Pw a spell of level lvl costs to cast? */ +#define SPELL_LEV_PW(lvl) ((lvl) * 5) #endif /* SPELL_H */ diff --git a/include/stairs.h b/include/stairs.h new file mode 100644 index 000000000..e52ad7075 --- /dev/null +++ b/include/stairs.h @@ -0,0 +1,18 @@ +/* NetHack 5.0 stairs.h $NHDT-Date: 1685863327 2023/06/04 07:22:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */ +/* Copyright (c) 2024 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef STAIRS_H +#define STAIRS_H + +typedef struct stairway { /* basic stairway identifier */ + coordxy sx, sy; /* x / y location of the stair */ + d_level tolev; /* where does it go */ + boolean up; /* up or down? */ + boolean isladder; /* ladder or stairway? */ + boolean u_traversed; /* hero has traversed this stair */ + struct stairway *next; +} stairway; + +#endif /* STAIRS_H */ + diff --git a/include/sym.h b/include/sym.h new file mode 100644 index 000000000..6939a4943 --- /dev/null +++ b/include/sym.h @@ -0,0 +1,180 @@ +/* NetHack 5.0 sym.h $NHDT-Date: $ $NHDT-Branch: $ $NHDT-Revision: $ */ +/* Copyright (c) 2016 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef SYM_H +#define SYM_H + +/* + * Default characters for monsters. + */ +/* clang-format off */ +enum mon_defchars { +#define MONSYMS_DEFCHAR_ENUM +#include "defsym.h" +#undef MONSYMS_DEFCHAR_ENUM +}; +/* clang-format on */ + +enum mon_syms { +#define MONSYMS_S_ENUM +#include "defsym.h" +#undef MONSYMS_S_ENUM + + MAXMCLASSES /* number of monster classes */ +}; + +#ifndef MAKEDEFS_C +/* Default characters for dungeon surroundings and furniture */ +enum cmap_symbols { +#define PCHAR_S_ENUM +#include "defsym.h" +#undef PCHAR_S_ENUM + MAXPCHARS +}; + +/* + * special symbol set handling types ( for invoking callbacks, etc.) + * Must match the order of the known_handlers strings + * in drawing.c + */ + +enum symset_handling_types { + H_UNK = 0, + H_IBM = 1, + H_DEC = 2, + H_CURS = 3, + H_MAC = 4, /* obsolete; needed so that the listing of available + * symsets by 'O' can skip it for !MAC_GRAPHICS_ENV */ + H_UTF8 = 5 +}; + +struct symdef { + uchar sym; + const char *explanation; + uchar color; +}; + +enum symparse_range { + SYM_INVALID = 0, + SYM_CONTROL = 1, /* start/finish markers */ + SYM_PCHAR = 2, /* index into showsyms */ + SYM_OC = 3, /* index into oc_syms */ + SYM_MON = 4, /* index into monsyms */ + SYM_OTH = 5 /* misc */ +}; + +struct symparse { + enum symparse_range range; + int idx; + const char *name; +}; + +/* linked list of symsets and their characteristics */ +struct symsetentry { + struct symsetentry *next; /* next in list */ + char *name; /* ptr to symset name */ + char *desc; /* ptr to description */ + int idx; /* an index value */ + enum symset_handling_types handling; /* known handlers value */ + Bitfield(nocolor, 1); /* don't use color if set */ + Bitfield(primary, 1); /* restricted for use as primary set */ + Bitfield(rogue, 1); /* restricted for use as rogue lev set */ + Bitfield(explicitly, 1); /* explicit symset set */ + /* 4 free bits */ +}; + +/* + * + */ + +#define MAXDCHARS (S_water - S_stone + 1) /* mapped dungeon characters */ +#define MAXTCHARS (TRAPNUM - 1) /* trap chars */ +#define MAXECHARS (S_expl_br - S_vbeam + 1) /* mapped effects characters */ +#define MAXEXPCHARS 9 /* number of explosion characters */ + +#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom) + +#define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) < S_arrow_trap + MAXTCHARS) +#define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge) +#define is_cmap_door(i) ((i) >= S_vodoor && (i) <= S_hcdoor) +#define is_cmap_wall(i) ((i) >= S_stone && (i) <= S_trwall) +#define is_cmap_room(i) ((i) >= S_room && (i) <= S_darkroom) +#define is_cmap_corr(i) ((i) >= S_corr && (i) <= S_litcorr) +#define is_cmap_furniture(i) ((i) >= S_upstair && (i) <= S_fountain) +#define is_cmap_water(i) ((i) == S_pool || (i) == S_water) +#define is_cmap_lava(i) ((i) == S_lava || (i) == S_lavawall) +#define is_cmap_stairs(i) ((i) >= S_upstair && (i) <= S_brdnladder) +#define is_cmap_engraving(i) ((i) == S_engroom || (i) == S_engrcorr) + +/* misc symbol definitions */ +enum misc_symbols { + SYM_NOTHING = 0, + SYM_UNEXPLORED = 1, + SYM_BOULDER = 2, + SYM_INVISIBLE = 3, + SYM_PET_OVERRIDE = 4, + SYM_HERO_OVERRIDE = 5, + MAXOTHER +}; + +/* + * Graphics sets for display symbols + */ +#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */ +enum graphics_sets { + PRIMARYSET = 0, /* primary graphics set */ + ROGUESET = 1, /* rogue graphics set */ + NUM_GRAPHICS, + UNICODESET = NUM_GRAPHICS +}; + +enum do_customizations { + do_custom_none, + do_custom_colors, + do_custom_symbols +}; + +enum customization_types { custom_none, custom_symbols, + custom_ureps, custom_nhcolor, custom_count }; + +struct custom_symbol { + const struct symparse *symparse; + unsigned char val; +}; +struct custom_urep { + int glyphidx; + struct unicode_representation u; +}; +struct custom_nhcolor { + int glyphidx; + uint32 nhcolor; +}; +union customization_content { + struct custom_symbol sym; + struct custom_urep urep; + struct custom_nhcolor ccolor; +}; +struct customization_detail { + union customization_content content; + struct customization_detail *next; +}; + + +/* one set per symset_name */ +struct symset_customization { + const char *customization_name; + int count; + enum customization_types custtype; + struct customization_detail *details; + struct customization_detail *details_end; +}; + +extern const struct symdef defsyms[MAXPCHARS + 1]; /* defaults */ +#define WARNCOUNT 6 /* number of different warning levels */ +extern const struct symdef def_warnsyms[WARNCOUNT]; +#define SYMHANDLING(ht) (gs.symset[gc.currentgraphics].handling == (ht)) + +#endif /* !MAKEDEFS_C */ +#endif /* SYM_H */ + diff --git a/include/sys.h b/include/sys.h index ed2f57859..2ea704cdb 100644 --- a/include/sys.h +++ b/include/sys.h @@ -1,11 +1,11 @@ -/* NetHack 3.6 sys.h $NHDT-Date: 1449296291 2015/12/05 06:18:11 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.27 $ */ +/* NetHack 5.0 sys.h $NHDT-Date: 1693083207 2023/08/26 20:53:27 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.41 $ */ /* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef SYS_H #define SYS_H -struct sysopt { +struct sysopt_s { char *support; /* local support contact */ char *recover; /* how to run recover - may be overridden by win port */ char *wizards; /* space-separated list of usernames */ @@ -15,6 +15,7 @@ struct sysopt { char *shellers; /* like wizards, for ! command (-DSHELL); also ^Z */ char *genericusers; /* usernames that prompt for user name */ char *debugfiles; /* files to show debugplines in. '*' is all. */ + char *msghandler; #ifdef DUMPLOG char *dumplogfile; /* where the dump file is saved */ #endif @@ -28,6 +29,7 @@ struct sysopt { int check_save_uid; /* restoring savefile checks UID? */ int check_plname; /* use plname for checking wizards/explorers/shellers */ int bones_pools; + long livelog; /* LL_foo events to livelog */ /* record file */ int persmax; @@ -39,17 +41,26 @@ struct sysopt { /* panic options */ char *gdbpath; char *greppath; + char *crashreporturl; int panictrace_gdb; int panictrace_libc; + /* save and bones format */ + int saveformat[2]; /* primary and onetime conversion */ + int bonesformat[2]; /* primary and onetime conversion */ + /* enable accessibility options */ int accessibility; #ifdef WIN32 - int portable_device_paths; /* nethack configuration for a portable device */ + int portable_device_paths; /* nethack config for a portable device */ #endif + + /* nethack's interactive help menu */ + int hideusage; /* 0: include 'command-line usage' entry in help menu; + * 1: suppress it */ }; -extern struct sysopt sysopt; +extern struct sysopt_s sysopt; #define SYSOPT_SEDUCE sysopt.seduce diff --git a/include/tile2x11.h b/include/tile2x11.h index 802cbd853..ffdfda291 100644 --- a/include/tile2x11.h +++ b/include/tile2x11.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 tile2x11.h $NHDT-Date: 1524689515 2018/04/25 20:51:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ */ +/* NetHack 5.0 tile2x11.h $NHDT-Date: 1597274123 2020/08/12 23:15:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.12 $ */ /* Copyright (c) 2002 by David Cohrs */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,7 +6,10 @@ #define TILE2X11_H /* - * Header for the x11 tile map. + * Header for the X11 tile map. + * + * dat/x11tiles is used by Qt for fallback if nhtiles.bmp is inaccessible, + * so this header is used by Qt as well as by X11. */ typedef struct { unsigned long version; diff --git a/include/tileset.h b/include/tileset.h index 2ab145e66..ef432732f 100644 --- a/include/tileset.h +++ b/include/tileset.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 tileset.h $NHDT-Date: 1457207052 2016/03/05 19:44:12 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.0 $ */ +/* NetHack 5.0 tileset.h $NHDT-Date: 1596498564 2020/08/03 23:49:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $ */ /* Copyright (c) Ray Chason, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -16,10 +16,16 @@ struct TileImage { unsigned char *indexes; /* for paletted images */ }; -boolean FDECL(read_tiles, (const char *filename, BOOLEAN_P true_color)); -const struct Pixel *NDECL(get_palette); -void NDECL(free_tiles); -const struct TileImage *FDECL(get_tile, (unsigned tile_index)); +boolean read_tiles(const char *filename, boolean true_color); +const struct Pixel *get_palette(void); +void set_tile_type(boolean true_color); +void free_tiles(void); +const struct TileImage *get_tile(unsigned tile_index); + +/* For resizing tiles */ +struct TileImage *stretch_tile(const struct TileImage *, unsigned, + unsigned); +void free_tile(struct TileImage *); /* Used internally by the tile set code */ struct TileSetImage { @@ -28,7 +34,7 @@ struct TileSetImage { struct Pixel *pixels; /* for direct color */ unsigned char *indexes; /* for paletted images */ struct Pixel palette[256]; - + /* Image description from the file */ char *image_desc; @@ -36,8 +42,8 @@ struct TileSetImage { unsigned tile_width, tile_height; }; -boolean FDECL(read_bmp_tiles, (const char *filename, struct TileSetImage *image)); -boolean FDECL(read_gif_tiles, (const char *filename, struct TileSetImage *image)); -boolean FDECL(read_png_tiles, (const char *filename, struct TileSetImage *image)); +boolean read_bmp_tiles(const char *filename, struct TileSetImage *image); +boolean read_gif_tiles(const char *filename, struct TileSetImage *image); +boolean read_png_tiles(const char *filename, struct TileSetImage *image); #endif diff --git a/include/timeout.h b/include/timeout.h index 0ac85a3c8..946959ae9 100644 --- a/include/timeout.h +++ b/include/timeout.h @@ -1,20 +1,21 @@ -/* NetHack 3.6 timeout.h $NHDT-Date: 1564269131 2019/07/27 23:12:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ */ -/* Copyright 1994, Dean Luick */ +/* NetHack 5.0 timeout.h $NHDT-Date: 1705087443 2024/01/12 19:24:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.23 $ */ +/* Copyright 1994, Dean Luick */ /* NetHack may be freely redistributed. See license for details. */ #ifndef TIMEOUT_H #define TIMEOUT_H /* generic timeout function */ -typedef void FDECL((*timeout_proc), (ANY_P *, long)); +typedef void (*timeout_proc)(ANY_P *, long); /* kind of timer */ enum timer_type { - TIMER_LEVEL = 0, /* event specific to level [melting ice] */ - TIMER_GLOBAL = 1, /* event follows current play [not used] */ - TIMER_OBJECT = 2, /* event follows an object [various] */ - TIMER_MONSTER = 3, /* event follows a monster [not used] */ - NUM_TIMER_KINDS /* 4 */ + TIMER_NONE = 0, + TIMER_LEVEL = 1, /* event specific to level [melting ice] */ + TIMER_GLOBAL = 2, /* event follows current play [not used] */ + TIMER_OBJECT = 3, /* event follows an object [various] */ + TIMER_MONSTER = 4, /* event follows a monster [not used] */ + NUM_TIMER_KINDS /* 5 */ }; /* save/restore timer ranges */ @@ -22,21 +23,41 @@ enum timer_type { #define RANGE_GLOBAL 1 /* save/restore timers following global play */ /* - * Timeout functions. Add a define here, then put it in the table + * Timeout functions. Add an enum here, then put it in the table * in timeout.c. "One more level of indirection will fix everything." + * Also add it to timerstr[] in nhl_get_timertype(nhlua.c); the entries + * there match these but are spelled differently. + * + * Note: if any are inserted, removed, or reordered then EDITLEVEL + * needs to be incremented because timeout indices get written into save + * and bones files if any timers are present while saving. (Adding new + * ones at the end isn't restricted this way since new indices won't be + * present in old data.) */ enum timeout_types { ROT_ORGANIC = 0, /* for buried organics */ ROT_CORPSE, REVIVE_MON, + ZOMBIFY_MON, BURN_OBJECT, HATCH_EGG, FIG_TRANSFORM, + SHRINK_GLOB, MELT_ICE_AWAY, NUM_TIME_FUNCS }; +#define timer_is_pos(ttype) ((ttype) == MELT_ICE_AWAY) +#define timer_is_obj(ttype) ((ttype) == ROT_ORGANIC \ + || (ttype) == ROT_CORPSE \ + || (ttype) == REVIVE_MON \ + || (ttype) == ZOMBIFY_MON \ + || (ttype) == BURN_OBJECT \ + || (ttype) == HATCH_EGG \ + || (ttype) == FIG_TRANSFORM \ + || (ttype) == SHRINK_GLOB) + /* used in timeout.c */ typedef struct fe { struct fe *next; /* next item in chain */ diff --git a/include/trap.h b/include/trap.h index ef9392939..d756cde03 100644 --- a/include/trap.h +++ b/include/trap.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.h $NHDT-Date: 1547255912 2019/01/12 01:18:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ */ +/* NetHack 5.0 trap.h $NHDT-Date: 1670316586 2022/12/06 08:49:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.31 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -17,19 +17,20 @@ union vlaunchinfo { struct trap { struct trap *ntrap; - xchar tx, ty; - d_level dst; /* destination for portals */ + coordxy tx, ty; + d_level dst; /* destination for portals/holes/trapdoors */ coord launch; +#define teledest launch /* x,y destination for teleport traps, if > 0 */ Bitfield(ttyp, 5); Bitfield(tseen, 1); Bitfield(once, 1); Bitfield(madeby_u, 1); /* So monsters may take offence when you trap - them. Recognizing who made the trap isn't - completely unreasonable, everybody has - their own style. This flag is also needed - when you untrap a monster. It would be too - easy to make a monster peaceful if you could - set a trap for it and then untrap it. */ + * them. Recognizing who made the trap isn't + * completely unreasonable; everybody has + * their own style. This flag is also needed + * when you untrap a monster. It would be too + * easy to make a monster peaceful if you could + * set a trap for it and then untrap it. */ union vlaunchinfo vl; #define launch_otyp vl.v_launch_otyp #define launch2 vl.v_launch2 @@ -37,7 +38,6 @@ struct trap { #define tnote vl.v_tnote }; -extern struct trap *ftrap; #define newtrap() (struct trap *) alloc(sizeof(struct trap)) #define dealloc_trap(trap) free((genericptr_t)(trap)) @@ -55,6 +55,7 @@ extern struct trap *ftrap; /* unconditional traps */ enum trap_types { + ALL_TRAPS = -1, /* mon_knows_traps(), mon_learns_traps() */ NO_TRAP = 0, ARROW_TRAP = 1, DART_TRAP = 2, @@ -78,12 +79,50 @@ enum trap_types { MAGIC_TRAP = 20, ANTI_MAGIC = 21, POLY_TRAP = 22, - VIBRATING_SQUARE = 23, + VIBRATING_SQUARE = 23, /* not a trap but shown/remembered as if one + * once it has been discovered */ - TRAPNUM = 24 + /* trapped door and trapped chest aren't traps on the map, but they + might be shown/remembered as such after trap detection until hero + comes in view of them and sees the feature or object; + key-using or door-busting monsters who survive a door trap learn + to avoid other such doors [not implemented] */ + TRAPPED_DOOR = 24, /* part of door; not present on map as a trap */ + TRAPPED_CHEST = 25, /* part of object; not on map */ + + TRAPNUM = 26 +}; + +/* some trap-related function return results */ +enum trap_result { + Trap_Effect_Finished = 0, + Trap_Is_Gone = 0, + Trap_Caught_Mon = 1, + Trap_Killed_Mon = 2, + Trap_Moved_Mon = 3, /* new location, or new level */ }; +/* return codes from immune_to_trap() */ +enum trap_immunities { + TRAP_NOT_IMMUNE = 0, + TRAP_CLEARLY_IMMUNE = 1, + TRAP_HIDDEN_IMMUNE = 2, +}; + + #define is_pit(ttyp) ((ttyp) == PIT || (ttyp) == SPIKED_PIT) #define is_hole(ttyp) ((ttyp) == HOLE || (ttyp) == TRAPDOOR) +#define unhideable_trap(ttyp) ((ttyp) == HOLE) /* visible traps */ +#define undestroyable_trap(ttyp) ((ttyp) == MAGIC_PORTAL \ + || (ttyp) == VIBRATING_SQUARE) +#define is_magical_trap(ttyp) ((ttyp) == TELEP_TRAP \ + || (ttyp) == LEVEL_TELEP \ + || (ttyp) == MAGIC_TRAP \ + || (ttyp) == ANTI_MAGIC \ + || (ttyp) == POLY_TRAP) +/* "transportation" traps */ +#define is_xport(ttyp) ((ttyp) >= TELEP_TRAP && (ttyp) <= MAGIC_PORTAL) +#define fixed_tele_trap(t) ((t)->ttyp == TELEP_TRAP \ + && isok((t)->teledest.x,(t)->teledest.y)) #endif /* TRAP_H */ diff --git a/include/vision.h b/include/vision.h index 4b1f1a746..b0728f763 100644 --- a/include/vision.h +++ b/include/vision.h @@ -1,16 +1,10 @@ -/* NetHack 3.6 vision.h $NHDT-Date: 1559994624 2019/06/08 11:50:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.10 $ */ +/* NetHack 5.0 vision.h $NHDT-Date: 1666478832 2022/10/22 22:47:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */ -/* NetHack may be freely redistributed. See license for details. */ +/* NetHack may be freely redistributed. See license for details. */ #ifndef VISION_H #define VISION_H -#if 0 /* (moved to decl.h) */ -extern boolean vision_full_recalc; /* TRUE if need vision recalc */ -extern char **viz_array; /* could see/in sight row pointers */ -extern char *viz_rmin; /* min could see indices */ -extern char *viz_rmax; /* max could see indices */ -#endif #define COULD_SEE 0x1 /* location could be seen, if it were lit */ #define IN_SIGHT 0x2 /* location can be seen */ #define TEMP_LIT 0x4 /* location is temporarily lit */ @@ -18,28 +12,32 @@ extern char *viz_rmax; /* max could see indices */ /* * Light source sources */ -#define LS_OBJECT 0 -#define LS_MONSTER 1 +enum ls_sources { + LS_NONE = 0, + LS_OBJECT = 1, + LS_MONSTER = 2, + NUM_LS_SOURCES +}; /* - * cansee() - Returns true if the hero can see the location. + * cansee() - Returns true if the hero can see the location. * - * couldsee() - Returns true if the hero has a clear line of sight to - * the location. + * couldsee() - Returns true if the hero has a clear line of sight to + * the location. */ -#define cansee(x, y) (viz_array[y][x] & IN_SIGHT) -#define couldsee(x, y) (viz_array[y][x] & COULD_SEE) -#define templit(x, y) (viz_array[y][x] & TEMP_LIT) +#define cansee(x, y) ((gv.viz_array[y][x] & IN_SIGHT) != 0) +#define couldsee(x, y) ((gv.viz_array[y][x] & COULD_SEE) != 0) +#define templit(x, y) ((gv.viz_array[y][x] & TEMP_LIT) != 0) /* * The following assume the monster is not blind. * - * m_cansee() - Returns true if the monster can see the given location. + * m_cansee() - Returns true if the monster can see the given location. * * m_canseeu() - Returns true if the monster could see the hero. Assumes - * that if the hero has a clear line of sight to the monster's - * location and the hero is visible, then monster can see the - * hero. + * that if the hero has a clear line of sight to the monster's + * location and the hero is visible, then monster can see the + * hero. */ #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2)) diff --git a/include/vmsconf.h b/include/vmsconf.h index dbfbff948..a4d1eb724 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 vmsconf.h $NHDT-Date: 1555361299 2019/04/15 20:48:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 5.0 vmsconf.h $NHDT-Date: 1596498569 2020/08/03 23:49:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -17,7 +17,7 @@ * extra room for patching longer values into an existing executable. */ #define Local_WIZARD "NHWIZARD\0\0\0\0" -#define Local_HACKDIR "DISK$USERS:[GAMES.NETHACK.3_5_X.PLAY]\0\0\0\0\0\0\0\0" +#define Local_HACKDIR "DISK$USERS:[GAMES.NETHACK.3_7_X.PLAY]\0\0\0\0\0\0\0\0" /* * This section cleans up the stuff done in config.h so that it @@ -92,17 +92,6 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then */ #define SELECTSAVED -/* - * You may define TEXTCOLOR if your system has any terminals that recognize - * ANSI color sequences of the form ``[#;#m'', where the first # is - * a number between 40 and 47 represented background color, and the second - * # is a number between 30 and 37 representing the foreground color. - * GIGI terminals and DECterm windows on color VAXstations support these - * color escape sequences, as do some 3rd party terminals and many micro - * computers. - */ -/* #define TEXTCOLOR */ - /* * If you define USE_QIO_INPUT, then you'll get raw characters from the * keyboard, not unlike those of the unix version of Nethack. This will @@ -162,20 +151,23 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then /* config.h defines USE_ISAAC64; we'll use it on Alpha or IA64 but not VAX; it overrides RANDOM */ +#if !defined(VMSVSI) #if (defined(VAX) || defined(vax) || defined(__vax)) && defined(USE_ISAAC64) #undef ISAAC64 #endif +#endif #define FCMASK 0660 /* file creation mask */ /* - * + * The remainder of the file should not need to be changed. */ -#define NO_VSNPRINTF /* Avoid vsnprintf, use less-safe vsprintf instead. */ -/* - * The remainder of the file should not need to be changed. +/* This used to be force-defined for VMS in topten.c, but with + * the global variable consolidation into g in 5.0, it has to be + * defined here so that decl.h includes the field in g. */ +#define UPDATE_RECORD_IN_PLACE /* data librarian defs */ #ifdef DLB @@ -188,6 +180,7 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then /* # define FILENAME_CMP strcmpi */ /* case insensitive */ #endif +#ifndef VMSVSI #if defined(VAXC) && !defined(ANCIENT_VAXC) #ifdef volatile #undef volatile @@ -212,6 +205,19 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then #define ALLOCA_HACK /* used in util/panic.c */ #endif #endif +#endif /* !VMSVSI */ + +#ifdef VMSVSI +#define NO_TERMCAP_HEADERS +/* C99 */ +#include +#include +#include +#include +#include +#include +#include +#endif #ifdef _DECC_V4_SOURCE /* excludes some necessary typedefs when _DECC_V4_SOURCE is defined @@ -233,9 +239,13 @@ typedef __gid_t gid_t; #define __MODE_T typedef __mode_t mode_t; #endif +#ifndef __OFF_T +#define __OFF_T +typedef int32_t off_t; +#endif #endif /* _DECC_V4_SOURCE */ -#include +#ifndef VMSVSI #if 0 /* is missing for old gcc versions; skip it to save time */ #include #else /* values needed from missing include file */ @@ -245,19 +255,19 @@ typedef __mode_t mode_t; #define O_CREAT 0x200 #define O_TRUNC 0x400 #endif +#endif #define tgetch vms_getchar +#ifndef VMSVSI #if defined(__DECC_VER) && (__DECC_VER >= 50000000) /* for cc/Standard=ANSI89, suppress notification that '$' in identifiers is an extension; sys/vms/*.c needs it regardless of strict ANSI mode */ # pragma message disable DOLLARID #endif +#endif -#include "system.h" - -#define index strchr -#define rindex strrchr +/* #include "system.h" */ /* Use the high quality random number routines. */ #ifndef USE_ISAAC64 @@ -274,6 +284,7 @@ typedef __mode_t mode_t; # endif #endif +#if !defined(VMSVSI) #ifndef __GNUC__ #ifndef bcopy #define bcopy(s, d, n) memcpy((d), (s), (n)) /* vaxcrtl */ @@ -286,27 +297,31 @@ typedef __mode_t mode_t; #define link(f1, f2) vms_link(f1, f2) /* vmsfiles.c */ #define open(f, k, m) vms_open(f, k, m) /* vmsfiles.c */ #define fopen(f, m) vms_fopen(f, m) /* vmsfiles.c */ -/* #define unlink(f0) vms_unlink(f0) /* vmsfiles.c */ +/* #define unlink(f0) vms_unlink(f0) */ /* vmsfiles.c */ #ifdef VERYOLD_VMS #define unlink(f0) delete (f0) /* vaxcrtl */ #else #define unlink(f0) remove(f0) /* vaxcrtl, decc$shr */ #endif +#endif /* VMSVSI */ + #define C$$TRANSLATE(n) c__translate(n) /* vmsfiles.c */ +#if !defined(VMSVSI) /* VMS global names are case insensitive... */ #define An vms_an #define The vms_the #define Shk_Your vms_shk_your +#endif /* VMSVSI */ /* avoid global symbol in Alpha/VMS V1.5 STARLET library (link trouble) */ #define ospeed vms_ospeed /* used in several files which don't #include "extern.h" */ -extern void FDECL(vms_exit, (int)); -extern int FDECL(vms_open, (const char *, int, unsigned)); -extern FILE *FDECL(vms_fopen, (const char *, const char *)); -char *FDECL(vms_basename, (const char *)); /* vmsfiles.c */ +extern void vms_exit(int); +extern int vms_open(const char *, int, unsigned); +extern FILE *vms_fopen(const char *, const char *); +char *vms_basename(const char *, boolean); /* vmsfiles.c */ #endif /* VMSCONF_H */ #endif /* VMS */ diff --git a/include/warnings.h b/include/warnings.h new file mode 100644 index 000000000..9f2858a3d --- /dev/null +++ b/include/warnings.h @@ -0,0 +1,124 @@ +/* NetHack 5.0 warnings.h $NHDT-Date: 1596498562 2020/08/03 23:49:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.24 $ */ +/* Copyright (c) Michael Allison, 2021. */ + +#ifndef WARNINGS_H +#define WARNINGS_H + +/* + * If ENABLE_WARNING_PRAGMAS is defined, the checks for various + * compilers is activated. + * + * If a suitable compiler is found, STDC_Pragma_AVAILABLE will be defined. + * When STDC_Pragma_AVAILABLE is not defined, these are defined as no-ops: + * DISABLE_WARNING_UNREACHABLE_CODE + * DISABLE_WARNING_CONDEXPR_IS_CONSTANT + * DISABLE_WARNING_FORMAT_NONLITERAL + * ... + * RESTORE_WARNINGS + * RESTORE_WARNING_CONDEXPR_IS_CONSTANT + * RESTORE_WARNING_FORMAT_NONLITERAL + * + */ + +#if !defined(DISABLE_WARNING_PRAGMAS) +#if defined(__STDC_VERSION__) +#if __STDC_VERSION__ >= 199901L +#define ACTIVATE_WARNING_PRAGMAS +#endif /* __STDC_VERSION >= 199901L */ +#endif /* __STDC_VERSION */ +#if defined(_MSC_VER) +#ifndef ACTIVATE_WARNING_PRAGMAS +#define ACTIVATE_WARNING_PRAGMAS +#endif +#endif +#if defined(__GNUC__) || defined(__clang__) +#if defined(__cplusplus) +#ifndef ACTIVATE_WARNING_PRAGMAS +#define ACTIVATE_WARNING_PRAGMAS +#endif +#endif /* __cplusplus */ +#endif /* __GNUC__ || __clang__ */ + +#ifdef ACTIVATE_WARNING_PRAGMAS +#if defined(__clang__) +#define DISABLE_WARNING_UNREACHABLE_CODE \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wunreachable-code\"") +#define DISABLE_WARNING_FORMAT_NONLITERAL \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"") +#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("clang diagnostic pop") +#define RESTORE_WARNING_UNREACHABLE_CODE _Pragma("clang diagnostic pop") +#define RESTORE_WARNINGS _Pragma("clang diagnostic pop") +#define STDC_Pragma_AVAILABLE + +#elif defined(__GNUC__) +/* unlike in clang, -Wunreachable-code does not function in later versions + of gcc [this may be an issue of requiring -O1 or higher] */ +#define DISABLE_WARNING_UNREACHABLE_CODE \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wunreachable-code\"") +#define DISABLE_WARNING_FORMAT_NONLITERAL \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") +#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("GCC diagnostic pop") +#define RESTORE_WARNING_UNREACHABLE_CODE _Pragma("GCC diagnostic pop") +#define RESTORE_WARNINGS _Pragma("GCC diagnostic pop") +#define STDC_Pragma_AVAILABLE + +#elif defined(_MSC_VER) +#if _MSC_VER > 1916 +#define DISABLE_WARNING_UNREACHABLE_CODE \ + _Pragma("warning( push )") \ + _Pragma("warning( disable : 4702 )") +#define DISABLE_WARNING_FORMAT_NONLITERAL \ + _Pragma("warning( push )") \ + _Pragma("warning( disable : 4774 )") +#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT \ + _Pragma("warning( push )") \ + _Pragma("warning( disable : 4127 )") +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT _Pragma("warning( pop )") +#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("warning( pop )") +#define RESTORE_WARNING_UNREACHABLE_CODE _Pragma("warning( pop )") +#define RESTORE_WARNINGS _Pragma("warning( pop )") +#define STDC_Pragma_AVAILABLE +#else /* Visual Studio prior to 2019 below */ +#define DISABLE_WARNING_UNREACHABLE_CODE \ + __pragma(warning(push)) \ + __pragma(warning(disable:4702)) +#define DISABLE_WARNING_FORMAT_NONLITERAL \ + __pragma(warning(push)) \ + __pragma(warning(disable:4774)) +#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT \ + __pragma(warning(push)) \ + __pragma(warning(disable:4127)) +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT __pragma(warning(pop)) +#define RESTORE_WARNING_FORMAT_NONLITERAL __pragma(warning(pop)) +#define RESTORE_WARNING_UNREACHABLE_CODE __pragma(warning(pop)) +#define RESTORE_WARNINGS __pragma(warning(pop)) +#define STDC_Pragma_AVAILABLE +#endif /* vs2019 or vs2017 */ + +#endif /* various compiler detections */ +#endif /* ACTIVATE_WARNING_PRAGMAS */ +#else /* DISABLE_WARNING_PRAGMAS */ +#if defined(STDC_Pragma_AVAILABLE) +#undef STDC_Pragma_AVAILABLE +#endif +#endif /* DISABLE_WARNING_PRAGMAS */ + +#if !defined(STDC_Pragma_AVAILABLE) +#define DISABLE_WARNING_UNREACHABLE_CODE +#define DISABLE_WARNING_FORMAT_NONLITERAL +#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_FORMAT_NONLITERAL +#define RESTORE_WARNING_UNREACHABLE_CODE +#define RESTORE_WARNINGS +#endif + +#endif /* WARNINGS_H */ diff --git a/include/weight.h b/include/weight.h new file mode 100644 index 000000000..967ba0f0e --- /dev/null +++ b/include/weight.h @@ -0,0 +1,34 @@ +/* NetHack 5.0 weight.h $NHDT-Date: 1742427965 2025/03/19 23:46:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1 $ */ +/* Copyright (c) Michael Allison, 2025. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef WEIGHT_H +#define WEIGHT_H + +/* weight-related constants and thresholds */ +enum weight_constants { + WT_ETHEREAL = 0, + WT_SPLASH_THRESHOLD = 9, /* weight needed to make splash in water */ + WT_WEIGHTCAP_STRCON = 25, /* str + con multiplied by this for conv to + * carrying capacity in weight_cap() */ + WT_WEIGHTCAP_SPARE = 50, /* used in weight_cap calc */ + WT_JELLY = 50, /* weight of jelly body */ + WT_WOUNDEDLEG_REDUCT = 100, /* wounded legs reduce carrcap by this */ + WT_TO_DMG = 100, /* divisor to convert weight to dmg amt */ + WT_IRON_BALL_INCR = 160, /* weight increment of heavy iron ball */ + WT_IRON_BALL_BASE = 480, /* base starting weight of iron ball */ + WT_NOISY_INV = 500, /* inv_weight() max for noisy fumbling */ + WT_NYMPH = 600, /* weight of nymph body */ + WT_TOOMUCH_DIAGONAL = 600, /* weight_cap threshold for diag squeeze */ + WT_ELF = 800, /* weight of elf body */ + WT_SQUEEZABLE_INV = 850, /* inv_weight() maximum for squeezing */ + MAX_CARR_CAP = 1000, /* max carrying capacity, so that + * boulders can be heavier */ + WT_HUMAN = 1450, /* weight of human body */ + WT_BABY_DRAGON = 1500, /* weight of baby dragon body */ + WT_DRAGON = 4500, /* weight of dragon body */ +}; + +#endif /* WEIGHT_H */ + + diff --git a/include/winX.h b/include/winX.h index a1a560528..495a2d29f 100644 --- a/include/winX.h +++ b/include/winX.h @@ -1,16 +1,19 @@ -/* NetHack 3.6 winX.h $NHDT-Date: 1457079196 2016/03/04 08:13:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.23 $ */ +/* NetHack 5.0 winX.h $NHDT-Date: 1740795096 2025/02/28 18:11:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.65 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ /* - * Definitions for the X11 window-port. See doc/window.doc for details on + * Definitions for the X11 window-port. See doc/window.txt for details on * the window interface. */ #ifndef WINX_H #define WINX_H -#ifndef E -#define E extern +#ifndef COLOR_H +#include "color.h" /* CLR_MAX */ +#endif +#ifndef WINTYPE_H +#include "wintype.h" /* winid */ #endif #if defined(BOS) || defined(NHSTDC) @@ -23,6 +26,19 @@ #endif #endif +/* winX.c uses XtOffset() and the way that that macro is defined in + triggers "performing pointer subtraction with + a null pointer has undefined behavior" warnings; this modified + edition doesn't guarantee defined behavior but does silence those + warnings without needing to know whether current compiler version + supports the '-Wno-null-pointer-subtraction' option */ +#ifdef XtOffset +#undef XtOffset +#define XtOffset(p_type,field) \ + ((Cardinal) (((ptrdiff_t) (char *) (&(((p_type) NULL)->field))) \ + - ((ptrdiff_t) (char *) NULL))) +#endif + /* * Generic text buffer. */ @@ -37,15 +53,24 @@ struct text_buffer { /* * Information specific to a map window. */ +#ifdef ENHANCED_SYMBOLS +typedef uint32 X11_map_symbol; +typedef uint32 X11_color; +#else +typedef char X11_map_symbol; +typedef unsigned char X11_color; +#endif struct text_map_info_t { - unsigned char text[ROWNO][COLNO]; /* Actual displayed screen. */ -#ifdef TEXTCOLOR - unsigned char colors[ROWNO][COLNO]; /* Color of each character. */ + X11_map_symbol text[ROWNO][COLNO]; /* Actual displayed screen. */ + X11_color colors[ROWNO][COLNO]; /* Color of each character. */ + X11_color framecolors[ROWNO][COLNO]; /* Color of background + behind text */ GC color_gcs[CLR_MAX], /* GC for each color */ inv_color_gcs[CLR_MAX]; /* GC for each inverse color */ #define copy_gc color_gcs[NO_COLOR] #define inv_copy_gc inv_color_gcs[NO_COLOR] -#else +#if 0 + /* was else from old textcolor days */ GC copy_gc, /* Drawing GC */ inv_copy_gc; /* Inverse drawing GC */ #endif @@ -54,11 +79,17 @@ struct text_map_info_t { square_height, /* we can calculate the correct */ square_ascent, /* placement of changes. */ square_lbearing; + +#ifdef ENHANCED_SYMBOLS + XFontStruct *font; +#endif }; struct tile_glyph_info_t { unsigned short glyph; - unsigned special; + unsigned short tileidx; + unsigned glyphflags; + uint32 framecolor; }; struct tile_map_info_t { @@ -77,7 +108,7 @@ struct tile_map_info_t { struct map_info_t { Dimension viewport_width, /* Saved viewport size, so we can */ viewport_height; /* clip to cursor on a resize. */ - unsigned char t_start[ROWNO], /* Starting column for new info. */ + coordxy t_start[ROWNO], /* Starting column for new info. */ t_stop[ROWNO]; /* Ending column for new info. */ boolean is_tile; /* true if currently using tiles */ @@ -115,10 +146,18 @@ struct mesg_info_t { }; /* - * Information specific to a "text" status window. + * Information specific to "fancy", "text", or "tty-style" status window. + * (Tty-style supports status highlighting and effectively makes "text" + * obsolete.) */ struct status_info_t { struct text_buffer text; /* Just a text buffer. */ + Pixel fg, bg; /* foreground and background */ + XFontStruct *fs; /* Status window font structure. */ + Dimension spacew; /* width of one space */ + Position x, y[3]; /* x coord (not used), y for up to three lines */ + Dimension wd, ht; /* width (not used), height (same for all lines) */ + Dimension brd, in_wd; /* border width, internal width */ }; /* @@ -131,8 +170,10 @@ typedef struct x11_mi { long pick_count; /* specific selection count; -1 if none */ char *str; /* The text of the item. */ int attr; /* Attribute for the line. */ + int color; /* Color for the line. */ boolean selected; /* Been selected? */ boolean preselected; /* in advance? */ + unsigned itemflags; /* MENU_ITEMFLAGS_foo */ char selector; /* Char used to select this entry. */ char gselector; /* Group selector. */ Widget w; @@ -239,20 +280,25 @@ struct xwindow { /* event into a character(s) */ #define DEFAULT_LINES_DISPLAYED 12 /* # of lines displayed message window */ -#define MAX_HISTORY 60 /* max history saved on message window */ + +/* flags for X11_yn_function_core() */ +#define YN_NORMAL 0U /* no flags */ +#define YN_NO_LOGMESG 1U /* suppress echo of prompt+response to message window + * and dumplog message history */ +#define YN_NO_DEFAULT 2U /* don't convert quitchars to 0 or ESC to q/n/def */ /* Window variables (winX.c). */ -E struct xwindow window_list[MAX_WINDOWS]; -E XtAppContext app_context; /* context of application */ -E Widget toplevel; /* toplevel widget */ -E Atom wm_delete_window; /* delete window protocol */ -E boolean exit_x_event; /* exit condition for event loop */ +extern struct xwindow window_list[MAX_WINDOWS]; +extern XtAppContext app_context; /* context of application */ +extern Widget toplevel; /* toplevel widget */ +extern Atom wm_delete_window; /* delete window protocol */ +extern boolean exit_x_event; /* exit condition for event loop */ #define EXIT_ON_KEY_PRESS 0 /* valid values for exit_x_event */ #define EXIT_ON_KEY_OR_BUTTON_PRESS 1 #define EXIT_ON_EXIT 2 #define EXIT_ON_SENT_EVENT 3 -E int click_x, click_y, click_button, updated_inventory; -E boolean plsel_ask_name; +extern int click_x, click_y, click_button, updated_inventory; +extern boolean plsel_ask_name; typedef struct { Boolean slow; /* issue prompts between map and message wins */ @@ -278,182 +324,192 @@ typedef struct { #endif } AppResources; -E AppResources appResources; -E void (*input_func)(); +extern AppResources appResources; +extern void (*input_func)(Widget, XEvent *, String *, Cardinal *); extern struct window_procs X11_procs; /* Check for an invalid window id. */ -#define check_winid(window) \ - if ((window) < 0 || (window) >= MAX_WINDOWS) { \ - panic("illegal windid [%d] in %s at line %d", window, __FILE__, \ - __LINE__); \ - } +#define check_winid(window) \ + do { \ + if ((window) < 0 || (window) >= MAX_WINDOWS) \ + panic("illegal windid [%d] in %s at line %d", \ + window, __FILE__, __LINE__); \ + } while (0) + +/* ### Window.c ### */ +extern Font WindowFont(Widget); +extern XFontStruct *WindowFontStruct(Widget); /* ### dialogs.c ### */ -E Widget -FDECL(CreateDialog, (Widget, String, XtCallbackProc, XtCallbackProc)); -E void FDECL(SetDialogPrompt, (Widget, String)); -E String FDECL(GetDialogResponse, (Widget)); -E void FDECL(SetDialogResponse, (Widget, String, unsigned)); -E void FDECL(positionpopup, (Widget, BOOLEAN_P)); +extern Widget CreateDialog(Widget, String, XtCallbackProc, XtCallbackProc); +extern void SetDialogPrompt(Widget, String); +extern String GetDialogResponse(Widget); +extern void SetDialogResponse(Widget, String, unsigned); +extern void positionpopup(Widget, boolean); /* ### winX.c ### */ -E struct xwindow *FDECL(find_widget, (Widget)); -E XColor FDECL(get_nhcolor, (struct xwindow *, int)); -E void FDECL(init_menu_nhcolors, (struct xwindow *)); -E void FDECL(load_boldfont, (struct xwindow *, Widget)); -E Boolean FDECL(nhApproxColor, (Screen *, Colormap, char *, XColor *)); -E void FDECL(get_widget_window_geometry, (Widget, int *, int *, int *, int *)); -E char *FDECL(fontname_boldify, (const char *)); -E Dimension FDECL(nhFontHeight, (Widget)); -E char FDECL(key_event_to_char, (XKeyEvent *)); -E void FDECL(msgkey, (Widget, XtPointer, XEvent *)); -E void FDECL(highlight_yn, (BOOLEAN_P)); -E void FDECL(nh_XtPopup, (Widget, int, Widget)); -E void FDECL(nh_XtPopdown, (Widget)); -E void FDECL(win_X11_init, (int)); -E void FDECL(find_scrollbars, (Widget, Widget *, Widget *)); -E void FDECL(nh_keyscroll, (Widget, XEvent *, String *, Cardinal *)); +extern struct xwindow *find_widget(Widget); +extern XColor get_nhcolor(struct xwindow *, int); +extern void init_menu_nhcolors(struct xwindow *); +extern void load_boldfont(struct xwindow *, Widget); +extern Boolean nhApproxColor(Screen *, Colormap, char *, XColor *); +extern Boolean nhCvtStringToPixel(Display *, XrmValuePtr, Cardinal *, + XrmValuePtr, XrmValuePtr, XtPointer *); +extern void get_window_frame_extents(Widget, long *, long *, long *, long *); +extern void get_widget_window_geometry(Widget, int *, int *, int *, int *); +extern char *fontname_boldify(const char *); +extern Dimension nhFontHeight(Widget); +extern char key_event_to_char(XKeyEvent *); +extern void msgkey(Widget, XtPointer, XEvent *, Boolean *); +extern void highlight_yn(boolean); +extern void nh_XtPopup(Widget, int, Widget); +extern void nh_XtPopdown(Widget); +extern void win_X11_init(int); +extern void find_scrollbars(Widget, Widget, Widget *, Widget *); +extern void nh_keyscroll(Widget, XEvent *, String *, Cardinal *); /* ### winmesg.c ### */ -E void FDECL(set_message_slider, (struct xwindow *)); -E void FDECL(create_message_window, (struct xwindow *, BOOLEAN_P, Widget)); -E void FDECL(destroy_message_window, (struct xwindow *)); -E void FDECL(display_message_window, (struct xwindow *)); -E void FDECL(append_message, (struct xwindow *, const char *)); -E void FDECL(set_last_pause, (struct xwindow *)); +extern void set_message_slider(struct xwindow *); +extern void create_message_window(struct xwindow *, boolean, Widget); +extern void destroy_message_window(struct xwindow *); +extern void display_message_window(struct xwindow *); +extern void append_message(struct xwindow *, const char *); +extern void set_last_pause(struct xwindow *); /* ### winmap.c ### */ -E void NDECL(post_process_tiles); -E void FDECL(check_cursor_visibility, (struct xwindow *)); -E void FDECL(display_map_window, (struct xwindow *)); -E void FDECL(clear_map_window, (struct xwindow *)); -E void FDECL(map_input, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(set_map_size, (struct xwindow *, DIMENSION_P, DIMENSION_P)); -E void FDECL(create_map_window, (struct xwindow *, BOOLEAN_P, Widget)); -E void FDECL(destroy_map_window, (struct xwindow *)); -E int FDECL(x_event, (int)); +extern void post_process_tiles(void); +extern void check_cursor_visibility(struct xwindow *); +extern void display_map_window(struct xwindow *); +extern void clear_map_window(struct xwindow *); +extern void map_input(Widget, XEvent *, String *, Cardinal *); +extern void set_map_size(struct xwindow *, Dimension, Dimension); +extern void create_map_window(struct xwindow *, boolean, Widget); +extern void destroy_map_window(struct xwindow *); +extern int x_event(int); /* ### winmenu.c ### */ -E void FDECL(menu_delete, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(menu_key, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(create_menu_window, (struct xwindow *)); -E void FDECL(destroy_menu_window, (struct xwindow *)); +extern void menu_delete(Widget, XEvent *, String *, Cardinal *); +extern void menu_key(Widget, XEvent *, String *, Cardinal *); +extern void x11_no_perminv(struct xwindow *); +extern void x11_scroll_perminv(int); +extern void create_menu_window(struct xwindow *); +extern void destroy_menu_window(struct xwindow *); /* ### winmisc.c ### */ -E void FDECL(ps_key, (Widget, XEvent *, String *, - Cardinal *)); /* player selection action */ -E void FDECL(race_key, (Widget, XEvent *, String *, - Cardinal *)); /* race selection action */ -E void FDECL(gend_key, (Widget, XEvent *, String *, Cardinal *)); /* gender */ -E void FDECL(algn_key, - (Widget, XEvent *, String *, Cardinal *)); /* alignment */ -E void FDECL(ec_delete, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(ec_key, (Widget, XEvent *, String *, - Cardinal *)); /* extended command action */ -E void FDECL(plsel_quit, (Widget, XEvent *, String *, - Cardinal *)); /* player selection dialog */ -E void FDECL(plsel_play, (Widget, XEvent *, String *, - Cardinal *)); /* player selection dialog */ -E void FDECL(plsel_randomize, (Widget, XEvent *, String *, - Cardinal *)); /* player selection dialog */ -E void NDECL(release_extended_cmds); +extern XtPointer i2xtp(int); +extern int xtp2i(XtPointer); +extern void ps_key(Widget, XEvent *, String *, + Cardinal *); /* player selection action */ +extern void race_key(Widget, XEvent *, String *, + Cardinal *); /* race selection action */ +extern void gend_key(Widget, XEvent *, String *, Cardinal *); /* gender */ +extern void algn_key(Widget, XEvent *, String *, Cardinal *); /* alignment */ +extern void ec_delete(Widget, XEvent *, String *, Cardinal *); +extern void ec_key(Widget, XEvent *, String *, + Cardinal *); /* extended command action */ +extern void plsel_quit(Widget, XEvent *, String *, + Cardinal *); /* player selection dialog */ +extern void plsel_play(Widget, XEvent *, String *, + Cardinal *); /* player selection dialog */ +extern void plsel_randomize(Widget, XEvent *, String *, + Cardinal *); /* player selection dialog */ +extern void release_extended_cmds(void); /* ### winstatus.c ### */ -E void FDECL(create_status_window, (struct xwindow *, BOOLEAN_P, Widget)); -E void FDECL(destroy_status_window, (struct xwindow *)); -E void FDECL(adjust_status, (struct xwindow *, const char *)); -E void NDECL(null_out_status); -E void NDECL(check_turn_events); +extern void create_status_window(struct xwindow *, boolean, Widget); +extern void destroy_status_window(struct xwindow *); +extern void adjust_status(struct xwindow *, const char *); +extern void null_out_status(void); +extern void check_turn_events(void); /* ### wintext.c ### */ -E void FDECL(delete_text, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(dismiss_text, (Widget, XEvent *, String *, Cardinal *)); -E void FDECL(key_dismiss_text, (Widget, XEvent *, String *, Cardinal *)); +extern void delete_text(Widget, XEvent *, String *, Cardinal *); +extern void dismiss_text(Widget, XEvent *, String *, Cardinal *); +extern void key_dismiss_text(Widget, XEvent *, String *, Cardinal *); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(rip_dismiss_text, (Widget, XEvent *, String *, Cardinal *)); +extern void rip_dismiss_text(Widget, XEvent *, String *, Cardinal *); #endif -E void FDECL(add_to_text_window, (struct xwindow *, int, const char *)); -E void FDECL(display_text_window, (struct xwindow *, BOOLEAN_P)); -E void FDECL(create_text_window, (struct xwindow *)); -E void FDECL(destroy_text_window, (struct xwindow *)); -E void FDECL(clear_text_window, (struct xwindow *)); -E void FDECL(append_text_buffer, (struct text_buffer *, const char *, - BOOLEAN_P)); /* text buffer routines */ -E void FDECL(init_text_buffer, (struct text_buffer *)); -E void FDECL(clear_text_buffer, (struct text_buffer *)); -E void FDECL(free_text_buffer, (struct text_buffer *)); +extern void add_to_text_window(struct xwindow *, int, const char *); +extern void display_text_window(struct xwindow *, boolean); +extern void create_text_window(struct xwindow *); +extern void destroy_text_window(struct xwindow *); +extern void clear_text_window(struct xwindow *); +extern void append_text_buffer(struct text_buffer *, const char *, + boolean); /* text buffer routines */ +extern void init_text_buffer(struct text_buffer *); +extern void clear_text_buffer(struct text_buffer *); +extern void free_text_buffer(struct text_buffer *); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(calculate_rip_text, (int, time_t)); +extern void calculate_rip_text(int, time_t); #endif /* ### winval.c ### */ -E Widget FDECL(create_value, (Widget, const char *)); -E void FDECL(set_name, (Widget, const char *)); -E void FDECL(set_name_width, (Widget, int)); -E int FDECL(get_name_width, (Widget)); -E void FDECL(set_value, (Widget, const char *)); -E void FDECL(set_value_width, (Widget, int)); -E int FDECL(get_value_width, (Widget)); -E void FDECL(hilight_value, (Widget)); -E void FDECL(swap_fg_bg, (Widget)); - +extern Widget create_value(Widget, const char *); +extern void set_name(Widget, const char *); +extern void set_name_width(Widget, int); +extern int get_name_width(Widget); +extern Widget get_value_widget(Widget); +extern void set_value_width(Widget, int); +extern int get_value_width(Widget); +extern void hilight_value(Widget); +extern void swap_fg_bg(Widget); +extern void set_value(Widget w, const char *new_value); /* external declarations */ -E char *FDECL(X11_getmsghistory, (BOOLEAN_P)); -E void FDECL(X11_putmsghistory, (const char *, BOOLEAN_P)); -E void FDECL(X11_init_nhwindows, (int *, char **)); -E void NDECL(X11_player_selection); -E void NDECL(X11_askname); -E void NDECL(X11_get_nh_event); -E void FDECL(X11_exit_nhwindows, (const char *)); -E void FDECL(X11_suspend_nhwindows, (const char *)); -E void NDECL(X11_resume_nhwindows); -E winid FDECL(X11_create_nhwindow, (int)); -E void FDECL(X11_clear_nhwindow, (winid)); -E void FDECL(X11_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(X11_destroy_nhwindow, (winid)); -E void FDECL(X11_curs, (winid, int, int)); -E void FDECL(X11_putstr, (winid, int, const char *)); -E void FDECL(X11_display_file, (const char *, BOOLEAN_P)); -E void FDECL(X11_start_menu, (winid)); -E void FDECL(X11_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); -E void FDECL(X11_end_menu, (winid, const char *)); -E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **)); -E void NDECL(X11_update_inventory); -E void NDECL(X11_mark_synch); -E void NDECL(X11_wait_synch); +extern char *X11_getmsghistory(boolean); +extern void X11_putmsghistory(const char *, boolean); +extern void X11_init_nhwindows(int *, char **); +extern void X11_player_selection(void); +extern void X11_askname(void); +extern void X11_get_nh_event(void); +extern void X11_exit_nhwindows(const char *); +extern void X11_suspend_nhwindows(const char *); +extern void X11_resume_nhwindows(void); +extern winid X11_create_nhwindow(int); +extern void X11_clear_nhwindow(winid); +extern void X11_display_nhwindow(winid, boolean); +extern void X11_destroy_nhwindow(winid); +extern void X11_curs(winid, int, int); +extern void X11_putstr(winid, int, const char *); +extern void X11_display_file(const char *, boolean); +extern void X11_start_menu(winid, unsigned long); +extern void X11_add_menu(winid, const glyph_info *, const ANY_P *, char, + char, int, int, const char *, unsigned int); +extern void X11_end_menu(winid, const char *); +extern int X11_select_menu(winid, int, MENU_ITEM_P **); +extern void X11_mark_synch(void); +extern void X11_wait_synch(void); #ifdef CLIPPING -E void FDECL(X11_cliparound, (int, int)); +extern void X11_cliparound(int, int); #endif -E void FDECL(X11_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int)); -E void FDECL(X11_raw_print, (const char *)); -E void FDECL(X11_raw_print_bold, (const char *)); -E int NDECL(X11_nhgetch); -E int FDECL(X11_nh_poskey, (int *, int *, int *)); -E void NDECL(X11_nhbell); -E int NDECL(X11_doprev_message); -E char FDECL(X11_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(X11_getlin, (const char *, char *)); -E int NDECL(X11_get_ext_cmd); -E void FDECL(X11_number_pad, (int)); -E void NDECL(X11_delay_output); -E void NDECL(X11_status_init); -E void NDECL(X11_status_finish); -E void FDECL(X11_status_enablefield, (int, const char *, const char *, BOOLEAN_P)); -E void FDECL(X11_status_update, (int, genericptr_t, int, int, int, unsigned long *)); - -/* other defs that really should go away (they're tty specific) */ -E void NDECL(X11_start_screen); -E void NDECL(X11_end_screen); +extern void X11_print_glyph(winid, coordxy, coordxy, const glyph_info *, + const glyph_info *); +extern void X11_raw_print(const char *); +extern void X11_raw_print_bold(const char *); +extern int X11_nhgetch(void); +extern int X11_nh_poskey(coordxy *, coordxy *, int *); +extern void X11_nhbell(void); +extern int X11_doprev_message(void); +extern char X11_yn_function_core(const char *, const char *, char, unsigned); +extern char X11_yn_function(const char *, const char *, char); +extern void X11_getlin(const char *, char *); +extern int X11_get_ext_cmd(void); +extern void X11_number_pad(int); +extern void X11_delay_output(void); +extern void X11_status_init(void); +extern void X11_status_finish(void); +extern void X11_status_enablefield(int, const char *, const char *, boolean); +extern void X11_status_update(int, genericptr_t, int, int, int, + unsigned long *); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(X11_outrip, (winid, int, time_t)); +extern void X11_outrip(winid, int, time_t); #else -E void FDECL(genl_outrip, (winid, int, time_t)); +extern void genl_outrip(winid, int, time_t); #endif -E void FDECL(X11_preference_update, (const char *)); +extern void X11_preference_update(const char *); +extern void X11_update_inventory(int); +extern win_request_info *X11_ctrl_nhwindow(winid, int, win_request_info *); #endif /* WINX_H */ diff --git a/include/winami.h b/include/winami.h index ccc3c1e16..525f53d6d 100644 --- a/include/winami.h +++ b/include/winami.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 winami.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ +/* NetHack 5.0 winami.h $NHDT-Date: 1596498569 2020/08/03 23:49:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */ /* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1991. */ /* Copyright (c) Gregg Wonderly, Naperville, Illinois, 1992, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -22,6 +22,7 @@ typedef struct amii_mi { char gselector; /* Group selector */ char canselect; /* Can user select this entry. */ char attr; /* Attribute for the line. */ + int color; /* Color for the line (from menucolors). */ char *str; /* The text of the item. */ } amii_menu_item; @@ -37,13 +38,13 @@ struct amii_menu { * tty-style windows also, then things will need to change. */ /* per-window data */ struct amii_WinDesc { - xchar type; /* type of window */ + xint16 type; /* type of window */ struct amii_menu menu; boolean active; /* true if window is active */ boolean wasup; /* true if menu/text window was already open */ short disprows; /* Rows displayed so far (used for paging in message win) */ - xchar offx, offy; /* offset from topleft of display */ + coordxy offx, offy; /* offset from topleft of display */ short vwx, vwy, vcx, vcy; /* View cursor location */ short rows, cols; /* dimensions */ short curx, cury; /* current cursor position */ diff --git a/include/wincurs.h b/include/wincurs.h index 8ae45e10e..0911cf11c 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 wincurs.h */ +/* NetHack 5.0 wincurs.h */ /* Copyright (c) Karl Garrison, 2010. */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,8 +12,9 @@ extern int orig_cursor; /* Preserve initial cursor state */ extern WINDOW *base_term; /* underlying terminal window */ extern boolean counting; /* Count window is active */ extern WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ +extern WINDOW *activemenu; /* curses window for menu requesting a + * count; affects count_window refresh */ -#define TEXTCOLOR /* Allow color */ #define NHW_END 19 #define OFF 0 #define ON 1 @@ -25,14 +26,13 @@ extern WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ #define SCROLLBAR_BACK_COLOR CLR_BLACK #define HIGHLIGHT_COLOR CLR_WHITE #define MORECOLOR CLR_ORANGE -#define STAT_UP_COLOR CLR_GREEN -#define STAT_DOWN_COLOR CLR_RED #define MESSAGE_WIN 1 #define STATUS_WIN 2 #define MAP_WIN 3 #define INV_WIN 4 -#define NHWIN_MAX 5 -#define MESG_HISTORY_MAX 200 +#define TEXT_WIN 5 +#define MENU_WIN 6 +#define NHWIN_MAX 7 #if !defined(__APPLE__) || !defined(NCURSES_VERSION) # define USE_DARKGRAY /* Allow "bright" black; delete if not visible */ #endif /* !__APPLE__ && !PDCURSES */ @@ -45,6 +45,9 @@ extern WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ #if !defined(A_RIGHTLINE) && defined(A_RIGHT) #define A_RIGHTLINE A_RIGHT #endif +#ifndef A_ITALIC +#define A_ITALIC A_UNDERLINE +#endif typedef enum orient_type { @@ -56,10 +59,8 @@ typedef enum orient_type UNDEFINED } orient; -#ifdef GCC_WARN int wprintw(WINDOW *, const char *, ...) PRINTF_F(2, 3); int mvwprintw(WINDOW *, int, int, const char *, ...) PRINTF_F(4, 5); -#endif /* cursmain.c */ @@ -69,50 +70,54 @@ extern void curses_init_nhwindows(int* argcp, char** argv); extern void curses_player_selection(void); extern void curses_askname(void); extern void curses_get_nh_event(void); +extern void curses_uncurse_terminal(void); extern void curses_exit_nhwindows(const char *str); extern void curses_suspend_nhwindows(const char *str); extern void curses_resume_nhwindows(void); extern winid curses_create_nhwindow(int type); extern void curses_clear_nhwindow(winid wid); -extern void curses_display_nhwindow(winid wid, BOOLEAN_P block); +extern void curses_display_nhwindow(winid wid, boolean block); extern void curses_destroy_nhwindow(winid wid); extern void curses_curs(winid wid, int x, int y); extern void curses_putstr(winid wid, int attr, const char *text); -extern void curses_display_file(const char *filename, BOOLEAN_P must_exist); -extern void curses_start_menu(winid wid); -extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier, - CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); +extern void curses_putmixed(winid window, int attr, const char *str); +extern void curses_display_file(const char *filename, boolean must_exist); +extern void curses_start_menu(winid wid, unsigned long); +extern void curses_add_menu(winid wid, const glyph_info *, + const ANY_P * identifier, + char accelerator, char group_accel, int attr, + int clr, const char *str, unsigned int itemflags); extern void curses_end_menu(winid wid, const char *prompt); extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); -extern void curses_update_inventory(void); extern void curses_mark_synch(void); extern void curses_wait_synch(void); extern void curses_cliparound(int x, int y); -extern void curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, - int glyph, int bkglyph); +extern void curses_print_glyph(winid wid, coordxy x, coordxy y, + const glyph_info *, const glyph_info *); extern void curses_raw_print(const char *str); extern void curses_raw_print_bold(const char *str); extern int curses_nhgetch(void); -extern int curses_nh_poskey(int *x, int *y, int *mod); +extern int curses_nh_poskey(coordxy *x, coordxy *y, int *mod); extern void curses_nhbell(void); extern int curses_doprev_message(void); extern char curses_yn_function(const char *question, const char *choices, - CHAR_P def); + char def); extern void curses_getlin(const char *question, char *input); extern int curses_get_ext_cmd(void); extern void curses_number_pad(int state); extern void curses_delay_output(void); -extern void curses_start_screen(void); -extern void curses_end_screen(void); -extern void curses_outrip(winid wid, int how); +extern void curses_outrip(winid wid, int how, time_t when); extern void genl_outrip(winid tmpwin, int how, time_t when); extern void curses_preference_update(const char *pref); extern void curs_reset_windows(boolean, boolean); +extern void curses_update_inventory(int); +extern win_request_info *curses_ctrl_nhwindow(winid, int, win_request_info *); /* curswins.c */ -extern WINDOW *curses_create_window(int width, int height, orient orientation); +extern WINDOW *curses_create_window(int, int, int, orient); +extern void curses_set_wid_colors(int wid, WINDOW *win); +extern void curses_parse_wid_colors(int wid, char *fg, char *bg); extern void curses_destroy_win(WINDOW *win); extern WINDOW *curses_get_nhwin(winid wid); extern void curses_add_nhwin(winid wid, int height, int width, int y, @@ -123,8 +128,14 @@ extern void curses_refresh_nethack_windows(void); extern void curses_del_nhwin(winid wid); extern void curses_del_wid(winid wid); extern void curs_destroy_all_wins(void); +#ifdef ENHANCED_SYMBOLS extern void curses_putch(winid wid, int x, int y, int ch, - int color, int attrs); + struct unicode_representation *u, int color, + int framecolor, int attrs); +#else +extern void curses_putch(winid wid, int x, int y, int ch, int color, + int framecolor, int attrs); +#endif extern void curses_get_window_size(winid wid, int *height, int *width); extern boolean curses_window_has_border(winid wid); extern boolean curses_window_exists(winid wid); @@ -134,17 +145,19 @@ extern void curses_puts(winid wid, int attr, const char *text); extern void curses_clear_nhwin(winid wid); extern void curses_alert_win_border(winid wid, boolean onoff); extern void curses_alert_main_borders(boolean onoff); +extern int get_framecolor(int nhcolor, int framecolor); extern void curses_draw_map(int sx, int sy, int ex, int ey); extern boolean curses_map_borders(int *sx, int *sy, int *ex, int *ey, int ux, int uy); /* cursmisc.c */ +extern int curses_getch(void); extern int curses_read_char(void); extern void curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff); extern void curses_menu_color_attr(WINDOW *, int, int, int); -extern void curses_bail(const char *mesg); +ATTRNORETURN extern void curses_bail(const char *mesg) NORETURN; extern winid curses_get_wid(int type); extern char *curses_copy_of(const char *s); extern int curses_num_lines(const char *str, int width); @@ -154,16 +167,15 @@ extern boolean curses_is_menu(winid wid); extern boolean curses_is_text(winid wid); extern int curses_convert_glyph(int ch, int glyph); extern void curses_move_cursor(winid wid, int x, int y); +extern void curses_update_stdscr_cursor(void); extern void curses_prehousekeeping(void); extern void curses_posthousekeeping(void); extern void curses_view_file(const char *filename, boolean must_exist); extern void curses_rtrim(char *str); -extern int curses_get_count(int first_digit); -extern int curses_convert_attr(int attr); -extern int curses_read_attrs(const char *attrs); -extern char *curses_fmt_attrs(char *); +extern long curses_get_count(int first_digit); +extern attr_t curses_convert_attr(int attr); extern int curses_convert_keys(int key); -extern int curses_get_mouse(int *mousex, int *mousey, int *mod); +extern int curses_get_mouse(coordxy *mousex, coordxy *mousey, int *mod); extern void curses_mouse_support(int); /* cursdial.c */ @@ -171,13 +183,13 @@ extern void curses_mouse_support(int); extern void curses_line_input_dialog(const char *prompt, char *answer, int buffer); extern int curses_character_input_dialog(const char *prompt, - const char *choices, CHAR_P def); + const char *choices, char def); extern int curses_ext_cmd(void); -extern void curses_create_nhmenu(winid wid); -extern void curses_add_nhmenu_item(winid wid, int glyph, - const ANY_P *identifier, CHAR_P accelerator, - CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); +extern void curses_create_nhmenu(winid wid, unsigned long); +extern void curses_add_nhmenu_item(winid wid, const glyph_info *, + const ANY_P *identifier, char accelerator, + char group_accel, int attr, int clr, + const char *str, unsigned itemflags); extern void curs_menu_set_bottom_heavy(winid); extern void curses_finalize_nhmenu(winid wid, const char *prompt); extern int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected); @@ -193,12 +205,15 @@ extern void curses_status_update(int, genericptr_t, int, int, int, /* cursinvt.c */ -extern void curses_update_inv(void); -extern void curses_add_inv(int, int, CHAR_P, attr_t, const char *); +extern void curs_purge_perminv_data(boolean); +extern void curs_update_invt(int); +extern void curs_add_invt(int, char, attr_t, int, const char *); /* cursinit.c */ extern void curses_create_main_windows(void); +extern int curses_init_rgb(int r, int g, int b); +extern int curses_init_pair(int fg, int bg); extern void curses_init_nhcolors(void); extern void curses_choose_character(void); extern int curses_character_dialog(const char **choices, const char *prompt); @@ -210,6 +225,7 @@ extern void curses_cleanup(void); extern void curses_message_win_puts(const char *message, boolean recursed); extern void curses_got_input(void); +extern int curses_got_output(void); extern int curses_block(boolean require_tab); /* for MSGTYPE=STOP */ extern int curses_more(void); extern void curses_clear_unhighlight_message_window(void); @@ -220,8 +236,8 @@ extern void curses_init_mesg_history(void); extern void curses_teardown_messages(void); extern void curses_prev_mesg(void); extern void curses_count_window(const char *count_text); -char *curses_getmsghistory(BOOLEAN_P); -void curses_putmsghistory(const char *, BOOLEAN_P); +char *curses_getmsghistory(boolean); +void curses_putmsghistory(const char *, boolean); #endif /* WINCURS_H */ diff --git a/include/windconf.h b/include/windconf.h new file mode 100644 index 000000000..0f493ca76 --- /dev/null +++ b/include/windconf.h @@ -0,0 +1,297 @@ +/* NetHack 5.0 windconf.h $NHDT-Date: 1596498552 2020/08/03 23:49:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.89 $ */ +/* Copyright (c) NetHack PC Development Team 1993, 1994. */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef WINDCONF_H +#define WINDCONF_H + +/* #define SHELL */ /* nt use of pcsys routines caused a hang */ + +#define EXEPATH /* Allow .exe location to be used as HACKDIR */ +#define TRADITIONAL_GLYPHMAP /* Store glyph mappings at level change time */ + +#define LAN_FEATURES /* Include code for lan-aware features. Untested in \ + 3.4.0*/ + +#define PC_LOCKING /* Prevent overwrites of aborted or in-progress games */ +/* without first receiving confirmation. */ + +#define SELF_RECOVER /* Allow the game itself to recover from an aborted \ + game */ + +#define SYSCF /* Use a global configuration */ +#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */ + +#ifdef DUMPLOG +#define DUMPLOG_FILE "%TEMP%/nethack-%n-%d.log" +#endif + +/*#define CHANGE_COLOR*/ /* allow palette changes */ + +#define QWERTZ_SUPPORT /* when swap_yz is True, numpad 7 is 'z' not 'y' */ + +#define OPTIONS_AT_RUNTIME /* build info done at runtime not text file */ + +#define EARLY_CONFIGFILE_PASS +#define TTY_PERM_INVENT + +#ifdef WIN32CON +#define IDLECHECKPOINT +#endif + +/* + * ----------------------------------------------------------------- + * The remaining code shouldn't need modification. + * ----------------------------------------------------------------- + */ +/* #define SHORT_FILENAMES */ /* All NT filesystems support long names now + */ + +#ifdef DLB +#define VERSION_IN_DLB_FILENAME /* Append version digits to nhdat */ +#endif + +#ifdef MICRO +#undef MICRO /* never define this! */ +#endif + +#define NOCWD_ASSUMPTIONS /* Always define this. There are assumptions that \ + it is defined for WIN32. \ + Allow paths to be specified for HACKDIR, \ + LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \ + SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */ +#define NO_TERMS +#define ASCIIGRAPH + +#ifdef OPTIONS_USED +#undef OPTIONS_USED +#endif +#define OPTIONS_USED "options" +#define OPTIONS_FILE OPTIONS_USED + +#define PORT_HELP "porthelp" + +#define PORT_DEBUG /* include ability to debug international keyboard issues \ + */ + +#define RUNTIME_PORT_ID /* trigger run-time port identification for \ + * identification of exe CPU architecture \ + */ +#define RUNTIME_PASTEBUF_SUPPORT + + +#define SAFERHANGUP /* Define SAFERHANGUP to delay hangup processing \ + * until the main command loop. 'safer' because it \ + * avoids certain cheats and also avoids losing \ + * objects being thrown when the hangup occurs. \ + */ + +#define CONFIG_FILE ".nethackrc" +#define CONFIG_TEMPLATE "nethackrc.template" +#define SYSCF_TEMPLATE "sysconf.template" +#define SYMBOLS_TEMPLATE "symbols.template" +#define GUIDEBOOK_FILE "Guidebook.txt" + +/* Stuff to help the user with some common, yet significant errors */ +#define INTERJECT_PANIC 0 +#define INTERJECTION_TYPES (INTERJECT_PANIC + 1) +extern void interject_assistance(int, int, genericptr_t, genericptr_t); +extern void interject(int); +extern char *windows_exepath(void); + +/* + *=============================================== + * Compiler-specific adjustments + *=============================================== + */ + +#ifdef __GNUC__ +#define MD_USE_TMPFILE_S +# +#ifdef strncasecmp +#undef strncasecmp +#endif +#ifdef strcasecmp +#undef strcasecmp +/* https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ */ +#endif +/* extern int getlock(void); */ +#endif /* __GNUC__ */ + +#ifdef _MSC_VER +#define MD_USE_TMPFILE_S +#define HAS_STDINT +#if (_MSC_VER > 1000) +/* Visual C 8 warning elimination */ +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif +#ifndef _SCL_SECURE_NO_DEPRECATE +#define _SCL_SECURE_NO_DEPRECATE +#endif +#ifndef _CRT_NONSTDC_NO_DEPRECATE +#define _CRT_NONSTDC_NO_DEPRECATE +#endif +#pragma warning(disable : 4996) /* VC8 deprecation warnings */ +#pragma warning(disable : 4142) /* benign redefinition */ +#pragma warning(disable : 4267) /* conversion from 'size_t' to XX */ +#if (_MSC_VER > 1600) +#pragma warning(disable : 4459) /* hide global declaration */ +#endif /* _MSC_VER > 1600 */ +#endif /* _MSC_VER > 1000 */ +#pragma warning(disable : 4761) /* integral size mismatch in arg; conv \ + supp*/ +#ifdef YYPREFIX +#pragma warning(disable : 4102) /* unreferenced label */ +#endif +#ifdef __cplusplus +/* suppress a warning in cppregex.cpp */ +#pragma warning(disable : 4101) /* unreferenced local variable */ +#endif +#ifndef HAS_STDINT_H +#define HAS_STDINT_H /* force include of stdint.h in integer.h */ +#endif +/* Turn on some additional warnings */ +#pragma warning(3:4389) + +/* supply ssize_t */ +#include +typedef SSIZE_T ssize_t; + +#endif /* _MSC_VER */ + +/* The following is needed for prototypes of certain functions */ +#if defined(_MSC_VER) +#include /* Provides prototypes of exit(), spawn() */ +#endif + +#include /* Provides prototypes of strncmpi(), etc. */ +#ifdef STRNCMPI +#define strncmpi(a, b, c) strnicmp(a, b, c) +#endif + + +#include +#ifdef __BORLANDC__ +#undef randomize +#undef random +#endif + +#define PATHLEN BUFSZ /* maximum pathlength */ +#define FILENAME BUFSZ /* maximum filename length (conservative) */ + +#if defined(_MAX_PATH) && defined(_MAX_FNAME) +#if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ) +#undef PATHLEN +#undef FILENAME +#define PATHLEN _MAX_PATH +#define FILENAME _MAX_FNAME +#endif +#endif + +#define NO_SIGNAL +#define USE_STDARG + +/* Use the high quality random number routines. */ +#ifdef USE_ISAAC64 +#undef RANDOM +#else +#define RANDOM +#define Rand() random() +#endif + +/* Fall back to C's if nothing else, but this really isn't acceptable */ +#if !defined(USE_ISAAC64) && !defined(RANDOM) +#define Rand() rand() +#endif + +#include +#define FCMASK (_S_IREAD | _S_IWRITE) /* file creation mask */ +#define regularize nt_regularize +#define HLOCK "NHPERM" + +#ifndef M +#define M(c) ((char) (0x80 | (c))) +/* #define M(c) ((c) - 128) */ +#endif + +#ifndef C +#define C(c) (0x1f & (c)) +#endif + +#if defined(DLB) || defined(_MSC_VER) +#define FILENAME_CMP stricmp /* case insensitive */ +#endif + +/* this was part of the MICRO stuff in the past */ +extern const char *alllevels, *allbones; +#define ABORT C('a') +#define getuid() 1 +#define getlogin() ((char *) 0) +extern void win32_abort(void); +extern void consoletty_preference_update(const char *); +extern void toggle_mouse_support(void); +extern void map_subkeyvalue(char *); +extern void set_altkeyhandling(const char *); +extern void raw_clear_screen(void); + +#include +#ifndef __BORLANDC__ +#include +#include +#else +int _RTLENTRY _EXPFUNC access(const char _FAR *__path, int __amode); +int _RTLENTRY _EXPFUNC _chdrive(int __drive); +int _RTLENTRYF _EXPFUNC32 chdir(const char _FAR *__path); +char _FAR *_RTLENTRY _EXPFUNC getcwd(char _FAR *__buf, int __buflen); +int _RTLENTRY _EXPFUNC +write(int __handle, const void _FAR *__buf, unsigned __len); +int _RTLENTRY _EXPFUNC creat(const char _FAR *__path, int __amode); +int _RTLENTRY _EXPFUNC close(int __handle); +int _RTLENTRY _EXPFUNC _close(int __handle); +int _RTLENTRY _EXPFUNC +open(const char _FAR *__path, int __access, ... /*unsigned mode*/); +long _RTLENTRY _EXPFUNC lseek(int __handle, long __offset, int __fromwhere); +int _RTLENTRY _EXPFUNC read(int __handle, void _FAR *__buf, unsigned __len); +#endif +#undef kbhit /* Use our special NT kbhit */ +#define kbhit (*nt_kbhit) + +#ifdef LAN_FEATURES +#define MAX_LAN_USERNAME 20 +#endif + +#ifndef alloca +#define ALLOCA_HACK /* used in util/panic.c */ +#endif + +extern int set_win32_option(const char *, const char *); +#define LEFTBUTTON FROM_LEFT_1ST_BUTTON_PRESSED +#define RIGHTBUTTON RIGHTMOST_BUTTON_PRESSED +#define MIDBUTTON FROM_LEFT_2ND_BUTTON_PRESSED +#define MOUSEMASK (LEFTBUTTON | RIGHTBUTTON | MIDBUTTON) +#ifdef CHANGE_COLOR +extern int alternative_palette(char *); +#endif + +#define nethack_enter(argc, argv) nethack_enter_windows() +extern boolean file_exists(const char *); +extern boolean file_newer(const char *, const char *); +#ifndef SYSTEM_H +/* #include "system.h" */ +#endif + +#if defined(WIN_CE) +#define QSORTCALLBACK __cdecl +#endif + +/* Override the default version of nhassert. The default version is unable + * to generate a string form of the expression due to the need to be + * compatible with compilers which do not support macro stringization (i.e. + * #x to turn x into its string form). + */ +extern void nt_assert_failed(const char *, const char *, int); +#define nhassert(expression) (void)((!!(expression)) || \ + (nt_assert_failed(#expression, __FILE__, __LINE__), 0)) + +#endif /* WINDCONF_H */ diff --git a/include/winprocs.h b/include/winprocs.h index 55b2b0611..7ec7de01a 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -1,85 +1,101 @@ -/* NetHack 3.6 winprocs.h $NHDT-Date: 1567213890 2019/08/31 01:11:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.50 $ */ -/* Copyright (c) David Cohrs, 1992 */ +/* NetHack 5.0 winprocs.h $NHDT-Date: 1736530208 2025/01/10 09:30:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.83 $ */ +/* Copyright (c) David Cohrs, 1992 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef WINPROCS_H #define WINPROCS_H #include "botl.h" +#ifndef CLR_MAX +#include "color.h" +#endif + +enum wp_ids { wp_tty = 1, wp_X11, wp_Qt, wp_mswin, wp_curses, + wp_chainin, wp_chainout, wp_shim, + wp_hup, wp_guistubs, wp_ttystubs, +#if defined(AMIGA) + wp_amii, wp_amiv, +#endif +#ifdef OUTDATED_STUFF + wp_mac, wp_Gem, wp_Gnome, +#endif + wp_trace // XXX do we need this? should chainin/out get an id? TBD +}; /* NB: this MUST match chain_procs below */ struct window_procs { const char *name; /* Names should start with [a-z]. Names must * not start with '-'. Names starting with * '+' are reserved for processors. */ + enum wp_ids wp_id; unsigned long wincap; /* window port capability options supported */ unsigned long wincap2; /* additional window port capability options */ boolean has_color[CLR_MAX]; - void FDECL((*win_init_nhwindows), (int *, char **)); - void NDECL((*win_player_selection)); - void NDECL((*win_askname)); - void NDECL((*win_get_nh_event)); - void FDECL((*win_exit_nhwindows), (const char *)); - void FDECL((*win_suspend_nhwindows), (const char *)); - void NDECL((*win_resume_nhwindows)); - winid FDECL((*win_create_nhwindow), (int)); - void FDECL((*win_clear_nhwindow), (winid)); - void FDECL((*win_display_nhwindow), (winid, BOOLEAN_P)); - void FDECL((*win_destroy_nhwindow), (winid)); - void FDECL((*win_curs), (winid, int, int)); - void FDECL((*win_putstr), (winid, int, const char *)); - void FDECL((*win_putmixed), (winid, int, const char *)); - void FDECL((*win_display_file), (const char *, BOOLEAN_P)); - void FDECL((*win_start_menu), (winid)); - void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P, - int, const char *, BOOLEAN_P)); - void FDECL((*win_end_menu), (winid, const char *)); - int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **)); - char FDECL((*win_message_menu), (CHAR_P, int, const char *)); - void NDECL((*win_update_inventory)); - void NDECL((*win_mark_synch)); - void NDECL((*win_wait_synch)); + void (*win_init_nhwindows)(int *, char **); + void (*win_player_selection)(void); + void (*win_askname)(void); + void (*win_get_nh_event)(void); + void (*win_exit_nhwindows)(const char *); + void (*win_suspend_nhwindows)(const char *); + void (*win_resume_nhwindows)(void); + winid (*win_create_nhwindow)(int); + void (*win_clear_nhwindow)(winid); + void (*win_display_nhwindow)(winid, boolean); + void (*win_destroy_nhwindow)(winid); + void (*win_curs)(winid, int, int); + void (*win_putstr)(winid, int, const char *); + void (*win_putmixed)(winid, int, const char *); + void (*win_display_file)(const char *, boolean); + void (*win_start_menu)(winid, unsigned long); + void (*win_add_menu)(winid, const glyph_info *, const ANY_P *, + char, char, int, int, + const char *, unsigned int); + void (*win_end_menu)(winid, const char *); + int (*win_select_menu)(winid, int, MENU_ITEM_P **); + char (*win_message_menu)(char, int, const char *); + void (*win_mark_synch)(void); + void (*win_wait_synch)(void); #ifdef CLIPPING - void FDECL((*win_cliparound), (int, int)); + void (*win_cliparound)(int, int); #endif #ifdef POSITIONBAR - void FDECL((*win_update_positionbar), (char *)); + void (*win_update_positionbar)(char *); #endif - void FDECL((*win_print_glyph), (winid, XCHAR_P, XCHAR_P, int, int)); - void FDECL((*win_raw_print), (const char *)); - void FDECL((*win_raw_print_bold), (const char *)); - int NDECL((*win_nhgetch)); - int FDECL((*win_nh_poskey), (int *, int *, int *)); - void NDECL((*win_nhbell)); - int NDECL((*win_doprev_message)); - char FDECL((*win_yn_function), (const char *, const char *, CHAR_P)); - void FDECL((*win_getlin), (const char *, char *)); - int NDECL((*win_get_ext_cmd)); - void FDECL((*win_number_pad), (int)); - void NDECL((*win_delay_output)); + void (*win_print_glyph)(winid, coordxy, coordxy, + const glyph_info *, const glyph_info *); + void (*win_raw_print)(const char *); + void (*win_raw_print_bold)(const char *); + int (*win_nhgetch)(void); + int (*win_nh_poskey)(coordxy *, coordxy *, int *); + void (*win_nhbell)(void); + int (*win_doprev_message)(void); + char (*win_yn_function)(const char *, const char *, char); + void (*win_getlin)(const char *, char *); + int (*win_get_ext_cmd)(void); + void (*win_number_pad)(int); + void (*win_delay_output)(void); #ifdef CHANGE_COLOR - void FDECL((*win_change_color), (int, long, int)); -#ifdef MAC - void FDECL((*win_change_background), (int)); - short FDECL((*win_set_font_name), (winid, char *)); + void (*win_change_color)(int, long, int); +#ifdef MACOS9 + void (*win_change_background)(int); + short (*win_set_font_name)(winid, char *); #endif - char *NDECL((*win_get_color_string)); + char *(*win_get_color_string)(void); #endif - /* other defs that really should go away (they're tty specific) */ - void NDECL((*win_start_screen)); - void NDECL((*win_end_screen)); - - void FDECL((*win_outrip), (winid, int, time_t)); - void FDECL((*win_preference_update), (const char *)); - char *FDECL((*win_getmsghistory), (BOOLEAN_P)); - void FDECL((*win_putmsghistory), (const char *, BOOLEAN_P)); - void NDECL((*win_status_init)); - void NDECL((*win_status_finish)); - void FDECL((*win_status_enablefield), - (int, const char *, const char *, BOOLEAN_P)); - void FDECL((*win_status_update), (int, genericptr_t, int, int, int, unsigned long *)); - boolean NDECL((*win_can_suspend)); + void (*win_outrip)(winid, int, time_t); + void (*win_preference_update)(const char *); + char *(*win_getmsghistory)(boolean); + void (*win_putmsghistory)(const char *, boolean); + void (*win_status_init)(void); + void (*win_status_finish)(void); + void (*win_status_enablefield)(int, const char *, const char *, + boolean); + void (*win_status_update)(int, genericptr_t, int, int, int, + unsigned long *); + boolean (*win_can_suspend)(void); + void (*win_update_inventory)(int); + win_request_info *(*win_ctrl_nhwindow)(winid, int, win_request_info *); }; extern @@ -91,6 +107,7 @@ extern /* * If you wish to only support one window system and not use procedure * pointers, add the appropriate #ifdef below. + * XXX which is what? */ #define init_nhwindows (*windowprocs.win_init_nhwindows) @@ -109,9 +126,14 @@ extern #define putmixed (*windowprocs.win_putmixed) #define display_file (*windowprocs.win_display_file) #define start_menu (*windowprocs.win_start_menu) -#define add_menu (*windowprocs.win_add_menu) #define end_menu (*windowprocs.win_end_menu) -#define select_menu (*windowprocs.win_select_menu) +/* 5.0: There are real add_menu() and select_menu in the core now. + * add_menu does some common activities, such as menu_colors. + * select_menu does some before and after activities. + * add_menu() and select_menu() are in windows.c + */ +/* #define add_menu (*windowprocs.win_add_menu) */ +/* #define select_menu (*windowprocs.win_select_menu) */ #define message_menu (*windowprocs.win_message_menu) #define mark_synch (*windowprocs.win_mark_synch) @@ -129,13 +151,18 @@ extern #define nh_poskey (*windowprocs.win_nh_poskey) #define nhbell (*windowprocs.win_nhbell) #define nh_doprev_message (*windowprocs.win_doprev_message) -#define getlin (*windowprocs.win_getlin) +/* 5.0: There is a real getlin() in the core now, which does + * some before and after activities. + * [alternative fix for menu search via ':'.] + * getlin() is in windows.c + */ +/* #define getlin (*windowprocs.win_getlin) */ #define get_ext_cmd (*windowprocs.win_get_ext_cmd) #define number_pad (*windowprocs.win_number_pad) -#define delay_output (*windowprocs.win_delay_output) +#define nh_delay_output (*windowprocs.win_delay_output) #ifdef CHANGE_COLOR #define change_color (*windowprocs.win_change_color) -#ifdef MAC +#ifdef MACOS9 #define change_background (*windowprocs.win_change_background) #define set_font_name (*windowprocs.win_set_font_name) #endif @@ -148,10 +175,6 @@ extern */ /* #define yn_function (*windowprocs.win_yn_function) */ -/* other defs that really should go away (they're tty specific) */ -#define start_screen (*windowprocs.win_start_screen) -#define end_screen (*windowprocs.win_end_screen) - #define outrip (*windowprocs.win_outrip) #define preference_update (*windowprocs.win_preference_update) #define getmsghistory (*windowprocs.win_getmsghistory) @@ -161,6 +184,13 @@ extern */ #define status_enablefield (*windowprocs.win_status_enablefield) #define status_update (*windowprocs.win_status_update) +#define ctrl_nhwindow (*windowprocs.win_ctrl_nhwindow) + +/* + * + */ +#define WPID(name) #name, wp_##name +#define WPIDMINUS(name) "-" #name, wp_##name /* * WINCAP @@ -218,17 +248,23 @@ extern #define WC2_RESET_STATUS 0x0100L /* 09 call status_update(BL_RESET) to * indicate 'draw everything' */ #define WC2_TERM_SIZE 0x0200L /* 10 support setting terminal size */ -#define WC2_STATUSLINES 0x0400L /* 16 switch between 2 or 3 lines of status */ -#define WC2_WINDOWBORDERS 0x0800L /* 11 display borders on nh windows */ -#define WC2_PETATTR 0x1000L /* 12 attributes for hilite_pet */ -#define WC2_GUICOLOR 0x2000L /* 13 display colours outside map win */ +#define WC2_STATUSLINES 0x0400L /* 11 switch between 2|3 lines of status */ +#define WC2_WINDOWBORDERS 0x0800L /* 12 display borders on nh windows */ +#define WC2_PETATTR 0x1000L /* 13 attributes for hilite_pet */ +#define WC2_GUICOLOR 0x2000L /* 14 display colours outside map win */ /* pline() can overload the display attributes argument passed to putstr() with one or more flags and at most one of bold/blink/inverse/&c */ -#define WC2_URGENT_MESG 0x4000L /* 14 putstr(WIN_MESSAGE) supports urgency - * via non-display attribute flag */ -#define WC2_SUPPRESS_HIST 0x8000L /* 15 putstr(WIN_MESSAGE) supports history - * suppression via non-disp attr */ - /* 16 free bits */ +#define WC2_URGENT_MESG 0x4000L /* 15 putstr(WIN_MESSAGE) supports urgency + * via non-display attribute flag */ +#define WC2_SUPPRESS_HIST 0x8000L /* 16 putstr(WIN_MESSAGE) supports history + * suppression via non-disp attr */ +#define WC2_MENU_SHIFT 0x010000L /* 17 horizontal menu scrolling */ +#define WC2_U_UTF8STR 0x020000L /* 18 utf8str support */ +#define WC2_EXTRACOLORS 0x040000L /* 19 color support beyond NH_BASIC_COLOR */ + /* 13 free bits */ +#define WC2_EXTRASTATUS 0x080000L /* 20 optional weaponstatus, armorstatus, + * terrainstatus */ + /* 12 free bits */ #define ALIGN_LEFT 1 #define ALIGN_RIGHT 2 @@ -253,16 +289,6 @@ extern #define MAP_MODE_ASCII_FIT_TO_SCREEN 10 #define MAP_MODE_TILES_FIT_TO_SCREEN 11 -#if 0 -#define WC_SND_SOUND 0x0001L /* 01 Port has some sound capabilities */ -#define WC_SND_SPEAKER 0x0002L /* 02 Sound supported via built-in speaker */ -#define WC_SND_STEREO 0x0004L /* 03 Stereo sound supported */ -#define WC_SND_RAW 0x0008L /* 04 Raw sound supported */ -#define WC_SND_WAVE 0x0010L /* 05 Wave support */ -#define WC_SND_MIDI 0x0020L /* 06 Midi support */ - /* 26 free bits */ -#endif - struct wc_Opt { const char *wc_name; unsigned long wc_bit; @@ -270,8 +296,13 @@ struct wc_Opt { /* Macro for the currently active Window Port whose function pointers have been loaded */ +#if 0 +/* 5.0 The string comparison version isn't used anymore */ #define WINDOWPORT(wn) \ - (windowprocs.name && !strncmpi((wn), windowprocs.name, strlen((wn)))) + (windowprocs.name && !strncmpi((#wn), windowprocs.name, strlen((#wn)))) +#endif + +#define WINDOWPORT(wn) (windowprocs.wp_id == wp_##wn) /* role selection by player_selection(); this ought to be in the core... */ #define RS_NAME 0 @@ -289,9 +320,9 @@ struct wc_Opt { #ifdef WINCHAIN /* Setup phases for window chain elements. - void * rv = X_procs_chain(int, int, void *, void *, void *); - Xprivate* ALLOC n 0 0 0 - - INIT n self next nextdata + void * rv = X_procs_chain(int, int, void *, void *, void *); + Xprivate* ALLOC n 0 0 0 + - INIT n self next nextdata where: Xprivate* is anything window chain entry type X wants back n is the link count (starting with 1) @@ -312,149 +343,79 @@ struct chain_procs { const char *name; /* Names should start with [a-z]. Names must * not start with '-'. Names starting with * '+' are reserved for processors. */ + enum wp_ids wp_id; unsigned long wincap; /* window port capability options supported */ unsigned long wincap2; /* additional window port capability options */ - void FDECL((*win_init_nhwindows), (CARGS, int *, char **)); - void FDECL((*win_player_selection), (CARGS)); - void FDECL((*win_askname), (CARGS)); - void FDECL((*win_get_nh_event), (CARGS)); - void FDECL((*win_exit_nhwindows), (CARGS, const char *)); - void FDECL((*win_suspend_nhwindows), (CARGS, const char *)); - void FDECL((*win_resume_nhwindows), (CARGS)); - winid FDECL((*win_create_nhwindow), (CARGS, int)); - void FDECL((*win_clear_nhwindow), (CARGS, winid)); - void FDECL((*win_display_nhwindow), (CARGS, winid, BOOLEAN_P)); - void FDECL((*win_destroy_nhwindow), (CARGS, winid)); - void FDECL((*win_curs), (CARGS, winid, int, int)); - void FDECL((*win_putstr), (CARGS, winid, int, const char *)); - void FDECL((*win_putmixed), (CARGS, winid, int, const char *)); - void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P)); - void FDECL((*win_start_menu), (CARGS, winid)); - void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P, - CHAR_P, int, const char *, BOOLEAN_P)); - void FDECL((*win_end_menu), (CARGS, winid, const char *)); - int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **)); - char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *)); - void FDECL((*win_update_inventory), (CARGS)); - void FDECL((*win_mark_synch), (CARGS)); - void FDECL((*win_wait_synch), (CARGS)); + boolean has_color[CLR_MAX]; + void (*win_init_nhwindows)(CARGS, int *, char **); + void (*win_player_selection)(CARGS); + void (*win_askname)(CARGS); + void (*win_get_nh_event)(CARGS); + void (*win_exit_nhwindows)(CARGS, const char *); + void (*win_suspend_nhwindows)(CARGS, const char *); + void (*win_resume_nhwindows)(CARGS); + winid (*win_create_nhwindow)(CARGS, int); + void (*win_clear_nhwindow)(CARGS, winid); + void (*win_display_nhwindow)(CARGS, winid, boolean); + void (*win_destroy_nhwindow)(CARGS, winid); + void (*win_curs)(CARGS, winid, int, int); + void (*win_putstr)(CARGS, winid, int, const char *); + void (*win_putmixed)(CARGS, winid, int, const char *); + void (*win_display_file)(CARGS, const char *, boolean); + void (*win_start_menu)(CARGS, winid, unsigned long); + void (*win_add_menu)(CARGS, winid, const glyph_info *, + const ANY_P *, char, char, int, + int, const char *, unsigned int); + void (*win_end_menu)(CARGS, winid, const char *); + int (*win_select_menu)(CARGS, winid, int, MENU_ITEM_P **); + char (*win_message_menu)(CARGS, char, int, const char *); + void (*win_mark_synch)(CARGS); + void (*win_wait_synch)(CARGS); #ifdef CLIPPING - void FDECL((*win_cliparound), (CARGS, int, int)); + void (*win_cliparound)(CARGS, int, int); #endif #ifdef POSITIONBAR - void FDECL((*win_update_positionbar), (CARGS, char *)); + void (*win_update_positionbar)(CARGS, char *); #endif - void FDECL((*win_print_glyph), (CARGS, winid, XCHAR_P, XCHAR_P, int, int)); - void FDECL((*win_raw_print), (CARGS, const char *)); - void FDECL((*win_raw_print_bold), (CARGS, const char *)); - int FDECL((*win_nhgetch), (CARGS)); - int FDECL((*win_nh_poskey), (CARGS, int *, int *, int *)); - void FDECL((*win_nhbell), (CARGS)); - int FDECL((*win_doprev_message), (CARGS)); - char FDECL((*win_yn_function), - (CARGS, const char *, const char *, CHAR_P)); - void FDECL((*win_getlin), (CARGS, const char *, char *)); - int FDECL((*win_get_ext_cmd), (CARGS)); - void FDECL((*win_number_pad), (CARGS, int)); - void FDECL((*win_delay_output), (CARGS)); + void (*win_print_glyph)(CARGS, winid, coordxy, coordxy, + const glyph_info *, + const glyph_info *); + void (*win_raw_print)(CARGS, const char *); + void (*win_raw_print_bold)(CARGS, const char *); + int (*win_nhgetch)(CARGS); + int (*win_nh_poskey)(CARGS, coordxy *, coordxy *, int *); + void (*win_nhbell)(CARGS); + int (*win_doprev_message)(CARGS); + char (*win_yn_function) + (CARGS, const char *, const char *, char); + void (*win_getlin)(CARGS, const char *, char *); + int (*win_get_ext_cmd)(CARGS); + void (*win_number_pad)(CARGS, int); + void (*win_delay_output)(CARGS); #ifdef CHANGE_COLOR - void FDECL((*win_change_color), (CARGS, int, long, int)); -#ifdef MAC - void FDECL((*win_change_background), (CARGS, int)); - short FDECL((*win_set_font_name), (CARGS, winid, char *)); + void (*win_change_color)(CARGS, int, long, int); +#ifdef MACOS9 + void (*win_change_background)(CARGS, int); + short (*win_set_font_name)(CARGS, winid, char *); #endif - char *FDECL((*win_get_color_string), (CARGS)); + char *(*win_get_color_string)(CARGS); #endif - /* other defs that really should go away (they're tty specific) */ - void FDECL((*win_start_screen), (CARGS)); - void FDECL((*win_end_screen), (CARGS)); - - void FDECL((*win_outrip), (CARGS, winid, int, time_t)); - void FDECL((*win_preference_update), (CARGS, const char *)); - char *FDECL((*win_getmsghistory), (CARGS, BOOLEAN_P)); - void FDECL((*win_putmsghistory), (CARGS, const char *, BOOLEAN_P)); - void FDECL((*win_status_init), (CARGS)); - void FDECL((*win_status_finish), (CARGS)); - void FDECL((*win_status_enablefield), - (CARGS, int, const char *, const char *, BOOLEAN_P)); - void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, unsigned long *)); - boolean FDECL((*win_can_suspend), (CARGS)); + void (*win_outrip)(CARGS, winid, int, time_t); + void (*win_preference_update)(CARGS, const char *); + char *(*win_getmsghistory)(CARGS, boolean); + void (*win_putmsghistory)(CARGS, const char *, boolean); + void (*win_status_init)(CARGS); + void (*win_status_finish)(CARGS); + void (*win_status_enablefield) + (CARGS, int, const char *, const char *, boolean); + void (*win_status_update)(CARGS, int, genericptr_t, int, int, int, + unsigned long *); + boolean (*win_can_suspend)(CARGS); + void (*win_update_inventory)(CARGS, int); + win_request_info *(*win_ctrl_nhwindow)(CARGS, winid, int, + win_request_info *); }; #endif /* WINCHAIN */ -#ifdef SAFEPROCS -/* - * window port routines available in sys/share/safeproc.c - */ -extern struct window_procs *FDECL(get_safe_procs, (int)); -extern void FDECL(safe_init_nhwindows, (int *, char **)); -extern void NDECL(safe_player_selection); -extern void NDECL(safe_askname); -extern void NDECL(safe_get_nh_event); -extern void FDECL(safe_exit_nhwindows, (const char *)); -extern void FDECL(safe_suspend_nhwindows, (const char *)); -extern void NDECL(safe_resume_nhwindows); -extern winid FDECL(safe_create_nhwindow, (int)); -extern void FDECL(safe_clear_nhwindow, (winid)); -extern void FDECL(safe_display_nhwindow, (winid, BOOLEAN_P)); -extern void FDECL(safe_destroy_nhwindow, (winid)); -extern void FDECL(safe_curs, (winid, int, int)); -extern void FDECL(safe_putstr, (winid, int, const char *)); -extern void FDECL(safe_putmixed, (winid, int, const char *)); -extern void FDECL(safe_display_file, (const char *, BOOLEAN_P)); -extern void FDECL(safe_start_menu, (winid)); -extern void FDECL(safe_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, - int, const char *, BOOLEAN_P)); -extern void FDECL(safe_end_menu, (winid, const char *)); -extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **)); -extern char FDECL(safe_message_menu, (CHAR_P, int, const char *)); -extern void NDECL(safe_update_inventory); -extern void NDECL(safe_mark_synch); -extern void NDECL(safe_wait_synch); -#ifdef CLIPPING -extern void FDECL(safe_cliparound, (int, int)); -#endif -#ifdef POSITIONBAR -extern void FDECL(safe_update_positionbar, (char *)); -#endif -extern void FDECL(safe_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int)); -extern void FDECL(safe_raw_print, (const char *)); -extern void FDECL(safe_raw_print_bold, (const char *)); -extern int NDECL(safe_nhgetch); -extern int FDECL(safe_nh_poskey, (int *, int *, int *)); -extern void NDECL(safe_nhbell); -extern int NDECL(safe_doprev_message); -extern char FDECL(safe_yn_function, (const char *, const char *, CHAR_P)); -extern void FDECL(safe_getlin, (const char *, char *)); -extern int NDECL(safe_get_ext_cmd); -extern void FDECL(safe_number_pad, (int)); -extern void NDECL(safe_delay_output); -#ifdef CHANGE_COLOR -extern void FDECL(safe_change_color, (int, long, int)); -#ifdef MAC -extern void FDECL(safe_change_background, (int)); -extern short FDECL(safe_set_font_name, (winid, char *)); -#endif -extern char *NDECL(safe_get_color_string); -#endif -extern void NDECL(safe_start_screen); -extern void NDECL(safe_end_screen); -extern void FDECL(safe_outrip, (winid, int, time_t)); -extern void FDECL(safe_preference_update, (const char *)); -extern char *FDECL(safe_getmsghistory, (BOOLEAN_P)); -extern void FDECL(safe_putmsghistory, (const char *, BOOLEAN_P)); -extern void NDECL(safe_status_init); -extern void NDECL(safe_status_finish); -extern void FDECL(safe_status_enablefield, - (int, const char *, const char *, BOOLEAN_P)); -extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, unsigned long *)); -extern boolean NDECL(safe_can_suspend); -extern void FDECL(stdio_raw_print, (const char *)); -extern void FDECL(stdio_nonl_raw_print, (const char *)); -extern void FDECL(stdio_raw_print_bold, (const char *)); -extern void NDECL(stdio_wait_synch); -extern int NDECL(stdio_nhgetch); -#endif /* SAFEPROCS */ #endif /* WINPROCS_H */ - diff --git a/include/wintype.h b/include/wintype.h index 26afbca3f..5d17e4147 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintype.h $NHDT-Date: 1549327486 2019/02/05 00:44:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.19 $ */ +/* NetHack 5.0 wintype.h $NHDT-Date: 1717880364 2024/06/08 20:59:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.52 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -13,23 +13,31 @@ typedef union any { struct obj *a_obj; struct monst *a_monst; int a_int; + int a_xint16; + int a_xint8; char a_char; schar a_schar; uchar a_uchar; unsigned int a_uint; long a_long; unsigned long a_ulong; + coordxy a_coordxy; int *a_iptr; + xint16 *a_xint16ptr; + xint8 *a_xint8ptr; long *a_lptr; + coordxy *a_coordxyptr; unsigned long *a_ulptr; unsigned *a_uptr; const char *a_string; - int NDECL((*a_nfunc)); + int (*a_nfunc)(void); unsigned long a_mask32; /* used by status highlighting */ + int64 a_int64; + uint64 a_uint64; /* add types as needed */ } anything; -#define ANY_P union any /* avoid typedef in prototypes */ - /* (buggy old Ultrix compiler) */ +#define ANY_P union any /* avoid typedef in prototypes + * (buggy old Ultrix compiler) */ /* symbolic names for the data types housed in anything */ enum any_types { @@ -49,16 +57,57 @@ enum any_types { ANY_ULPTR, /* pointer to unsigned long */ ANY_STR, /* pointer to null-terminated char string */ ANY_NFUNC, /* pointer to function taking no args, returning int */ - ANY_MASK32 /* 32-bit mask (stored as unsigned long) */ + ANY_MASK32, /* 32-bit mask (stored as unsigned long) */ + + ANY_INVALID /* leave this last */ }; /* menu return list */ typedef struct mi { - anything item; /* identifier */ - long count; /* count */ + anything item; /* identifier */ + long count; /* count */ + unsigned itemflags; /* item flags */ } menu_item; #define MENU_ITEM_P struct mi +/* These would be in sym.h and display.h if they weren't needed to + define the windowproc interface for X11 which doesn't include + most of the main NetHack header files */ + +struct classic_representation { + int color; + int symidx; +}; + +struct unicode_representation { + uint32 utf32ch; + uint8 *utf8str; +}; + +typedef struct glyph_map_entry { + unsigned glyphflags; + struct classic_representation sym; + uint32 customcolor; + uint16 color256idx; + short int tileidx; +#ifdef ENHANCED_SYMBOLS + struct unicode_representation *u; +#endif +} glyph_map; + +/* glyph plus additional info + if you add fields or change the ordering, fix up the following: + g_info initialization in display.c + nul_glyphinfo initialization in display.c + */ +typedef struct glyphinfo { + int glyph; /* the display entity */ + int ttychar; + uint32 framecolor; + glyph_map gm; +} glyph_info; +/*#define GLYPH_INFO_P struct glyphinfo //not used*/ + /* select_menu() "how" argument types */ /* [MINV_PICKMASK in monst.h assumes these have values of 0, 1, 2] */ #define PICK_NONE 0 /* user picks nothing (display only) */ @@ -72,11 +121,14 @@ typedef struct mi { #define NHW_MAP 3 #define NHW_MENU 4 #define NHW_TEXT 5 +#define NHW_PERMINVENT 6 +#define NHW_LAST_TYPE NHW_PERMINVENT /* attribute types for putstr; the same as the ANSI value, for convenience */ #define ATR_NONE 0 #define ATR_BOLD 1 #define ATR_DIM 2 +#define ATR_ITALIC 3 #define ATR_ULINE 4 #define ATR_BLINK 5 #define ATR_INVERSE 7 @@ -88,16 +140,20 @@ typedef struct mi { /* nh_poskey() modifier types */ #define CLICK_1 1 #define CLICK_2 2 +#define NUM_MOUSE_BUTTONS 2 /* invalid winid */ #define WIN_ERR ((winid) -1) -/* menu window keyboard commands (may be mapped) */ +/* menu window keyboard commands (may be mapped); menu_shift_right and + menu_shift_left are for interacting with persistent inventory window */ /* clang-format off */ #define MENU_FIRST_PAGE '^' #define MENU_LAST_PAGE '|' #define MENU_NEXT_PAGE '>' #define MENU_PREVIOUS_PAGE '<' +#define MENU_SHIFT_RIGHT '}' +#define MENU_SHIFT_LEFT '{' #define MENU_SELECT_ALL '.' #define MENU_UNSELECT_ALL '-' #define MENU_INVERT_ALL '@' @@ -105,6 +161,105 @@ typedef struct mi { #define MENU_UNSELECT_PAGE '\\' #define MENU_INVERT_PAGE '~' #define MENU_SEARCH ':' + +#define MENU_ITEMFLAGS_NONE 0x0000000U +#define MENU_ITEMFLAGS_SELECTED 0x0000001U +#define MENU_ITEMFLAGS_SKIPINVERT 0x0000002U +#define MENU_ITEMFLAGS_SKIPMENUCOLORS 0x0000004U + +/* 5.0+ enhanced menu flags that not all window ports are likely to + * support initially. + * + * As behavior and appearance modification flags are added, the various + * individual window ports will likely have to be updated to respond + * to the flags in an appropriate way. + */ + +#define MENU_BEHAVE_STANDARD 0x0000000U +#define MENU_BEHAVE_PERMINV 0x0000001U + +enum perm_invent_toggles { + toggling_off = -1, + toggling_not = 0, + toggling_on = 1 +}; + +/* perm_invent modes */ +enum inv_mode_bits { + InvNormal = 1, + InvShowGold = 2, + InvSparse = 4, /* must be ORed with Normal or ShowGold to be valid */ + InvInUse = 8 +}; +enum inv_modes { /* 'perminv_mode' option settings */ + InvOptNone = 0, /* no perm_invent */ + InvOptOn = InvNormal, /* 1 */ + InvOptFull = InvShowGold, /* 2 */ +#if 1 /*#ifdef TTY_PERM_INVENT*/ + /* confusingly-named "sparse mode" shows all inventory letters, even when + their slots are empty; only meaningful for tty's perm_invent */ + InvOptOn_grid = InvNormal | InvSparse, /* 5 */ + InvOptFull_grid = InvShowGold | InvSparse, /* 6 */ +#endif + InvOptInUse = InvInUse, /* 8 */ +}; + +enum to_core_flags { + active = 0x001, + too_small = 0x002, + prohibited = 0x004, + no_init_done = 0x008, + too_early = 0x010, +}; + +enum from_core_requests { + invalid_core_request = 0, + set_mode = 1, + request_settings = 2, + set_menu_promptstyle = 3, +}; + +struct to_core { + long tocore_flags; + boolean active; + boolean use_update_inventory; /* disable the newer slot interface */ + int maxslot; + int needrows, needcols; + int haverows, havecols; +}; + +struct from_core { + enum from_core_requests core_request; + enum inv_modes invmode; + color_attr menu_promptstyle; +}; + +struct win_request_info_t { + struct to_core tocore; + struct from_core fromcore; +}; + +typedef struct win_request_info_t win_request_info; +extern win_request_info zerowri; /* windows.c */ + +/* #define CORE_INVENT */ + +/* In a binary with multiple window interfaces linked in, this is + * a structure to track certain interface capabilities that cannot be + * statically done at compile time. Some of them can be toggled and + * the core needs to know if they are active or not at the time. + */ + +enum win_display_modes { + wdmode_traditional = 0, + wdmode_tiled +}; + +struct win_settings { + enum win_display_modes wdmode; + uint32 map_frame_color; +}; + /* clang-format on */ #endif /* WINTYPE_H */ diff --git a/include/xwindow.h b/include/xwindow.h index 8b9cfa0d3..72edd084f 100644 --- a/include/xwindow.h +++ b/include/xwindow.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 xwindow.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Dean Luick, 1992 */ +/* NetHack 5.0 xwindow.h $NHDT-Date: 1596498574 2020/08/03 23:49:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */ +/* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef _xwindow_h @@ -13,44 +13,44 @@ /* Resources: - Name Class RepType Default Value - ---- ----- ------- ------------- - background Background Pixel XtDefaultBackground - border BorderColor Pixel XtDefaultForeground - borderWidth BorderWidth Dimension 1 - destroyCallback Callback Pointer NULL - height Height Dimension 0 - mappedWhenManaged MappedWhenManaged Boolean True - sensitive Sensitive Boolean True - width Width Dimension 0 - x Position Position 0 - y Position Position 0 - - rows Width Dimension 21 - columns Height Dimension 80 - foreground Color Pixel XtDefaultForeground - - black Color Pixel "black" - red Color Pixel "red" - green Color Pixel "pale green" - brown Color Pixel "brown" - blue Color Pixel "blue" - magenta Color Pixel "magenta" - cyan Color Pixel "light cyan" - gray Color Pixel "gray" + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + + rows Width Dimension 21 + columns Height Dimension 80 + foreground Color Pixel XtDefaultForeground + + black Color Pixel "black" + red Color Pixel "red" + green Color Pixel "pale green" + brown Color Pixel "brown" + blue Color Pixel "blue" + magenta Color Pixel "magenta" + cyan Color Pixel "light cyan" + gray Color Pixel "gray" //no color// - orange Color Pixel "orange" - bright_green Color Pixel "green" - yellow Color Pixel "yellow" - bright_blue Color Pixel "royal blue" - bright_magenta Color Pixel "violet" - bright_cyan Color Pixel "cyan" - white Color Pixel "white" - - font Font XFontStruct* XtDefaultFont - exposeCallback Callback Callback NULL - callback Callback Callback NULL - resizeCallback Callback Callback NULL + orange Color Pixel "orange" + bright_green Color Pixel "green" + yellow Color Pixel "yellow" + bright_blue Color Pixel "royal blue" + bright_magenta Color Pixel "violet" + bright_cyan Color Pixel "cyan" + white Color Pixel "white" + + font Font XFontStruct* XtDefaultFont + exposeCallback Callback Callback NULL + callback Callback Callback NULL + resizeCallback Callback Callback NULL */ /* define any special resource names here that are not in @@ -76,8 +76,8 @@ #define XtNexposeCallback "exposeCallback" #define XtNresizeCallback "resizeCallback" -extern XFontStruct *WindowFontStruct(/* Widget */); -extern Font WindowFont(/* Widget */); +extern XFontStruct *WindowFontStruct(Widget); +extern Font WindowFont(Widget); #define XtCWindowResource "WindowResource" #define XtCRows "Rows" diff --git a/include/xwindowp.h b/include/xwindowp.h index 74f8e4ac0..6eb8bfdda 100644 --- a/include/xwindowp.h +++ b/include/xwindowp.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 xwindowp.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) Dean Luick, 1992 */ +/* NetHack 5.0 xwindowp.h $NHDT-Date: 1596498575 2020/08/03 23:49:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */ +/* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef _xwindowp_h diff --git a/include/you.h b/include/you.h index ad178a2c5..d788046bf 100644 --- a/include/you.h +++ b/include/you.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 you.h $NHDT-Date: 1547514642 2019/01/15 01:10:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.35 $ */ +/* NetHack 5.0 you.h $NHDT-Date: 1702349061 2023/12/12 02:44:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -22,9 +22,9 @@ struct RoleName { struct RoleAdvance { /* "fix" is the fixed amount, "rnd" is the random amount */ - xchar infix, inrnd; /* at character initialization */ - xchar lofix, lornd; /* gained per level < urole.xlev */ - xchar hifix, hirnd; /* gained per level >= urole.xlev */ + xint16 infix, inrnd; /* at character initialization */ + xint16 lofix, lornd; /* gained per level < gu.urole.xlev */ + xint16 hifix, hirnd; /* gained per level >= gu.urole.xlev */ }; struct u_have { @@ -43,8 +43,8 @@ struct u_event { Bitfield(qcalled, 1); /* called by Quest leader to do task */ Bitfield(qexpelled, 1); /* expelled from the Quest dungeon */ Bitfield(qcompleted, 1); /* successfully completed Quest task */ - Bitfield(uheard_tune, 2); /* 1=know about, 2=heard passtune */ - + Bitfield(uheard_tune, 2); /* 1=know about, 2=heard passtune, 3=bridge has + * been destroyed so tune has become useless */ Bitfield(uopened_dbridge, 1); /* opened the drawbridge */ Bitfield(invoked, 1); /* invoked Gate to the Sanctum level */ Bitfield(gehennom_entered, 1); /* entered Gehennom via Valley */ @@ -52,21 +52,85 @@ struct u_event { Bitfield(udemigod, 1); /* killed the wiz */ Bitfield(uvibrated, 1); /* stepped on "vibrating square" */ Bitfield(ascended, 1); /* has offered the Amulet */ + + Bitfield(amulet_wish, 1); /* has gained a wish from the Amulet */ + /* 7 free bits */ }; -struct u_achieve { - Bitfield(amulet, 1); /* touched Amulet */ - Bitfield(bell, 1); /* touched Bell */ - Bitfield(book, 1); /* touched Book */ - Bitfield(menorah, 1); /* touched Candelabrum */ - Bitfield(enter_gehennom, - 1); /* entered Gehennom (or Valley) by any means */ - Bitfield(ascended, 1); /* not quite the same as u.uevent.ascended */ - Bitfield(mines_luckstone, 1); /* got a luckstone at end of mines */ - Bitfield(finish_sokoban, 1); /* obtained the sokoban prize */ - - Bitfield(killed_medusa, 1); +/* + * Achievements: milestones reached during the current game. + * Numerical order of these matters because they've been encoded in + * a bitmask in xlogfile. Reordering would break decoding that. + * Aside from that, the number isn't significant--they're recorded + * and eventually disclosed in the order achieved. + * + * Since xlogfile could be post-processed by unknown tools, we should + * limit these to 31 total (it's possible that 32-bit signed longs are + * the best such tools can offer). Eventually that is likely to need + * to change, probably by giving xlogfile an achieve2 field rather + * than by assuming that 64-bit longs are viable or by squeezing in a + * 32nd entry by switching to unsigned long. + */ +enum achivements { + ACH_BELL = 1, /* acquired Bell of Opening */ + ACH_HELL = 2, /* entered Gehennom */ + ACH_CNDL = 3, /* acquired Candelabrum of Invocation */ + ACH_BOOK = 4, /* acquired Book of the Dead */ + ACH_INVK = 5, /* performed invocation to gain access to Sanctum */ + ACH_AMUL = 6, /* acquired The Amulet */ + ACH_ENDG = 7, /* entered end game */ + ACH_ASTR = 8, /* entered Astral Plane */ + ACH_UWIN = 9, /* ascended */ + ACH_MINE_PRIZE = 10, /* acquired Mines' End luckstone */ + ACH_SOKO_PRIZE = 11, /* acquired Sokoban bag or amulet */ + ACH_MEDU = 12, /* killed Medusa */ + ACH_BLND = 13, /* hero was always blond, no, blind */ + ACH_NUDE = 14, /* hero never wore armor */ + /* 1 through 14 were present in 3.6.x; the rest are newer; first, + some easier ones so less skilled players can have achievements */ + ACH_MINE = 15, /* entered Gnomish Mines */ + ACH_TOWN = 16, /* reached Minetown */ + ACH_SHOP = 17, /* entered a shop */ + ACH_TMPL = 18, /* entered a temple */ + ACH_ORCL = 19, /* consulted the Oracle */ + ACH_NOVL = 20, /* read at least one passage from a Discworld novel */ + ACH_SOKO = 21, /* entered Sokoban */ + ACH_BGRM = 22, /* entered Bigroom (not guaranteed to be in every dgn) */ + /* role's rank titles, beyond first (#0 at level one, not an achievement); + 23..30 are negated if hero is female at the time new rank is gained + so that disclosing them can use the gender which applied at the time */ + ACH_RNK1 = 23, ACH_RNK2 = 24, ACH_RNK3 = 25, ACH_RNK4 = 26, + ACH_RNK5 = 27, ACH_RNK6 = 28, ACH_RNK7 = 29, ACH_RNK8 = 30, + ACH_TUNE = 31, /* discovered the castle drawbridge's open/close tune */ + N_ACH = 32 /* allocate room for 31 plus a slot for 0 terminator */ }; + /* + * Other potential achievements to track (this comment briefly resided + * in encodeachieve(topten.c) and has been revised since moving here: + * AC <= 0, AC <= -10, AC <= -20 (stop there; lower is better but + * not something to encourage with achievements), + * got quest summons, + * entered quest branch, + * chatted with leader, + * entered second or lower quest level (implies leader gave the Ok), + * entered last quest level, + * defeated nemesis (not same as acquiring Bell or artifact), + * completed quest (formally, by bringing artifact to leader), + * entered rogue level, + * entered Fort Ludios level/branch (not guaranteed to be achievable), + * entered Medusa level, + * entered castle level, + * obtained castle wand (handle similarly to mines and sokoban prizes), + * passed Valley level (entered-Gehennom already covers Valley itself), + * [assorted demon lairs?], + * entered Vlad's tower branch, + * defeated Vlad (not same as acquiring Candelabrum), + * entered Wizard's tower area within relevant level, + * defeated Wizard, + * found vibrating square, + * entered sanctum level (maybe not; too close to performed-invocation), + * [defeated Famine, defeated Pestilence, defeated Death] + */ struct u_realtime { long realtime; /* accumulated playing time in seconds */ @@ -92,13 +156,27 @@ struct u_conduct { /* number of times... */ long polyselfs; /* transformed yourself */ long wishes; /* used a wish */ long wisharti; /* wished for an artifact */ + long hf_reserved1; /* hf uses for elbereth;for hf savefile compatiblity */ + long sokocheat; /* violated special 'rules' in Sokoban */ + long pets; /* obtained a pet */ /* genocides already listed at end of game */ + long reserved1; + long reserved2; + long reserved3; + long reserved4; }; struct u_roleplay { - boolean blind; /* permanently blind */ - boolean nudist; /* has not worn any armor, ever */ - long numbones; /* # of bones files loaded */ + boolean blind; /* permanently blind */ + boolean nudist; /* has not worn any armor, ever */ + boolean deaf; /* permanently deaf */ + boolean pauper; /* no starting inventory */ + boolean reroll; /* starting inventory/attr rerolling enabled */ + boolean reserved1; + boolean reserved2; + boolean reserved3; + long numbones; /* # of bones files loaded */ + long numrerolls; /* # of rerolls used */ }; /*** Unified structure containing role information ***/ @@ -112,8 +190,7 @@ struct Role { const char *intermed; /* quest intermediate goal (from questpgr.c) */ /*** Indices of important monsters and objects ***/ - short malenum, /* index (PM_) as a male (botl.c) */ - femalenum, /* ...or as a female (NON_PM == same) */ + short mnum, /* index (PM_) of role (botl.c) */ petnum, /* PM_ of preferred pet (NON_PM == random) */ ldrnum, /* PM_ of quest leader (questpgr.c) */ guardnum, /* PM_ of quest guardians (questpgr.c) */ @@ -137,12 +214,12 @@ struct Role { #define ROLE_CHAOTIC AM_CHAOTIC /*** Attributes (from attrib.c and exper.c) ***/ - xchar attrbase[A_MAX]; /* lowest initial attributes */ - xchar attrdist[A_MAX]; /* distribution of initial attributes */ + xint16 attrbase[A_MAX]; /* lowest initial attributes */ + xint16 attrdist[A_MAX]; /* distribution of initial attributes */ struct RoleAdvance hpadv; /* hit point advancement */ struct RoleAdvance enadv; /* energy advancement */ - xchar xlev; /* cutoff experience level */ - xchar initrecord; /* initial alignment record */ + xint16 xlev; /* cutoff experience level */ + xint16 initrecord; /* initial alignment record */ /*** Spell statistics (from spell.c) ***/ int spelbase; /* base spellcasting penalty */ @@ -167,9 +244,8 @@ struct Role { }; extern const struct Role roles[]; /* table of available roles */ -extern struct Role urole; -#define Role_if(X) (urole.malenum == (X)) -#define Role_switch (urole.malenum) +#define Role_if(X) (gu.urole.mnum == (X)) +#define Role_switch (gu.urole.mnum) /* used during initialization for race, gender, and alignment as well as for character class */ @@ -187,8 +263,7 @@ struct Race { struct RoleName individual; /* individual as a noun ("man", "elf") */ /*** Indices of important monsters and objects ***/ - short malenum, /* PM_ as a male monster */ - femalenum, /* ...or as a female (NON_PM == same) */ + short mnum, /* PM_ as a monster */ mummynum, /* PM_ as a mummy */ zombienum; /* PM_ as a zombie */ @@ -199,8 +274,8 @@ struct Race { hatemask; /* bit mask of always hostile */ /*** Attributes ***/ - xchar attrmin[A_MAX]; /* minimum allowable attribute */ - xchar attrmax[A_MAX]; /* maximum allowable attribute */ + xint16 attrmin[A_MAX]; /* minimum allowable attribute */ + xint16 attrmax[A_MAX]; /* maximum allowable attribute */ struct RoleAdvance hpadv; /* hit point advancement */ struct RoleAdvance enadv; /* energy advancement */ #if 0 /* DEFERRED */ @@ -219,9 +294,8 @@ struct Race { }; extern const struct Race races[]; /* Table of available races */ -extern struct Race urace; -#define Race_if(X) (urace.malenum == (X)) -#define Race_switch (urace.malenum) +#define Race_if(X) (gu.urace.mnum == (X)) +#define Race_switch (gu.urace.mnum) /*** Unified structure specifying gender information ***/ struct Gender { @@ -240,14 +314,21 @@ extern const struct Gender genders[]; /* table of available genders */ #define uhe() (genders[flags.female ? 1 : 0].he) #define uhim() (genders[flags.female ? 1 : 0].him) #define uhis() (genders[flags.female ? 1 : 0].his) +/* pronoun_gender() flag masks */ +#define PRONOUN_NORMAL 0 /* none of the below */ +#define PRONOUN_NO_IT 1 +#define PRONOUN_HALLU 2 /* corresponding pronouns for monsters; yields "it" when mtmp can't be seen */ -#define mhe(mtmp) (genders[pronoun_gender(mtmp, FALSE)].he) -#define mhim(mtmp) (genders[pronoun_gender(mtmp, FALSE)].him) -#define mhis(mtmp) (genders[pronoun_gender(mtmp, FALSE)].his) +#define mhe(mtmp) (genders[pronoun_gender(mtmp, PRONOUN_HALLU)].he) +#define mhim(mtmp) (genders[pronoun_gender(mtmp, PRONOUN_HALLU)].him) +#define mhis(mtmp) (genders[pronoun_gender(mtmp, PRONOUN_HALLU)].his) /* override "it" if reason is lack of visibility rather than neuter species */ -#define noit_mhe(mtmp) (genders[pronoun_gender(mtmp, TRUE)].he) -#define noit_mhim(mtmp) (genders[pronoun_gender(mtmp, TRUE)].him) -#define noit_mhis(mtmp) (genders[pronoun_gender(mtmp, TRUE)].his) +#define noit_mhe(mtmp) \ + (genders[pronoun_gender(mtmp, (PRONOUN_NO_IT | PRONOUN_HALLU))].he) +#define noit_mhim(mtmp) \ + (genders[pronoun_gender(mtmp, (PRONOUN_NO_IT | PRONOUN_HALLU))].him) +#define noit_mhis(mtmp) \ + (genders[pronoun_gender(mtmp, (PRONOUN_NO_IT | PRONOUN_HALLU))].his) /*** Unified structure specifying alignment information ***/ struct Align { @@ -262,29 +343,42 @@ struct Align { extern const struct Align aligns[]; /* table of available alignments */ enum utraptypes { - TT_BEARTRAP = 0, - TT_PIT = 1, - TT_WEB = 2, - TT_LAVA = 3, - TT_INFLOOR = 4, - TT_BURIEDBALL = 5 + TT_NONE = 0, + TT_BEARTRAP = 1, + TT_PIT = 2, + TT_WEB = 3, + TT_LAVA = 4, + TT_INFLOOR = 5, + TT_BURIEDBALL = 6 +}; + +enum utotypes { + UTOTYPE_NONE = 0x00, + UTOTYPE_ATSTAIRS = 0x01, + UTOTYPE_FALLING = 0x02, + UTOTYPE_PORTAL = 0x04, + UTOTYPE_RMPORTAL = 0x10, /* remove portal */ + UTOTYPE_DEFERRED = 0x20 /* deferred_goto */ }; /*** Information about the player ***/ struct you { - xchar ux, uy; /* current map coordinates */ - schar dx, dy, dz; /* direction of move (or zap or ... ) */ - schar di; /* direction of FF */ - xchar tx, ty; /* destination of travel */ - xchar ux0, uy0; /* initial position FF */ + coordxy ux, uy; /* current map coordinates */ + int dx, dy, dz; /* x,y,z deltas; direction of move (or zap or ... ) + * usually +1 or 0 or -1 */ + coordxy tx, ty; /* destination of travel */ + coordxy ux0, uy0; /* previous ux,uy */ d_level uz, uz0; /* your level on this and the previous turn */ d_level utolev; /* level monster teleported you to, or uz */ uchar utotype; /* bitmask of goto_level() flags for utolev */ + d_level ucamefrom; /* level where you came from; used for tutorial */ boolean umoved; /* changed map location (post-move) */ int last_str_turn; /* 0: none, 1: half turn, 2: full turn - +: turn right, -: turn left */ - int ulevel; /* 1 to MAXULEV */ - int ulevelmax; + * +: turn right, -: turn left */ + int ulevel; /* 1 to MAXULEV (30) */ + int ulevelmax; /* highest level, but might go down (to throttle + * lost level recovery via blessed full healing) */ + int ulevelpeak; /* really highest level reached; never does down */ unsigned utrap; /* trap timeout */ unsigned utraptype; /* defined if utrap nonzero. one of utraptypes */ char urooms[5]; /* rooms (roomno + 3) occupied now */ @@ -295,7 +389,7 @@ struct you { char ushops_entered[5]; /* ditto, shops entered this turn */ char ushops_left[5]; /* ditto, shops exited this turn */ - int uhunger; /* refd only in eat.c and shk.c */ + int uhunger; /* refd only in eat.c and shk.c (also insight.c) */ unsigned uhs; /* hunger state - see eat.c */ struct prop uprops[LAST_PROP + 1]; @@ -309,6 +403,7 @@ struct you { /* These ranges can never be more than MAX_RANGE (vision.h). */ int nv_range; /* current night vision range */ int xray_range; /* current xray vision range */ + int unblind_telepat_range; /* * These variables are valid globally only when punished and blind. @@ -323,7 +418,8 @@ struct you { int umonster; /* hero's "real" monster num */ int umonnum; /* current monster number */ - int mh, mhmax, mtimedone; /* for polymorph-self */ + int mh, mhmax, /* current and max hit points when polyd */ + mtimedone; /* no. of turns until polymorph times out */ struct attribs macurr, /* for monster attribs */ mamax; /* for monster attribs */ int ulycn; /* lycanthrope type */ @@ -339,10 +435,13 @@ struct you { Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */ Bitfield(uburied, 1); /* you're buried */ Bitfield(uedibility, 1); /* blessed food detect; sense unsafe food */ - /* 1 free bit! */ + Bitfield(uhandedness, 1); /* There is no advantage for either handedness. + The distinction is only for flavor variation + and for use in messages. */ +#define RIGHT_HANDED 0x00 +#define LEFT_HANDED 0x01 unsigned udg_cnt; /* how long you have been demigod */ - struct u_achieve uachieve; /* achievements */ struct u_event uevent; /* certain events have happened */ struct u_have uhave; /* you're carrying special objects */ struct u_conduct uconduct; /* KMH, conduct */ @@ -359,44 +458,112 @@ struct you { #define A_CURRENT 0 aligntyp ualignbase[CONVERT]; /* for ualign conversion record */ schar uluck, moreluck; /* luck and luck bonus */ + /* default u.uluck is 0 except on special days (full moon: +1, Fri 13: -1, + both: 0); equilibrium for luck timeout is changed to those values, + but Luck max and min stay at 10+3 and -10-3 even on those days */ #define Luck (u.uluck + u.moreluck) #define LUCKADD 3 /* value of u.moreluck when carrying luck stone; - + when blessed or uncursed, - when cursed */ -#define LUCKMAX 10 /* maximum value of u.ulUck */ + * +3 when blessed or uncursed, -3 when cursed */ +#define LUCKMAX 10 /* maximum value of u.uluck */ #define LUCKMIN (-10) /* minimum value of u.uluck */ schar uhitinc; schar udaminc; schar uac; +#define AC_MAX 99 /* abs(u.uac) <= 99; likewise for monster AC */ uchar uspellprot; /* protection by SPE_PROTECTION */ uchar usptime; /* #moves until uspellprot-- */ uchar uspmtime; /* #moves between uspellprot-- */ - int uhp, uhpmax; /* hit points, aka health */ - int uen, uenmax; /* magical energy - M. Stephenson */ - xchar uhpinc[MAXULEV], /* increases to uhpmax for each level gain */ + int uhp, uhpmax, /* hit points, aka health */ + uhppeak; /* highest value of uhpmax so far */ + int uen, uenmax, /* magical energy, aka spell power */ + uenpeak; /* highest value of uenmax so far */ + xint16 uhpinc[MAXULEV], /* increases to uhpmax for each level gain */ ueninc[MAXULEV]; /* increases to uenmax for each level gain */ int ugangr; /* if the gods are angry at you */ int ugifts; /* number of artifacts bestowed */ int ublessed, ublesscnt; /* blessing/duration from #pray */ long umoney0; long uspare1; - long uexp, urexp; + long uexp, urexp; /* exper pts for gaining levels and for score */ long ucleansed; /* to record moves when player was cleansed */ long usleep; /* sleeping; monstermove you last started */ int uinvault; struct monst *ustuck; /* engulfer or grabber, maybe grabbee if Upolyd */ struct monst *usteed; /* mount when riding */ + unsigned ustuck_mid; /* u.ustuck->m_id, used during save/restore */ + unsigned usteed_mid; /* u.usteed->m_id, used during save/restore */ long ugallop; /* turns steed will run after being kicked */ int urideturns; /* time spent riding, for skill advancement */ int umortality; /* how many times you died */ int ugrave_arise; /* you die and become something aside from a ghost */ int weapon_slots; /* unused skill slots */ int skills_advanced; /* # of advances made so far */ - xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */ + xint16 skill_record[P_SKILL_LIMIT]; /* skill advancements */ struct skills weapon_skills[P_NUM_SKILLS]; boolean twoweap; /* KMH -- Using two-weapon combat */ - + short mcham; /* vampire mndx if shapeshifted to bat/cloud */ + short umovement; /* instead of youmonst.movement */ + schar uachieved[N_ACH]; /* list of achievements in the order attained */ + struct monst *umonst; /* for future conversion of &gy.youmonst to u.umonst */ }; /* end of `struct you' */ + +/* _hitmon_data: Info for when hero hits a monster */ +/* The basic reason we need all these booleans is that we don't want + * a "hit" message when a monster dies, so we have to know how much + * damage it did _before_ outputting a hit message, but any messages + * associated with the damage don't come out until _after_ outputting + * a hit message. + * + * More complications: first_weapon_hit() should be called before + * xkilled() in order to have the gamelog messages in the right order. + * So it can't be deferred until end of known_hitum() as was originally + * done. + */ +struct _hitmon_data { + int dmg; /* damage */ + int thrown; + int twohits; /* 0: 1 of 1; 1: 1 of 2; 2: 2 of 2 */ + int dieroll; + struct permonst *mdat; + boolean use_weapon_skill; + boolean train_weapon_skill; + int barehand_silver_rings; + boolean silvermsg; + boolean silverobj; + boolean lightobj; + int material; + int jousting; + boolean hittxt; + boolean get_dmg_bonus; + boolean unarmed; + boolean hand_to_hand; + boolean ispoisoned; + boolean unpoisonmsg; + boolean needpoismsg; + boolean poiskilled; + boolean already_killed; + boolean offmap; + boolean destroyed; + boolean dryit; + boolean doreturn; + boolean retval; + char saved_oname[BUFSZ]; +}; + #define Upolyd (u.umonnum != u.umonster) +#define Ugender ((Upolyd ? u.mfemale : flags.female) ? 1 : 0) + +/* point px,py is adjacent to (or same location as) hero */ +#define next2u(px,py) (distu((px),(py)) <= 2) +/* is monster on top of or next to hero? */ +#define m_next2u(m) (distu((m)->mx,(m)->my) <= 2) +/* hero at (x,y)? */ +#define u_at(x,y) ((x) == u.ux && (y) == u.uy) + +#define URIGHTY (u.uhandedness == RIGHT_HANDED) +#define ULEFTY (u.uhandedness == LEFT_HANDED) +#define RING_ON_PRIMARY (ULEFTY ? uleft : uright) +#define RING_ON_SECONDARY (ULEFTY ? uright : uleft) #endif /* YOU_H */ diff --git a/include/youprop.h b/include/youprop.h index c9656aacf..4aa6557fa 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 youprop.h $NHDT-Date: 1568831820 2019/09/18 18:37:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.27 $ */ -/* Copyright (c) 1989 Mike Threepoint */ +/* NetHack 5.0 youprop.h $NHDT-Date: 1725653018 2024/09/06 20:03:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.45 $ */ +/* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ #ifndef YOUPROP_H @@ -8,7 +8,6 @@ #include "prop.h" #include "permonst.h" #include "mondata.h" -#include "pm.h" /* KMH, intrinsics patch. * Reorganized and rewritten for >32-bit properties. @@ -65,10 +64,12 @@ #define EStone_resistance u.uprops[STONE_RES].extrinsic #define Stone_resistance (HStone_resistance || EStone_resistance) -/* Intrinsics only */ #define HSick_resistance u.uprops[SICK_RES].intrinsic -#define Sick_resistance (HSick_resistance || defends(AD_DISE, uwep)) +#define ESick_resistance u.uprops[SICK_RES].extrinsic +#define Sick_resistance (HSick_resistance || ESick_resistance \ + || defended(&gy.youmonst, AD_DISE)) +/* Intrinsics only */ #define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ /*** Troubles ***/ @@ -82,20 +83,28 @@ #define HConfusion u.uprops[CONFUSION].intrinsic #define Confusion HConfusion -#define Blinded u.uprops[BLINDED].intrinsic -#define Blindfolded (ublindf && ublindf->otyp != LENSES) -/* ...means blind because of a cover */ -#define Blind \ - ((u.uroleplay.blind || Blinded || Blindfolded \ - || !haseyes(youmonst.data)) \ - && !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)) -/* ...the Eyes operate even when you really are blind - or don't have any eyes */ -#define Blindfolded_only \ - (Blindfolded && ublindf->oartifact != ART_EYES_OF_THE_OVERWORLD \ - && !u.uroleplay.blind && !Blinded && haseyes(youmonst.data)) -/* ...blind because of a blindfold, and *only* that */ +/* Blindness is more complex than other properties */ +#define HBlinded u.uprops[BLINDED].intrinsic /* TIMEOUT|FROMOUTSIDE|FROMFORM */ +#define EBlinded u.uprops[BLINDED].extrinsic /* W_TOOL */ + /* wearing the Eyes of the Overworld overrides blindness */ +#define BBlinded u.uprops[BLINDED].blocked /* W_TOOL */ + /* non-blindfold: timed effect | u.uroleplay.blind | !haseyes() */ +#define Blinded (HBlinded && !BBlinded) +#define BlindedTimeout (HBlinded & TIMEOUT) +#define PermaBlind ((HBlinded & FROMOUTSIDE) != 0L) /* OPTIONS:blind */ + /* worn blindfold (or towel; lenses don't set [BLINDED].extrinsic) */ +#define Blindfolded EBlinded +#define Blindfolded_only (Blindfolded && !Blinded) + /* '#define Blind (Blinded || Blindfolded)' would work, but only + because BBlinded (conferred by artifact lenses) and Blindfolded + are mutually exclusive; explicitly applying !BBlinded to both + internal and external blindness should be more robust in case + of future changes */ +#define Blind ((HBlinded || EBlinded) && !BBlinded) +/* + * Maladies + */ #define Sick u.uprops[SICK].intrinsic #define Stoned u.uprops[STONED].intrinsic #define Strangled u.uprops[STRANGLED].intrinsic @@ -113,16 +122,22 @@ /* Timeout, plus a worn mask */ #define HDeaf u.uprops[DEAF].intrinsic #define EDeaf u.uprops[DEAF].extrinsic -#define Deaf (HDeaf || EDeaf) +#define Deaf (HDeaf || EDeaf || u.uroleplay.deaf) #define HFumbling u.uprops[FUMBLING].intrinsic #define EFumbling u.uprops[FUMBLING].extrinsic #define Fumbling (HFumbling || EFumbling) +/* HWounded_legs indicates whether wounded leg(s) condition exists and + holds the timeout for recovery; EWounded_legs uses the worn-ring bits + to track left vs right vs both and is meaningless when HWounded_legs + is zero except when timeout has just decremented that to 0 and calls + heal_legs(); both values apply to steed rather than to hero when riding */ #define HWounded_legs u.uprops[WOUNDED_LEGS].intrinsic #define EWounded_legs u.uprops[WOUNDED_LEGS].extrinsic #define Wounded_legs (HWounded_legs || EWounded_legs) +/* Sleepy: prone to falling asleep periodically; not necessarily asleep now */ #define HSleepy u.uprops[SLEEPY].intrinsic #define ESleepy u.uprops[SLEEPY].extrinsic #define Sleepy (HSleepy || ESleepy) @@ -141,6 +156,10 @@ #define Blind_telepat (HTelepat || ETelepat) #define Unblind_telepat (ETelepat) +#define HBlnd_resist u.uprops[BLND_RES].intrinsic /* from form */ +#define EBlnd_resist u.uprops[BLND_RES].extrinsic /* wielding Sunsword */ +#define Blnd_resist (HBlnd_resist || EBlnd_resist) + #define HWarning u.uprops[WARNING].intrinsic #define EWarning u.uprops[WARNING].extrinsic #define Warning (HWarning || EWarning) @@ -180,11 +199,13 @@ #define Invisible (Invis && !See_invisible) /* Note: invisibility also hides inventory and steed */ -#define EDisplaced u.uprops[DISPLACED].extrinsic -#define Displaced EDisplaced +#define HDisplaced u.uprops[DISPLACED].intrinsic /* timed from corpse */ +#define EDisplaced u.uprops[DISPLACED].extrinsic /* worn cloak */ +#define Displaced (HDisplaced || EDisplaced) #define HStealth u.uprops[STEALTH].intrinsic #define EStealth u.uprops[STEALTH].extrinsic +/* BStealth has FROMOUTSIDE set if mounted on non-flying steed */ #define BStealth u.uprops[STEALTH].blocked #define Stealth ((HStealth || EStealth) && !BStealth) @@ -234,8 +255,9 @@ && !BFlying) /* May touch surface; does not override any others */ +#define HWwalking u.uprops[WWALKING].intrinsic /* see lava_effects() */ #define EWwalking u.uprops[WWALKING].extrinsic -#define Wwalking (EWwalking && !Is_waterlevel(&u.uz)) +#define Wwalking ((HWwalking || EWwalking) && !Is_waterlevel(&u.uz)) /* Don't get wet, can't go under water; overrides others except levitation */ /* Wwalking is meaningless on water level */ @@ -248,11 +270,11 @@ #define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic #define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic #define Amphibious \ - (HMagical_breathing || EMagical_breathing || amphibious(youmonst.data)) + (HMagical_breathing || EMagical_breathing || amphibious(gy.youmonst.data)) /* Get wet, may go under surface */ #define Breathless \ - (HMagical_breathing || EMagical_breathing || breathless(youmonst.data)) + (HMagical_breathing || EMagical_breathing || breathless(gy.youmonst.data)) #define Underwater (u.uinwater) /* Note that Underwater and u.uinwater are both used in code. @@ -368,10 +390,19 @@ * Some pseudo-properties. */ +/* the code will needs lots of updating to use this so leave it commented +#define Riding (u.usteed != NULL) +*/ + /* unconscious() includes u.usleep but not is_fainted(); the multi test is redundant but allows the function calls to be skipped most of the time */ -#define Unaware (multi < 0 && (unconscious() || is_fainted())) +#define Unaware (gm.multi < 0 && (unconscious() || is_fainted())) + +#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(gy.youmonst.data)) -#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(youmonst.data)) +/* _The_Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round + your head to ward off noxious fumes" [we require it to be damp or wet] */ +#define Half_gas_damage \ + (ublindf && ublindf->otyp == TOWEL && ublindf->spe > 0) #endif /* YOUPROP_H */ From 0f452f2742f2262cc0cea1bd58835854a72de0f1 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 15:50:24 +0100 Subject: [PATCH 3/9] Remove header - missed in first commti --- include/tosconf.h | 87 ----------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 include/tosconf.h diff --git a/include/tosconf.h b/include/tosconf.h deleted file mode 100644 index 3f5ca4c5f..000000000 --- a/include/tosconf.h +++ /dev/null @@ -1,87 +0,0 @@ -/* NetHack 3.6 tosconf.h $NHDT-Date: 1432512782 2015/05/25 00:13:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifdef TOS -#ifndef TOSCONF_H -#define TOSCONF_H - -#define MICRO /* must be defined to allow some inclusions */ - -/* - Adjust these options to suit your compiler. The default here is for - GNU C with the MiNT library. -*/ - -/*#define NO_SIGNAL /* library doesn't support signals */ -/*#define NO_FSTAT /* library doesn't have fstat() call */ -#define MINT /* library supports MiNT extensions to TOS */ - -#ifdef __MINT__ -#define MINT -#endif - -#ifdef O_BINARY -#define FCMASK O_BINARY -#else -#define FCMASK 0660 -#define O_BINARY 0 -#endif - -#ifdef UNIXDEBUG -#define remove(x) unlink(x) -#endif - -/* configurable options */ -#define MFLOPPY /* floppy support */ -#define RANDOM /* improved random numbers */ -#define SHELL /* allow spawning of shell */ -#define TERMLIB /* use termcap */ -#define TEXTCOLOR /* allow color */ -#define MAIL /* enable the fake maildemon */ -#ifdef MINT -#define SUSPEND /* allow suspending the game */ -#endif - -#ifndef TERMLIB -#define ANSI_DEFAULT /* use vt52 by default */ -#endif - -#if defined(__GNUC__) || defined(__MINT__) -/* actually, only more recent GNU C libraries have strcmpi - * on the other hand, they're free -- if yours is out of - * date, grab the most recent from atari.archive.umich.edu - */ -#define STRNCMPI -#undef strcmpi -extern int FDECL(strcmpi, (const char *, const char *)); -extern int FDECL(strncmpi, (const char *, const char *, size_t)); -#endif - -#include -#include -/* instead of including system.h from pcconf.h */ -#include -#include -#include -#define SIG_RET_TYPE __Sigfunc -#define SYSTEM_H - -#ifndef MICRO_H -#include "micro.h" -#endif -#ifndef PCCONF_H -#include "pcconf.h" /* remainder of stuff is same as the PC */ -#endif - -#ifdef TEXTCOLOR -extern boolean colors_changed; /* in tos.c */ -#endif - -#ifdef __GNUC__ -#define GCC_BUG /* correct a gcc bug involving double for loops */ -#endif - -#endif /* TOSCONF_H */ -#endif /* TOS */ From ea74e56e1ed7f13e745baab32ad5a5cb71fa577c Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 16:25:18 +0100 Subject: [PATCH 4/9] Add nh5 config.h with NLE mods --- include/config.h | 366 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 263 insertions(+), 103 deletions(-) diff --git a/include/config.h b/include/config.h index 36df21b5f..88e6e029f 100644 --- a/include/config.h +++ b/include/config.h @@ -1,7 +1,6 @@ -/* NetHack 3.6 config.h $NHDT-Date: 1575245033 2019/12/02 00:03:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.126 $ */ +/* NetHack 5.0 config.h $NHDT-Date: 1710344316 2024/03/13 15:38:36 $ $NHDT-Branch: keni-staticfn $:$NHDT-Revision: 1.188 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ -/* Copyright (c) Facebook, Inc,. and its affiliates. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef CONFIG_H /* make sure the compiler does not see the typedefs twice */ @@ -25,7 +24,7 @@ /* #define TOS */ /* define for Atari ST/TT */ /* #define STUPID */ /* avoid some complicated expressions if - your C compiler chokes on them */ + * your C compiler chokes on them */ /* #define MINIMAL_TERM */ #define ANSI_DEFAULT /* NLE: Don't #define TERMLIB in tcap.h, use this. */ /* if a terminal handles highlighting or tabs poorly, @@ -38,19 +37,28 @@ /* Hint: if you're not developing code, don't define ULTRIX_PROTO. */ -#include "config1.h" /* should auto-detect MSDOS, MAC, AMIGA, and WIN32 */ +#include "config1.h" /* should auto-detect MSDOS, MACOS9, AMIGA, and WIN32 */ + +/* + * Consolidated version, patchlevel, development status. + */ +#ifdef SHORT_FILENAMES +#include "patchlev.h" +#else +#include "patchlevel.h" +#endif + /* Windowing systems... * Define all of those you want supported in your binary. * Some combinations make no sense. See the installation document. */ #if !defined(NOTTYGRAPHICS) -#define TTY_GRAPHICS /* good old tty based graphics */ +#define TTY_GRAPHICS /* good old tty-based graphics */ #endif /* #define CURSES_GRAPHICS *//* Curses interface - Karl Garrison*/ /* #define X11_GRAPHICS */ /* X11 interface */ /* #define QT_GRAPHICS */ /* Qt interface */ -/* #define GNOME_GRAPHICS */ /* Gnome interface */ /* #define MSWIN_GRAPHICS */ /* Windows NT, CE, Graphics */ #define RL_GRAPHICS /* Reinforcement learning 'window' port */ @@ -61,11 +69,11 @@ * Define the default window system. This should be one that is compiled * into your system (see defines above). Known window systems are: * - * tty, X11, mac, amii, BeOS, Qt, Gem, Gnome, rl + * tty, X11, mac, amii, BeOS, Qt, Gem, Gnome, shim, rl */ -/* MAC also means MAC windows */ -#ifdef MAC +/* MACOS9 also means MAC windows */ +#ifdef MACOS9 #ifndef AUX #define DEFAULT_WINDOW_SYS "mac" #endif @@ -93,22 +101,27 @@ #ifdef QT_GRAPHICS #ifndef DEFAULT_WC_TILED_MAP -#define DEFAULT_WC_TILED_MAP /* Default to tiles if users doesn't say \ - wc_ascii_map */ -#endif -#ifndef NOUSER_SOUNDS -#define USER_SOUNDS /* Use sounds */ +#define DEFAULT_WC_TILED_MAP /* Default to tiles if users doesn't request + * wc_ascii_map */ #endif +#ifndef USE_XPM #define USE_XPM /* Use XPM format for images (required) */ +#endif +#ifndef GRAPHIC_TOMBSTONE #define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ +#endif #ifndef DEFAULT_WINDOW_SYS #define DEFAULT_WINDOW_SYS "Qt" #endif #endif #ifdef GNOME_GRAPHICS +#ifndef USE_XPM #define USE_XPM /* Use XPM format for images (required) */ +#endif +#ifndef GRAPHIC_TOMBSTONE #define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ +#endif #ifndef DEFAULT_WINDOW_SYS #define DEFAULT_WINDOW_SYS "Gnome" #endif @@ -127,9 +140,11 @@ #endif #endif +#ifdef TTY_GRAPHICS #ifndef DEFAULT_WINDOW_SYS #define DEFAULT_WINDOW_SYS "tty" #endif +#endif #ifdef CURSES_GRAPHICS #ifndef DEFAULT_WINDOW_SYS @@ -137,19 +152,29 @@ #endif #endif +#ifdef SHIM_GRAPHICS +#ifndef DEFAULT_WINDOW_SYS +#define DEFAULT_WINDOW_SYS "shim" +#endif +#endif + #ifdef X11_GRAPHICS /* - * There are two ways that X11 tiles may be defined. (1) using a custom - * format loaded by NetHack code, or (2) using the XPM format loaded by - * the free XPM library. The second option allows you to then use other - * programs to generate tiles files. For example, the PBMPlus tools + * There are two ways that X11 tiles may be defined: + * (1) using a custom format loaded by NetHack code. + * (2) using the XPM format loaded by the free XPM library. + * The second option allows you to then use other programs to + * generate tiles files. For example, the PBMPlus tools * would allow: - * xpmtoppm x11tiles_big.xpm + * xpmtoppm x11tiles_big.xpm */ /* # define USE_XPM */ /* Disable if you do not have the XPM library */ #ifdef USE_XPM +#ifndef GRAPHIC_TOMBSTONE #define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.xpm) */ #endif +#endif #ifndef DEFAULT_WC_TILED_MAP #define DEFAULT_WC_TILED_MAP /* Default to tiles */ #endif @@ -158,9 +183,9 @@ /* * Section 2: Some global parameters and filenames. * - * LOGFILE, XLOGFILE, NEWS and PANICLOG refer to files in - * the playground directory. Commenting out LOGFILE, XLOGFILE, - * NEWS or PANICLOG removes that feature from the game. + * LOGFILE, XLOGFILE, LIVELOGFILE, NEWS and PANICLOG refer to + * files in the playground directory. Commenting out LOGFILE, + * XLOGFILE, NEWS or PANICLOG removes that feature from the game. * * Building with debugging features enabled is now unconditional; * the old WIZARD setting for that has been eliminated. @@ -187,9 +212,16 @@ * PERS_IS_UID (0 or 1 - person is name or (numeric) userid) * Can force incubi/succubi behavior to be toned down to nymph-like: * SEDUCE (0 or 1 - runtime disable/enable SEDUCE option) + * Can hide the entry for displaying command line usage from + * the help menu if players don't have access to command lines: + * HIDEUSAGE (0 or 1 - runtime show/hide command line usage) * The following options pertain to crash reporting: * GREPPATH (the path to the system grep(1) utility) * GDBPATH (the path to the system gdb(1) program) + * CRASHREPORT (use CRASHREPORTURL if defined in syscf; this + * define specifies the name of the helper program + * used to launch the browser and enables the + * feature)) * Regular nethack options can also be specified in order to * provide system-wide default values local to your system: * OPTIONS (same as in users' .nethackrc or defaults.nh) @@ -221,6 +253,61 @@ #define GREPPATH "/bin/grep" #endif +#ifndef NOCRASHREPORT +# ifndef CRASHREPORT +# ifdef MACOS +# define CRASHREPORT "/usr/bin/open" +# endif +# ifdef __linux__ +# define CRASHREPORT "/usr/bin/xdg-open" + /* Define this if the terminal is filled with useless error messages + * when the browser launches. */ +# define CRASHREPORT_EXEC_NOSTDERR +# endif +# ifdef WIN32 +# define CRASHREPORT /* builtin helper */ +# endif +# endif +#else +# ifdef CRASHREPORT +# undef CRASHREPORT +# endif +# if defined(MSDOS) || defined(NOPANICTRACE) +# undef PANICTRACE +# endif +#endif + +#ifdef CRASHREPORT +# ifndef DUMPLOG_CORE +# define DUMPLOG_CORE // required to get ^P info +# endif +# ifdef MACOS +# define PANICTRACE +# endif +# ifdef __linux__ +# define PANICTRACE +# ifndef NOSTATICFN // may be defined on command line +# define NOSTATICFN +# endif +# endif +// This test isn't quite right: CNG is only available from Windows 2000 on. +// But we'll check that at runtime. +# ifdef WIN32 +# define PANICTRACE +# define NOSTATICFN +# endif +#endif + +#ifdef NONOSTATICFN +# define staticfn static +#else +# ifdef NOSTATICFN +# define staticfn +# else +# define staticfn static +# endif +#endif + /* note: "larger" is in comparison with 'record', the high-scores file (whose name can be overridden via #define in global.h if desired) */ #define LOGFILE "logfile" /* larger file for debugging purposes */ @@ -232,6 +319,21 @@ many players, as it saves the player name and the game start time */ /* #define PANICLOG_FMT2 */ +/* + * When building the program, whether the 'makedefs' utility + * checks for non-ASCII or non-printable (control) characters + * in various data files (data.base, rumors.tru, rumors.fal, + * {oracles,epitaphs,engravings,bogusmons}.txt and warns about them. + * They also get changed to '#' instead of possibly remaining + * unprintable. + * + * If you modify the data files to intentionally add accented + * letters or something comparable, comment this out. (Such things + * won't necessarily work as intended within nethack but at least + * makedefs wouldn't reject them.) + */ +#define MAKEDEFS_FILTER_NONASCII + /* * PERSMAX, POINTSMIN, ENTRYMAX, PERS_IS_UID: * These control the contents of 'record', the high-scores file. @@ -249,13 +351,34 @@ #define ENTRYMAX 100 /* must be >= 10 */ #endif #ifndef PERS_IS_UID -#if !defined(MICRO) && !defined(MAC) && !defined(WIN32) +#if !defined(MICRO) && !defined(MACOS9) && !defined(WIN32) #define PERS_IS_UID 1 /* delete for PERSMAX per name; now per uid */ #else #define PERS_IS_UID 0 #endif #endif +/* + * NODUMPENUMS + * If there are memory constraints and you don't want to store information + * about the internal enum values for monsters and objects, this can be + * uncommented to define NODUMPENUMS. Doing so will disable the + * nethack --dumpenums + * command line option. + * Note: the extra memory is also used when ENHANCED_SYMBOLS is + * defined, so defining both ENHANCED_SYMBOLS and NODUMPENUMS will limit + * the amount of memory and code reduction offered by the latter. + */ +/* #define NODUMPENUMS */ + +/* + * ENHANCED_SYMBOLS + * Support the enhanced display of symbols by utilizing utf8. + * Enabled by default, but it can be disabled by commenting it out. + */ + +#define ENHANCED_SYMBOLS + /* * If COMPRESS is defined, it should contain the full path name of your * 'compress' program. @@ -276,6 +399,7 @@ #if defined(UNIX) && !defined(ZLIB_COMP) && !defined(COMPRESS) /* path and file name extension for compression program */ +/* NLE: Don't define COMPRESS or COMPRESS_EXTENSION */ /* #define COMPRESS "/usr/bin/compress" */ /* Lempel-Ziv compression */ /* #define COMPRESS_EXTENSION ".Z" */ /* compress's extension */ /* An example of one alternative you might want to use: */ @@ -287,38 +411,6 @@ /* # define ZLIB_COMP */ /* ZLIB for compression */ #endif -/* - * Internal Compression Options - * - * Internal compression options RLECOMP and ZEROCOMP alter the data - * that gets written to the save file by NetHack, in contrast - * to COMPRESS or ZLIB_COMP which compress the entire file after - * the NetHack data is written out. - * - * Defining RLECOMP builds in support for internal run-length - * compression of level structures. If RLECOMP support is included - * it can be toggled on/off at runtime via the config file option - * rlecomp. - * - * Defining ZEROCOMP builds in support for internal zero-comp - * compression of data. If ZEROCOMP support is included it can still - * be toggled on/off at runtime via the config file option zerocomp. - * - * RLECOMP and ZEROCOMP support can be included even if - * COMPRESS or ZLIB_COMP support is included. One reason for doing - * so would be to provide savefile read compatibility with a savefile - * where those options were in effect. With RLECOMP and/or ZEROCOMP - * defined, NetHack can read an rlecomp or zerocomp savefile in, yet - * re-save without them. - * - * Using any compression option will create smaller bones/level/save - * files at the cost of additional code and time. - */ - -/* # define INTERNAL_COMP */ /* defines both ZEROCOMP and RLECOMP */ -/* # define ZEROCOMP */ /* Support ZEROCOMP compression */ -/* # define RLECOMP */ /* Support RLECOMP compression */ - /* * Data librarian. Defining DLB places most of the support files into * a tar-like file, thus making a neater installation. See *conf.h @@ -353,10 +445,12 @@ * died due to program or system crashes to be resumed from the point * of the last level change, after running a utility program. */ +/* NLE: Don't define INSURANCE */ /* #define INSURANCE allow crashed game recovery */ -#ifndef MAC -/* #define CHDIR */ /* delete if no chdir() available */ /* Deleted for NLE */ +#if !defined(MACOS9) && !defined(SHIM_GRAPHICS) + /* NLE: deleted */ + /* #define CHDIR */ /* delete if no chdir() available */ #endif #ifdef CHDIR @@ -385,6 +479,7 @@ */ #endif /* CHDIR */ + /* * Section 3: Definitions that may vary with system type. * For example, both schar and uchar should be short ints on @@ -443,33 +538,22 @@ typedef unsigned char uchar; /* #define STRNCMPI */ /* compiler/library has the strncmpi function */ /* - * There are various choices for the NetHack vision system. There is a - * choice of two algorithms with the same behavior. Defining VISION_TABLES - * creates huge (60K) tables at compile time, drastically increasing data - * size, but runs slightly faster than the alternate algorithm. (MSDOS in - * particular cannot tolerate the increase in data size; other systems can - * flip a coin weighted to local conditions.) + * Vision choices. * - * If VISION_TABLES is not defined, things will be faster if you can use - * MACRO_CPATH. Some cpps, however, cannot deal with the size of the - * functions that have been macroized. + * Things will be faster if you can use MACRO_CPATH. Some cpps, however, + * cannot deal with the size of the functions that have been macroized. */ -/* #define VISION_TABLES */ /* use vision tables generated at compile time */ -#ifndef VISION_TABLES #ifndef NO_MACRO_CPATH #define MACRO_CPATH /* use clear_path macros instead of functions */ #endif -#endif -#if !defined(MAC) +#if !defined(MACOS9) #if !defined(NOCLIPPING) #define CLIPPING /* allow smaller screens -- ERS */ #endif #endif -#define DOAGAIN '\001' /* ^A, the "redo" key used in cmd.c and getline.c */ - /* CONFIG_ERROR_SECURE: If user makes NETHACKOPTIONS point to a file ... * TRUE: Show the first error, nothing else. * FALSE: Show all errors as normal, with line numbers and context. @@ -486,8 +570,30 @@ typedef unsigned char uchar; * bugs left here. */ +/* SELECTSAVED: Enable the 'selectsaved' run-time option, allowing it + * to be set in user's config file or NETHACKOPTIONS. When set, if + * player is about to be given the "who are you?" prompt, check for + * save files and if any are found, put up a menu of them for choosing + * one to restore (plus extra menu entries "new game" and "quit"). + * + * Not useful if players are forced to use a specific character name + * such as their user name. However in some cases, players can set + * their character name to one which is classified as generic in the + * sysconf file (such as "player" or "games") + * nethack -u player + * to force the "who are you?" prompt in which case 'selectsaved' will + * be honored. + * + * Comment out if the wildcard file name lookup in files.c doesn't + * compile or doesn't work as intended. + */ +#define SELECTSAVED /* support for restoring via menu */ + /* TTY_TILES_ESCCODES: Enable output of special console escape codes - * which act as hints for external programs such as EbonHack. + * which act as hints for external programs such as EbonHack or hterm. + * + * TTY_SOUND_ESCCODES: Enable output of special console escape codes + * which act as hints for theoretical external programs to play sound effect. * * Only for TTY_GRAPHICS. * @@ -495,39 +601,45 @@ typedef unsigned char uchar; * one or more positive integer values, separated by semicolons. * For example ESC [ 1 ; 0 ; 120 z * - * Possible codes are: + * Possible TTY_TILES_ESCCODES codes are: * ESC [ 1 ; 0 ; n ; m z Start a glyph (aka a tile) number n, with flags m * ESC [ 1 ; 1 z End a glyph. * ESC [ 1 ; 2 ; n z Select a window n to output to. * ESC [ 1 ; 3 z End of data. NetHack has finished sending data, * and is waiting for input. + * Possible TTY_SOUND_ESCCODES codes are: + * ESC [ 1 ; 4 ; n ; m z Play specified sound n, volume m * * Whenever NetHack outputs anything, it will first output the "select window" * code. Whenever NetHack outputs a tile, it will first output the "start * glyph" code, then the escape codes for color and the glyph character * itself, and then the "end glyph" code. * - * To compile NetHack with this, add tile.c to WINSRC and tile.o to WINOBJ - * in the hints file or Makefile. - * Set boolean option vt_tiledata in your config file to turn this on. - * Note that gnome-terminal at least doesn't work with this. */ + * To compile NetHack with this, add tile.c to WINSRC and tile.o to WINOBJ in + * the hints file or Makefile. Set boolean option vt_tiledata and/or + * vt_sounddata in your config file to turn either of these on. Note that some + * terminals (e.g. old versions of gnome-terminal) don't work with this. */ /* #define TTY_TILES_ESCCODES */ +/* #define TTY_SOUND_ESCCODES */ -/* NetHack will execute an external program whenever a new message-window - * message is shown. The program to execute is given in environment variable - * NETHACK_MSGHANDLER. It will get the message as the only parameter. - * Only available with POSIX_TYPES or GNU C */ -/* #define MSGHANDLER */ +/* An experimental minimalist inventory list capability under tty if you have + * at least 28 additional rows beneath the status window on your terminal */ +/* #define TTY_PERM_INVENT */ +/* enable status highlighting via STATUS_HILITE directives in run-time + config file and the 'statushilites' option */ #define STATUS_HILITES /* support hilites of status fields */ /* #define WINCHAIN */ /* stacked window systems */ -/* #define DEBUG_MIGRATING_MONS */ /* add a wizard-mode command to help debug - migrating monsters */ +#if defined(DEBUG) && !defined(DEBUG_MIGRATING_MONS) +#define DEBUG_MIGRATING_MONS /* add a wizard-mode command to help debug + * migrating monsters */ +#endif /* SCORE_ON_BOTL is neither experimental nor inadequately tested, but doesn't seem to fit in any other section... */ +/* NLE: Enable SCORE_ON_BOTL */ #define SCORE_ON_BOTL /* enable the 'showscore' option to show estimated score on status line */ @@ -537,7 +649,9 @@ typedef unsigned char uchar; /* EXTRA_SANITY_CHECKS adds extra impossible calls, * probably not useful for normal play */ -/* #define EXTRA_SANITY_CHECKS */ +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#define EXTRA_SANITY_CHECKS +#endif /* BREADCRUMBS employs the use of predefined compiler macros * __FUNCTION__ and __LINE__ to store some caller breadcrumbs @@ -556,13 +670,67 @@ typedef unsigned char uchar; whole thing, then type a new end for the text. */ /* #define EDIT_GETLIN */ +#ifndef NO_CHRONICLE +/* CHRONICLE - enable #chronicle command, a log of major game events. + The logged messages will also appear in DUMPLOG. */ +#define CHRONICLE +#ifdef CHRONICLE +/* LIVELOG - log CHRONICLE events into LIVELOGFILE as they happen. */ +/* #define LIVELOG */ +#endif /* CHRONICLE */ +#else +#undef LIVELOG*/#endif /* NO_CHRONICLE */ + /* #define DUMPLOG */ /* End-of-game dump logs */ -#ifdef DUMPLOG -#ifndef DUMPLOG_MSG_COUNT -#define DUMPLOG_MSG_COUNT 50 +#define USE_ISAAC64 /* Use cross-platform, bundled RNG */ + +/* TEMPORARY - MAKE UNCONDITIONAL BEFORE RELEASE */ +/* undef this to check if sandbox breaks something */ +#define NHL_SANDBOX + +#ifdef NHL_SANDBOX +#ifdef CHRONICLE + /* LIVELOG (and therefore CHRONICLE) is needed for --loglua */ +#define LIVELOG +#endif #endif +/* experimential; if the platform/window-port supports it; when the game has + * started to wait for player input, and the wait lasts longer than + * IDLECHECKPOINT_WAIT_TIME seconds (defined in hack.h or *conf.h), the game + * will perform an update to the checkpoint file. + * Currently has support in: + * WIN32CON + * Qt + */ + +/* #define IDLECHECKPOINT */ + +/* End of Section 4 */ + +#ifdef TTY_TILES_ESCCODES +# ifndef TILES_IN_GLYPHMAP +# define TILES_IN_GLYPHMAP +# endif +#endif + +#include "cstd.h" +#include "integer.h" +#include "global.h" /* Define everything else according to choices above */ + +/* Place the following after #include [platform]conf.h in global.h so that + overrides are possible in there, for things like unix-specific file + paths. */ + +#ifdef LIVELOG +#ifndef LIVELOGFILE +#define LIVELOGFILE "livelog" /* in-game events recorded, live */ +#endif /* LIVELOGFILE */ +#endif /* LIVELOG */ + +#ifdef DUMPLOG +#define DUMPLOG_CORE #ifndef DUMPLOG_FILE #define DUMPLOG_FILE "/tmp/nethack.%n.%d.log" /* DUMPLOG_FILE allows following placeholders: @@ -577,20 +745,12 @@ typedef unsigned char uchar; %N first character of player name DUMPLOG_FILE is not used if SYSCF is defined */ +#endif /* DUMPLOG_FILE */ +#endif /* DUMPLOG */ +#ifdef DUMPLOG_CORE +#ifndef DUMPLOG_MSG_COUNT +#define DUMPLOG_MSG_COUNT 50 +#endif /* DUMPLOG_MSG_COUNT */ #endif -#endif - -#define USE_ISAAC64 /* Use cross-plattform, bundled RNG */ - -/* End of Section 4 */ - -#ifdef TTY_TILES_ESCCODES -# ifndef USE_TILES -# define USE_TILES -# endif -#endif - -#include "global.h" /* Define everything else according to choices above */ - #endif /* CONFIG_H */ From 7dcfd78e64daae8155bdb5aba9d9ddbc77813a5a Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 16:52:23 +0100 Subject: [PATCH 5/9] Add nh5 extern.h with NLE mods --- include/extern.h | 6034 +++++++++++++++++++++++++++------------------- 1 file changed, 3531 insertions(+), 2503 deletions(-) diff --git a/include/extern.h b/include/extern.h index 2b6076108..94046fca0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,143 +1,237 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1573940539 2019/11/16 21:42:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.741 $ */ -/* Copyright (c) Steve Creps, 1988. */ +/* NetHack 5.0 extern.h $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1523 $ */ +/* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef EXTERN_H #define EXTERN_H -#define E extern +/* + * The placements of the NONNULLARG* and NONNULLPTRS macros were done + * using the following rules: + * These were the rules that were followed when determining which function + * parameters should be nonnull, and which are nullable: + * + * 1. If the first use of, or reference to, the pointer parameter in the + * function is a dereference, then the parameter will be considered + * nonnull. + * + * 2. If there is code in the function that tests for the pointer parameter + * being null, and adjusts the code-path accordingly so that no segfault + * will occur, then the parameter will not be considered nonnull (it can + * be null). + * + * Note that if an arg is declared nonnull, any tests inside the function + * for the variable being null, will likely trigger a compiler warning + * diagnostic about the unnecessary test. + * + * Description of the NONNULL macros: + * + * NONNULL The function return value is never NULL. + * NONNULLPTRS Every pointer argument is declared nonnull. + * NONNULLARG1 The 1st argument is declared nonnull. + * NONNULLARG2 The 2nd argument is declared nonnull. + * NONNULLARG3 The 3rd argument is declared nonnull. + * NONNULLARG4 The 4th argument is declared nonnull (not used). + * NONNULLARG5 The 5th argument is declared nonnull. + * NONNULLARG6 The 6th argument is declared nonnull. + * NONNULLARG7 The 7th argument is declared nonnull (bhit). + * NONNULLARG12 The 1st and 2nd arguments are declared nonnull. + * NONNULLARG23 The 2nd and 3rd arguments are declared nonnull. + * NONNULLARG13 The 1st and 3rd arguments are declared nonnull. + * NONNULLARG123 The 1st, 2nd and 3rd arguments are declared nonnull. + * NONNULLARG14 The 1st and 4th arguments are declared nonnull. + * NONNULLARG134 The 1st, 3rd and 4th arguments are declared nonnull. + * NONNULLARG17 The 1st and 7th arguments are declared nonnull (this + * was a special-case added for askchain(), where the + * arguments are spread out that way. This macro + * could be removed if the askchain arguments in the + * prototype and callers were changed to make the + * nonnull arguments side-by-side). + * NONNULLARG145 The 1st, 4th and 5th arguments are declared nonnull + * (this was a special-case added for find_roll_to_hit(), + * in uhitm.c, where the arguments are spread out that way. + * We can't just use NONNULLPTRS there because the 3rd + * argument 'weapon' can be NULL). + * NONNULLARG24 The 2nd and 4th arguments are declared nonnull (this + * was a special-case added for query_objlist() in invent.c). + * NONNULLARG45 The 4th and 5th arguments are declared nonnull (this + * was a special-case added for do_screen_description(), + * in pager.c, where the arguments are spread out that way. + * We can't just use NONNULLPTRS there because the 6th + * argument can be NULL). + * NO_NNARGS This macro expands to nothing. It is just used to + * mark that analysis has been done on the function, + * and concluded that none of the arguments could be + * marked nonnull.That distinguishes a function that has + * not been analyzed (yet), from one that has. + * + */ + +#ifndef ARTIFACT_H +#include "artifact.h" +#endif + +#ifndef MFNDPOS_H +#include "mfndpos.h" +#endif /* ### alloc.c ### */ #if 0 -E long *FDECL(alloc, (unsigned int)); +/* routines in alloc.c depend on MONITOR_HEAP and are declared in global.h */ +extern long *alloc(unsigned int) NONNULL; #endif -E char *FDECL(fmt_ptr, (const genericptr)); +extern char *fmt_ptr(const void *) NONNULL; +/* moved from hacklib.c to alloc.c so that utility programs have access */ +#define FITSint(x) FITSint_(x, __func__, __LINE__) +extern int FITSint_(long long, const char *, int) NONNULLARG2; +#define FITSuint(x) FITSuint_(x, __func__, __LINE__) +extern unsigned FITSuint_(unsigned long long, const char *, int) NONNULLARG2; +/* for Strlen() which returns unsigned instead of size_t and panics for + strings of length INT_MAX (32K - 1) or longer */ + +#include "hacklib.h" /* This next pre-processor directive covers almost the entire file, * interrupted only occasionally to pick up specific functions as needed. */ -#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(CPPREGEX_C) /* ### allmain.c ### */ -E void FDECL(moveloop, (BOOLEAN_P)); -E void NDECL(stop_occupation); -E void NDECL(display_gamewindows); -E void NDECL(newgame); -E void FDECL(welcome, (BOOLEAN_P)); -E time_t NDECL(get_realtime); -E int FDECL(argcheck, (int, char **, enum earlyarg)); +extern void early_init(int, char *[]); +extern void moveloop_core(void); +extern void moveloop(boolean); +extern void stop_occupation(void); +extern void init_sound_disp_gamewindows(void); +extern void newgame(void); +extern void welcome(boolean); +extern long timet_to_seconds(time_t); +extern long timet_delta(time_t, time_t); /* ### apply.c ### */ -E int NDECL(doapply); -E int NDECL(dorub); -E int NDECL(dojump); -E int FDECL(jump, (int)); -E int NDECL(number_leashed); -E void FDECL(o_unleash, (struct obj *)); -E void FDECL(m_unleash, (struct monst *, BOOLEAN_P)); -E void NDECL(unleash_all); -E boolean FDECL(leashable, (struct monst *)); -E boolean NDECL(next_to_u); -E struct obj *FDECL(get_mleash, (struct monst *)); -E const char *NDECL(beautiful); -E void FDECL(check_leash, (XCHAR_P, XCHAR_P)); -E boolean FDECL(um_dist, (XCHAR_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(snuff_candle, (struct obj *)); -E boolean FDECL(snuff_lit, (struct obj *)); -E boolean FDECL(catch_lit, (struct obj *)); -E void FDECL(use_unicorn_horn, (struct obj *)); -E boolean FDECL(tinnable, (struct obj *)); -E void NDECL(reset_trapset); -E void FDECL(fig_transform, (ANY_P *, long)); -E int FDECL(unfixable_trouble_count, (BOOLEAN_P)); +extern void do_blinding_ray(struct obj *) NONNULLPTRS; +extern int doapply(void); +extern int dorub(void); +extern int dojump(void); +extern int jump(int); +extern int number_leashed(void); +extern void o_unleash(struct obj *) NONNULLPTRS; +extern void m_unleash(struct monst *, boolean) NONNULLPTRS; +extern void unleash_all(void); +extern boolean leashable(struct monst *) NONNULLARG1; +extern boolean next_to_u(void); +extern struct obj *get_mleash(struct monst *) NONNULLARG1; +extern const char *beautiful(void); +extern void check_leash(coordxy, coordxy); +extern boolean um_dist(coordxy, coordxy, xint16); +extern boolean snuff_candle(struct obj *) NONNULLPTRS; +extern boolean snuff_lit(struct obj *) NONNULLPTRS; +extern boolean splash_lit(struct obj *) NONNULLPTRS; +extern boolean catch_lit(struct obj *) NONNULLPTRS; +extern void use_unicorn_horn(struct obj **); +extern boolean tinnable(struct obj *) NONNULLPTRS; +extern void reset_trapset(void); +extern int use_whip(struct obj *) NONNULLPTRS; +extern boolean could_pole_mon(void); +extern int use_pole(struct obj *, boolean) NONNULLPTRS; +extern void maybe_dunk_boulders(coordxy, coordxy); +extern void fig_transform(union any *, long) NONNULLARG1; +extern int unfixable_trouble_count(boolean); /* ### artifact.c ### */ -E void NDECL(init_artifacts); -E void FDECL(save_artifacts, (int)); -E void FDECL(restore_artifacts, (int)); -E const char *FDECL(artiname, (int)); -E struct obj *FDECL(mk_artifact, (struct obj *, ALIGNTYP_P)); -E const char *FDECL(artifact_name, (const char *, short *)); -E boolean FDECL(exist_artifact, (int, const char *)); -E void FDECL(artifact_exists, (struct obj *, const char *, BOOLEAN_P)); -E int NDECL(nartifact_exist); -E boolean FDECL(arti_immune, (struct obj *, int)); -E boolean FDECL(spec_ability, (struct obj *, unsigned long)); -E boolean FDECL(confers_luck, (struct obj *)); -E boolean FDECL(arti_reflects, (struct obj *)); -E boolean FDECL(shade_glare, (struct obj *)); -E boolean FDECL(restrict_name, (struct obj *, const char *)); -E boolean FDECL(defends, (int, struct obj *)); -E boolean FDECL(defends_when_carried, (int, struct obj *)); -E boolean FDECL(protects, (struct obj *, BOOLEAN_P)); -E void FDECL(set_artifact_intrinsic, (struct obj *, BOOLEAN_P, long)); -E int FDECL(touch_artifact, (struct obj *, struct monst *)); -E int FDECL(spec_abon, (struct obj *, struct monst *)); -E int FDECL(spec_dbon, (struct obj *, struct monst *, int)); -E void FDECL(discover_artifact, (XCHAR_P)); -E boolean FDECL(undiscovered_artifact, (XCHAR_P)); -E int FDECL(disp_artifact_discoveries, (winid)); -E boolean FDECL(artifact_hit, (struct monst *, struct monst *, struct obj *, - int *, int)); -E int NDECL(doinvoke); -E boolean FDECL(finesse_ahriman, (struct obj *)); -E void FDECL(arti_speak, (struct obj *)); -E boolean FDECL(artifact_light, (struct obj *)); -E long FDECL(spec_m2, (struct obj *)); -E boolean FDECL(artifact_has_invprop, (struct obj *, UCHAR_P)); -E long FDECL(arti_cost, (struct obj *)); -E struct obj *FDECL(what_gives, (long *)); -E const char *FDECL(glow_color, (int)); -E const char *FDECL(glow_verb, (int, BOOLEAN_P)); -E void FDECL(Sting_effects, (int)); -E int FDECL(retouch_object, (struct obj **, BOOLEAN_P)); -E void FDECL(retouch_equipment, (int)); -E void NDECL(mkot_trap_warn); -E boolean FDECL(is_magic_key, (struct monst *, struct obj *)); -E struct obj *FDECL(has_magic_key, (struct monst *)); +extern void init_artifacts(void); +extern void save_artifacts(NHFILE *); +extern void restore_artifacts(NHFILE *); +extern const char *artiname(int); +extern struct obj *mk_artifact(struct obj *, aligntyp, uchar, boolean); +extern const char *artifact_name(const char *, short *, boolean) NONNULLARG1; +extern boolean exist_artifact(int, const char *) NONNULLPTRS; +extern void artifact_exists(struct obj *, const char *, boolean, unsigned) ; +extern void found_artifact(int); +extern void find_artifact(struct obj *) NONNULLPTRS; +extern int nartifact_exist(void); +extern void artifact_origin(struct obj *, unsigned) NONNULLPTRS; +extern boolean arti_immune(struct obj *, int); +extern boolean spec_ability(struct obj *, unsigned long); +extern boolean confers_luck(struct obj *) NONNULLPTRS; +extern boolean arti_reflects(struct obj *); +extern boolean shade_glare(struct obj *) NONNULLPTRS; +extern boolean restrict_name(struct obj *, const char *) NONNULLPTRS; +extern boolean attacks(int, struct obj *); +extern boolean defends(int, struct obj *); +extern boolean defends_when_carried(int, struct obj *); +extern boolean protects(struct obj *, boolean); +extern void set_artifact_intrinsic(struct obj *, boolean, long); +extern int touch_artifact(struct obj *, struct monst *) NONNULLARG2; +extern int spec_abon(struct obj *, struct monst *) NONNULLARG2; +extern int spec_dbon(struct obj *, struct monst *, int) NONNULLARG2; +extern void discover_artifact(xint16); +extern boolean undiscovered_artifact(xint16); +extern int disp_artifact_discoveries(winid); +extern void dump_artifact_info(winid); +extern boolean artifact_hit(struct monst *, struct monst *, struct obj *, + int *, int) NONNULLARG2; +extern int doinvoke(void); +extern boolean finesse_ahriman(struct obj *); +extern int arti_speak(struct obj *); +extern boolean artifact_light(struct obj *); +extern long spec_m2(struct obj *); +extern boolean artifact_has_invprop(struct obj *, uchar); +extern long arti_cost(struct obj *) NONNULLARG1; +extern struct obj *what_gives(long *) NONNULLARG1; +extern const char *glow_color(int); +extern const char *glow_verb(int, boolean); +extern void Sting_effects(int); +extern int retouch_object(struct obj **, boolean) NONNULLARG1; +extern void retouch_equipment(int); +extern void mkot_trap_warn(void); +extern boolean is_magic_key(struct monst *, struct obj *); +extern struct obj *has_magic_key(struct monst *); +extern boolean is_art(struct obj *, int); +extern boolean permapoisoned(struct obj *); /* ### attrib.c ### */ -E boolean FDECL(adjattrib, (int, int, int)); -E void FDECL(gainstr, (struct obj *, int, BOOLEAN_P)); -E void FDECL(losestr, (int)); -E void FDECL(poisontell, (int, BOOLEAN_P)); -E void FDECL(poisoned, (const char *, int, const char *, int, BOOLEAN_P)); -E void FDECL(change_luck, (SCHAR_P)); -E int FDECL(stone_luck, (BOOLEAN_P)); -E void NDECL(set_moreluck); -E void NDECL(restore_attrib); -E void FDECL(exercise, (int, BOOLEAN_P)); -E void NDECL(exerchk); -E void FDECL(init_attr, (int)); -E void NDECL(redist_attr); -E void FDECL(adjabil, (int, int)); -E int NDECL(newhp); -E schar FDECL(acurr, (int)); -E schar NDECL(acurrstr); -E boolean FDECL(extremeattr, (int)); -E void FDECL(adjalign, (int)); -E int FDECL(is_innate, (int)); -E char *FDECL(from_what, (int)); -E void FDECL(uchangealign, (int, int)); +extern boolean adjattrib(int, int, int); +extern void gainstr(struct obj *, int, boolean); +extern void losestr(int, const char *, schar); +extern void poison_strdmg(int, int, const char *, schar); +extern void poisontell(int, boolean); +extern void poisoned(const char *, int, const char *, int, boolean) NONNULLARG1; +extern void change_luck(schar); +extern int stone_luck(boolean); +extern void set_moreluck(void); +extern void restore_attrib(void); +extern void exercise(int, boolean); +extern void exerchk(void); +extern void init_attr(int); +extern void redist_attr(void); +extern void vary_init_attr(void); +extern void adjabil(int, int); +extern int newhp(void); +extern int minuhpmax(int); +extern void setuhpmax(int, boolean); +extern int adjuhploss(int, int); +extern schar acurr(int); +extern schar acurrstr(void); +extern boolean extremeattr(int); +extern void adjalign(int); +extern int is_innate(int); +extern char *from_what(int); +extern void uchangealign(int, int); /* ### ball.c ### */ -E void FDECL(ballrelease, (BOOLEAN_P)); -E void NDECL(ballfall); +extern void ballrelease(boolean); +extern void ballfall(void); #ifndef BREADCRUMBS -E void NDECL(placebc); -E void NDECL(unplacebc); -E int NDECL(unplacebc_and_covet_placebc); -E void FDECL(lift_covet_and_placebc, (int)); +extern void placebc(void); +extern void unplacebc(void); +extern int unplacebc_and_covet_placebc(void); +extern void lift_covet_and_placebc(int); #else -E void FDECL(Placebc, (const char *, int)); -E void FDECL(Unplacebc, (const char *, int)); -E int FDECL(Unplacebc_and_covet_placebc, (const char *, int)); -E void FDECL(Lift_covet_and_placebc, (int, const char *, int)); #define placebc() Placebc(__FUNCTION__, __LINE__) #define unplacebc() Unplacebc(__FUNCTION__, __LINE__) #define unplacebc_and_covet_placebc() \ @@ -145,2489 +239,3293 @@ E void FDECL(Lift_covet_and_placebc, (int, const char *, int)); #define lift_covet_and_placebc(x) \ Lift_covet_and_placebc(x, __FUNCTION__, __LINE__) #endif -E void FDECL(set_bc, (int)); -E void FDECL(move_bc, (int, int, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(drag_ball, (XCHAR_P, XCHAR_P, int *, xchar *, xchar *, - xchar *, xchar *, boolean *, BOOLEAN_P)); -E void FDECL(drop_ball, (XCHAR_P, XCHAR_P)); -E void NDECL(drag_down); -E void NDECL(bc_sanity_check); +extern void set_bc(int); +extern void move_bc(int, int, coordxy, coordxy, coordxy, coordxy); +extern boolean drag_ball(coordxy, coordxy, int *, coordxy *, coordxy *, + coordxy *, coordxy *, boolean *, boolean) NONNULLPTRS; +extern void drop_ball(coordxy, coordxy); +extern void drag_down(void); +extern void bc_sanity_check(void); /* ### bones.c ### */ -E void FDECL(sanitize_name, (char *)); -E void FDECL(drop_upon_death, (struct monst *, struct obj *, int, int)); -E boolean NDECL(can_make_bones); -E void FDECL(savebones, (int, time_t, struct obj *)); -E int NDECL(getbones); +extern void sanitize_name(char *) NONNULLARG1; +extern void drop_upon_death(struct monst *, struct obj *, coordxy, coordxy); +extern boolean can_make_bones(void); +extern void savebones(int, time_t, struct obj *); +extern int getbones(void); +extern boolean bones_include_name(const char *) NONNULLARG1; +extern void fix_ghostly_obj(struct obj *) NONNULLARG1; +extern void newebones(struct monst *) NONNULLARG1; +extern void free_ebones(struct monst *) NONNULLARG1; /* ### botl.c ### */ -E char *NDECL(do_statusline1); -E void NDECL(check_gold_symbol); -E char *NDECL(do_statusline2); -E void NDECL(bot); -E void NDECL(timebot); -E int FDECL(xlev_to_rank, (int)); -E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P)); -E int FDECL(title_to_mon, (const char *, int *, int *)); -E void NDECL(max_rank_sz); +extern char *get_strength_str(void); +extern char *do_statusline1(void); +extern void check_gold_symbol(void); +extern char *do_statusline2(void); +extern void bot(void); +extern void timebot(void); +extern int xlev_to_rank(int); +extern int rank_to_xlev(int); +extern const char *rank_of(int, short, boolean); +extern int title_to_mon(const char *, int *, int *); +extern void max_rank_sz(void); #ifdef SCORE_ON_BOTL -E long NDECL(botl_score); -#endif -E int FDECL(describe_level, (char *)); -E void FDECL(status_initialize, (BOOLEAN_P)); -E void NDECL(status_finish); -E boolean NDECL(exp_percent_changing); -E int NDECL(stat_cap_indx); -E int NDECL(stat_hunger_indx); -E const char *FDECL(bl_idx_to_fldname, (int)); +extern long botl_score(void); +#endif +extern int describe_level(char *, int); +extern char *weapon_status(char *) NONNULL NONNULLARG1; +extern char *armor_status(char *) NONNULL NONNULLARG1; +extern void status_initialize(boolean); +extern void status_finish(void); +extern boolean exp_percent_changing(void); +extern int stat_cap_indx(void); +extern int stat_hunger_indx(void); +extern const char *bl_idx_to_fldname(int); +extern void repad_with_dashes(char *); +extern void condopt(int, boolean *, boolean); +extern int parse_cond_option(boolean, char *); +extern boolean cond_menu(void); +extern boolean opt_next_cond(int, char *); #ifdef STATUS_HILITES -E void NDECL(status_eval_next_unhilite); -E void NDECL(reset_status_hilites); -E boolean FDECL(parse_status_hl1, (char *op, BOOLEAN_P)); -E void FDECL(status_notify_windowport, (BOOLEAN_P)); -E void NDECL(clear_status_hilites); -E int NDECL(count_status_hilites); -E boolean NDECL(status_hilite_menu); +extern void status_eval_next_unhilite(void); +extern void reset_status_hilites(void); +extern boolean parse_status_hl1(char *op, boolean); +extern void status_notify_windowport(boolean); +extern void clear_status_hilites(void); +extern int count_status_hilites(void); +extern void all_options_statushilites(strbuf_t *); +extern boolean status_hilite_menu(void); +#endif /* STATUS_HILITES */ + +/* ### calendar.c ### */ + +extern time_t getnow(void); +extern int getyear(void); +#if 0 +extern char *yymmdd(time_t) NONNULL; +#endif +extern long yyyymmdd(time_t); +extern long hhmmss(time_t); +extern char *yyyymmddhhmmss(time_t) NONNULL; +extern time_t time_from_yyyymmddhhmmss(char *); +extern int phase_of_the_moon(void); +extern boolean friday_13th(void); +extern int night(void); +extern int midnight(void); + +/* ### cfgfiles.c ### */ + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +extern int l_get_config_errors(lua_State *) NONNULLARG1; +#endif +extern int do_write_config_file(void); +extern boolean parse_config_line(char *) NONNULLARG1; +#ifdef USER_SOUNDS +extern boolean can_read_file(const char *) NONNULLARG1; +#endif +extern void config_error_init(boolean, const char *, boolean); +extern void config_erradd(const char *); +extern int config_error_done(void); +/* arg1 of read_config_file can be NULL to pass through + * to fopen_config_file() to mean 'use the default config file name' */ +extern boolean read_config_file(const char *, int); +extern boolean parse_conf_str(const char *str, boolean (*proc)(char *)); +extern boolean parse_conf_file(FILE *fp, boolean (*proc)(char *arg)); +extern void set_configfile_name(const char *); +extern char *get_configfile(void); +extern const char *get_default_configfile(void); +extern void rcfile(void); +extern void rcfile_interface_options(void); +extern void rcfile_only_this_option(enum opt); +extern void heed_all_config_statements(void); +extern void disregard_all_config_statements(void); +extern void heed_this_config_statement(int); +extern void disregard_this_config_statement(int); +extern boolean config_unmatched_ignored(void); +extern void clear_ignore_errors_on_unmatched(void); +extern void set_ignore_errors_on_unmatched(void); + +/* ### coloratt.c ### */ + +extern char *color_attr_to_str(color_attr *); +extern boolean color_attr_parse_str(color_attr *, char *); +extern int32 colortable_to_int32(const struct nethack_color *); +extern int query_color(const char *, int) NO_NNARGS; +extern int query_attr(const char *, int) NO_NNARGS; +extern boolean query_color_attr(color_attr *, const char *) NONNULLARG1; +extern const char *attr2attrname(int); +extern void basic_menu_colors(boolean); +extern boolean add_menu_coloring_parsed(const char *, int, int); +extern const char *clr2colorname(int); +extern int match_str2clr(char *, boolean) NONNULLARG1; +extern int match_str2attr(const char *, boolean) NONNULLARG1; +extern boolean add_menu_coloring(char *) NONNULLARG1; +extern void free_one_menu_coloring(int); +extern void free_menu_coloring(void); +extern int count_menucolors(void); +extern int32 check_enhanced_colors(char *) NONNULLARG1; +extern const char *wc_color_name(int32) NONNULL; +extern int32_t rgbstr_to_int32(const char *rgbstr); +extern boolean closest_color(uint32_t lcolor, uint32_t *closecolor, uint16 *clridx); +extern int color_distance(uint32_t, uint32_t); +extern boolean onlyhexdigits(const char *buf); +extern uint32 get_nhcolor_from_256_index(int idx); +#ifdef CHANGE_COLOR +extern int count_alt_palette(void); +extern int alternative_palette(char *); +extern void change_palette(void); #endif /* ### cmd.c ### */ -E char NDECL(randomkey); -E void FDECL(random_response, (char *, int)); -E int NDECL(rnd_extcmd_idx); -E int NDECL(doconduct); -E int NDECL(domonability); -E char FDECL(cmd_from_func, (int NDECL((*)))); -E boolean FDECL(redraw_cmd, (CHAR_P)); -#ifdef USE_TRAMPOLI -E int NDECL(doextcmd); -E int NDECL(domonability); -E int NDECL(doprev_message); -E int NDECL(timed_occupation); -E int NDECL(doattributes); -E int NDECL(wiz_detect); -E int NDECL(wiz_genesis); -E int NDECL(wiz_identify); -E int NDECL(wiz_level_tele); -E int NDECL(wiz_map); -E int NDECL(wiz_where); -E int NDECL(wiz_wish); -#endif /* USE_TRAMPOLI */ -E void NDECL(reset_occupations); -E void FDECL(set_occupation, (int (*)(void), const char *, int)); -E char NDECL(pgetchar); -E void FDECL(pushch, (CHAR_P)); -E void FDECL(savech, (CHAR_P)); -E const char *FDECL(key2extcmddesc, (UCHAR_P)); -E boolean FDECL(bind_specialkey, (UCHAR_P, const char *)); -E char FDECL(txt2key, (char *)); -E void FDECL(parseautocomplete, (char *, BOOLEAN_P)); -E void FDECL(reset_commands, (BOOLEAN_P)); -E void FDECL(rhack, (char *)); -E int NDECL(doextlist); -E int NDECL(extcmd_via_menu); -E int NDECL(enter_explore_mode); -E void FDECL(enlightenment, (int, int)); -E void FDECL(youhiding, (BOOLEAN_P, int)); -E void FDECL(show_conduct, (int)); -E boolean FDECL(bind_key, (UCHAR_P, const char *)); -E void NDECL(dokeylist); -E int FDECL(xytod, (SCHAR_P, SCHAR_P)); -E void FDECL(dtoxy, (coord *, int)); -E int FDECL(movecmd, (CHAR_P)); -E int NDECL(dxdy_moveok); -E int FDECL(getdir, (const char *)); -E void NDECL(confdir); -E const char *FDECL(directionname, (int)); -E int FDECL(isok, (int, int)); -E int FDECL(get_adjacent_loc, - (const char *, const char *, XCHAR_P, XCHAR_P, coord *)); -E const char *FDECL(click_to_cmd, (int, int, int)); -E char FDECL(get_count, (char *, CHAR_P, long, long *, BOOLEAN_P)); +extern void cmdbind_freeall(void); +extern int dotoggleoption(void); +extern void set_move_cmd(int, int); +extern int do_move_west(void); +extern int do_move_northwest(void); +extern int do_move_north(void); +extern int do_move_northeast(void); +extern int do_move_east(void); +extern int do_move_southeast(void); +extern int do_move_south(void); +extern int do_move_southwest(void); +extern int do_rush_west(void); +extern int do_rush_northwest(void); +extern int do_rush_north(void); +extern int do_rush_northeast(void); +extern int do_rush_east(void); +extern int do_rush_southeast(void); +extern int do_rush_south(void); +extern int do_rush_southwest(void); +extern int do_run_west(void); +extern int do_run_northwest(void); +extern int do_run_north(void); +extern int do_run_northeast(void); +extern int do_run_east(void); +extern int do_run_southeast(void); +extern int do_run_south(void); +extern int do_run_southwest(void); +extern int do_reqmenu(void); +extern int do_rush(void); +extern int do_run(void); +extern int do_fight(void); +extern int do_repeat(void); +extern char randomkey(void); +extern void random_response(char *, int); +extern int rnd_extcmd_idx(void); +extern int domonability(void); +extern const struct ext_func_tab *ext_func_tab_from_func(int(*)(void)); +extern char cmd_from_func(int(*)(void)); +extern char cmd_from_dir(int, int); +extern char *cmd_from_ecname(const char *); +extern const char *cmdname_from_func(int(*)(void), char *, boolean); +extern boolean redraw_cmd(char); +extern const char *levltyp_to_name(int); +extern int dolookaround(void); +extern void reset_occupations(void); +extern void set_occupation(int(*)(void), const char *, cmdcount_nht); +extern void cmdq_add_ec(int, int(*)(void)); +extern void cmdq_add_key(int, char); +extern void cmdq_add_dir(int, schar, schar, schar); +extern void cmdq_add_userinput(int); +extern void cmdq_add_int(int, int); +extern void cmdq_shift(int); +extern struct _cmd_queue *cmdq_reverse(struct _cmd_queue *); +extern struct _cmd_queue *cmdq_copy(int); +extern struct _cmd_queue *cmdq_pop(void); +extern struct _cmd_queue *cmdq_peek(int); +extern void cmdq_clear(int); +extern char pgetchar(void); +extern char extcmd_initiator(void); +extern int doextcmd(void); +extern struct ext_func_tab *extcmds_getentry(int); +extern int count_bind_keys(void); +extern int count_autocompletions(void); +extern void get_changed_key_binds(strbuf_t *); +extern void handler_rebind_keys(void); +extern void handler_change_autocompletions(void); +extern int extcmds_match(const char *, int, int **); +extern const char *key2extcmddesc(uchar); +extern boolean bind_specialkey(uchar, const char *); +extern void parseautocomplete(char *, boolean); +extern void all_options_autocomplete(strbuf_t *); +extern void lock_mouse_buttons(boolean); +extern void reset_commands(boolean); +extern void update_rest_on_space(void); +extern void rhack(int); +extern int doextlist(void); +extern int extcmd_via_menu(void); +extern int enter_explore_mode(void); +extern boolean bind_mousebtn(int, const char *); +extern boolean bind_key(uchar, const char *, boolean); +extern void dokeylist(void); +extern int xytodir(int, int); +extern void dirtocoord(coord *, int); +extern int movecmd(char, int); +extern int dxdy_moveok(void); +extern int getdir(const char *); +extern void confdir(boolean); +extern const char *directionname(int); +extern int isok(coordxy, coordxy); +extern int get_adjacent_loc(const char *, const char *, coordxy, coordxy, + coord *); +extern void click_to_cmd(coordxy, coordxy, int); +extern char get_count(const char *, char, long, cmdcount_nht *, unsigned); #ifdef HANGUPHANDLING -E void FDECL(hangup, (int)); -E void NDECL(end_of_input); +extern void hangup(int); +extern void end_of_input(void); #endif -E char NDECL(readchar); -E void NDECL(sanity_check); -E char* FDECL(key2txt, (UCHAR_P, char *)); -E char FDECL(yn_function, (const char *, const char *, CHAR_P)); -E boolean FDECL(paranoid_query, (BOOLEAN_P, const char *)); +extern char readchar(void); +extern char readchar_poskey(coordxy *, coordxy *, int *); +extern char* key2txt(uchar, char *); +extern char yn_function(const char *, const char *, char, boolean); +extern char paranoid_ynq(boolean, const char *, boolean); +extern boolean paranoid_query(boolean, const char *); +extern void makemap_prepost(boolean, boolean); +extern const char *ecname_from_fn(int (*)(void)); + +/* ### date.c ### */ + +extern void populate_nomakedefs(struct version_info *) NONNULLARG1; +extern void free_nomakedefs(void); /* ### dbridge.c ### */ -E boolean FDECL(is_pool, (int, int)); -E boolean FDECL(is_lava, (int, int)); -E boolean FDECL(is_pool_or_lava, (int, int)); -E boolean FDECL(is_ice, (int, int)); -E boolean FDECL(is_moat, (int, int)); -E schar FDECL(db_under_typ, (int)); -E int FDECL(is_drawbridge_wall, (int, int)); -E boolean FDECL(is_db_wall, (int, int)); -E boolean FDECL(find_drawbridge, (int *, int *)); -E boolean FDECL(create_drawbridge, (int, int, int, BOOLEAN_P)); -E void FDECL(open_drawbridge, (int, int)); -E void FDECL(close_drawbridge, (int, int)); -E void FDECL(destroy_drawbridge, (int, int)); +extern boolean is_waterwall(coordxy, coordxy); +extern boolean is_pool(coordxy, coordxy); +extern boolean is_lava(coordxy, coordxy); +extern boolean is_pool_or_lava(coordxy, coordxy); +extern boolean is_ice(coordxy, coordxy); +extern boolean is_moat(coordxy, coordxy); +extern schar db_under_typ(int); +extern int is_drawbridge_wall(coordxy, coordxy); +extern boolean is_db_wall(coordxy, coordxy); +extern boolean find_drawbridge(coordxy *, coordxy *) NONNULLPTRS; +extern boolean create_drawbridge(coordxy, coordxy, int, boolean); +extern void open_drawbridge(coordxy, coordxy); +extern void close_drawbridge(coordxy, coordxy); +extern void destroy_drawbridge(coordxy, coordxy); /* ### decl.c ### */ -E void NDECL(decl_init); +extern void program_state_init(void); +extern void decl_globals_init(void); +extern void sa_victual(volatile struct victual_info *); /* ### detect.c ### */ -E boolean FDECL(trapped_chest_at, (int, int, int)); -E boolean FDECL(trapped_door_at, (int, int, int)); -E struct obj *FDECL(o_in, (struct obj *, CHAR_P)); -E struct obj *FDECL(o_material, (struct obj *, unsigned)); -E int FDECL(gold_detect, (struct obj *)); -E int FDECL(food_detect, (struct obj *)); -E int FDECL(object_detect, (struct obj *, int)); -E int FDECL(monster_detect, (struct obj *, int)); -E int FDECL(trap_detect, (struct obj *)); -E const char *FDECL(level_distance, (d_level *)); -E void FDECL(use_crystal_ball, (struct obj **)); -E void NDECL(do_mapping); -E void FDECL(do_vicinity_map, (struct obj *)); -E void FDECL(cvt_sdoor_to_door, (struct rm *)); -#ifdef USE_TRAMPOLI -E void FDECL(findone, (int, int, genericptr_t)); -E void FDECL(openone, (int, int, genericptr_t)); -#endif -E int NDECL(findit); -E int NDECL(openit); -E boolean FDECL(detecting, (void (*)(int, int, genericptr))); -E void FDECL(find_trap, (struct trap *)); -E void NDECL(warnreveal); -E int FDECL(dosearch0, (int)); -E int NDECL(dosearch); -E void NDECL(sokoban_detect); +extern boolean trapped_chest_at(int, coordxy, coordxy); +extern boolean trapped_door_at(int, coordxy, coordxy); +extern struct obj *o_in(struct obj *, char) NONNULLARG1; +extern struct obj *o_material(struct obj *, unsigned) NONNULLARG1; +extern int gold_detect(struct obj *) NONNULLARG1; +extern int food_detect(struct obj *); +extern int object_detect(struct obj *, int); +extern int monster_detect(struct obj *, int); +extern int trap_detect(struct obj *); +extern const char *level_distance(d_level *) NONNULL NONNULLARG1; +extern void use_crystal_ball(struct obj **) NONNULLARG1; +extern void show_map_spot(coordxy, coordxy, boolean); +extern void do_mapping(void); +extern void do_vicinity_map(struct obj *); +extern void cvt_sdoor_to_door(struct rm *) NONNULLARG1; +extern int findit(void); +extern int openit(void); +extern boolean detecting(void(*)(coordxy, coordxy, void *)); +extern void find_trap(struct trap *) NONNULLARG1; +extern void warnreveal(void); +extern int dosearch0(int); +extern int dosearch(void); +extern void premap_detect(void); #ifdef DUMPLOG -E void NDECL(dump_map); +extern void dump_map(void); #endif -E void FDECL(reveal_terrain, (int, int)); +extern void reveal_terrain(unsigned); +extern int wiz_mgender(void); /* ### dig.c ### */ -E int FDECL(dig_typ, (struct obj *, XCHAR_P, XCHAR_P)); -E boolean NDECL(is_digging); -#ifdef USE_TRAMPOLI -E int NDECL(dig); -#endif -E int NDECL(holetime); -E boolean FDECL(dig_check, (struct monst *, BOOLEAN_P, int, int)); -E void FDECL(digactualhole, (int, int, struct monst *, int)); -E boolean FDECL(dighole, (BOOLEAN_P, BOOLEAN_P, coord *)); -E int FDECL(use_pick_axe, (struct obj *)); -E int FDECL(use_pick_axe2, (struct obj *)); -E boolean FDECL(mdig_tunnel, (struct monst *)); -E void FDECL(draft_message, (BOOLEAN_P)); -E void FDECL(watch_dig, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void NDECL(zap_dig); -E struct obj *FDECL(bury_an_obj, (struct obj *, boolean *)); -E void FDECL(bury_objs, (int, int)); -E void FDECL(unearth_objs, (int, int)); -E void FDECL(rot_organic, (ANY_P *, long)); -E void FDECL(rot_corpse, (ANY_P *, long)); -E struct obj *FDECL(buried_ball, (coord *)); -E void NDECL(buried_ball_to_punishment); -E void NDECL(buried_ball_to_freedom); -E schar FDECL(fillholetyp, (int, int, BOOLEAN_P)); -E void FDECL(liquid_flow, - (XCHAR_P, XCHAR_P, SCHAR_P, struct trap *, const char *)); -E boolean FDECL(conjoined_pits, (struct trap *, struct trap *, BOOLEAN_P)); +extern int dig_typ(struct obj *, coordxy, coordxy); +extern boolean is_digging(void); +extern int holetime(void); +extern enum digcheck_result dig_check(struct monst *, coordxy, coordxy); +extern void digcheck_fail_message(enum digcheck_result, struct monst *, + coordxy, coordxy); +extern void digactualhole(coordxy, coordxy, struct monst *, int); +extern boolean dighole(boolean, boolean, coord *); +extern int use_pick_axe(struct obj *) NONNULLARG1; +extern int use_pick_axe2(struct obj *) NONNULLARG1; +extern boolean mdig_tunnel(struct monst *) NONNULLARG1; +extern void draft_message(boolean); +extern void watch_dig(struct monst *, coordxy, coordxy, boolean); +extern void zap_dig(void); +extern struct obj *bury_an_obj(struct obj *, boolean *) NONNULLARG1; +extern void bury_objs(int, int); +extern void unearth_objs(int, int); +extern void rot_organic(union any *, long) NONNULLARG1; +extern void rot_corpse(union any *, long) NONNULLARG1; +extern struct obj *buried_ball(coord *) NONNULLARG1; +extern void buried_ball_to_punishment(void); +extern void buried_ball_to_freedom(void); +extern schar fillholetyp(coordxy, coordxy, boolean); +extern void liquid_flow(coordxy, coordxy, schar, struct trap *, const char *); +extern boolean conjoined_pits(struct trap *, struct trap *, boolean); #if 0 -E void FDECL(bury_monst, (struct monst *)); -E void NDECL(bury_you); -E void NDECL(unearth_you); -E void NDECL(escape_tomb); -E void FDECL(bury_obj, (struct obj *)); +extern void bury_monst(struct monst *) NONNULLARG1; +extern void bury_you(void); +extern void unearth_you(void); +extern void escape_tomb(void); +extern void bury_obj(struct obj *) NONNULLARG1; +#endif +#ifdef DEBUG +extern int wiz_debug_cmd_bury(void); #endif /* ### display.c ### */ -E void FDECL(magic_map_background, (XCHAR_P, XCHAR_P, int)); -E void FDECL(map_background, (XCHAR_P, XCHAR_P, int)); -E void FDECL(map_trap, (struct trap *, int)); -E void FDECL(map_object, (struct obj *, int)); -E void FDECL(map_invisible, (XCHAR_P, XCHAR_P)); -E boolean FDECL(unmap_invisible, (int, int)); -E void FDECL(unmap_object, (int, int)); -E void FDECL(map_location, (int, int, int)); -E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P)); -E void FDECL(feel_location, (XCHAR_P, XCHAR_P)); -E void FDECL(newsym, (int, int)); -E void FDECL(newsym_force, (int, int)); -E void FDECL(shieldeff, (XCHAR_P, XCHAR_P)); -E void FDECL(tmp_at, (int, int)); -E void FDECL(flash_glyph_at, (int, int, int, int)); -E void FDECL(swallowed, (int)); -E void FDECL(under_ground, (int)); -E void FDECL(under_water, (int)); -E void NDECL(see_monsters); -E void NDECL(set_mimic_blocking); -E void NDECL(see_objects); -E void NDECL(see_traps); -E void NDECL(curs_on_u); -E int NDECL(doredraw); -E void NDECL(docrt); -E void NDECL(redraw_map); -E void FDECL(show_glyph, (int, int, int)); -E void NDECL(clear_glyph_buffer); -E void FDECL(row_refresh, (int, int, int)); -E void NDECL(cls); -E void FDECL(flush_screen, (int)); -E int FDECL(back_to_glyph, (XCHAR_P, XCHAR_P)); -E int FDECL(zapdir_to_glyph, (int, int, int)); -E int FDECL(glyph_at, (XCHAR_P, XCHAR_P)); -E void NDECL(set_wall_state); -E void FDECL(unset_seenv, (struct rm *, int, int, int, int)); -E int FDECL(warning_of, (struct monst *)); +extern int tp_sensemon(struct monst *) NONNULLARG1; +extern int sensemon(struct monst *) NONNULLARG1; +extern int mon_warning(struct monst *) NONNULLARG1; +extern int mon_visible(struct monst *) NONNULLARG1; +extern int see_with_infrared(struct monst *) NONNULLARG1; +extern int canseemon(struct monst *) NONNULLARG1; +extern int knowninvisible(struct monst *) NONNULLARG1; +extern int is_safemon(struct monst *) NONNULLARG1; +extern void magic_map_background(coordxy, coordxy, int); +extern void map_background(coordxy, coordxy, int); +extern void map_trap(struct trap *, int) NONNULLARG1; +extern void map_object(struct obj *, int) NONNULLARG1; +extern void map_invisible(coordxy, coordxy); +extern void map_engraving(struct engr *, int); +extern boolean unmap_invisible(coordxy, coordxy); +extern void unmap_object(coordxy, coordxy); +extern void map_location(coordxy, coordxy, int); +extern boolean suppress_map_output(void); +extern void feel_newsym(coordxy, coordxy); +extern void feel_location(coordxy, coordxy); +extern void newsym(coordxy, coordxy); +extern void newsym_force(coordxy, coordxy); +extern void shieldeff(coordxy, coordxy); +extern void tmp_at(coordxy, coordxy); +extern void flash_glyph_at(coordxy, coordxy, int, int); +extern void swallowed(int); +extern void under_ground(int); +extern void under_water(int); +extern void see_monsters(void); +extern void set_mimic_blocking(void); +extern void see_objects(void); +extern void see_nearby_objects(void); +extern void see_traps(void); +extern void curs_on_u(void); +extern int doredraw(void); +extern void docrt(void); +extern void docrt_flags(int); +extern void redraw_map(boolean); +extern void show_glyph(coordxy, coordxy, int); +extern void clear_glyph_buffer(void); +extern void row_refresh(coordxy, coordxy, coordxy); +extern void cls(void); +extern void flush_screen(int); +extern int back_to_glyph(coordxy, coordxy); +extern int zapdir_to_glyph(int, int, int); +extern int glyph_at(coordxy, coordxy); +extern void reglyph_darkroom(void); +extern void xy_set_wall_state(coordxy, coordxy); +extern void set_wall_state(void); +extern void unset_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy); +extern int warning_of(struct monst *) NONNULLARG1; +extern void map_glyphinfo(coordxy, coordxy, int, unsigned, glyph_info *) NONNULLPTRS; +extern void reset_glyphmap(enum glyphmap_change_triggers trigger); +extern int fn_cmap_to_glyph(int); /* ### do.c ### */ -#ifdef USE_TRAMPOLI -E int FDECL(drop, (struct obj *)); -E int NDECL(wipeoff); -#endif -E int NDECL(dodrop); -E boolean FDECL(boulder_hits_pool, (struct obj *, int, int, BOOLEAN_P)); -E boolean FDECL(flooreffects, (struct obj *, int, int, const char *)); -E void FDECL(doaltarobj, (struct obj *)); -E boolean FDECL(canletgo, (struct obj *, const char *)); -E void FDECL(dropx, (struct obj *)); -E void FDECL(dropy, (struct obj *)); -E void FDECL(dropz, (struct obj *, BOOLEAN_P)); -E void FDECL(obj_no_longer_held, (struct obj *)); -E int NDECL(doddrop); -E int NDECL(dodown); -E int NDECL(doup); +extern int dodrop(void); +extern boolean boulder_hits_pool(struct obj *, coordxy, coordxy, boolean); +extern boolean flooreffects(struct obj *, coordxy, coordxy, + const char *) NONNULLPTRS; +extern void doaltarobj(struct obj *) NONNULLARG1; +extern void polymorph_sink(void); +extern void trycall(struct obj *) NONNULLARG1; +extern boolean canletgo(struct obj *, const char *) NONNULLPTRS; +extern void dropx(struct obj *) NONNULLARG1; +extern void dropy(struct obj *) NONNULLARG1; +extern void dropz(struct obj *, boolean) NONNULLARG1; +extern void obj_no_longer_held(struct obj *); +extern int doddrop(void); +extern int dodown(void); +extern int doup(void); #ifdef INSURANCE -E void NDECL(save_currentstate); -#endif -E void FDECL(u_collide_m, (struct monst *)); -E void FDECL(goto_level, (d_level *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(schedule_goto, (d_level *, BOOLEAN_P, BOOLEAN_P, int, - const char *, const char *)); -E void NDECL(deferred_goto); -E boolean FDECL(revive_corpse, (struct obj *)); -E void FDECL(revive_mon, (ANY_P *, long)); -E int NDECL(donull); -E int NDECL(dowipe); -E void FDECL(set_wounded_legs, (long, int)); -E void FDECL(heal_legs, (int)); +extern void save_currentstate(void); +#endif +extern void u_collide_m(struct monst *); +extern void goto_level(d_level *, boolean, boolean, boolean) NONNULLARG1; +extern void hellish_smoke_mesg(void); +extern void maybe_lvltport_feedback(void); +extern void schedule_goto(d_level *, int, const char *, const char *) NONNULLARG1; +extern void deferred_goto(void); +extern boolean revive_corpse(struct obj *) NONNULLARG1; +extern void revive_mon(union any *, long) NONNULLARG1; +extern void zombify_mon(union any *, long) NONNULLARG1; +extern boolean cmd_safety_prevention(const char *, const char *, + const char *, int *) NONNULLPTRS; +extern int donull(void); +extern int dowipe(void); +extern void legs_in_no_shape(const char *, boolean) NONNULLARG1; +extern void set_wounded_legs(long, int); +extern void heal_legs(int); /* ### do_name.c ### */ -E char *FDECL(coord_desc, (int, int, char *, CHAR_P)); -E boolean FDECL(getpos_menu, (coord *, int)); -E int FDECL(getpos, (coord *, BOOLEAN_P, const char *)); -E void FDECL(getpos_sethilite, (void (*f)(int), boolean (*d)(int,int))); -E void FDECL(new_mname, (struct monst *, int)); -E void FDECL(free_mname, (struct monst *)); -E void FDECL(new_oname, (struct obj *, int)); -E void FDECL(free_oname, (struct obj *)); -E const char *FDECL(safe_oname, (struct obj *)); -E struct monst *FDECL(christen_monst, (struct monst *, const char *)); -E struct obj *FDECL(oname, (struct obj *, const char *)); -E boolean FDECL(objtyp_is_callable, (int)); -E int NDECL(docallcmd); -E void FDECL(docall, (struct obj *)); -E const char *NDECL(rndghostname); -E char *FDECL(x_monnam, (struct monst *, int, const char *, int, BOOLEAN_P)); -E char *FDECL(l_monnam, (struct monst *)); -E char *FDECL(mon_nam, (struct monst *)); -E char *FDECL(noit_mon_nam, (struct monst *)); -E char *FDECL(Monnam, (struct monst *)); -E char *FDECL(noit_Monnam, (struct monst *)); -E char *FDECL(noname_monnam, (struct monst *, int)); -E char *FDECL(m_monnam, (struct monst *)); -E char *FDECL(y_monnam, (struct monst *)); -E char *FDECL(Adjmonnam, (struct monst *, const char *)); -E char *FDECL(Amonnam, (struct monst *)); -E char *FDECL(a_monnam, (struct monst *)); -E char *FDECL(distant_monnam, (struct monst *, int, char *)); -E char *FDECL(mon_nam_too, (struct monst *, struct monst *)); -E char *FDECL(minimal_monnam, (struct monst *, BOOLEAN_P)); -E char *FDECL(rndmonnam, (char *)); -E const char *FDECL(hcolor, (const char *)); -E const char *NDECL(rndcolor); -E const char *FDECL(hliquid, (const char *)); -E const char *NDECL(roguename); -E struct obj *FDECL(realloc_obj, - (struct obj *, int, genericptr_t, int, const char *)); -E char *FDECL(coyotename, (struct monst *, char *)); -E char *FDECL(rndorcname, (char *)); -E struct monst *FDECL(christen_orc, (struct monst *, const char *, - const char *)); -E const char *FDECL(noveltitle, (int *)); -E const char *FDECL(lookup_novel, (const char *, int *)); +extern void new_mgivenname(struct monst *, int) NONNULLARG1; +extern void free_mgivenname(struct monst *) NONNULLARG1; +extern void new_oname(struct obj *, int) NONNULLARG1; +extern void free_oname(struct obj *) NONNULLARG1; +extern const char *safe_oname(struct obj *) NONNULLARG1; +extern struct monst *christen_monst(struct monst *, const char *) NONNULLARG1; +extern struct obj *oname(struct obj *, const char *, unsigned) NONNULLPTRS; +extern boolean objtyp_is_callable(int); +extern int name_ok(struct obj *); +extern int call_ok(struct obj *); +extern int docallcmd(void); +extern void docall(struct obj *) NONNULLARG1; +extern const char *rndghostname(void); +extern char *x_monnam(struct monst *, int, const char *, int, boolean) NONNULLARG1; +extern char *l_monnam(struct monst *) NONNULLARG1; +extern char *mon_nam(struct monst *) NONNULLARG1; +extern char *noit_mon_nam(struct monst *) NONNULLARG1; +extern char *some_mon_nam(struct monst *) NONNULLARG1; +extern char *Monnam(struct monst *) NONNULLARG1; +extern char *noit_Monnam(struct monst *) NONNULLARG1; +extern char *Some_Monnam(struct monst *) NONNULLARG1; +extern char *noname_monnam(struct monst *, int) NONNULLARG1; +extern char *m_monnam(struct monst *) NONNULLARG1; +extern char *y_monnam(struct monst *) NONNULLARG1; +extern char *YMonnam(struct monst *) NONNULLARG1; +extern char *Adjmonnam(struct monst *, const char *) NONNULLARG1; +extern char *Amonnam(struct monst *) NONNULLARG1; +extern char *a_monnam(struct monst *) NONNULLARG1; +extern char *distant_monnam(struct monst *, int, char *) NONNULLARG1; +extern char *mon_nam_too(struct monst *, struct monst *) NONNULLPTRS; +extern char *monverbself(struct monst *, char *, + const char *, const char *) NONNULLARG123; +extern char *minimal_monnam(struct monst *, boolean); +extern char *bogusmon(char *, char *) NONNULLARG1; +extern char *rndmonnam(char *); +extern const char *hcolor(const char *); +extern const char *rndcolor(void); +extern const char *hliquid(const char *); +extern const char *roguename(void); +/* +extern struct obj *realloc_obj(struct obj *, int, genericptr_t, int, + const char *); +*/ +extern char *coyotename(struct monst *, char *); +extern char *rndorcname(char *); +extern struct monst *christen_orc(struct monst *, const char *, + const char *) NONNULLARG1; +extern const char *noveltitle(int *); +extern const char *lookup_novel(const char *, int *) NONNULLARG1; +#ifndef PMNAME_MACROS +extern int Mgender(struct monst *) NONNULLARG1; +extern const char *pmname(struct permonst *, int) NONNULLARG1; +#endif +extern const char *mon_pmname(struct monst *) NONNULLARG1; +extern const char *obj_pmname(struct obj *) NONNULLARG1; /* ### do_wear.c ### */ -#ifdef USE_TRAMPOLI -E int NDECL(Armor_on); -E int NDECL(Boots_on); -E int NDECL(Gloves_on); -E int NDECL(Helmet_on); -E int FDECL(select_off, (struct obj *)); -E int NDECL(take_off); -#endif -E const char *FDECL(fingers_or_gloves, (BOOLEAN_P)); -E void FDECL(off_msg, (struct obj *)); -E void FDECL(set_wear, (struct obj *)); -E boolean FDECL(donning, (struct obj *)); -E boolean FDECL(doffing, (struct obj *)); -E void FDECL(cancel_doff, (struct obj *, long)); -E void NDECL(cancel_don); -E int FDECL(stop_donning, (struct obj *)); -E int NDECL(Armor_off); -E int NDECL(Armor_gone); -E int NDECL(Helmet_off); -E int NDECL(Gloves_off); -E int NDECL(Boots_on); -E int NDECL(Boots_off); -E int NDECL(Cloak_off); -E int NDECL(Shield_off); -E int NDECL(Shirt_off); -E void NDECL(Amulet_off); -E void FDECL(Ring_on, (struct obj *)); -E void FDECL(Ring_off, (struct obj *)); -E void FDECL(Ring_gone, (struct obj *)); -E void FDECL(Blindf_on, (struct obj *)); -E void FDECL(Blindf_off, (struct obj *)); -E int NDECL(dotakeoff); -E int NDECL(doremring); -E int FDECL(cursed, (struct obj *)); -E int FDECL(armoroff, (struct obj *)); -E int FDECL(canwearobj, (struct obj *, long *, BOOLEAN_P)); -E int NDECL(dowear); -E int NDECL(doputon); -E void NDECL(find_ac); -E void NDECL(glibr); -E struct obj *FDECL(some_armor, (struct monst *)); -E struct obj *FDECL(stuck_ring, (struct obj *, int)); -E struct obj *NDECL(unchanger); -E void NDECL(reset_remarm); -E int NDECL(doddoremarm); -E int FDECL(destroy_arm, (struct obj *)); -E void FDECL(adj_abon, (struct obj *, SCHAR_P)); -E boolean -FDECL(inaccessible_equipment, (struct obj *, const char *, BOOLEAN_P)); +extern const char *fingers_or_gloves(boolean); +extern void off_msg(struct obj *) NONNULLARG1; +extern void toggle_displacement(struct obj *, long, boolean); +extern void set_wear(struct obj *); +extern boolean donning(struct obj *) NONNULLARG1; +extern boolean doffing(struct obj *) NONNULLARG1; +extern void cancel_doff(struct obj *, long) NONNULLARG1; +extern void cancel_don(void); +extern int stop_donning(struct obj *); /* doseduce() calls with NULL */ +extern int Armor_off(void); +extern int Armor_gone(void); +extern int Helmet_off(void); +extern boolean hard_helmet(struct obj *); +extern void wielding_corpse(struct obj *, struct obj *, boolean); +extern int Gloves_off(void); +extern int Boots_on(void); +extern int Boots_off(void); +extern int Cloak_off(void); +extern int Shield_off(void); +extern int Shirt_off(void); +extern void Amulet_off(void); +extern void Ring_on(struct obj *) NONNULLARG1; +extern void Ring_off(struct obj *) NONNULLARG1; +extern void Ring_gone(struct obj *) NONNULLARG1; +extern void Blindf_on(struct obj *) NONNULLARG1; +extern void Blindf_off(struct obj *); +extern int dotakeoff(void); +extern int ia_dotakeoff(void); +extern int doremring(void); +extern int cursed(struct obj *); +extern int armoroff(struct obj *); +extern int canwearobj(struct obj *, long *, boolean) NONNULLPTRS; +extern int dowear(void); +extern int doputon(void); +extern void find_ac(void); +extern void glibr(void); +extern struct obj *some_armor(struct monst *) NONNULLARG1; +extern struct obj *stuck_ring(struct obj *, int); +extern struct obj *unchanger(void); +extern void reset_remarm(void); +extern int doddoremarm(void); +extern int remarm_swapwep(void); +extern int disintegrate_arm(struct obj *); +extern int destroy_arm(void); +extern void adj_abon(struct obj *, schar) NONNULLARG1; +extern boolean inaccessible_equipment(struct obj *, const char *, boolean); +extern int any_worn_armor_ok(struct obj *); +extern int count_worn_armor(void); /* ### dog.c ### */ -E void FDECL(newedog, (struct monst *)); -E void FDECL(free_edog, (struct monst *)); -E void FDECL(initedog, (struct monst *)); -E struct monst *FDECL(make_familiar, - (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E struct monst *NDECL(makedog); -E void NDECL(update_mlstmv); -E void NDECL(losedogs); -E void FDECL(mon_arrive, (struct monst *, BOOLEAN_P)); -E void FDECL(mon_catchup_elapsed_time, (struct monst *, long)); -E void FDECL(keepdogs, (BOOLEAN_P)); -E void FDECL(migrate_to_level, (struct monst *, XCHAR_P, XCHAR_P, coord *)); -E int FDECL(dogfood, (struct monst *, struct obj *)); -E boolean FDECL(tamedog, (struct monst *, struct obj *)); -E void FDECL(abuse_dog, (struct monst *)); -E void FDECL(wary_dog, (struct monst *, BOOLEAN_P)); +extern void newedog(struct monst *) NONNULLARG1; +extern void free_edog(struct monst *) NONNULLARG1; +extern void initedog(struct monst *, boolean) NONNULLARG1; +extern struct monst *make_familiar(struct obj *, coordxy, coordxy, boolean); +extern struct monst *makedog(void); +extern void update_mlstmv(void); +extern void losedogs(void); +extern void mon_arrive(struct monst *, int) NONNULLARG1; +extern void mon_catchup_elapsed_time(struct monst *, long) NONNULLARG1; +extern void keepdogs(boolean); +extern void migrate_to_level(struct monst *, xint16, xint16, coord *) NONNULLARG1; +extern void discard_migrations(void); +extern int dogfood(struct monst *, struct obj *) NONNULLPTRS; +extern boolean tamedog(struct monst *, struct obj *, boolean) NONNULLARG1; +extern void abuse_dog(struct monst *) NONNULLARG1; +extern void wary_dog(struct monst *, boolean) NONNULLARG1; /* ### dogmove.c ### */ -E struct obj *FDECL(droppables, (struct monst *)); -E int FDECL(dog_nutrition, (struct monst *, struct obj *)); -E int FDECL(dog_eat, (struct monst *, struct obj *, int, int, BOOLEAN_P)); -E int FDECL(dog_move, (struct monst *, int)); -#ifdef USE_TRAMPOLI -E void FDECL(wantdoor, (int, int, genericptr_t)); -#endif -E void FDECL(finish_meating, (struct monst *)); +extern boolean cursed_object_at(coordxy, coordxy); +extern struct obj *droppables(struct monst *) NONNULLARG1; +extern int dog_nutrition(struct monst *, struct obj *) NONNULLPTRS; +extern int dog_eat(struct monst *, struct obj *, + coordxy, coordxy, boolean) NONNULLPTRS; +extern int pet_ranged_attk(struct monst *, boolean) NONNULLARG1; +extern int dog_move(struct monst *, int) NONNULLARG1; +extern boolean could_reach_item(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void finish_meating(struct monst *) NONNULLARG1; +extern void quickmimic(struct monst *) NONNULLARG1; /* ### dokick.c ### */ -E boolean FDECL(ghitm, (struct monst *, struct obj *)); -E void FDECL(container_impact_dmg, (struct obj *, XCHAR_P, XCHAR_P)); -E int NDECL(dokick); -E boolean FDECL(ship_object, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(obj_delivery, (BOOLEAN_P)); -E void FDECL(deliver_obj_to_mon, (struct monst *mtmp, int, unsigned long)); -E schar FDECL(down_gate, (XCHAR_P, XCHAR_P)); -E void FDECL(impact_drop, (struct obj *, XCHAR_P, XCHAR_P, XCHAR_P)); +extern boolean ghitm(struct monst *, struct obj *) NONNULLPTRS; +extern void container_impact_dmg(struct obj *, coordxy, coordxy) NONNULLARG1; +extern int dokick(void); +extern boolean ship_object(struct obj *, coordxy, coordxy, boolean); +extern void obj_delivery(boolean); +extern void deliver_obj_to_mon(struct monst *mtmp, int, unsigned long) NONNULLARG1; +extern schar down_gate(coordxy, coordxy); +extern void impact_drop(struct obj *, coordxy, coordxy, xint16); /* ### dothrow.c ### */ -E int NDECL(dothrow); -E int NDECL(dofire); -E void FDECL(endmultishot, (BOOLEAN_P)); -E void FDECL(hitfloor, (struct obj *, BOOLEAN_P)); -E void FDECL(hurtle, (int, int, int, BOOLEAN_P)); -E void FDECL(mhurtle, (struct monst *, int, int, int)); -E boolean FDECL(throwing_weapon, (struct obj *)); -E void FDECL(throwit, (struct obj *, long, BOOLEAN_P)); -E int FDECL(omon_adj, (struct monst *, struct obj *, BOOLEAN_P)); -E int FDECL(thitmonst, (struct monst *, struct obj *)); -E int FDECL(hero_breaks, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E int FDECL(breaks, (struct obj *, XCHAR_P, XCHAR_P)); -E void FDECL(release_camera_demon, (struct obj *, XCHAR_P, XCHAR_P)); -E void FDECL(breakobj, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(breaktest, (struct obj *)); -E boolean FDECL(walk_path, (coord *, coord *, - boolean (*)(genericptr, int, int), genericptr_t)); -E boolean FDECL(hurtle_jump, (genericptr_t, int, int)); -E boolean FDECL(hurtle_step, (genericptr_t, int, int)); +extern int multishot_class_bonus(int, struct obj *, struct obj *) NONNULLARG2; +extern int dothrow(void); +extern int dofire(void); +extern void endmultishot(boolean); +extern void hitfloor(struct obj *, boolean) NONNULLARG1; +extern boolean hurtle_jump(genericptr_t, coordxy, coordxy) NONNULLARG1; +extern boolean hurtle_step(genericptr_t, coordxy, coordxy) NONNULLARG1; +extern boolean will_hurtle(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void hurtle(int, int, int, boolean); +extern void mhurtle(struct monst *, int, int, int) NONNULLARG1; +extern boolean harmless_missile(struct obj *) NONNULLARG1; +extern boolean throwing_weapon(struct obj *) NONNULLARG1; +extern boolean throwit_mon_hit(struct obj *, struct monst *) NONNULLARG1; +extern void throwit(struct obj *, long, boolean, struct obj *) NONNULLARG1; +extern int omon_adj(struct monst *, struct obj *, boolean) NONNULLPTRS; +extern boolean should_mulch_missile(struct obj *); +extern int thitmonst(struct monst *, struct obj *) NONNULLPTRS; +extern int hero_breaks(struct obj *, coordxy, coordxy, unsigned); +extern int breaks(struct obj *, coordxy, coordxy) NONNULLARG1; +extern void release_camera_demon(struct obj *, coordxy, coordxy) NONNULLARG1; +extern int breakobj(struct obj *, coordxy, coordxy, boolean, boolean) NONNULLARG1; +extern boolean breaktest(struct obj *) NONNULLARG1; +extern boolean walk_path(coord *, coord *, + boolean(*)(void *, coordxy, coordxy), genericptr_t) NONNULLARG12; /* ### drawing.c ### */ -#endif /* !MAKEDEFS_C && !LEV_LEX_C */ -E int FDECL(def_char_to_objclass, (CHAR_P)); -E int FDECL(def_char_to_monclass, (CHAR_P)); -#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) -E void FDECL(switch_symbols, (int)); -E void FDECL(assign_graphics, (int)); -E void NDECL(init_symbols); -E void NDECL(init_showsyms); -E void NDECL(init_primary_symbols); -E void NDECL(init_rogue_symbols); -E void NDECL(init_ov_primary_symbols); -E void NDECL(init_ov_rogue_symbols); -E void FDECL(clear_symsetentry, (int, BOOLEAN_P)); -E void FDECL(update_primary_symset, (struct symparse *, int)); -E void FDECL(update_rogue_symset, (struct symparse *, int)); -E void FDECL(update_ov_primary_symset, (struct symparse *, int)); -E void FDECL(update_ov_rogue_symset, (struct symparse *, int)); -E boolean FDECL(cursed_object_at, (int, int)); -E nhsym FDECL(get_othersym, (int, int)); + +extern int def_char_to_objclass(char); +extern int def_char_to_monclass(char); +extern int def_char_is_furniture(char); /* ### dungeon.c ### */ -E void FDECL(save_dungeon, (int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(restore_dungeon, (int)); -E void FDECL(insert_branch, (branch *, BOOLEAN_P)); -E void NDECL(init_dungeons); -E s_level *FDECL(find_level, (const char *)); -E s_level *FDECL(Is_special, (d_level *)); -E branch *FDECL(Is_branchlev, (d_level *)); -E boolean FDECL(builds_up, (d_level *)); -E xchar FDECL(ledger_no, (d_level *)); -E xchar NDECL(maxledgerno); -E schar FDECL(depth, (d_level *)); -E xchar FDECL(dunlev, (d_level *)); -E xchar FDECL(dunlevs_in_dungeon, (d_level *)); -E xchar FDECL(ledger_to_dnum, (XCHAR_P)); -E xchar FDECL(ledger_to_dlev, (XCHAR_P)); -E xchar FDECL(deepest_lev_reached, (BOOLEAN_P)); -E boolean FDECL(on_level, (d_level *, d_level *)); -E void FDECL(next_level, (BOOLEAN_P)); -E void FDECL(prev_level, (BOOLEAN_P)); -E void FDECL(u_on_newpos, (int, int)); -E void FDECL(u_on_rndspot, (int)); -E void FDECL(u_on_sstairs, (int)); -E void NDECL(u_on_upstairs); -E void NDECL(u_on_dnstairs); -E boolean FDECL(On_stairs, (XCHAR_P, XCHAR_P)); -E void FDECL(get_level, (d_level *, int)); -E boolean FDECL(Is_botlevel, (d_level *)); -E boolean FDECL(Can_fall_thru, (d_level *)); -E boolean FDECL(Can_dig_down, (d_level *)); -E boolean FDECL(Can_rise_up, (int, int, d_level *)); -E boolean FDECL(has_ceiling, (d_level *)); -E boolean FDECL(In_quest, (d_level *)); -E boolean FDECL(In_mines, (d_level *)); -E branch *FDECL(dungeon_branch, (const char *)); -E boolean FDECL(at_dgn_entrance, (const char *)); -E boolean FDECL(In_hell, (d_level *)); -E boolean FDECL(In_V_tower, (d_level *)); -E boolean FDECL(On_W_tower_level, (d_level *)); -E boolean FDECL(In_W_tower, (int, int, d_level *)); -E void FDECL(find_hell, (d_level *)); -E void FDECL(goto_hell, (BOOLEAN_P, BOOLEAN_P)); -E void FDECL(assign_level, (d_level *, d_level *)); -E void FDECL(assign_rnd_level, (d_level *, d_level *, int)); -E int FDECL(induced_align, (int)); -E boolean FDECL(Invocation_lev, (d_level *)); -E xchar NDECL(level_difficulty); -E schar FDECL(lev_by_name, (const char *)); -E schar FDECL(print_dungeon, (BOOLEAN_P, schar *, xchar *)); -E char *FDECL(get_annotation, (d_level *)); -E int NDECL(donamelevel); -E int NDECL(dooverview); -E void FDECL(show_overview, (int, int)); -E void FDECL(forget_mapseen, (int)); -E void FDECL(rm_mapseen, (int)); -E void FDECL(init_mapseen, (d_level *)); -E void NDECL(recalc_mapseen); -E void FDECL(mapseen_temple, (struct monst *)); -E void FDECL(room_discovered, (int)); -E void FDECL(recbranch_mapseen, (d_level *, d_level *)); -E void FDECL(overview_stats, (winid, const char *, long *, long *)); -E void FDECL(remdun_mapseen, (int)); -E const char *FDECL(endgamelevelname, (char *, int)); +extern void save_dungeon(NHFILE *, boolean, boolean) NONNULLARG1; +extern void restore_dungeon(NHFILE *) NONNULLARG1; +extern void insert_branch(branch *, boolean) NONNULLARG1; +extern void init_dungeons(void); +extern s_level *find_level(const char *) NONNULLARG1; +extern s_level *Is_special(d_level *) NONNULLARG1; +extern branch *Is_branchlev(d_level *) NONNULLARG1; +extern boolean builds_up(d_level *) NONNULLARG1; +extern xint16 ledger_no(d_level *) NONNULLARG1; +extern xint16 maxledgerno(void); +extern schar depth(d_level *) NONNULLARG1; +extern xint16 dunlev(d_level *) NONNULLARG1; +extern xint16 dunlevs_in_dungeon(d_level *) NONNULLARG1; +extern xint16 ledger_to_dnum(xint16); +extern xint16 ledger_to_dlev(xint16); +extern xint16 deepest_lev_reached(boolean); +extern boolean on_level(d_level *, d_level *) NONNULLARG12; +extern void next_level(boolean); +extern void prev_level(boolean); +extern void u_on_newpos(coordxy, coordxy); +extern void u_on_rndspot(int); +extern void get_level(d_level *, int) NONNULLARG1; +extern boolean Is_botlevel(d_level *) NONNULLARG1; +extern boolean Can_fall_thru(d_level *) NONNULLARG1; +extern boolean Can_dig_down(d_level *) NONNULLARG1; +extern boolean Can_rise_up(coordxy, coordxy, d_level *) NONNULLARG3; +extern boolean has_ceiling(d_level *) NONNULLARG1; +extern boolean avoid_ceiling(d_level *) NONNULLARG1; +extern const char *surface(coordxy, coordxy); +extern const char *ceiling(coordxy, coordxy); +extern boolean In_quest(d_level *) NONNULLARG1; +extern boolean In_mines(d_level *) NONNULLARG1; +extern branch *dungeon_branch(const char *) NONNULL NONNULLARG1; +extern boolean at_dgn_entrance(const char *) NONNULLARG1; +extern boolean In_hell(d_level *) NONNULLARG1; +extern boolean In_V_tower(d_level *) NONNULLARG1; +extern boolean On_W_tower_level(d_level *) NONNULLARG1; +extern boolean In_W_tower(coordxy, coordxy, d_level *) NONNULLARG3; +extern void find_hell(d_level *) NONNULLARG1; +extern void goto_hell(boolean, boolean); +extern boolean single_level_branch(d_level *) NONNULLARG1; +extern void assign_level(d_level *, d_level *) NONNULLPTRS; +extern void assign_rnd_level(d_level *, d_level *, int) NONNULLARG12; +extern unsigned int induced_align(int); +extern boolean Invocation_lev(d_level *) NONNULLARG1; +extern xint16 level_difficulty(void); +extern schar lev_by_name(const char *); +extern schar print_dungeon(boolean, schar *, xint16 *); +extern void print_level_annotation(void); +extern int donamelevel(void); +extern void free_exclusions(void); +extern void save_exclusions(NHFILE *) NONNULLARG1; +extern void load_exclusions(NHFILE *) NONNULLARG1; +extern int dooverview(void); +extern void show_overview(int, int); +extern void rm_mapseen(int); +extern void init_mapseen(d_level *) NONNULLARG1; +extern void update_lastseentyp(coordxy, coordxy); +extern int update_mapseen_for(coordxy, coordxy); +extern void recalc_mapseen(void); +extern void mapseen_temple(struct monst *); +extern void room_discovered(int); +extern void recbranch_mapseen(d_level *, d_level *) NONNULLPTRS; +extern void overview_stats(winid, const char *, long *, long *) NONNULLPTRS; +extern void remdun_mapseen(int); +extern const char *endgamelevelname(char *, int); + +/* ### earlyarg.c ### */ + +extern int argcheck(int, char **, enum earlyarg); +extern void early_options(int *argc_p, char ***argv_p, char **hackdir_p); +#ifdef WIN32 +int windows_early_options(const char *); +#endif /* ### eat.c ### */ -#ifdef USE_TRAMPOLI -E int NDECL(eatmdone); -E int NDECL(eatfood); -E int NDECL(opentin); -E int NDECL(unfaint); -#endif -E void NDECL(eatmupdate); -E boolean FDECL(is_edible, (struct obj *)); -E void NDECL(init_uhunger); -E int NDECL(Hear_again); -E void NDECL(reset_eat); -E int NDECL(doeat); -E int FDECL(use_tin_opener, (struct obj *)); -E void NDECL(gethungry); -E void FDECL(morehungry, (int)); -E void FDECL(lesshungry, (int)); -E boolean NDECL(is_fainted); -E void NDECL(reset_faint); -E void NDECL(violated_vegetarian); -E void FDECL(newuhs, (BOOLEAN_P)); -E struct obj *FDECL(floorfood, (const char *, int)); -E void NDECL(vomit); -E int FDECL(eaten_stat, (int, struct obj *)); -E void FDECL(food_disappears, (struct obj *)); -E void FDECL(food_substitution, (struct obj *, struct obj *)); -E void FDECL(eating_conducts, (struct permonst *)); -E int FDECL(eat_brains, (struct monst *, struct monst *, BOOLEAN_P, int *)); -E void NDECL(fix_petrification); -E void FDECL(consume_oeaten, (struct obj *, int)); -E boolean FDECL(maybe_finished_meal, (BOOLEAN_P)); -E void FDECL(set_tin_variety, (struct obj *, int)); -E int FDECL(tin_variety_txt, (char *, int *)); -E void FDECL(tin_details, (struct obj *, int, char *)); -E boolean FDECL(Popeye, (int)); +extern void eatmupdate(void); +extern boolean is_edible(struct obj *) NONNULLARG1; +extern void init_uhunger(void); +extern int Hear_again(void); +extern boolean eating_glob(struct obj *); +extern void reset_eat(void); +extern unsigned obj_nutrition(struct obj *) NONNULLARG1; +extern int doeat(void); +extern int use_tin_opener(struct obj *) NONNULLARG1; +extern void gethungry(void); +extern void morehungry(int); +extern void lesshungry(int); +extern boolean is_fainted(void); +extern void reset_faint(void); +extern int corpse_intrinsic(struct permonst *) NONNULLARG1; +extern void violated_vegetarian(void); +extern void newuhs(boolean); +extern struct obj *floorfood(const char *, int) NONNULLARG1; +extern void vomit(void); +extern int eaten_stat(int, struct obj *) NONNULLARG2; +extern void food_disappears(struct obj *) NONNULLARG1; +extern void food_substitution(struct obj *, struct obj *) NONNULLPTRS; +extern long temp_resist(int); +extern boolean eating_dangerous_corpse(int); +extern void eating_conducts(struct permonst *) NONNULLARG1; +extern int eat_brains(struct monst *, struct monst *, boolean, + int *) NONNULLARG12; +extern void fix_petrification(void); +extern int intrinsic_possible(int, struct permonst *) NONNULLARG2; +extern boolean should_givit(int, struct permonst *) NONNULLARG2; +extern void consume_oeaten(struct obj *, int) NONNULLARG1; +extern boolean maybe_finished_meal(boolean); +extern void cant_finish_meal(struct obj *) NONNULLARG1; +extern void set_tin_variety(struct obj *, int) NONNULLARG1; +extern int tin_variety_txt(char *, int *); +extern void tin_details(struct obj *, int, char *); +extern boolean Popeye(int); +extern int Finish_digestion(void); /* ### end.c ### */ -E void FDECL(done1, (int)); -E int NDECL(done2); -#ifdef USE_TRAMPOLI -E void FDECL(done_intr, (int)); -#endif -E void FDECL(done_in_by, (struct monst *, int)); -#endif /* !MAKEDEFS_C && !LEV_LEX_C */ -E void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2) NORETURN; -#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) -E void FDECL(done, (int)); -E void FDECL(container_contents, (struct obj *, BOOLEAN_P, - BOOLEAN_P, BOOLEAN_P)); -E void FDECL(nh_terminate, (int)) NORETURN; -E int NDECL(dovanquished); -E int NDECL(num_genocides); -E void FDECL(delayed_killer, (int, int, const char *)); -E struct kinfo *FDECL(find_delayed_killer, (int)); -E void FDECL(dealloc_killer, (struct kinfo *)); -E void FDECL(save_killers, (int, int)); -E void FDECL(restore_killers, (int)); -E char *FDECL(build_english_list, (char *)); -#if defined(PANICTRACE) && !defined(NO_SIGNAL) -E void FDECL(panictrace_setsignals, (BOOLEAN_P)); -#endif +extern void done1(int); +extern int done2(void); +extern void done_in_by(struct monst *, int) NONNULLARG1; +extern void done_object_cleanup(void); +extern void NH_abort(char *); +#endif /* !MAKEDEFS_C && MDLIB_C && !CPPREGEX_C */ +#if !defined(CPPREGEX_C) +ATTRNORETURN extern void panic(const char *, ...) PRINTF_F(1, 2) NORETURN; +#endif +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(CPPREGEX_C) +extern void done(int); +extern void container_contents(struct obj *, boolean, boolean, boolean); +ATTRNORETURN extern void nh_terminate(int) NORETURN; +extern void delayed_killer(int, int, const char *); +extern struct kinfo *find_delayed_killer(int); +extern void dealloc_killer(struct kinfo *); +extern void save_killers(NHFILE *) NONNULLARG1; +extern void restore_killers(NHFILE *) NONNULLARG1; +extern char *build_english_list(char *) NONNULLARG1; /* ### engrave.c ### */ -E char *FDECL(random_engraving, (char *)); -E void FDECL(wipeout_text, (char *, int, unsigned)); -E boolean FDECL(can_reach_floor, (BOOLEAN_P)); -E void FDECL(cant_reach_floor, (int, int, BOOLEAN_P, BOOLEAN_P)); -E const char *FDECL(surface, (int, int)); -E const char *FDECL(ceiling, (int, int)); -E struct engr *FDECL(engr_at, (XCHAR_P, XCHAR_P)); -E int FDECL(sengr_at, (const char *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(u_wipe_engr, (int)); -E void FDECL(wipe_engr_at, (XCHAR_P, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(read_engr_at, (int, int)); -E void FDECL(make_engr_at, (int, int, const char *, long, XCHAR_P)); -E void FDECL(del_engr_at, (int, int)); -E int NDECL(freehand); -E int NDECL(doengrave); -E void NDECL(sanitize_engravings); -E void FDECL(save_engravings, (int, int)); -E void FDECL(rest_engravings, (int)); -E void FDECL(engr_stats, (const char *, char *, long *, long *)); -E void FDECL(del_engr, (struct engr *)); -E void FDECL(rloc_engr, (struct engr *)); -E void FDECL(make_grave, (int, int, const char *)); +extern char *random_engraving(char *, char *) NONNULLARG12; +extern void wipeout_text(char *, int, unsigned) NONNULLARG1; +extern boolean can_reach_floor(boolean); +extern void cant_reach_floor(coordxy, coordxy, boolean, boolean, boolean); +extern struct engr *engr_at(coordxy, coordxy); +extern struct engr *sengr_at(const char *, coordxy, coordxy, boolean) NONNULLARG1; +extern void u_wipe_engr(int); +extern void wipe_engr_at(coordxy, coordxy, xint16, boolean); +extern void read_engr_at(coordxy, coordxy); +extern void make_engr_at(coordxy, coordxy, const char *, const char *, long, int) NONNULLARG3; +extern void del_engr_at(coordxy, coordxy); +extern int freehand(void); +extern int doengrave(void); +extern void sanitize_engravings(void); +extern void forget_engravings(void); +extern void engraving_sanity_check(void); +extern void save_engravings(NHFILE *) NONNULLARG1; +extern void rest_engravings(NHFILE *) NONNULLARG1; +extern void engr_stats(const char *, char *, long *, long *) NONNULLPTRS; +extern void del_engr(struct engr *) NONNULLARG1; +extern void rloc_engr(struct engr *) NONNULLARG1; +extern void make_grave(coordxy, coordxy, const char *); +extern void disturb_grave(coordxy, coordxy); +extern void see_engraving(struct engr *) NONNULLARG1; +extern void feel_engraving(struct engr *) NONNULLARG1; +extern boolean engr_can_be_felt(struct engr *) NONNULLARG1; /* ### exper.c ### */ -E long FDECL(newuexp, (int)); -E int NDECL(newpw); -E int FDECL(experience, (struct monst *, int)); -E void FDECL(more_experienced, (int, int)); -E void FDECL(losexp, (const char *)); -E void NDECL(newexplevel); -E void FDECL(pluslvl, (BOOLEAN_P)); -E long FDECL(rndexp, (BOOLEAN_P)); +extern long newuexp(int); +extern int newpw(void); +extern int experience(struct monst *, int) NONNULLARG1; +extern void more_experienced(int, int); +extern void losexp(const char *); +extern void newexplevel(void); +extern void pluslvl(boolean); +extern long rndexp(boolean); /* ### explode.c ### */ -E void FDECL(explode, (int, int, int, int, CHAR_P, int)); -E long FDECL(scatter, (int, int, int, unsigned int, struct obj *)); -E void FDECL(splatter_burning_oil, (int, int, BOOLEAN_P)); -E void FDECL(explode_oil, (struct obj *, int, int)); +extern void explode(coordxy, coordxy, int, int, char, int); +extern long scatter(coordxy, coordxy, int, unsigned int, struct obj *); +extern void splatter_burning_oil(coordxy, coordxy, boolean); +extern void explode_oil(struct obj *, coordxy, coordxy) NONNULLARG1; +extern int adtyp_to_expltype(const int); +extern void mon_explodes(struct monst *, struct attack *) NONNULLPTRS; /* ### extralev.c ### */ -E void NDECL(makeroguerooms); -E void FDECL(corr, (int, int)); -E void NDECL(makerogueghost); +extern void makeroguerooms(void); +extern void corr(coordxy, coordxy); +extern void makerogueghost(void); /* ### files.c ### */ -E void FDECL(append_slash, (char *)); /* Moved for NLE. */ - -E char *FDECL(fname_encode, (const char *, CHAR_P, char *, char *, int)); -E char *FDECL(fname_decode, (CHAR_P, char *, char *, int)); -E const char *FDECL(fqname, (const char *, int, int)); -E FILE *FDECL(fopen_datafile, (const char *, const char *, int)); -#ifdef MFLOPPY -E void NDECL(set_lock_and_bones); -#endif -E void FDECL(set_levelfile_name, (char *, int)); -E int FDECL(create_levelfile, (int, char *)); -E int FDECL(open_levelfile, (int, char *)); -E void FDECL(delete_levelfile, (int)); -E void NDECL(clearlocks); -E int FDECL(create_bonesfile, (d_level *, char **, char *)); -#ifdef MFLOPPY -E void NDECL(cancel_bonesfile); -#endif -E void FDECL(commit_bonesfile, (d_level *)); -E int FDECL(open_bonesfile, (d_level *, char **)); -E int FDECL(delete_bonesfile, (d_level *)); -E void NDECL(compress_bonesfile); -E void FDECL(set_savefile_name, (BOOLEAN_P)); +extern const char *nh_basename(const char *, boolean) NONNULLARG1; +extern char *fname_encode(const char *, char, + char *, char *, int) NONNULLPTRS; +extern char *fname_decode(char, char *, char *, int) NONNULLPTRS; +extern const char *fqname(const char *, int, int); +extern FILE *fopen_datafile(const char *, const char *, int) NONNULLPTRS; +extern void init_nhfile(NHFILE *) NONNULLARG1; +extern void close_nhfile(NHFILE *) NONNULLARG1; +extern void rewind_nhfile(NHFILE *) NONNULLARG1; +extern void set_levelfile_name(char *, int) NONNULLARG1; +extern NHFILE *create_levelfile(int, char *); +extern NHFILE *open_levelfile(int, char *); +extern void delete_levelfile(int); +extern void clearlocks(void); +extern NHFILE *create_bonesfile(d_level *, char **, char *) NONNULLARG12; +extern void commit_bonesfile(d_level *) NONNULLARG1; +extern NHFILE *open_bonesfile(d_level *, char **) NONNULLPTRS; +extern int delete_bonesfile(d_level *) NONNULLARG1; +extern void compress_bonesfile(void); +extern void set_savefile_name(boolean); #ifdef INSURANCE -E void FDECL(save_savefile_name, (int)); +extern void save_savefile_name(NHFILE *) NONNULLARG1; #endif #ifndef MICRO -E void NDECL(set_error_savefile); -#endif -E int NDECL(create_savefile); -E int NDECL(open_savefile); -E int NDECL(delete_savefile); -E int NDECL(restore_saved_game); -E void FDECL(nh_compress, (const char *)); -E void FDECL(nh_uncompress, (const char *)); -E boolean FDECL(lock_file, (const char *, int, int)); -E void FDECL(unlock_file, (const char *)); -#ifdef USER_SOUNDS -E boolean FDECL(can_read_file, (const char *)); -#endif -E void FDECL(config_error_init, (BOOLEAN_P, const char *, BOOLEAN_P)); -E void FDECL(config_erradd, (const char *)); -E int NDECL(config_error_done); -E boolean FDECL(read_config_file, (const char *, int)); -E void FDECL(check_recordfile, (const char *)); -E void NDECL(read_wizkit); -E int FDECL(read_sym_file, (int)); -E int FDECL(parse_sym_line, (char *, int)); -E void FDECL(paniclog, (const char *, const char *)); -E void FDECL(testinglog, (const char *, const char *, const char *)); -E int FDECL(validate_prefix_locations, (char *)); +extern void set_error_savefile(void); +#endif +extern NHFILE *create_savefile(void); +extern NHFILE *open_savefile(void); +extern int delete_savefile(void); +extern NHFILE *get_freeing_nhfile(void); +extern NHFILE *restore_saved_game(void); +extern int check_panic_save(void); #ifdef SELECTSAVED -E char *FDECL(plname_from_file, (const char *)); -#endif -E char **NDECL(get_saved_games); -E void FDECL(free_saved_games, (char **)); +extern char *plname_from_file(const char *, boolean) NONNULLARG1; +#endif +extern char **get_saved_games(void); +extern void free_saved_games(char **); +extern void nh_compress(const char *); +extern void nh_uncompress(const char *); +extern void nh_sfconvert(const char *); +extern void nh_sfunconvert(const char *); +extern int delete_convertedfile(const char *); +extern void free_convert_filenames(void); +extern boolean lock_file(const char *, int, int) NONNULLARG1; +extern void unlock_file(const char *) NONNULLARG1; +extern void check_recordfile(const char *); +extern void read_wizkit(void); +extern int read_sym_file(int); +extern void paniclog(const char *, const char *) NONNULLPTRS; +extern void testinglog(const char *, const char *, const char *); +extern int validate_prefix_locations(char *); #ifdef SELF_RECOVER -E boolean NDECL(recover_savefile); +extern boolean recover_savefile(void); +extern void assure_syscf_file(void); #endif #ifdef SYSCF_FILE -E void NDECL(assure_syscf_file); -#endif -E int FDECL(nhclose, (int)); -#ifdef HOLD_LOCKFILE_OPEN -E void NDECL(really_close); +extern void assure_syscf_file(void); #endif +extern int nhclose(int); #ifdef DEBUG -E boolean FDECL(debugcore, (const char *, BOOLEAN_P)); -#endif -E void NDECL(reveal_paths); -E boolean FDECL(read_tribute, (const char *, const char *, int, - char *, int, unsigned)); -E boolean FDECL(Death_quote, (char *, int)); +extern boolean debugcore(const char *, boolean); +#endif +extern void reveal_paths(int); +extern boolean read_tribute(const char *, const char *, int, char *, int, + unsigned); +extern boolean Death_quote(char *, int) NONNULLARG1; +extern void livelog_add(long ll_type, const char *) NONNULLARG2; +ATTRNORETURN extern void do_deferred_showpaths(int) NORETURN; +extern boolean contains_directory(const char *); +extern void get_nhuuid(void); +extern void free_nhuuid(void); /* ### fountain.c ### */ -E void FDECL(floating_above, (const char *)); -E void FDECL(dogushforth, (int)); -#ifdef USE_TRAMPOLI -E void FDECL(gush, (int, int, genericptr_t)); -#endif -E void FDECL(dryup, (XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void NDECL(drinkfountain); -E void FDECL(dipfountain, (struct obj *)); -E void FDECL(breaksink, (int, int)); -E void NDECL(drinksink); +extern void floating_above(const char *) NONNULLARG1; +extern void dogushforth(int); +extern void dryup(coordxy, coordxy, boolean); +extern void drinkfountain(void); +extern void dipfountain(struct obj *) NONNULLARG1; +extern int wash_hands(void); +extern void breaksink(coordxy, coordxy); +extern void drinksink(void); +extern void dipsink(struct obj *) NONNULLARG1; +extern void sink_backs_up(coordxy, coordxy); + +/* ### getpos.c ### */ + +extern char *dxdy_to_dist_descr(coordxy, coordxy, boolean); +extern char *coord_desc(coordxy, coordxy, char *, char) NONNULLARG3; +extern void auto_describe(coordxy, coordxy); +extern boolean getpos_menu(coord *, int) NONNULLARG1; +extern int getpos(coord *, boolean, const char *) NONNULLARG1; +extern void getpos_sethilite(void(*f)(boolean), boolean(*d)(coordxy,coordxy)); +extern boolean mapxy_valid(coordxy, coordxy); +extern boolean gather_locs_interesting(coordxy, coordxy, int); + +/* ### glyphs.c ### */ + +extern int glyphrep_to_custom_map_entries(const char *op, + int *glyph) NONNULLPTRS; +extern int add_custom_urep_entry(const char *symset_name, int glyphidx, + uint32 utf32ch, const uint8 *utf8str, + enum graphics_sets which_set) NONNULLARG1; +extern int add_custom_nhcolor_entry(const char *customization_name, + int glyphidx, uint32 nhcolor, + enum graphics_sets which_set) NONNULLARG1; +struct customization_detail *find_matching_customization( + const char *customization_name, + enum customization_types custtype, + enum graphics_sets which_set); +int set_map_customcolor(glyph_map *gm, uint32 nhcolor) NONNULLARG1; +extern int unicode_val(const char *); +extern int glyphrep(const char *) NONNULLARG1; +extern int match_glyph(char *) NONNULLARG1; +extern void dump_all_glyphids(FILE *fp) NONNULLARG1; +extern void wizcustom_glyphids(winid win); +extern void fill_glyphid_cache(void); +extern void free_glyphid_cache(void); +extern boolean glyphid_cache_status(void); +extern void apply_customizations(enum graphics_sets which_set, + enum do_customizations docustomize); +extern void purge_custom_entries(enum graphics_sets which_set); +extern void purge_all_custom_entries(void); +extern void dump_glyphids(void); +extern void clear_all_glyphmap_colors(void); +extern void reset_customcolors(void); +extern int glyph_to_cmap(int); +extern void maybe_shuffle_customizations(void); /* ### hack.c ### */ -E boolean FDECL(is_valid_travelpt, (int,int)); -E anything *FDECL(uint_to_any, (unsigned)); -E anything *FDECL(long_to_any, (long)); -E anything *FDECL(monst_to_any, (struct monst *)); -E anything *FDECL(obj_to_any, (struct obj *)); -E boolean FDECL(revive_nasty, (int, int, const char *)); -E void FDECL(movobj, (struct obj *, XCHAR_P, XCHAR_P)); -E boolean FDECL(may_dig, (XCHAR_P, XCHAR_P)); -E boolean FDECL(may_passwall, (XCHAR_P, XCHAR_P)); -E boolean FDECL(bad_rock, (struct permonst *, XCHAR_P, XCHAR_P)); -E int FDECL(cant_squeeze_thru, (struct monst *)); -E boolean FDECL(invocation_pos, (XCHAR_P, XCHAR_P)); -E boolean FDECL(test_move, (int, int, int, int, int)); +extern boolean is_valid_travelpt(coordxy, coordxy); +extern anything *uint_to_any(unsigned); +extern anything *long_to_any(long); +extern anything *monst_to_any(struct monst *) NONNULLARG1; +extern anything *obj_to_any(struct obj *) NONNULLARG1; +extern boolean revive_nasty(coordxy, coordxy, const char *); +extern int still_chewing(coordxy, coordxy); +extern void movobj(struct obj *, coordxy, coordxy); +extern boolean may_dig(coordxy, coordxy); +extern boolean may_passwall(coordxy, coordxy); +extern boolean bad_rock(struct permonst *, coordxy, coordxy) NONNULLARG1; +extern int cant_squeeze_thru(struct monst *) NONNULLARG1; +extern boolean invocation_pos(coordxy, coordxy); +extern boolean test_move(coordxy, coordxy, coordxy, coordxy, int); #ifdef DEBUG -E int NDECL(wiz_debug_cmd_traveldisplay); -#endif -E boolean NDECL(u_rooted); -E void NDECL(domove); -E boolean NDECL(overexertion); -E void NDECL(invocation_message); -E void NDECL(switch_terrain); -E boolean FDECL(pooleffects, (BOOLEAN_P)); -E void FDECL(spoteffects, (BOOLEAN_P)); -E char *FDECL(in_rooms, (XCHAR_P, XCHAR_P, int)); -E boolean FDECL(in_town, (int, int)); -E void FDECL(check_special_room, (BOOLEAN_P)); -E int NDECL(dopickup); -E void NDECL(lookaround); -E boolean FDECL(crawl_destination, (int, int)); -E int NDECL(monster_nearby); -E void FDECL(nomul, (int)); -E void FDECL(unmul, (const char *)); -E void FDECL(losehp, (int, const char *, BOOLEAN_P)); -E int NDECL(weight_cap); -E int NDECL(inv_weight); -E int NDECL(near_capacity); -E int FDECL(calc_capacity, (int)); -E int NDECL(max_capacity); -E boolean FDECL(check_capacity, (const char *)); -E int FDECL(inv_cnt, (BOOLEAN_P)); -E long FDECL(money_cnt, (struct obj *)); - -/* ### hacklib.c ### */ - -E boolean FDECL(digit, (CHAR_P)); -E boolean FDECL(letter, (CHAR_P)); -E char FDECL(highc, (CHAR_P)); -E char FDECL(lowc, (CHAR_P)); -E char *FDECL(lcase, (char *)); -E char *FDECL(ucase, (char *)); -E char *FDECL(upstart, (char *)); -E char *FDECL(mungspaces, (char *)); -E char *FDECL(trimspaces, (char *)); -E char *FDECL(strip_newline, (char *)); -E char *FDECL(stripchars, (char *, const char *, const char *)); -E char *FDECL(eos, (char *)); -E boolean FDECL(str_end_is, (const char *, const char *)); -E char *FDECL(strkitten, (char *, CHAR_P)); -E void FDECL(copynchars, (char *, const char *, int)); -E char FDECL(chrcasecpy, (int, int)); -E char *FDECL(strcasecpy, (char *, const char *)); -E char *FDECL(s_suffix, (const char *)); -E char *FDECL(ing_suffix, (const char *)); -E char *FDECL(xcrypt, (const char *, char *)); -E boolean FDECL(onlyspace, (const char *)); -E char *FDECL(tabexpand, (char *)); -E char *FDECL(visctrl, (CHAR_P)); -E char *FDECL(strsubst, (char *, const char *, const char *)); -E int FDECL(strNsubst, (char *, const char *, const char *, int)); -E const char *FDECL(ordin, (int)); -E char *FDECL(sitoa, (int)); -E int FDECL(sgn, (int)); -E int FDECL(rounddiv, (long, int)); -E int FDECL(dist2, (int, int, int, int)); -E int FDECL(isqrt, (int)); -E int FDECL(distmin, (int, int, int, int)); -E boolean FDECL(online2, (int, int, int, int)); -E boolean FDECL(pmatch, (const char *, const char *)); -E boolean FDECL(pmatchi, (const char *, const char *)); -E boolean FDECL(pmatchz, (const char *, const char *)); -#ifndef STRNCMPI -E int FDECL(strncmpi, (const char *, const char *, int)); -#endif -#ifndef STRSTRI -E char *FDECL(strstri, (const char *, const char *)); -#endif -E boolean -FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P)); -E void FDECL(init_random, (int FDECL((*fn), (int)))); -E void FDECL(reseed_random, (int FDECL((*fn), (int)))); -E time_t NDECL(getnow); -E int NDECL(getyear); -#if 0 -E char *FDECL(yymmdd, (time_t)); -#endif -E long FDECL(yyyymmdd, (time_t)); -E long FDECL(hhmmss, (time_t)); -E char *FDECL(yyyymmddhhmmss, (time_t)); -E time_t FDECL(time_from_yyyymmddhhmmss, (char *)); -E int NDECL(phase_of_the_moon); -E boolean NDECL(friday_13th); -E int NDECL(night); -E int NDECL(midnight); -E void FDECL(strbuf_init, (strbuf_t *)); -E void FDECL(strbuf_append, (strbuf_t *, const char *)); -E void FDECL(strbuf_reserve, (strbuf_t *, int)); -E void FDECL(strbuf_empty, (strbuf_t *)); -E void FDECL(strbuf_nl_to_crlf, (strbuf_t *)); +extern int wiz_debug_cmd_traveldisplay(void); +#endif +extern boolean u_rooted(void); +extern void notice_mon(struct monst *) NONNULLARG1; +extern void notice_all_mons(boolean); +extern void impact_disturbs_zombies(struct obj *, boolean) NONNULLARG1; +extern void disturb_buried_zombies(coordxy, coordxy); +extern boolean u_maybe_impaired(void); +extern const char *u_locomotion(const char *) NONNULLARG1; +extern boolean handle_tip(int); +extern void domove(void); +extern void runmode_delay_output(void); +extern void overexert_hp(void); +extern boolean overexertion(void); +extern void invocation_message(void); +extern void classify_terrain(void); +extern void switch_terrain(void); +extern void set_uinwater(int); +extern boolean pooleffects(boolean); +extern void spoteffects(boolean); +extern char *in_rooms(coordxy, coordxy, int); +extern boolean in_town(coordxy, coordxy); +extern void check_special_room(boolean); +extern int dopickup(void); +extern void lookaround(void); +extern boolean doorless_door(coordxy, coordxy); +extern boolean crawl_destination(coordxy, coordxy); +extern int monster_nearby(void); +extern void end_running(boolean); +extern void nomul(int); +extern void unmul(const char *); +extern void showdamage(int); +extern void losehp(int, const char *, schar) ; +extern int weight_cap(void); +extern int inv_weight(void); +extern int near_capacity(void); +extern int calc_capacity(int); +extern int max_capacity(void); +extern boolean check_capacity(const char *); +extern void dump_weights(void); +extern int inv_cnt(boolean); +/* sometimes money_cnt(gi.invent) which can be null */ +extern long money_cnt(struct obj *) NO_NNARGS; +extern void spot_checks(coordxy, coordxy, schar); +extern int rounddiv(long, int); + +/* ### strutil.c ### */ + +extern void strbuf_init(strbuf_t *) NONNULLARG1; +extern void strbuf_append(strbuf_t *, const char *) NONNULLPTRS; +extern void strbuf_reserve(strbuf_t *, int) NONNULLARG1; +extern void strbuf_empty(strbuf_t *) NONNULLARG1; +extern void strbuf_nl_to_crlf(strbuf_t *) NONNULLARG1; +extern unsigned Strlen_(const char *, const char *, int) NONNULLPTRS; +extern boolean pmatch(const char *, const char *) NONNULLPTRS; +extern boolean pmatchi(const char *, const char *) NONNULLPTRS; +/* +extern boolean pmatchz(const char *, const char *) NONNULLPTRS; +*/ + +/* ### iactions.c ### */ + +extern int itemactions(struct obj *otmp) NONNULLARG1; + +/* ### insight.c ### */ + +extern int doattributes(void); +extern void enlightenment(int, int); +extern void youhiding(boolean, int); +extern char *trap_predicament(char *, int, boolean) NONNULLARG1; +extern int doconduct(void); +extern void show_conduct(int); +extern void record_achievement(schar); +extern boolean remove_achievement(schar); +extern int count_achievements(void); +extern schar achieve_rank(int); +extern boolean sokoban_in_play(void); +extern int do_gamelog(void); +extern void show_gamelog(int); +extern int set_vanq_order(boolean); +extern int dovanquished(void); +extern int doborn(void); +extern void list_vanquished(char, boolean); +extern int num_genocides(void); +extern void list_genocided(char, boolean); +extern int dogenocided(void); +extern const char *align_str(aligntyp); +extern char *piousness(boolean, const char *); +extern void mstatusline(struct monst *) NONNULLARG1; +extern void ustatusline(void); /* ### invent.c ### */ -E Loot *FDECL(sortloot, (struct obj **, unsigned, BOOLEAN_P, - boolean (*)(OBJ_P))); -E void FDECL(unsortloot, (Loot **)); -E void FDECL(assigninvlet, (struct obj *)); -E struct obj *FDECL(merge_choice, (struct obj *, struct obj *)); -E int FDECL(merged, (struct obj **, struct obj **)); -#ifdef USE_TRAMPOLI -E int FDECL(ckunpaid, (struct obj *)); -#endif -E void FDECL(addinv_core1, (struct obj *)); -E void FDECL(addinv_core2, (struct obj *)); -E struct obj *FDECL(addinv, (struct obj *)); -E struct obj *FDECL(hold_another_object, - (struct obj *, const char *, const char *, const char *)); -E void FDECL(useupall, (struct obj *)); -E void FDECL(useup, (struct obj *)); -E void FDECL(consume_obj_charge, (struct obj *, BOOLEAN_P)); -E void FDECL(freeinv_core, (struct obj *)); -E void FDECL(freeinv, (struct obj *)); -E void FDECL(delallobj, (int, int)); -E void FDECL(delobj, (struct obj *)); -E struct obj *FDECL(sobj_at, (int, int, int)); -E struct obj *FDECL(nxtobj, (struct obj *, int, BOOLEAN_P)); -E struct obj *FDECL(carrying, (int)); -E boolean NDECL(have_lizard); -E struct obj *NDECL(u_have_novel); -E struct obj *FDECL(o_on, (unsigned int, struct obj *)); -E boolean FDECL(obj_here, (struct obj *, int, int)); -E boolean NDECL(wearing_armor); -E boolean FDECL(is_worn, (struct obj *)); -E struct obj *FDECL(g_at, (int, int)); -E boolean FDECL(splittable, (struct obj *)); -E struct obj *FDECL(getobj, (const char *, const char *)); -E int FDECL(ggetobj, (const char *, int (*)(OBJ_P), int, - BOOLEAN_P, unsigned *)); -E int FDECL(askchain, (struct obj **, const char *, int, int (*)(OBJ_P), - int (*)(OBJ_P), int, const char *)); -E void FDECL(fully_identify_obj, (struct obj *)); -E int FDECL(identify, (struct obj *)); -E int FDECL(count_unidentified, (struct obj *)); -E void FDECL(identify_pack, (int, BOOLEAN_P)); -E void NDECL(learn_unseen_invent); -E void NDECL(update_inventory); -E void FDECL(prinv, (const char *, struct obj *, long)); -E char *FDECL(xprname, - (struct obj *, const char *, CHAR_P, BOOLEAN_P, long, long)); -E int NDECL(ddoinv); -E char FDECL(display_inventory, (const char *, BOOLEAN_P)); -E int FDECL(display_binventory, (int, int, BOOLEAN_P)); -E struct obj *FDECL(display_cinventory, (struct obj *)); -E struct obj *FDECL(display_minventory, (struct monst *, int, char *)); -E int NDECL(dotypeinv); -E const char *FDECL(dfeature_at, (int, int, char *)); -E int FDECL(look_here, (int, BOOLEAN_P)); -E int NDECL(dolook); -E boolean FDECL(will_feel_cockatrice, (struct obj *, BOOLEAN_P)); -E void FDECL(feel_cockatrice, (struct obj *, BOOLEAN_P)); -E void FDECL(stackobj, (struct obj *)); -E boolean FDECL(mergable, (struct obj *, struct obj *)); -E int NDECL(doprgold); -E int NDECL(doprwep); -E int NDECL(doprarm); -E int NDECL(doprring); -E int NDECL(dopramulet); -E int NDECL(doprtool); -E int NDECL(doprinuse); -E void FDECL(useupf, (struct obj *, long)); -E char *FDECL(let_to_name, (CHAR_P, BOOLEAN_P, BOOLEAN_P)); -E void NDECL(free_invbuf); -E void NDECL(reassign); -E int NDECL(doorganize); -E void NDECL(free_pickinv_cache); -E int FDECL(count_unpaid, (struct obj *)); -E int FDECL(count_buc, (struct obj *, int, boolean (*)(OBJ_P))); -E void FDECL(tally_BUCX, (struct obj *, BOOLEAN_P, - int *, int *, int *, int *, int *)); -E long FDECL(count_contents, (struct obj *, - BOOLEAN_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(carry_obj_effects, (struct obj *)); -E const char *FDECL(currency, (long)); -E void FDECL(silly_thing, (const char *, struct obj *)); +extern void loot_classify(Loot *, struct obj *) NONNULLPTRS; +extern Loot *sortloot(struct obj **, unsigned, boolean, + boolean(*)(struct obj *)) NONNULLARG1; +extern void unsortloot(Loot **) NONNULLARG1; +extern void assigninvlet(struct obj *) NONNULLARG1; +extern struct obj *merge_choice(struct obj *, struct obj *) NONNULLARG2; +extern int merged(struct obj **, struct obj **) NONNULLPTRS; +extern void addinv_core1(struct obj *) NONNULLARG1; +extern void addinv_core2(struct obj *) NONNULLARG1; +extern struct obj *addinv(struct obj *) NONNULLARG1; +extern struct obj *addinv_before(struct obj *, struct obj *) NONNULLARG1; +extern struct obj *addinv_nomerge(struct obj *) NONNULLARG1; +extern struct obj *hold_another_object(struct obj *, const char *, + const char *, const char *) NONNULLARG1; +/* nhlua.c calls useupall(gi.invent), but checks gi.invent against NULL + * before doing so. useupall() won't handle NULL*/ +extern void useupall(struct obj *) NONNULLARG1; +extern void useup(struct obj *) NONNULLARG1; +extern void consume_obj_charge(struct obj *, boolean) NONNULLARG1; +extern void freeinv_core(struct obj *) NONNULLARG1; +extern void freeinv(struct obj *) NONNULLARG1; +extern void delallobj(coordxy, coordxy); +extern void delobj(struct obj *) NONNULLARG1; +extern void delobj_core(struct obj *, boolean) NONNULLARG1; +extern struct obj *sobj_at(int, coordxy, coordxy); +extern struct obj *nxtobj(struct obj *, int, boolean) NONNULLARG1; +extern struct obj *carrying(int); +extern struct obj *u_carried_gloves(void); +extern struct obj *u_have_novel(void); +extern struct obj *o_on(unsigned int, struct obj *); +extern boolean obj_here(struct obj *, coordxy, coordxy) NONNULLARG1; +extern boolean wearing_armor(void); +extern boolean is_worn(struct obj *) NONNULLARG1; +extern boolean is_inuse(struct obj *) NONNULLARG1; +extern struct obj *g_at(coordxy, coordxy); +extern boolean splittable(struct obj *) NONNULLARG1; +extern int any_obj_ok(struct obj *); +extern struct obj *getobj(const char *, int(*)(struct obj *), unsigned int); +extern int ggetobj(const char *, int(*)(struct obj *), int, boolean, + unsigned *) NONNULLARG1; +extern int askchain(struct obj **, const char *, int, int(*)(struct obj *), + int(*)(struct obj *), int, const char *) NONNULLARG17; +extern void set_cknown_lknown(struct obj *) NONNULLARG1; +extern void fully_identify_obj(struct obj *) NONNULLARG1; +extern int identify(struct obj *) NONNULLARG1; +extern int count_unidentified(struct obj *) NO_NNARGS; +extern void identify_pack(int, boolean); +extern void learn_unseen_invent(void); +extern void update_inventory(void); +extern int doperminv(void); +extern void prinv(const char *, struct obj *, long) NONNULLARG2; +extern char *xprname(struct obj *, const char *, char, boolean, long, long); +extern int ddoinv(void); +extern char display_inventory(const char *, boolean); +extern int display_binventory(coordxy, coordxy, boolean); +extern struct obj *display_cinventory(struct obj *) NONNULLARG1; +extern struct obj *display_minventory(struct monst *, int, char *) NONNULLARG1; +extern int dotypeinv(void); +extern const char *dfeature_at(coordxy, coordxy, char *) NONNULLARG3; +extern int look_here(int, unsigned); +extern int dolook(void); +extern boolean will_feel_cockatrice(struct obj *, boolean) NONNULLARG1; +extern void feel_cockatrice(struct obj *, boolean) NONNULLARG1; +extern void stackobj(struct obj *) NONNULLARG1; +extern boolean mergable(struct obj *, struct obj *) NONNULLPTRS; +extern int doprgold(void); +extern int doprwep(void); +extern int doprarm(void); +extern int doprring(void); +extern int dopramulet(void); +extern int doprtool(void); +extern int doprinuse(void); +extern void useupf(struct obj *, long) NONNULLARG1; +extern char *let_to_name(char, boolean, boolean); +extern void free_invbuf(void); +extern void reassign(void); +extern boolean check_invent_gold(const char *) NONNULLARG1; +extern int doorganize(void); +extern int adjust_split(void); +extern void free_pickinv_cache(void); +/* sometimes count_unpaid(gi.invent) which can be null */ +extern int count_unpaid(struct obj *) NO_NNARGS; +extern int count_buc(struct obj *, int, boolean(*)(struct obj *)); +extern void tally_BUCX(struct obj *, boolean, int *, int *, int *, int *, + int *, int *); +extern long count_contents(struct obj *, boolean, + boolean, boolean, boolean) NONNULLARG1; +extern void carry_obj_effects(struct obj *) NONNULLARG1; +extern const char *currency(long); +extern void silly_thing(const char *, struct obj *) NONNULLARG1; +extern void sync_perminvent(void); +extern void perm_invent_toggled(boolean negated); +extern void prepare_perminvent(winid window); +extern struct obj *carrying_stoning_corpse(void); +extern void repopulate_perminvent(void); /* ### ioctl.c ### */ #if defined(UNIX) || defined(__BEOS__) -E void NDECL(getwindowsz); -E void NDECL(getioctls); -E void NDECL(setioctls); +extern void getwindowsz(void); +extern void getioctls(void); +extern void setioctls(void); #ifdef SUSPEND -E int NDECL(dosuspend); +extern int dosuspend(void); #endif /* SUSPEND */ #endif /* UNIX || __BEOS__ */ /* ### light.c ### */ -E void FDECL(new_light_source, (XCHAR_P, XCHAR_P, int, int, ANY_P *)); -E void FDECL(del_light_source, (int, ANY_P *)); -E void FDECL(do_light_sources, (char **)); -E void FDECL(show_transient_light, (struct obj *, int, int)); -E void NDECL(transient_light_cleanup); -E struct monst *FDECL(find_mid, (unsigned, unsigned)); -E void FDECL(save_light_sources, (int, int, int)); -E void FDECL(restore_light_sources, (int)); -E void FDECL(light_stats, (const char *, char *, long *, long *)); -E void FDECL(relink_light_sources, (BOOLEAN_P)); -E void NDECL(light_sources_sanity_check); -E void FDECL(obj_move_light_source, (struct obj *, struct obj *)); -E boolean NDECL(any_light_source); -E void FDECL(snuff_light_source, (int, int)); -E boolean FDECL(obj_sheds_light, (struct obj *)); -E boolean FDECL(obj_is_burning, (struct obj *)); -E void FDECL(obj_split_light_source, (struct obj *, struct obj *)); -E void FDECL(obj_merge_light_sources, (struct obj *, struct obj *)); -E void FDECL(obj_adjust_light_radius, (struct obj *, int)); -E int FDECL(candle_light_range, (struct obj *)); -E int FDECL(arti_light_radius, (struct obj *)); -E const char *FDECL(arti_light_description, (struct obj *)); -E int NDECL(wiz_light_sources); +extern void new_light_source(coordxy, coordxy, + int, int, union any *) NONNULLPTRS; +extern void del_light_source(int, union any *) NONNULLARG2; +extern void do_light_sources(seenV **) NONNULLARG1; +extern void show_transient_light(struct obj *, coordxy, coordxy); +extern void transient_light_cleanup(void); +extern struct monst *find_mid(unsigned, unsigned); +extern void save_light_sources(NHFILE *, int); +extern void restore_light_sources(NHFILE *) NONNULLARG1; +extern void light_stats(const char *, char *, long *, long *) NONNULLPTRS; +extern void relink_light_sources(boolean); +extern void light_sources_sanity_check(void); +extern void obj_move_light_source(struct obj *, struct obj *) NONNULLARG12; +extern boolean any_light_source(void); +extern void snuff_light_source(coordxy, coordxy); +extern boolean obj_sheds_light(struct obj *) NONNULLARG1; +extern boolean obj_is_burning(struct obj *) NONNULLARG1; +extern void obj_split_light_source(struct obj *, struct obj *) NONNULLARG12; +extern void obj_merge_light_sources(struct obj *, struct obj *) NONNULLARG12; +extern void obj_adjust_light_radius(struct obj *, int) NONNULLARG1; +extern int candle_light_range(struct obj *) NONNULLARG1; +extern int arti_light_radius(struct obj *) NONNULLARG1; +extern const char *arti_light_description(struct obj *) NONNULLARG1; +extern int wiz_light_sources(void); /* ### lock.c ### */ -#ifdef USE_TRAMPOLI -E int NDECL(forcelock); -E int NDECL(picklock); -#endif -E boolean FDECL(picking_lock, (int *, int *)); -E boolean FDECL(picking_at, (int, int)); -E void FDECL(breakchestlock, (struct obj *, BOOLEAN_P)); -E void NDECL(reset_pick); -E void FDECL(maybe_reset_pick, (struct obj *)); -E int FDECL(pick_lock, (struct obj *)); -E int NDECL(doforce); -E boolean FDECL(boxlock, (struct obj *, struct obj *)); -E boolean FDECL(doorlock, (struct obj *, int, int)); -E int NDECL(doopen); -E boolean FDECL(stumble_on_door_mimic, (int, int)); -E int FDECL(doopen_indir, (int, int)); -E int NDECL(doclose); - -#ifdef MAC -/* These declarations are here because the main code calls them. */ - +extern boolean picking_lock(coordxy *, coordxy *); +extern boolean picking_at(coordxy, coordxy); +extern void breakchestlock(struct obj *, boolean) NONNULLARG1; +extern void reset_pick(void); +extern void maybe_reset_pick(struct obj *); +extern struct obj *autokey(boolean); +extern int pick_lock(struct obj *, coordxy, coordxy, struct obj *); +extern boolean u_have_forceable_weapon(void); +extern int doforce(void); +extern boolean boxlock(struct obj *, struct obj *) NONNULLARG12; +extern boolean doorlock(struct obj *, coordxy, coordxy) NONNULLARG1; +extern int doopen(void); +extern boolean stumble_on_door_mimic(coordxy, coordxy); +extern int doopen_indir(coordxy, coordxy); +extern int doclose(void); + +#ifdef MACOS9 +/* outdated functions removed */ /* ### macfile.c ### */ - -E int FDECL(maccreat, (const char *, long)); -E int FDECL(macopen, (const char *, int, long)); -E int FDECL(macclose, (int)); -E int FDECL(macread, (int, void *, unsigned)); -E int FDECL(macwrite, (int, void *, unsigned)); -E long FDECL(macseek, (int, long, short)); -E int FDECL(macunlink, (const char *)); - /* ### macmain.c ### */ - -E boolean NDECL(authorize_wizard_mode); - -/* ### macsnd.c ### */ - -E void FDECL(mac_speaker, (struct obj *, char *)); - /* ### macunix.c ### */ - -E void FDECL(regularize, (char *)); -E void NDECL(getlock); - /* ### macwin.c ### */ - -E void FDECL(lock_mouse_cursor, (Boolean)); -E int NDECL(SanePositions); - /* ### mttymain.c ### */ - -E void FDECL(getreturn, (char *)); -E void VDECL(msmsg, (const char *, ...)); -E void NDECL(gettty); -E void NDECL(setftty); -E void FDECL(settty, (const char *)); -E int NDECL(tgetch); -E void FDECL(cmov, (int x, int y)); -E void FDECL(nocmov, (int x, int y)); - -#endif /* MAC */ +#endif /* ### mail.c ### */ #ifdef MAIL #ifdef UNIX -E void NDECL(free_maildata); -E void NDECL(getmailstatus); -E void NDECL(ck_server_admin_msg); +extern void free_maildata(void); +extern void getmailstatus(void); +extern void ck_server_admin_msg(void); #endif -E void NDECL(ckmailstatus); -E void FDECL(readmail, (struct obj *)); +extern void ckmailstatus(void); +extern void readmail(struct obj *); #endif /* MAIL */ /* ### makemon.c ### */ -E void FDECL(dealloc_monst, (struct monst *)); -E boolean FDECL(is_home_elemental, (struct permonst *)); -E struct monst *FDECL(clone_mon, (struct monst *, XCHAR_P, XCHAR_P)); -E int FDECL(monhp_per_lvl, (struct monst *)); -E void FDECL(newmonhp, (struct monst *, int)); -E struct mextra *NDECL(newmextra); -E void FDECL(copy_mextra, (struct monst *, struct monst *)); -E void FDECL(dealloc_mextra, (struct monst *)); -E struct monst *FDECL(makemon, (struct permonst *, int, int, int)); -E boolean FDECL(create_critters, (int, struct permonst *, BOOLEAN_P)); -E struct permonst *NDECL(rndmonst); -E void FDECL(reset_rndmonst, (int)); -E struct permonst *FDECL(mkclass, (CHAR_P, int)); -E struct permonst *FDECL(mkclass_aligned, (CHAR_P, int, ALIGNTYP_P)); -E int FDECL(mkclass_poly, (int)); -E int FDECL(adj_lev, (struct permonst *)); -E struct permonst *FDECL(grow_up, (struct monst *, struct monst *)); -E int FDECL(mongets, (struct monst *, int)); -E int FDECL(golemhp, (int)); -E boolean FDECL(peace_minded, (struct permonst *)); -E void FDECL(set_malign, (struct monst *)); -E void FDECL(newmcorpsenm, (struct monst *)); -E void FDECL(freemcorpsenm, (struct monst *)); -E void FDECL(set_mimic_sym, (struct monst *)); -E int FDECL(mbirth_limit, (int)); -E void FDECL(mimic_hit_msg, (struct monst *, SHORT_P)); -E void FDECL(mkmonmoney, (struct monst *, long)); -E int FDECL(bagotricks, (struct obj *, BOOLEAN_P, int *)); -E boolean FDECL(propagate, (int, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(usmellmon, (struct permonst *)); - -/* ### mapglyph.c ### */ - -E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int, unsigned)); -E char *FDECL(encglyph, (int)); -E char *FDECL(decode_mixed, (char *, const char *)); -E void FDECL(genl_putmixed, (winid, int, const char *)); +extern boolean is_home_elemental(struct permonst *) NONNULLARG1; +extern struct monst *clone_mon(struct monst *, coordxy, coordxy) NONNULLARG1; +extern int monhp_per_lvl(struct monst *) NONNULLARG1; +extern void newmonhp(struct monst *, int) NONNULLARG1; +extern struct mextra *newmextra(void) NONNULL; +extern struct monst *makemon(struct permonst *, coordxy, coordxy, mmflags_nht); +extern struct monst *unmakemon(struct monst *, mmflags_nht) NONNULLARG1; +extern boolean create_critters(int, struct permonst *, boolean); +extern struct permonst *rndmonst_adj(int, int); +extern struct permonst *rndmonst(void); +extern struct permonst *mkclass(char, int); +extern struct permonst *mkclass_aligned(char, int, aligntyp); +extern int mkclass_poly(int); +extern int adj_lev(struct permonst *) NONNULLARG1; +extern struct permonst *grow_up(struct monst *, struct monst *) NONNULLARG1; +extern struct obj* mongets(struct monst *, int) NONNULLARG1; +extern int golemhp(int); +extern boolean peace_minded(struct permonst *) NONNULLARG1; +extern void set_malign(struct monst *) NONNULLARG1; +extern void newmcorpsenm(struct monst *) NONNULLARG1; +extern void freemcorpsenm(struct monst *) NONNULLARG1; +extern void set_mimic_sym(struct monst *) NO_NNARGS; /* tests for NULL mtmp */ +extern int mbirth_limit(int); +extern void mkmonmoney(struct monst *, long) NONNULLARG1; +extern int bagotricks(struct obj *, boolean, int *); +extern boolean propagate(int, boolean, boolean); +extern void summon_furies(int); +extern void dump_mongen(void); /* ### mcastu.c ### */ -E int FDECL(castmu, (struct monst *, struct attack *, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(buzzmu, (struct monst *, struct attack *)); +extern int castmu(struct monst *, struct attack *, + boolean, boolean) NONNULLARG12; +extern void touch_of_death(struct monst *) NONNULLARG1; +extern char *death_inflicted_by(char *, const char *, + struct monst *) NONNULLARG12; +extern int buzzmu(struct monst *, struct attack *) NONNULLARG12; + +/* ### mdlib.c ### */ + +extern void runtime_info_init(void); +extern const char *do_runtime_info(int *) NO_NNARGS; +extern void release_runtime_info(void); +extern char *mdlib_version_string(char *, const char *) NONNULL NONNULLPTRS; /* ### mhitm.c ### */ -E int FDECL(fightm, (struct monst *)); -E int FDECL(mattackm, (struct monst *, struct monst *)); -E boolean FDECL(engulf_target, (struct monst *, struct monst *)); -E int FDECL(mdisplacem, (struct monst *, struct monst *, BOOLEAN_P)); -E void FDECL(paralyze_monst, (struct monst *, int)); -E int FDECL(sleep_monst, (struct monst *, int, int)); -E void FDECL(slept_monst, (struct monst *)); -E void FDECL(xdrainenergym, (struct monst *, BOOLEAN_P)); -E long FDECL(attk_protection, (int)); -E void FDECL(rustm, (struct monst *, struct obj *)); +extern int fightm(struct monst *) NONNULLARG1; +extern int mdisplacem(struct monst *, struct monst *, boolean); +extern int mattackm(struct monst *, struct monst *); +extern boolean failed_grab(struct monst *, struct monst *, + struct attack *) NONNULLPTRS; +extern boolean engulf_target(struct monst *, struct monst *) NONNULLARG12; +extern int mon_poly(struct monst *, struct monst *, int) NONNULLARG12; +extern void paralyze_monst(struct monst *, int) NONNULLARG1; +extern int sleep_monst(struct monst *, int, int) NONNULLARG1; +extern void slept_monst(struct monst *) NONNULLARG1; +extern void xdrainenergym(struct monst *, boolean) NONNULLARG1; +extern long attk_protection(int); +extern void rustm(struct monst *, struct obj *); /* ### mhitu.c ### */ -E const char *FDECL(mpoisons_subj, (struct monst *, struct attack *)); -E void NDECL(u_slow_down); -E struct monst *NDECL(cloneu); -E void FDECL(expels, (struct monst *, struct permonst *, BOOLEAN_P)); -E struct attack *FDECL(getmattk, (struct monst *, struct monst *, - int, int *, struct attack *)); -E int FDECL(mattacku, (struct monst *)); -E int FDECL(magic_negation, (struct monst *)); -E boolean NDECL(gulp_blnd_check); -E int FDECL(gazemu, (struct monst *, struct attack *)); -E void FDECL(mdamageu, (struct monst *, int)); -E int FDECL(could_seduce, (struct monst *, struct monst *, struct attack *)); -E int FDECL(doseduce, (struct monst *)); +extern void hitmsg(struct monst *, struct attack *) NONNULLARG12; +extern const char *mswings_verb(struct obj *, boolean) NONNULLARG1; +extern const char *mpoisons_subj(struct monst *, struct attack *) NONNULLARG12; +extern void u_slow_down(void); +extern struct monst *cloneu(void); +extern void expels(struct monst *, struct permonst *, boolean) NONNULLARG12; +extern struct attack *getmattk(struct monst *, struct monst *, int, int *, + struct attack *) NONNULLARG12; +extern boolean mtrapped_in_pit(struct monst *) NONNULLARG1; +extern int mattacku(struct monst *) NONNULLARG1; +boolean diseasemu(struct permonst *) NONNULLARG1; +boolean u_slip_free(struct monst *, struct attack *) NONNULLARG12; +extern int magic_negation(struct monst *) NONNULLARG1; +extern boolean gulp_blnd_check(void); +extern int gazemu(struct monst *, struct attack *) NONNULLARG12; +extern void mdamageu(struct monst *, int) NONNULLARG1; +extern int could_seduce(struct monst *, struct monst *, struct attack *) NONNULLARG12; +extern int doseduce(struct monst *) NONNULLARG1; +extern boolean mon_avoiding_this_attack(struct monst *, int) NONNULLARG1; +/* extern boolean ranged_attk_assessed(struct monst *mtmp, + boolean (*assessfunct)(struct monst *, int)) NONNULLARG1; +*/ +extern boolean ranged_attk_available(struct monst *mtmp) NONNULLARG1; /* ### minion.c ### */ -E void FDECL(newemin, (struct monst *)); -E void FDECL(free_emin, (struct monst *)); -E int FDECL(monster_census, (BOOLEAN_P)); -E int FDECL(msummon, (struct monst *)); -E void FDECL(summon_minion, (ALIGNTYP_P, BOOLEAN_P)); -E int FDECL(demon_talk, (struct monst *)); -E long FDECL(bribe, (struct monst *)); -E int FDECL(dprince, (ALIGNTYP_P)); -E int FDECL(dlord, (ALIGNTYP_P)); -E int NDECL(llord); -E int FDECL(ndemon, (ALIGNTYP_P)); -E int NDECL(lminion); -E void FDECL(lose_guardian_angel, (struct monst *)); -E void NDECL(gain_guardian_angel); +extern void newemin(struct monst *) NONNULLARG1; +extern void free_emin(struct monst *) NONNULLARG1; +extern int monster_census(boolean); +extern int msummon(struct monst *); +extern void summon_minion(aligntyp, boolean); +extern int demon_talk(struct monst *) NONNULLARG1; +extern long bribe(struct monst *, const char *) NONNULLARG12; +extern int dprince(aligntyp); +extern int dlord(aligntyp); +extern int llord(void); +extern int ndemon(aligntyp); +extern int lminion(void); +extern void lose_guardian_angel(struct monst *); +extern void gain_guardian_angel(void); /* ### mklev.c ### */ -#ifdef USE_TRAMPOLI -E int FDECL(do_comp, (genericptr_t, genericptr_t)); -#endif -E void NDECL(sort_rooms); -E void FDECL(add_room, (int, int, int, int, BOOLEAN_P, SCHAR_P, BOOLEAN_P)); -E void FDECL(add_subroom, (struct mkroom *, int, int, int, int, BOOLEAN_P, - SCHAR_P, BOOLEAN_P)); -E void NDECL(makecorridors); -E void FDECL(add_door, (int, int, struct mkroom *)); -E void NDECL(mklev); +extern void sort_rooms(void); +extern void add_room(coordxy, coordxy, coordxy, coordxy, + boolean, schar, boolean); +extern void add_subroom(struct mkroom *, + coordxy, coordxy, coordxy, coordxy, + boolean, schar, boolean) NONNULLARG1; +extern void free_luathemes(enum lua_theme_group); +extern void makecorridors(void); +extern void add_door(coordxy, coordxy, struct mkroom *) NONNULLARG3; +extern void count_level_features(void); +extern void clear_level_structures(void); +extern void level_finalize_topology(void); +extern void mklev(void); #ifdef SPECIALIZATION -E void FDECL(topologize, (struct mkroom *, BOOLEAN_P)); +extern void topologize(struct mkroom *, boolean) NONNULLARG1; #else -E void FDECL(topologize, (struct mkroom *)); -#endif -E void FDECL(place_branch, (branch *, XCHAR_P, XCHAR_P)); -E boolean FDECL(occupied, (XCHAR_P, XCHAR_P)); -E int FDECL(okdoor, (XCHAR_P, XCHAR_P)); -E void FDECL(dodoor, (int, int, struct mkroom *)); -E void FDECL(mktrap, (int, int, struct mkroom *, coord *)); -E void FDECL(mkstairs, (XCHAR_P, XCHAR_P, CHAR_P, struct mkroom *)); -E void NDECL(mkinvokearea); -E void FDECL(mineralize, (int, int, int, int, BOOLEAN_P)); +extern void topologize(struct mkroom *) NONNULLARG1; +#endif +/* place_branch() has tests for NULL branch arg, preventing NONNULLARG1 */ +extern void place_branch(branch *, coordxy, coordxy) NO_NNARGS; +extern boolean occupied(coordxy, coordxy); +extern int okdoor(coordxy, coordxy); +extern boolean maybe_sdoor(int); +extern void dodoor(coordxy, coordxy, struct mkroom *) NONNULLARG3; +extern void mktrap(int, unsigned, struct mkroom *, coord *) NO_NNARGS; +extern void mkstairs(coordxy, coordxy, char, struct mkroom *, boolean); +extern void mkinvokearea(void); +extern void mineralize(int, int, int, int, boolean); /* ### mkmap.c ### */ -E void FDECL(flood_fill_rm, (int, int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(remove_rooms, (int, int, int, int)); -/* E void FDECL(mkmap, (lev_init *)); -- need sp_lev.h for lev_init */ +extern void flood_fill_rm(coordxy, coordxy, int, boolean, boolean); +extern void remove_rooms(coordxy, coordxy, coordxy, coordxy); +extern boolean litstate_rnd(int); /* ### mkmaze.c ### */ -E void FDECL(wallification, (int, int, int, int)); -E void FDECL(fix_wall_spines, (int, int, int, int)); -E void FDECL(walkfrom, (int, int, SCHAR_P)); -E void FDECL(makemaz, (const char *)); -E void FDECL(mazexy, (coord *)); -E void NDECL(bound_digging); -E void FDECL(mkportal, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(bad_location, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P)); -E void FDECL(place_lregion, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, d_level *)); -E void NDECL(fixup_special); -E void NDECL(fumaroles); -E void NDECL(movebubbles); -E void NDECL(water_friction); -E void FDECL(save_waterlevel, (int, int)); -E void FDECL(restore_waterlevel, (int)); -E const char *FDECL(waterbody_name, (XCHAR_P, XCHAR_P)); +extern boolean set_levltyp(coordxy, coordxy, schar); +extern boolean set_levltyp_lit(coordxy, coordxy, schar, schar); +extern void create_maze(int, int, boolean); +extern void wallification(coordxy, coordxy, coordxy, coordxy); +extern void fix_wall_spines(coordxy, coordxy, coordxy, coordxy); +extern void walkfrom(coordxy, coordxy, schar); +extern void pick_vibrasquare_location(void); +extern void makemaz(const char *) NONNULLARG1; +extern void mazexy(coord *) NONNULLARG1; +extern void get_level_extends(coordxy *, coordxy *, coordxy *, coordxy *) NONNULLPTRS; +extern void bound_digging(void); +extern void mkportal(coordxy, coordxy, xint16, xint16); +extern boolean bad_location(coordxy, coordxy, coordxy, coordxy, coordxy, + coordxy); +extern boolean is_exclusion_zone(xint16, coordxy, coordxy); +/* dungeon.c u_on_rndspot() passes NULL final arg to place_lregion() */ +extern void place_lregion(coordxy, coordxy, coordxy, coordxy, coordxy, + coordxy, coordxy, coordxy, xint16, d_level *) NO_NNARGS; +extern void fixup_special(void); +extern void fumaroles(void); +extern void movebubbles(void); +extern void water_friction(void); +extern void save_waterlevel(NHFILE *) NONNULLARG1; +extern void restore_waterlevel(NHFILE *) NONNULLARG1; +extern void maybe_adjust_hero_bubble(void); /* ### mkobj.c ### */ -E struct oextra *NDECL(newoextra); -E void FDECL(copy_oextra, (struct obj *, struct obj *)); -E void FDECL(dealloc_oextra, (struct obj *)); -E void FDECL(newomonst, (struct obj *)); -E void FDECL(free_omonst, (struct obj *)); -E void FDECL(newomid, (struct obj *)); -E void FDECL(free_omid, (struct obj *)); -E void FDECL(newolong, (struct obj *)); -E void FDECL(free_olong, (struct obj *)); -E void FDECL(new_omailcmd, (struct obj *, const char *)); -E void FDECL(free_omailcmd, (struct obj *)); -E struct obj *FDECL(mkobj_at, (CHAR_P, int, int, BOOLEAN_P)); -E struct obj *FDECL(mksobj_at, (int, int, int, BOOLEAN_P, BOOLEAN_P)); -E struct obj *FDECL(mksobj_migr_to_species, (int, unsigned, BOOLEAN_P, BOOLEAN_P)); -E struct obj *FDECL(mkobj, (CHAR_P, BOOLEAN_P)); -E int NDECL(rndmonnum); -E boolean FDECL(bogon_is_pname, (CHAR_P)); -E struct obj *FDECL(splitobj, (struct obj *, long)); -E struct obj *FDECL(unsplitobj, (struct obj *)); -E void NDECL(clear_splitobjs); -E void FDECL(replace_object, (struct obj *, struct obj *)); -E struct obj *FDECL(unknwn_contnr_contents, (struct obj *)); -E void FDECL(bill_dummy_object, (struct obj *)); -E void FDECL(costly_alteration, (struct obj *, int)); -E struct obj *FDECL(mksobj, (int, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(bcsign, (struct obj *)); -E int FDECL(weight, (struct obj *)); -E struct obj *FDECL(mkgold, (long, int, int)); -E struct obj *FDECL(mkcorpstat, (int, struct monst *, struct permonst *, int, - int, unsigned)); -E int FDECL(corpse_revive_type, (struct obj *)); -E struct obj *FDECL(obj_attach_mid, (struct obj *, unsigned)); -E struct monst *FDECL(get_mtraits, (struct obj *, BOOLEAN_P)); -E struct obj *FDECL(mk_tt_object, (int, int, int)); -E struct obj *FDECL(mk_named_object, - (int, struct permonst *, int, int, const char *)); -E struct obj *FDECL(rnd_treefruit_at, (int, int)); -E void FDECL(set_corpsenm, (struct obj *, int)); -E void FDECL(start_corpse_timeout, (struct obj *)); -E void FDECL(bless, (struct obj *)); -E void FDECL(unbless, (struct obj *)); -E void FDECL(curse, (struct obj *)); -E void FDECL(uncurse, (struct obj *)); -E void FDECL(blessorcurse, (struct obj *, int)); -E void FDECL(set_bknown, (struct obj *, unsigned)); -E boolean FDECL(is_flammable, (struct obj *)); -E boolean FDECL(is_rottable, (struct obj *)); -E void FDECL(place_object, (struct obj *, int, int)); -E void FDECL(remove_object, (struct obj *)); -E void FDECL(discard_minvent, (struct monst *)); -E void FDECL(obj_extract_self, (struct obj *)); -E void FDECL(extract_nobj, (struct obj *, struct obj **)); -E void FDECL(extract_nexthere, (struct obj *, struct obj **)); -E int FDECL(add_to_minv, (struct monst *, struct obj *)); -E struct obj *FDECL(add_to_container, (struct obj *, struct obj *)); -E void FDECL(add_to_migration, (struct obj *)); -E void FDECL(add_to_buried, (struct obj *)); -E void FDECL(dealloc_obj, (struct obj *)); -E void FDECL(obj_ice_effects, (int, int, BOOLEAN_P)); -E long FDECL(peek_at_iced_corpse_age, (struct obj *)); -E int FDECL(hornoplenty, (struct obj *, BOOLEAN_P)); -E void NDECL(obj_sanity_check); -E struct obj *FDECL(obj_nexto, (struct obj *)); -E struct obj *FDECL(obj_nexto_xy, (struct obj *, int, int, BOOLEAN_P)); -E struct obj *FDECL(obj_absorb, (struct obj **, struct obj **)); -E struct obj *FDECL(obj_meld, (struct obj **, struct obj **)); -E void FDECL(pudding_merge_message, (struct obj *, struct obj *)); -E struct obj *FDECL(init_dummyobj, (struct obj *, SHORT_P, long)); +extern struct oextra *newoextra(void) NONNULL; +extern void copy_oextra(struct obj *, struct obj *); +extern void dealloc_oextra(struct obj *) NONNULLARG1; +extern void newomonst(struct obj *) NONNULLARG1; +extern void free_omonst(struct obj *) NONNULLARG1; +extern void newomid(struct obj *) NONNULLARG1; +extern void free_omid(struct obj *) NONNULLARG1; +/* +extern void newolong(struct obj *); +extern void free_olong(struct obj *); +*/ +extern void new_omailcmd(struct obj *, const char *) NONNULLPTRS; +extern void free_omailcmd(struct obj *) NONNULLARG1; +extern struct obj *mkobj_at(char, coordxy, coordxy, boolean); +extern struct obj *mksobj_at(int, coordxy, coordxy, boolean, boolean); +extern struct obj *mksobj_migr_to_species(int, unsigned, boolean, boolean); +extern struct obj *mkobj(int, boolean) NONNULL; +extern int rndmonnum_adj(int, int); +extern int rndmonnum(void); +extern boolean bogon_is_pname(char); +extern struct obj *splitobj(struct obj *, long) NONNULLARG1; +extern unsigned next_ident(void); +extern struct obj *unsplitobj(struct obj *) NONNULLARG1; +extern void clear_splitobjs(void); +extern void replace_object(struct obj *, struct obj *) NONNULLARG12; +extern struct obj *unknwn_contnr_contents(struct obj *) NONNULLARG1; +extern void bill_dummy_object(struct obj *) NONNULLARG1; +extern void costly_alteration(struct obj *, int) NONNULLARG1; +extern void clear_dknown(struct obj *); +extern void unknow_object(struct obj *); +extern struct obj *mksobj(int, boolean, boolean) NONNULL; +extern boolean stone_object_type(unsigned); +extern boolean stone_furniture_type(unsigned); +extern int bcsign(struct obj *) NONNULLARG1; +extern int weight(struct obj *) NONNULLARG1; +extern struct obj *mkgold(long, coordxy, coordxy); +extern void fixup_oil(struct obj *, struct obj *) NONNULLARG1; +extern struct obj *mkcorpstat(int, struct monst *, struct permonst *, + coordxy, coordxy, unsigned) NONNULL; +extern int corpse_revive_type(struct obj *) NONNULLARG1; +extern struct obj *obj_attach_mid(struct obj *, unsigned); +extern struct monst *get_mtraits(struct obj *, boolean) NONNULLARG1; +extern struct obj *mk_tt_object(int, coordxy, coordxy); +extern struct obj *mk_named_object(int, struct permonst *, + coordxy, coordxy, + const char *) ; +extern struct obj *rnd_treefruit_at(coordxy, coordxy); +extern boolean is_treefruit(struct obj *) NONNULLARG1; +extern void set_corpsenm(struct obj *, int) NONNULLARG1; +extern long rider_revival_time(struct obj *, boolean) NONNULLARG1; +extern void start_corpse_timeout(struct obj *) NONNULLARG1; +extern void start_glob_timeout(struct obj *, long) NONNULLARG1; +extern void shrink_glob(anything *, long) NONNULLARG1; +extern void maybe_adjust_light(struct obj *, int) NONNULLARG1; +extern void bless(struct obj *) NONNULLARG1; +extern void unbless(struct obj *) NONNULLARG1; +extern void curse(struct obj *) NONNULLARG1; +extern void uncurse(struct obj *) NONNULLARG1; +extern void blessorcurse(struct obj *, int) NONNULLARG1; +extern void set_bknown(struct obj *, unsigned) NONNULLARG1; +extern boolean is_flammable(struct obj *) NONNULLARG1; +extern boolean is_rottable(struct obj *) NONNULLARG1; +extern void place_object(struct obj *, coordxy, coordxy) NONNULLARG1; +extern void recreate_pile_at(coordxy, coordxy); +extern void remove_object(struct obj *) NONNULLARG1; +extern void discard_minvent(struct monst *, boolean) NONNULLARG1; +extern void obj_extract_self(struct obj *) NONNULLARG1; +extern void extract_nobj(struct obj *, struct obj **) NONNULLARG12; +extern void extract_nexthere(struct obj *, struct obj **) NONNULLARG12; +extern int add_to_minv(struct monst *, struct obj *) NONNULLARG12; +extern struct obj *add_to_container(struct obj *, struct obj *) NONNULLARG12; +extern void add_to_migration(struct obj *) NONNULLARG1; +extern void add_to_buried(struct obj *) NONNULLARG1; +extern void container_weight(struct obj *) NONNULLARG1; +extern void dealloc_obj(struct obj *) NONNULLARG1; +extern void obj_ice_effects(coordxy, coordxy, boolean); +extern long peek_at_iced_corpse_age(struct obj *) NONNULLARG1; +extern void dobjsfree(void); +extern int hornoplenty(struct obj *, boolean, struct obj *); +extern void obj_sanity_check(void); +extern struct obj *obj_nexto(struct obj *); +extern struct obj *obj_nexto_xy(struct obj *, coordxy, coordxy, boolean) NONNULLARG1; +extern struct obj *obj_absorb(struct obj **, struct obj **); +extern struct obj *obj_meld(struct obj **, struct obj **); +extern void pudding_merge_message(struct obj *, struct obj *) NONNULLARG12; +extern struct obj *init_dummyobj(struct obj *, short, long); /* ### mkroom.c ### */ -E void FDECL(mkroom, (int)); -E void FDECL(fill_zoo, (struct mkroom *)); -E struct permonst *NDECL(antholemon); -E boolean FDECL(nexttodoor, (int, int)); -E boolean FDECL(has_dnstairs, (struct mkroom *)); -E boolean FDECL(has_upstairs, (struct mkroom *)); -E int FDECL(somex, (struct mkroom *)); -E int FDECL(somey, (struct mkroom *)); -E boolean FDECL(inside_room, (struct mkroom *, XCHAR_P, XCHAR_P)); -E boolean FDECL(somexy, (struct mkroom *, coord *)); -E void FDECL(mkundead, (coord *, BOOLEAN_P, int)); -E struct permonst *NDECL(courtmon); -E void FDECL(save_rooms, (int)); -E void FDECL(rest_rooms, (int)); -E struct mkroom *FDECL(search_special, (SCHAR_P)); -E int FDECL(cmap_to_type, (int)); +extern void do_mkroom(int); +extern void fill_zoo(struct mkroom *) NONNULLARG1; +extern struct permonst *antholemon(void); +extern boolean nexttodoor(int, int); +extern boolean has_dnstairs(struct mkroom *) NONNULLARG1; +extern boolean has_upstairs(struct mkroom *) NONNULLARG1; +extern int somex(struct mkroom *) NONNULLARG1; +extern int somey(struct mkroom *) NONNULLARG1; +extern boolean inside_room(struct mkroom *, coordxy, coordxy) NONNULLARG1; +extern boolean somexy(struct mkroom *, coord *) NONNULLARG12; +extern boolean somexyspace(struct mkroom *, coord *) NONNULLARG12; +extern void mkundead(coord *, boolean, int) NONNULLARG1; +extern struct permonst *courtmon(void); +extern void save_rooms(NHFILE *) NONNULLARG1; +extern void rest_rooms(NHFILE *) NONNULLARG1; +extern struct mkroom *search_special(schar); +extern int cmap_to_type(int); /* ### mon.c ### */ -E void NDECL(mon_sanity_check); -E int FDECL(undead_to_corpse, (int)); -E int FDECL(genus, (int, int)); -E int FDECL(pm_to_cham, (int)); -E int FDECL(minliquid, (struct monst *)); -E int NDECL(movemon); -E int FDECL(meatmetal, (struct monst *)); -E int FDECL(meatobj, (struct monst *)); -E void FDECL(mpickgold, (struct monst *)); -E boolean FDECL(mpickstuff, (struct monst *, const char *)); -E int FDECL(curr_mon_load, (struct monst *)); -E int FDECL(max_mon_load, (struct monst *)); -E int FDECL(can_carry, (struct monst *, struct obj *)); -E int FDECL(mfndpos, (struct monst *, coord *, long *, long)); -E boolean FDECL(monnear, (struct monst *, int, int)); -E void NDECL(dmonsfree); -E void FDECL(elemental_clog, (struct monst *)); -E int FDECL(mcalcmove, (struct monst *)); -E void NDECL(mcalcdistress); -E void FDECL(replmon, (struct monst *, struct monst *)); -E void FDECL(relmon, (struct monst *, struct monst **)); -E struct obj *FDECL(mlifesaver, (struct monst *)); -E boolean FDECL(corpse_chance, (struct monst *, struct monst *, BOOLEAN_P)); -E void FDECL(mondead, (struct monst *)); -E void FDECL(mondied, (struct monst *)); -E void FDECL(mongone, (struct monst *)); -E void FDECL(monstone, (struct monst *)); -E void FDECL(monkilled, (struct monst *, const char *, int)); -E void FDECL(unstuck, (struct monst *)); -E void FDECL(killed, (struct monst *)); -E void FDECL(xkilled, (struct monst *, int)); -E void FDECL(mon_to_stone, (struct monst *)); -E void FDECL(m_into_limbo, (struct monst *)); -E void FDECL(mnexto, (struct monst *)); -E void FDECL(maybe_mnexto, (struct monst *)); -E int FDECL(mnearto, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(m_respond, (struct monst *)); -E void FDECL(setmangry, (struct monst *, BOOLEAN_P)); -E void FDECL(wakeup, (struct monst *, BOOLEAN_P)); -E void NDECL(wake_nearby); -E void FDECL(wake_nearto, (int, int, int)); -E void FDECL(seemimic, (struct monst *)); -E void NDECL(rescham); -E void NDECL(restartcham); -E void FDECL(restore_cham, (struct monst *)); -E boolean FDECL(hideunder, (struct monst *)); -E void FDECL(hide_monst, (struct monst *)); -E void FDECL(mon_animal_list, (BOOLEAN_P)); -E boolean FDECL(validvamp, (struct monst *, int *, int)); -E int FDECL(select_newcham_form, (struct monst *)); -E void FDECL(mgender_from_permonst, (struct monst *, struct permonst *)); -E int FDECL(newcham, - (struct monst *, struct permonst *, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(can_be_hatched, (int)); -E int FDECL(egg_type_from_parent, (int, BOOLEAN_P)); -E boolean FDECL(dead_species, (int, BOOLEAN_P)); -E void NDECL(kill_genocided_monsters); -E void FDECL(golemeffects, (struct monst *, int, int)); -E boolean FDECL(angry_guards, (BOOLEAN_P)); -E void NDECL(pacify_guards); -E void FDECL(decide_to_shapeshift, (struct monst *, int)); -E boolean FDECL(vamp_stone, (struct monst *)); +extern void dealloc_monst(struct monst *) NONNULLARG1; +extern void copy_mextra(struct monst *, struct monst *); +extern void dealloc_mextra(struct monst *) NONNULLARG1; +extern void mon_sanity_check(void); +extern boolean zombie_maker(struct monst *) NONNULLARG1; +extern int zombie_form(struct permonst *) NONNULLARG1; +extern int m_poisongas_ok(struct monst *) NONNULLARG1; +extern int undead_to_corpse(int); +extern int genus(int, int); +extern int pm_to_cham(int); +extern int minliquid(struct monst *) NONNULLARG1; +extern boolean movemon_singlemon(struct monst *) NONNULLARG1; +extern int movemon(void); +extern void meatbox(struct monst *, struct obj *) NONNULLPTRS; +extern void m_consume_obj(struct monst *, struct obj *) NONNULLPTRS; +extern int meatmetal(struct monst *) NONNULLARG1; +extern int meatobj(struct monst *) NONNULLARG1; +extern int meatcorpse(struct monst *) NONNULLARG1; +extern void mon_give_prop(struct monst *, int) NONNULLARG1; +extern void mon_givit(struct monst *, struct permonst *) NONNULLARG12; +extern void mpickgold(struct monst *) NONNULLARG1; +extern boolean mpickstuff(struct monst *) NONNULLARG1; +extern int curr_mon_load(struct monst *) NONNULLARG1; +extern int max_mon_load(struct monst *) NONNULLARG1; +extern boolean can_touch_safely(struct monst *, struct obj *) NONNULLARG12; +extern int can_carry(struct monst *, struct obj *) NONNULLARG12; +extern long mon_allowflags(struct monst *) NONNULLARG1; +extern boolean m_in_air(struct monst *) NONNULLARG1; +extern int mfndpos(struct monst *, struct mfndposdata *, long) NONNULLPTRS; +extern boolean monnear(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void dmonsfree(void); +extern void elemental_clog(struct monst *) NONNULLARG1; +extern int mcalcmove(struct monst *, boolean) NONNULLARG1; +extern void mcalcdistress(void); +extern void replmon(struct monst *, struct monst *) NONNULLARG12; +extern void relmon(struct monst *, struct monst **) NONNULLARG1; +extern struct obj *mlifesaver(struct monst *) NONNULLARG1; +extern boolean corpse_chance(struct monst *, struct monst *, boolean) NONNULLARG1; +extern void mondead(struct monst *) NONNULLARG1; +extern void mondied(struct monst *) NONNULLARG1; +extern void mongone(struct monst *) NONNULLARG1; +extern void monstone(struct monst *) NONNULLARG1; +extern void monkilled(struct monst *, const char *, int) NONNULLARG1; +extern void set_ustuck(struct monst *); +extern void unstuck(struct monst *) NONNULLARG1; +extern void killed(struct monst *) NONNULLARG1; +extern void xkilled(struct monst *, int) NONNULLARG1; +extern void mon_to_stone(struct monst *) NONNULLARG1; +extern void m_into_limbo(struct monst *) NONNULLARG1; +extern void migrate_mon(struct monst *, xint16, xint16) NONNULLARG1; +extern void mnexto(struct monst *, unsigned) NONNULLARG1; +extern void deal_with_overcrowding(struct monst *) NONNULLARG1; +extern void maybe_mnexto(struct monst *) NONNULLARG1; +extern int mnearto(struct monst *, coordxy, coordxy, boolean, unsigned) NONNULLARG1; +extern void m_respond(struct monst *) NONNULLARG1; +extern void setmangry(struct monst *, boolean) NONNULLARG1; +extern void wake_msg(struct monst *, boolean) NONNULLARG1; +extern void wakeup(struct monst *, boolean) NONNULLARG1; +extern void wake_nearby(boolean); +extern void wake_nearto(coordxy, coordxy, int); +extern void seemimic(struct monst *) NONNULLARG1; +extern void normal_shape(struct monst *) NONNULLARG1; +extern void alloc_itermonarr(unsigned); +extern void iter_mons_safe(boolean (*)(struct monst *)); +extern void iter_mons(void (*)(struct monst *)); +extern struct monst *get_iter_mons(boolean (*)(struct monst *)); +extern struct monst *get_iter_mons_xy(boolean (*)(struct monst *, + coordxy, coordxy), + coordxy, coordxy); +extern int healmon(struct monst *, int, int) NONNULLARG1; +extern void rescham(void); +extern void restartcham(void); +extern void restore_cham(struct monst *) NONNULLARG1; +extern void maybe_unhide_at(coordxy, coordxy); +extern boolean hideunder(struct monst *) NONNULLARG1; +extern void hide_monst(struct monst *) NONNULLARG1; +extern void mon_animal_list(boolean); +extern boolean valid_vampshiftform(int, int); +extern boolean validvamp(struct monst *, int *, int) NONNULLARG12; +extern int select_newcham_form(struct monst *) NONNULLARG1; +extern void mgender_from_permonst(struct monst *, struct permonst *) NONNULLARG12; +extern int newcham(struct monst *, struct permonst *, unsigned) NONNULLARG1; +extern int can_be_hatched(int); +extern int egg_type_from_parent(int, boolean); +extern boolean dead_species(int, boolean); +extern void kill_genocided_monsters(void); +extern void golemeffects(struct monst *, int, int); +extern boolean angry_guards(boolean); +extern void pacify_guards(void); +extern void decide_to_shapeshift(struct monst *) NONNULLARG1; +extern boolean vamp_stone(struct monst *) NONNULLARG1; +extern void check_gear_next_turn(struct monst *) NONNULLARG1; +extern void copy_mextra(struct monst *, struct monst *); +extern void dealloc_mextra(struct monst *); +extern boolean usmellmon(struct permonst *); +extern void mimic_hit_msg(struct monst *, short); +extern void adj_erinys(unsigned); +extern void see_monster_closeup(struct monst *, boolean) NONNULLARG1; +extern void see_nearby_monsters(void); +extern void shieldeff_mon(struct monst *) NONNULLARG1; +extern void flash_mon(struct monst *) NONNULLARG1; /* ### mondata.c ### */ -E void FDECL(set_mon_data, (struct monst *, struct permonst *)); -E struct attack *FDECL(attacktype_fordmg, (struct permonst *, int, int)); -E boolean FDECL(attacktype, (struct permonst *, int)); -E boolean FDECL(noattacks, (struct permonst *)); -E boolean FDECL(poly_when_stoned, (struct permonst *)); -E boolean FDECL(resists_drli, (struct monst *)); -E boolean FDECL(resists_magm, (struct monst *)); -E boolean FDECL(resists_blnd, (struct monst *)); -E boolean -FDECL(can_blnd, (struct monst *, struct monst *, UCHAR_P, struct obj *)); -E boolean FDECL(ranged_attk, (struct permonst *)); -E boolean FDECL(hates_silver, (struct permonst *)); -E boolean FDECL(mon_hates_silver, (struct monst *)); -E boolean FDECL(mon_hates_light, (struct monst *)); -E boolean FDECL(passes_bars, (struct permonst *)); -E boolean FDECL(can_blow, (struct monst *)); -E boolean FDECL(can_chant, (struct monst *)); -E boolean FDECL(can_be_strangled, (struct monst *)); -E boolean FDECL(can_track, (struct permonst *)); -E boolean FDECL(breakarm, (struct permonst *)); -E boolean FDECL(sliparm, (struct permonst *)); -E boolean FDECL(sticks, (struct permonst *)); -E boolean FDECL(cantvomit, (struct permonst *)); -E int FDECL(num_horns, (struct permonst *)); -/* E boolean FDECL(canseemon, (struct monst *)); */ -E struct attack *FDECL(dmgtype_fromattack, (struct permonst *, int, int)); -E boolean FDECL(dmgtype, (struct permonst *, int)); -E int FDECL(max_passive_dmg, (struct monst *, struct monst *)); -E boolean FDECL(same_race, (struct permonst *, struct permonst *)); -E int FDECL(monsndx, (struct permonst *)); -E int FDECL(name_to_mon, (const char *)); -E int FDECL(name_to_monclass, (const char *, int *)); -E int FDECL(gender, (struct monst *)); -E int FDECL(pronoun_gender, (struct monst *, BOOLEAN_P)); -E boolean FDECL(levl_follower, (struct monst *)); -E int FDECL(little_to_big, (int)); -E int FDECL(big_to_little, (int)); -E boolean FDECL(big_little_match, (int, int)); -E const char *FDECL(locomotion, (const struct permonst *, const char *)); -E const char *FDECL(stagger, (const struct permonst *, const char *)); -E const char *FDECL(on_fire, (struct permonst *, struct attack *)); -E const struct permonst *FDECL(raceptr, (struct monst *)); -E boolean FDECL(olfaction, (struct permonst *)); +extern void set_mon_data(struct monst *, struct permonst *) NONNULLARG12; +extern struct attack *attacktype_fordmg(struct permonst *, int, int) NONNULLARG1; +extern boolean attacktype(struct permonst *, int) NONNULLARG1; +extern boolean noattacks(struct permonst *) NONNULLARG1; +extern boolean poly_when_stoned(struct permonst *) NONNULLARG1; +extern boolean defended(struct monst *, int) NONNULLARG1; +extern boolean Resists_Elem(struct monst *, int) NONNULLARG1; +extern boolean resists_drli(struct monst *) NONNULLARG1; +extern boolean resists_magm(struct monst *) NONNULLARG1; +extern boolean resists_blnd(struct monst *) NONNULLARG1; +extern boolean resists_blnd_by_arti(struct monst *) NONNULLARG1; +extern boolean can_blnd(struct monst *, struct monst *, + uchar, struct obj *) NONNULLARG2; +extern boolean ranged_attk(struct permonst *) NONNULLARG1; +extern boolean mon_hates_silver(struct monst *) NONNULLARG1; +extern boolean hates_silver(struct permonst *) NONNULLARG1; +extern boolean mon_hates_blessings(struct monst *) NONNULLARG1; +extern boolean hates_blessings(struct permonst *) NONNULLARG1; +extern boolean mon_hates_light(struct monst *) NONNULLARG1; +extern boolean passes_bars(struct permonst *) NONNULLARG1; +extern boolean can_blow(struct monst *) NONNULLARG1; +extern boolean can_chant(struct monst *) NONNULLARG1; +extern boolean can_be_strangled(struct monst *) NONNULLARG1; +extern boolean can_track(struct permonst *) NONNULLARG1; +extern boolean breakarm(struct permonst *) NONNULLARG1; +extern boolean sliparm(struct permonst *) NONNULLARG1; +extern boolean sticks(struct permonst *) NONNULLARG1; +extern boolean cantvomit(struct permonst *) NONNULLARG1; +extern int num_horns(struct permonst *) NONNULLARG1; +extern struct attack *dmgtype_fromattack(struct permonst *, int, int) NONNULLARG1; +extern boolean dmgtype(struct permonst *, int) NONNULLARG1; +extern int max_passive_dmg(struct monst *, struct monst *) NONNULLARG12; +extern boolean same_race(struct permonst *, struct permonst *) NONNULLARG12; +extern int name_to_mon(const char *, int *) NONNULLARG1; +extern int name_to_monplus(const char *, const char **, int *) NONNULLARG1; +extern int name_to_monclass(const char *, int *); +extern int gender(struct monst *) NONNULLARG1; +extern int pronoun_gender(struct monst *, unsigned) NONNULLARG1; +extern boolean levl_follower(struct monst *) NONNULLARG1; +extern int little_to_big(int); +extern int big_to_little(int); +extern boolean big_little_match(int, int); +extern const char *locomotion(const struct permonst *, const char *) NONNULLARG12; +extern const char *stagger(const struct permonst *, const char *) NONNULLARG12; +extern const char *on_fire(struct permonst *, struct attack *) NONNULLARG12; +extern const char *msummon_environ(struct permonst *, const char **) NONNULLARG12; +extern const struct permonst *raceptr(struct monst *) NONNULLARG1; +extern boolean olfaction(struct permonst *) NONNULLARG1; +unsigned long cvt_adtyp_to_mseenres(uchar); +unsigned long cvt_prop_to_mseenres(uchar); +extern void monstseesu(unsigned long); +extern void monstunseesu(unsigned long); +extern void give_u_to_m_resistances(struct monst *) NONNULLARG1; +extern boolean resist_conflict(struct monst *) NONNULLARG1; +extern boolean mon_knows_traps(struct monst *, int) NONNULLARG1; +extern void mon_learns_traps(struct monst *, int) NONNULLARG1; +extern void mons_see_trap(struct trap *) NONNULLARG1; +extern int get_atkdam_type(int); +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) +extern int mstrength(struct permonst *) NONNULLARG1; +#endif /* ### monmove.c ### */ -E boolean FDECL(itsstuck, (struct monst *)); -E boolean FDECL(mb_trapped, (struct monst *)); -E boolean FDECL(monhaskey, (struct monst *, BOOLEAN_P)); -E void FDECL(mon_regen, (struct monst *, BOOLEAN_P)); -E int FDECL(dochugw, (struct monst *)); -E boolean FDECL(onscary, (int, int, struct monst *)); -E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(mon_yells, (struct monst *, const char *)); -E int FDECL(dochug, (struct monst *)); -E boolean FDECL(m_digweapon_check, (struct monst *, XCHAR_P, XCHAR_P)); -E int FDECL(m_move, (struct monst *, int)); -E void FDECL(dissolve_bars, (int, int)); -E boolean FDECL(closed_door, (int, int)); -E boolean FDECL(accessible, (int, int)); -E void FDECL(set_apparxy, (struct monst *)); -E boolean FDECL(can_ooze, (struct monst *)); -E boolean FDECL(can_fog, (struct monst *)); -E boolean FDECL(should_displace, - (struct monst *, coord *, long *, int, XCHAR_P, XCHAR_P)); -E boolean FDECL(undesirable_disp, (struct monst *, XCHAR_P, XCHAR_P)); +extern boolean mon_would_take_item(struct monst *, struct obj *) NONNULLARG12; +extern boolean mon_would_consume_item(struct monst *, struct obj *) NONNULLARG12; +extern boolean itsstuck(struct monst *) NONNULLARG1; +extern boolean mb_trapped(struct monst *, boolean) NONNULLARG1; +extern void mon_track_add(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void mon_track_clear(struct monst *) NONNULLARG1; +extern boolean monhaskey(struct monst *, boolean) NONNULLARG1; +extern void mon_regen(struct monst *, boolean) NONNULLARG1; +extern void m_everyturn_effect(struct monst *) NONNULLARG1; +extern void m_postmove_effect(struct monst *) NONNULLARG1; +extern int dochugw(struct monst *, boolean) NONNULLARG1; +extern boolean onscary(coordxy, coordxy, struct monst *) NONNULLARG3; +extern struct monst *find_pmmonst(int); +extern int bee_eat_jelly(struct monst *, struct obj *) NONNULLARG12; +extern void monflee(struct monst *, int, boolean, boolean) NONNULLARG1; +extern void mon_yells(struct monst *, const char *) NONNULLARG12; +extern boolean m_can_break_boulder(struct monst *) NONNULLARG1; +extern void m_break_boulder(struct monst *, coordxy, coordxy) NONNULLARG1; +extern int dochug(struct monst *) NONNULLARG1; +extern boolean m_digweapon_check(struct monst *, coordxy, coordxy) NONNULLARG1; +extern boolean m_avoid_kicked_loc(struct monst *, coordxy, coordxy) NONNULLARG1; +extern boolean m_avoid_soko_push_loc(struct monst *, coordxy, coordxy) NONNULLARG1; +extern int m_move(struct monst *, int) NONNULLARG1; +extern int m_move_aggress(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void dissolve_bars(coordxy, coordxy); +extern boolean closed_door(coordxy, coordxy); +extern boolean accessible(coordxy, coordxy); +extern void set_apparxy(struct monst *) NONNULLARG1; +extern boolean can_ooze(struct monst *) NONNULLARG1; +extern boolean can_fog(struct monst *) NONNULLARG1; +extern boolean should_displace(struct monst *, const struct mfndposdata *, + coordxy, coordxy) NONNULLPTRS; +extern boolean undesirable_disp(struct monst *, coordxy, coordxy) NONNULLARG1; +extern boolean can_hide_under_obj(struct obj *); /* ### monst.c ### */ -E void NDECL(monst_init); - -/* ### monstr.c ### */ - -E void NDECL(monstr_init); +extern void monst_globals_init(void); /* ### mplayer.c ### */ -E struct monst *FDECL(mk_mplayer, - (struct permonst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(create_mplayers, (int, BOOLEAN_P)); -E void FDECL(mplayer_talk, (struct monst *)); +extern struct monst *mk_mplayer(struct permonst *, + coordxy, coordxy, boolean) NONNULLARG1; +extern void create_mplayers(int, boolean); +extern void mplayer_talk(struct monst *) NONNULLARG1; #if defined(MICRO) || defined(WIN32) -/* ### msdos.c,os2.c,tos.c,winnt.c ### */ +/* ### msdos.c,os2.c,tos.c,windsys.c ### */ #ifndef WIN32 -E int NDECL(tgetch); +extern int tgetch(void); #endif #ifndef TOS -E char NDECL(switchar); +extern char switchar(void); #endif #ifndef __GO32__ -E long FDECL(freediskspace, (char *)); +extern long freediskspace(char *); #ifdef MSDOS -E int FDECL(findfirst_file, (char *)); -E int NDECL(findnext_file); -E long FDECL(filesize_nh, (char *)); +extern int findfirst_file(char *); +extern int findnext_file(void); +extern long filesize_nh(char *); #else -E int FDECL(findfirst, (char *)); -E int NDECL(findnext); -E long FDECL(filesize, (char *)); +extern int findfirst(char *); +extern int findnext(void); +extern long filesize(char *); #endif /* MSDOS */ -E char *NDECL(foundfile_buffer); +extern char *foundfile_buffer(void); #endif /* __GO32__ */ -E void FDECL(chdrive, (char *)); +extern void chdrive(const char *); #ifndef TOS -E void NDECL(disable_ctrlP); -E void NDECL(enable_ctrlP); +extern void disable_ctrlP(void); +extern void enable_ctrlP(void); #endif -#if defined(MICRO) && !defined(WINNT) -E void NDECL(get_scr_size); +#if defined(MICRO) && !defined(WIN32) +extern void get_scr_size(void); #ifndef TOS -E void FDECL(gotoxy, (int, int)); +extern void gotoxy(int, int); #endif #endif #ifdef TOS -E int FDECL(_copyfile, (char *, char *)); -E int NDECL(kbhit); -E void NDECL(set_colors); -E void NDECL(restore_colors); +extern int _copyfile(char *, char *); +extern int kbhit(void); +extern void set_colors(void); +extern void restore_colors(void); #ifdef SUSPEND -E int NDECL(dosuspend); +extern int dosuspend(void); #endif #endif /* TOS */ #ifdef WIN32 -E char *FDECL(get_username, (int *)); -E void FDECL(nt_regularize, (char *)); -E int NDECL((*nt_kbhit)); -E void FDECL(Delay, (int)); +extern void nt_regularize(char *); +extern int(*nt_kbhit)(void); +extern void Delay(int); +boolean get_user_home_folder(char *, size_t); +# ifdef CRASHREPORT +struct CRctxt; +extern struct CRctxt *ctxp; +extern int win32_cr_helper(char, struct CRctxt *, void *, int); +extern int win32_cr_gettrace(int, char *, int); +extern int *win32_cr_shellexecute(const char *); +# endif #endif /* WIN32 */ + #endif /* MICRO || WIN32 */ /* ### mthrowu.c ### */ -E int FDECL(thitu, (int, int, struct obj **, const char *)); -E int FDECL(ohitmon, (struct monst *, struct obj *, int, BOOLEAN_P)); -E void FDECL(thrwmu, (struct monst *)); -E int FDECL(spitmu, (struct monst *, struct attack *)); -E int FDECL(breamu, (struct monst *, struct attack *)); -E boolean FDECL(linedup, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, int)); -E boolean FDECL(lined_up, (struct monst *)); -E struct obj *FDECL(m_carrying, (struct monst *, int)); -E int FDECL(thrwmm, (struct monst *, struct monst *)); -E int FDECL(spitmm, (struct monst *, struct attack *, struct monst *)); -E int FDECL(breamm, (struct monst *, struct attack *, struct monst *)); -E void FDECL(m_useupall, (struct monst *, struct obj *)); -E void FDECL(m_useup, (struct monst *, struct obj *)); -E void FDECL(m_throw, (struct monst *, int, int, int, int, int, struct obj *)); -E void FDECL(hit_bars, (struct obj **, int, int, int, int, - BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(hits_bars, (struct obj **, int, int, int, int, int, int)); +extern const char *rnd_hallublast(void); +extern boolean m_has_launcher_and_ammo(struct monst *) NONNULLARG1; +extern int thitu(int, int, struct obj **, const char *) NO_NNARGS; +extern boolean ohitmon(struct monst *, struct obj *, + int, boolean) NONNULLARG12; +extern void thrwmu(struct monst *) NONNULLARG1; +extern int spitmu(struct monst *, struct attack *) NONNULLPTRS; +extern int breamu(struct monst *, struct attack *) NONNULLPTRS; +extern boolean linedup_callback(coordxy, coordxy, coordxy, coordxy, + boolean(*)(coordxy, coordxy)); +extern boolean linedup(coordxy, coordxy, coordxy, coordxy, int); +extern boolean lined_up(struct monst *) NONNULLARG1; +extern struct obj *m_carrying(struct monst *, int) NONNULLARG1; +extern int thrwmm(struct monst *, struct monst *) NONNULLARG12; +extern int spitmm(struct monst *, struct attack *, struct monst *) NONNULLPTRS; +extern int breamm(struct monst *, struct attack *, struct monst *) NONNULLPTRS; +extern void m_useupall(struct monst *, struct obj *) NONNULLARG12; +extern void m_useup(struct monst *, struct obj *) NONNULLARG12; +extern void m_throw(struct monst *, coordxy, coordxy, coordxy, coordxy, + int, struct obj *) NONNULLPTRS; +extern void hit_bars(struct obj **, coordxy, coordxy, coordxy, coordxy, + unsigned) NONNULLARG1; +extern boolean hits_bars(struct obj **, coordxy, coordxy, coordxy, coordxy, + int, int) NONNULLARG1; /* ### muse.c ### */ -E boolean FDECL(find_defensive, (struct monst *)); -E int FDECL(use_defensive, (struct monst *)); -E int FDECL(rnd_defensive_item, (struct monst *)); -E boolean FDECL(find_offensive, (struct monst *)); -#ifdef USE_TRAMPOLI -E int FDECL(mbhitm, (struct monst *, struct obj *)); -#endif -E int FDECL(use_offensive, (struct monst *)); -E int FDECL(rnd_offensive_item, (struct monst *)); -E boolean FDECL(find_misc, (struct monst *)); -E int FDECL(use_misc, (struct monst *)); -E int FDECL(rnd_misc_item, (struct monst *)); -E boolean FDECL(searches_for_item, (struct monst *, struct obj *)); -E boolean FDECL(mon_reflects, (struct monst *, const char *)); -E boolean FDECL(ureflects, (const char *, const char *)); -E void FDECL(mcureblindness, (struct monst *, BOOLEAN_P)); -E boolean FDECL(munstone, (struct monst *, BOOLEAN_P)); -E boolean FDECL(munslime, (struct monst *, BOOLEAN_P)); +extern boolean find_defensive(struct monst *, boolean) NONNULLARG1; +extern int use_defensive(struct monst *) NONNULLARG1; +extern int rnd_defensive_item(struct monst *) NONNULLARG1; +extern boolean find_offensive(struct monst *) NONNULLARG1; +extern int use_offensive(struct monst *) NONNULLARG1; +extern int rnd_offensive_item(struct monst *) NONNULLARG1; +extern boolean find_misc(struct monst *) NONNULLARG1; +extern int use_misc(struct monst *) NONNULLARG1; +extern int rnd_misc_item(struct monst *) NONNULLARG1; +extern boolean searches_for_item(struct monst *, struct obj *) NONNULLARG12; +extern boolean mon_reflects(struct monst *, const char *) NONNULLARG1; +extern boolean ureflects(const char *, const char *) NO_NNARGS; +extern void mcureblindness(struct monst *, boolean) NONNULLARG1; +extern boolean munstone(struct monst *, boolean) NONNULLARG1; +extern boolean munslime(struct monst *, boolean) NONNULLARG1; /* ### music.c ### */ -E void FDECL(awaken_soldiers, (struct monst *)); -E int FDECL(do_play_instrument, (struct obj *)); - -/* ### nhlan.c ### */ -#ifdef LAN_FEATURES -E void NDECL(init_lan_features); -E char *NDECL(lan_username); -#endif - -/* ### nhregex.c ### */ -E struct nhregex *NDECL(regex_init); -E boolean FDECL(regex_compile, (const char *, struct nhregex *)); -E const char *FDECL(regex_error_desc, (struct nhregex *)); -E boolean FDECL(regex_match, (const char *, struct nhregex *)); -E void FDECL(regex_free, (struct nhregex *)); - -/* ### nttty.c ### */ +extern void awaken_soldiers(struct monst *) NONNULLARG1; +extern int do_play_instrument(struct obj *) NONNULLARG1; +enum instruments obj_to_instr(struct obj *) NONNULLARG1; + +/* ### nhlsel.c ### */ + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +extern struct selectionvar *l_selection_check(lua_State *, int) NONNULLARG1; +extern int l_selection_register(lua_State *) NONNULLARG1; +extern void l_selection_push_copy(lua_State *, struct selectionvar *) NONNULLARG12; +extern int l_obj_register(lua_State *) NONNULLARG1; +#endif + +/* ### nhlobj.c ### */ + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +extern void nhl_push_obj(lua_State *, struct obj *) NONNULLARG12; +extern int nhl_obj_u_giveobj(lua_State *) NONNULLARG1; +extern int l_obj_register(lua_State *) NONNULLARG1; +#endif + +/* ### nhlua.c ### */ + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +extern void l_nhcore_init(void); +extern void l_nhcore_done(void); +extern void l_nhcore_call(int); +extern lua_State * nhl_init(nhl_sandbox_info *) NONNULLARG1; +/* nhl_done contains a test for NULL arg1, preventing NONNULLARG1 */ +extern void nhl_done(lua_State *) NO_NNARGS; +extern boolean nhl_loadlua(lua_State *, const char *) NONNULLARG12; +extern char *get_nh_lua_variables(void); +extern void save_luadata(NHFILE *) NONNULLARG1; +extern void restore_luadata(NHFILE *) NONNULLARG1; +extern int nhl_pcall(lua_State *, int, int, const char *) NONNULLARG1; +extern int nhl_pcall_handle(lua_State *, int, int, const char *, + NHL_pcall_action) NONNULLARG1; +extern boolean load_lua(const char *, nhl_sandbox_info *) NONNULLARG12; +ATTRNORETURN extern void nhl_error(lua_State *, const char *) + NORETURN NONNULLARG12; +extern void lcheck_param_table(lua_State *) NONNULLARG1; +extern schar get_table_mapchr(lua_State *, const char *) NONNULLARG12; +extern schar get_table_mapchr_opt(lua_State *, const char *, schar) + NONNULLARG12; +extern short nhl_get_timertype(lua_State *, int) NONNULLARG1; +extern boolean nhl_get_xy_params(lua_State *, lua_Integer *, lua_Integer *) + NONNULLARG123; +extern void nhl_add_table_entry_int(lua_State *, const char *, lua_Integer) + NONNULLARG12; +extern void nhl_add_table_entry_char(lua_State *, const char *, char) + NONNULLARG12; +extern void nhl_add_table_entry_str(lua_State *, const char *, const char *) + NONNULLARG123; +extern void nhl_add_table_entry_bool(lua_State *, const char *, boolean) + NONNULLARG12; +extern void nhl_add_table_entry_region(lua_State *, const char *, + coordxy, coordxy, coordxy, coordxy) + NONNULLARG12; +extern schar splev_chr2typ(char); +extern schar check_mapchr(const char *) NO_NNARGS; +extern int get_table_int(lua_State *, const char *) NONNULLARG12; +extern int get_table_int_opt(lua_State *, const char *, int) NONNULLARG12; +extern char *get_table_str(lua_State *, const char *) NONNULLARG12; +/* dungeon.c init_dungeon_levels() passes NULL to get_table_str_opt arg3 */ +extern char *get_table_str_opt(lua_State *, const char *, char *) NONNULLARG12; +extern int get_table_boolean(lua_State *, const char *) NONNULLARG12; +extern int get_table_boolean_opt(lua_State *, const char *, int) NONNULLARG12; +/* lspo_feature calls get_table_option(L, "type", NULL, features), + so arg3 can be NULL. NONNULLARG124 is not currently defined */ +extern int get_table_option(lua_State *, const char *, const char *, + const char *const *) NO_NNARGS; +/* extern int str_lines_max_width(const char *); */ +extern const char *get_lua_version(void); +extern void nhl_pushhooked_open_table(lua_State *L) NONNULLARG1; +extern void free_tutorial(void); +extern void tutorial(boolean); +#endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ + +#endif /* MAKEDEFS_C MDLIB_C CPPREGEX_C */ + +/* ### {cpp,pmatch,posix}regex.c ### */ +#include "nhregex.h" + +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(CPPREGEX_C) + +/* ### consoletty.c ### */ #ifdef WIN32 -E void NDECL(get_scr_size); -E int NDECL(nttty_kbhit); -E void FDECL(nttty_open, (int)); -E void NDECL(nttty_rubout); -E int NDECL(tgetch); -E int FDECL(ntposkey, (int *, int *, int *)); -E void FDECL(set_output_mode, (int)); -E void NDECL(synch_cursor); -E void NDECL(nethack_enter_nttty); -E void NDECL(nttty_exit); -E int NDECL(set_keyhandling_via_option); +extern void get_scr_size(void); +extern int consoletty_kbhit(void); +extern void consoletty_open(int); +extern void consoletty_rubout(void); +extern int tgetch(void); +extern int console_poskey(coordxy *, coordxy *, int *); +void console_g_putch(int in_ch); +extern void set_output_mode(int); +extern void synch_cursor(void); +extern void nethack_enter_consoletty(void); +extern void consoletty_exit(void); +extern int set_keyhandling_via_option(void); +#ifdef ENHANCED_SYMBOLS +extern void tty_utf8graphics_fixup(void); +extern void tty_ibmgraphics_fixup(void); +#endif /* ENHANCED_SYMBOLS */ #endif /* WIN32 */ /* ### o_init.c ### */ -E void NDECL(init_objects); -E void FDECL(obj_shuffle_range, (int, int *, int *)); -E int NDECL(find_skates); -E void NDECL(oinit); -E void FDECL(savenames, (int, int)); -E void FDECL(restnames, (int)); -E void FDECL(discover_object, (int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(undiscover_object, (int)); -E int NDECL(dodiscovered); -E int NDECL(doclassdisco); -E void NDECL(rename_disco); +extern void init_objects(void); +extern void init_oclass_probs(void); +extern void obj_shuffle_range(int, int *, int *) NONNULLPTRS; +/* objdescr_is() contains a test for NULL arg1, so can't be NONNULLARG12 */ +extern boolean objdescr_is(struct obj *, const char *) NONNULLARG2; +extern void oinit(void); +extern void savenames(NHFILE *) NONNULLARG1; +extern void restnames(NHFILE *) NONNULLARG1; +extern void observe_object(struct obj *) NONNULLARG1; +extern void discover_object(int, boolean, boolean, boolean); +extern void undiscover_object(int); +extern boolean interesting_to_discover(int); +extern int choose_disco_sort(int); +extern int dodiscovered(void); +extern int doclassdisco(void); +extern void rename_disco(void); +extern void get_sortdisco(char *opts, boolean cnf) NONNULLARG1; /* ### objects.c ### */ -E void NDECL(objects_init); +extern void objects_globals_init(void); /* ### objnam.c ### */ -E char *FDECL(obj_typename, (int)); -E char *FDECL(simple_typename, (int)); -E char *FDECL(safe_typename, (int)); -E boolean FDECL(obj_is_pname, (struct obj *)); -E char *FDECL(distant_name, (struct obj *, char *(*)(OBJ_P))); -E char *FDECL(fruitname, (BOOLEAN_P)); -E struct fruit *FDECL(fruit_from_indx, (int)); -E struct fruit *FDECL(fruit_from_name, (const char *, BOOLEAN_P, int *)); -E void FDECL(reorder_fruit, (BOOLEAN_P)); -E char *FDECL(xname, (struct obj *)); -E char *FDECL(mshot_xname, (struct obj *)); -E boolean FDECL(the_unique_obj, (struct obj *)); -E boolean FDECL(the_unique_pm, (struct permonst *)); -E boolean FDECL(erosion_matters, (struct obj *)); -E char *FDECL(doname, (struct obj *)); -E char *FDECL(doname_with_price, (struct obj *)); -E char *FDECL(doname_vague_quan, (struct obj *)); -E boolean FDECL(not_fully_identified, (struct obj *)); -E char *FDECL(corpse_xname, (struct obj *, const char *, unsigned)); -E char *FDECL(cxname, (struct obj *)); -E char *FDECL(cxname_singular, (struct obj *)); -E char *FDECL(killer_xname, (struct obj *)); -E char *FDECL(short_oname, - (struct obj *, char *(*)(OBJ_P), char *(*)(OBJ_P), unsigned)); -E const char *FDECL(singular, (struct obj *, char *(*)(OBJ_P))); -E char *FDECL(an, (const char *)); -E char *FDECL(An, (const char *)); -E char *FDECL(The, (const char *)); -E char *FDECL(the, (const char *)); -E char *FDECL(aobjnam, (struct obj *, const char *)); -E char *FDECL(yobjnam, (struct obj *, const char *)); -E char *FDECL(Yobjnam2, (struct obj *, const char *)); -E char *FDECL(Tobjnam, (struct obj *, const char *)); -E char *FDECL(otense, (struct obj *, const char *)); -E char *FDECL(vtense, (const char *, const char *)); -E char *FDECL(Doname2, (struct obj *)); -E char *FDECL(yname, (struct obj *)); -E char *FDECL(Yname2, (struct obj *)); -E char *FDECL(ysimple_name, (struct obj *)); -E char *FDECL(Ysimple_name2, (struct obj *)); -E char *FDECL(simpleonames, (struct obj *)); -E char *FDECL(ansimpleoname, (struct obj *)); -E char *FDECL(thesimpleoname, (struct obj *)); -E char *FDECL(bare_artifactname, (struct obj *)); -E char *FDECL(makeplural, (const char *)); -E char *FDECL(makesingular, (const char *)); -E struct obj *FDECL(readobjnam, (char *, struct obj *)); -E int FDECL(rnd_class, (int, int)); -E const char *FDECL(suit_simple_name, (struct obj *)); -E const char *FDECL(cloak_simple_name, (struct obj *)); -E const char *FDECL(helm_simple_name, (struct obj *)); -E const char *FDECL(gloves_simple_name, (struct obj *)); -E const char *FDECL(mimic_obj_name, (struct monst *)); -E char *FDECL(safe_qbuf, (char *, const char *, const char *, struct obj *, - char *(*)(OBJ_P), char *(*)(OBJ_P), const char *)); -E int FDECL(shiny_obj, (CHAR_P)); +extern void maybereleaseobuf(char *) NONNULLARG1; +extern char *obj_typename(int); +extern char *simple_typename(int); +extern char *safe_typename(int); +extern boolean obj_is_pname(struct obj *) NONNULLARG1; +extern char *distant_name(struct obj *, char *(*)(struct obj *)) NONNULLPTRS; +extern char *fruitname(boolean); +extern struct fruit *fruit_from_indx(int); +extern struct fruit *fruit_from_name(const char *, boolean, int *) NONNULLARG1; +extern void reorder_fruit(boolean); +extern char *xname(struct obj *) NONNULLARG1; +extern char *mshot_xname(struct obj *) NONNULLARG1; +extern boolean the_unique_obj(struct obj *) NONNULLARG1; +extern boolean the_unique_pm(struct permonst *) NONNULLARG1; +extern boolean erosion_matters(struct obj *) NONNULLARG1; +extern char *doname(struct obj *) NONNULLARG1; +extern char *doname_with_price(struct obj *) NONNULLARG1; +extern char *doname_vague_quan(struct obj *) NONNULLARG1; +extern boolean not_fully_identified(struct obj *) NONNULLARG1; +extern char *corpse_xname(struct obj *, const char *, unsigned) NONNULLARG1; +extern char *cxname(struct obj *) NONNULLARG1; +extern char *cxname_singular(struct obj *) NONNULLARG1; +extern char *killer_xname(struct obj *) NONNULLARG1; +extern char *short_oname(struct obj *, char *(*)(struct obj *), + char *(*)(struct obj *), unsigned) NONNULLARG12; +extern const char *singular(struct obj *, char *(*)(struct obj *)) NONNULLPTRS; +extern char *just_an(char *, const char *) NONNULL NONNULLARG12; +/* an(), the() contain tests for NULL arg, preventing NONNULLARG1 */ +extern char *an(const char *) NONNULL NO_NNARGS; +extern char *An(const char *) NONNULL NO_NNARGS; +extern char *The(const char *) NONNULL NO_NNARGS; +extern char *the(const char *) NONNULL NO_NNARGS; +extern char *aobjnam(struct obj *, const char *) NONNULL NONNULLARG1; +extern char *yobjnam(struct obj *, const char *) NONNULL NONNULLARG1; +extern char *Yobjnam2(struct obj *, const char *) NONNULL NONNULLARG1; +extern char *Tobjnam(struct obj *, const char *) NONNULL NONNULLARG1; +extern char *otense(struct obj *, const char *) NONNULL NONNULLARG12; +extern char *vtense(const char *, const char *) NONNULL NONNULLARG2; +extern char *Doname2(struct obj *) NONNULL NONNULLARG1; +extern char *paydoname(struct obj *) NONNULL NONNULLARG1; +extern char *yname(struct obj *) NONNULL NONNULLARG1; +extern char *Yname2(struct obj *) NONNULL NONNULLARG1; +extern char *ysimple_name(struct obj *) NONNULL NONNULLARG1; +extern char *Ysimple_name2(struct obj *) NONNULL NONNULLARG1; +extern char *simpleonames(struct obj *) NONNULL NONNULLARG1; +extern char *ansimpleoname(struct obj *) NONNULL NONNULLARG1; +extern char *thesimpleoname(struct obj *) NONNULL NONNULLARG1; +extern char *actualoname(struct obj *) NONNULL NONNULLARG1; +extern char *bare_artifactname(struct obj *) NONNULL NONNULLARG1; +/* makeplural() and makesingular() never return NULL but have tests for NULL + arg1, and code path that leads to impossible(), preventing NONNULLARG1 */ +extern char *makeplural(const char *) NONNULL NO_NNARGS; +extern char *makesingular(const char *) NONNULL NO_NNARGS; +/* readobjnam() can return NULL and allows a NULL to trigger code path for + random object */ +extern struct obj *readobjnam(char *, struct obj *) NO_NNARGS; +extern int rnd_class(int, int); +/* discover_object() passes NULL arg2 to Japanese_item_name(), + * preventing NONNULLARG2 */ +extern const char *Japanese_item_name(int, const char *) NO_NNARGS; +extern const char *armor_simple_name(struct obj *) NONNULL NONNULLARG1; +/* suit_simple_name has its code in a NULL arg test + conditional block, preventing NONNULLARG1 */ +extern const char *suit_simple_name(struct obj *) NONNULL NO_NNARGS; +/* cloak_simple_name has its code in a NULL arg test + conditional block, preventing NONNULLARG1 */ +extern const char *cloak_simple_name(struct obj *) NONNULL NO_NNARGS; +/* helm_simple_name always just returns hardcoded literals */ +extern const char *helm_simple_name(struct obj *) NONNULL NO_NNARGS; +/* gloves_simple_name has its code in a NULL arg test + conditional block, preventing NONNULLARG1 */ +extern const char *gloves_simple_name(struct obj *) NONNULL NO_NNARGS; +/* boots_simple_name has its code in a NULL arg test + conditional block, preventing NONNULLARG1 */ +extern const char *boots_simple_name(struct obj *) NONNULL NO_NNARGS; +/* shield_simple_name has its code in a NULL arg test + conditional block, preventing NONNULLARG1 */ +extern const char *shield_simple_name(struct obj *) NONNULL NO_NNARGS; +/* shirt_simple_name always just returns hardcoded "shirt" */ +extern const char *shirt_simple_name(struct obj *) NONNULL NO_NNARGS; +extern const char *mimic_obj_name(struct monst *) NONNULL NONNULLARG1; +/* safe_qbuf() contains tests for NULL arg2 and arg3, qprefix and qsuffix, + preventing use of NONNULLPTRS. */ +extern char *safe_qbuf(char *, const char *, const char *, struct obj *, + char * (*)(struct obj *), char * (*)(struct obj *), + const char *) NONNULL NONNULLARG14; +extern int shiny_obj(char); /* ### options.c ### */ -E void NDECL(reglyph_darkroom); -E boolean FDECL(match_optname, (const char *, const char *, int, BOOLEAN_P)); -E void NDECL(initoptions); -E void NDECL(initoptions_init); -E void NDECL(initoptions_finish); -E boolean FDECL(parseoptions, (char *, BOOLEAN_P, BOOLEAN_P)); -E int NDECL(doset); -E int NDECL(dotogglepickup); -E void NDECL(option_help); -E void FDECL(next_opt, (winid, const char *)); -E int FDECL(fruitadd, (char *, struct fruit *)); -E int FDECL(choose_classes_menu, (const char *, int, BOOLEAN_P, - char *, char *)); -E boolean FDECL(parsebindings, (char *)); -E void FDECL(oc_to_str, (char *, char *)); -E void FDECL(add_menu_cmd_alias, (CHAR_P, CHAR_P)); -E char FDECL(get_menu_cmd_key, (CHAR_P)); -E char FDECL(map_menu_cmd, (CHAR_P)); -E void FDECL(show_menu_controls, (winid, BOOLEAN_P)); -E void FDECL(assign_warnings, (uchar *)); -E char *FDECL(nh_getenv, (const char *)); -E void FDECL(set_duplicate_opt_detection, (int)); -E void FDECL(set_wc_option_mod_status, (unsigned long, int)); -E void FDECL(set_wc2_option_mod_status, (unsigned long, int)); -E void FDECL(set_option_mod_status, (const char *, int)); -E int FDECL(add_autopickup_exception, (const char *)); -E void NDECL(free_autopickup_exceptions); -E int FDECL(load_symset, (const char *, int)); -E void NDECL(free_symsets); -E boolean FDECL(parsesymbols, (char *, int)); -E struct symparse *FDECL(match_sym, (char *)); -E void NDECL(set_playmode); -E int FDECL(sym_val, (const char *)); -E int FDECL(query_color, (const char *)); -E int FDECL(query_attr, (const char *)); -E const char *FDECL(clr2colorname, (int)); -E int FDECL(match_str2clr, (char *)); -E int FDECL(match_str2attr, (const char *, BOOLEAN_P)); -E boolean FDECL(add_menu_coloring, (char *)); -E boolean FDECL(get_menu_coloring, (const char *, int *, int *)); -E void NDECL(free_menu_coloring); -E boolean FDECL(msgtype_parse_add, (char *)); -E int FDECL(msgtype_type, (const char *, BOOLEAN_P)); -E void FDECL(hide_unhide_msgtypes, (BOOLEAN_P, int)); -E void NDECL(msgtype_free); +extern boolean ask_do_tutorial(void); +extern boolean match_optname(const char *, const char *, int, boolean) NONNULLARG12; +extern uchar txt2key(char *) NONNULLARG1; +extern void initoptions(void); +extern void initoptions_init(void); +extern void initoptions_finish(void); +extern boolean parseoptions(char *, boolean, boolean) NONNULLARG1; +extern void freeroleoptvals(void); +extern char *get_option_value(const char *, boolean) NONNULLARG1; +extern int doset_simple(void); +extern int doset(void); +extern int dotogglepickup(void); +extern int toggle_bool_option(const char *); +extern void option_help(void); +extern void all_options_strbuf(strbuf_t *) NONNULLARG1; +extern void next_opt(winid, const char *) NONNULLARG2; +extern int fruitadd(char *, struct fruit *) NONNULLARG1; +extern boolean parsebindings(char *) NONNULLARG1; +extern void oc_to_str(char *, char *) NONNULLARG12; +extern void add_menu_cmd_alias(char, char); +extern char get_menu_cmd_key(char); +extern char map_menu_cmd(char); +extern char *collect_menu_keys(char *, unsigned, boolean) NONNULLARG1; +extern void show_menu_controls(winid, boolean); +extern void assign_warnings(uchar *) NONNULLARG1; +extern char *nh_getenv(const char *) NONNULLARG1; +extern void reset_duplicate_opt_detection(void); +extern void set_wc_option_mod_status(unsigned long, int); +extern void set_wc2_option_mod_status(unsigned long, int); +extern void set_option_mod_status(const char *, int) NONNULLARG1; +extern int add_autopickup_exception(const char *) NONNULLARG1; +extern void free_autopickup_exceptions(void); +extern void set_playmode(void); +extern int sym_val(const char *) NONNULLARG1; +extern boolean msgtype_parse_add(char *) NONNULLARG1; +extern int msgtype_type(const char *, boolean) NONNULLARG1; +extern void hide_unhide_msgtypes(boolean, int); +extern void msgtype_free(void); +extern void options_free_window_colors(void); +extern void heed_all_options(void); +extern void disregard_all_options(void); +extern void heed_this_option(enum opt); +extern void disregard_this_option(enum opt); +extern void clear_ignore_errors_on_unmatched(void); +#ifdef TTY_PERM_INVENT +extern void check_perm_invent_again(void); +#endif /* ### pager.c ### */ -E char *FDECL(self_lookat, (char *)); -E void FDECL(mhidden_description, (struct monst *, BOOLEAN_P, char *)); -E boolean FDECL(object_from_map, (int,int,int,struct obj **)); -E int FDECL(do_screen_description, (coord, BOOLEAN_P, int, char *, - const char **, struct permonst **)); -E int FDECL(do_look, (int, coord *)); -E int NDECL(dowhatis); -E int NDECL(doquickwhatis); -E int NDECL(doidtrap); -E int NDECL(dowhatdoes); -E char *FDECL(dowhatdoes_core, (CHAR_P, char *)); -E int NDECL(dohelp); -E int NDECL(dohistory); +extern char *self_lookat(char *) NONNULL NONNULLARG1; +extern char *monhealthdescr(struct monst *mon, boolean, + char *) NONNULL NONNULLARG3; +extern void mhidden_description(struct monst *, unsigned, char *) NONNULLPTRS; +extern boolean object_from_map(int, coordxy, coordxy, + struct obj **) NONNULLPTRS; +extern const char *waterbody_name(coordxy, coordxy) NONNULL; +extern char *ice_descr(coordxy, coordxy, char *) NONNULL NONNULLARG3; +extern boolean ia_checkfile(struct obj *) NONNULLARG1; +extern int do_screen_description(coord, boolean, int, char *, const char **, + struct permonst **) NONNULLARG45; +extern int do_look(int, coord *); +extern int dowhatis(void); +extern int doquickwhatis(void); +extern int doidtrap(void); +extern int dowhatdoes(void); +extern char *dowhatdoes_core(char, char *) NONNULLARG2; /*might return NULL*/ +extern int dohelp(void); +extern int dohistory(void); +void allopt_array_init(void); /* ### xxmain.c ### */ -#if defined(MICRO) || defined(WIN32) +#if defined(UNIX) || defined(MICRO) || defined(WIN32) #ifdef CHDIR -E void FDECL(chdirx, (char *, BOOLEAN_P)); +extern void chdirx(const char *, boolean); #endif /* CHDIR */ -E boolean NDECL(authorize_wizard_mode); -#endif /* MICRO || WIN32 */ +extern boolean authorize_wizard_mode(void); +extern boolean authorize_explore_mode(void); +#endif #if defined(WIN32) -E int NDECL(getlock); -E const char *NDECL(get_portable_device); +extern int getlock(void); +extern const char *get_portable_device(void); #endif -/* ### pcsys.c ### */ +/* ### pcsys.c, windsys.c ### */ +#if defined(MICRO) || defined(WIN32) +ATTRNORETURN extern void nethack_exit(int) NORETURN; +#else +#define nethack_exit exit +#endif + +/* ### pcsys.c ### */ #if defined(MICRO) || defined(WIN32) -E void NDECL(flushout); -E int NDECL(dosh); -#ifdef MFLOPPY -E void FDECL(eraseall, (const char *, const char *)); -E void FDECL(copybones, (int)); -E void NDECL(playwoRAMdisk); -E int FDECL(saveDiskPrompt, (int)); -E void NDECL(gameDiskPrompt); -#endif -E void FDECL(append_slash, (char *)); -E void FDECL(getreturn, (const char *)); +extern void flushout(void); +extern int dosh(void); +extern void append_slash(char *); +extern void getreturn(const char *); #ifndef AMIGA -E void VDECL(msmsg, (const char *, ...)); +extern void msmsg(const char *, ...) PRINTF_F(1, 2); #endif -E FILE *FDECL(fopenp, (const char *, const char *)); -#endif /* MICRO || WIN32 */ +/* E FILE *fopenp(const char *, const char *); */ +#endif /* MICRO || WIN2 */ /* ### pctty.c ### */ #if defined(MICRO) || defined(WIN32) -E void NDECL(gettty); -E void FDECL(settty, (const char *)); -E void NDECL(setftty); -E void VDECL(error, (const char *, ...)); +extern void gettty(void); +extern void settty(const char *); +extern void setftty(void); +ATTRNORETURN extern void error(const char *, ...) PRINTF_F(1, 2) NORETURN; #if defined(TIMED_DELAY) && defined(_MSC_VER) -E void FDECL(msleep, (unsigned)); +extern void msleep(unsigned); #endif #endif /* MICRO || WIN32 */ /* ### pcunix.c ### */ - #if defined(MICRO) -E void FDECL(regularize, (char *)); +extern void regularize(char *); #if defined(PC_LOCKING) -E void NDECL(getlock); +extern void getlock(void); #endif #endif /* MICRO */ /* ### pickup.c ### */ -E int FDECL(collect_obj_classes, (char *, struct obj *, BOOLEAN_P, - boolean FDECL((*), (OBJ_P)), int *)); -E boolean FDECL(rider_corpse_revival, (struct obj *, BOOLEAN_P)); -E boolean FDECL(menu_class_present, (int)); -E void FDECL(add_valid_menu_class, (int)); -E boolean FDECL(allow_all, (struct obj *)); -E boolean FDECL(allow_category, (struct obj *)); -E boolean FDECL(is_worn_by_type, (struct obj *)); -E int FDECL(ck_bag, (struct obj *)); -#ifdef USE_TRAMPOLI -E int FDECL(in_container, (struct obj *)); -E int FDECL(out_container, (struct obj *)); -#endif -E int FDECL(pickup, (int)); -E int FDECL(pickup_object, (struct obj *, long, BOOLEAN_P)); -E int FDECL(query_category, (const char *, struct obj *, int, - menu_item **, int)); -E int FDECL(query_objlist, (const char *, struct obj **, int, - menu_item **, int, boolean (*)(OBJ_P))); -E struct obj *FDECL(pick_obj, (struct obj *)); -E int NDECL(encumber_msg); -E int FDECL(container_at, (int, int, BOOLEAN_P)); -E int NDECL(doloot); -E void FDECL(observe_quantum_cat, (struct obj *, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(container_gone, (int (*)(OBJ_P))); -E boolean NDECL(u_handsy); -E int FDECL(use_container, (struct obj **, int, BOOLEAN_P)); -E int FDECL(loot_mon, (struct monst *, int *, boolean *)); -E int NDECL(dotip); -E struct autopickup_exception *FDECL(check_autopickup_exceptions, (struct obj *)); -E boolean FDECL(autopick_testobj, (struct obj *, BOOLEAN_P)); +extern int collect_obj_classes(char *, struct obj *, boolean, + boolean(*)(struct obj *), int *) NONNULLARG5; +extern boolean rider_corpse_revival(struct obj *, boolean) NO_NNARGS; +extern void force_decor(boolean); +extern void deferred_decor(boolean); +extern boolean menu_class_present(int); +extern void add_valid_menu_class(int); +extern boolean allow_all(struct obj *) NO_NNARGS; +extern boolean allow_category(struct obj *) NONNULLARG1; +extern boolean is_worn_by_type(struct obj *) NONNULLARG1; +extern int ck_bag(struct obj *) NONNULLARG1; +extern void removed_from_icebox(struct obj *) NONNULLARG1; +/* reset_justpicked() is sometimes passed gi.invent + * which can be null */ +extern void reset_justpicked(struct obj *) NO_NNARGS; +/* sometimes count_justpicked(gi.invent) which can be null */ +extern int count_justpicked(struct obj *) NO_NNARGS; +/* sometimes find_justpicked(gi.invent) which can be null */ +extern struct obj *find_justpicked(struct obj *) NO_NNARGS; +extern int pickup(int); +extern int pickup_object(struct obj *, long, boolean) NONNULLARG1; +extern int query_category(const char *, struct obj *, int, menu_item **, int) NONNULLARG14; +/* dotypeinv() call query_objlist with NULL arg1 */ +extern int query_objlist(const char *, struct obj **, int, menu_item **, int, + boolean(*)(struct obj *)) NONNULLARG24; +extern boolean reroll_menu(void); +extern struct obj *pick_obj(struct obj *) NONNULLARG1; +extern void encumber_msg(void); +extern int container_at(coordxy, coordxy, boolean); +extern int doloot(void); +extern void observe_quantum_cat(struct obj *, boolean, boolean) NONNULLARG1; +extern boolean container_gone(int(*)(struct obj *)) NONNULLARG1; +extern boolean u_handsy(void); +extern int use_container(struct obj **, boolean, boolean) NONNULLARG1; +extern int loot_mon(struct monst *, int *, boolean *) NO_NNARGS; +extern int dotip(void); +extern struct autopickup_exception *check_autopickup_exceptions(struct obj *) NONNULLARG1; +extern boolean autopick_testobj(struct obj *, boolean) NONNULLARG1; +extern boolean u_safe_from_fatal_corpse(struct obj *obj, int) NONNULLARG1; /* ### pline.c ### */ -#ifdef DUMPLOG -E void FDECL(dumplogmsg, (const char *)); -E void NDECL(dumplogfreemessages); -#endif -E void VDECL(pline, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(custompline, (unsigned, const char *, ...)) PRINTF_F(2, 3); -E void VDECL(Norep, (const char *, ...)) PRINTF_F(1, 2); -E void NDECL(free_youbuf); -E void VDECL(You, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(Your, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_feel, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_cant, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_hear, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(You_see, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(pline_The, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(There, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); -E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); +#ifdef DUMPLOG_CORE +extern void dumplogmsg(const char *); +extern void dumplogfreemessages(void); +#endif +extern void pline(const char *, ...) PRINTF_F(1, 2); +extern void pline_dir(int, const char *, ...) PRINTF_F(2, 3); +extern void pline_xy(coordxy, coordxy, const char *, ...) PRINTF_F(3, 4); +extern void pline_mon(struct monst *, const char *, ...) PRINTF_F(2, 3) NONNULLARG1; +extern void set_msg_dir(int); +extern void set_msg_xy(coordxy, coordxy); +extern void custompline(unsigned, const char *, ...) PRINTF_F(2, 3); +extern void urgent_pline(const char *, ...) PRINTF_F(1, 2); +extern void Norep(const char *, ...) PRINTF_F(1, 2); +extern void free_youbuf(void); +extern void You(const char *, ...) PRINTF_F(1, 2); +extern void Your(const char *, ...) PRINTF_F(1, 2); +extern void You_feel(const char *, ...) PRINTF_F(1, 2); +extern void You_cant(const char *, ...) PRINTF_F(1, 2); +extern void You_hear(const char *, ...) PRINTF_F(1, 2); +extern void You_see(const char *, ...) PRINTF_F(1, 2); +extern void pline_The(const char *, ...) PRINTF_F(1, 2); +extern void There(const char *, ...) PRINTF_F(1, 2); +extern void verbalize(const char *, ...) PRINTF_F(1, 2); +extern void gamelog_add(long, long, const char *); +extern void livelog_printf(long, const char *, ...) PRINTF_F(2, 3); +extern void raw_printf(const char *, ...) PRINTF_F(1, 2); +extern void impossible(const char *, ...) PRINTF_F(1, 2); +extern void config_error_add(const char *, ...) PRINTF_F(1, 2); +extern void nhassert_failed(const char *, const char *, int); /* ### polyself.c ### */ -E void NDECL(set_uasmon); -E void NDECL(float_vs_flight); -E void NDECL(change_sex); -E void FDECL(polyself, (int)); -E int FDECL(polymon, (int)); -E void NDECL(rehumanize); -E int NDECL(dobreathe); -E int NDECL(dospit); -E int NDECL(doremove); -E int NDECL(dospinweb); -E int NDECL(dosummon); -E int NDECL(dogaze); -E int NDECL(dohide); -E int NDECL(dopoly); -E int NDECL(domindblast); -E void NDECL(uunstick); -E void FDECL(skinback, (BOOLEAN_P)); -E const char *FDECL(mbodypart, (struct monst *, int)); -E const char *FDECL(body_part, (int)); -E int NDECL(poly_gender); -E void FDECL(ugolemeffects, (int, int)); -E boolean NDECL(ugenocided); -E const char *NDECL(udeadinside); +extern void set_uasmon(void); +extern void float_vs_flight(void); +extern void steed_vs_stealth(void); +extern void change_sex(void); +extern void livelog_newform(boolean, int, int); +extern void polyself(int); +extern int polymon(int); +extern schar uasmon_maxStr(void); +extern void rehumanize(void); +extern int dobreathe(void); +extern int dospit(void); +extern int doremove(void); +extern int dospinweb(void); +extern int dosummon(void); +extern int dogaze(void); +extern int dohide(void); +extern int dopoly(void); +extern int domindblast(void); +extern void uunstick(void); +extern void skinback(boolean); +extern const char *mbodypart(struct monst *, int) NONNULLARG1; +extern const char *body_part(int); +extern int poly_gender(void); +extern void ugolemeffects(int, int); +extern boolean ugenocided(void); +extern const char *udeadinside(void); /* ### potion.c ### */ -E void FDECL(set_itimeout, (long *, long)); -E void FDECL(incr_itimeout, (long *, int)); -E void FDECL(make_confused, (long, BOOLEAN_P)); -E void FDECL(make_stunned, (long, BOOLEAN_P)); -E void FDECL(make_sick, (long, const char *, BOOLEAN_P, int)); -E void FDECL(make_slimed, (long, const char *)); -E void FDECL(make_stoned, (long, const char *, int, const char *)); -E void FDECL(make_vomiting, (long, BOOLEAN_P)); -E void FDECL(make_blinded, (long, BOOLEAN_P)); -E void NDECL(toggle_blindness); -E boolean FDECL(make_hallucinated, (long, BOOLEAN_P, long)); -E void FDECL(make_deaf, (long, BOOLEAN_P)); -E void FDECL(make_glib, (int)); -E void NDECL(self_invis_message); -E int NDECL(dodrink); -E int FDECL(dopotion, (struct obj *)); -E int FDECL(peffects, (struct obj *)); -E void FDECL(healup, (int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(strange_feeling, (struct obj *, const char *)); -E void FDECL(potionhit, (struct monst *, struct obj *, int)); -E void FDECL(potionbreathe, (struct obj *)); -E int NDECL(dodip); -E void FDECL(mongrantswish, (struct monst **)); -E void FDECL(djinni_from_bottle, (struct obj *)); -E struct monst *FDECL(split_mon, (struct monst *, struct monst *)); -E const char *NDECL(bottlename); +extern void set_itimeout(long *, long) NONNULLARG1; +extern void incr_itimeout(long *, int) NONNULLARG1; +extern void make_confused(long, boolean); +extern void make_stunned(long, boolean); +extern void make_sick(long, const char *, boolean, int) NO_NNARGS; +extern void make_slimed(long, const char *) NO_NNARGS; +extern void make_stoned(long, const char *, int, const char *) NO_NNARGS; +extern void make_vomiting(long, boolean); +extern void make_blinded(long, boolean); +extern void toggle_blindness(void); +extern boolean make_hallucinated(long, boolean, long); +extern void make_deaf(long, boolean); +extern void make_glib(int); +extern void self_invis_message(void); +extern int dodrink(void); +extern int dopotion(struct obj *) NONNULLARG1; +extern int peffects(struct obj *) NONNULLARG1; +extern void healup(int, int, boolean, boolean); +extern void strange_feeling(struct obj *, const char *) NO_NNARGS; +extern void impact_arti_light(struct obj *, boolean, boolean) NONNULLARG1; +extern void potionhit(struct monst *, struct obj *, int) NONNULLARG12; +extern void potionbreathe(struct obj *) NONNULLARG1; +extern int dodip(void); +extern int dip_into(void); /* altdip */ +extern void mongrantswish(struct monst **) NONNULLARG1; +extern void djinni_from_bottle(struct obj *) NONNULLARG1; +extern struct monst *split_mon(struct monst *, struct monst *) NONNULLARG1; +extern const char *bottlename(void); +extern void speed_up(long); /* ### pray.c ### */ -E boolean FDECL(critically_low_hp, (BOOLEAN_P)); -E boolean NDECL(stuck_in_wall); -#ifdef USE_TRAMPOLI -E int NDECL(prayer_done); -#endif -E int NDECL(dosacrifice); -E boolean FDECL(can_pray, (BOOLEAN_P)); -E int NDECL(dopray); -E const char *NDECL(u_gname); -E int NDECL(doturn); -E const char *NDECL(a_gname); -E const char *FDECL(a_gname_at, (XCHAR_P x, XCHAR_P y)); -E const char *FDECL(align_gname, (ALIGNTYP_P)); -E const char *FDECL(halu_gname, (ALIGNTYP_P)); -E const char *FDECL(align_gtitle, (ALIGNTYP_P)); -E void FDECL(altar_wrath, (int, int)); +extern boolean critically_low_hp(boolean); +extern boolean stuck_in_wall(void); +extern void desecrate_altar(boolean, aligntyp); +extern int dosacrifice(void); +extern boolean can_pray(boolean); +extern int dopray(void); +extern const char *u_gname(void); +extern int doturn(void); +extern int altarmask_at(coordxy, coordxy); +extern const char *a_gname(void); +extern const char *a_gname_at(coordxy x, coordxy y); +extern const char *align_gname(aligntyp); +extern const char *halu_gname(aligntyp); +extern const char *align_gtitle(aligntyp); +extern void altar_wrath(coordxy, coordxy); /* ### priest.c ### */ -E int FDECL(move_special, (struct monst *, BOOLEAN_P, SCHAR_P, BOOLEAN_P, - BOOLEAN_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -E char FDECL(temple_occupied, (char *)); -E boolean FDECL(inhistemple, (struct monst *)); -E int FDECL(pri_move, (struct monst *)); -E void FDECL(priestini, (d_level *, struct mkroom *, int, int, BOOLEAN_P)); -E aligntyp FDECL(mon_aligntyp, (struct monst *)); -E char *FDECL(priestname, (struct monst *, char *)); -E boolean FDECL(p_coaligned, (struct monst *)); -E struct monst *FDECL(findpriest, (CHAR_P)); -E void FDECL(intemple, (int)); -E void FDECL(forget_temple_entry, (struct monst *)); -E void FDECL(priest_talk, (struct monst *)); -E struct monst *FDECL(mk_roamer, (struct permonst *, ALIGNTYP_P, XCHAR_P, - XCHAR_P, BOOLEAN_P)); -E void FDECL(reset_hostility, (struct monst *)); -E boolean FDECL(in_your_sanctuary, (struct monst *, XCHAR_P, XCHAR_P)); -E void FDECL(ghod_hitsu, (struct monst *)); -E void NDECL(angry_priest); -E void NDECL(clearpriests); -E void FDECL(restpriest, (struct monst *, BOOLEAN_P)); -E void FDECL(newepri, (struct monst *)); -E void FDECL(free_epri, (struct monst *)); -E const char *FDECL(align_str, (ALIGNTYP_P)); -E char *FDECL(piousness, (BOOLEAN_P, const char *)); -E void FDECL(mstatusline, (struct monst *)); -E void NDECL(ustatusline); +extern int move_special(struct monst *, boolean, schar, boolean, boolean, + coordxy, coordxy, coordxy, coordxy) NONNULLARG1; +extern char temple_occupied(char *) NONNULLARG1; +extern boolean inhistemple(struct monst *) NO_NNARGS; +extern int pri_move(struct monst *) NONNULLARG1; +extern void priestini(d_level *, struct mkroom *, int, int, boolean) NONNULLARG12; +extern aligntyp mon_aligntyp(struct monst *) NONNULLARG1; +extern char *priestname(struct monst *, int, boolean, char *) NONNULLARG1; +extern boolean p_coaligned(struct monst *) NONNULLARG1; +extern struct monst *findpriest(char); +extern void intemple(int); +extern void forget_temple_entry(struct monst *) NONNULLARG1; +extern void priest_talk(struct monst *) NONNULLARG1; +extern struct monst *mk_roamer(struct permonst *, aligntyp, coordxy, coordxy, + boolean) NO_NNARGS; +extern void reset_hostility(struct monst *) NONNULLARG1; +extern boolean in_your_sanctuary(struct monst *, coordxy, coordxy) NO_NNARGS; +extern void ghod_hitsu(struct monst *) NONNULLARG1; +extern void angry_priest(void); +extern void clearpriests(void); +extern void restpriest(struct monst *, boolean) NONNULLARG1; +extern void newepri(struct monst *) NONNULLARG1; +extern void free_epri(struct monst *) NONNULLARG1; /* ### quest.c ### */ -E void NDECL(onquest); -E void NDECL(nemdead); -E void FDECL(artitouch, (struct obj *)); -E boolean NDECL(ok_to_quest); -E void FDECL(leader_speaks, (struct monst *)); -E void NDECL(nemesis_speaks); -E void FDECL(quest_chat, (struct monst *)); -E void FDECL(quest_talk, (struct monst *)); -E void FDECL(quest_stat_check, (struct monst *)); -E void FDECL(finish_quest, (struct obj *)); +extern void onquest(void); +extern void nemdead(void); +extern void leaddead(void); +extern void artitouch(struct obj *) NONNULLARG1; +extern boolean ok_to_quest(void); +extern void leader_speaks(struct monst *) NONNULLARG1; +extern void nemesis_speaks(void); +extern void nemesis_stinks(coordxy, coordxy); +extern void quest_chat(struct monst *) NONNULLARG1; +extern void quest_talk(struct monst *) NONNULLARG1; +extern void quest_stat_check(struct monst *) NONNULLARG1; +extern void finish_quest(struct obj *) NO_NNARGS; /* ### questpgr.c ### */ -E void NDECL(load_qtlist); -E void NDECL(unload_qtlist); -E short FDECL(quest_info, (int)); -E const char *NDECL(ldrname); -E boolean FDECL(is_quest_artifact, (struct obj *)); -E struct obj *FDECL(find_quest_artifact, (unsigned)); -E void FDECL(com_pager, (int)); -E void FDECL(qt_pager, (int)); -E struct permonst *NDECL(qt_montype); -E void NDECL(deliver_splev_message); +extern void load_qtlist(void); +extern void unload_qtlist(void); +extern short quest_info(int); +extern const char *ldrname(void); +extern boolean is_quest_artifact(struct obj *) NONNULLARG1; +extern struct obj *find_quest_artifact(unsigned); +extern int stinky_nemesis(struct monst *); +extern void com_pager(const char *); +extern void qt_pager(const char *); +extern struct permonst *qt_montype(void); +extern void deliver_splev_message(void); /* ### random.c ### */ #if defined(RANDOM) && !defined(__GO32__) /* djgpp has its own random */ -E void FDECL(srandom, (unsigned)); -E char *FDECL(initstate, (unsigned, char *, int)); -E char *FDECL(setstate, (char *)); -E long NDECL(random); +#ifndef CROSS_TO_AMIGA +extern void srandom(unsigned); +extern char *initstate(unsigned, char *, int); +extern char *setstate(char *); +extern long random(void); +#endif /* CROSS_TO_AMIGA */ #endif /* RANDOM */ /* ### read.c ### */ -E void FDECL(learnscroll, (struct obj *)); -E char *FDECL(tshirt_text, (struct obj *, char *)); -E int NDECL(doread); -E boolean FDECL(is_chargeable, (struct obj *)); -E void FDECL(recharge, (struct obj *, int)); -E void FDECL(forget_objects, (int)); -E void FDECL(forget_levels, (int)); -E void NDECL(forget_traps); -E void FDECL(forget_map, (int)); -E int FDECL(seffects, (struct obj *)); -E void FDECL(drop_boulder_on_player, - (BOOLEAN_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E boolean FDECL(drop_boulder_on_monster, (int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(wand_explode, (struct obj *, int)); -#ifdef USE_TRAMPOLI -E void FDECL(set_lit, (int, int, genericptr_t)); -#endif -E void FDECL(litroom, (BOOLEAN_P, struct obj *)); -E void FDECL(do_genocide, (int)); -E void FDECL(punish, (struct obj *)); -E void NDECL(unpunish); -E boolean FDECL(cant_revive, (int *, BOOLEAN_P, struct obj *)); -E boolean NDECL(create_particular); +extern void learnscroll(struct obj *) NONNULLARG1; +extern char *tshirt_text(struct obj *, char *) NONNULLARG12; +extern char *hawaiian_motif(struct obj *, char *) NONNULLARG12; +extern char *apron_text(struct obj *, char *) NONNULLARG12; +extern const char *candy_wrapper_text(struct obj *) NONNULLARG1; +extern void assign_candy_wrapper(struct obj *) NONNULLARG1; +extern int doread(void); +extern int charge_ok(struct obj *) NO_NNARGS; +extern void recharge(struct obj *, int) NONNULLARG1; +extern boolean valid_cloud_pos(coordxy, coordxy); +extern int seffects(struct obj *) NONNULLARG1; +extern void drop_boulder_on_player(boolean, boolean, boolean, boolean); +extern boolean drop_boulder_on_monster(coordxy, coordxy, boolean, boolean); +extern void wand_explode(struct obj *, int) NONNULLARG1; +extern void litroom(boolean, struct obj *) NO_NNARGS; +extern void do_genocide(int); +extern void punish(struct obj *) NO_NNARGS; +extern void unpunish(void); +extern boolean cant_revive(int *, boolean, struct obj *) NO_NNARGS; +extern boolean create_particular(void); /* ### rect.c ### */ -E void NDECL(init_rect); -E NhRect *FDECL(get_rect, (NhRect *)); -E NhRect *NDECL(rnd_rect); -E void FDECL(remove_rect, (NhRect *)); -E void FDECL(add_rect, (NhRect *)); -E void FDECL(split_rects, (NhRect *, NhRect *)); +extern void init_rect(void); +extern void free_rect(void); +extern NhRect *get_rect(NhRect *) NONNULLARG1; +extern NhRect *rnd_rect(void); +extern void rect_bounds(NhRect, NhRect, NhRect *) NONNULLARG3; +extern void remove_rect(NhRect *) NONNULLARG1; +extern void add_rect(NhRect *) NONNULLARG1; +extern void split_rects(NhRect *, NhRect *) NONNULLARG12; /* ## region.c ### */ -E void NDECL(clear_regions); -E void NDECL(run_regions); -E boolean FDECL(in_out_region, (XCHAR_P, XCHAR_P)); -E boolean FDECL(m_in_out_region, (struct monst *, XCHAR_P, XCHAR_P)); -E void NDECL(update_player_regions); -E void FDECL(update_monster_region, (struct monst *)); -E NhRegion *FDECL(visible_region_at, (XCHAR_P, XCHAR_P)); -E void FDECL(show_region, (NhRegion *, XCHAR_P, XCHAR_P)); -E void FDECL(save_regions, (int, int)); -E void FDECL(rest_regions, (int, BOOLEAN_P)); -E void FDECL(region_stats, (const char *, char *, long *, long *)); -E NhRegion *FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int)); -E boolean NDECL(region_danger); -E void NDECL(region_safety); + +extern boolean inside_region(NhRegion *, int, int) NO_NNARGS; +extern void clear_regions(void); +extern void run_regions(void); +extern boolean in_out_region(coordxy, coordxy); +extern boolean m_in_out_region(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void update_player_regions(void); +extern void update_monster_region(struct monst *) NONNULLARG1; +extern int reg_damg(NhRegion *) NONNULLARG1; +extern boolean any_visible_region(void); +extern void visible_region_summary(winid); +extern NhRegion *visible_region_at(coordxy, coordxy); +extern void show_region(NhRegion *, coordxy, coordxy) NONNULLARG1; +extern void save_regions(NHFILE *) NONNULLARG1; +extern void rest_regions(NHFILE *) NONNULLARG1; +extern void region_stats(const char *, char *, long *, long *) NONNULLPTRS; +extern NhRegion *create_gas_cloud(coordxy, coordxy, int, int); +extern NhRegion *create_gas_cloud_selection(struct selectionvar *, int); +extern boolean region_danger(void); +extern void region_safety(void); + +/* ### report.c ### */ + +#ifdef CRASHREPORT +extern boolean submit_web_report(int, const char *, const char *); +extern boolean submit_web_report(int, const char *, const char *); +extern void crashreport_init(int, char *[]); +extern void crashreport_bidshow(void); +extern boolean swr_add_uricoded(const char *, char **, int *, char *); +extern int dobugreport(void); +#endif /* CRASHREPORT */ +# ifndef NO_SIGNAL +extern void panictrace_handler(int); +# endif +#ifdef PANICTRACE +extern const char *get_saved_pline(int); +extern boolean NH_panictrace_libc(void); +extern boolean NH_panictrace_gdb(void); +#if defined(PANICTRACE) && !defined(NO_SIGNAL) +extern void panictrace_setsignals(boolean); +#endif +#endif /* PANICTRACE */ /* ### restore.c ### */ -E void FDECL(inven_inuse, (BOOLEAN_P)); -E int FDECL(dorecover, (int)); -E void FDECL(restcemetery, (int, struct cemetery **)); -E void FDECL(trickery, (char *)); -E void FDECL(getlev, (int, int, XCHAR_P, BOOLEAN_P)); -E void FDECL(get_plname_from_file, (int, char *)); +extern void inven_inuse(boolean); +extern int dorecover(NHFILE *) NONNULLARG1; +extern void restcemetery(NHFILE *, struct cemetery **) NONNULLARG12; +extern void trickery(char *) NO_NNARGS; +extern void getlev(NHFILE *, int, xint8) NONNULLARG1; +extern void get_plname_from_file(NHFILE *, char *, boolean) NONNULLARG12; #ifdef SELECTSAVED -E int FDECL(restore_menu, (winid)); -#endif -E void NDECL(minit); -E boolean FDECL(lookup_id_mapping, (unsigned, unsigned *)); -E void FDECL(mread, (int, genericptr_t, unsigned int)); -E int FDECL(validate, (int, const char *)); -E void NDECL(reset_restpref); -E void FDECL(set_restpref, (const char *)); -E void FDECL(set_savepref, (const char *)); +extern int restore_menu(winid); +#endif +extern boolean lookup_id_mapping(unsigned, unsigned *) NONNULLARG2; +/* extern void reset_restpref(void); */ +/* extern void set_restpref(const char *); */ +/* extern void set_savepref(const char *); */ +#ifdef SFCTOOL +void rest_bubbles(NHFILE *); +void restore_gamelog(NHFILE *); +boolean restgamestate(NHFILE *); +void restore_msghistory(NHFILE *); +#endif +extern void rest_adjust_levelflags(void); +extern void moves_to_relative_time(long *); +extern void relative_time_to_moves(long *); /* ### rip.c ### */ -E void FDECL(genl_outrip, (winid, int, time_t)); +extern void genl_outrip(winid, int, time_t); /* ### rnd.c ### */ #ifdef USE_ISAAC64 -E void FDECL(init_isaac64, (unsigned long, int FDECL((*fn), (int)))); -E long NDECL(nhrand); -#endif -E int FDECL(rn2, (int)); -E int FDECL(rn2_on_display_rng, (int)); -E int FDECL(rnl, (int)); -E int FDECL(rnd, (int)); -E int FDECL(d, (int, int)); -E int FDECL(rne, (int)); -E int FDECL(rnz, (int)); +extern void init_isaac64(unsigned long, int(*fn)(int)); +extern long nhrand(void); +#endif +extern int rn2(int); +extern int rn2_on_display_rng(int); +extern int rnd_on_display_rng(int); +extern int rnl(int); +extern int rnd(int); +extern int d(int, int); +extern int rne(int); +extern int rnz(int); +extern void init_random(int(*fn)(int)); +extern void reseed_random(int(*fn)(int)); +extern void shuffle_int_array(int *, int) NONNULLARG1; /* ### role.c ### */ -E boolean FDECL(validrole, (int)); -E boolean FDECL(validrace, (int, int)); -E boolean FDECL(validgend, (int, int, int)); -E boolean FDECL(validalign, (int, int, int)); -E int FDECL(randrole, (BOOLEAN_P)); -E int FDECL(randrace, (int)); -E int FDECL(randgend, (int, int)); -E int FDECL(randalign, (int, int)); -E int FDECL(str2role, (const char *)); -E int FDECL(str2race, (const char *)); -E int FDECL(str2gend, (const char *)); -E int FDECL(str2align, (const char *)); -E boolean FDECL(ok_role, (int, int, int, int)); -E int FDECL(pick_role, (int, int, int, int)); -E boolean FDECL(ok_race, (int, int, int, int)); -E int FDECL(pick_race, (int, int, int, int)); -E boolean FDECL(ok_gend, (int, int, int, int)); -E int FDECL(pick_gend, (int, int, int, int)); -E boolean FDECL(ok_align, (int, int, int, int)); -E int FDECL(pick_align, (int, int, int, int)); -E void NDECL(rigid_role_checks); -E boolean FDECL(setrolefilter, (const char *)); -E boolean NDECL(gotrolefilter); -E void NDECL(clearrolefilter); -E char *FDECL(build_plselection_prompt, (char *, int, int, int, int, int)); -E char *FDECL(root_plselection_prompt, (char *, int, int, int, int, int)); -E void NDECL(plnamesuffix); -E void FDECL(role_selection_prolog, (int, winid)); -E void FDECL(role_menu_extra, (int, winid, BOOLEAN_P)); -E void NDECL(role_init); -E const char *FDECL(Hello, (struct monst *)); -E const char *NDECL(Goodbye); +extern boolean validrole(int); +extern boolean validrace(int, int); +extern boolean validgend(int, int, int); +extern boolean validalign(int, int, int); +extern int randrole(boolean); +extern int randrace(int); +extern int randgend(int, int); +extern int randalign(int, int); +extern int str2role(const char *) NO_NNARGS; +extern int str2race(const char *) NO_NNARGS; +extern int str2gend(const char *) NO_NNARGS; +extern int str2align(const char *) NO_NNARGS; +extern boolean ok_role(int, int, int, int); +extern int pick_role(int, int, int, int); +extern boolean ok_race(int, int, int, int); +extern int pick_race(int, int, int, int); +extern boolean ok_gend(int, int, int, int); +extern int pick_gend(int, int, int, int); +extern boolean ok_align(int, int, int, int); +extern int pick_align(int, int, int, int); +extern void rigid_role_checks(void); +extern boolean setrolefilter(const char *) NONNULLARG1; +extern boolean gotrolefilter(void); +extern char *rolefilterstring(char *, int) NONNULLARG1; +extern void clearrolefilter(int); +extern char *root_plselection_prompt(char *, int, int, int, int, int) NO_NNARGS; +extern char *build_plselection_prompt(char *, int, int, int, int, int) NONNULLARG1; +extern void plnamesuffix(void); +extern void role_selection_prolog(int, winid); +extern void role_menu_extra(int, winid, boolean); +extern void role_init(void); +extern const char *Hello(struct monst *) NO_NNARGS; +extern const char *Goodbye(void); +extern const struct Race *character_race(short); +extern void genl_player_selection(void); +extern int genl_player_setup(int); /* ### rumors.c ### */ -E char *FDECL(getrumor, (int, char *, BOOLEAN_P)); -E char *FDECL(get_rnd_text, (const char *, char *, int FDECL((*), (int)))); -E void FDECL(outrumor, (int, int)); -E void FDECL(outoracle, (BOOLEAN_P, BOOLEAN_P)); -E void FDECL(save_oracles, (int, int)); -E void FDECL(restore_oracles, (int)); -E int FDECL(doconsult, (struct monst *)); -E void NDECL(rumor_check); +extern char *getrumor(int, char *, boolean) NONNULLARG2; +extern char *get_rnd_text(const char *, char *, int(*)(int), + unsigned) NONNULLPTRS; +extern void outrumor(int, int); +extern void outoracle(boolean, boolean); +extern void save_oracles(NHFILE *) NONNULLARG1; +extern void restore_oracles(NHFILE *) NONNULLARG1; +extern int doconsult(struct monst *) NO_NNARGS; +extern void rumor_check(void); +extern boolean CapitalMon(const char *) NO_NNARGS; +extern void free_CapMons(void); /* ### save.c ### */ -E int NDECL(dosave); -E int NDECL(dosave0); -E boolean FDECL(tricked_fileremoved, (int, char *)); +extern int dosave(void); +extern int dosave0(void); +extern boolean tricked_fileremoved(NHFILE *, char *) NONNULLARG2; #ifdef INSURANCE -E void NDECL(savestateinlock); -#endif -#ifdef MFLOPPY -E boolean FDECL(savelev, (int, XCHAR_P, int)); -E boolean FDECL(swapin_file, (int)); -E void NDECL(co_false); -#else -E void FDECL(savelev, (int, XCHAR_P, int)); -#endif -E genericptr_t FDECL(mon_to_buffer, (struct monst *, int *)); -E void FDECL(bufon, (int)); -E void FDECL(bufoff, (int)); -E void FDECL(bflush, (int)); -E void FDECL(bwrite, (int, genericptr_t, unsigned int)); -E void FDECL(bclose, (int)); -E void FDECL(def_bclose, (int)); -#if defined(ZEROCOMP) -E void FDECL(zerocomp_bclose, (int)); -#endif -E void FDECL(savecemetery, (int, int, struct cemetery **)); -E void FDECL(savefruitchn, (int, int)); -E void FDECL(store_plname_in_file, (int)); -E void NDECL(free_dungeons); -E void NDECL(freedynamicdata); -E void FDECL(store_savefileinfo, (int)); +extern void savestateinlock(void); +#endif +extern void savelev(NHFILE *, xint8) NONNULLARG1; +/* extern genericptr_t mon_to_buffer(struct monst *, int *); */ +extern void savecemetery(NHFILE *, struct cemetery **) NONNULLARG12; +extern void savefruitchn(NHFILE *) NONNULLARG1; +extern void store_plname_in_file(NHFILE *) NONNULLARG1; +extern void free_dungeons(void); +extern void freedynamicdata(void); +extern void store_savefileinfo(NHFILE *) NONNULLARG1; +extern void store_savefileinfo(NHFILE *) NONNULLARG1; +extern int nhdatatypes_size(void); +#if 0 +extern void assignlog(char *, char*, int); +extern FILE *getlog(NHFILE *); +extern void closelog(NHFILE *); +#endif + +/* ### selvar.c ### */ + +extern struct selectionvar *selection_new(void); +extern void selection_free(struct selectionvar *, boolean) NO_NNARGS; +extern void selection_clear(struct selectionvar *, int) NONNULLARG1; +extern struct selectionvar *selection_clone(struct selectionvar *) NONNULLARG1; +extern void selection_getbounds(struct selectionvar *, NhRect *) NO_NNARGS; +extern void selection_recalc_bounds(struct selectionvar *) NONNULLARG1; +extern coordxy selection_getpoint(coordxy, coordxy, struct selectionvar *) NO_NNARGS; +extern void selection_setpoint(coordxy, coordxy, struct selectionvar *, int); +extern struct selectionvar * selection_not(struct selectionvar *); +extern struct selectionvar *selection_filter_percent(struct selectionvar *, + int); +extern struct selectionvar *selection_filter_mapchar(struct selectionvar *, + xint16, int); +extern int selection_rndcoord(struct selectionvar *, coordxy *, coordxy *, + boolean); +extern void selection_do_grow(struct selectionvar *, int); +extern void set_selection_floodfillchk(int(*)(coordxy, coordxy)); +extern void selection_floodfill(struct selectionvar *, coordxy, coordxy, + boolean); +extern void selection_do_ellipse(struct selectionvar *, int, int, int, int, + int); +extern void selection_do_gradient(struct selectionvar *, long, long, long, + long, long, long, long); +extern void selection_do_line(coordxy, coordxy, coordxy, coordxy, + struct selectionvar *); +extern void selection_do_randline(coordxy, coordxy, coordxy, coordxy, + schar, schar, struct selectionvar *); +extern void selection_iterate(struct selectionvar *, select_iter_func, + genericptr_t); +extern boolean selection_is_irregular(struct selectionvar *); +extern char *selection_size_description(struct selectionvar *, char *); +extern struct selectionvar *selection_from_mkroom(struct mkroom *) NO_NNARGS; +extern void selection_force_newsyms(struct selectionvar *) NONNULLARG1; + +/* ### sfstruct.c ### */ + +extern boolean close_check(int); +/* extern void newread(NHFILE *, int, int, genericptr_t, unsigned); */ +extern void bufon(int); +extern void bufoff(int); +extern void bflush(int); +extern void bwrite(int, const genericptr_t, unsigned) NONNULLARG2; +extern void mread(int, genericptr_t, unsigned) NONNULLARG2; +extern void bclose(int); /* ### shk.c ### */ -E void FDECL(setpaid, (struct monst *)); -E long FDECL(money2mon, (struct monst *, long)); -E void FDECL(money2u, (struct monst *, long)); -E void FDECL(shkgone, (struct monst *)); -E void FDECL(set_residency, (struct monst *, BOOLEAN_P)); -E void FDECL(replshk, (struct monst *, struct monst *)); -E void FDECL(restshk, (struct monst *, BOOLEAN_P)); -E char FDECL(inside_shop, (XCHAR_P, XCHAR_P)); -E void FDECL(u_left_shop, (char *, BOOLEAN_P)); -E void FDECL(remote_burglary, (XCHAR_P, XCHAR_P)); -E void FDECL(u_entered_shop, (char *)); -E void FDECL(pick_pick, (struct obj *)); -E boolean FDECL(same_price, (struct obj *, struct obj *)); -E void NDECL(shopper_financial_report); -E int FDECL(inhishop, (struct monst *)); -E struct monst *FDECL(shop_keeper, (CHAR_P)); -E boolean FDECL(tended_shop, (struct mkroom *)); -E boolean FDECL(is_unpaid, (struct obj *)); -E void FDECL(delete_contents, (struct obj *)); -E void FDECL(obfree, (struct obj *, struct obj *)); -E void FDECL(home_shk, (struct monst *, BOOLEAN_P)); -E void FDECL(make_happy_shk, (struct monst *, BOOLEAN_P)); -E void FDECL(make_happy_shoppers, (BOOLEAN_P)); -E void FDECL(hot_pursuit, (struct monst *)); -E void FDECL(make_angry_shk, (struct monst *, XCHAR_P, XCHAR_P)); -E int NDECL(dopay); -E boolean FDECL(paybill, (int, BOOLEAN_P)); -E void NDECL(finish_paybill); -E struct obj *FDECL(find_oid, (unsigned)); -E long FDECL(contained_cost, - (struct obj *, struct monst *, long, BOOLEAN_P, BOOLEAN_P)); -E long FDECL(contained_gold, (struct obj *)); -E void FDECL(picked_container, (struct obj *)); -E void FDECL(gem_learned, (int)); -E void FDECL(alter_cost, (struct obj *, long)); -E long FDECL(unpaid_cost, (struct obj *, BOOLEAN_P)); -E boolean FDECL(billable, (struct monst **, struct obj *, CHAR_P, BOOLEAN_P)); -E void FDECL(addtobill, (struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(splitbill, (struct obj *, struct obj *)); -E void FDECL(subfrombill, (struct obj *, struct monst *)); -E long FDECL(stolen_value, - (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(sellobj_state, (int)); -E void FDECL(sellobj, (struct obj *, XCHAR_P, XCHAR_P)); -E int FDECL(doinvbill, (int)); -E struct monst *FDECL(shkcatch, (struct obj *, XCHAR_P, XCHAR_P)); -E void FDECL(add_damage, (XCHAR_P, XCHAR_P, long)); -E int FDECL(repair_damage, (struct monst *, struct damage *, int *, - BOOLEAN_P)); -E int FDECL(shk_move, (struct monst *)); -E void FDECL(after_shk_move, (struct monst *)); -E boolean FDECL(is_fshk, (struct monst *)); -E void FDECL(shopdig, (int)); -E void FDECL(pay_for_damage, (const char *, BOOLEAN_P)); -E boolean FDECL(costly_spot, (XCHAR_P, XCHAR_P)); -E struct obj *FDECL(shop_object, (XCHAR_P, XCHAR_P)); -E void FDECL(price_quote, (struct obj *)); -E void FDECL(shk_chat, (struct monst *)); -E void FDECL(check_unpaid_usage, (struct obj *, BOOLEAN_P)); -E void FDECL(check_unpaid, (struct obj *)); -E void FDECL(costly_gold, (XCHAR_P, XCHAR_P, long)); -E long FDECL(get_cost_of_shop_item, (struct obj *, int *)); -E int FDECL(oid_price_adjustment, (struct obj *, unsigned)); -E boolean FDECL(block_door, (XCHAR_P, XCHAR_P)); -E boolean FDECL(block_entry, (XCHAR_P, XCHAR_P)); -E char *FDECL(shk_your, (char *, struct obj *)); -E char *FDECL(Shk_Your, (char *, struct obj *)); -E void FDECL(globby_bill_fixup, (struct obj *, struct obj *)); -E void FDECL(globby_donation, (struct obj *, struct obj *)); +/* setpaid() has a conditional code block near the end of the + function, where arg1 is tested for NULL, preventing NONNULLARG1 */ +extern void setpaid(struct monst *) NO_NNARGS; +extern void record_price_quote(int, unsigned long, boolean); +extern void append_price_quote(char *, char **, int) NONNULLARG12; +extern long money2mon(struct monst *, long) NONNULLARG1; +extern void money2u(struct monst *, long) NONNULLARG1; +extern void shkgone(struct monst *) NONNULLARG1; +extern void set_residency(struct monst *, boolean) NONNULLARG1; +extern void replshk(struct monst *, struct monst *) NONNULLARG12; +extern void restshk(struct monst *, boolean) NONNULLARG1; +extern char inside_shop(coordxy, coordxy); +extern void u_left_shop(char *, boolean) NONNULLARG1; +extern void remote_burglary(coordxy, coordxy); +extern void u_entered_shop(char *); +extern void pick_pick(struct obj *) NONNULLARG1; +extern boolean same_price(struct obj *, struct obj *) NONNULLARG12; +extern void shopper_financial_report(void); +extern int inhishop(struct monst *) NONNULLARG1; +extern struct monst *shop_keeper(char); +extern struct monst *find_objowner(struct obj *, + coordxy x, coordxy y) NONNULLARG1; +extern boolean tended_shop(struct mkroom *) NONNULLARG1; +extern boolean onshopbill(struct obj *, struct monst *, boolean) NONNULLARG1; +extern boolean is_unpaid(struct obj *) NONNULLARG1; +extern void delete_contents(struct obj *) NONNULLARG1; +extern void obfree(struct obj *, struct obj *) NONNULLARG1; +extern void make_happy_shk(struct monst *, boolean) NONNULLARG1; +extern void make_happy_shoppers(boolean); +extern void hot_pursuit(struct monst *) NONNULLARG1; +extern void make_angry_shk(struct monst *, coordxy, coordxy) NONNULLARG1; +extern int dopay(void); +extern boolean paybill(int, boolean); +extern void finish_paybill(void); +extern struct obj *find_oid(unsigned); +extern long contained_cost(struct obj *, struct monst *, long, boolean, + boolean) NONNULLARG12; +extern long contained_gold(struct obj *, boolean) NONNULLARG1; +extern void picked_container(struct obj *) NONNULLARG1; +extern void gem_learned(int); +extern void alter_cost(struct obj *, long) NONNULLARG1; +extern long unpaid_cost(struct obj *, uchar) NONNULLARG1; +extern boolean billable(struct monst **, struct obj *, char, + boolean) NONNULLARG12; +extern void addtobill(struct obj *, boolean, boolean, boolean) NONNULLARG1; +extern void splitbill(struct obj *, struct obj *) NONNULLARG12; +extern void subfrombill(struct obj *, struct monst *) NONNULLARG12; +extern long stolen_value(struct obj *, coordxy, coordxy, + boolean, boolean) NONNULLARG1; +extern void donate_gold(long, struct monst *, boolean) NONNULLARG2; +extern void sellobj_state(int); +extern void sellobj(struct obj *, coordxy, coordxy) NONNULLARG1; +extern int doinvbill(int); +extern struct monst *shkcatch(struct obj *, coordxy, coordxy) NONNULLARG1; +extern void add_damage(coordxy, coordxy, long); +extern void fix_shop_damage(void); +extern int shk_move(struct monst *) NONNULLARG1; +extern void after_shk_move(struct monst *) NONNULLARG1; +extern boolean is_fshk(struct monst *) NONNULLARG1; +extern void shopdig(int); +extern void pay_for_damage(const char *, boolean); +extern boolean costly_spot(coordxy, coordxy); +/* costly_adjacent() has checks for null 1st arg, and an early return, + so it cannot be NONNULLARG1 */ +extern boolean costly_adjacent(struct monst *, coordxy, coordxy) NO_NNARGS; +extern struct obj *shop_object(coordxy, coordxy); +extern void price_quote(struct obj *) NONNULLARG1; +extern void shk_chat(struct monst *) NONNULLARG1; +extern void check_unpaid_usage(struct obj *, boolean) NONNULLARG1; +extern void check_unpaid(struct obj *) NONNULLARG1; +extern void costly_gold(coordxy, coordxy, long, boolean); +extern long get_cost_of_shop_item(struct obj *, int *) NONNULLARG1; +extern int oid_price_adjustment(struct obj *, unsigned) NONNULLARG1; +extern boolean block_door(coordxy, coordxy); +extern boolean block_entry(coordxy, coordxy); +extern char *shk_your(char *, struct obj *) NONNULLPTRS; +extern char *Shk_Your(char *, struct obj *) NONNULLPTRS; +extern void globby_bill_fixup(struct obj *, struct obj *) NONNULLARG12; +/*extern void globby_donation(struct obj *, struct obj *); */ +extern void credit_report(struct monst *shkp, int idx, + boolean silent) NONNULLARG1; +extern void use_unpaid_trapobj(struct obj *, coordxy, coordxy) NONNULLARG1; +extern void noisy_shop(struct mkroom *); + /* ### shknam.c ### */ -E void FDECL(neweshk, (struct monst *)); -E void FDECL(free_eshk, (struct monst *)); -E void FDECL(stock_room, (int, struct mkroom *)); -E boolean FDECL(saleable, (struct monst *, struct obj *)); -E int FDECL(get_shop_item, (int)); -E char *FDECL(Shknam, (struct monst *)); -E char *FDECL(shkname, (struct monst *)); -E boolean FDECL(shkname_is_pname, (struct monst *)); -E boolean FDECL(is_izchak, (struct monst *, BOOLEAN_P)); +extern void neweshk(struct monst *) NONNULLARG1; +extern void free_eshk(struct monst *) NONNULLARG1; +extern void stock_room(int, struct mkroom *) NONNULLARG2; +extern boolean saleable(struct monst *, struct obj *) NONNULLARG12; +extern int get_shop_item(int); +extern char *Shknam(struct monst *) NONNULLARG1; +extern char *shkname(struct monst *) NONNULLARG1; +extern boolean shkname_is_pname(struct monst *) NONNULLARG1; +extern boolean is_izchak(struct monst *, boolean) NONNULLARG1; /* ### sit.c ### */ -E void NDECL(take_gold); -E int NDECL(dosit); -E void NDECL(rndcurse); -E void NDECL(attrcurse); +extern void take_gold(void); +extern int dosit(void); +extern void rndcurse(void); +extern int attrcurse(void); /* ### sounds.c ### */ -E void NDECL(dosounds); -E const char *FDECL(growl_sound, (struct monst *)); -E void FDECL(growl, (struct monst *)); -E void FDECL(yelp, (struct monst *)); -E void FDECL(whimper, (struct monst *)); -E void FDECL(beg, (struct monst *)); -E int NDECL(dotalk); +extern void dosounds(void); +extern const char *growl_sound(struct monst *) NONNULLARG1; +extern void growl(struct monst *) NONNULLARG1; +extern void yelp(struct monst *) NONNULLARG1; +extern void whimper(struct monst *) NONNULLARG1; +extern void beg(struct monst *) NONNULLARG1; +extern const char *maybe_gasp(struct monst *) NONNULLARG1; +extern const char *cry_sound(struct monst *) NONNULLARG1; +extern int domonnoise(struct monst *) NONNULLARG1; +extern int dotalk(void); +extern int tiphat(void); #ifdef USER_SOUNDS -E int FDECL(add_sound_mapping, (const char *)); -E void FDECL(play_sound_for_message, (const char *)); -#endif - -/* ### sys.c ### */ - -E void NDECL(sys_early_init); -E void NDECL(sysopt_release); -E void FDECL(sysopt_seduce_set, (int)); - -/* ### sys/msdos/sound.c ### */ - -#ifdef MSDOS -E int FDECL(assign_soundcard, (char *)); -#endif +extern int add_sound_mapping(const char *) NONNULLARG1; +extern void play_sound_for_message(const char *) NONNULLARG1; +extern void maybe_play_sound(const char *) NONNULLARG1; +extern void release_sound_mappings(void); +#if defined(WIN32) || defined(QT_GRAPHICS) +extern void play_usersound(const char *, int); +#endif +#if defined(TTY_SOUND_ESCCODES) +extern void play_usersound_via_idx(int, int); +#endif +#endif /* USER SOUNDS */ +extern void assign_soundlib(int); +extern void activate_chosen_soundlib(void); +extern void get_soundlib_name(char *dest, int maxlen) NONNULLARG1; +#ifdef SND_SOUNDEFFECTS_AUTOMAP +extern char *get_sound_effect_filename(int32_t seidint, + char *buf, size_t bufsz, int32_t); +#endif +extern char *base_soundname_to_filename(char *, char *, size_t, int32_t) NONNULLARG1; +extern void set_voice(struct monst *, int32_t, int32_t, int32_t) NO_NNARGS; +extern void sound_speak(const char *) NO_NNARGS; +extern enum soundlib_ids soundlib_id_from_opt(char *); /* ### sp_lev.c ### */ -E boolean FDECL(check_room, (xchar *, xchar *, xchar *, xchar *, BOOLEAN_P)); -E boolean FDECL(create_room, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, - XCHAR_P, XCHAR_P, XCHAR_P)); -E void FDECL(create_secret_door, (struct mkroom *, XCHAR_P)); -E boolean -FDECL(dig_corridor, (coord *, coord *, BOOLEAN_P, SCHAR_P, SCHAR_P)); -E void FDECL(fill_room, (struct mkroom *, BOOLEAN_P)); -E boolean FDECL(load_special, (const char *)); -E xchar FDECL(selection_getpoint, (int, int, struct opvar *)); -E struct opvar *FDECL(selection_opvar, (char *)); -E void FDECL(opvar_free_x, (struct opvar *)); -E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int)))); -E void FDECL(selection_floodfill, (struct opvar *, int, int, BOOLEAN_P)); +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +extern boolean match_maptyps(xint16, xint16); +extern void create_des_coder(void); +extern void reset_xystart_size(void); +extern struct mapfragment *mapfrag_fromstr(char *) NONNULLARG1; +extern void mapfrag_free(struct mapfragment **) NO_NNARGS; +extern schar mapfrag_get(struct mapfragment *, int, int) NONNULLARG1; +extern boolean mapfrag_canmatch(struct mapfragment *) NONNULLARG1; +extern const char * mapfrag_error(struct mapfragment *) NO_NNARGS; +extern boolean mapfrag_match(struct mapfragment *, int, int) NONNULLARG1; +extern void flip_level(int, boolean); +extern void flip_level_rnd(int, boolean); +extern boolean check_room(coordxy *, coordxy *, coordxy *, coordxy *, boolean) NONNULLPTRS; +extern boolean create_room(coordxy, coordxy, coordxy, coordxy, + coordxy, coordxy, xint16, xint16); +extern boolean dig_corridor(coord *, coord *, int *, boolean, schar, schar) NONNULLARG12; +extern void fill_special_room(struct mkroom *) NO_NNARGS; +extern void wallify_map(coordxy, coordxy, coordxy, coordxy); +extern boolean load_special(const char *) NONNULLARG1; +extern coordxy random_wdir(void); +extern boolean pm_good_location(coordxy, coordxy, struct permonst *) NONNULLARG3; +extern void get_location_coord(coordxy *, coordxy *, int, struct mkroom *, + long) NONNULLARG12; +extern void set_floodfillchk_match_under(coordxy); +extern int lspo_reset_level(lua_State *) NO_NNARGS; /* wiz_load_splua NULL */ +/* lspo_finalize_level() has tests for whether arg1 L is null, and chooses + code paths to follow based on that. Also preventing NONNULLARG1 is it + being called from wiz_load_splua() with a NULL arg. + Side note: The parameter is also marked as UNUSED, but apparently it is */ +extern int lspo_finalize_level(lua_State *) NO_NNARGS; +extern boolean get_coord(lua_State *, int, lua_Integer *, lua_Integer *) NONNULLPTRS; +extern void cvt_to_abscoord(coordxy *, coordxy *) NONNULLPTRS; +extern void cvt_to_relcoord(coordxy *, coordxy *) NONNULLPTRS; +extern int nhl_abs_coord(lua_State *) NONNULLARG1; +extern void update_croom(void); +extern const char *get_trapname_bytype(int); +extern void l_register_des(lua_State *) NONNULLARG1; +extern int get_table_objclass(lua_State *) NONNULLARG1; +extern int get_table_objtype(lua_State *) NONNULLARG1; +#endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ /* ### spell.c ### */ -E void FDECL(book_cursed, (struct obj *)); -#ifdef USE_TRAMPOLI -E int NDECL(learn); -#endif -E int FDECL(study_book, (struct obj *)); -E void FDECL(book_disappears, (struct obj *)); -E void FDECL(book_substitution, (struct obj *, struct obj *)); -E void NDECL(age_spells); -E int NDECL(docast); -E int FDECL(spell_skilltype, (int)); -E int FDECL(spelleffects, (int, BOOLEAN_P)); -E int FDECL(tport_spell, (int)); -E void NDECL(losespells); -E int NDECL(dovspell); -E void FDECL(initialspell, (struct obj *)); +extern void book_cursed(struct obj *) NONNULLARG1; +extern int study_book(struct obj *) NONNULLARG1; +extern void book_disappears(struct obj *) NONNULLARG1; +extern void book_substitution(struct obj *, struct obj *) NONNULLARG12; +extern void age_spells(void); +extern int dowizcast(void); +extern int docast(void); +extern int spell_skilltype(int); +extern int spelleffects(int, boolean, boolean); +extern int tport_spell(int); +extern void losespells(void); +extern int dovspell(void); +extern void show_spells(void); +extern void initialspell(struct obj *) NONNULLARG1; +extern int known_spell(short); +extern int spell_idx(short); +extern char force_learn_spell(short); +extern int num_spells(void); +extern void skill_based_spellbook_id(void); + +/* ### stairs.c ### */ + +extern void stairway_add(coordxy, coordxy, + boolean, boolean, d_level *) NONNULLPTRS; +extern void stairway_free_all(void); +extern stairway *stairway_at(coordxy, coordxy); +extern stairway *stairway_find(d_level *) NONNULLARG1; +extern stairway *stairway_find_from(d_level *, boolean) NONNULLARG1; +extern stairway *stairway_find_dir(boolean); +extern stairway *stairway_find_type_dir(boolean, boolean); +extern stairway *stairway_find_special_dir(boolean); +extern void u_on_sstairs(int); +extern void u_on_upstairs(void); +extern void u_on_dnstairs(void); +extern boolean On_stairs(coordxy, coordxy); +extern boolean On_ladder(coordxy, coordxy); +extern boolean On_stairs_up(coordxy, coordxy); +extern boolean On_stairs_dn(coordxy, coordxy); +extern boolean known_branch_stairs(stairway *); +extern char *stairs_description(stairway *, char *, boolean) NONNULLARG1; /* ### steal.c ### */ -#ifdef USE_TRAMPOLI -E int NDECL(stealarm); -#endif -E long FDECL(somegold, (long)); -E void FDECL(stealgold, (struct monst *)); -E void FDECL(remove_worn_item, (struct obj *, BOOLEAN_P)); -E int FDECL(steal, (struct monst *, char *)); -E int FDECL(mpickobj, (struct monst *, struct obj *)); -E void FDECL(stealamulet, (struct monst *)); -E void FDECL(maybe_absorb_item, (struct monst *, struct obj *, int, int)); -E void FDECL(mdrop_obj, (struct monst *, struct obj *, BOOLEAN_P)); -E void FDECL(mdrop_special_objs, (struct monst *)); -E void FDECL(relobj, (struct monst *, int, BOOLEAN_P)); -E struct obj *FDECL(findgold, (struct obj *)); +extern long somegold(long); +extern void stealgold(struct monst *) NONNULLARG1; +extern void thiefdead(void); +extern boolean unresponsive(void); +extern void remove_worn_item(struct obj *, boolean) NONNULLARG1; +extern int steal(struct monst *, char *) NONNULLARG1; +/* mpickobj() contains a test for NULL arg2 obj and a code path + that leads to impossible(). Prevents NONNULLARG12. */ +extern int mpickobj(struct monst *, struct obj *) NONNULLARG1; +extern void stealamulet(struct monst *) NONNULLARG1; +extern void maybe_absorb_item(struct monst *, struct obj *, int, int) NONNULLARG12; +extern void mdrop_obj(struct monst *, struct obj *, boolean) NONNULLARG12; +extern void mdrop_special_objs(struct monst *) NONNULLARG1; +extern void relobj(struct monst *, int, boolean) NONNULLARG1; +extern struct obj *findgold(struct obj *) NO_NNARGS; /* ### steed.c ### */ -E void NDECL(rider_cant_reach); -E boolean FDECL(can_saddle, (struct monst *)); -E int FDECL(use_saddle, (struct obj *)); -E void FDECL(put_saddle_on_mon, (struct obj *, struct monst *)); -E boolean FDECL(can_ride, (struct monst *)); -E int NDECL(doride); -E boolean FDECL(mount_steed, (struct monst *, BOOLEAN_P)); -E void NDECL(exercise_steed); -E void NDECL(kick_steed); -E void FDECL(dismount_steed, (int)); -E void FDECL(place_monster, (struct monst *, int, int)); -E boolean FDECL(stucksteed, (BOOLEAN_P)); +extern void rider_cant_reach(void); +extern boolean can_saddle(struct monst *) NONNULLARG1; +extern int use_saddle(struct obj *) NONNULLARG1; +extern void put_saddle_on_mon(struct obj *, struct monst *) NONNULLARG2; +extern boolean can_ride(struct monst *) NONNULLARG1; +extern int doride(void); +extern boolean mount_steed(struct monst *, boolean) NO_NNARGS; +extern void exercise_steed(void); +extern void kick_steed(void); +extern void dismount_steed(int); +extern void place_monster(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void poly_steed(struct monst *, struct permonst *) NONNULLARG12; +extern boolean stucksteed(boolean); + +/* ### symbols.c ### */ + +extern void switch_symbols(int); +extern void assign_graphics(int); +extern void init_symbols(void); +extern void init_showsyms(void); +extern void init_primary_symbols(void); +extern void init_rogue_symbols(void); +extern void init_ov_primary_symbols(void); +extern void init_ov_rogue_symbols(void); +extern void clear_symsetentry(int, boolean); +extern void update_primary_symset(const struct symparse *, int) NONNULLARG1; +extern void update_rogue_symset(const struct symparse *, int) NONNULLARG1; +extern void update_ov_primary_symset(const struct symparse *, int) NONNULLARG1; +extern void update_ov_rogue_symset(const struct symparse *, int) NONNULLARG1; +extern int parse_sym_line(char *, int) NONNULLARG1; +extern nhsym get_othersym(int, int); +extern boolean symset_is_compatible(enum symset_handling_types, unsigned long); +extern void set_symhandling(char *handling, int which_set) NONNULLARG1; +extern boolean proc_symset_line(char *) NONNULLARG1; +extern int do_symset(boolean); +extern int load_symset(const char *, int) NONNULLARG1; +extern void free_symsets(void); +extern const struct symparse *match_sym(char *) NONNULLARG1; +extern void savedsym_free(void); +extern void savedsym_strbuf(strbuf_t *) NONNULLARG1; +extern boolean parsesymbols(char *, int) NONNULLARG1; + +/* ### sys.c ### */ + +extern void sys_early_init(void); +extern void sysopt_release(void); +extern void sysopt_seduce_set(int); /* ### teleport.c ### */ -E boolean FDECL(goodpos, (int, int, struct monst *, unsigned)); -E boolean FDECL(enexto, (coord *, XCHAR_P, XCHAR_P, struct permonst *)); -E boolean FDECL(enexto_core, (coord *, XCHAR_P, XCHAR_P, - struct permonst *, unsigned)); -E void FDECL(teleds, (int, int, BOOLEAN_P)); -E boolean FDECL(safe_teleds, (BOOLEAN_P)); -E boolean FDECL(teleport_pet, (struct monst *, BOOLEAN_P)); -E void NDECL(tele); -E boolean FDECL(scrolltele, (struct obj *)); -E int NDECL(dotelecmd); -E int FDECL(dotele, (BOOLEAN_P)); -E void NDECL(level_tele); -E void FDECL(domagicportal, (struct trap *)); -E void FDECL(tele_trap, (struct trap *)); -E void FDECL(level_tele_trap, (struct trap *, unsigned)); -E void FDECL(rloc_to, (struct monst *, int, int)); -E boolean FDECL(rloc, (struct monst *, BOOLEAN_P)); -E boolean FDECL(tele_restrict, (struct monst *)); -E void FDECL(mtele_trap, (struct monst *, struct trap *, int)); -E int FDECL(mlevel_tele_trap, (struct monst *, struct trap *, - BOOLEAN_P, int)); -E boolean FDECL(rloco, (struct obj *)); -E int NDECL(random_teleport_level); -E boolean FDECL(u_teleport_mon, (struct monst *, BOOLEAN_P)); - -/* ### tile.c ### */ -#ifdef USE_TILES -E void FDECL(substitute_tiles, (d_level *)); -#endif +extern boolean noteleport_level(struct monst *) NONNULLARG1; +/* rloc_engr() passes NULL monst arg to goodpos()*/ +extern boolean goodpos(coordxy, coordxy, struct monst *, + mmflags_nht) NO_NNARGS; +extern boolean enexto(coord *, coordxy, coordxy, + struct permonst *) NONNULLARG1; +extern boolean enexto_gpflags(coord *, coordxy, coordxy, struct permonst *, + mmflags_nht) NONNULLARG1; +extern boolean enexto_core(coord *, coordxy, coordxy, struct permonst *, + mmflags_nht) NONNULLARG1; +extern void teleds(coordxy, coordxy, int); +extern int collect_coords(coord *, coordxy, coordxy, int, unsigned, + boolean (*)(coordxy, coordxy)) NONNULLARG1; +extern boolean safe_teleds(int); +extern boolean teleport_pet(struct monst *, boolean) NONNULLARG1; +extern void tele_to_rnd_pet(void); +extern void tele(void); +extern void scrolltele(struct obj *) NO_NNARGS; +extern int dotelecmd(void); +extern int dotele(boolean); +extern void level_tele(void); +extern void domagicportal(struct trap *) NONNULLARG1; +extern void tele_trap(struct trap *) NONNULLARG1; +extern void level_tele_trap(struct trap *, unsigned) NONNULLARG1; +extern void rloc_to(struct monst *, coordxy, coordxy) NONNULLARG1; +extern void rloc_to_flag(struct monst *, coordxy, coordxy, + unsigned) NONNULLARG1; +extern boolean rloc(struct monst *, unsigned) NONNULLARG1; +extern boolean control_mon_tele(struct monst *, coord *cc, unsigned, + boolean) NONNULLARG1; +extern boolean tele_restrict(struct monst *) NONNULLARG1; +extern void mtele_trap(struct monst *, struct trap *, int) NONNULLARG12; +extern int mlevel_tele_trap(struct monst *, struct trap *, + boolean, int) NONNULLARG1; +extern boolean rloco(struct obj *) NONNULLARG1; +extern int random_teleport_level(void); +extern boolean u_teleport_mon(struct monst *, boolean) NONNULLARG1; /* ### timeout.c ### */ -E void NDECL(burn_away_slime); -E void NDECL(nh_timeout); -E void FDECL(fall_asleep, (int, BOOLEAN_P)); -E void FDECL(attach_egg_hatch_timeout, (struct obj *, long)); -E void FDECL(attach_fig_transform_timeout, (struct obj *)); -E void FDECL(kill_egg, (struct obj *)); -E void FDECL(hatch_egg, (ANY_P *, long)); -E void FDECL(learn_egg_type, (int)); -E void FDECL(burn_object, (ANY_P *, long)); -E void FDECL(begin_burn, (struct obj *, BOOLEAN_P)); -E void FDECL(end_burn, (struct obj *, BOOLEAN_P)); -E void NDECL(do_storms); -E boolean FDECL(start_timer, (long, SHORT_P, SHORT_P, ANY_P *)); -E long FDECL(stop_timer, (SHORT_P, ANY_P *)); -E long FDECL(peek_timer, (SHORT_P, ANY_P *)); -E void NDECL(run_timers); -E void FDECL(obj_move_timers, (struct obj *, struct obj *)); -E void FDECL(obj_split_timers, (struct obj *, struct obj *)); -E void FDECL(obj_stop_timers, (struct obj *)); -E boolean FDECL(obj_has_timer, (struct obj *, SHORT_P)); -E void FDECL(spot_stop_timers, (XCHAR_P, XCHAR_P, SHORT_P)); -E long FDECL(spot_time_expires, (XCHAR_P, XCHAR_P, SHORT_P)); -E long FDECL(spot_time_left, (XCHAR_P, XCHAR_P, SHORT_P)); -E boolean FDECL(obj_is_local, (struct obj *)); -E void FDECL(save_timers, (int, int, int)); -E void FDECL(restore_timers, (int, int, BOOLEAN_P, long)); -E void FDECL(timer_stats, (const char *, char *, long *, long *)); -E void FDECL(relink_timers, (BOOLEAN_P)); -E int NDECL(wiz_timeout_queue); -E void NDECL(timer_sanity_check); +extern const char *property_by_index(int, int *) NO_NNARGS; +extern void burn_away_slime(void); +extern void nh_timeout(void); +extern void fall_asleep(int, boolean); +extern void attach_egg_hatch_timeout(struct obj *, long) NONNULLARG1; +extern void attach_fig_transform_timeout(struct obj *) NONNULLARG1; +extern void kill_egg(struct obj *) NONNULLARG1; +extern void hatch_egg(union any *, long) NONNULLARG1; +extern void learn_egg_type(int); +extern void burn_object(union any *, long) NONNULLARG1; +extern void begin_burn(struct obj *, boolean) NONNULLARG1; +extern void end_burn(struct obj *, boolean) NONNULLARG1; +extern void do_storms(void); +extern boolean start_timer(long, short, short, union any *) NONNULLARG4; +extern long stop_timer(short, union any *) NONNULLARG2; +extern long peek_timer(short, union any *) NONNULLARG2; +extern void run_timers(void); +extern void obj_move_timers(struct obj *, struct obj *) NONNULLARG12; +extern void obj_split_timers(struct obj *, struct obj *) NONNULLARG12; +extern void obj_stop_timers(struct obj *) NONNULLARG1; +extern boolean obj_has_timer(struct obj *, short) NONNULLARG1; +extern void spot_stop_timers(coordxy, coordxy, short); +extern long spot_time_expires(coordxy, coordxy, short); +extern long spot_time_left(coordxy, coordxy, short); +extern boolean obj_is_local(struct obj *) NONNULLARG1; +extern void save_timers(NHFILE *, int) NONNULLARG1; +extern void restore_timers(NHFILE *, int, long) NONNULLARG1; +extern void timer_stats(const char *, char *, long *, long *) NONNULLPTRS; +extern void relink_timers(boolean); +extern int wiz_timeout_queue(void); +extern void timer_sanity_check(void); /* ### topten.c ### */ -E void FDECL(formatkiller, (char *, unsigned, int, BOOLEAN_P)); -E int FDECL(observable_depth, (d_level *)); -E void FDECL(topten, (int, time_t)); -E void FDECL(prscore, (int, char **)); -E struct toptenentry *NDECL(get_rnd_toptenentry); -E struct obj *FDECL(tt_oname, (struct obj *)); +extern void formatkiller(char *, unsigned, int, boolean) NONNULLARG1; +extern int observable_depth(d_level *) NONNULLARG1; +extern void topten(int, time_t); +extern void prscore(int, char **); +extern struct toptenentry *get_rnd_toptenentry(void); +extern struct obj *tt_oname(struct obj *) NO_NNARGS; +extern int tt_doppel(struct monst *) NONNULLARG1; /* ### track.c ### */ -E void NDECL(initrack); -E void NDECL(settrack); -E coord *FDECL(gettrack, (int, int)); +extern void initrack(void); +extern void settrack(void); +extern coord *gettrack(coordxy, coordxy); +extern boolean hastrack(coordxy, coordxy); +extern void save_track(NHFILE *) NONNULLARG1; +extern void rest_track(NHFILE *) NONNULLARG1; /* ### trap.c ### */ -E boolean FDECL(burnarmor, (struct monst *)); -E int FDECL(erode_obj, (struct obj *, const char *, int, int)); -E boolean FDECL(grease_protect, (struct obj *, const char *, struct monst *)); -E struct trap *FDECL(maketrap, (int, int, int)); -E void FDECL(fall_through, (BOOLEAN_P, unsigned)); -E struct monst *FDECL(animate_statue, - (struct obj *, XCHAR_P, XCHAR_P, int, int *)); -E struct monst *FDECL(activate_statue_trap, - (struct trap *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(set_utrap, (unsigned, unsigned)); -E void FDECL(reset_utrap, (BOOLEAN_P)); -E void FDECL(dotrap, (struct trap *, unsigned)); -E void FDECL(seetrap, (struct trap *)); -E void FDECL(feeltrap, (struct trap *)); -E int FDECL(mintrap, (struct monst *)); -E void FDECL(instapetrify, (const char *)); -E void FDECL(minstapetrify, (struct monst *, BOOLEAN_P)); -E void FDECL(selftouch, (const char *)); -E void FDECL(mselftouch, (struct monst *, const char *, BOOLEAN_P)); -E void NDECL(float_up); -E void FDECL(fill_pit, (int, int)); -E int FDECL(float_down, (long, long)); -E void NDECL(climb_pit); -E boolean FDECL(fire_damage, (struct obj *, BOOLEAN_P, XCHAR_P, XCHAR_P)); -E int FDECL(fire_damage_chain, - (struct obj *, BOOLEAN_P, BOOLEAN_P, XCHAR_P, XCHAR_P)); -E boolean FDECL(lava_damage, (struct obj *, XCHAR_P, XCHAR_P)); -E void acid_damage(struct obj *); -E int FDECL(water_damage, (struct obj *, const char *, BOOLEAN_P)); -E void FDECL(water_damage_chain, (struct obj *, BOOLEAN_P)); -E boolean NDECL(drown); -E void FDECL(drain_en, (int)); -E int NDECL(dountrap); -E void FDECL(cnv_trap_obj, (int, int, struct trap *, BOOLEAN_P)); -E int FDECL(untrap, (BOOLEAN_P)); -E boolean FDECL(openholdingtrap, (struct monst *, boolean *)); -E boolean FDECL(closeholdingtrap, (struct monst *, boolean *)); -E boolean FDECL(openfallingtrap, (struct monst *, BOOLEAN_P, boolean *)); -E boolean FDECL(chest_trap, (struct obj *, int, BOOLEAN_P)); -E void FDECL(deltrap, (struct trap *)); -E boolean FDECL(delfloortrap, (struct trap *)); -E struct trap *FDECL(t_at, (int, int)); -E void FDECL(b_trapped, (const char *, int)); -E boolean NDECL(unconscious); -E void FDECL(blow_up_landmine, (struct trap *)); -E int FDECL(launch_obj, (SHORT_P, int, int, int, int, int)); -E boolean NDECL(launch_in_progress); -E void NDECL(force_launch_placement); -E boolean FDECL(uteetering_at_seen_pit, (struct trap *)); -E boolean FDECL(uescaped_shaft, (struct trap *)); -E boolean NDECL(lava_effects); -E void NDECL(sink_into_lava); -E void NDECL(sokoban_guilt); +extern boolean burnarmor(struct monst *) NO_NNARGS; +extern int erode_obj(struct obj *, const char *, int, int) NO_NNARGS; +extern boolean grease_protect(struct obj *, const char *, + struct monst *) NONNULLARG1; +extern struct trap *maketrap(coordxy, coordxy, int); +extern d_level *clamp_hole_destination(d_level *) NONNULLARG1; +extern void fall_through(boolean, unsigned); +extern struct monst *animate_statue(struct obj *, coordxy, coordxy, + int, int *) NONNULLARG1; +extern struct monst *activate_statue_trap(struct trap *, coordxy, coordxy, + boolean) NONNULLARG1; +extern int immune_to_trap(struct monst *, unsigned) NO_NNARGS; /* revisit */ +extern void set_utrap(unsigned, unsigned); +extern void reset_utrap(boolean); +extern boolean wearing_iron_shoes(struct monst *); +extern boolean m_harmless_trap(struct monst *, struct trap *) NONNULLPTRS; +extern void dotrap(struct trap *, unsigned) NONNULLARG1; +extern void seetrap(struct trap *) NONNULLARG1; +extern void feeltrap(struct trap *) NONNULLARG1; +extern int mintrap(struct monst *, unsigned) NONNULLARG1; +extern void instapetrify(const char *) NO_NNARGS; +extern void minstapetrify(struct monst *, boolean) NONNULLARG1; +extern void selftouch(const char *) NONNULLARG1; +extern void mselftouch(struct monst *, const char *, boolean) NONNULLARG1; +extern void float_up(void); +extern void fill_pit(coordxy, coordxy); +extern int float_down(long, long); +extern void climb_pit(void); +extern boolean fire_damage(struct obj *, boolean, + coordxy, coordxy) NONNULLARG1; +extern int fire_damage_chain(struct obj *, boolean, boolean, + coordxy, coordxy) NO_NNARGS; +extern boolean lava_damage(struct obj *, coordxy, coordxy) NONNULLARG1; +/* acid_damage() has a test for NULL arg and early return if so, + preventing NONNULLARG1 */ +extern void acid_damage(struct obj *) NO_NNARGS; +extern int water_damage(struct obj *, const char *, boolean) NO_NNARGS; +extern void water_damage_chain(struct obj *, boolean) NO_NNARGS; +extern boolean rnd_nextto_goodpos(coordxy *, coordxy *, + struct monst *) NONNULLPTRS; +extern void back_on_ground(boolean); +extern void rescued_from_terrain(int); +extern boolean drown(void); +extern void drain_en(int, boolean); +extern int dountrap(void); +extern int could_untrap(boolean, boolean); +extern void cnv_trap_obj(int, int, struct trap *, boolean) NONNULLARG3; +extern boolean into_vs_onto(int); +extern int untrap(boolean, coordxy, coordxy, struct obj *) NO_NNARGS; +extern boolean openholdingtrap(struct monst *, boolean *) NO_NNARGS; +extern boolean closeholdingtrap(struct monst *, boolean *) NO_NNARGS; +extern boolean openfallingtrap(struct monst *, boolean, boolean *) NONNULLARG3; +extern boolean chest_trap(struct obj *, int, boolean) NONNULLARG1; +extern void deltrap(struct trap *) NONNULLARG1; +extern boolean delfloortrap(struct trap *) NO_NNARGS; +extern struct trap *t_at(coordxy, coordxy); +extern int count_traps(int); +extern void b_trapped(const char *, int) NONNULLARG1; +extern boolean unconscious(void); +extern void blow_up_landmine(struct trap *) NONNULLARG1; +extern int launch_obj(short, coordxy, coordxy, coordxy, coordxy, int); +extern boolean launch_in_progress(void); +extern void force_launch_placement(void); +extern boolean uteetering_at_seen_pit(struct trap *) NO_NNARGS; +extern boolean uescaped_shaft(struct trap *) NO_NNARGS; +extern boolean lava_effects(void); +extern void sink_into_lava(void); +extern void sokoban_guilt(void); +extern const char * trapname(int, boolean); +extern void ignite_items(struct obj *) NO_NNARGS; +extern void trap_ice_effects(coordxy x, coordxy y, boolean ice_is_melting); +extern void trap_sanity_check(void); /* ### u_init.c ### */ -E void NDECL(u_init); +extern void u_init_misc(void); +extern void u_init_inventory_attrs(void); +extern void u_init_skills_discoveries(void); /* ### uhitm.c ### */ -E void FDECL(erode_armor, (struct monst *, int)); -E boolean FDECL(attack_checks, (struct monst *, struct obj *)); -E void FDECL(check_caitiff, (struct monst *)); -E int FDECL(find_roll_to_hit, (struct monst *, UCHAR_P, struct obj *, - int *, int *)); -E boolean FDECL(attack, (struct monst *)); -E boolean FDECL(hmon, (struct monst *, struct obj *, int, int)); -E boolean FDECL(shade_miss, (struct monst *, struct monst *, struct obj *, - BOOLEAN_P, BOOLEAN_P)); -E int FDECL(damageum, (struct monst *, struct attack *, int)); -E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P)); -E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int, - UCHAR_P, BOOLEAN_P)); -E void FDECL(passive_obj, (struct monst *, struct obj *, struct attack *)); -E void FDECL(stumble_onto_mimic, (struct monst *)); -E int FDECL(flash_hits_mon, (struct monst *, struct obj *)); -E void FDECL(light_hits_gremlin, (struct monst *, int)); +extern void dynamic_multi_reason(struct monst *, const char *, boolean) NONNULLARG12; +extern void erode_armor(struct monst *, int) NONNULLARG1; +extern boolean attack_checks(struct monst *, struct obj *) NONNULLARG1; +extern void check_caitiff(struct monst *) NONNULLARG1; +extern void mon_maybe_unparalyze(struct monst *) NONNULLARG1; +extern int find_roll_to_hit(struct monst *, uchar, struct obj *, + int *, int *) NONNULLARG145; +extern boolean force_attack(struct monst *, boolean) NONNULLARG1; +extern boolean do_attack(struct monst *) NONNULLARG1; +extern boolean hmon(struct monst *, struct obj *, int, int) NONNULLARG1; +extern boolean shade_miss(struct monst *, struct monst *, struct obj *, + boolean, boolean) NONNULLARG12; +extern void mhitm_ad_rust(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_corr(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_dcay(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_dren(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_drli(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_fire(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_cold(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_elec(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_acid(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_sgld(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_tlpt(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +/* gazemm() calls mhitm_ad_blnd with a NULL 4th arg */ +extern void mhitm_ad_blnd(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLARG123; +extern void mhitm_ad_curs(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_drst(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_drin(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_stck(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_wrap(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_plys(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_slee(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_slim(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_ench(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_slow(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_conf(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_poly(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_famn(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_pest(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_deth(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_halu(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_phys(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_ston(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_were(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_heal(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_stun(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_legs(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_dgst(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_samu(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_dise(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_sedu(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_ad_ssex(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern void mhitm_adtyping(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLPTRS; +extern boolean do_stone_u(struct monst *) NONNULLARG1; +extern void do_stone_mon(struct monst *, struct attack *, struct monst *, + struct mhitm_data *) NONNULLARG134; +extern int damageum(struct monst *, struct attack *, int) NONNULLARG12; +/* domove_fight_empty passes NULL to explum arg1 */ +extern int explum(struct monst *, struct attack *) NONNULLARG2; +extern void missum(struct monst *, struct attack *, boolean) NONNULLARG12; +extern boolean m_is_steadfast(struct monst *) NONNULLARG1; +extern boolean mhitm_knockback(struct monst *, struct monst *,struct attack *, + int *, boolean) NONNULLPTRS; +extern int passive(struct monst *, struct obj *, boolean, boolean, uchar, + boolean) NONNULLARG1; +extern void passive_obj(struct monst *, struct obj *, struct attack *) NONNULLARG1; +extern void that_is_a_mimic(struct monst *, unsigned) NONNULLARG1; +extern void stumble_onto_mimic(struct monst *) NONNULLARG1; +extern boolean disguised_as_non_mon(struct monst *) NONNULLARG1; +extern boolean disguised_as_mon(struct monst *) NONNULLARG1; +extern int flash_hits_mon(struct monst *, struct obj *) NONNULLARG12; +extern void light_hits_gremlin(struct monst *, int) NONNULLARG1; -/* ### unixmain.c ### */ +/* ### unixmain.c ### */ #ifdef UNIX #ifdef PORT_HELP -E void NDECL(port_help); -#endif -E void FDECL(sethanguphandler, (void (*)(int))); -E boolean NDECL(authorize_wizard_mode); -E boolean FDECL(check_user_string, (char *)); -E char *NDECL(get_login_name); +extern void port_help(void); +#endif +extern void sethanguphandler(void(*)(int)); +extern boolean authorize_wizard_mode(void); +extern boolean authorize_explore_mode(void); +extern void append_slash(char *) NONNULLARG1; +extern boolean check_user_string(const char *) NONNULLARG1; +extern char *get_login_name(void); +extern unsigned long sys_random_seed(void); #endif /* UNIX */ +ATTRNORETURN extern void after_opt_showpaths(const char *) NORETURN; /* ### unixtty.c ### */ #if defined(UNIX) || defined(__BEOS__) -E void NDECL(gettty); -E void FDECL(settty, (const char *)); -E void NDECL(setftty); -E void NDECL(intron); -E void NDECL(introff); -/* GCC's libc has error() */ +extern void gettty(void); +extern void settty(const char *) NO_NNARGS; +extern void setftty(void); +extern void intron(void); +extern void introff(void); +/* NLE: GCC's libc has error() */ #ifdef error #undef error #endif -E void VDECL(error, (const char *, ...)) PRINTF_F(1, 2); +ATTRNORETURN extern void error(const char *, ...) PRINTF_F(1, 2) NORETURN; +#ifdef ENHANCED_SYMBOLS +extern void tty_utf8graphics_fixup(void); +#endif #endif /* UNIX || __BEOS__ */ /* ### unixunix.c ### */ #ifdef UNIX -E void NDECL(getlock); -E void FDECL(regularize, (char *)); +extern void getlock(void); +extern void ask_about_panic_save(void); +extern void regularize(char *) NONNULLARG1; #if defined(TIMED_DELAY) && !defined(msleep) && defined(SYSV) -E void FDECL(msleep, (unsigned)); +extern void msleep(unsigned); #endif #ifdef SHELL -E int NDECL(dosh); +extern int dosh(void); #endif /* SHELL */ #if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER) -E int FDECL(child, (int)); +extern int child(int); #endif #ifdef PANICTRACE -E boolean FDECL(file_exists, (const char *)); +extern boolean file_exists(const char *) NONNULLARG1; #endif #endif /* UNIX */ @@ -2635,386 +3533,516 @@ E boolean FDECL(file_exists, (const char *)); #ifdef UNIX #ifdef GNOME_GRAPHICS -E int FDECL(hide_privileges, (BOOLEAN_P)); +extern int hide_privileges(boolean); #endif #endif /* UNIX */ +/* ### utf8map.c ### */ + +#ifdef ENHANCED_SYMBOLS +extern char *mixed_to_utf8(char *buf, size_t bufsz, const char *str, + int *) NONNULLARG1; +void free_all_glyphmap_u(void); +int set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str) NONNULLPTRS; +#endif /* ENHANCED_SYMBOLS */ +extern void reset_customsymbols(void); + /* ### vault.c ### */ -E void FDECL(newegd, (struct monst *)); -E void FDECL(free_egd, (struct monst *)); -E boolean FDECL(grddead, (struct monst *)); -E struct monst *NDECL(findgd); -E void NDECL(vault_summon_gd); -E char FDECL(vault_occupied, (char *)); -E void FDECL(uleftvault, (struct monst *)); -E void NDECL(invault); -E int FDECL(gd_move, (struct monst *)); -E void FDECL(paygd, (BOOLEAN_P)); -E long NDECL(hidden_gold); -E boolean NDECL(gd_sound); -E void FDECL(vault_gd_watching, (unsigned int)); +extern void newegd(struct monst *) NONNULLARG1; +extern void free_egd(struct monst *) NONNULLARG1; +extern boolean grddead(struct monst *) NONNULLARG1; +extern struct monst *findgd(void); +extern void vault_summon_gd(void); +extern char vault_occupied(char *) NONNULLARG1; +extern void uleftvault(struct monst *); /* NULL leads to impossible() */ +extern void invault(void); +extern int gd_move(struct monst *) NONNULLARG1; +extern void paygd(boolean); +extern long hidden_gold(boolean); +extern boolean gd_sound(void); +extern void vault_gd_watching(unsigned int); /* ### version.c ### */ -E char *FDECL(version_string, (char *)); -E char *FDECL(getversionstring, (char *)); -E int NDECL(doversion); -E int NDECL(doextversion); +extern char *version_string(char *, size_t bufsz) NONNULL NONNULLARG1; +extern char *getversionstring(char *, size_t bufsz) NONNULL NONNULLARG1; +extern char *status_version(char *, size_t, boolean) NONNULL NONNULLARG1; +extern int doversion(void); +extern int doextversion(void); #ifdef MICRO -E boolean FDECL(comp_times, (long)); -#endif -E boolean -FDECL(check_version, (struct version_info *, const char *, BOOLEAN_P)); -E boolean FDECL(uptodate, (int, const char *)); -E void FDECL(store_version, (int)); -E unsigned long FDECL(get_feature_notice_ver, (char *)); -E unsigned long NDECL(get_current_feature_ver); -E const char *FDECL(copyright_banner_line, (int)); -E void FDECL(early_version_info, (BOOLEAN_P)); - -#ifdef RUNTIME_PORT_ID -E char *FDECL(get_port_id, (char *)); -#endif -#ifdef RUNTIME_PASTEBUF_SUPPORT -E void FDECL(port_insert_pastebuf, (char *)); -#endif +extern boolean comp_times(long); +#endif +extern boolean check_version(struct version_info *, const char *, boolean, + unsigned long) NONNULLARG1; +extern int uptodate(NHFILE *, const char *, unsigned long) NONNULLARG1; +extern void store_version(NHFILE *) NONNULLARG1; +extern unsigned long get_feature_notice_ver(char *) NO_NNARGS; +extern unsigned long get_current_feature_ver(void); +extern const char *copyright_banner_line(int) NONNULL; +extern void early_version_info(boolean); +extern void dump_version_info(void); +extern void store_critical_bytes(NHFILE *) NONNULLARG1; +extern int compare_critical_bytes(NHFILE *, int *, unsigned long) NONNULLARG1; +extern int get_critical_size_count(void); +extern int validate(NHFILE *, const char *, boolean) NONNULLARG1; /* ### video.c ### */ #ifdef MSDOS -E int FDECL(assign_video, (char *)); +extern int assign_video(char *) NONNULLARG1; #ifdef NO_TERMS -E void NDECL(gr_init); -E void NDECL(gr_finish); +extern void gr_init(void); +extern void gr_finish(void); #endif -E void FDECL(tileview, (BOOLEAN_P)); +extern void tileview(boolean); #endif #ifdef VIDEOSHADES -E int FDECL(assign_videoshades, (char *)); -E int FDECL(assign_videocolors, (char *)); -#endif - -/* ### vis_tab.c ### */ - -#ifdef VISION_TABLES -E void NDECL(vis_tab_init); +extern int assign_videoshades(char *) NONNULLARG1; +extern int assign_videocolors(char *) NONNULLARG1; #endif /* ### vision.c ### */ -E void NDECL(vision_init); -E int FDECL(does_block, (int, int, struct rm *)); -E void NDECL(vision_reset); -E void FDECL(vision_recalc, (int)); -E void FDECL(block_point, (int, int)); -E void FDECL(unblock_point, (int, int)); -E boolean FDECL(clear_path, (int, int, int, int)); -E void FDECL(do_clear_area, (int, int, int, - void (*)(int, int, genericptr), genericptr_t)); -E unsigned FDECL(howmonseen, (struct monst *)); +extern boolean get_viz_clear(int, int); +extern void vision_init(void); +extern int does_block(int, int, struct rm *) NONNULLARG3; +extern void vision_reset(void); +extern void vision_recalc(int); +extern void block_point(int, int); +extern void unblock_point(int, int); +extern void recalc_block_point(coordxy, coordxy); +extern boolean clear_path(int, int, int, int); +extern void do_clear_area(coordxy, coordxy, int, + void(*)(coordxy, coordxy, void *), genericptr_t); +extern unsigned howmonseen(struct monst *) NONNULLARG1; #ifdef VMS /* ### vmsfiles.c ### */ -E int FDECL(vms_link, (const char *, const char *)); -E int FDECL(vms_unlink, (const char *)); -E int FDECL(vms_creat, (const char *, unsigned int)); -E int FDECL(vms_open, (const char *, int, unsigned int)); -E boolean FDECL(same_dir, (const char *, const char *)); -E int FDECL(c__translate, (int)); -E char *FDECL(vms_basename, (const char *)); +extern int vms_link(const char *, const char *); +extern int vms_unlink(const char *); +extern int vms_creat(const char *, unsigned int); +extern int vms_open(const char *, int, unsigned int); +extern boolean same_dir(const char *, const char *); +extern int c__translate(int); +extern char *vms_basename(const char *, boolean); /* ### vmsmail.c ### */ -E unsigned long NDECL(init_broadcast_trapping); -E unsigned long NDECL(enable_broadcast_trapping); -E unsigned long NDECL(disable_broadcast_trapping); +extern unsigned long init_broadcast_trapping(void); +extern unsigned long enable_broadcast_trapping(void); +extern unsigned long disable_broadcast_trapping(void); #if 0 -E struct mail_info *NDECL(parse_next_broadcast); +extern struct mail_info *parse_next_broadcast(void); #endif /*0*/ /* ### vmsmain.c ### */ -E int FDECL(main, (int, char **)); +extern int main(int, char **); #ifdef CHDIR -E void FDECL(chdirx, (const char *, BOOLEAN_P)); +extern void chdirx(const char *, boolean); #endif /* CHDIR */ -E void FDECL(sethanguphandler, (void (*)(int))); -E boolean NDECL(authorize_wizard_mode); +extern void sethanguphandler(void(*)(int)); +extern boolean authorize_wizard_mode(void); +extern boolean authorize_explore_mode(void); /* ### vmsmisc.c ### */ -E void NDECL(vms_abort) NORETURN; -E void FDECL(vms_exit, (int)) NORETURN; +ATTRNORETURN extern void vms_abort(void) NORETURN; +ATTRNORETURN extern void vms_exit(int) NORETURN; #ifdef PANICTRACE -E void FDECL(vms_traceback, (int)); +extern void vms_traceback(int); #endif /* ### vmstty.c ### */ -E int NDECL(vms_getchar); -E void NDECL(gettty); -E void FDECL(settty, (const char *)); -E void FDECL(shuttty, (const char *)); -E void NDECL(setftty); -E void NDECL(intron); -E void NDECL(introff); -E void VDECL(error, (const char *, ...)) PRINTF_F(1, 2); +extern int vms_getchar(void); +extern void gettty(void); +extern void settty(const char *); +extern void shuttty(const char *); +extern void setftty(void); +extern void intron(void); +extern void introff(void); +ATTRNORETURN extern void error (const char *, ...) PRINTF_F(1, 2) NORETURN; #ifdef TIMED_DELAY -E void FDECL(msleep, (unsigned)); +extern void msleep(unsigned); +#endif +#ifdef SIGWINCH +extern void getwindowsz(void); +#endif +#ifdef ENHANCED_SYMBOLS +extern void tty_utf8graphics_fixup(void); #endif /* ### vmsunix.c ### */ -E void NDECL(getlock); -E void FDECL(regularize, (char *)); -E int NDECL(vms_getuid); -E boolean FDECL(file_is_stmlf, (int)); -E int FDECL(vms_define, (const char *, const char *, int)); -E int FDECL(vms_putenv, (const char *)); -E char *NDECL(verify_termcap); +extern void getlock(void); +extern void regularize(char *); +extern int vms_getuid(void); +extern boolean file_is_stmlf(int); +extern int vms_define(const char *, const char *, int); +extern int vms_putenv(const char *); +extern char *verify_termcap(void); #if defined(CHDIR) || defined(SHELL) || defined(SECURE) -E void NDECL(privoff); -E void NDECL(privon); +extern void privoff(void); +extern void privon(void); +#endif +#ifdef SYSCF +extern boolean check_user_string(const char *); #endif #ifdef SHELL -E int NDECL(dosh); +extern int dosh(void); #endif #if defined(SHELL) || defined(MAIL) -E int FDECL(vms_doshell, (const char *, BOOLEAN_P)); +extern int vms_doshell(const char *, boolean); #endif #ifdef SUSPEND -E int NDECL(dosuspend); +extern int dosuspend(void); #endif #ifdef SELECTSAVED -E int FDECL(vms_get_saved_games, (const char *, char ***)); +extern int vms_get_saved_games(const char *, char ***); #endif #endif /* VMS */ /* ### weapon.c ### */ -E const char *FDECL(weapon_descr, (struct obj *)); -E int FDECL(hitval, (struct obj *, struct monst *)); -E int FDECL(dmgval, (struct obj *, struct monst *)); -E int FDECL(special_dmgval, (struct monst *, struct monst *, long, long *)); -E void FDECL(silver_sears, (struct monst *, struct monst *, long)); -E struct obj *FDECL(select_rwep, (struct monst *)); -E boolean FDECL(monmightthrowwep, (struct obj *)); -E struct obj *FDECL(select_hwep, (struct monst *)); -E void FDECL(possibly_unwield, (struct monst *, BOOLEAN_P)); -E void FDECL(mwepgone, (struct monst *)); -E int FDECL(mon_wield_item, (struct monst *)); -E int NDECL(abon); -E int NDECL(dbon); -E void FDECL(wet_a_towel, (struct obj *, int, BOOLEAN_P)); -E void FDECL(dry_a_towel, (struct obj *, int, BOOLEAN_P)); -E char *FDECL(skill_level_name, (int, char *)); -E const char *FDECL(skill_name, (int)); -E boolean FDECL(can_advance, (int, BOOLEAN_P)); -E int NDECL(enhance_weapon_skill); -E void FDECL(unrestrict_weapon_skill, (int)); -E void FDECL(use_skill, (int, int)); -E void FDECL(add_weapon_skill, (int)); -E void FDECL(lose_weapon_skill, (int)); -E int FDECL(weapon_type, (struct obj *)); -E int NDECL(uwep_skill_type); -E int FDECL(weapon_hit_bonus, (struct obj *)); -E int FDECL(weapon_dam_bonus, (struct obj *)); -E void FDECL(skill_init, (const struct def_skill *)); +extern const char *weapon_descr(struct obj *) NONNULLARG1; +extern int hitval(struct obj *, struct monst *) NONNULLARG12; +extern int dmgval(struct obj *, struct monst *) NONNULLARG12; +extern int special_dmgval(struct monst *, struct monst *, long, long *) NONNULLARG12; +extern void silver_sears(struct monst *, struct monst *, long) NONNULLARG2; +extern struct obj *select_rwep(struct monst *) NONNULLARG1; +extern boolean monmightthrowwep(struct obj *) NONNULLARG1; +extern struct obj *select_hwep(struct monst *) NONNULLARG1; +extern void possibly_unwield(struct monst *, boolean) NONNULLARG1; +extern int mon_wield_item(struct monst *) NONNULLARG1; +extern void mwepgone(struct monst *) NONNULLARG1; +extern int abon(void); +extern int dbon(void); +extern void wet_a_towel(struct obj *, int, boolean) NONNULLARG1; +extern void dry_a_towel(struct obj *, int, boolean) NONNULLARG1; +extern char *skill_level_name(int, char *) NONNULLARG2; +extern const char *skill_name(int); +extern boolean can_advance(int, boolean); +extern void show_skills(void); +extern int enhance_weapon_skill(void); +extern void unrestrict_weapon_skill(int); +extern void use_skill(int, int); +extern void add_weapon_skill(int); +extern void lose_weapon_skill(int); +extern void drain_weapon_skill(int); +extern int weapon_type(struct obj *) NO_NNARGS; +extern int uwep_skill_type(void); +/* find_roll_to_hit() calls weapon_hit_bonus() with a NULL argument, + preventing NONNULLARG1 */ +extern int weapon_hit_bonus(struct obj *) NO_NNARGS; +extern int weapon_dam_bonus(struct obj *) NO_NNARGS; +extern void skill_init(const struct def_skill *) NONNULLARG1; +extern void setmnotwielded(struct monst *, struct obj *) NONNULLARG1; +extern const struct throw_and_return_weapon *autoreturn_weapon(struct obj *) + NONNULLARG1; /* ### were.c ### */ -E void FDECL(were_change, (struct monst *)); -E int FDECL(counter_were, (int)); -E int FDECL(were_beastie, (int)); -E void FDECL(new_were, (struct monst *)); -E int FDECL(were_summon, (struct permonst *, BOOLEAN_P, int *, char *)); -E void NDECL(you_were); -E void FDECL(you_unwere, (BOOLEAN_P)); -E void FDECL(set_ulycn, (int)); +extern void were_change(struct monst *) NONNULLARG1; +extern int counter_were(int); +extern int were_beastie(int); +extern void new_were(struct monst *) NONNULLARG1; +extern int were_summon(struct permonst *, boolean, int *, char *) NONNULLARG13; +extern void you_were(void); +extern void you_unwere(boolean); +extern void set_ulycn(int); /* ### wield.c ### */ -E void FDECL(setuwep, (struct obj *)); -E void FDECL(setuqwep, (struct obj *)); -E void FDECL(setuswapwep, (struct obj *)); -E int NDECL(dowield); -E int NDECL(doswapweapon); -E int NDECL(dowieldquiver); -E boolean FDECL(wield_tool, (struct obj *, const char *)); -E int NDECL(can_twoweapon); -E void NDECL(drop_uswapwep); -E int NDECL(dotwoweapon); -E void NDECL(uwepgone); -E void NDECL(uswapwepgone); -E void NDECL(uqwepgone); -E void NDECL(untwoweapon); -E int FDECL(chwepon, (struct obj *, int)); -E int FDECL(welded, (struct obj *)); -E void FDECL(weldmsg, (struct obj *)); -E void FDECL(setmnotwielded, (struct monst *, struct obj *)); -E boolean FDECL(mwelded, (struct obj *)); +extern void setuwep(struct obj *) NO_NNARGS; /* NULL:ball.c, do.c */ +extern const char *empty_handed(void); +extern void setuqwep(struct obj *) NO_NNARGS; /* NULL:ball.c, do.c */ +extern void setuswapwep(struct obj *) NO_NNARGS; /* NULL: ball.c, do.c */ +extern int dowield(void); +extern int doswapweapon(void); +extern int dowieldquiver(void); +extern int doquiver_core(const char *) NONNULLARG1; +extern boolean wield_tool(struct obj *, const char *) NONNULLARG1; +extern int can_twoweapon(void); +extern void drop_uswapwep(void); +extern int dotwoweapon(void); +extern void uwepgone(void); +extern void uswapwepgone(void); +extern void uqwepgone(void); +extern void set_twoweap(boolean); +extern void untwoweapon(void); +extern int chwepon(struct obj *, int) NO_NNARGS; +extern int welded(struct obj *) NO_NNARGS; +extern void weldmsg(struct obj *) NONNULLARG1; +extern boolean mwelded(struct obj *) NO_NNARGS; /* ### windows.c ### */ -E void FDECL(choose_windows, (const char *)); +extern void choose_windows(const char *) NONNULLARG1; #ifdef WINCHAIN -void FDECL(addto_windowchain, (const char *s)); -void NDECL(commit_windowchain); -#endif -E boolean NDECL(genl_can_suspend_no); -E boolean NDECL(genl_can_suspend_yes); -E char FDECL(genl_message_menu, (CHAR_P, int, const char *)); -E void FDECL(genl_preference_update, (const char *)); -E char *FDECL(genl_getmsghistory, (BOOLEAN_P)); -E void FDECL(genl_putmsghistory, (const char *, BOOLEAN_P)); +void addto_windowchain(const char *s) NONNULLARG1; +void commit_windowchain(void); +#endif +#ifdef TTY_GRAPHICS +extern boolean check_tty_wincap(unsigned long); +extern boolean check_tty_wincap2(unsigned long); +#endif +extern boolean genl_can_suspend_no(void); +extern boolean genl_can_suspend_yes(void); +extern char genl_message_menu(char, int, const char *) NONNULLARG3; +extern void genl_preference_update(const char *) NO_NNARGS; +extern char *genl_getmsghistory(boolean); +extern void genl_putmsghistory(const char *, boolean) NONNULLARG1; #ifdef HANGUPHANDLING -E void NDECL(nhwindows_hangup); -#endif -E void NDECL(genl_status_init); -E void NDECL(genl_status_finish); -E void FDECL(genl_status_enablefield, (int, const char *, const char *, - BOOLEAN_P)); -E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, - unsigned long *)); +extern void nhwindows_hangup(void); +#endif +extern void genl_status_init(void); +extern void genl_status_finish(void); +extern void genl_status_enablefield(int, const char *, const char *, + boolean) NONNULLPTRS; +extern void genl_status_update(int, genericptr_t, int, int, int, + unsigned long *) NONNULLARG2; #ifdef DUMPLOG -E char *FDECL(dump_fmtstr, (const char *, char *, BOOLEAN_P)); -#endif -E void FDECL(dump_open_log, (time_t)); -E void NDECL(dump_close_log); -E void FDECL(dump_redirect, (BOOLEAN_P)); -E void FDECL(dump_forward_putstr, (winid, int, const char*, int)); +extern char *dump_fmtstr(const char *, char *, boolean) NONNULLPTRS; +#endif +extern void dump_open_log(time_t); +extern void dump_close_log(void); +extern void dump_redirect(boolean); +extern void dump_forward_putstr(winid, int, const char*, int) NONNULLARG3; +extern int has_color(int); +extern int glyph2ttychar(int); +extern int glyph2symidx(int); +extern char *encglyph(int); +extern int decode_glyph(const char *str, int *glyph_ptr) NONNULLPTRS; +extern char *decode_mixed(char *, const char *) NONNULLARG1; +extern void genl_putmixed(winid, int, const char *) NONNULLARG3; +extern void genl_display_file(const char *, boolean) NONNULLARG1; +extern boolean menuitem_invert_test(int, unsigned, boolean); +extern const char *mixed_to_glyphinfo(const char *str, + glyph_info *gip) NO_NNARGS; +extern void adjust_menu_promptstyle(winid, color_attr *) NONNULLARG2; +extern int choose_classes_menu(const char *, int, boolean, + char *, char *) NONNULLARG1; +extern void add_menu(winid, const glyph_info *, const ANY_P *, + char, char, int, int, const char *, unsigned int); +extern void add_menu_heading(winid, const char *) NONNULLARG2; +extern void add_menu_str(winid, const char *) NONNULLARG2; +extern int select_menu(winid, int, menu_item **) NONNULLARG3; +extern void getlin(const char *, char *) NONNULLARG2; + +/* ### windsys.c ### */ -/* ### winnt.c ### */ #ifdef WIN32 -E void NDECL(nethack_enter_winnt); +extern void nethack_enter_windows(void); #endif /* ### wizard.c ### */ -E void NDECL(amulet); -E int FDECL(mon_has_amulet, (struct monst *)); -E int FDECL(mon_has_special, (struct monst *)); -E int FDECL(tactics, (struct monst *)); -E boolean FDECL(has_aggravatables, (struct monst *)); -E void NDECL(aggravate); -E void NDECL(clonewiz); -E int NDECL(pick_nasty); -E int FDECL(nasty, (struct monst *)); -E void NDECL(resurrect); -E void NDECL(intervene); -E void NDECL(wizdead); -E void FDECL(cuss, (struct monst *)); +extern void amulet(void); +extern int mon_has_amulet(struct monst *) NONNULLARG1; +extern int mon_has_special(struct monst *) NONNULLARG1; +extern void choose_stairs(coordxy *, coordxy *, boolean) NONNULLARG12; +extern int tactics(struct monst *) NONNULLARG1; +extern boolean has_aggravatables(struct monst *) NONNULLARG1; +extern void aggravate(void); +extern void clonewiz(void); +extern int pick_nasty(int); +extern int nasty(struct monst *) NO_NNARGS; +extern void resurrect(void); +extern void intervene(void); +extern void wizdeadorgone(void); +extern void cuss(struct monst *) NONNULLARG1; + +/* ### wizcmds.c ### */ + +extern int wiz_custom(void); +extern int wiz_detect(void); +extern int wiz_flip_level(void); +extern int wiz_fuzzer(void); +extern int wiz_genesis(void); +extern int wiz_identify(void); +extern int wiz_intrinsic(void); +extern int wiz_kill(void); +extern int wiz_level_change(void); +extern int wiz_level_tele(void); +extern int wiz_load_lua(void); +extern int wiz_load_splua(void); +extern int wiz_makemap(void); +extern int wiz_map(void); +extern int wiz_migrate_mons(void); +extern int wiz_panic(void); +extern int wiz_polyself(void); +extern int wiz_rumor_check(void); +extern int wiz_show_seenv(void); +extern int wiz_show_stats(void); +extern int wiz_show_vision(void); +extern int wiz_show_wmodes(void); +extern int wiz_smell(void); +extern int wiz_telekinesis(void); +extern int wiz_where(void); +extern int wiz_wish(void); +extern void makemap_remove_mons(void); +extern void wiz_levltyp_legend(void); +extern void wiz_map_levltyp(void); +extern void wizcustom_callback(winid win, int glyphnum, char *id); +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) +extern int wiz_display_macros(void); +extern int wiz_mon_diff(void); +extern int wiz_objprobs(void); +extern int wiz_show_nhuuid(void); +#endif +extern void sanity_check(void); /* ### worm.c ### */ -E int NDECL(get_wormno); -E void FDECL(initworm, (struct monst *, int)); -E void FDECL(worm_move, (struct monst *)); -E void FDECL(worm_nomove, (struct monst *)); -E void FDECL(wormgone, (struct monst *)); -E void FDECL(wormhitu, (struct monst *)); -E void FDECL(cutworm, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -E void FDECL(see_wsegs, (struct monst *)); -E void FDECL(detect_wsegs, (struct monst *, BOOLEAN_P)); -E void FDECL(save_worm, (int, int)); -E void FDECL(rest_worm, (int)); -E void FDECL(place_wsegs, (struct monst *, struct monst *)); -E void FDECL(sanity_check_worm, (struct monst *)); -E void FDECL(remove_worm, (struct monst *)); -E void FDECL(place_worm_tail_randomly, (struct monst *, XCHAR_P, XCHAR_P)); -E int FDECL(size_wseg, (struct monst *)); -E int FDECL(count_wsegs, (struct monst *)); -E boolean FDECL(worm_known, (struct monst *)); -E boolean FDECL(worm_cross, (int, int, int, int)); -E int FDECL(wseg_at, (struct monst *, int, int)); +extern int get_wormno(void); +extern void initworm(struct monst *, int) NONNULLARG1; +extern void worm_move(struct monst *) NONNULLARG1; +extern void worm_nomove(struct monst *) NONNULLARG1; +extern void wormgone(struct monst *) NONNULLARG1; +extern int wormhitu(struct monst *) NONNULLARG1; +extern void cutworm(struct monst *, coordxy, coordxy, boolean) NONNULLARG1; +extern void see_wsegs(struct monst *) NONNULLARG1; +extern void detect_wsegs(struct monst *, boolean) NONNULLARG1; +extern void save_worm(NHFILE *) NONNULLARG1; +extern void rest_worm(NHFILE *) NONNULLARG1; +extern void place_wsegs(struct monst *, struct monst *) NONNULLARG1; +extern void sanity_check_worm(struct monst *); /* NULL leads to impossible */ +extern void wormno_sanity_check(void); +extern void remove_worm(struct monst *) NONNULLARG1; +extern void place_worm_tail_randomly(struct monst *, coordxy, coordxy) NONNULLARG1; +extern int size_wseg(struct monst *) NONNULLARG1; +extern int count_wsegs(struct monst *) NONNULLARG1; +extern boolean worm_known(struct monst *) NONNULLARG1; +extern boolean worm_cross(int, int, int, int); +extern int wseg_at(struct monst *, int, int) NO_NNARGS; +extern void flip_worm_segs_vertical(struct monst *, int, int) NONNULLARG1; +extern void flip_worm_segs_horizontal(struct monst *, int, int) NONNULLARG1; +extern void redraw_worm(struct monst *); /* ### worn.c ### */ -E void FDECL(setworn, (struct obj *, long)); -E void FDECL(setnotworn, (struct obj *)); -E struct obj *FDECL(wearmask_to_obj, (long)); -E long FDECL(wearslot, (struct obj *)); -E void FDECL(mon_set_minvis, (struct monst *)); -E void FDECL(mon_adjust_speed, (struct monst *, int, struct obj *)); -E void FDECL(update_mon_intrinsics, - (struct monst *, struct obj *, BOOLEAN_P, BOOLEAN_P)); -E int FDECL(find_mac, (struct monst *)); -E void FDECL(m_dowear, (struct monst *, BOOLEAN_P)); -E struct obj *FDECL(which_armor, (struct monst *, long)); -E void FDECL(mon_break_armor, (struct monst *, BOOLEAN_P)); -E void FDECL(bypass_obj, (struct obj *)); -E void NDECL(clear_bypasses); -E void FDECL(bypass_objlist, (struct obj *, BOOLEAN_P)); -E struct obj *FDECL(nxt_unbypassed_obj, (struct obj *)); -E struct obj *FDECL(nxt_unbypassed_loot, (Loot *, struct obj *)); -E int FDECL(racial_exception, (struct monst *, struct obj *)); +extern void recalc_telepat_range(void); +extern void setworn(struct obj *, long) NO_NNARGS; /* has tests for obj */ +extern void setnotworn(struct obj *) NO_NNARGS; /* has tests for obj */ +extern void allunworn(void); +extern struct obj *wearmask_to_obj(long); +extern int wornmask_to_armcat(long); +extern long armcat_to_wornmask(int); +extern long wearslot(struct obj *) NONNULLARG1; +extern void check_wornmask_slots(void); +extern void mon_set_minvis(struct monst *, boolean) NONNULLARG1; +extern void mon_adjust_speed(struct monst *, int, struct obj *) NONNULLARG1; +extern void update_mon_extrinsics(struct monst *, struct obj *, boolean, + boolean) NONNULLARG12; +extern int find_mac(struct monst *) NONNULLARG1; +extern void m_dowear(struct monst *, boolean) NONNULLARG1; +extern struct obj *which_armor(struct monst *, long) NONNULLARG1; +extern void mon_break_armor(struct monst *, boolean) NONNULLARG1; +extern void bypass_obj(struct obj *) NONNULLARG1; +extern void clear_bypasses(void); +/* callers don't check gi.invent before passing to bypass_objlist */ +extern void bypass_objlist(struct obj *, boolean) NO_NNARGS; +extern struct obj *nxt_unbypassed_obj(struct obj *) NO_NNARGS; +extern struct obj *nxt_unbypassed_loot(Loot *, struct obj *) NONNULLARG1; +extern int racial_exception(struct monst *, struct obj *) NONNULLARG12; +extern void extract_from_minvent(struct monst *, struct obj *, boolean, + boolean) NONNULLARG12; /* ### write.c ### */ -E int FDECL(dowrite, (struct obj *)); +extern int dowrite(struct obj *) NONNULLARG1; /* ### zap.c ### */ -E void FDECL(learnwand, (struct obj *)); -E int FDECL(bhitm, (struct monst *, struct obj *)); -E void FDECL(probe_monster, (struct monst *)); -E boolean FDECL(get_obj_location, (struct obj *, xchar *, xchar *, int)); -E boolean FDECL(get_mon_location, (struct monst *, xchar *, xchar *, int)); -E struct monst *FDECL(get_container_location, - (struct obj * obj, int *, int *)); -E struct monst *FDECL(montraits, (struct obj *, coord *, BOOLEAN_P)); -E struct monst *FDECL(revive, (struct obj *, BOOLEAN_P)); -E int FDECL(unturn_dead, (struct monst *)); -E void FDECL(cancel_item, (struct obj *)); -E boolean FDECL(drain_item, (struct obj *, BOOLEAN_P)); -E struct obj *FDECL(poly_obj, (struct obj *, int)); -E boolean FDECL(obj_resists, (struct obj *, int, int)); -E boolean FDECL(obj_shudders, (struct obj *)); -E void FDECL(do_osshock, (struct obj *)); -E int FDECL(bhito, (struct obj *, struct obj *)); -E int FDECL(bhitpile, - (struct obj *, int (*)(OBJ_P, OBJ_P), int, int, SCHAR_P)); -E int FDECL(zappable, (struct obj *)); -E void FDECL(zapnodir, (struct obj *)); -E int NDECL(dozap); -E int FDECL(zapyourself, (struct obj *, BOOLEAN_P)); -E void FDECL(ubreatheu, (struct attack *)); -E int FDECL(lightdamage, (struct obj *, BOOLEAN_P, int)); -E boolean FDECL(flashburn, (long)); -E boolean FDECL(cancel_monst, (struct monst *, struct obj *, BOOLEAN_P, - BOOLEAN_P, BOOLEAN_P)); -E void NDECL(zapsetup); -E void NDECL(zapwrapup); -E void FDECL(weffects, (struct obj *)); -E int FDECL(spell_damage_bonus, (int)); -E const char *FDECL(exclam, (int force)); -E void FDECL(hit, (const char *, struct monst *, const char *)); -E void FDECL(miss, (const char *, struct monst *)); -E struct monst *FDECL(bhit, (int, int, int, enum bhit_call_types, - int (*)(MONST_P, OBJ_P), - int (*)(OBJ_P, OBJ_P), struct obj **)); -E struct monst *FDECL(boomhit, (struct obj *, int, int)); -E int FDECL(zhitm, (struct monst *, int, int, struct obj **)); -E int FDECL(burn_floor_objects, (int, int, BOOLEAN_P, BOOLEAN_P)); -E void FDECL(buzz, (int, int, XCHAR_P, XCHAR_P, int, int)); -E void FDECL(dobuzz, (int, int, XCHAR_P, XCHAR_P, int, int, BOOLEAN_P)); -E void FDECL(melt_ice, (XCHAR_P, XCHAR_P, const char *)); -E void FDECL(start_melt_ice_timeout, (XCHAR_P, XCHAR_P, long)); -E void FDECL(melt_ice_away, (ANY_P *, long)); -E int FDECL(zap_over_floor, (XCHAR_P, XCHAR_P, int, boolean *, SHORT_P)); -E void FDECL(fracture_rock, (struct obj *)); -E boolean FDECL(break_statue, (struct obj *)); -E void FDECL(destroy_item, (int, int)); -E int FDECL(destroy_mitem, (struct monst *, int, int)); -E int FDECL(resist, (struct monst *, CHAR_P, int, int)); -E void NDECL(makewish); - -#endif /* !MAKEDEFS_C && !LEV_LEX_C */ - -#undef E +extern void learnwand(struct obj *) NONNULLARG1; +extern int bhitm(struct monst *, struct obj *) NONNULLARG12; +extern void release_hold(void); +extern void probe_monster(struct monst *) NONNULLARG1; +extern boolean get_obj_location(struct obj *, coordxy *, coordxy *, + int) NONNULLPTRS; +extern boolean get_mon_location(struct monst *, coordxy *, coordxy *, + int) NONNULLPTRS; +extern struct monst *get_container_location(struct obj *, + int *, int *) NONNULLARG2; +extern struct monst *montraits(struct obj *, coord *, boolean) NONNULLARG12; +extern struct monst *revive(struct obj *, boolean) NONNULLARG1; +extern int unturn_dead(struct monst *) NONNULLARG1; +extern void unturn_you(void); +extern void cancel_item(struct obj *) NONNULLARG1; +extern void blank_novel(struct obj *) NONNULLARG1; +extern boolean drain_item(struct obj *, boolean) NO_NNARGS; /* tests !obj */ +extern boolean obj_unpolyable(struct obj *) NONNULLARG1; +extern struct obj *poly_obj(struct obj *, int) NONNULLARG1; +extern boolean obj_resists(struct obj *, int, int) NONNULLARG1; +extern boolean obj_shudders(struct obj *) NONNULLARG1; +extern void do_osshock(struct obj *) NONNULLARG1; +extern int bhito(struct obj *, struct obj *) NONNULLARG12; +extern int bhitpile(struct obj *, int(*)(struct obj *, struct obj *), + coordxy, coordxy, schar) NONNULLARG12; +extern int zappable(struct obj *) NONNULLARG1; +extern void do_enlightenment_effect(void); +extern void zapnodir(struct obj *) NONNULLARG1; +extern int dozap(void); +extern int zapyourself(struct obj *, boolean) NONNULLARG1; +extern void ubreatheu(struct attack *) NONNULLARG1; +extern int lightdamage(struct obj *, boolean, int) NONNULLARG1; +extern boolean flashburn(long, boolean); +extern boolean cancel_monst(struct monst *, struct obj *, boolean, boolean, + boolean) NONNULLARG12; +extern void zapsetup(void); +extern void zapwrapup(void); +extern void weffects(struct obj *) NONNULLARG1; +extern int spell_damage_bonus(int); +extern const char *exclam(int force) NONNULL; +extern void hit(const char *, struct monst *, const char *) NONNULLPTRS; +extern void miss(const char *, struct monst *) NONNULLPTRS; +extern struct monst *bhit(int, int, int, enum bhit_call_types, + int(*)(struct monst *, struct obj *), + int(*)(struct obj *, struct obj *), + struct obj **) NONNULLARG7; +extern struct monst *boomhit(struct obj *, int, int) NONNULLARG1; +extern int zhitm(struct monst *, int, int, struct obj **) NONNULLPTRS; +extern int burn_floor_objects(coordxy, coordxy, boolean, boolean); +extern void ubuzz(int, int); +extern void buzz(int, int, coordxy, coordxy, int, int); +extern void dobuzz(int, int, coordxy, coordxy, int, int, + boolean, boolean, boolean); +extern void melt_ice(coordxy, coordxy, const char *) NO_NNARGS; +extern void start_melt_ice_timeout(coordxy, coordxy, long); +extern void melt_ice_away(union any *, long) NONNULLARG1; +extern int zap_over_floor(coordxy, coordxy, int, boolean *, + boolean, short) NONNULLARG4; +extern void mon_spell_hits_spot(struct monst *, int, coordxy x, coordxy y); +extern void fracture_rock(struct obj *) NONNULLARG1; +extern boolean break_statue(struct obj *) NONNULLARG1; +extern int u_adtyp_resistance_obj(int); +extern boolean inventory_resistance_check(int); +extern char *item_what(int); +extern int destroy_items(struct monst *, int, int) NONNULLARG1; +extern int resist(struct monst *, char, int, int) NONNULLARG1; +extern void wish_history_add(char *); +extern void wish_history_flush(void); +extern void makewish(void); +extern const char *flash_str(int, boolean) NONNULL; + +/* ### unixmain.c, windsys.c ### */ + +#ifdef RUNTIME_PORT_ID +extern char *get_port_id(char *); +#endif +#ifdef RUNTIME_PASTEBUF_SUPPORT +extern void port_insert_pastebuf(char *); +#endif +extern void get_nhuuid(void); +extern void free_nhuuid(void); + +#endif /* !MAKEDEFS_C && !MDLIB_C */ #endif /* EXTERN_H */ + +/*extern.h*/ From e5c1f884f278883b3521f8258f89d90c081d7875 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 16:54:13 +0100 Subject: [PATCH 6/9] Add nh5 tcap.h with NLE mods --- include/tcap.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/tcap.h b/include/tcap.h index 707621572..a17833385 100644 --- a/include/tcap.h +++ b/include/tcap.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 tcap.h $NHDT-Date: 1432512774 2015/05/25 00:12:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ +/* NetHack 5.0 tcap.h $NHDT-Date: 1596498562 2020/08/03 23:49:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.12 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1989. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -15,7 +15,7 @@ #endif /* might display need graphics code? */ -#if !defined(AMIGA) && !defined(TOS) && !defined(MAC) +#if !defined(AMIGA) && !defined(TOS) && !defined(MACOS9) #if defined(TERMLIB) || defined(OS2) || defined(MSDOS) #define ASCIIGRAPH #endif @@ -49,12 +49,10 @@ extern struct tc_lcl_data { /* defined and set up in termcap.c */ extern short ospeed; /* set up in termcap.c */ -#ifdef TEXTCOLOR #ifdef TOS extern const char *hilites[CLR_MAX]; #else extern NEARDATA char *hilites[CLR_MAX]; #endif -#endif #endif /* TCAP_H */ From de594486fa6d29693f054ab7048c6825a17b4ca6 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 17:02:18 +0100 Subject: [PATCH 7/9] Add nh5 tradstdc.h without NLE mods - mod not needed --- include/tradstdc.h | 372 ++++++++++++++++++++++++++++++--------------- 1 file changed, 251 insertions(+), 121 deletions(-) diff --git a/include/tradstdc.h b/include/tradstdc.h index 49dbc5add..a202c0c7b 100644 --- a/include/tradstdc.h +++ b/include/tradstdc.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 tradstdc.h $NHDT-Date: 1555361295 2019/04/15 20:48:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $ */ +/* NetHack 5.0 tradstdc.h $NHDT-Date: 1744938651 2025/04/17 17:10:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -47,8 +47,6 @@ * USE_VARARGS means use the facilities. Again, this should only * be done if the library supports it. ANSI is *not* required for this. * Otherwise, the kludgy old methods are used. - * The defaults are USE_STDARG for ANSI compilers, and USE_OLDARGS for - * others. */ /* #define USE_VARARGS */ /* use instead of */ @@ -58,15 +56,15 @@ #define USE_VARARGS #endif -#if defined(NHSTDC) || defined(ULTRIX_PROTO) || defined(MAC) -#if !defined(USE_VARARGS) && !defined(USE_OLDARGS) && !defined(USE_STDARG) +#if !defined(USE_STDARG) && !defined(USE_VARARGS) && !defined(USE_OLDARGS) +/* the old VARARGS and OLDARGS stuff is still here, but since we're + requiring C99 these days it's unlikely to be useful */ #define USE_STDARG #endif -#endif #ifdef NEED_VARARGS /* only define these if necessary */ /* - * These have changed since 3.4.3. VA_END() now provides an explicit + * These changed in 3.6.0. VA_END() provides a hidden * closing brace to complement VA_DECL()'s hidden opening brace, so code * started with VA_DECL() needs an extra opening brace to complement * the explicit final closing brace. This was done so that the source @@ -74,11 +72,11 @@ * function whose opening brace was missing; there are now visible and * invisible braces at beginning and end. Sample usage: void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace - { --new, explicit opening brace (actually introduces a nested block) + { --explicit opening brace (actually introduces a nested block) VA_START(bar); ...code for foo... - VA_END(); --expansion now provides a closing brace for the nested block - } --existing closing brace, still pairs with the hidden one in VA_DECL() + VA_END(); --expansion provides a closing brace for the nested block + } --closing brace, pairs with the hidden one in VA_DECL() * Reading the code--or using source browsing tools which match braces-- * results in seeing a matched set of braces. Usage of VA_END() is * potentially trickier, but nethack uses it in a straightforward manner. @@ -158,7 +156,8 @@ typedef const char *vA; [nethack's core doesn't use VA_NEXT() so doesn't use VA_SHIFT() either, and this definition is just retained for completeness. - lev_comp does use VA_NEXT(), but it passes all 'argX' arguments.] + lev_comp does use VA_NEXT(), but it passes all 'argX' arguments. + Note: as of 5.0.0, lev_comp doesn't exist anymore.] */ #define VA_SHIFT() \ (arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \ @@ -173,107 +172,16 @@ typedef const char *vA; #endif /* NEED_VARARGS */ -#if defined(NHSTDC) || defined(MSDOS) || defined(MAC) \ - || defined(ULTRIX_PROTO) || defined(__BEOS__) - -/* - * Used for robust ANSI parameter forward declarations: - * int VDECL(sprintf, (char *, const char *, ...)); - * - * NDECL() is used for functions with zero arguments; - * FDECL() is used for functions with a fixed number of arguments; - * VDECL() is used for functions with a variable number of arguments. - * Separate macros are needed because ANSI will mix old-style declarations - * with prototypes, except in the case of varargs, and the OVERLAY-specific - * trampoli.* mechanism conflicts with the ANSI <> syntax. - */ - -#define NDECL(f) f(void) /* overridden later if USE_TRAMPOLI set */ - -#define FDECL(f, p) f p - -#if defined(MSDOS) || defined(USE_STDARG) -#define VDECL(f, p) f p -#else -#define VDECL(f, p) f() -#endif - -/* - * Used for definitions of functions which take no arguments to force - * an explicit match with the NDECL prototype. Needed in some cases - * (MS Visual C 2005) for functions called through pointers. - */ -#define VOID_ARGS void - /* generic pointer, always a macro; genericptr_t is usually a typedef */ #define genericptr void * - -#if (defined(ULTRIX_PROTO) && !defined(__GNUC__)) || defined(OS2_CSET2) -/* Cover for Ultrix on a DECstation with 2.0 compiler, which coredumps on - * typedef void * genericptr_t; - * extern void a(void(*)(int, genericptr_t)); - * Using the #define is OK for other compiler versions too. - */ -/* And IBM CSet/2. The redeclaration of free hoses the compile. */ -#define genericptr_t genericptr -#else -#if !defined(NHSTDC) && !defined(MAC) -#define const -#define signed -#define volatile -#endif -#endif - -/* - * Suppress `const' if necessary and not handled elsewhere. - * Don't use `#if defined(xxx) && !defined(const)' - * because some compilers choke on `defined(const)'. - * This has been observed with Lattice, MPW, and High C. - */ -#if (defined(ULTRIX_PROTO) && !defined(NHSTDC)) || defined(apollo) -/* the system header files don't use `const' properly */ -#ifndef const -#define const -#endif -#endif - -#else /* NHSTDC */ /* a "traditional" C compiler */ - -#define NDECL(f) f() -#define FDECL(f, p) f() -#define VDECL(f, p) f() - -#define VOID_ARGS /*empty*/ - -#if defined(AMIGA) || defined(HPUX) || defined(POSIX_TYPES) \ - || defined(__DECC) || defined(__BORLANDC__) -#define genericptr void * -#endif -#ifndef genericptr -#define genericptr char * -#endif - -/* - * Traditional C compilers don't have "signed", "const", or "volatile". - */ -#define signed -#define const -#define volatile - -#endif /* NHSTDC */ - #ifndef genericptr_t typedef genericptr genericptr_t; /* (void *) or (char *) */ #endif -#if defined(MICRO) || defined(WIN32) +#ifndef NO_PTR_FMT /* We actually want to know which systems have an ANSI run-time library * to know which support the %p format for printing pointers. - * Due to the presence of things like gcc, NHSTDC is not a good test. - * So we assume microcomputers have all converted to ANSI and bigger - * computers which may have older libraries give reasonable results with - * casting pointers to unsigned long int (fmt_ptr() in alloc.c). - */ + * Since we require C99 or later, assume the library supports it. */ #define HAS_PTR_FMT #endif @@ -336,13 +244,13 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #endif #endif -/* These are used for arguments within FDECL/VDECL prototype declarations. +/* These are used for arguments within VDECL prototype declarations. */ #ifdef UNWIDENED_PROTOTYPES #define CHAR_P char #define SCHAR_P schar #define UCHAR_P uchar -#define XCHAR_P xchar +#define XCHAR_P coordxy #define SHORT_P short #ifndef SKIP_BOOLEAN #define BOOLEAN_P boolean @@ -361,7 +269,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #define ALIGNTYP_P int #else /* Neither widened nor unwidened prototypes. Argument list expansion - * by FDECL/VDECL always empty; all xxx_P vanish so defs aren't needed. */ + * by VDECL always empty; all xxx_P vanish so defs aren't needed. */ #endif #endif @@ -394,14 +302,8 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ * include files have prototypes and the compiler also complains that * prototyped and unprototyped declarations don't match. */ -#undef NDECL -#undef FDECL #undef VDECL -#define NDECL(f) f() -#define FDECL(f, p) f() #define VDECL(f, p) f() -#undef VOID_ARGS -#define VOID_ARGS /*empty*/ #endif #endif @@ -411,43 +313,271 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #undef signed #endif +/* + * Language + * Standard + * + * NetHack 5.0 range + * / + * / + * C2y X NetHack 3.6 and earlier range + * C23 X / + * C17 X X + * C11 X X + * C99 X X + * C89 X + * + * + * The NetHack 5.0 source code currently makes use of the following + * C99 (and above) language features: + * + * commas at the end of enumerator lists + * variable declarations in for loop initializers + * mixing declarations and code + * variadic macros + * 'long long' + * + * The NetHack 5.0 source code adheres to the following greater-than C99 + * language restrictions: + * + * Removal of K&R function definitions + * Removal of implicit int + */ + +/* + * Provide a shorthand way of checking for a certain C standard + * in the NetHack header files by always setting NH_C to one + * of three possible values (as of January 2025): + * + * NH_C >= 202300L Being compiled under C23 or greater + * NH_C >= 199900L Being compiled under C99 or greater + * NH_C >= 198900L Being compiled under C89 or greater, + * or C std could not be determined. + */ +#if defined(__STDC_VERSION__) +#if (__STDC_VERSION__ >= 202000L) +#define NH_C 202300L +#else +#define NH_C 199900L +#endif /* C23 or C99 */ +#else /* __STDC_VERSION not defined */ +#define NH_C 198900L +#endif /* __STDC_VERSION not defined */ +#ifndef NH_C +#define NH_C 198900L +#endif + +/* NH_C is now defined to 198900L or 199900L or 202300L */ + +#if NH_C >= 202300L +/* Give first priority to standard */ +#ifndef __has_c_attribute +#define __has_c_attribute(x) 0 +#endif +/* + * noreturn + */ +#ifndef ATTRNORETURN +#define ATTRNORETURN [[noreturn]] +/* #warning [[noreturn]] from C23 */ +#endif /* ATTRNORETURN not defined */ +/* + * fallthrough + */ +#if __has_c_attribute(fallthrough) +/* Standard attribute is available, use it. */ +#define FALLTHROUGH [[fallthrough]] +/* #warning [[fallthrough]] from C23 */ +#endif /* __has_c_attribute(fallthrough) */ +/* + * maybe_unused + */ +#if __has_c_attribute(maybe_unused) +#ifndef ATTRUNUSED +#define ATTRUNUSED [[maybe_unused]] +#endif +#endif /* __has_c_attribute(maybe_unused) */ +#endif /* NH_C >= 202300L */ + +/* + * Compiler-specific + */ + #ifdef __clang__ /* clang's gcc emulation is sufficient for nethack's usage */ #ifndef __GNUC__ -#define __GNUC__ 4 +#define __GNUC__ 5 /* high enough for returns_nonnull */ #endif #endif /* - * Allow gcc2 to check parameters of printf-like calls with -Wformat; - * append this to a prototype declaration (see pline() in extern.h). + * gcc (and also clang which masquerades as__GNUC__==5 due to #define above) + * + * Allow gcc2 and above to check parameters of printf-like calls with + * -Wformat; append this to a prototype declaration (see pline() in extern.h). */ #ifdef __GNUC__ #if (__GNUC__ >= 2) && !defined(USE_OLDARGS) #define PRINTF_F(f, v) __attribute__((format(printf, f, v))) #endif +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define PRINTF_F_PTR(f, v) PRINTF_F(f, v) +#endif #if __GNUC__ >= 3 +#ifndef ATTRUNUSED #define UNUSED __attribute__((unused)) +#endif +#ifndef ATTRNORETURN +#ifndef NORETURN #define NORETURN __attribute__((noreturn)) -#if defined(GCC_URWARN) +/* #warning NORETURN __attribute__((noreturn)) from __GNUC__ >= 3 */ +#endif /* NORETURN */ +#endif /* ATTRNORETURN */ +#endif /* __GNUC__ >= 3 */ +#if __GNUC__ >= 5 +#ifndef NONNULLS_DEFINED +#define DO_DEFINE_NONNULLS +#endif /* !NONNULLS_DEFINED */ +/* #pragma message is available */ +#define NH_PRAGMA_MESSAGE 1 +#endif /* __GNUC__ greater than or equal to 5 */ +#if (!defined(__linux__) && !defined(MACOS)) || defined(GCC_URWARN) /* disable gcc's __attribute__((__warn_unused_result__)) since explicitly - discarding the result by casting to (void) is not accepted as a 'use'. - This appears to be a problem for both Linux and M1 Macs. -*/ + discarding the result by casting to (void) is not accepted as a 'use' */ #define __warn_unused_result__ /*empty*/ #define warn_unused_result /*empty*/ +#endif /* GCC_URWARN || !__linux || !MACOS */ +#endif /* __GNUC__ || clang masquerading as __GNUC__==5 */ + +/* + * clang-specific + * + */ +#if defined(__clang__) +#ifndef FALLTHROUGH +#if defined(__clang_major__) +#if __clang_major__ >= 9 +#define FALLTHROUGH __attribute__((fallthrough)) +/* #warning FALLTHROUGH __attribute__((fallthrough)) from clang */ +#endif /* __clang_major__ greater than or equal to 9 */ +#endif /* __clang_major__ is defined */ +#endif /* FALLTHROUGH */ +#if !defined(DO_DEFINE_NONNULLS) +#define DO_DEFINE_NONNULLS +#endif +#endif /* __clang__ */ + +/* + * NONNULL args + */ +#if defined(DO_DEFINE_NONNULLS) && !defined(NONNULLS_DEFINED) +#define NONNULL __attribute__((returns_nonnull)) +#define NONNULLPTRS __attribute__((nonnull)) +#define NONNULLARG1 __attribute__((nonnull (1))) +#define NONNULLARG2 __attribute__((nonnull (2))) +#define NONNULLARG3 __attribute__((nonnull (3))) +#define NONNULLARG4 __attribute__((nonnull (4))) +#define NONNULLARG5 __attribute__((nonnull (5))) +#define NONNULLARG6 __attribute__((nonnull (6))) +#define NONNULLARG7 __attribute__((nonnull (7))) /* for bhit() */ +#define NONNULLARG12 __attribute__((nonnull (1, 2))) +#define NONNULLARG23 __attribute__((nonnull (2, 3))) +#define NONNULLARG123 __attribute__((nonnull (1, 2, 3))) +#define NONNULLARG13 __attribute__((nonnull (1, 3))) +#define NONNULLARG14 __attribute__((nonnull (1, 4))) /* for query_category */ +#define NONNULLARG134 __attribute__((nonnull (1, 3, 4))) /* for do_stone_mon */ +#define NONNULLARG145 __attribute__((nonnull (1, 4, 5))) /* find_roll_to_hit */ +#define NONNULLARG17 __attribute__((nonnull (1, 7))) /* for askchain() */ +#define NONNULLARG24 __attribute__((nonnull (2, 4))) /* query_objlist() */ +#define NONNULLARG45 __attribute__((nonnull (4, 5))) /* do_screen_descri... */ +#define NONNULLS_DEFINED +#undef DO_DEFINE_NONNULLS +#endif /* DO_DEFINE_NONNULLS && !NONNULLS_DEFINED */ + +/* + * Microsoft compiler + */ +#ifdef _MSC_VER +#ifndef ATTRNORETURN +#define ATTRNORETURN __declspec(noreturn) +/* #warning ATTRNORETURN __declspec(noreturn) from _MSC_VER */ #endif -#endif +/* #pragma message is available */ +#define NH_PRAGMA_MESSAGE 1 +#endif /* _MSC_VER */ + +#if !defined(UNUSED) && defined(ATTRUNUSED) +#define UNUSED ATTRUNUSED #endif +/* Fallback implementations */ #ifndef PRINTF_F #define PRINTF_F(f, v) #endif +#ifndef PRINTF_F_PTR +#define PRINTF_F_PTR(f, v) +#endif #ifndef UNUSED #define UNUSED #endif +#ifndef ATTRUNUSED +#define ATTRUNUSED +#endif +#ifndef FALLTHROUGH +#define FALLTHROUGH +#endif +#ifndef ATTRNORETURN +#define ATTRNORETURN +#endif #ifndef NORETURN #define NORETURN #endif +#ifndef NONNULLS_DEFINED +#define NONNULL +#define NONNULLPTRS +#define NONNULLARG1 +#define NONNULLARG2 +#define NONNULLARG3 +#define NONNULLARG4 +#define NONNULLARG5 +#define NONNULLARG6 +#define NONNULLARG7 +#define NONNULLARG12 +#define NONNULLARG23 +#define NONNULLARG123 +#define NONNULLARG13 +#define NONNULLARG14 +#define NONNULLARG134 +#define NONNULLARG145 +#define NONNULLARG17 +#define NONNULLARG24 +#define NONNULLARG45 +#define NONNULLS_DEFINED +#endif /* NONNULLS_DEFINED */ +#ifndef NO_NNARGS +#define NO_NNARGS /*empty*/ +#endif /* NO_NNARGS */ + +/* + * Allow gcc and clang to catch the use of non-C99 functions that + * NetHack has replaced with a C99 standard function. The old non-C99 + * function will cause a link failure on non-Unix platforms, + * so it is preferrable to catch it early, during compile. + */ +#if !defined(X11_BUILD) && !defined(__cplusplus) +#if defined(__GNUC__) && !defined(__clang__) +#if __GNUC__ >= 12 +extern char *index(const char *s, int c) __attribute__ ((unavailable)); +extern char *rindex(const char *s, int c) __attribute__ ((unavailable)); +#endif +#endif +#if defined(__clang__) +#if __clang_major__ >= 7 +extern char *index(const char *s, int c) __attribute__ ((unavailable)); +extern char *rindex(const char *s, int c) __attribute__ ((unavailable)); +#endif +#endif +#endif + #endif /* TRADSTDC_H */ From 39dcedfd9cbb8a2e2fe6e364abab5a79f4d4d1d7 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 17:13:50 +0100 Subject: [PATCH 8/9] Add nh5 unixconf.h with NLE mods --- include/unixconf.h | 70 ++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/include/unixconf.h b/include/unixconf.h index 55cb8a052..86eaa3592 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixconf.h $NHDT-Date: 1555361298 2019/04/15 20:48:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.42 $ */ +/* NetHack 5.0 unixconf.h $NHDT-Date: 1711213886 2024/03/23 17:11:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.57 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -55,11 +55,6 @@ * particular, it should NOT be defined for the UNIXPC * unless you remove the use of the shared library in * the Makefile */ -#define TEXTCOLOR /* Use System V r3.2 terminfo color support - * and/or ANSI color support on termcap systems - * and/or X11 color. Note: if you get compiler - * warnings about 'has_colors()' being implicitly - * declared, uncomment NEED_HAS_COLORS_DECL below. */ #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control * (e.g., VSUSP) */ #define POSIX_TYPES /* use POSIX types for system calls and termios */ @@ -70,27 +65,9 @@ * Linux, Solaris 2.x */ -/* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for - X11 on SunOS 4.1.x, x>= 2. Do not define - for other X11 implementations. */ -/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ -/* #define BSD_43_BUG */ /* for real 4.3BSD cc's without schain botch fix */ -/* #define MICROPORT_BUG */ /* problems with large arrays in structs */ -/* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to - run with Microport Sys V/AT version 2.4. - By Jay Maynard */ -/* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization - */ - /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48 is available from your system */ -/* see sys/unix/snd86unx.shr for more information on these */ -/* #define UNIX386MUSIC */ /* play real music through speaker on systems - with music driver installed */ -/* #define VPIX_MUSIC */ /* play real music through speaker on systems - with built-in VPIX support */ - /* * The next two defines are intended mainly for the Andrew File System, * which does not allow hard links. If NO_FILE_LINKS is defined, lock files @@ -111,13 +88,15 @@ /* * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" * If defined, it can be overridden by the environment variable PAGER. - * Hack will use its internal pager if DEF_PAGER is not defined. - * (This might be preferable for security reasons.) + * NetHack will use its internal pager if DEF_PAGER is not defined _or_ + * if DLB is defined since an external pager won't know how to access the + * contents of the dlb container file. + * (Note: leaving DEF_PAGER undefined is preferable for security reasons.) */ -/* #define DEF_PAGER ".../mydir/mypager" */ +/* #define DEF_PAGER "/usr/bin/less" */ /* - * Define PORT_HELP to be the name of the port-specfic help file. + * Define PORT_HELP to be the name of the port-specific help file. * This file is found in HACKDIR. * Normally, you shouldn't need to change this. * There is currently no port-specific help for Unix systems. @@ -135,10 +114,11 @@ */ /* #define TIMED_DELAY */ /* usleep() */ #endif -#if defined(MACOSX) && !defined(TIMED_DELAY) +#if defined(MACOS) && !defined(TIMED_DELAY) #define TIMED_DELAY #endif +/* NLE: Define AVOID_WIN_IOCTL */ #define AVOID_WIN_IOCTL /* ensure USE_WIN_IOCTL remains undefined */ /* @@ -291,8 +271,11 @@ #endif #endif #endif + +#ifndef NOSUSPEND #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX) -#define SUSPEND /* let ^Z suspend the game */ +#define SUSPEND /* let ^Z suspend the game (push to background) */ +#endif #endif /* @@ -305,10 +288,18 @@ #if defined(BSD) || defined(ULTRIX) #include -#else -#include #endif +/* these might be needed for include/system.h; + default comes from system's time.h */ +/* #define NEED_TIME_DECL 1 */ +/* #define NEED_LOCALTIME_DECL 1 */ +/* #define NEED_CTIME_DECL 1 */ +/* these might be needed for src/hacklib.c; + default is 'time_t *' */ +/* #define TIME_type long * */ +/* #define LOCALTIME_type long * */ + #define HLOCK "perm" /* an empty file used for locking purposes */ #define tgetch getchar @@ -317,10 +308,7 @@ #define SHELL /* do not delete the '!' command */ #endif -#include "system.h" - #if defined(POSIX_TYPES) || defined(__GNUC__) -#include #include #endif @@ -338,19 +326,21 @@ #include #endif #else /* therefore SYSV */ +#ifdef NOT_C99 #ifndef index /* some systems seem to do this for you */ #define index strchr #endif #ifndef rindex #define rindex strrchr #endif -#endif +#endif /* NOT_C99 */ +#endif /* SYSV */ /* Use the high quality random number routines. */ /* the high quality random number routines */ #ifndef USE_ISAAC64 # if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \ - || defined(RANDOM) || defined(MACOSX) + || defined(RANDOM) || defined(MACOS) # define Rand() random() # else # define Rand() lrand48() @@ -366,7 +356,7 @@ #endif #endif -/* Relevant for some systems which enable TEXTCOLOR: some older versions +/* Relevant for some systems: some older versions of curses (the run-time library optionally used by nethack's tty interface in addition to its curses interface) supply 'has_colors()' but corresponding doesn't declare it. has_colors() is used @@ -407,7 +397,7 @@ #endif /* LINUX */ #endif /* GNOME_GRAPHICS */ -#ifdef MACOSX +#if defined(MACOS) && !defined(LIBNH) # define RUNTIME_PASTEBUF_SUPPORT #endif @@ -420,7 +410,7 @@ #ifdef LINUX # define DEV_RANDOM "/dev/urandom" #else -# if defined(BSD) || defined(MACOSX) +# if defined(BSD) || defined(MACOS) # define DEV_RANDOM "/dev/random" # endif #endif From 073f559be25041a11b82b73292d07e5c45dfe624 Mon Sep 17 00:00:00 2001 From: Stephen Oman Date: Sat, 6 Jun 2026 17:25:56 +0100 Subject: [PATCH 9/9] Add nh5 wintty.h with NLE mods --- include/wintty.h | 393 +++++++++++++++++++++++++++++------------------ 1 file changed, 242 insertions(+), 151 deletions(-) diff --git a/include/wintty.h b/include/wintty.h index e32f766e0..8240101a5 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -1,38 +1,61 @@ -/* NetHack 3.6 wintty.h $NHDT-Date: 1558330405 2019/05/20 05:33:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.34 $ */ -/* Copyright (c) David Cohrs, 1991,1992 */ +/* NetHack 5.0 wintty.h $NHDT-Date: 1656014599 2022/06/23 20:03:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.55 $ */ +/* Copyright (c) David Cohrs, 1991,1992 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef WINTTY_H #define WINTTY_H -#define E extern - #ifndef WINDOW_STRUCTS #define WINDOW_STRUCTS +#ifdef TTY_PERM_INVENT + +enum { tty_perminv_minrow = 28, tty_perminv_mincol = 79 }; +/* for static init of zerottycell, put pointer first */ +union ttycellcontent { + glyph_info *gi; + char ttychar; +}; +struct tty_perminvent_cell { + Bitfield(refresh, 1); + Bitfield(text, 1); + Bitfield(glyph, 1); + union ttycellcontent content; + uint32 color; /* adjusted color 0 = ignore + * 1-16 = NetHack color + 1 + * 17..16,777,233 = 24-bit color + 17 + */ +}; +#endif + /* menu structure */ typedef struct tty_mi { struct tty_mi *next; anything identifier; /* user identifier */ long count; /* user count */ char *str; /* description string (including accelerator) */ + glyph_info glyphinfo; /* glyph */ int attr; /* string attribute */ + int color; /* string color */ boolean selected; /* TRUE if selected by user */ + unsigned itemflags; /* item flags */ char selector; /* keyboard accelerator */ char gselector; /* group accelerator */ } tty_menu_item; /* descriptor for tty-based windows */ struct WinDesc { - int flags; /* window flags */ - xchar type; /* type of window */ - boolean active; /* true if window is active */ - short offx, offy; /* offset from topleft of display */ - long rows, cols; /* dimensions */ - long curx, cury; /* current cursor position */ - long maxrow, maxcol; /* the maximum size used -- for MENU wins */ - /* maxcol is also used by WIN_MESSAGE for */ - /* tracking the ^P command */ + int flags; /* window flags */ + xint16 type; /* type of window */ + boolean active; /* true if window is active */ + boolean blanked; /* for erase_tty_screen(); not used [yet?] */ + short offx, offy; /* offset from topleft of display */ + long rows, cols; /* dimensions */ + long curx, cury; /* current cursor position */ + long maxrow, maxcol; /* the maximum size used -- for MENU wins; + * maxcol is also used by WIN_MESSAGE for + * tracking the ^P command */ + unsigned long mbehavior; /* menu behavior flags (MENU) */ short *datlen; /* allocation size for *data */ char **data; /* window data [row][column] */ char *morestr; /* string to display instead of default */ @@ -43,28 +66,44 @@ struct WinDesc { long nitems; /* total number of items (MENU) */ short how; /* menu mode - pick 1 or N (MENU) */ char menu_ch; /* menu char (MENU) */ +#ifdef TTY_PERM_INVENT + struct tty_perminvent_cell **cells; +#endif }; /* window flags */ #define WIN_CANCELLED 1 -#define WIN_STOP 1 /* for NHW_MESSAGE; stops output */ +#define WIN_STOP 1 /* for NHW_MESSAGE; stops output; sticks until + * next input request or reversed by WIN_NOSTOP */ #define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */ +#define WIN_NOSTOP 4 /* current message has been designated as urgent; + * prevents WIN_STOP from becoming set if current + * message triggers --More-- and user types ESC + * (current message won't have been seen yet) */ + +/* topline states */ +#define TOPLINE_EMPTY 0 /* empty */ +#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ +#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ +#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ /* descriptor for tty-based displays -- all the per-display data */ struct DisplayDesc { - short rows, cols; /* width and height of tty display */ - short curx, cury; /* current cursor position on the screen */ -#ifdef TEXTCOLOR - int color; /* current color */ -#endif - int attrs; /* attributes in effect */ - int toplin; /* flag for topl stuff */ - int rawprint; /* number of raw_printed lines since synch */ - int inmore; /* non-zero if more() is active */ - int inread; /* non-zero if reading a character */ - int intr; /* non-zero if inread was interrupted */ - winid lastwin; /* last window used for I/O */ - char dismiss_more; /* extra character accepted at --More-- */ + short rows, cols; /* width and height of tty display */ + short curx, cury; /* current cursor position on the screen */ + uint32 color; /* current color */ + uint32 colorflags; /* NH_BASIC_COLOR or 24-bit color */ + uint32 framecolor; /* current background color */ + int attrs; /* attributes in effect */ + int toplin; /* flag for topl stuff */ + int rawprint; /* number of raw_printed lines since synch */ + int inmore; /* non-zero if more() is active */ + int inread; /* non-zero if reading a character */ + int intr; /* non-zero if inread was interrupted */ + winid lastwin; /* last window used for I/O */ + char dismiss_more; /* extra character accepted at --More-- */ + int topl_utf8; /* non-zero if utf8 in str */ + int mixed; /* we are processing mixed output */ }; #endif /* WINDOW_STRUCTS */ @@ -89,7 +128,9 @@ struct tty_status_fields { #ifdef NHW_BASE #undef NHW_BASE #endif -#define NHW_BASE 6 +#define NHW_BASE (NHW_LAST_TYPE + 1) + +/* external declarations */ extern struct window_procs tty_procs; @@ -106,140 +147,191 @@ extern char defmorestr[]; /* default --more-- prompt */ /* port specific external function references */ /* ### getline.c ### */ -E void FDECL(xwaitforspace, (const char *)); -/* ### termcap.c, video.c ### */ +extern void xwaitforspace(const char *); -E void FDECL(tty_startup, (int *, int *)); -#ifndef NO_TERMS -E void NDECL(tty_shutdown); -#endif -E int FDECL(xputc, (int)); -E void FDECL(xputs, (const char *)); -#if defined(SCREEN_VGA) || defined(SCREEN_8514) -E void FDECL(xputg, (int, int, unsigned)); -#endif -E void NDECL(cl_end); -E void NDECL(clear_screen); -E void NDECL(home); -E void NDECL(standoutbeg); -E void NDECL(standoutend); -#if 0 -E void NDECL(revbeg); -E void NDECL(boldbeg); -E void NDECL(blinkbeg); -E void NDECL(dimbeg); -E void NDECL(m_end); -#endif -E void NDECL(backsp); -E void NDECL(graph_on); -E void NDECL(graph_off); -E void NDECL(cl_eos); +/* ### termcap.c, video.c ### */ /* - * termcap.c (or facsimiles in other ports) is the right place for doing - * strange and arcane things such as outputting escape sequences to select - * a color or whatever. wintty.c should concern itself with WHERE to put - * stuff in a window. + * TERM or NO_TERMS + * + * The tty windowport interface relies on lower-level support routines + * to actually manipulate the terminal/display. Those are the right place + * for doing strange and arcane things such as outputting escape sequences + * to select a color or whatever. wintty.c should concern itself with WHERE + * to put stuff in a window. + + * The TERM routines are found in: + * + * !NO_TERMS: termcap.c + * + * NO_TERMS: + * WINCON sys/windows/consoletty.c + * MSDOS sys/msdos/video.c + * */ -E int FDECL(term_attr_fixup, (int)); -E void FDECL(term_start_attr, (int attr)); -E void FDECL(term_end_attr, (int attr)); -E void NDECL(term_start_raw_bold); -E void NDECL(term_end_raw_bold); - -#ifdef TEXTCOLOR -E void NDECL(term_end_color); -E void FDECL(term_start_color, (int color)); -E int FDECL(has_color, (int color)); -#endif /* TEXTCOLOR */ +extern void backsp(void); +extern void cl_end(void); +extern void cl_eos(void); +extern void graph_on(void); +extern void graph_off(void); +extern void home(void); +extern void standoutbeg(void); +extern void standoutend(void); +extern int term_attr_fixup(int); +extern void term_clear_screen(void); +extern void term_curs_set(int); +extern void term_end_attr(int attr); +extern void term_end_color(void); +extern void term_end_extracolor(void); +extern void term_end_raw_bold(void); +extern void term_end_screen(void); +extern void term_start_attr(int attr); +extern void term_start_bgcolor(int color); +extern void term_start_color(int color); +extern void term_start_extracolor(uint32, uint16); +extern void term_start_raw_bold(void); +extern void term_start_screen(void); +extern void term_startup(int *, int *); +extern void term_shutdown(void); + +extern int xputc(int); +extern void xputs(const char *); +#if 0 +extern void revbeg(void); +extern void boldbeg(void); +extern void blinkbeg(void); +extern void dimbeg(void); +extern void m_end(void); +#endif +#if defined(SCREEN_VGA) || defined(SCREEN_8514) || defined(SCREEN_VESA) +extern void xputg(const glyph_info *, const glyph_info *); +#endif /* ### topl.c ### */ -E void FDECL(show_topl, (const char *)); -E void NDECL(remember_topl); -E void FDECL(addtopl, (const char *)); -E void NDECL(more); -E void FDECL(update_topl, (const char *)); -E void FDECL(putsyms, (const char *)); +extern void show_topl(const char *); +extern void remember_topl(void); +extern void addtopl(const char *); +extern void more(void); +extern void update_topl(const char *); +extern void putsyms(const char *); /* ### wintty.c ### */ + #ifdef CLIPPING -E void NDECL(setclipped); +extern void setclipped(void); #endif -E void FDECL(docorner, (int, int)); -E void NDECL(end_glyphout); -E void FDECL(g_putch, (int)); -E void FDECL(win_tty_init, (int)); - -/* external declarations */ -E void FDECL(tty_init_nhwindows, (int *, char **)); -E void FDECL(tty_preference_update, (const char *)); -E void NDECL(tty_player_selection); -E void NDECL(tty_askname); -E void NDECL(tty_get_nh_event); -E void FDECL(tty_exit_nhwindows, (const char *)); -E void FDECL(tty_suspend_nhwindows, (const char *)); -E void NDECL(tty_resume_nhwindows); -E winid FDECL(tty_create_nhwindow, (int)); -E void FDECL(tty_clear_nhwindow, (winid)); -E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P)); -E void FDECL(tty_dismiss_nhwindow, (winid)); -E void FDECL(tty_destroy_nhwindow, (winid)); -E void FDECL(tty_curs, (winid, int, int)); -E void FDECL(tty_putstr, (winid, int, const char *)); -E void FDECL(tty_display_file, (const char *, BOOLEAN_P)); -E void FDECL(tty_start_menu, (winid)); -E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); -E void FDECL(tty_end_menu, (winid, const char *)); -E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **)); -E char FDECL(tty_message_menu, (CHAR_P, int, const char *)); -E void NDECL(tty_update_inventory); -E void NDECL(tty_mark_synch); -E void NDECL(tty_wait_synch); +extern void docorner(int, int, int); +extern void end_glyphout(void); +extern void g_putch(int); +#ifdef ENHANCED_SYMBOLS +#if defined(WIN32) || defined(UNIX) || defined(MSDOS) +extern void g_pututf8(uint8 *); +#endif +#endif /* ENHANCED_SYMBOLS */ +extern void erase_tty_screen(void); +extern void win_tty_init(int); + +/* tty interface */ +extern void tty_init_nhwindows(int *, char **); +extern void tty_preference_update(const char *); +extern void tty_player_selection(void); +extern void tty_askname(void); +extern void tty_get_nh_event(void); +extern void tty_exit_nhwindows(const char *); +extern void tty_suspend_nhwindows(const char *); +extern void tty_resume_nhwindows(void); +extern winid tty_create_nhwindow(int); +extern void tty_clear_nhwindow(winid); +extern void tty_display_nhwindow(winid, boolean); +extern void tty_dismiss_nhwindow(winid); +extern void tty_destroy_nhwindow(winid); +extern void tty_curs(winid, int, int); +extern void tty_putstr(winid, int, const char *); +extern void tty_putmixed(winid window, int attr, const char *str); +extern void tty_display_file(const char *, boolean); +extern void tty_start_menu(winid, unsigned long); +extern void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, + char, int, int, const char *, unsigned int); +extern void tty_end_menu(winid, const char *); +extern int tty_select_menu(winid, int, MENU_ITEM_P **); +extern char tty_message_menu(char, int, const char *); +extern void tty_mark_synch(void); +extern void tty_wait_synch(void); #ifdef CLIPPING -E void FDECL(tty_cliparound, (int, int)); +extern void tty_cliparound(int, int); #endif #ifdef POSITIONBAR -E void FDECL(tty_update_positionbar, (char *)); +extern void tty_update_positionbar(char *); #endif -E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int)); -E void FDECL(tty_raw_print, (const char *)); -E void FDECL(tty_raw_print_bold, (const char *)); -E int NDECL(tty_nhgetch); -E int FDECL(tty_nh_poskey, (int *, int *, int *)); -E void NDECL(tty_nhbell); -E int NDECL(tty_doprev_message); -E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P)); -E void FDECL(tty_getlin, (const char *, char *)); -E int NDECL(tty_get_ext_cmd); -E void FDECL(tty_number_pad, (int)); -E void NDECL(tty_delay_output); +extern void tty_print_glyph(winid, coordxy, coordxy, const glyph_info *, + const glyph_info *); +extern void tty_raw_print(const char *); +extern void tty_raw_print_bold(const char *); +extern int tty_nhgetch(void); +extern int tty_nh_poskey(coordxy *, coordxy *, int *); +extern void tty_nhbell(void); +extern int tty_doprev_message(void); +extern char tty_yn_function(const char *, const char *, char); +extern void tty_getlin(const char *, char *); +extern int tty_get_ext_cmd(void); +extern void tty_number_pad(int); +extern void tty_delay_output(void); #ifdef CHANGE_COLOR -E void FDECL(tty_change_color, (int color, long rgb, int reverse)); -#ifdef MAC -E void FDECL(tty_change_background, (int white_or_black)); -E short FDECL(set_tty_font_name, (winid, char *)); +extern void tty_change_color(int color, long rgb, int reverse); +#ifdef MACOS9 +extern void tty_change_background(int white_or_black); +extern short set_tty_font_name(winid, char *); #endif -E char *NDECL(tty_get_color_string); +extern char *tty_get_color_string(void); #endif -E void FDECL(tty_status_enablefield, - (int, const char *, const char *, BOOLEAN_P)); -E void NDECL(tty_status_init); -E void FDECL(tty_status_update, (int, genericptr_t, int, int, int, unsigned long *)); +extern void tty_status_enablefield(int, const char *, const char *, boolean); +extern void tty_status_init(void); +extern void tty_status_update(int, genericptr_t, int, int, + int, unsigned long *); -/* other defs that really should go away (they're tty specific) */ -E void NDECL(tty_start_screen); -E void NDECL(tty_end_screen); +extern void genl_outrip(winid, int, time_t); -E void FDECL(genl_outrip, (winid, int, time_t)); +extern char *tty_getmsghistory(boolean); +extern void tty_putmsghistory(const char *, boolean); +extern void tty_update_inventory(int); +extern win_request_info *tty_ctrl_nhwindow(winid, int, win_request_info *); -E char *FDECL(tty_getmsghistory, (BOOLEAN_P)); -E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); +#ifdef TTY_PERM_INVENT +extern void tty_refresh_inventory(int start, int stop, int y); +#endif -#ifdef NO_TERMS -#ifdef MAC +/* termcap is implied if NO_TERMS is not defined */ +#ifndef NO_TERMS +#ifndef NO_TERMCAP_HEADERS +#include +#ifdef clear_screen /* avoid a conflict */ +#undef clear_screen +#endif +#include +#ifdef bell +#undef bell +#endif +#ifdef color_names +#undef color_names +#endif +#ifdef tone +#undef tone +#endif +#ifdef hangup +#undef hangup +#endif +#else +extern int tgetent(char *, const char *); +extern void tputs(const char *, int, int (*)(int)); +extern int tgetnum(const char *); +extern int tgetflag(const char *); +extern char *tgetstr(const char *, char **); +extern char *tgoto(const char *, int, int); +#endif /* NO_TERMCAP_HEADERS */ +#else /* ?NO_TERMS */ +#ifdef MACOS9 #ifdef putchar #undef putchar #undef putc @@ -247,10 +339,10 @@ E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); #define putchar term_putc #define fflush term_flush #define puts term_puts -E int FDECL(term_putc, (int c)); -E int FDECL(term_flush, (void *desc)); -E int FDECL(term_puts, (const char *str)); -#endif /* MAC */ +extern int term_putc(int c); +extern int term_flush(void *desc); +extern int term_puts(const char *str); +#endif /* MACOS9 */ #if defined(MSDOS) || defined(WIN32) #if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32) #undef putchar @@ -261,25 +353,24 @@ E int FDECL(term_puts, (const char *str)); #define puts(x) xputs(x) #endif /*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32 */ #ifdef POSITIONBAR -E void FDECL(video_update_positionbar, (char *)); +extern void video_update_positionbar(char *); #endif #endif /*MSDOS*/ -#endif /*NO_TERMS*/ +#endif /* NO_TERMS */ +/* NLE mod */ #ifdef RL_GRAPHICS #undef putchar #undef puts #undef fflush -E int FDECL(nle_putchar, (int) ); -E int FDECL(nle_puts, (const char *) ); -E int FDECL(nle_xputs, (const char *) ); -E int FDECL(nle_fflush, (FILE *) ); +extern int nle_putchar(int); +extern int nle_puts(const char *); +extern int nle_xputs(const char *); +extern int nle_fflush(FILE *); #define putchar nle_putchar #define puts nle_puts #define fflush nle_fflush #endif /*RL_GRAPHICS*/ -#undef E - #endif /* WINTTY_H */