From 8b57d96fd2b25a1f39eefd83bc63cf9a092e7fc0 Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Mon, 25 May 2015 09:03:10 +0900 Subject: [PATCH] Reformat .h files. I did my best to exempt some of the bigger aligned blocks from the reformatting using the /* clang-format off */ and /* clang-format on */ tags. Probably some that shouldn't have been formatted were anyway; if you encounter them, please fix. The clang-format tags were left in on the basis that it's much easier to prune those out later than to put them back in, and it means that, modulo my custom version of clang-format, I should be able to run clang-format on the source tree again without changing anything, now that Pat has fixed the VA_DECL issues. --- include/align.h | 45 +- include/amiconf.h | 119 +-- include/artifact.h | 100 +-- include/artilist.h | 456 +++++------ include/attrib.h | 51 +- include/beconf.h | 7 +- include/bitmfile.h | 22 +- include/botl.h | 96 +-- include/color.h | 64 +- include/config.h | 233 +++--- include/config1.h | 226 +++--- include/context.h | 157 ++-- include/coord.h | 2 +- include/decl.h | 355 ++++---- include/def_os2.h | 221 ++--- include/dgn_file.h | 66 +- include/display.h | 365 +++++---- include/dlb.h | 128 ++- include/dungeon.h | 336 ++++---- include/engrave.h | 29 +- include/extern.h | 1568 ++++++++++++++++++------------------ include/flag.h | 518 ++++++------ include/func_tab.h | 14 +- include/gem_rsc.h | 103 ++- include/global.h | 326 ++++---- include/hack.h | 486 +++++------ include/lev.h | 46 +- include/lint.h | 71 +- include/load_img.h | 47 +- include/mac-carbon.h | 2 +- include/mac-qt.h | 2 +- include/mac-term.h | 6 +- include/macconf.h | 87 +- include/macpopup.h | 2 +- include/mactty.h | 209 ++--- include/macwin.h | 181 +++-- include/mail.h | 17 +- include/mextra.h | 174 ++-- include/mfndpos.h | 36 +- include/micro.h | 4 +- include/mkroom.h | 147 ++-- include/monattk.h | 143 ++-- include/mondata.h | 339 ++++---- include/monflag.h | 336 ++++---- include/monst.h | 236 +++--- include/monsym.h | 254 +++--- include/mttypriv.h | 72 +- include/ntconf.h | 197 ++--- include/obj.h | 543 ++++++------- include/objclass.h | 305 +++---- include/os2conf.h | 44 +- include/patchlevel.h | 28 +- include/pcconf.h | 335 ++++---- include/permonst.h | 63 +- include/prop.h | 243 +++--- include/qt_clust.h | 33 +- include/qt_kde0.h | 5 +- include/qt_win.h | 1305 +++++++++++++++--------------- include/qt_xpms.h | 129 +-- include/qtext.h | 141 ++-- include/qttableview.h | 389 +++++---- include/quest.h | 74 +- include/rect.h | 4 +- include/region.h | 74 +- include/rm.h | 705 ++++++++-------- include/skills.h | 134 ++- include/sp_lev.h | 517 ++++++------ include/spell.h | 18 +- include/sys.h | 57 +- include/system.h | 562 ++++++------- include/tcap.h | 24 +- include/tile2x11.h | 2 +- include/timeout.h | 42 +- include/tosconf.h | 36 +- include/tradstdc.h | 357 ++++---- include/trampoli.h | 290 +++---- include/trap.h | 106 +-- include/unixconf.h | 329 ++++---- include/vision.h | 42 +- include/vmsconf.h | 188 ++--- include/wceconf.h | 288 ++++--- include/winGnome.h | 2 +- include/winX.h | 429 +++++----- include/winami.h | 145 ++-- include/wingem.h | 44 +- include/winprocs.h | 290 ++++--- include/wintty.h | 174 ++-- include/wintype.h | 106 +-- include/xwindow.h | 52 +- include/xwindowp.h | 56 +- include/you.h | 615 +++++++------- include/youprop.h | 511 ++++++------ sys/amiga/windefs.h | 150 ++-- sys/amiga/winext.h | 62 +- sys/amiga/winproto.h | 227 +++--- sys/msdos/pctiles.h | 69 +- sys/msdos/pcvideo.h | 327 ++++---- sys/msdos/portio.h | 60 +- sys/share/dgn_comp.h | 86 +- sys/share/lev_comp.h | 432 +++++----- sys/vms/lev_lex.h | 6 +- sys/wince/ceinc/assert.h | 11 +- sys/wince/ceinc/errno.h | 1 - sys/wince/ceinc/fcntl.h | 62 +- sys/wince/ceinc/sys/stat.h | 1 - sys/wince/mhaskyn.h | 2 +- sys/wince/mhcmd.h | 16 +- sys/wince/mhdlg.h | 7 +- sys/wince/mhinput.h | 57 +- sys/wince/mhmain.h | 3 +- sys/wince/mhmap.h | 11 +- sys/wince/mhmenu.h | 10 +- sys/wince/mhmsg.h | 60 +- sys/wince/mhmsgwnd.h | 5 +- sys/wince/mhrip.h | 5 +- sys/wince/mhstatus.h | 4 +- sys/wince/mhtext.h | 4 +- sys/wince/mhtxtbuf.h | 4 +- sys/wince/newres.h | 39 +- sys/wince/resource.h | 308 +++---- sys/wince/winMS.h | 115 ++- sys/winnt/win32api.h | 23 +- util/mdgrep.h | 226 +++--- win/Qt/tileedit.h | 119 +-- win/gem/gr_rect.h | 10 +- win/gnome/gn_xpms.h | 5 +- win/gnome/gnaskstr.h | 6 +- win/gnome/gnbind.h | 40 +- win/gnome/gnglyph.h | 29 +- win/gnome/gnmain.h | 16 +- win/gnome/gnmenu.h | 25 +- win/gnome/gnmesg.h | 7 +- win/gnome/gnomeprv.h | 5 +- win/gnome/gnopts.h | 5 +- win/gnome/gnplayer.h | 2 +- win/gnome/gnsignal.h | 45 +- win/gnome/gnstatus.h | 2 +- win/gnome/gntext.h | 9 +- win/gnome/gnworn.h | 2 +- win/gnome/gnyesno.h | 5 +- win/share/tile.h | 19 +- win/win32/mhaskyn.h | 3 +- win/win32/mhdlg.h | 8 +- win/win32/mhfont.h | 1 - win/win32/mhinput.h | 57 +- win/win32/mhmain.h | 3 +- win/win32/mhmap.h | 12 +- win/win32/mhmenu.h | 14 +- win/win32/mhmsg.h | 79 +- win/win32/mhmsgwnd.h | 6 +- win/win32/mhrip.h | 5 +- win/win32/mhsplash.h | 3 +- win/win32/mhstatus.h | 5 +- win/win32/mhtext.h | 5 +- win/win32/resource.h | 288 +++---- win/win32/winMS.h | 209 +++-- 156 files changed, 10995 insertions(+), 10984 deletions(-) diff --git a/include/align.h b/include/align.h index 2b058ada0..cef60c01c 100644 --- a/include/align.h +++ b/include/align.h @@ -7,38 +7,39 @@ #ifndef ALIGN_H #define ALIGN_H -typedef schar aligntyp; /* basic alignment type */ +typedef schar aligntyp; /* basic alignment type */ -typedef struct align { /* alignment & record */ - aligntyp type; - int record; +typedef struct align { /* alignment & record */ + aligntyp type; + int record; } align; /* bounds for "record" -- respect initial alignments of 10 */ -#define ALIGNLIM (10L + (moves/200L)) +#define ALIGNLIM (10L + (moves / 200L)) -#define A_NONE (-128) /* the value range of type */ +#define A_NONE (-128) /* the value range of type */ -#define A_CHAOTIC (-1) -#define A_NEUTRAL 0 -#define A_LAWFUL 1 +#define A_CHAOTIC (-1) +#define A_NEUTRAL 0 +#define A_LAWFUL 1 -#define A_COALIGNED 1 -#define A_OPALIGNED (-1) +#define A_COALIGNED 1 +#define A_OPALIGNED (-1) -#define AM_NONE 0 -#define AM_CHAOTIC 1 -#define AM_NEUTRAL 2 -#define AM_LAWFUL 4 +#define AM_NONE 0 +#define AM_CHAOTIC 1 +#define AM_NEUTRAL 2 +#define AM_LAWFUL 4 -#define AM_MASK 7 +#define AM_MASK 7 -#define AM_SPLEV_CO 3 -#define AM_SPLEV_NONCO 7 +#define AM_SPLEV_CO 3 +#define AM_SPLEV_NONCO 7 -#define Amask2align(x) ((aligntyp) ((!(x)) ? A_NONE \ - : ((x) == AM_LAWFUL) ? A_LAWFUL : ((int)x) - 2)) -#define Align2amask(x) (((x) == A_NONE) ? AM_NONE \ - : ((x) == A_LAWFUL) ? AM_LAWFUL : (x) + 2) +#define Amask2align(x) \ + ((aligntyp)((!(x)) ? A_NONE : ((x) == AM_LAWFUL) ? A_LAWFUL \ + : ((int) x) - 2)) +#define Align2amask(x) \ + (((x) == A_NONE) ? AM_NONE : ((x) == A_LAWFUL) ? AM_LAWFUL : (x) + 2) #endif /* ALIGN_H */ diff --git a/include/amiconf.h b/include/amiconf.h index 826fe521d..ce4594b7f 100644 --- a/include/amiconf.h +++ b/include/amiconf.h @@ -1,76 +1,77 @@ /* NetHack 3.6 amiconf.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.6 amiconf.h $Date: 2012/01/10 17:47:16 $ $Revision: 1.8 $ */ -/* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1990, 1991, 1992, 1993. */ +/* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1990, 1991, 1992, 1993. + */ /* NetHack may be freely redistributed. See license for details. */ #ifndef AMICONF_H #define AMICONF_H -#undef abs /* avoid using macro form of abs */ +#undef abs /* avoid using macro form of abs */ #ifndef __SASC_60 -# undef min /* this gets redefined */ -# undef max /* this gets redefined */ +#undef min /* this gets redefined */ +#undef max /* this gets redefined */ #endif -#include /* get time_t defined before use! */ +#include /* get time_t defined before use! */ -#ifdef __SASC_60 /* since SAS can prevent re-inclusion */ -#include /* general things, including builtins */ +#ifdef __SASC_60 /* since SAS can prevent re-inclusion */ +#include /* general things, including builtins */ #include #endif #ifdef AZTEC_50 #include -# define AZTEC_C_WORKAROUND /* Bug which turns up in sounds.c. Bummer... */ -# define NO_SIGNAL /* 5.0 signal handling doesn't like SIGINT... */ +#define AZTEC_C_WORKAROUND /* Bug which turns up in sounds.c. Bummer... */ +#define NO_SIGNAL /* 5.0 signal handling doesn't like SIGINT... */ #endif #ifdef _DCC #include -# define _SIZE_T -# define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */ +#define _SIZE_T +#define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */ #endif #ifndef __GNUC__ typedef long off_t; #endif -#define MICRO /* must be defined to allow some inclusions */ +#define MICRO /* must be defined to allow some inclusions */ -#define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR, - LEVELDIR, SAVEDIR, BONESDIR, DATADIR, - SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */ +#define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR, \ + LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \ + SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */ /* data librarian defs */ #ifndef NOCWD_ASSUMPTIONS -# define DLBFILE "NetHack:nhdat" /* main library */ -# define DLBFILE2 "NetHack:nhsdat" /* sound library */ +#define DLBFILE "NetHack:nhdat" /* main library */ +#define DLBFILE2 "NetHack:nhsdat" /* sound library */ #else -# define DLBFILE "nhdat" /* main library */ -# define DLBFILE2 "nhsdat" /* sound library */ +#define DLBFILE "nhdat" /* main library */ +#define DLBFILE2 "nhsdat" /* sound library */ #endif -#define FILENAME_CMP stricmp /* case insensitive */ +#define FILENAME_CMP stricmp /* case insensitive */ #ifndef __SASC_60 -# define O_BINARY 0 +#define O_BINARY 0 #endif /* Compile in New Intuition look for 2.0 */ -#ifdef IDCMP_CLOSEWINDOW -# ifndef INTUI_NEW_LOOK -# define INTUI_NEW_LOOK 1 -# endif +#ifdef IDCMP_CLOSEWINDOW +#ifndef INTUI_NEW_LOOK +#define INTUI_NEW_LOOK 1 +#endif #endif -#define MFLOPPY /* You'll probably want this; provides assistance - * for typical personal computer configurations - */ +#define MFLOPPY /* You'll probably want this; provides assistance \ + * for typical personal computer configurations \ + */ #define RANDOM /* ### amidos.c ### */ -extern void FDECL(nethack_exit, (int)); +extern void FDECL(nethack_exit, (int)); /* ### amiwbench.c ### */ @@ -82,7 +83,7 @@ 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 FDECL(getlind, (const char *, char *, const char *)); /* ### winreq.c ### */ @@ -109,14 +110,14 @@ extern char **ami_argv; #endif #ifndef PCCONF_H -#include "pcconf.h" /* remainder of stuff is almost same as the PC */ +#include "pcconf.h" /* remainder of stuff is almost same as the PC */ #endif -#define remove(x) unlink(x) +#define remove(x) unlink(x) /* DICE wants rewind() to return void. We want it to return int. */ #if defined(_DCC) || defined(__GNUC__) -# define rewind(f) fseek(f, 0, 0) +#define rewind(f) fseek(f, 0, 0) #endif #ifdef AZTEC_C @@ -124,68 +125,68 @@ extern FILE *FDECL(freopen, (const char *, const char *, FILE *)); extern char *FDECL(gets, (char *)); #endif -#define msmsg printf +#define msmsg printf /* * If AZTEC_C we can't use the long cpath in vision.c.... */ #ifdef AZTEC_C -# undef MACRO_CPATH +#undef MACRO_CPATH #endif /* * (Possibly) configurable Amiga options: */ -#define TEXTCOLOR /* Use colored monsters and objects */ -#define HACKFONT /* Use special hack.font */ -#define SHELL /* Have a shell escape command (!) */ -#define MAIL /* Get mail at unexpected occasions */ -#define DEFAULT_ICON "NetHack:default.icon" /* private icon */ -#define AMIFLUSH /* toss typeahead (select flush in .cnf) */ +#define TEXTCOLOR /* Use colored monsters and objects */ +#define HACKFONT /* Use special hack.font */ +#define SHELL /* Have a shell escape command (!) */ +#define MAIL /* Get mail at unexpected occasions */ +#define DEFAULT_ICON "NetHack:default.icon" /* private icon */ +#define AMIFLUSH /* toss typeahead (select flush in .cnf) */ /* #define OPT_DISPMAP /* enable fast_map option */ /* new window system options */ - /* WRONG - AMIGA_INTUITION should go away */ +/* WRONG - AMIGA_INTUITION should go away */ #ifdef AMII_GRAPHICS -# define AMIGA_INTUITION /* high power graphics interface (amii) */ +#define AMIGA_INTUITION /* high power graphics interface (amii) */ #endif -#define CHANGE_COLOR 1 +#define CHANGE_COLOR 1 -#ifdef TEXTCOLOR -# define DEPTH 6 /* Maximum depth of the screen allowed */ +#ifdef TEXTCOLOR +#define DEPTH 6 /* Maximum depth of the screen allowed */ #else -# define DEPTH 2 /* Four colors...sigh... */ +#define DEPTH 2 /* Four colors...sigh... */ #endif -#define AMII_MAXCOLORS (1L< /* for time_t */ -#include /* for lseek() */ +#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 diff --git a/include/bitmfile.h b/include/bitmfile.h index cef1cf9cb..e035a1127 100644 --- a/include/bitmfile.h +++ b/include/bitmfile.h @@ -14,24 +14,20 @@ #define ULONG unsigned long #define UBYTE unsigned char -#define XIMG_MAGIC 0x58494D47 - +#define XIMG_MAGIC 0x58494D47 typedef enum { IMG, XIMG } FILE_TYP; const char *get_file_ext(FILE_TYP typ); -struct RGB - { - UWORD r, g, b; - }; +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) ) ; +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/botl.h b/include/botl.h index f2ad4924c..65a893ebb 100644 --- a/include/botl.h +++ b/include/botl.h @@ -1,6 +1,6 @@ -/* NetHack 3.6 botl.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* NetHack 3.6 botl.h $Date: 2012/01/10 17:47:16 $ $Revision: 1.6 $ */ -/* Copyright (c) Michael Allison, 2003 */ +/* NetHack 3.6 botl.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.6 botl.h $Date: 2012/01/10 17:47:16 $ $Revision: 1.6 $ */ +/* Copyright (c) Michael Allison, 2003 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef BOTL_H @@ -8,58 +8,62 @@ #ifdef STATUS_VIA_WINDOWPORT -#define BL_FLUSH -1 -#define BL_TITLE 0 -#define BL_STR 1 -#define BL_DX 2 -#define BL_CO 3 -#define BL_IN 4 -#define BL_WI 5 -#define BL_CH 6 -#define BL_ALIGN 7 -#define BL_SCORE 8 -#define BL_CAP 9 -#define BL_GOLD 10 -#define BL_ENE 11 -#define BL_ENEMAX 12 -#define BL_XP 13 -#define BL_AC 14 -#define BL_HD 15 -#define BL_TIME 16 -#define BL_HUNGER 17 -#define BL_HP 18 -#define BL_HPMAX 19 -#define BL_LEVELDESC 20 -#define BL_EXP 21 -#define BL_CONDITION 22 -#define MAXBLSTATS 23 +/* clang-format off */ +#define BL_FLUSH -1 +#define BL_TITLE 0 +#define BL_STR 1 +#define BL_DX 2 +#define BL_CO 3 +#define BL_IN 4 +#define BL_WI 5 +#define BL_CH 6 +#define BL_ALIGN 7 +#define BL_SCORE 8 +#define BL_CAP 9 +#define BL_GOLD 10 +#define BL_ENE 11 +#define BL_ENEMAX 12 +#define BL_XP 13 +#define BL_AC 14 +#define BL_HD 15 +#define BL_TIME 16 +#define BL_HUNGER 17 +#define BL_HP 18 +#define BL_HPMAX 19 +#define BL_LEVELDESC 20 +#define BL_EXP 21 +#define BL_CONDITION 22 +#define MAXBLSTATS 23 +/* clang-format on */ /* Boolean condition bits for the condition mask */ -#define BL_MASK_BLIND 0x00000001L -#define BL_MASK_CONF 0x00000002L -#define BL_MASK_FOODPOIS 0x00000004L -#define BL_MASK_ILL 0x00000008L -#define BL_MASK_HALLU 0x00000010L -#define BL_MASK_STUNNED 0x00000020L -#define BL_MASK_SLIMED 0x00000040L +/* clang-format off */ +#define BL_MASK_BLIND 0x00000001L +#define BL_MASK_CONF 0x00000002L +#define BL_MASK_FOODPOIS 0x00000004L +#define BL_MASK_ILL 0x00000008L +#define BL_MASK_HALLU 0x00000010L +#define BL_MASK_STUNNED 0x00000020L +#define BL_MASK_SLIMED 0x00000040L +/* clang-format on */ -#define REASSESS_ONLY TRUE +#define REASSESS_ONLY TRUE #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_TH_NONE 0 -#define BL_TH_VAL_PERCENTAGE 100 /* threshold is percentage */ -#define BL_TH_VAL_ABSOLUTE 101 /* threshold is particular value */ -#define BL_TH_UPDOWN 102 /* threshold is up or down change */ -#define BL_TH_CONDITION 103 /* threshold is bitmask of conditions */ +#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_TH_NONE 0 +#define BL_TH_VAL_PERCENTAGE 100 /* threshold is percentage */ +#define BL_TH_VAL_ABSOLUTE 101 /* threshold is particular value */ +#define BL_TH_UPDOWN 102 /* threshold is up or down change */ +#define BL_TH_CONDITION 103 /* threshold is bitmask of conditions */ #endif -extern const char *status_fieldnames[]; /* in botl.c */ +extern const char *status_fieldnames[]; /* in botl.c */ #endif #endif /* BOTL_H */ diff --git a/include/color.h b/include/color.h index dd4309cb1..9370d52bd 100644 --- a/include/color.h +++ b/include/color.h @@ -13,43 +13,43 @@ * exceptions, these are listed below. Bright black doesn't mean very * much, so it is used as the "default" foreground color of the screen. */ -#define CLR_BLACK 0 -#define CLR_RED 1 -#define CLR_GREEN 2 -#define CLR_BROWN 3 /* on IBM, low-intensity yellow is brown */ -#define CLR_BLUE 4 -#define CLR_MAGENTA 5 -#define CLR_CYAN 6 -#define CLR_GRAY 7 /* low-intensity white */ -#define NO_COLOR 8 -#define CLR_ORANGE 9 -#define CLR_BRIGHT_GREEN 10 -#define CLR_YELLOW 11 -#define CLR_BRIGHT_BLUE 12 -#define CLR_BRIGHT_MAGENTA 13 -#define CLR_BRIGHT_CYAN 14 -#define CLR_WHITE 15 -#define CLR_MAX 16 +#define CLR_BLACK 0 +#define CLR_RED 1 +#define CLR_GREEN 2 +#define CLR_BROWN 3 /* on IBM, low-intensity yellow is brown */ +#define CLR_BLUE 4 +#define CLR_MAGENTA 5 +#define CLR_CYAN 6 +#define CLR_GRAY 7 /* low-intensity white */ +#define NO_COLOR 8 +#define CLR_ORANGE 9 +#define CLR_BRIGHT_GREEN 10 +#define CLR_YELLOW 11 +#define CLR_BRIGHT_BLUE 12 +#define CLR_BRIGHT_MAGENTA 13 +#define CLR_BRIGHT_CYAN 14 +#define CLR_WHITE 15 +#define CLR_MAX 16 /* 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 +#define BRIGHT 8 /* these can be configured */ -#define HI_OBJ CLR_MAGENTA -#define HI_METAL CLR_CYAN -#define HI_COPPER CLR_YELLOW -#define HI_SILVER CLR_GRAY -#define HI_GOLD CLR_YELLOW -#define HI_LEATHER CLR_BROWN -#define HI_CLOTH CLR_BROWN -#define HI_ORGANIC CLR_BROWN -#define HI_WOOD CLR_BROWN -#define HI_PAPER CLR_WHITE -#define HI_GLASS CLR_BRIGHT_CYAN -#define HI_MINERAL CLR_GRAY -#define DRAGON_SILVER CLR_BRIGHT_CYAN -#define HI_ZAP CLR_BRIGHT_BLUE +#define HI_OBJ CLR_MAGENTA +#define HI_METAL CLR_CYAN +#define HI_COPPER CLR_YELLOW +#define HI_SILVER CLR_GRAY +#define HI_GOLD CLR_YELLOW +#define HI_LEATHER CLR_BROWN +#define HI_CLOTH CLR_BROWN +#define HI_ORGANIC CLR_BROWN +#define HI_WOOD CLR_BROWN +#define HI_PAPER CLR_WHITE +#define HI_GLASS CLR_BRIGHT_CYAN +#define HI_MINERAL CLR_GRAY +#define DRAGON_SILVER CLR_BRIGHT_CYAN +#define HI_ZAP CLR_BRIGHT_BLUE struct menucoloring { struct nhregex *match; diff --git a/include/config.h b/include/config.h index 2d06c044e..33fa6a0ce 100644 --- a/include/config.h +++ b/include/config.h @@ -3,10 +3,10 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ -#ifndef CONFIG_H /* make sure the compiler does not see the typedefs twice */ +#ifndef CONFIG_H /* make sure the compiler does not see the typedefs twice \ + */ #define CONFIG_H - /* * Section 1: Operating and window systems selection. * Select the version of the OS you are using. @@ -15,41 +15,40 @@ * provide it (no need to change sec#1, vmsconf.h handles it). */ -#define UNIX /* delete if no fork(), exec() available */ +#define UNIX /* delete if no fork(), exec() available */ -/* #define MSDOS */ /* in case it's not auto-detected */ +/* #define MSDOS */ /* in case it's not auto-detected */ -/* #define OS2 */ /* define for OS/2 */ +/* #define OS2 */ /* define for OS/2 */ -/* #define TOS */ /* define for Atari ST/TT */ +/* #define TOS */ /* define for Atari ST/TT */ -/* #define STUPID */ /* avoid some complicated expressions if - your C compiler chokes on them */ +/* #define STUPID */ /* avoid some complicated expressions if + your C compiler chokes on them */ /* #define MINIMAL_TERM */ - /* if a terminal handles highlighting or tabs poorly, - try this define, used in pager.c and termcap.c */ +/* if a terminal handles highlighting or tabs poorly, + try this define, used in pager.c and termcap.c */ /* #define ULTRIX_CC20 */ - /* define only if using cc v2.0 on a DECstation */ +/* define only if using cc v2.0 on a DECstation */ /* #define ULTRIX_PROTO */ - /* define for Ultrix 4.0 (or higher) on a DECstation; - * if you get compiler errors, don't define this. */ - /* Hint: if you're not developing code, don't define - ULTRIX_PROTO. */ - -#include "config1.h" /* should auto-detect MSDOS, MAC, AMIGA, and WIN32 */ +/* define for Ultrix 4.0 (or higher) on a DECstation; + * if you get compiler errors, don't define this. */ +/* Hint: if you're not developing code, don't define + ULTRIX_PROTO. */ +#include "config1.h" /* should auto-detect MSDOS, MAC, AMIGA, and WIN32 */ /* 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 X11_GRAPHICS */ /* X11 interface */ -/* #define QT_GRAPHICS */ /* Qt interface */ -/* #define GNOME_GRAPHICS */ /* Gnome interface */ -/* #define MSWIN_GRAPHICS */ /* Windows NT, CE, Graphics */ +/* #define X11_GRAPHICS */ /* X11 interface */ +/* #define QT_GRAPHICS */ /* Qt interface */ +/* #define GNOME_GRAPHICS */ /* Gnome interface */ +/* #define MSWIN_GRAPHICS */ /* Windows NT, CE, Graphics */ /* * Define the default window system. This should be one that is compiled @@ -60,62 +59,63 @@ /* MAC also means MAC windows */ #ifdef MAC -# ifndef AUX -# define DEFAULT_WINDOW_SYS "mac" -# endif +#ifndef AUX +#define DEFAULT_WINDOW_SYS "mac" +#endif #endif /* Amiga supports AMII_GRAPHICS and/or TTY_GRAPHICS */ #ifdef AMIGA -# define AMII_GRAPHICS /* (optional) */ -# define DEFAULT_WINDOW_SYS "amii" /* "amii", "amitile" or "tty" */ +#define AMII_GRAPHICS /* (optional) */ +#define DEFAULT_WINDOW_SYS "amii" /* "amii", "amitile" or "tty" */ #endif /* Atari supports GEM_GRAPHICS and/or TTY_GRAPHICS */ #ifdef TOS -# define GEM_GRAPHICS /* Atari GEM interface (optional) */ -# define DEFAULT_WINDOW_SYS "Gem" /* "Gem" or "tty" */ +#define GEM_GRAPHICS /* Atari GEM interface (optional) */ +#define DEFAULT_WINDOW_SYS "Gem" /* "Gem" or "tty" */ #endif #ifdef __BEOS__ -#define BEOS_GRAPHICS /* (optional) */ -#define DEFAULT_WINDOW_SYS "BeOS" /* "tty" */ -#ifndef HACKDIR /* override the default hackdir below */ -# define HACKDIR "/boot/apps/NetHack" +#define BEOS_GRAPHICS /* (optional) */ +#define DEFAULT_WINDOW_SYS "BeOS" /* "tty" */ +#ifndef HACKDIR /* override the default hackdir below */ +#define HACKDIR "/boot/apps/NetHack" #endif #endif #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 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 USER_SOUNDS /* Use sounds */ +#endif +#define USE_XPM /* Use XPM format for images (required) */ +#define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ +#ifndef DEFAULT_WINDOW_SYS +#define DEFAULT_WINDOW_SYS "Qt" #endif -# define USE_XPM /* Use XPM format for images (required) */ -# define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ -# ifndef DEFAULT_WINDOW_SYS -# define DEFAULT_WINDOW_SYS "Qt" -# endif #endif #ifdef GNOME_GRAPHICS -# define USE_XPM /* Use XPM format for images (required) */ -# define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ -# ifndef DEFAULT_WINDOW_SYS -# define DEFAULT_WINDOW_SYS "Gnome" -# endif +#define USE_XPM /* Use XPM format for images (required) */ +#define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ +#ifndef DEFAULT_WINDOW_SYS +#define DEFAULT_WINDOW_SYS "Gnome" +#endif #endif #ifdef MSWIN_GRAPHICS -# ifndef DEFAULT_WINDOW_SYS -# define DEFAULT_WINDOW_SYS "mswin" -# endif -# define HACKDIR "\\nethack" +#ifndef DEFAULT_WINDOW_SYS +#define DEFAULT_WINDOW_SYS "mswin" +#endif +#define HACKDIR "\\nethack" #endif #ifndef DEFAULT_WINDOW_SYS -# define DEFAULT_WINDOW_SYS "tty" +#define DEFAULT_WINDOW_SYS "tty" #endif #ifdef X11_GRAPHICS @@ -127,15 +127,14 @@ * would allow: * xpmtoppm x11tiles_big.xpm */ -/* # define USE_XPM */ /* Disable if you do not have the XPM library */ -# ifdef USE_XPM -# define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.xpm) */ -# endif -# ifndef DEFAULT_WC_TILED_MAP -# define DEFAULT_WC_TILED_MAP /* Default to tiles */ -# endif +/* # define USE_XPM */ /* Disable if you do not have the XPM library */ +#ifdef USE_XPM +#define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.xpm) */ +#endif +#ifndef DEFAULT_WC_TILED_MAP +#define DEFAULT_WC_TILED_MAP /* Default to tiles */ +#endif #endif - /* * Section 2: Some global parameters and filenames. @@ -151,14 +150,16 @@ * (this does NOT default to compiled-in value) * MAXPLAYERS (see MAX_NR_OF_PLAYERS above and nethack.sh) * SUPPORT (how to get local support)(no default) - * RECOVER (how to recover a game at your site)(no default) + * RECOVER (how to recover a game at your site)(no + *default) * SHELLERS (who can use !, syntax as WIZARDS) * for the record file (see topten.c): * PERSMAX (max entries for one person) * ENTRYMAX (max entries in the record file) * POINTSMIN (min points to get an entry) * PERS_IS_UID (0 or 1 - person is name or (numeric) userid) - * SEDUCE (0 or 1 - runtime disable/enable SEDUCE option) + * SEDUCE (0 or 1 - runtime disable/enable SEDUCE + *option) * * The following options select how the config space is stored: * SYSCF_FILE in the named file @@ -168,44 +169,43 @@ * GDBPATH (the path to the system gdb(1) program) */ -#ifndef WIZARD_NAME /* allow for compile-time or Makefile changes */ -# define WIZARD_NAME "wizard" +#ifndef WIZARD_NAME /* allow for compile-time or Makefile changes */ +#define WIZARD_NAME "wizard" #endif #ifndef SYSCF -#define SYSCF /* use a global configuration */ +#define SYSCF /* use a global configuration */ #define SYSCF_FILE "sysconf" /* global configuration is in a file */ #endif #ifndef GDBPATH -# define GDBPATH "/usr/bin/gdb" +#define GDBPATH "/usr/bin/gdb" #endif #ifndef GREPPATH -# define GREPPATH "/bin/grep" +#define GREPPATH "/bin/grep" #endif -#define LOGFILE "logfile" /* larger file for debugging purposes */ -#define XLOGFILE "xlogfile" /* even larger logfile */ -#define NEWS "news" /* the file containing the latest hack news */ -#define PANICLOG "paniclog" /* log of panic and impossible events */ +#define LOGFILE "logfile" /* larger file for debugging purposes */ +#define XLOGFILE "xlogfile" /* even larger logfile */ +#define NEWS "news" /* the file containing the latest hack news */ +#define PANICLOG "paniclog" /* log of panic and impossible events */ #ifndef PERSMAX -# define PERSMAX 3 /* entries per name/uid per char. allowed */ +#define PERSMAX 3 /* entries per name/uid per char. allowed */ #endif #ifndef POINTSMIN -# define POINTSMIN 1 /* must be > 0 */ +#define POINTSMIN 1 /* must be > 0 */ #endif #ifndef ENTRYMAX -# define ENTRYMAX 100 /* must be >= 10 */ +#define ENTRYMAX 100 /* must be >= 10 */ #endif #ifndef PERS_IS_UID -# if !defined(MICRO) && !defined(MAC) && !defined(WIN32) -# define PERS_IS_UID 1 /* delete for PERSMAX per name; now per uid */ -# else -# define PERS_IS_UID 0 -# endif +#if !defined(MICRO) && !defined(MAC) && !defined(WIN32) +#define PERS_IS_UID 1 /* delete for PERSMAX per name; now per uid */ +#else +#define PERS_IS_UID 0 +#endif #endif - /* * If COMPRESS is defined, it should contain the full path name of your @@ -224,18 +224,18 @@ * COMPRESS and ZLIB_COMP are mutually exclusive. * */ - + #if defined(UNIX) && !defined(ZLIB_COMP) && !defined(COMPRESS) /* path and file name extension for compression program */ -#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */ -#define COMPRESS_EXTENSION ".Z" /* compress's 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: */ -/* #define COMPRESS "/usr/local/bin/gzip" */ /* FSF gzip compression */ -/* #define COMPRESS_EXTENSION ".gz" */ /* normal gzip extension */ +/* #define COMPRESS "/usr/local/bin/gzip" */ /* FSF gzip compression */ +/* #define COMPRESS_EXTENSION ".gz" */ /* normal gzip extension */ #endif #ifndef COMPRESS -/* # define ZLIB_COMP */ /* ZLIB for compression */ +/* # define ZLIB_COMP */ /* ZLIB for compression */ #endif /* @@ -266,26 +266,26 @@ * 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 */ +/* # 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 * for detailed configuration. */ -/* #define DLB */ /* not supported on all platforms */ +/* #define DLB */ /* not supported on all platforms */ /* * Defining INSURANCE slows down level changes, but allows games that * died due to program or system crashes to be resumed from the point * of the last level change, after running a utility program. */ -#define INSURANCE /* allow crashed game recovery */ +#define INSURANCE /* allow crashed game recovery */ #ifndef MAC -# define CHDIR /* delete if no chdir() available */ +#define CHDIR /* delete if no chdir() available */ #endif #ifdef CHDIR @@ -293,9 +293,9 @@ * If you define HACKDIR, then this will be the default playground; * otherwise it will be the current directory. */ -# ifndef HACKDIR -# define HACKDIR "/usr/games/lib/nethackdir" -# endif +#ifndef HACKDIR +#define HACKDIR "/usr/games/lib/nethackdir" +#endif /* * Some system administrators are stupid enough to make Hack suid root @@ -304,7 +304,7 @@ * since the user might create files in a directory of his choice. * Of course SECURE is meaningful only if HACKDIR is defined. */ -/* #define SECURE */ /* do setuid(getuid()) after chdir() */ +/* #define SECURE */ /* do setuid(getuid()) after chdir() */ /* * If it is desirable to limit the number of people that can play Hack @@ -314,13 +314,11 @@ */ #endif /* CHDIR */ - /* If GENERIC_USERNAMES is defined, and the user name is found * in that list, prompt for username instead. * A public server should probably disable this. */ #define GENERIC_USERNAMES "play player game games nethack nethacker" - /* * Section 3: Definitions that may vary with system type. * For example, both schar and uchar should be short ints on @@ -332,14 +330,14 @@ * 'void' type (and thus would give all sorts of compile errors without * this definition). */ -/* #define NOVOID */ /* define if no "void" data type. */ +/* #define NOVOID */ /* define if no "void" data type. */ /* * Uncomment the following line if your compiler falsely claims to be * a standard C compiler (i.e., defines __STDC__ without cause). * Examples are Apollo's cc (in some versions) and possibly SCO UNIX's rcc. */ -/* #define NOTSTDC */ /* define for lying compilers */ +/* #define NOTSTDC */ /* define for lying compilers */ #include "tradstdc.h" @@ -353,9 +351,9 @@ * typedef short int schar; */ #ifdef AZTEC -# define schar char +#define schar char #else -typedef signed char schar; +typedef signed char schar; #endif /* @@ -368,8 +366,8 @@ typedef signed char schar; * * typedef unsigned short int uchar; */ -#ifndef _AIX32 /* identical typedef in system file causes trouble */ -typedef unsigned char uchar; +#ifndef _AIX32 /* identical typedef in system file causes trouble */ +typedef unsigned char uchar; #endif /* @@ -379,9 +377,9 @@ typedef unsigned char uchar; * allocate a separate character for each bitfield. (The bitfields used never * have more than 7 bits, and most are only 1 bit.) */ -#define BITFIELDS /* Good bitfield handling */ +#define BITFIELDS /* Good bitfield handling */ -/* #define STRNCMPI */ /* compiler/library has the strncmpi function */ +/* #define STRNCMPI */ /* compiler/library has the strncmpi function */ /* * There are various choices for the NetHack vision system. There is a @@ -398,9 +396,9 @@ typedef unsigned char uchar; /* #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 +#ifndef NO_MACRO_CPATH +#define MACRO_CPATH /* use clear_path macros instead of functions */ +#endif #endif /* @@ -417,14 +415,14 @@ typedef unsigned char uchar; /* monsters & objects */ /* I/O */ #if !defined(MAC) -# if !defined(NOCLIPPING) -# define CLIPPING /* allow smaller screens -- ERS */ -# endif +#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 */ -/* #define SCORE_ON_BOTL */ /* added by Gary Erickson (erickson@ucivax) */ +/* #define SCORE_ON_BOTL */ /* added by Gary Erickson (erickson@ucivax) */ /* * Section 5: EXPERIMENTAL STUFF @@ -434,11 +432,12 @@ typedef unsigned char uchar; * bugs left here. */ -/* #define STATUS_VIA_WINDOWPORT */ /* re-work of the status line updating process */ -/* #define STATUS_HILITES */ /* support hilites of status fields */ -/* #define WINCHAIN*/ /* stacked window systems */ +/* #define STATUS_VIA_WINDOWPORT */ /* re-work of the status line updating + process */ +/* #define STATUS_HILITES */ /* support hilites of status fields */ +/* #define WINCHAIN*/ /* stacked window systems */ /* End of Section 5 */ -#include "global.h" /* Define everything else according to choices above */ +#include "global.h" /* Define everything else according to choices above */ #endif /* CONFIG_H */ diff --git a/include/config1.h b/include/config1.h index d8477c205..8bb029f44 100644 --- a/include/config1.h +++ b/include/config1.h @@ -14,82 +14,81 @@ * DJGPP auto-defines MSDOS. */ -/* #define MSDOS */ /* use if not defined by compiler or cases below */ +/* #define MSDOS */ /* use if not defined by compiler or cases below */ -#ifdef __MSDOS__ /* for Borland C */ -# ifndef MSDOS -# define MSDOS -# endif +#ifdef __MSDOS__ /* for Borland C */ +#ifndef MSDOS +#define MSDOS +#endif #endif #ifdef __TURBOC__ -# define __MSC /* increase Borland C compatibility in libraries */ +#define __MSC /* increase Borland C compatibility in libraries */ #endif #ifdef MSDOS -# undef UNIX +#undef UNIX #endif /* * Mac Stuff. */ #if defined(__APPLE__) && defined(__MACH__) -# define MACOSX +#define MACOSX #endif -#ifdef macintosh /* Auto-defined symbol for MPW compilers (sc and mrc) */ -# define MAC +#ifdef macintosh /* Auto-defined symbol for MPW compilers (sc and mrc) */ +#define MAC #endif -#ifdef THINK_C /* Think C auto-defined symbol */ -# define MAC -# define NEED_VARARGS +#ifdef THINK_C /* Think C auto-defined symbol */ +#define MAC +#define NEED_VARARGS #endif -#ifdef __MWERKS__ /* defined by Metrowerks' Codewarrior compiler */ -# ifndef __BEOS__ /* BeOS */ -# define MAC -# endif -# define NEED_VARARGS -# define USE_STDARG +#ifdef __MWERKS__ /* defined by Metrowerks' Codewarrior compiler */ +#ifndef __BEOS__ /* BeOS */ +#define MAC +#endif +#define NEED_VARARGS +#define USE_STDARG #endif #if defined(MAC) || defined(__BEOS__) -# define DLB -# undef UNIX +#define DLB +#undef UNIX #endif #ifdef __BEOS__ -# define NEED_VARARGS +#define NEED_VARARGS #endif - /* * Amiga setup. */ -#ifdef AZTEC_C /* Manx auto-defines this */ -# ifdef MCH_AMIGA /* Manx auto-defines this for AMIGA */ -# ifndef AMIGA -#define AMIGA /* define for Commodore-Amiga */ -# endif /* (SAS/C auto-defines AMIGA) */ -#define AZTEC_50 /* define for version 5.0 of manx */ -# endif +#ifdef AZTEC_C /* Manx auto-defines this */ +#ifdef MCH_AMIGA /* Manx auto-defines this for AMIGA */ +#ifndef AMIGA +#define AMIGA /* define for Commodore-Amiga */ +#endif /* (SAS/C auto-defines AMIGA) */ +#define AZTEC_50 /* define for version 5.0 of manx */ +#endif #endif #ifdef __SASC_60 -# define NEARDATA __near /* put some data close */ +#define NEARDATA __near /* put some data close */ #else -# ifdef _DCC -# define NEARDATA __near /* put some data close */ -# else -# define NEARDATA -# endif +#ifdef _DCC +#define NEARDATA __near /* put some data close */ +#else +#define NEARDATA +#endif #endif #ifdef AMIGA -# define NEED_VARARGS -# undef UNIX -# define DLB -# define HACKDIR "NetHack:" -# define NO_MACRO_CPATH +#define NEED_VARARGS +#undef UNIX +#define DLB +#define HACKDIR "NetHack:" +#define NO_MACRO_CPATH #endif /* @@ -97,17 +96,17 @@ */ #ifdef atarist -# undef UNIX -# ifndef TOS -# define TOS -# endif +#undef UNIX +#ifndef TOS +#define TOS +#endif #else -# ifdef __MINT__ -# undef UNIX -# ifndef TOS -# define TOS -# endif -# endif +#ifdef __MINT__ +#undef UNIX +#ifndef TOS +#define TOS +#endif +#endif #endif /* @@ -115,9 +114,9 @@ */ #ifdef _WIN32_WCE #define WIN_CE -# ifndef WIN32 -# define WIN32 -# endif +#ifndef WIN32 +#define WIN32 +#endif #endif #if defined(_WIN32) && !defined(WIN32) @@ -125,80 +124,79 @@ #endif #ifdef WIN32 -# undef UNIX -# undef MSDOS -# define NHSTDC -# define USE_STDARG -# define NEED_VARARGS +#undef UNIX +#undef MSDOS +#define NHSTDC +#define USE_STDARG +#define NEED_VARARGS #ifndef WIN_CE -# define STRNCMPI -# define STRCMPI +#define STRNCMPI +#define STRCMPI #endif #endif - #if defined(__linux__) && defined(__GNUC__) && !defined(_GNU_SOURCE) /* ensure _GNU_SOURCE is defined before including any system headers */ -# define _GNU_SOURCE -#endif - -#ifdef VMS /* really old compilers need special handling, detected here */ -# undef UNIX -# ifdef __DECC -# ifndef __DECC_VER /* buggy early versions want widened prototypes */ -# define NOTSTDC /* except when typedefs are involved */ -# define USE_VARARGS -# else -# define NHSTDC -# define USE_STDARG -# define POSIX_TYPES -# define _DECC_V4_SOURCE /* avoid some incompatible V5.x changes */ -# endif -# undef __HIDE_FORBIDDEN_NAMES /* need non-ANSI library support functions */ -# ifdef VAXC /* DEC C in VAX C compatability mode; 'signed' works */ -# define signed /* but causes diagnostic about VAX C not supporting it */ -# endif -# else -# ifdef VAXC /* must use CC/DEFINE=ANCIENT_VAXC for vaxc v2.2 or older */ -# define signed -# ifdef ANCIENT_VAXC /* vaxc v2.2 and earlier [lots of warnings to come] */ -# define KR1ED /* simulate defined() */ -# define USE_VARARGS -# else /* vaxc v2.3,2.4,or 3.x, or decc in vaxc mode */ -# if defined(USE_PROTOTYPES) /* this breaks 2.2 (*forces* use of ANCIENT)*/ -# define __STDC__ 0 /* vaxc is not yet ANSI compliant, but close enough */ +#define _GNU_SOURCE +#endif + +#ifdef VMS /* really old compilers need special handling, detected here */ +#undef UNIX +#ifdef __DECC +#ifndef __DECC_VER /* buggy early versions want widened prototypes */ +#define NOTSTDC /* except when typedefs are involved */ +#define USE_VARARGS +#else +#define NHSTDC +#define USE_STDARG +#define POSIX_TYPES +#define _DECC_V4_SOURCE /* avoid some incompatible V5.x changes */ +#endif +#undef __HIDE_FORBIDDEN_NAMES /* need non-ANSI library support functions */ +#ifdef VAXC /* DEC C in VAX C compatability mode; 'signed' works */ +#define signed /* but causes diagnostic about VAX C not supporting it */ +#endif +#else +#ifdef VAXC /* must use CC/DEFINE=ANCIENT_VAXC for vaxc v2.2 or older */ +#define signed +#ifdef ANCIENT_VAXC /* vaxc v2.2 and earlier [lots of warnings to come] */ +#define KR1ED /* simulate defined() */ +#define USE_VARARGS +#else /* vaxc v2.3,2.4,or 3.x, or decc in vaxc mode */ +#if defined(USE_PROTOTYPES) /* this breaks 2.2 (*forces* use of ANCIENT)*/ +#define __STDC__ 0 /* vaxc is not yet ANSI compliant, but close enough */ #include -# define UNWIDENED_PROTOTYPES -# endif -# define USE_STDARG -# endif -# endif /*VAXC*/ -# endif /*__DECC*/ -# ifdef VERYOLD_VMS /* v4.5 or earlier; no longer available for testing */ -# define USE_OLDARGS /* is there, vprintf & vsprintf aren't */ -# ifdef USE_VARARGS -# undef USE_VARARGS -# endif -# ifdef USE_STDARG -# undef USE_STDARG -# endif -# endif +#define UNWIDENED_PROTOTYPES +#endif +#define USE_STDARG +#endif +#endif /*VAXC*/ +#endif /*__DECC*/ +#ifdef VERYOLD_VMS /* v4.5 or earlier; no longer available for testing */ +#define USE_OLDARGS /* is there, vprintf & vsprintf aren't */ +#ifdef USE_VARARGS +#undef USE_VARARGS +#endif +#ifdef USE_STDARG +#undef USE_STDARG +#endif +#endif #endif /*VMS*/ #ifdef vax /* just in case someone thinks a DECstation is a vax. It's not, it's a mips */ -# ifdef ULTRIX_PROTO -# undef ULTRIX_PROTO -# endif -# ifdef ULTRIX_CC20 -# undef ULTRIX_CC20 -# endif +#ifdef ULTRIX_PROTO +#undef ULTRIX_PROTO +#endif +#ifdef ULTRIX_CC20 +#undef ULTRIX_CC20 +#endif #endif -#ifdef KR1ED /* For compilers which cannot handle defined() */ -#define defined(x) (-x-1 != -1) +#ifdef KR1ED /* For compilers which cannot handle defined() */ +#define defined(x) (-x - 1 != -1) /* Because: * #define FOO => FOO={} => defined( ) => (-1 != - - 1) => 1 * #define FOO 1 or on command-line -DFOO @@ -213,4 +211,4 @@ */ #endif -#endif /* CONFIG1_H */ +#endif /* CONFIG1_H */ diff --git a/include/context.h b/include/context.h index 6775464b5..0ce00b21e 100644 --- a/include/context.h +++ b/include/context.h @@ -3,9 +3,8 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ - -/* If you change the context structure make sure you increment EDITLEVEL in */ -/* patchlevel.h if needed. */ +/* If you change the context structure make sure you increment EDITLEVEL in */ +/* patchlevel.h if needed. */ #ifndef CONTEXT_H #define CONTEXT_H @@ -20,105 +19,105 @@ * */ -struct dig_info { /* apply.c, hack.c */ - int effort; - d_level level; - coord pos; - long lastdigtime; - boolean down, chew, warned, quiet; +struct dig_info { /* apply.c, hack.c */ + int effort; + d_level level; + coord pos; + long lastdigtime; + boolean down, chew, warned, quiet; }; struct tin_info { - struct obj *tin; - unsigned o_id; /* o_id of tin in save file */ - int usedtime, reqtime; + struct obj *tin; + unsigned o_id; /* o_id of tin in save file */ + int usedtime, reqtime; }; struct book_info { - struct obj *book; /* last/current book being xscribed */ - unsigned o_id; /* o_id of book in save file */ - schar delay; /* moves left for this spell */ + struct obj *book; /* last/current book being xscribed */ + unsigned o_id; /* o_id of book in save file */ + schar delay; /* moves left for this spell */ }; struct takeoff_info { - long mask; - long what; - int delay; - boolean cancelled_don; - char disrobing[CONTEXTVERBSZ+1]; + long mask; + long what; + int delay; + boolean cancelled_don; + char disrobing[CONTEXTVERBSZ + 1]; }; struct victual_info { - struct obj *piece; /* the thing being eaten, or last thing that - * was partially eaten, unless that thing was - * a tin, which uses the tin structure above, - * in which case this should be 0 */ - unsigned o_id; /* o_id of food object in save file */ - /* doeat() initializes these when piece is valid */ - int usedtime, /* turns spent eating */ - reqtime; /* turns required to eat */ - int nmod; /* coded nutrition per turn */ - Bitfield(canchoke,1); /* was satiated at beginning */ - - /* start_eating() initializes these */ - Bitfield(fullwarn,1); /* have warned about being full */ - Bitfield(eating,1); /* victual currently being eaten */ - Bitfield(doreset,1); /* stop eating at end of turn */ + struct obj *piece; /* the thing being eaten, or last thing that + * was partially eaten, unless that thing was + * a tin, which uses the tin structure above, + * in which case this should be 0 */ + unsigned o_id; /* o_id of food object in save file */ + /* doeat() initializes these when piece is valid */ + int usedtime, /* turns spent eating */ + reqtime; /* turns required to eat */ + int nmod; /* coded nutrition per turn */ + Bitfield(canchoke, 1); /* was satiated at beginning */ + + /* start_eating() initializes these */ + Bitfield(fullwarn, 1); /* have warned about being full */ + Bitfield(eating, 1); /* victual currently being eaten */ + Bitfield(doreset, 1); /* stop eating at end of turn */ }; 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 */ - struct permonst *species; /* particular species due to poly */ - short speciesidx; /* index of above in mons[] (for save/restore) */ + unsigned long obj; /* object warn_of_mon monster type M2 */ + unsigned long polyd; /* warn_of_mon monster type M2 due to poly */ + struct permonst *species; /* particular species due to poly */ + short speciesidx; /* index of above in mons[] (for save/restore) */ }; struct polearm_info { - struct monst *hitmon; /* the monster we tried to hit last */ - unsigned m_id; /* monster id of hitmon, in save file */ + struct monst *hitmon; /* the monster we tried to hit last */ + unsigned m_id; /* monster id of hitmon, in save file */ }; struct tribute_info { - size_t tributesz; /* make it possible to skip this in future */ - boolean enabled; /* Do we have tributes turned on? */ - Bitfield(bookstock,1); /* Have we stocked the book? */ - /* Markers for other tributes can go here */ - /* 31 free bits */ + size_t tributesz; /* make it possible to skip this in future */ + boolean enabled; /* Do we have tributes turned on? */ + Bitfield(bookstock, 1); /* Have we stocked the book? */ + /* Markers for other tributes can go here */ + /* 31 free bits */ }; - + 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; - int rndencode; /* randomized escape sequence introducer */ - long next_attrib_check; /* next attribute check */ - long stethoscope_move; - short stethoscope_movement; - boolean travel; /* find way automatically to u.tx,u.ty */ - boolean travel1; /* first travel step */ - boolean forcefight; - boolean nopick; /* do not pickup objects (as when running) */ - boolean made_amulet; - boolean mon_moving; /* monsters' turn to move */ - 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 */ - struct dig_info digging; - struct victual_info victual; - struct tin_info tin; - struct book_info spbook; - struct takeoff_info takeoff; - struct warntype_info warntype; - struct polearm_info polearm; - struct tribute_info tribute; + 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; + int rndencode; /* randomized escape sequence introducer */ + long next_attrib_check; /* next attribute check */ + long stethoscope_move; + short stethoscope_movement; + boolean travel; /* find way automatically to u.tx,u.ty */ + boolean travel1; /* first travel step */ + boolean forcefight; + boolean nopick; /* do not pickup objects (as when running) */ + boolean made_amulet; + boolean mon_moving; /* monsters' turn to move */ + 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 */ + struct dig_info digging; + struct victual_info victual; + struct tin_info tin; + struct book_info spbook; + struct takeoff_info takeoff; + struct warntype_info warntype; + struct polearm_info polearm; + struct tribute_info tribute; }; extern NEARDATA struct context_info context; diff --git a/include/coord.h b/include/coord.h index 5ced6de26..439dc8751 100644 --- a/include/coord.h +++ b/include/coord.h @@ -7,7 +7,7 @@ #define COORD_H typedef struct nhcoord { - xchar x,y; + xchar x, y; } coord; #endif /* COORD_H */ diff --git a/include/decl.h b/include/decl.h index 3de35ce87..c98e9c424 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1,5 +1,5 @@ -/* NetHack 3.6 decl.h $NHDT-Date: 1432472662 2015/05/24 13:04:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */ -/* NetHack 3.6 decl.h $Date: 2011/12/29 20:06:27 $ $Revision: 1.44 $ */ +/* NetHack 3.6 decl.h $NHDT-Date: 1432472662 2015/05/24 13:04:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */ +/* NetHack 3.6 decl.h $Date: 2011/12/29 20:06:27 $ $Revision: 1.44 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -18,7 +18,7 @@ E int locknum; #endif #ifdef DEF_PAGER E char *catmore; -#endif /* DEF_PAGER */ +#endif /* DEF_PAGER */ E char SAVEF[]; #ifdef MICRO @@ -33,102 +33,104 @@ E NEARDATA int nroom; E NEARDATA int nsubroom; E NEARDATA int occtime; -#define WARNCOUNT 6 /* number of different warning levels */ +#define WARNCOUNT 6 /* number of different warning levels */ E nhsym warnsyms[WARNCOUNT]; -E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */ +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; +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 accesing the dungeon levels by their old names */ -#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) - -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) +/* 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 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) +#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_race; /* character's race */ E NEARDATA char pl_fruit[PL_FSIZ]; E NEARDATA struct fruit *ffruit; @@ -139,22 +141,22 @@ E NEARDATA char tune[6]; E struct linfo level_info[MAXLINFO]; E NEARDATA struct sinfo { - int gameover; /* self explanatory? */ - int stopprint; /* inhibit further end of game disclosure */ + 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 */ + 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; + 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; + int in_paniclog; #endif - int wizkit_wishing; + int wizkit_wishing; } program_state; E boolean restoring; @@ -174,32 +176,36 @@ 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 + 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 */ + char name[BUFSZ]; /* actual killer name */ } killer; E long done_money; E const char *configfile; -E char lastconfigfile[BUFSZ]; /* used for messaging */ +E char lastconfigfile[BUFSZ]; /* used for messaging */ 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 *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 schar tbx, tby; /* set in mthrowu.c */ -E NEARDATA struct multishot { int n, i; short o; boolean s; } m_shot; +E NEARDATA struct multishot { + int n, i; + short o; + boolean s; +} m_shot; E NEARDATA long moves, monstermoves; E NEARDATA long wailmsg; @@ -215,33 +221,31 @@ E NEARDATA boolean in_steed_dismounting; E const int shield_static[]; #include "spell.h" -E NEARDATA struct spell spl_book[]; /* sized in decl.c */ +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 */ +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 *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 *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 struct obj zeroobj; /* init'd and defined in decl.c */ -E NEARDATA anything zeroany; /* init'd and defined in decl.c */ +E NEARDATA struct obj zeroobj; /* init'd and defined in decl.c */ +E NEARDATA anything zeroany; /* init'd and defined in decl.c */ #include "you.h" E NEARDATA struct you u; @@ -249,78 +253,75 @@ 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) */ +#ifndef PM_H /* (pm.h has already been included via youprop.h) */ #include "pm.h" #endif -E NEARDATA struct monst youmonst; /* init'd and defined in decl.c */ +E NEARDATA struct monst youmonst; /* init'd and defined in decl.c */ E NEARDATA struct monst *mydogs, *migrating_mons; E NEARDATA struct mvitals { - uchar born; - uchar died; - uchar mvflags; + uchar born; + uchar died; + uchar mvflags; } mvitals[NUMMONS]; 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; + 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; -#define NH_BLACK c_color_names.c_black -#define NH_AMBER c_color_names.c_amber -#define NH_GOLDEN c_color_names.c_golden -#define NH_LIGHT_BLUE c_color_names.c_light_blue -#define NH_RED c_color_names.c_red -#define NH_GREEN c_color_names.c_green -#define NH_SILVER c_color_names.c_silver -#define NH_BLUE c_color_names.c_blue -#define NH_PURPLE c_color_names.c_purple -#define NH_WHITE c_color_names.c_white -#define NH_ORANGE c_color_names.c_orange +#define NH_BLACK c_color_names.c_black +#define NH_AMBER c_color_names.c_amber +#define NH_GOLDEN c_color_names.c_golden +#define NH_LIGHT_BLUE c_color_names.c_light_blue +#define NH_RED c_color_names.c_red +#define NH_GREEN c_color_names.c_green +#define NH_SILVER c_color_names.c_silver +#define NH_BLUE c_color_names.c_blue +#define NH_PURPLE c_color_names.c_purple +#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 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]; } c_common_strings; -#define nothing_happens c_common_strings.c_nothing_happens +#define nothing_happens c_common_strings.c_nothing_happens #define thats_enough_tries c_common_strings.c_thats_enough_tries -#define silly_thing_to c_common_strings.c_silly_thing_to +#define silly_thing_to c_common_strings.c_silly_thing_to #define shudder_for_moment c_common_strings.c_shudder_for_moment -#define something c_common_strings.c_something -#define Something c_common_strings.c_Something +#define something c_common_strings.c_something +#define Something c_common_strings.c_Something #define You_can_move_again c_common_strings.c_You_can_move_again -#define Never_mind c_common_strings.c_Never_mind -#define vision_clears c_common_strings.c_vision_clears -#define the_your c_common_strings.c_the_your +#define Never_mind c_common_strings.c_Never_mind +#define vision_clears c_common_strings.c_vision_clears +#define the_your c_common_strings.c_the_your /* 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 +#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_IT 0x01 +#define SUPPRESS_INVISIBLE 0x02 +#define SUPPRESS_HALLUCINATION 0x04 +#define SUPPRESS_SADDLE 0x08 +#define EXACT_NAME 0x0F /* Vision */ -E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */ -E NEARDATA char **viz_array; /* could see/in sight row pointers */ +E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */ +E NEARDATA char **viz_array; /* could see/in sight row pointers */ /* Window system stuff */ E NEARDATA winid WIN_MESSAGE; @@ -340,9 +341,9 @@ E NEARDATA winid WIN_MAP, WIN_INVEN; E char toplines[]; #ifndef TCAP_H -E 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 */ +E 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 @@ -351,28 +352,28 @@ E struct tc_gbl_data { /* also declared in tcap.h */ #endif /* xxxexplain[] is in drawing.c */ -E const char * const monexplain[], invisexplain[], * const oclass_names[]; +E const char *const monexplain[], invisexplain[], *const oclass_names[]; /* 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 -#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 +#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 +#ifndef FQN_MAX_FILENAME #define FQN_MAX_FILENAME 512 -# endif +#endif #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND) /* the bare-bones stuff is unconditional above to simplify coding; for @@ -389,10 +390,10 @@ E char *fqn_prefix_names[PREFIX_COUNT]; E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo; struct autopickup_exception { - struct nhregex *regex; + struct nhregex *regex; char *pattern; - boolean grab; - struct autopickup_exception *next; + boolean grab; + struct autopickup_exception *next; }; #ifdef PANICTRACE diff --git a/include/def_os2.h b/include/def_os2.h index 309e97679..f41066bc8 100644 --- a/include/def_os2.h +++ b/include/def_os2.h @@ -12,10 +12,10 @@ #ifdef OS2_USESYSHEADERS -# define INCL_NOPMAPI -# define INCL_DOSFILEMGR -# define INCL_DOS -# define INCL_SUB +#define INCL_NOPMAPI +#define INCL_DOSFILEMGR +#define INCL_DOS +#define INCL_SUB #include @@ -30,164 +30,164 @@ typedef unsigned int UINT; typedef unsigned long ULONG; typedef unsigned char BYTE; -# ifdef OS2_32BITAPI +#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 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 +#define DAT -# else /* OS2_32BITAPI */ +#else /* OS2_32BITAPI */ typedef unsigned short SHANDLE; typedef SHANDLE HKBD; typedef SHANDLE HVIO; -# define CCHMAXPATHCOMP 13 +#define CCHMAXPATHCOMP 13 -# ifdef OS2_MSC -# define API16 pascal far -# define DAT16 -# endif +#ifdef OS2_MSC +#define API16 pascal far +#define DAT16 +#endif -# define DAT DAT16 +#define DAT DAT16 -# endif /* OS2_32BITAPI */ +#endif /* OS2_32BITAPI */ -typedef USHORT * DAT16 PUSHORT; -typedef BYTE * DAT16 PBYTE; -typedef ULONG * DAT PULONG; -typedef VOID * DAT PVOID; +typedef USHORT *DAT16 PUSHORT; +typedef BYTE *DAT16 PBYTE; +typedef ULONG *DAT PULONG; +typedef VOID *DAT PVOID; typedef SHANDLE HDIR; -typedef HDIR * DAT PHDIR; +typedef HDIR *DAT PHDIR; -typedef char * DAT16 PCH; -typedef char * DAT PSZ; +typedef char *DAT16 PCH; +typedef char *DAT PSZ; /* all supported compilers understand this */ -# pragma pack(2) +#pragma pack(2) typedef struct { - UCHAR chChar; - UCHAR chScan; - UCHAR fbStatus; - UCHAR bNlsShift; - USHORT fsState; - ULONG time; + UCHAR chChar; + UCHAR chScan; + UCHAR fbStatus; + UCHAR bNlsShift; + USHORT fsState; + ULONG time; } KBDKEYINFO; -typedef KBDKEYINFO * DAT16 PKBDKEYINFO; +typedef KBDKEYINFO *DAT16 PKBDKEYINFO; /* File time and date types */ typedef struct { - UINT twosecs : 5; - UINT minutes : 6; - UINT hours : 5; + UINT twosecs : 5; + UINT minutes : 6; + UINT hours : 5; } FTIME; typedef struct { - UINT day : 5; - UINT month : 4; - UINT year : 7; + UINT day : 5; + UINT month : 4; + UINT year : 7; } FDATE; -# ifdef OS2_32BITAPI +#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]; + 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 +#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]; + 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; +typedef FILEFINDBUF *DAT16 PFILEFINDBUF; -# endif /* OS2_32BITAPI */ +#endif /* OS2_32BITAPI */ typedef struct { - ULONG idFileSystem; - ULONG cSectorUnit; - ULONG cUnit; - ULONG cUnitAvail; - USHORT cbSector; + ULONG idFileSystem; + ULONG cSectorUnit; + ULONG cUnit; + ULONG cUnitAvail; + USHORT cbSector; } FSALLOCATE; typedef struct { - USHORT cb; - USHORT fsMask; - USHORT chTurnAround; - USHORT fsInterim; - USHORT fsState; + USHORT cb; + USHORT fsMask; + USHORT chTurnAround; + USHORT fsInterim; + USHORT fsState; } KBDINFO; -typedef KBDINFO * DAT16 PKBDINFO; +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; + 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; +typedef VIOMODEINFO *DAT16 PVIOMODEINFO; -# pragma pack() +#pragma pack() /* OS2 API functions */ @@ -199,16 +199,17 @@ USHORT API16 KbdPeek(PKBDKEYINFO, HKBD); USHORT API16 VioGetMode(PVIOMODEINFO, HVIO); USHORT API16 VioSetCurPos(USHORT, USHORT, HVIO); -# ifdef OS2_32BITAPI +#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 +#else USHORT API16 DosQFSInfo(USHORT, USHORT, PBYTE, USHORT); -USHORT API16 DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG); +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_32BITAPI */ #endif /* OS2_USESYSHEADERS */ diff --git a/include/dgn_file.h b/include/dgn_file.h index 79d43b963..b9860c338 100644 --- a/include/dgn_file.h +++ b/include/dgn_file.h @@ -15,64 +15,60 @@ * Structures manipulated by the dungeon loader & compiler */ -struct couple { - short base, rand; +struct couple { + short base, rand; }; struct tmpdungeon { - char name[24], - protoname[24]; - struct couple lev; - int flags, - chance, - levels, - branches, - entry_lev; /* entry level for this dungeon */ - char boneschar; + char name[24], protoname[24]; + struct couple lev; + int flags, chance, levels, branches, + entry_lev; /* entry level for this dungeon */ + char boneschar; }; struct tmplevel { - char name[24]; - struct couple lev; - int chance, rndlevs, chain, flags; - char boneschar; + char name[24]; + struct couple lev; + int chance, rndlevs, chain, flags; + char boneschar; }; struct tmpbranch { - char name[24]; /* destination dungeon name */ - struct couple lev; - int chain; /* index into tmplevel array (chained branch)*/ - int type; /* branch type (see below) */ - int up; /* branch is up or down */ + char name[24]; /* destination dungeon name */ + struct couple lev; + int chain; /* index into tmplevel array (chained branch)*/ + int type; /* branch type (see below) */ + int up; /* branch is up or down */ }; /* * Values for type for tmpbranch structure. */ -#define TBR_STAIR 0 /* connection with both ends having a staircase */ -#define TBR_NO_UP 1 /* connection with no up staircase */ -#define TBR_NO_DOWN 2 /* connection with no down staircase */ -#define TBR_PORTAL 3 /* portal connection */ +#define TBR_STAIR 0 /* connection with both ends having a staircase */ +#define TBR_NO_UP 1 /* connection with no up staircase */ +#define TBR_NO_DOWN 2 /* connection with no down staircase */ +#define TBR_PORTAL 3 /* portal connection */ /* * Flags that map into the dungeon flags bitfields. */ -#define TOWN 1 /* levels only */ -#define HELLISH 2 -#define MAZELIKE 4 -#define ROGUELIKE 8 +#define TOWN 1 /* levels only */ +#define HELLISH 2 +#define MAZELIKE 4 +#define ROGUELIKE 8 -#define D_ALIGN_NONE 0 -#define D_ALIGN_CHAOTIC (AM_CHAOTIC << 4) -#define D_ALIGN_NEUTRAL (AM_NEUTRAL << 4) -#define D_ALIGN_LAWFUL (AM_LAWFUL << 4) +#define D_ALIGN_NONE 0 +#define D_ALIGN_CHAOTIC (AM_CHAOTIC << 4) +#define D_ALIGN_NEUTRAL (AM_NEUTRAL << 4) +#define D_ALIGN_LAWFUL (AM_LAWFUL << 4) -#define D_ALIGN_MASK 0x70 +#define D_ALIGN_MASK 0x70 /* * Max number of prototype levels and branches. */ -#define LEV_LIMIT 50 -#define BRANCH_LIMIT 32 +#define LEV_LIMIT 50 +#define BRANCH_LIMIT 32 #endif /* DGN_FILE_H */ diff --git a/include/display.h b/include/display.h index 27e52f64b..68bc08d31 100644 --- a/include/display.h +++ b/include/display.h @@ -12,7 +12,7 @@ #include "vision.h" #endif #ifndef MONDATA_H -#include "mondata.h" /* for mindless() */ +#include "mondata.h" /* for mindless() */ #endif /* @@ -21,7 +21,7 @@ * Returns the head of the list of objects that the player can see * at location (x,y). */ -#define vobj_at(x,y) (level.objects[x][y]) +#define vobj_at(x, y) (level.objects[x][y]) /* * sensemon() @@ -29,14 +29,14 @@ * Returns true if the hero can sense the given monster. This includes * monsters that are hiding or mimicing other monsters. */ -#define tp_sensemon(mon) ( /* The hero can always sense a monster IF: */\ - (!mindless(mon->data)) && /* 1. the monster has a brain to sense AND */\ - ((Blind && Blind_telepat) || /* 2a. hero is blind and telepathic OR */\ - /* 2b. hero is using a telepathy inducing */\ - /* object and in range */\ - (Unblind_telepat && \ - (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))) \ -) +#define tp_sensemon(mon) \ + (/* The hero can always sense a monster IF: */ \ + (!mindless(mon->data)) && /* 1. the monster has a brain to sense AND */ \ + ((Blind && Blind_telepat) \ + || /* 2a. hero is blind and telepathic OR */ /* 2b. hero is using a \ + telepathy inducing */ /* object and in range */ \ + (Unblind_telepat \ + && (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM))))) #define sensemon(mon) \ (tp_sensemon(mon) || Detect_monsters || MATCH_WARN_OF_MON(mon)) @@ -46,9 +46,9 @@ * 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 && (distu((mon)->mx, (mon)->my) < 100) \ + && (((int) ((mon)->m_lev / 4)) >= context.warnlevel)) /* * mon_visible() @@ -58,12 +58,12 @@ * vobj_at() returns a pointer to an object that the hero can see there. * Infravision is not taken into account. */ -#define mon_visible(mon) ( /* The hero can see the monster */\ - /* IF the monster */\ - (!mon->minvis || See_invisible) && /* 1. is not invisible AND */\ - (!mon->mundetected) && /* 2. not an undetected hider */\ - (!(mon->mburied || u.uburied)) /* 3. neither you or it is buried */\ -) +#define mon_visible(mon) \ + (/* The hero can see the monster */ /* IF the monster */ \ + (!mon->minvis || See_invisible) && /* 1. is not invisible AND */ \ + (!mon->mundetected) && /* 2. not an undetected hider */ \ + (!(mon->mburied || u.uburied)) /* 3. neither you or it is buried */ \ + ) /* * see_with_infrared() @@ -73,11 +73,10 @@ * invisible to infravision), because this is usually called from within * canseemon() or canspotmon() which already check that. */ -#define see_with_infrared(mon) \ - (!Blind && Infravision && infravisible(mon->data) \ +#define see_with_infrared(mon) \ + (!Blind && Infravision && infravisible(mon->data) \ && couldsee(mon->mx, mon->my)) - /* * canseemon() * @@ -85,9 +84,9 @@ * 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) \ - ((mon->wormno ? worm_known(mon) : \ - (cansee(mon->mx, mon->my) || see_with_infrared(mon))) \ +#define canseemon(mon) \ + ((mon->wormno ? worm_known(mon) \ + : (cansee(mon->mx, mon->my) || see_with_infrared(mon))) \ && mon_visible(mon)) /* @@ -110,15 +109,11 @@ * Infravision is not relevant; we assume that invisible monsters are also * invisible to infravision. */ -#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) \ + (mtmp->minvis \ + && ((cansee(mon->mx, mon->my) && (See_invisible || Detect_monsters)) \ + || (!Blind && (HTelepat & ~INTRINSIC) \ + && distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))) /* * is_safepet(mon) @@ -126,9 +121,9 @@ * A special case check used in attack() and domove(). Placing the * definition here is convenient. */ -#define is_safepet(mon) \ - (mon && mon->mtame && canspotmon(mon) && flags.safe_dog \ - && !Confusion && !Hallucination && !Stunned) +#define is_safepet(mon) \ + (mon && mon->mtame && canspotmon(mon) && flags.safe_dog && !Confusion \ + && !Hallucination && !Stunned) /* * canseeself() @@ -141,9 +136,9 @@ * unable to see. So when blind, being invisible won't affect your * self-perception, and when swallowed, the enclosing monster touches. */ -#define canseeself() (Blind || u.uswallow || (!Invisible && !u.uundetected)) -#define senseself() (Unblind_telepat || Detect_monsters) -#define canspotself() (canseeself() || senseself()) +#define canseeself() (Blind || u.uswallow || (!Invisible && !u.uundetected)) +#define senseself() (Unblind_telepat || Detect_monsters) +#define canspotself() (canseeself() || senseself()) /* * random_monster() @@ -153,8 +148,8 @@ * Respectively return a random monster, object, or trap number. */ #define random_monster() rn2(NUMMONS) -#define random_object() rn1(NUM_OBJECTS-1,1) -#define random_trap() rn1(TRAPNUM-1,1) +#define random_object() rn1(NUM_OBJECTS - 1, 1) +#define random_trap() rn1(TRAPNUM - 1, 1) /* * what_obj() @@ -164,9 +159,9 @@ * If hallucinating, choose a random object/monster, otherwise, use the one * given. */ -#define what_obj(obj) (Hallucination ? random_object() : obj) -#define what_mon(mon) (Hallucination ? random_monster() : mon) -#define what_trap(trp) (Hallucination ? random_trap() : trp) +#define what_obj(obj) (Hallucination ? random_object() : obj) +#define what_mon(mon) (Hallucination ? random_monster() : mon) +#define what_trap(trp) (Hallucination ? random_trap() : trp) /* * covers_objects() @@ -175,22 +170,22 @@ * These routines are true if what is really at the given location will * "cover" any objects or traps that might be there. */ -#define covers_objects(xx,yy) \ - ((is_pool(xx,yy) && !Underwater) || (levl[xx][yy].typ == LAVAPOOL)) - -#define covers_traps(xx,yy) covers_objects(xx,yy) +#define covers_objects(xx, yy) \ + ((is_pool(xx, yy) && !Underwater) || (levl[xx][yy].typ == LAVAPOOL)) +#define covers_traps(xx, yy) covers_objects(xx, yy) /* * tmp_at() control calls. */ -#define DISP_BEAM (-1) /* Keep all glyphs showing & clean up at end. */ -#define DISP_ALL (-2) /* Like beam, but still displayed if not visible. */ -#define DISP_FLASH (-3) /* Clean up each glyph before displaying new one. */ -#define DISP_ALWAYS (-4) /* Like flash, but still displayed if not visible. */ -#define DISP_CHANGE (-5) /* Change glyph. */ -#define DISP_END (-6) /* Clean up. */ -#define DISP_FREEMEM (-7) /* Free all memory during exit only. */ +#define DISP_BEAM (-1) /* Keep all glyphs showing & clean up at end. */ +#define DISP_ALL (-2) /* Like beam, but still displayed if not visible. */ +#define DISP_FLASH (-3) /* Clean up each glyph before displaying new one. */ +#define DISP_ALWAYS (-4) /* Like flash, but still displayed if not visible. \ + */ +#define DISP_CHANGE (-5) /* Change glyph. */ +#define DISP_END (-6) /* Clean up. */ +#define DISP_FREEMEM (-7) /* Free all memory during exit only. */ /* Total number of cmap indices in the sheild_static[] array. */ #define SHIELD_COUNT 21 @@ -201,20 +196,21 @@ * 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) : (otherwise_self)) - -#define display_self() \ - show_glyph(u.ux, u.uy, maybe_display_usteed( \ - youmonst.m_ap_type == M_AP_NOTHING ? \ - hero_glyph : \ - youmonst.m_ap_type == M_AP_FURNITURE ? \ - cmap_to_glyph(youmonst.mappearance) : \ - youmonst.m_ap_type == M_AP_OBJECT ? \ - objnum_to_glyph(youmonst.mappearance) : \ - /* else M_AP_MONSTER */ \ - monnum_to_glyph(youmonst.mappearance))) +#define maybe_display_usteed(otherwise_self) \ + ((u.usteed && mon_visible(u.usteed)) ? ridden_mon_to_glyph(u.usteed) \ + : (otherwise_self)) + +#define display_self() \ + show_glyph(u.ux, u.uy, \ + maybe_display_usteed( \ + youmonst.m_ap_type == M_AP_NOTHING \ + ? hero_glyph \ + : youmonst.m_ap_type == M_AP_FURNITURE \ + ? cmap_to_glyph(youmonst.mappearance) \ + : youmonst.m_ap_type == M_AP_OBJECT \ + ? objnum_to_glyph(youmonst.mappearance) \ + : /* else M_AP_MONSTER */ \ + monnum_to_glyph(youmonst.mappearance))) /* * A glyph is an abstraction that represents a _unique_ monster, object, @@ -238,7 +234,7 @@ * * corpse One for each monster. Count: NUMMONS * - * ridden Represents all monsters being ridden. Count: NUMMONS + * ridden Represents all monsters being ridden. Count: NUMMONS * * object One for each object. Count: NUM_OBJECTS * @@ -264,79 +260,82 @@ * * 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) +#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) #define NO_GLYPH MAX_GLYPH #define GLYPH_INVISIBLE GLYPH_INVIS_OFF -#define warning_to_glyph(mwarnlev) ((mwarnlev)+GLYPH_WARNING_OFF) -#define mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_MON_OFF) -#define detected_mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_DETECT_OFF) -#define ridden_mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_RIDDEN_OFF) -#define pet_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_PET_OFF) +#define warning_to_glyph(mwarnlev) ((mwarnlev) + GLYPH_WARNING_OFF) +#define mon_to_glyph(mon) \ + ((int) what_mon(monsndx((mon)->data)) + GLYPH_MON_OFF) +#define detected_mon_to_glyph(mon) \ + ((int) what_mon(monsndx((mon)->data)) + GLYPH_DETECT_OFF) +#define ridden_mon_to_glyph(mon) \ + ((int) what_mon(monsndx((mon)->data)) + GLYPH_RIDDEN_OFF) +#define pet_to_glyph(mon) \ + ((int) what_mon(monsndx((mon)->data)) + 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() \ - ((otg_temp = random_object()) == CORPSE ? \ - random_monster() + GLYPH_BODY_OFF : \ - otg_temp + GLYPH_OBJ_OFF) - -#define obj_to_glyph(obj) \ - ((obj)->otyp == STATUE ? \ - statue_to_glyph(obj) : \ - Hallucination ? \ - random_obj_to_glyph() : \ - (obj)->otyp == CORPSE ? \ - (int) (obj)->corpsenm + GLYPH_BODY_OFF : \ - (int) (obj)->otyp + GLYPH_OBJ_OFF) - +#define random_obj_to_glyph() \ + ((otg_temp = random_object()) == CORPSE \ + ? random_monster() + GLYPH_BODY_OFF \ + : otg_temp + GLYPH_OBJ_OFF) + +#define obj_to_glyph(obj) \ + ((obj)->otyp == STATUE \ + ? statue_to_glyph(obj) \ + : Hallucination ? random_obj_to_glyph() \ + : (obj)->otyp == CORPSE \ + ? (int) (obj)->corpsenm + GLYPH_BODY_OFF \ + : (int) (obj)->otyp + GLYPH_OBJ_OFF) /* MRKR: Statues now have glyphs corresponding to the monster they */ /* brepresent and look like monsters when you are hallucinating. */ -#define statue_to_glyph(obj) \ - (Hallucination ? \ - random_monster() + GLYPH_MON_OFF : \ - (int) (obj)->corpsenm + GLYPH_STATUE_OFF) +#define statue_to_glyph(obj) \ + (Hallucination ? random_monster() + GLYPH_MON_OFF \ + : (int) (obj)->corpsenm + GLYPH_STATUE_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_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 trap_to_glyph(trap) \ - cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp))) +#define trap_to_glyph(trap) \ + cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp))) /* 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 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) /* 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 \ + : (flags.female && urace.femalenum != NON_PM) \ + ? urace.femalenum \ + : urace.malenum) /* * Change the given glyph into it's given type. Note: @@ -350,71 +349,71 @@ * 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) -#define glyph_to_swallow(glyph) \ - (glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : \ - 0) -#define glyph_to_warning(glyph) \ - (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : \ - NO_GLYPH); +#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) +#define glyph_to_swallow(glyph) \ + (glyph_is_swallow(glyph) ? (((glyph) -GLYPH_SWALLOW_OFF) & 0x7) : 0) +#define glyph_to_warning(glyph) \ + (glyph_is_warning(glyph) ? ((glyph) -GLYPH_WARNING_OFF) : NO_GLYPH); /* * 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_monster(glyph) \ - ((glyph) >= GLYPH_MON_OFF && (glyph) < (GLYPH_MON_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)) - -#define glyph_is_ridden_monster(glyph) \ - ((glyph) >= GLYPH_RIDDEN_OFF && (glyph) < (GLYPH_RIDDEN_OFF+NUMMONS)) -#define glyph_is_detected_monster(glyph) \ - ((glyph) >= GLYPH_DETECT_OFF && (glyph) < (GLYPH_DETECT_OFF+NUMMONS)) +#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_monster(glyph) \ + ((glyph) >= GLYPH_MON_OFF && (glyph) < (GLYPH_MON_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)) + +#define glyph_is_ridden_monster(glyph) \ + ((glyph) >= GLYPH_RIDDEN_OFF && (glyph) < (GLYPH_RIDDEN_OFF + NUMMONS)) +#define glyph_is_detected_monster(glyph) \ + ((glyph) >= GLYPH_DETECT_OFF && (glyph) < (GLYPH_DETECT_OFF + NUMMONS)) #define glyph_is_invisible(glyph) ((glyph) == GLYPH_INVISIBLE) -#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) \ +#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_WARNING_OFF + WARNCOUNT)) + && (glyph) < (GLYPH_SWALLOW_OFF + (NUMMONS << 3))) +#define glyph_is_warning(glyph) \ + ((glyph) >= GLYPH_WARNING_OFF \ + && (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT)) #endif /* DISPLAY_H */ diff --git a/include/dlb.h b/include/dlb.h index 1a5fa77c1..3ae9197eb 100644 --- a/include/dlb.h +++ b/include/dlb.h @@ -12,59 +12,58 @@ /* implementations */ #ifdef MAC -# define DLBRSRC /* use Mac resources */ +#define DLBRSRC /* use Mac resources */ #else -# define DLBLIB /* use a set of external files */ +#define DLBLIB /* use a set of external files */ #endif #ifdef DLBLIB /* directory structure in memory */ typedef struct dlb_directory { - char *fname; /* file name as seen from calling code */ - long foffset; /* offset in lib file to start of this file */ - long fsize; /* file size */ - char handling; /* how to handle the file (compression, etc) */ + char *fname; /* file name as seen from calling code */ + long foffset; /* offset in lib file to start of this file */ + long fsize; /* file size */ + char handling; /* how to handle the file (compression, etc) */ } libdir; /* information about each open library */ typedef struct dlb_library { - FILE *fdata; /* opened data file */ - long fmark; /* current file mark */ - libdir *dir; /* directory of library file */ - char *sspace; /* pointer to string space */ - long nentries; /* # of files in directory */ - long rev; /* dlb file revision */ - long strsize; /* dlb file string size */ + FILE *fdata; /* opened data file */ + long fmark; /* current file mark */ + libdir *dir; /* directory of library file */ + char *sspace; /* pointer to string space */ + long nentries; /* # of files in directory */ + long rev; /* dlb file revision */ + long strsize; /* dlb file string size */ } library; /* library definitions */ -# ifndef DLBFILE -# define DLBFILE "nhdat" /* name of library */ -# endif -# ifndef FILENAME_CMP -# define FILENAME_CMP strcmp /* case sensitive */ -# endif +#ifndef DLBFILE +#define DLBFILE "nhdat" /* name of library */ +#endif +#ifndef FILENAME_CMP +#define FILENAME_CMP strcmp /* case sensitive */ +#endif #endif /* DLBLIB */ - typedef struct dlb_handle { - FILE *fp; /* pointer to an external file, use if non-null */ + FILE *fp; /* pointer to an external file, use if non-null */ #ifdef DLBLIB - library *lib; /* pointer to library structure */ - long start; /* offset of start of file */ - long size; /* size of file */ - long mark; /* current file marker */ + library *lib; /* pointer to library structure */ + long start; /* offset of start of file */ + long size; /* size of file */ + long mark; /* current file marker */ #endif #ifdef DLBRSRC - int fd; /* HandleFile file descriptor */ + int fd; /* HandleFile file descriptor */ #endif } dlb; #if defined(ULTRIX_PROTO) && !defined(__STDC__) - /* buggy old Ultrix compiler wants this for the (*dlb_fread_proc) - and (*dlb_fgets_proc) prototypes in struct dlb_procs (dlb.c); - we'll use it in all the declarations for consistency */ +/* buggy old Ultrix compiler wants this for the (*dlb_fread_proc) + and (*dlb_fgets_proc) prototypes in struct dlb_procs (dlb.c); + we'll use it in all the declarations for consistency */ #define DLB_P struct dlb_handle * #else #define DLB_P dlb * @@ -73,71 +72,70 @@ typedef struct dlb_handle { boolean NDECL(dlb_init); void NDECL(dlb_cleanup); -dlb *FDECL(dlb_fopen, (const char *,const char *)); +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_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)); - /* Resource DLB entry points */ #ifdef DLBRSRC - boolean rsrc_dlb_init(void); - void rsrc_dlb_cleanup(void); - boolean rsrc_dlb_fopen(dlb *dp, const char *name, const char *mode); - int rsrc_dlb_fclose(dlb *dp); - int rsrc_dlb_fread(char *buf, int size, int quan, dlb *dp); - int rsrc_dlb_fseek(dlb *dp, long pos, int whence); - char *rsrc_dlb_fgets(char *buf, int len, dlb *dp); - int rsrc_dlb_fgetc(dlb *dp); - long rsrc_dlb_ftell(dlb *dp); +boolean rsrc_dlb_init(void); +void rsrc_dlb_cleanup(void); +boolean rsrc_dlb_fopen(dlb *dp, const char *name, const char *mode); +int rsrc_dlb_fclose(dlb *dp); +int rsrc_dlb_fread(char *buf, int size, int quan, dlb *dp); +int rsrc_dlb_fseek(dlb *dp, long pos, int whence); +char *rsrc_dlb_fgets(char *buf, int len, dlb *dp); +int rsrc_dlb_fgetc(dlb *dp); +long rsrc_dlb_ftell(dlb *dp); #endif - #else /* DLB */ -# define dlb FILE +#define dlb FILE -# define dlb_init() -# define dlb_cleanup() +#define dlb_init() +#define dlb_cleanup() -# define dlb_fopen fopen -# define dlb_fclose fclose -# define dlb_fread fread -# define dlb_fseek fseek -# define dlb_fgets fgets -# define dlb_fgetc fgetc -# define dlb_ftell ftell +#define dlb_fopen fopen +#define dlb_fclose fclose +#define dlb_fread fread +#define dlb_fseek fseek +#define dlb_fgets fgets +#define dlb_fgetc fgetc +#define dlb_ftell ftell #endif /* DLB */ - /* various other I/O stuff we don't want to replicate everywhere */ #ifndef SEEK_SET -# define SEEK_SET 0 +#define SEEK_SET 0 #endif #ifndef SEEK_CUR -# define SEEK_CUR 1 +#define SEEK_CUR 1 #endif #ifndef SEEK_END -# define SEEK_END 2 +#define SEEK_END 2 #endif #define RDTMODE "r" -#if (defined(MSDOS) || defined(WIN32) || defined(TOS) || defined(OS2)) && defined(DLB) +#if (defined(MSDOS) || defined(WIN32) || defined(TOS) || defined(OS2)) \ + && defined(DLB) #define WRTMODE "w+b" #else #define WRTMODE "w+" #endif -#if (defined(MICRO) && !defined(AMIGA)) || defined(THINK_C) || defined(__MWERKS__) || defined(WIN32) -# define RDBMODE "rb" -# define WRBMODE "w+b" +#if (defined(MICRO) && !defined(AMIGA)) || defined(THINK_C) \ + || defined(__MWERKS__) || defined(WIN32) +#define RDBMODE "rb" +#define WRBMODE "w+b" #else -# define RDBMODE "r" -# define WRBMODE "w+" +#define RDBMODE "r" +#define WRBMODE "w+" #endif -#endif /* DLB_H */ +#endif /* DLB_H */ diff --git a/include/dungeon.h b/include/dungeon.h index 1ea73976d..65246ed29 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -6,33 +6,33 @@ #ifndef DUNGEON_H #define DUNGEON_H -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... */ +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... */ } d_flags; -typedef struct d_level { /* basic dungeon level element */ - xchar dnum; /* dungeon number */ - xchar dlevel; /* level number */ +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 */ - char proto[15]; /* name of prototype file (eg. "tower") */ - char boneid; /* character to id level in bones files */ - uchar rndlevs; /* no. of randomly available similar levels */ - d_flags flags; /* type flags */ +typedef struct s_level { /* special dungeon level element */ + struct s_level *next; + d_level dlevel; /* dungeon & level numbers */ + char proto[15]; /* name of prototype file (eg. "tower") */ + char boneid; /* character to id level in bones files */ + uchar rndlevs; /* no. of randomly available similar levels */ + 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) */ +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 */ @@ -44,23 +44,23 @@ typedef struct stairway { /* basic stairway identifier */ #define LR_UPTELE 5 #define LR_DOWNTELE 6 -typedef struct dest_area { /* non-stairway level change indentifier */ - 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 */ +typedef struct dest_area { /* non-stairway level change indentifier */ + 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 */ } dest_area; -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 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 */ - int ledger_start, /* the starting depth in "real" terms */ - depth_start; /* the starting depth in "logical" terms */ +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 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 */ + int ledger_start, /* the starting depth in "real" terms */ + depth_start; /* the starting depth in "logical" terms */ } dungeon; /* @@ -70,24 +70,23 @@ typedef struct dungeon { /* basic dungeon identifier */ * point. */ typedef struct branch { - struct branch *next; /* next in the branch chain */ - int id; /* branch identifier */ - int type; /* type of branch */ - d_level end1; /* "primary" end point */ - d_level end2; /* other end point */ - boolean end1_up; /* does end1 go up? */ + struct branch *next; /* next in the branch chain */ + int id; /* branch identifier */ + int type; /* type of branch */ + d_level end1; /* "primary" end point */ + d_level end2; /* other end point */ + boolean end1_up; /* does end1 go up? */ } branch; /* branch types */ -#define BR_STAIR 0 /* "Regular" connection, 2 staircases. */ -#define BR_NO_END1 1 /* "Regular" connection. However, no stair from */ - /* end1 to end2. There is a stair from end2 */ - /* to end1. */ -#define BR_NO_END2 2 /* "Regular" connection. However, no stair from */ - /* end2 to end1. There is a stair from end1 */ - /* to end2. */ -#define BR_PORTAL 3 /* Connection by magic portals (traps) */ - +#define BR_STAIR 0 /* "Regular" connection, 2 staircases. */ +#define BR_NO_END1 1 /* "Regular" connection. However, no stair from */ + /* end1 to end2. There is a stair from end2 */ + /* to end1. */ +#define BR_NO_END2 2 /* "Regular" connection. However, no stair from */ + /* end2 to end1. There is a stair from end1 */ + /* to end2. */ +#define BR_PORTAL 3 /* Connection by magic portals (traps) */ /* A particular dungeon contains num_dunlevs d_levels with dlevel 1.. * num_dunlevs. Ledger_start and depth_start are bases that are added @@ -99,151 +98,154 @@ typedef struct branch { * * Depth corresponds to the number of floors below the surface. */ -#define Is_astralevel(x) (on_level(x, &astral_level)) -#define Is_earthlevel(x) (on_level(x, &earth_level)) -#define Is_waterlevel(x) (on_level(x, &water_level)) -#define Is_firelevel(x) (on_level(x, &fire_level)) -#define Is_airlevel(x) (on_level(x, &air_level)) -#define Is_medusa_level(x) (on_level(x, &medusa_level)) -#define Is_oracle_level(x) (on_level(x, &oracle_level)) -#define Is_valley(x) (on_level(x, &valley_level)) -#define Is_juiblex_level(x) (on_level(x, &juiblex_level)) -#define Is_asmo_level(x) (on_level(x, &asmodeus_level)) -#define Is_baal_level(x) (on_level(x, &baalzebub_level)) -#define Is_wiz1_level(x) (on_level(x, &wiz1_level)) -#define Is_wiz2_level(x) (on_level(x, &wiz2_level)) -#define Is_wiz3_level(x) (on_level(x, &wiz3_level)) -#define Is_sanctum(x) (on_level(x, &sanctum_level)) -#define Is_portal_level(x) (on_level(x, &portal_level)) -#define Is_rogue_level(x) (on_level(x, &rogue_level)) -#define Is_stronghold(x) (on_level(x, &stronghold_level)) -#define Is_bigroom(x) (on_level(x, &bigroom_level)) -#define Is_qstart(x) (on_level(x, &qstart_level)) -#define Is_qlocate(x) (on_level(x, &qlocate_level)) -#define Is_nemesis(x) (on_level(x, &nemesis_level)) -#define Is_knox(x) (on_level(x, &knox_level)) -#define Is_mineend_level(x) (on_level(x, &mineend_level)) -#define Is_sokoend_level(x) (on_level(x, &sokoend_level)) - -#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 within_bounded_area(X,Y,LX,LY,HX,HY) \ - ((X) >= (LX) && (X) <= (HX) && (Y) >= (LY) && (Y) <= (HY)) +#define Is_astralevel(x) (on_level(x, &astral_level)) +#define Is_earthlevel(x) (on_level(x, &earth_level)) +#define Is_waterlevel(x) (on_level(x, &water_level)) +#define Is_firelevel(x) (on_level(x, &fire_level)) +#define Is_airlevel(x) (on_level(x, &air_level)) +#define Is_medusa_level(x) (on_level(x, &medusa_level)) +#define Is_oracle_level(x) (on_level(x, &oracle_level)) +#define Is_valley(x) (on_level(x, &valley_level)) +#define Is_juiblex_level(x) (on_level(x, &juiblex_level)) +#define Is_asmo_level(x) (on_level(x, &asmodeus_level)) +#define Is_baal_level(x) (on_level(x, &baalzebub_level)) +#define Is_wiz1_level(x) (on_level(x, &wiz1_level)) +#define Is_wiz2_level(x) (on_level(x, &wiz2_level)) +#define Is_wiz3_level(x) (on_level(x, &wiz3_level)) +#define Is_sanctum(x) (on_level(x, &sanctum_level)) +#define Is_portal_level(x) (on_level(x, &portal_level)) +#define Is_rogue_level(x) (on_level(x, &rogue_level)) +#define Is_stronghold(x) (on_level(x, &stronghold_level)) +#define Is_bigroom(x) (on_level(x, &bigroom_level)) +#define Is_qstart(x) (on_level(x, &qstart_level)) +#define Is_qlocate(x) (on_level(x, &qlocate_level)) +#define Is_nemesis(x) (on_level(x, &nemesis_level)) +#define Is_knox(x) (on_level(x, &knox_level)) +#define Is_mineend_level(x) (on_level(x, &mineend_level)) +#define Is_sokoend_level(x) (on_level(x, &sokoend_level)) + +#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 within_bounded_area(X, Y, LX, LY, HX, HY) \ + ((X) >= (LX) && (X) <= (HX) && (Y) >= (LY) && (Y) <= (HY)) /* monster and object migration codes */ -#define MIGR_NOWHERE (-1) /* failure flag for down_gate() */ -#define MIGR_RANDOM 0 -#define MIGR_APPROX_XY 1 /* approximate coordinates */ -#define MIGR_EXACT_XY 2 /* specific coordinates */ -#define MIGR_STAIRS_UP 3 -#define MIGR_STAIRS_DOWN 4 -#define MIGR_LADDER_UP 5 -#define MIGR_LADDER_DOWN 6 -#define MIGR_SSTAIRS 7 /* dungeon branch */ -#define MIGR_PORTAL 8 /* magic portal */ -#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_NOWHERE (-1) /* failure flag for down_gate() */ +#define MIGR_RANDOM 0 +#define MIGR_APPROX_XY 1 /* approximate coordinates */ +#define MIGR_EXACT_XY 2 /* specific coordinates */ +#define MIGR_STAIRS_UP 3 +#define MIGR_STAIRS_DOWN 4 +#define MIGR_LADDER_UP 5 +#define MIGR_LADDER_DOWN 6 +#define MIGR_SSTAIRS 7 /* dungeon branch */ +#define MIGR_PORTAL 8 /* magic portal */ +#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 */ /* 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 */ -#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. - */ + unsigned char flags; +#define VISITED 0x01 /* hero has visited this level */ +#define FORGOTTEN 0x02 /* hero will forget this level when reached */ +#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. + */ #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; +#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 * * It is designed to eliminate the need for an external notes file for some of - * the more mundane dungeon elements. "Where was the last altar I passed?" etc... + * the more mundane dungeon elements. "Where was the last altar I passed?" + * etc... * Presumably the character can remember this sort of thing even if, months * later in real time picking up an old save game, I can't. * * To be consistent, one can assume that this map is in the player's mind and - * has no physical correspondence (eliminating illiteracy/blind/hands/hands free - * concerns.) Therefore, this map is not exaustive nor detailed ("some fountains"). + * has no physical correspondence (eliminating illiteracy/blind/hands/hands + * free + * concerns.) Therefore, this map is not exaustive nor detailed ("some + * 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 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_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); - - 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(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 */ - - Bitfield(valley, 1); - Bitfield(msanctum, 1); - Bitfield(ludios, 1); - Bitfield(roguelevel, 1); - } 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[] */ - /* dead heroes; might not have graves or ghosts */ - struct cemetery *final_resting_place; /* same as level.bonesinfo */ +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); + + 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(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 */ + + Bitfield(valley, 1); + Bitfield(msanctum, 1); + Bitfield(ludios, 1); + Bitfield(roguelevel, 1); + } 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[] */ + /* dead heroes; might not have graves or ghosts */ + struct cemetery *final_resting_place; /* same as level.bonesinfo */ } mapseen; #endif /* DUNGEON_H */ diff --git a/include/engrave.h b/include/engrave.h index 35945d79b..6ef344408 100644 --- a/include/engrave.h +++ b/include/engrave.h @@ -8,22 +8,23 @@ #define ENGRAVE_H struct engr { - struct engr *nxt_engr; - char *engr_txt; - xchar engr_x, engr_y; - unsigned engr_lth; /* for save & restore; not length of text */ - long engr_time; /* moment engraving was (will be) finished */ - xchar engr_type; -#define DUST 1 -#define ENGRAVE 2 -#define BURN 3 -#define MARK 4 + struct engr *nxt_engr; + char *engr_txt; + xchar engr_x, engr_y; + unsigned engr_lth; /* for save & restore; not length of text */ + long engr_time; /* moment engraving was (will be) finished */ + xchar engr_type; +#define DUST 1 +#define ENGRAVE 2 +#define BURN 3 +#define MARK 4 #define ENGR_BLOOD 5 -#define HEADSTONE 6 -#define N_ENGRAVE 6 +#define HEADSTONE 6 +#define N_ENGRAVE 6 }; -#define newengr(lth) (struct engr *)alloc((unsigned)(lth) + sizeof(struct engr)) -#define dealloc_engr(engr) free((genericptr_t) (engr)) +#define newengr(lth) \ + (struct engr *) alloc((unsigned)(lth) + sizeof(struct engr)) +#define dealloc_engr(engr) free((genericptr_t)(engr)) #endif /* ENGRAVE_H */ diff --git a/include/extern.h b/include/extern.h index 09d2d6b3a..8beca1ee7 100644 --- a/include/extern.h +++ b/include/extern.h @@ -35,13 +35,13 @@ 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 FDECL(m_unleash, (struct monst *, BOOLEAN_P)); E void NDECL(unleash_all); 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 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 *)); @@ -49,7 +49,7 @@ 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)); +E int FDECL(unfixable_trouble_count, (BOOLEAN_P)); /* ### artifact.c ### */ @@ -57,57 +57,57 @@ 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 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(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 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 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 boolean FDECL(artifact_has_invprop, (struct obj *, UCHAR_P)); E long FDECL(arti_cost, (struct obj *)); E struct obj *FDECL(what_gives, (long *)); E void FDECL(Sting_effects, (int)); -E int FDECL(retouch_object, (struct obj **,BOOLEAN_P)); +E int FDECL(retouch_object, (struct obj **, BOOLEAN_P)); E void FDECL(retouch_equipment, (int)); /* ### attrib.c ### */ -E boolean FDECL(adjattrib, (int,int,int)); -E void FDECL(gainstr, (struct obj *,int,BOOLEAN_P)); +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(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 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 void FDECL(adjabil, (int, int)); E int NDECL(newhp); E schar FDECL(acurr, (int)); E schar NDECL(acurrstr); @@ -115,7 +115,7 @@ 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)); +E void FDECL(uchangealign, (int, int)); /* ### ball.c ### */ @@ -124,30 +124,30 @@ E void NDECL(ballfall); E void NDECL(placebc); E void NDECL(unplacebc); 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 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); /* ### bones.c ### */ E void FDECL(sanitize_name, (char *)); -E void FDECL(drop_upon_death, (struct monst *,struct obj *,int,int)); +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 void FDECL(savebones, (int, time_t, struct obj *)); E int NDECL(getbones); /* ### botl.c ### */ E int FDECL(xlev_to_rank, (int)); -E int FDECL(title_to_mon, (const char *,int *,int *)); +E int FDECL(title_to_mon, (const char *, int *, int *)); E void NDECL(max_rank_sz); #ifdef SCORE_ON_BOTL E long NDECL(botl_score); #endif E int FDECL(describe_level, (char *)); -E const char *FDECL(rank_of, (int,SHORT_P,BOOLEAN_P)); +E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P)); E void NDECL(bot); #ifdef STATUS_VIA_WINDOWPORT E void FDECL(status_initialize, (BOOLEAN_P)); @@ -155,14 +155,15 @@ E void NDECL(status_finish); E void NDECL(genl_status_init); E void NDECL(genl_status_finish); E void FDECL(genl_status_update, (int, genericptr_t, int, int)); -E void FDECL(genl_status_enablefield, (int, const char *, const char *,BOOLEAN_P)); -# ifdef STATUS_HILITES -E void FDECL(genl_status_threshold, (int,int,anything,int,int,int)); +E void FDECL(genl_status_enablefield, + (int, const char *, const char *, BOOLEAN_P)); +#ifdef STATUS_HILITES +E void FDECL(genl_status_threshold, (int, int, anything, int, int, int)); E boolean FDECL(set_status_hilites, (char *op)); E void NDECL(clear_status_hilites); E char *FDECL(get_status_hilites, (char *, int)); E boolean NDECL(status_hilite_menu); -# endif +#endif #endif /* ### cmd.c ### */ @@ -183,7 +184,7 @@ 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 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)); @@ -193,19 +194,20 @@ 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(enlightenment, (int, int)); +E void FDECL(youhiding, (BOOLEAN_P, int)); E void FDECL(show_conduct, (int)); -E int FDECL(xytod, (SCHAR_P,SCHAR_P)); -E void FDECL(dtoxy, (coord *,int)); +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 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)); #ifdef HANGUPHANDLING E void FDECL(hangup, (int)); E void NDECL(end_of_input); @@ -213,23 +215,23 @@ E void NDECL(end_of_input); E char NDECL(readchar); E void NDECL(sanity_check); E char FDECL(yn_function, (const char *, const char *, CHAR_P)); -E boolean FDECL(paranoid_query, (BOOLEAN_P,const char *)); +E boolean FDECL(paranoid_query, (BOOLEAN_P, const char *)); /* ### 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 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)); +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)); /* ### decl.c ### */ @@ -237,12 +239,12 @@ E void NDECL(decl_init); /* ### detect.c ### */ -E struct obj *FDECL(o_in, (struct obj*,CHAR_P)); -E struct obj *FDECL(o_material, (struct obj*,unsigned)); +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(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 *)); @@ -250,46 +252,47 @@ E void NDECL(do_mapping); E void NDECL(do_vicinity_map); 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)); +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 boolean FDECL(detecting, (void (*)(int, int, genericptr))); E void FDECL(find_trap, (struct trap *)); E int FDECL(dosearch0, (int)); E int NDECL(dosearch); E void NDECL(sokoban_detect); -E void FDECL(reveal_terrain, (int,int)); +E void FDECL(reveal_terrain, (int, int)); /* ### dig.c ### */ -E int FDECL(dig_typ, (struct obj *,XCHAR_P,XCHAR_P)); +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 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 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(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)); +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)); #if 0 E void FDECL(bury_monst, (struct monst *)); E void NDECL(bury_you); @@ -300,17 +303,17 @@ E void FDECL(bury_obj, (struct obj *)); /* ### 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 void FDECL(unmap_object, (int,int)); -E void FDECL(map_location, (int,int,int)); -E void FDECL(feel_location, (XCHAR_P,XCHAR_P)); -E void FDECL(newsym, (int,int)); -E void FDECL(shieldeff, (XCHAR_P,XCHAR_P)); -E void FDECL(tmp_at, (int,int)); +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 void FDECL(unmap_object, (int, int)); +E void FDECL(map_location, (int, int, int)); +E void FDECL(feel_location, (XCHAR_P, XCHAR_P)); +E void FDECL(newsym, (int, int)); +E void FDECL(shieldeff, (XCHAR_P, XCHAR_P)); +E void FDECL(tmp_at, (int, int)); E void FDECL(swallowed, (int)); E void FDECL(under_ground, (int)); E void FDECL(under_water, (int)); @@ -321,16 +324,16 @@ E void NDECL(see_traps); E void NDECL(curs_on_u); E int NDECL(doredraw); E void NDECL(docrt); -E void FDECL(show_glyph, (int,int,int)); +E void FDECL(show_glyph, (int, int, int)); E void NDECL(clear_glyph_buffer); -E void FDECL(row_refresh, (int,int,int)); +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 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 void FDECL(unset_seenv, (struct rm *, int, int, int, int)); /* ### do.c ### */ @@ -339,13 +342,13 @@ 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 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 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(dropz, (struct obj *, BOOLEAN_P)); E void FDECL(obj_no_longer_held, (struct obj *)); E int NDECL(doddrop); E int NDECL(dodown); @@ -353,33 +356,33 @@ E int NDECL(doup); #ifdef INSURANCE E void NDECL(save_currentstate); #endif -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 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(set_wounded_legs, (long, int)); E void NDECL(heal_legs); /* ### do_name.c ### */ -E int FDECL(getpos, (coord *,BOOLEAN_P,const char *)); -E void FDECL(getpos_sethilite, (void (*f)(int) )); -E void FDECL(new_mname, (struct monst *,int)); +E int FDECL(getpos, (coord *, BOOLEAN_P, const char *)); +E void FDECL(getpos_sethilite, (void (*f)(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(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 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(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 *)); @@ -387,17 +390,17 @@ E char *FDECL(Monnam, (struct monst *)); E char *FDECL(noit_Monnam, (struct monst *)); 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(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(distant_monnam, (struct monst *, int, char *)); E char *FDECL(rndmonnam, (char *)); E const char *FDECL(hcolor, (const char *)); E const char *NDECL(rndcolor); 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 *)); + (struct obj *, int, genericptr_t, int, const char *)); +E char *FDECL(coyotename, (struct monst *, char *)); E const char *FDECL(noveltitle, (int *)); E const char *FDECL(lookup_novel, (const char *, int *)); @@ -440,53 +443,55 @@ 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 *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)); +E void FDECL(adj_abon, (struct obj *, SCHAR_P)); +E boolean +FDECL(inaccessible_equipment, (struct obj *, const char *, BOOLEAN_P)); /* ### 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 *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(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(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)); /* ### 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)); +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)); +E void FDECL(wantdoor, (int, int, genericptr_t)); #endif -E void FDECL(finish_meating,(struct monst *)); +E void FDECL(finish_meating, (struct monst *)); /* ### dokick.c ### */ -E boolean FDECL(ghitm, (struct monst *,struct obj *)); -E void FDECL(container_impact_dmg, (struct obj *,XCHAR_P,XCHAR_P)); +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 boolean FDECL(ship_object, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); E void FDECL(obj_delivery, (BOOLEAN_P)); -E schar FDECL(down_gate, (XCHAR_P,XCHAR_P)); -E void FDECL(impact_drop, (struct obj *,XCHAR_P,XCHAR_P,XCHAR_P)); +E schar FDECL(down_gate, (XCHAR_P, XCHAR_P)); +E void FDECL(impact_drop, (struct obj *, XCHAR_P, XCHAR_P, XCHAR_P)); /* ### dothrow.c ### */ @@ -494,17 +499,20 @@ E int NDECL(dothrow); E int NDECL(dofire); E void FDECL(endmultishot, (BOOLEAN_P)); E void FDECL(hitfloor, (struct obj *)); -E void FDECL(hurtle, (int,int,int,BOOLEAN_P)); -E void FDECL(mhurtle, (struct monst *,int,int,int)); -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 void FDECL(hurtle, (int, int, int, BOOLEAN_P)); +E void FDECL(mhurtle, (struct monst *, int, int, int)); +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_t,int,int), genericptr_t)); +E boolean +FDECL(walk_path, + (coord *, coord *, boolean (*)(genericptr_t, int, int), genericptr_t)); E boolean FDECL(hurtle_step, (genericptr_t, int, int)); /* ### drawing.c ### */ @@ -519,16 +527,16 @@ E void NDECL(init_symbols); E void NDECL(update_bouldersym); E void NDECL(init_showsyms); E void NDECL(init_l_symbols); -E void FDECL(clear_symsetentry, (int,BOOLEAN_P)); -E void FDECL(update_l_symset, (struct symparse *,int)); -E void FDECL(update_r_symset, (struct symparse *,int)); +E void FDECL(clear_symsetentry, (int, BOOLEAN_P)); +E void FDECL(update_l_symset, (struct symparse *, int)); +E void FDECL(update_r_symset, (struct symparse *, int)); E boolean FDECL(cursed_object_at, (int, int)); /* ### dungeon.c ### */ -E void FDECL(save_dungeon, (int,BOOLEAN_P,BOOLEAN_P)); +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 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 *)); @@ -541,20 +549,20 @@ 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 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_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(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(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 *)); @@ -563,20 +571,20 @@ 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 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 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 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(show_overview, (int, int)); E void FDECL(forget_mapseen, (int)); E void FDECL(init_mapseen, (d_level *)); E void NDECL(recalc_mapseen); @@ -606,19 +614,19 @@ 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 struct obj *FDECL(floorfood, (const char *, int)); E void NDECL(vomit); -E int FDECL(eaten_stat, (int,struct obj *)); +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(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 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 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 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)); /* ### end.c ### */ @@ -628,19 +636,20 @@ E int NDECL(done2); #ifdef USE_TRAMPOLI E void FDECL(done_intr, (int)); #endif -E void FDECL(done_in_by, (struct monst *,int)); +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); +E void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2); #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(container_contents, + (struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); E void FDECL(terminate, (int)); E int NDECL(dovanquished); E int NDECL(num_genocides); -E void FDECL(delayed_killer, (int, int, const char*)); +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(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) @@ -650,32 +659,32 @@ E void FDECL(panictrace_setsignals, (BOOLEAN_P)); /* ### engrave.c ### */ E char *FDECL(random_engraving, (char *)); -E void FDECL(wipeout_text, (char *,int,unsigned)); +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(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 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(save_engravings, (int, int)); E void FDECL(rest_engravings, (int)); E void FDECL(del_engr, (struct engr *)); E void FDECL(rloc_engr, (struct engr *)); -E void FDECL(make_grave, (int,int,const char *)); +E void FDECL(make_grave, (int, int, const char *)); /* ### exper.c ### */ E int NDECL(newpw); -E int FDECL(experience, (struct monst *,int)); -E void FDECL(more_experienced, (int,int)); +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)); @@ -683,15 +692,15 @@ E long FDECL(rndexp, (BOOLEAN_P)); /* ### explode.c ### */ -E void FDECL(explode, (int,int,int,int,CHAR_P,int)); +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)); -E void FDECL(explode_oil, (struct obj *,int,int)); +E void FDECL(explode_oil, (struct obj *, int, int)); /* ### extralev.c ### */ E void NDECL(makeroguerooms); -E void FDECL(corr, (int,int)); +E void FDECL(corr, (int, int)); E void NDECL(makerogueghost); /* ### files.c ### */ @@ -699,22 +708,22 @@ E void NDECL(makerogueghost); 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)); +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(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 *)); +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 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)); #ifdef INSURANCE @@ -729,7 +738,7 @@ 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 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 *)); @@ -738,14 +747,14 @@ 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 int FDECL(parse_sym_line, (char *, int)); E void FDECL(paniclog, (const char *, const char *)); E int FDECL(validate_prefix_locations, (char *)); #ifdef SELECTSAVED E char *FDECL(plname_from_file, (const char *)); #endif -E char** NDECL(get_saved_games); -E void FDECL(free_saved_games, (char**)); +E char **NDECL(get_saved_games); +E void FDECL(free_saved_games, (char **)); #ifdef SELF_RECOVER E boolean NDECL(recover_savefile); #endif @@ -759,19 +768,19 @@ E void NDECL(really_close); #ifdef DEBUG E boolean FDECL(debugcore, (const char *, BOOLEAN_P)); #endif -E boolean FDECL(read_tribute, (const char *,const char *,int)); +E boolean FDECL(read_tribute, (const char *, const char *, int)); /* ### 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)); +#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 FDECL(breaksink, (int, int)); E void NDECL(drinksink); /* ### hack.c ### */ @@ -780,13 +789,13 @@ 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 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(invocation_pos, (XCHAR_P, XCHAR_P)); E boolean FDECL(test_move, (int, int, int, int, int)); E boolean NDECL(u_rooted); E void NDECL(domove); @@ -794,16 +803,16 @@ E boolean NDECL(overexertion); E void NDECL(invocation_message); 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 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 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 void FDECL(losehp, (int, const char *, BOOLEAN_P)); E int NDECL(weight_cap); E int NDECL(inv_weight); E int NDECL(near_capacity); @@ -824,35 +833,36 @@ E char *FDECL(ucase, (char *)); E char *FDECL(upstart, (char *)); E char *FDECL(mungspaces, (char *)); E char *FDECL(eos, (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(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 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 char *FDECL(strsubst, (char *, const char *, const char *)); 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(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 *)); +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)); +E int FDECL(strncmpi, (const char *, const char *, int)); #endif #ifndef STRSTRI -E char *FDECL(strstri, (const char *,const char *)); +E char *FDECL(strstri, (const char *, const char *)); #endif -E boolean FDECL(fuzzymatch, (const char *,const char *,const char *,BOOLEAN_P)); +E boolean +FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P)); E void NDECL(setrandom); E time_t NDECL(getnow); E int NDECL(getyear); @@ -861,7 +871,7 @@ 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 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); @@ -873,8 +883,8 @@ E int NDECL(midnight); E struct obj **FDECL(objarr_init, (int)); E void FDECL(objarr_set, (struct obj *, int, struct obj **, BOOLEAN_P)); E void FDECL(assigninvlet, (struct obj *)); -E struct obj *FDECL(merge_choice, (struct obj *,struct obj *)); -E int FDECL(merged, (struct obj **,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 @@ -882,44 +892,46 @@ 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 *)); + (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(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(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(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 *FDECL(o_on, (unsigned int,struct obj *)); -E boolean FDECL(obj_here, (struct obj *,int,int)); +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 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 struct obj *FDECL(g_at, (int, int)); +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 void FDECL(identify_pack, (int,BOOLEAN_P)); +E void FDECL(identify_pack, (int, BOOLEAN_P)); E void NDECL(learn_unseen_invent); -E void FDECL(prinv, (const char *,struct obj *,long)); -E char *FDECL(xprname, (struct obj *,const char *,CHAR_P,BOOLEAN_P,long,long)); +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 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 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 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 int NDECL(doprgold); E int NDECL(doprwep); @@ -928,17 +940,17 @@ 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 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 int FDECL(count_unpaid, (struct obj *)); -E int FDECL(count_buc, (struct obj *,int)); -E long FDECL(count_contents, (struct obj *,BOOLEAN_P,BOOLEAN_P,BOOLEAN_P)); +E int FDECL(count_buc, (struct obj *, int)); +E long FDECL(count_contents, (struct obj *, 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 *)); +E void FDECL(silly_thing, (const char *, struct obj *)); /* ### ioctl.c ### */ @@ -946,9 +958,9 @@ E void FDECL(silly_thing, (const char *,struct obj *)); E void NDECL(getwindowsz); E void NDECL(getioctls); E void NDECL(setioctls); -# ifdef SUSPEND +#ifdef SUSPEND E int NDECL(dosuspend); -# endif /* SUSPEND */ +#endif /* SUSPEND */ #endif /* UNIX || __BEOS__ */ /* ### light.c ### */ @@ -966,8 +978,8 @@ 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 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 *)); @@ -979,17 +991,17 @@ E int NDECL(wiz_light_sources); 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 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 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 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 boolean FDECL(stumble_on_door_mimic, (int, int)); +E int FDECL(doopen_indir, (int, int)); E int NDECL(doclose); #ifdef MAC @@ -997,12 +1009,12 @@ E int NDECL(doclose); /* ### macfile.c ### */ -E int FDECL(maccreat, (const char *,long)); -E int FDECL(macopen, (const char *,int,long)); +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(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 ### */ @@ -1011,7 +1023,7 @@ E boolean NDECL(authorize_wizard_mode); /* ### macsnd.c ### */ -E void FDECL(mac_speaker, (struct obj *,char *)); +E void FDECL(mac_speaker, (struct obj *, char *)); /* ### macunix.c ### */ @@ -1026,7 +1038,7 @@ E int NDECL(SanePositions); /* ### mttymain.c ### */ E void FDECL(getreturn, (char *)); -E void VDECL(msmsg, (const char *,...)); +E void VDECL(msmsg, (const char *, ...)); E void NDECL(gettty); E void NDECL(setftty); E void FDECL(settty, (const char *)); @@ -1039,9 +1051,9 @@ E void FDECL(nocmov, (int x, int y)); /* ### mail.c ### */ #ifdef MAIL -# ifdef UNIX +#ifdef UNIX E void NDECL(getmailstatus); -# endif +#endif E void NDECL(ckmailstatus); E void FDECL(readmail, (struct obj *)); #endif /* MAIL */ @@ -1050,20 +1062,20 @@ E void FDECL(readmail, (struct obj *)); 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 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 void FDECL(newmonhp, (struct monst *, int)); E struct mextra *NDECL(newmextra); -E void FDECL(copy_mextra, (struct monst *,struct monst *)); -E struct monst *FDECL(makemon, (struct permonst *,int,int,int)); -E boolean FDECL(create_critters, (int,struct permonst *,BOOLEAN_P)); +E void FDECL(copy_mextra, (struct monst *, 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, (CHAR_P, int)); 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 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 *)); @@ -1073,8 +1085,8 @@ 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 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 ### */ @@ -1085,35 +1097,36 @@ E void FDECL(genl_putmixed, (winid, int, const char *)); /* ### mcastu.c ### */ -E int FDECL(castmu, (struct monst *,struct attack *,BOOLEAN_P,BOOLEAN_P)); -E int FDECL(buzzmu, (struct monst *,struct attack *)); +E int FDECL(castmu, (struct monst *, struct attack *, BOOLEAN_P, BOOLEAN_P)); +E int FDECL(buzzmu, (struct monst *, struct attack *)); /* ### 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 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 void FDECL(xdrainenergym, (struct monst *, BOOLEAN_P)); E long FDECL(attk_protection, (int)); -E void FDECL(rustm, (struct monst *,struct obj *)); +E void FDECL(rustm, (struct monst *, struct obj *)); /* ### mhitu.c ### */ -E const char *FDECL(mpoisons_subj, (struct monst *,struct attack *)); +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 permonst *,int,int *,struct attack *)); +E void FDECL(expels, (struct monst *, struct permonst *, BOOLEAN_P)); +E struct attack *FDECL(getmattk, + (struct permonst *, 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(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 *)); /* ### minion.c ### */ @@ -1122,7 +1135,7 @@ 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 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)); @@ -1136,57 +1149,57 @@ E void NDECL(gain_guardian_angel); /* ### mklev.c ### */ #ifdef USE_TRAMPOLI -E int FDECL(do_comp, (genericptr_t,genericptr_t)); +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 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 FDECL(add_door, (int, int, struct mkroom *)); E void NDECL(mklev); #ifdef SPECIALIZATION -E void FDECL(topologize, (struct mkroom *,BOOLEAN_P)); +E void FDECL(topologize, (struct mkroom *, BOOLEAN_P)); #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 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)); /* ### mkmap.c ### */ -void FDECL(flood_fill_rm, (int,int,int,BOOLEAN_P,BOOLEAN_P)); -void FDECL(remove_rooms, (int,int,int,int)); +void FDECL(flood_fill_rm, (int, int, int, BOOLEAN_P, BOOLEAN_P)); +void FDECL(remove_rooms, (int, int, int, int)); /* ### mkmaze.c ### */ -E void FDECL(wallification, (int,int,int,int)); -E void FDECL(walkfrom, (int,int,SCHAR_P)); +E void FDECL(wallification, (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 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(fumaroles); E void NDECL(movebubbles); E void NDECL(water_friction); -E void FDECL(save_waterlevel, (int,int)); +E void FDECL(save_waterlevel, (int, int)); E void FDECL(restore_waterlevel, (int)); -E const char *FDECL(waterbody_name, (XCHAR_P,XCHAR_P)); +E const char *FDECL(waterbody_name, (XCHAR_P, XCHAR_P)); /* ### mkobj.c ### */ E struct oextra *NDECL(newoextra); -E void FDECL(copy_oextra, (struct obj *,struct obj *)); +E void FDECL(copy_oextra, (struct obj *, struct obj *)); E void FDECL(dealloc_oextra, (struct oextra *)); E void FDECL(newomonst, (struct obj *)); E void FDECL(free_omonst, (struct obj *)); @@ -1194,29 +1207,29 @@ 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(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(mkobj, (CHAR_P,BOOLEAN_P)); +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(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 void FDECL(replace_object, (struct obj *,struct obj *)); +E struct obj *FDECL(splitobj, (struct obj *, long)); +E void FDECL(replace_object, (struct obj *, 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 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 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_tt_object, (int, int, int)); E struct obj *FDECL(mk_named_object, - (int,struct permonst *,int,int,const char *)); + (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 *)); @@ -1224,10 +1237,10 @@ 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(blessorcurse, (struct obj *, int)); 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(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 *)); @@ -1240,26 +1253,26 @@ 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 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, (int, int, int, unsigned)); -E struct obj* FDECL(obj_absorb, (struct obj**, struct obj**)); -E struct obj* FDECL(obj_meld, (struct obj**, struct obj**)); +E struct obj *FDECL(obj_nexto, (struct obj *)); +E struct obj *FDECL(obj_nexto_xy, (int, int, int, unsigned)); +E struct obj *FDECL(obj_absorb, (struct obj **, struct obj **)); +E struct obj *FDECL(obj_meld, (struct obj **, struct obj **)); /* ### 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(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 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)); @@ -1269,73 +1282,75 @@ E int FDECL(cmap_to_type, (int)); /* ### mon.c ### */ E int FDECL(undead_to_corpse, (int)); -E int FDECL(genus, (int,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 boolean FDECL(mpickstuff, (struct monst *, const char *)); E int FDECL(curr_mon_load, (struct monst *)); E int FDECL(max_mon_load, (struct monst *)); -E boolean 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 boolean 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 int FDECL(mcalcmove, (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 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 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(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(xkilled, (struct monst *, int)); +E void FDECL(mon_to_stone, (struct monst *)); E void FDECL(mnexto, (struct monst *)); E void FDECL(maybe_mnexto, (struct monst *)); -E boolean FDECL(mnearto, (struct monst *,XCHAR_P,XCHAR_P,BOOLEAN_P)); +E boolean FDECL(mnearto, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); E void FDECL(m_respond, (struct monst *)); E void FDECL(setmangry, (struct monst *)); E void FDECL(wakeup, (struct monst *)); E void NDECL(wake_nearby); -E void FDECL(wake_nearto, (int,int,int)); +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 boolean FDECL(hideunder, (struct monst *)); E void FDECL(hide_monst, (struct monst *)); E void FDECL(mon_animal_list, (BOOLEAN_P)); 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(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 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 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 void FDECL(decide_to_shapeshift, (struct monst *, int)); /* ### mondata.c ### */ -E void FDECL(set_mon_data, (struct monst *,struct permonst *,int)); -E struct attack *FDECL(attacktype_fordmg, (struct permonst *,int,int)); -E boolean FDECL(attacktype, (struct permonst *,int)); +E void FDECL(set_mon_data, (struct monst *, struct permonst *, int)); +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(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 *)); @@ -1349,21 +1364,21 @@ 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 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(name_to_monclass, (const char *, int *)); E int FDECL(gender, (struct monst *)); E int FDECL(pronoun_gender, (struct monst *)); E boolean FDECL(levl_follower, (struct monst *)); E int FDECL(little_to_big, (int)); E int FDECL(big_to_little, (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 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 *)); @@ -1371,23 +1386,23 @@ E boolean FDECL(olfaction, (struct permonst *)); 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 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 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 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 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)); +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)); /* ### monst.c ### */ @@ -1399,76 +1414,77 @@ E void NDECL(monstr_init); /* ### 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 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 *)); #if defined(MICRO) || defined(WIN32) /* ### msdos.c,os2.c,tos.c,winnt.c ### */ -# ifndef WIN32 +#ifndef WIN32 E int NDECL(tgetch); -# endif -# ifndef TOS +#endif +#ifndef TOS E char NDECL(switchar); -# endif -# ifndef __GO32__ +#endif +#ifndef __GO32__ E long FDECL(freediskspace, (char *)); -# ifdef MSDOS +#ifdef MSDOS E int FDECL(findfirst_file, (char *)); E int NDECL(findnext_file); E long FDECL(filesize_nh, (char *)); -# else +#else E int FDECL(findfirst, (char *)); E int NDECL(findnext); E long FDECL(filesize, (char *)); -# endif /* MSDOS */ +#endif /* MSDOS */ E char *NDECL(foundfile_buffer); -# endif /* __GO32__ */ +#endif /* __GO32__ */ E void FDECL(chdrive, (char *)); -# ifndef TOS +#ifndef TOS E void NDECL(disable_ctrlP); E void NDECL(enable_ctrlP); -# endif -# if defined(MICRO) && !defined(WINNT) +#endif +#if defined(MICRO) && !defined(WINNT) E void NDECL(get_scr_size); -# ifndef TOS -E void FDECL(gotoxy, (int,int)); -# endif -# endif -# ifdef TOS -E int FDECL(_copyfile, (char *,char *)); +#ifndef TOS +E void FDECL(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); -# ifdef SUSPEND +#ifdef SUSPEND E int NDECL(dosuspend); -# endif -# endif /* TOS */ -# ifdef WIN32 +#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)); -# endif /* WIN32 */ +#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 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 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 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 boolean FDECL(hits_bars, (struct obj **,int,int,int,int)); +E struct obj *FDECL(m_carrying, (struct monst *, int)); +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 boolean FDECL(hits_bars, (struct obj **, int, int, int, int)); /* ### muse.c ### */ @@ -1477,18 +1493,18 @@ 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 *)); +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 boolean FDECL(munstone, (struct monst *,BOOLEAN_P)); -E boolean FDECL(munslime, (struct monst *,BOOLEAN_P)); +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 boolean FDECL(munstone, (struct monst *, BOOLEAN_P)); +E boolean FDECL(munslime, (struct monst *, BOOLEAN_P)); /* ### music.c ### */ @@ -1502,10 +1518,10 @@ E char *NDECL(lan_username); #endif /* ### nhregex.c ### */ -E struct nhregex * NDECL(regex_init); +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 boolean FDECL(regex_match, (const char *, struct nhregex *)); E void FDECL(regex_free, (struct nhregex *)); /* ### nttty.c ### */ @@ -1513,10 +1529,10 @@ E void FDECL(regex_free, (struct nhregex *)); #ifdef WIN32 E void NDECL(get_scr_size); E int NDECL(nttty_kbhit); -E void FDECL(nttty_open,(int)); +E void FDECL(nttty_open, (int)); E void NDECL(nttty_rubout); E int NDECL(tgetch); -E int FDECL(ntposkey,(int *, int *, int *)); +E int FDECL(ntposkey, (int *, int *, int *)); E void FDECL(set_output_mode, (int)); E void NDECL(synch_cursor); #endif @@ -1524,12 +1540,12 @@ E void NDECL(synch_cursor); /* ### o_init.c ### */ E void NDECL(init_objects); -E void FDECL(obj_shuffle_range, (int,int *,int *)); +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(savenames, (int, int)); E void FDECL(restnames, (int)); -E void FDECL(discover_object, (int,BOOLEAN_P,BOOLEAN_P)); +E void FDECL(discover_object, (int, BOOLEAN_P, BOOLEAN_P)); E void FDECL(undiscover_object, (int)); E int NDECL(dodiscovered); E int NDECL(doclassdisco); @@ -1544,7 +1560,7 @@ E void NDECL(objects_init); E char *FDECL(obj_typename, (int)); E char *FDECL(simple_typename, (int)); E boolean FDECL(obj_is_pname, (struct obj *)); -E char *FDECL(distant_name, (struct obj *,char *(*)(OBJ_P))); +E char *FDECL(distant_name, (struct obj *, char *(*)(OBJ_P))); E char *FDECL(fruitname, (BOOLEAN_P)); E char *FDECL(xname, (struct obj *)); E char *FDECL(mshot_xname, (struct obj *)); @@ -1552,23 +1568,23 @@ E boolean FDECL(the_unique_obj, (struct obj *)); E boolean FDECL(the_unique_pm, (struct permonst *)); E char *FDECL(doname, (struct obj *)); E boolean FDECL(not_fully_identified, (struct obj *)); -E char *FDECL(corpse_xname, (struct obj *,const char *,unsigned)); +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(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(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 *)); @@ -1580,28 +1596,29 @@ 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 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(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 char *FDECL(safe_qbuf, (char *, const char *, const char *, struct obj *, + char *(*)(OBJ_P), char *(*)(OBJ_P), const char *)); /* ### options.c ### */ -E boolean FDECL(match_optname, (const char *,const char *,int,BOOLEAN_P)); +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 void FDECL(parseoptions, (char *,BOOLEAN_P,BOOLEAN_P)); +E void 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 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 void FDECL(add_menu_cmd_alias, (CHAR_P, CHAR_P)); E char FDECL(map_menu_cmd, (CHAR_P)); E void FDECL(assign_warnings, (uchar *)); @@ -1609,10 +1626,10 @@ 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 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 int FDECL(load_symset, (const char *, int)); E void FDECL(parsesymbols, (char *)); E struct symparse *FDECL(match_sym, (char *)); E void NDECL(set_playmode); @@ -1628,18 +1645,19 @@ 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 char *FDECL(dowhatdoes_core, (CHAR_P, char *)); E int NDECL(dohelp); E int NDECL(dohistory); -E int FDECL(do_screen_description, (coord, BOOLEAN_P, int, char *, const char **)); +E int FDECL(do_screen_description, + (coord, BOOLEAN_P, int, char *, const char **)); E int FDECL(do_look, (int, coord *)); /* ### pcmain.c ### */ #if defined(MICRO) || defined(WIN32) -# ifdef CHDIR -E void FDECL(chdirx, (char *,BOOLEAN_P)); -# endif /* CHDIR */ +#ifdef CHDIR +E void FDECL(chdirx, (char *, BOOLEAN_P)); +#endif /* CHDIR */ E boolean NDECL(authorize_wizard_mode); #endif /* MICRO || WIN32 */ @@ -1648,19 +1666,19 @@ E boolean NDECL(authorize_wizard_mode); #if defined(MICRO) || defined(WIN32) E void NDECL(flushout); E int NDECL(dosh); -# ifdef MFLOPPY -E void FDECL(eraseall, (const char *,const char *)); +#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 +#endif E void FDECL(append_slash, (char *)); E void FDECL(getreturn, (const char *)); -# ifndef AMIGA -E void VDECL(msmsg, (const char *,...)); -# endif -E FILE *FDECL(fopenp, (const char *,const char *)); +#ifndef AMIGA +E void VDECL(msmsg, (const char *, ...)); +#endif +E FILE *FDECL(fopenp, (const char *, const char *)); #endif /* MICRO || WIN32 */ /* ### pctty.c ### */ @@ -1669,7 +1687,7 @@ E FILE *FDECL(fopenp, (const char *,const char *)); E void NDECL(gettty); E void FDECL(settty, (const char *)); E void NDECL(setftty); -E void VDECL(error, (const char *,...)); +E void VDECL(error, (const char *, ...)); #if defined(TIMED_DELAY) && defined(_MSC_VER) E void FDECL(msleep, (unsigned)); #endif @@ -1686,9 +1704,9 @@ E void NDECL(getlock); /* ### 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 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 void FDECL(add_valid_menu_class, (int)); E boolean FDECL(allow_all, (struct obj *)); E boolean FDECL(allow_category, (struct obj *)); @@ -1700,41 +1718,41 @@ 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 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 NDECL(doloot); E boolean FDECL(container_gone, (int (*)(OBJ_P))); E boolean NDECL(u_handsy); -E int FDECL(use_container, (struct obj **,int)); -E int FDECL(loot_mon, (struct monst *,int *,boolean *)); +E int FDECL(use_container, (struct obj **, int)); +E int FDECL(loot_mon, (struct monst *, int *, boolean *)); E int NDECL(dotip); E boolean FDECL(is_autopickup_exception, (struct obj *, BOOLEAN_P)); /* ### pline.c ### */ -E void VDECL(pline, (const char *,...)) PRINTF_F(1,2); -E void VDECL(Norep, (const char *,...)) PRINTF_F(1,2); +E void VDECL(pline, (const char *, ...)) PRINTF_F(1, 2); +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(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 const char *FDECL(align_str, (ALIGNTYP_P)); E void FDECL(mstatusline, (struct monst *)); E void NDECL(ustatusline); E void NDECL(self_invis_message); -E void FDECL(pudding_merge_message, (struct obj*, struct obj*)); +E void FDECL(pudding_merge_message, (struct obj *, struct obj *)); /* ### polyself.c ### */ @@ -1754,34 +1772,34 @@ E int NDECL(dohide); E int NDECL(dopoly); E int NDECL(domindblast); E void FDECL(skinback, (BOOLEAN_P)); -E const char *FDECL(mbodypart, (struct monst *,int)); +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 void FDECL(ugolemeffects, (int, int)); /* ### 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_blinded, (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 boolean FDECL(make_hallucinated, (long,BOOLEAN_P,long)); +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_blinded, (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 boolean FDECL(make_hallucinated, (long, BOOLEAN_P, long)); 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 *,BOOLEAN_P)); +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 *, BOOLEAN_P)); 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 struct monst *FDECL(split_mon, (struct monst *, struct monst *)); E const char *NDECL(bottlename); /* ### pray.c ### */ @@ -1796,36 +1814,35 @@ 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(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)); - +E void FDECL(altar_wrath, (int, int)); /* ### 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 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 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 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 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 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(restpriest, (struct monst *, BOOLEAN_P)); E void FDECL(newepri, (struct monst *)); E void FDECL(free_epri, (struct monst *)); @@ -1848,7 +1865,7 @@ 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 boolean FDECL(is_quest_artifact, (struct obj *)); E void FDECL(com_pager, (int)); E void FDECL(qt_pager, (int)); E struct permonst *NDECL(qt_montype); @@ -1858,7 +1875,7 @@ E void NDECL(deliver_splev_message); #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(initstate, (unsigned, char *, int)); E char *FDECL(setstate, (char *)); E long NDECL(random); #endif /* RANDOM */ @@ -1869,23 +1886,24 @@ 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(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 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)); +E void FDECL(wand_explode, (struct obj *, int)); #ifdef USE_TRAMPOLI -E void FDECL(set_lit, (int,int,genericptr_t)); +E void FDECL(set_lit, (int, int, genericptr_t)); #endif -E void FDECL(litroom, (BOOLEAN_P,struct obj *)); +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 FDECL(cant_revive, (int *, BOOLEAN_P, struct obj *)); E boolean NDECL(create_particular); /* ### rect.c ### */ @@ -1895,20 +1913,20 @@ 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 *)); +E void FDECL(split_rects, (NhRect *, NhRect *)); /* ## 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 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 NhRegion* FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int)); +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 NhRegion *FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int)); E boolean NDECL(region_danger); E void NDECL(region_safety); @@ -1916,31 +1934,31 @@ E void NDECL(region_safety); E void FDECL(inven_inuse, (BOOLEAN_P)); E int FDECL(dorecover, (int)); -E void FDECL(restcemetery, (int,struct cemetery **)); +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(getlev, (int, int, XCHAR_P, BOOLEAN_P)); E void FDECL(get_plname_from_file, (int, char *)); #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 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 *)); /* ### rip.c ### */ -E void FDECL(genl_outrip, (winid,int,time_t)); +E void FDECL(genl_outrip, (winid, int, time_t)); /* ### rnd.c ### */ E int FDECL(rn2, (int)); E int FDECL(rnl, (int)); E int FDECL(rnd, (int)); -E int FDECL(d, (int,int)); +E int FDECL(d, (int, int)); E int FDECL(rne, (int)); E int FDECL(rnz, (int)); @@ -1968,22 +1986,22 @@ 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, (char *)); -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 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)); +E void FDECL(role_selection_prolog, (int, winid)); +E void FDECL(role_menu_extra, (int, winid)); E void NDECL(role_init); E const char *FDECL(Hello, (struct monst *)); E const char *NDECL(Goodbye); /* ### rumors.c ### */ -E char *FDECL(getrumor, (int,char *, BOOLEAN_P)); +E char *FDECL(getrumor, (int, char *, BOOLEAN_P)); E char *FDECL(get_rnd_text, (const char *, char *)); -E void FDECL(outrumor, (int,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(save_oracles, (int, int)); E void FDECL(restore_oracles, (int)); E int FDECL(doconsult, (struct monst *)); E void NDECL(rumor_check); @@ -1997,24 +2015,24 @@ E boolean FDECL(tricked_fileremoved, (int, char *)); E void NDECL(savestateinlock); #endif #ifdef MFLOPPY -E boolean FDECL(savelev, (int,XCHAR_P,int)); +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)); +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(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(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); @@ -2025,74 +2043,76 @@ E void FDECL(store_savefileinfo, (int)); 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(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 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(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 void FDECL(make_angry_shk, (struct monst *, XCHAR_P, XCHAR_P)); E int NDECL(dopay); E boolean FDECL(paybill, (int)); 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_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(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(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 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 *,BOOLEAN_P)); +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 *, 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(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_usage, (struct obj *, BOOLEAN_P)); E void FDECL(check_unpaid, (struct obj *)); -E void FDECL(costly_gold, (XCHAR_P,XCHAR_P,long)); -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(costly_gold, (XCHAR_P, XCHAR_P, long)); +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 *)); /* ### 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 void FDECL(stock_room, (int, struct mkroom *)); +E boolean FDECL(saleable, (struct monst *, struct obj *)); E int FDECL(get_shop_item, (int)); E const char *FDECL(shkname, (struct monst *)); E boolean FDECL(shkname_is_pname, (struct monst *)); -E boolean FDECL(is_izchak, (struct monst *,BOOLEAN_P)); +E boolean FDECL(is_izchak, (struct monst *, BOOLEAN_P)); /* ### sit.c ### */ @@ -2119,7 +2139,7 @@ E void FDECL(play_sound_for_message, (const char *)); E void NDECL(sys_early_init); E void NDECL(sysopt_release); -E void FDECL(sysopt_seduce_set,(int)); +E void FDECL(sysopt_seduce_set, (int)); /* ### sys/msdos/sound.c ### */ @@ -2129,12 +2149,13 @@ E int FDECL(assign_soundcard, (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(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 *)); /* ### spell.c ### */ @@ -2144,11 +2165,11 @@ 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 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(spelleffects, (int, BOOLEAN_P)); E void NDECL(losespells); E int NDECL(dovspell); E void FDECL(initialspell, (struct obj *)); @@ -2160,14 +2181,14 @@ 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 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 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(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 void FDECL(relobj, (struct monst *, int, BOOLEAN_P)); E struct obj *FDECL(findgold, (struct obj *)); /* ### steed.c ### */ @@ -2181,17 +2202,18 @@ 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 void FDECL(place_monster, (struct monst *, int, int)); E boolean FDECL(stucksteed, (BOOLEAN_P)); /* ### 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(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 boolean FDECL(teleport_pet, (struct monst *, BOOLEAN_P)); E void NDECL(tele); E boolean FDECL(scrolltele, (struct obj *)); E int NDECL(dotele); @@ -2199,14 +2221,15 @@ 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 *)); -E void FDECL(rloc_to, (struct monst *,int,int)); +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 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)); +E boolean FDECL(u_teleport_mon, (struct monst *, BOOLEAN_P)); /* ### tile.c ### */ #ifdef USE_TILES @@ -2229,78 +2252,80 @@ 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 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_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(save_timers, (int, int, int)); +E void FDECL(restore_timers, (int, int, BOOLEAN_P, long)); E void FDECL(relink_timers, (BOOLEAN_P)); E int NDECL(wiz_timeout_queue); E void NDECL(timer_sanity_check); /* ### topten.c ### */ -E void FDECL(formatkiller, (char *,unsigned,int)); -E void FDECL(topten, (int,time_t)); -E void FDECL(prscore, (int,char **)); +E void FDECL(formatkiller, (char *, unsigned, int)); +E void FDECL(topten, (int, time_t)); +E void FDECL(prscore, (int, char **)); E struct obj *FDECL(tt_oname, (struct obj *)); /* ### track.c ### */ E void NDECL(initrack); E void NDECL(settrack); -E coord *FDECL(gettrack, (int,int)); +E coord *FDECL(gettrack, (int, int)); /* ### 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 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)); -E struct monst *FDECL(animate_statue, (struct obj *,XCHAR_P,XCHAR_P,int,int *)); +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)); + (struct trap *, XCHAR_P, XCHAR_P, 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(minstapetrify, (struct monst *, BOOLEAN_P)); E void FDECL(selftouch, (const char *)); -E void FDECL(mselftouch, (struct monst *,const char *,BOOLEAN_P)); +E void FDECL(mselftouch, (struct monst *, const char *, BOOLEAN_P)); E void NDECL(float_up); -E void FDECL(fill_pit, (int,int)); +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(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 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 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 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 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 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 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 *)); @@ -2314,26 +2339,27 @@ E void NDECL(u_init); /* ### uhitm.c ### */ -E void FDECL(erode_armor,(struct monst *,int)); -E boolean FDECL(attack_checks, (struct monst *,struct obj *)); +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 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)); -E int FDECL(damageum, (struct monst *,struct attack *)); -E void FDECL(missum, (struct monst *,struct attack *,BOOLEAN_P)); -E int FDECL(passive, (struct monst *,BOOLEAN_P,int,UCHAR_P,BOOLEAN_P)); -E void FDECL(passive_obj, (struct monst *,struct obj *,struct attack *)); +E boolean FDECL(hmon, (struct monst *, struct obj *, int)); +E int FDECL(damageum, (struct monst *, struct attack *)); +E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P)); +E int FDECL(passive, (struct monst *, 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)); +E int FDECL(flash_hits_mon, (struct monst *, struct obj *)); +E void FDECL(light_hits_gremlin, (struct monst *, int)); /* ### unixmain.c ### */ #ifdef UNIX -# ifdef PORT_HELP +#ifdef PORT_HELP E void NDECL(port_help); -# endif +#endif E void FDECL(sethanguphandler, (void (*)(int))); E boolean NDECL(authorize_wizard_mode); E boolean FDECL(check_user_string, (char *)); @@ -2347,7 +2373,7 @@ E void FDECL(settty, (const char *)); E void NDECL(setftty); E void NDECL(intron); E void NDECL(introff); -E void VDECL(error, (const char *,...)) PRINTF_F(1,2); +E void VDECL(error, (const char *, ...)) PRINTF_F(1, 2); #endif /* UNIX || __BEOS__ */ /* ### unixunix.c ### */ @@ -2355,26 +2381,26 @@ E void VDECL(error, (const char *,...)) PRINTF_F(1,2); #ifdef UNIX E void NDECL(getlock); E void FDECL(regularize, (char *)); -# if defined(TIMED_DELAY) && !defined(msleep) && defined(SYSV) +#if defined(TIMED_DELAY) && !defined(msleep) && defined(SYSV) E void FDECL(msleep, (unsigned)); -# endif -# ifdef SHELL +#endif +#ifdef SHELL E int NDECL(dosh); -# endif /* SHELL */ -# if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER) +#endif /* SHELL */ +#if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER) E int FDECL(child, (int)); -# endif -# ifdef PANICTRACE +#endif +#ifdef PANICTRACE E boolean FDECL(file_exists, (const char *)); -# endif +#endif #endif /* UNIX */ /* ### unixres.c ### */ #ifdef UNIX -# ifdef GNOME_GRAPHICS +#ifdef GNOME_GRAPHICS E int FDECL(hide_privileges, (BOOLEAN_P)); -# endif +#endif #endif /* UNIX */ /* ### vault.c ### */ @@ -2399,9 +2425,9 @@ E int NDECL(doextversion); #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 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); @@ -2415,11 +2441,11 @@ E void FDECL(append_port_id, (char *)); #ifdef MSDOS E int FDECL(assign_video, (char *)); -# ifdef NO_TERMS +#ifdef NO_TERMS E void NDECL(gr_init); E void NDECL(gr_finish); -# endif -E void FDECL(tileview,(BOOLEAN_P)); +#endif +E void FDECL(tileview, (BOOLEAN_P)); #endif #ifdef VIDEOSHADES E int FDECL(assign_videoshades, (char *)); @@ -2435,25 +2461,25 @@ E void NDECL(vis_tab_init); /* ### vision.c ### */ E void NDECL(vision_init); -E int FDECL(does_block, (int,int,struct rm*)); +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_t),genericptr_t)); +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_t), genericptr_t)); E unsigned FDECL(howmonseen, (struct monst *)); #ifdef VMS /* ### vmsfiles.c ### */ -E int FDECL(vms_link, (const char *,const char *)); +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(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 *)); @@ -2462,16 +2488,16 @@ E char *FDECL(vms_basename, (const char *)); E unsigned long NDECL(init_broadcast_trapping); E unsigned long NDECL(enable_broadcast_trapping); E unsigned long NDECL(disable_broadcast_trapping); -# if 0 +#if 0 E struct mail_info *NDECL(parse_next_broadcast); -# endif /*0*/ +#endif /*0*/ /* ### vmsmain.c ### */ E int FDECL(main, (int, char **)); -# ifdef CHDIR -E void FDECL(chdirx, (const char *,BOOLEAN_P)); -# endif /* CHDIR */ +#ifdef CHDIR +E void FDECL(chdirx, (const char *, BOOLEAN_P)); +#endif /* CHDIR */ E void FDECL(sethanguphandler, (void (*)(int))); E boolean NDECL(authorize_wizard_mode); @@ -2492,7 +2518,7 @@ 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); +E void VDECL(error, (const char *, ...)) PRINTF_F(1, 2); #ifdef TIMED_DELAY E void FDECL(msleep, (unsigned)); #endif @@ -2503,43 +2529,43 @@ 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_define, (const char *, const char *, int)); E int FDECL(vms_putenv, (const char *)); E char *NDECL(verify_termcap); -# if defined(CHDIR) || defined(SHELL) || defined(SECURE) +#if defined(CHDIR) || defined(SHELL) || defined(SECURE) E void NDECL(privoff); E void NDECL(privon); -# endif -# ifdef SHELL +#endif +#ifdef SHELL E int NDECL(dosh); -# endif -# if defined(SHELL) || defined(MAIL) -E int FDECL(vms_doshell, (const char *,BOOLEAN_P)); -# endif -# ifdef SUSPEND +#endif +#if defined(SHELL) || defined(MAIL) +E int FDECL(vms_doshell, (const char *, BOOLEAN_P)); +#endif +#ifdef SUSPEND E int NDECL(dosuspend); -# endif -# ifdef SELECTSAVED -E int FDECL(vms_get_saved_games, (const char *,char ***)); -# endif +#endif +#ifdef SELECTSAVED +E int FDECL(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(hitval, (struct obj *, struct monst *)); +E int FDECL(dmgval, (struct obj *, struct monst *)); E struct obj *FDECL(select_rwep, (struct monst *)); E struct obj *FDECL(select_hwep, (struct monst *)); -E void FDECL(possibly_unwield, (struct monst *,BOOLEAN_P)); +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 int NDECL(enhance_weapon_skill); E void FDECL(unrestrict_weapon_skill, (int)); -E void FDECL(use_skill, (int,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 *)); @@ -2554,7 +2580,7 @@ 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 int FDECL(were_summon, (struct permonst *, BOOLEAN_P, int *, char *)); E void NDECL(you_were); E void FDECL(you_unwere, (BOOLEAN_P)); @@ -2566,7 +2592,7 @@ 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 boolean FDECL(wield_tool, (struct obj *, const char *)); E int NDECL(can_twoweapon); E void NDECL(drop_uswapwep); E int NDECL(dotwoweapon); @@ -2574,10 +2600,10 @@ 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(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 void FDECL(setmnotwielded, (struct monst *, struct obj *)); E boolean FDECL(mwelded, (struct obj *)); /* ### windows.c ### */ @@ -2589,10 +2615,10 @@ 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 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)); +E void FDECL(genl_putmsghistory, (const char *, BOOLEAN_P)); #ifdef HANGUPHANDLING E void NDECL(nhwindows_hangup); #endif @@ -2606,7 +2632,7 @@ E int FDECL(tactics, (struct monst *)); E void NDECL(aggravate); E void NDECL(clonewiz); E int NDECL(pick_nasty); -E int FDECL(nasty, (struct monst*)); +E int FDECL(nasty, (struct monst *)); E void NDECL(resurrect); E void NDECL(intervene); E void NDECL(wizdead); @@ -2615,39 +2641,39 @@ E void FDECL(cuss, (struct monst *)); /* ### worm.c ### */ E int NDECL(get_wormno); -E void FDECL(initworm, (struct monst *,int)); +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,struct obj *)); +E void FDECL(cutworm, (struct monst *, XCHAR_P, XCHAR_P, struct obj *)); 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(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 *)); E void FDECL(remove_worm, (struct monst *)); -E void FDECL(place_worm_tail_randomly, (struct monst *,XCHAR_P,XCHAR_P)); +E void FDECL(place_worm_tail_randomly, (struct monst *, XCHAR_P, XCHAR_P)); E int FDECL(count_wsegs, (struct monst *)); E boolean FDECL(worm_known, (struct monst *)); -E boolean FDECL(worm_cross, (int,int,int,int)); +E boolean FDECL(worm_cross, (int, int, int, int)); /* ### worn.c ### */ -E void FDECL(setworn, (struct obj *,long)); +E void FDECL(setworn, (struct obj *, long)); E void FDECL(setnotworn, (struct obj *)); 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(mon_adjust_speed, (struct monst *, int, struct obj *)); E void FDECL(update_mon_intrinsics, - (struct monst *,struct obj *,BOOLEAN_P,BOOLEAN_P)); + (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(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 void FDECL(bypass_objlist, (struct obj *, BOOLEAN_P)); E struct obj *FDECL(nxt_unbypassed_obj, (struct obj *)); E int FDECL(racial_exception, (struct monst *, struct obj *)); @@ -2658,53 +2684,55 @@ E int FDECL(dowrite, (struct obj *)); /* ### zap.c ### */ E void FDECL(learnwand, (struct obj *)); -E int FDECL(bhitm, (struct monst *,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 *)); -E struct monst *FDECL(revive, (struct obj *,BOOLEAN_P)); +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 *)); +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 *)); E struct obj *FDECL(poly_obj, (struct obj *, int)); -E boolean FDECL(obj_resists, (struct obj *,int,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(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 int FDECL(zapyourself, (struct obj *, BOOLEAN_P)); E void FDECL(ubreatheu, (struct attack *)); -E int FDECL(lightdamage, (struct obj *,BOOLEAN_P,int)); +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 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,int,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(melt_ice, (XCHAR_P,XCHAR_P,const char *)); -E void FDECL(start_melt_ice_timeout, (XCHAR_P,XCHAR_P,long)); +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, int, 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(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 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 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 */ diff --git a/include/flag.h b/include/flag.h index d23c44095..ecd5c4e3e 100644 --- a/include/flag.h +++ b/include/flag.h @@ -16,110 +16,112 @@ */ 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 */ -#define wizard flags.debug - boolean end_own; /* list all own scores */ - boolean explore; /* in exploration mode */ + 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 */ +#define wizard flags.debug + boolean end_own; /* list all own scores */ + boolean explore; /* in exploration mode */ #define discover flags.explore - boolean female; - boolean friday13; /* it's Friday the 13th */ - boolean help; /* look in data file for info about stuff */ - boolean ignintr; /* ignore interrupts */ - 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 nap; /* `timed_delay' option for display effects */ - boolean null; /* OK to send nulls to the terminal */ - boolean perm_invent; /* keep full inventories up until dismissed */ - boolean pickup; /* whether you pickup or move and look */ - boolean pickup_thrown; /* auto-pickup items you threw */ - boolean pushweapon; /* When wielding, push old weapon into second slot */ - boolean rest_on_space; /* space means rest */ - boolean safe_dog; /* give complete protection to the dog */ - boolean showexp; /* show experience points */ - boolean showscore; /* show score */ - boolean silent; /* whether the bell rings or not */ - boolean sortloot; /* sort items alphabetically when looting */ - boolean sortpack; /* sorted inventory */ - boolean sparkle; /* show "resisting" special FX (Scott Bigham) */ - boolean standout; /* use standout for --More-- */ - boolean time; /* display elapsed 'time' */ - boolean tombstone; /* print tombstone */ - boolean verbose; /* max battle info */ - int end_top, end_around; /* describe desired score list */ - unsigned moonphase; - unsigned long suppress_alert; -#define NEW_MOON 0 -#define FULL_MOON 4 - int paranoia_bits; /* alternate confirmation prompting */ + boolean female; + boolean friday13; /* it's Friday the 13th */ + boolean help; /* look in data file for info about stuff */ + boolean ignintr; /* ignore interrupts */ + 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 nap; /* `timed_delay' option for display effects */ + boolean null; /* OK to send nulls to the terminal */ + boolean perm_invent; /* keep full inventories up until dismissed */ + boolean pickup; /* whether you pickup or move and look */ + boolean pickup_thrown; /* auto-pickup items you threw */ + boolean pushweapon; /* When wielding, push old weapon into second slot */ + boolean rest_on_space; /* space means rest */ + boolean safe_dog; /* give complete protection to the dog */ + boolean showexp; /* show experience points */ + boolean showscore; /* show score */ + boolean silent; /* whether the bell rings or not */ + boolean sortloot; /* sort items alphabetically when looting */ + boolean sortpack; /* sorted inventory */ + boolean sparkle; /* show "resisting" special FX (Scott Bigham) */ + boolean standout; /* use standout for --More-- */ + boolean time; /* display elapsed 'time' */ + boolean tombstone; /* print tombstone */ + boolean verbose; /* max battle info */ + int end_top, end_around; /* describe desired score list */ + unsigned moonphase; + unsigned long suppress_alert; +#define NEW_MOON 0 +#define FULL_MOON 4 + int paranoia_bits; /* alternate confirmation prompting */ #define PARANOID_CONFIRM 0x01 -#define PARANOID_QUIT 0x02 -#define PARANOID_DIE 0x04 -#define PARANOID_BONES 0x08 -#define PARANOID_HIT 0x10 -#define PARANOID_PRAY 0x20 -#define PARANOID_REMOVE 0x40 - int pickup_burden; /* maximum burden before prompt */ - int pile_limit; /* controls feedback when walking over objects */ - char inv_order[MAXOCLASSES]; - char pickup_types[MAXOCLASSES]; -#define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */ -#define DISCLOSE_PROMPT_DEFAULT_YES 'y' -#define DISCLOSE_PROMPT_DEFAULT_NO 'n' -#define DISCLOSE_YES_WITHOUT_PROMPT '+' -#define DISCLOSE_NO_WITHOUT_PROMPT '-' - 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 */ +#define PARANOID_QUIT 0x02 +#define PARANOID_DIE 0x04 +#define PARANOID_BONES 0x08 +#define PARANOID_HIT 0x10 +#define PARANOID_PRAY 0x20 +#define PARANOID_REMOVE 0x40 + int pickup_burden; /* maximum burden before prompt */ + int pile_limit; /* controls feedback when walking over objects */ + char inv_order[MAXOCLASSES]; + char pickup_types[MAXOCLASSES]; +#define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */ +#define DISCLOSE_PROMPT_DEFAULT_YES 'y' +#define DISCLOSE_PROMPT_DEFAULT_NO 'n' +#define DISCLOSE_YES_WITHOUT_PROMPT '+' +#define DISCLOSE_NO_WITHOUT_PROMPT '-' + 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 */ - /* KMH, role patch -- Variables used during startup. - * - * If the user wishes to select a role, race, gender, and/or alignment - * during startup, the choices should be recorded here. This - * might be specified through command-line options, environmental - * variables, a popup dialog box, menus, etc. - * - * These values are each an index into an array. They are not - * characters or letters, because that limits us to 26 roles. - * They are not booleans, because someday someone may need a neuter - * gender. Negative values are used to indicate that the user - * hasn't yet specified that particular value. If you determine - * that the user wants a random choice, then you should set an - * appropriate random value; if you just left the negative value, - * the user would be asked again! - * - * These variables are stored here because the u structure is - * cleared during character initialization, and because the - * flags structure is restored for saved games. Thus, we can - * use the same parameters to build the role entry for both - * new and restored games. - * - * These variables should not be referred to after the character - * is initialized or restored (specifically, after role_init() - * is called). - */ - int initrole; /* starting role (index into roles[]) */ - int initrace; /* starting race (index into races[]) */ - int initgend; /* starting gender (index into genders[]) */ - int initalign; /* starting alignment (index into aligns[]) */ - int randomall; /* randomly assign everything not specified */ - int pantheon; /* deity selection for priest character */ - /* Items which were in iflags in 3.4.x to preserve savefile compatibility */ - boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */ - boolean showrace; /* show hero glyph by race rather than by role */ - boolean travelcmd; /* allow travel command */ - int runmode; /* update screen display during run moves */ + /* KMH, role patch -- Variables used during startup. + * + * If the user wishes to select a role, race, gender, and/or alignment + * during startup, the choices should be recorded here. This + * might be specified through command-line options, environmental + * variables, a popup dialog box, menus, etc. + * + * These values are each an index into an array. They are not + * characters or letters, because that limits us to 26 roles. + * They are not booleans, because someday someone may need a neuter + * gender. Negative values are used to indicate that the user + * hasn't yet specified that particular value. If you determine + * that the user wants a random choice, then you should set an + * appropriate random value; if you just left the negative value, + * the user would be asked again! + * + * These variables are stored here because the u structure is + * cleared during character initialization, and because the + * flags structure is restored for saved games. Thus, we can + * use the same parameters to build the role entry for both + * new and restored games. + * + * These variables should not be referred to after the character + * is initialized or restored (specifically, after role_init() + * is called). + */ + int initrole; /* starting role (index into roles[]) */ + int initrace; /* starting race (index into races[]) */ + int initgend; /* starting gender (index into genders[]) */ + int initalign; /* starting alignment (index into aligns[]) */ + int randomall; /* randomly assign everything not specified */ + int pantheon; /* deity selection for priest character */ + /* Items which were in iflags in 3.4.x to preserve savefile compatibility + */ + boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */ + boolean showrace; /* show hero glyph by race rather than by role */ + boolean travelcmd; /* allow travel command */ + int runmode; /* update screen display during run moves */ }; /* @@ -136,24 +138,25 @@ struct flag { #ifdef SYSFLAGS struct sysflag { - char sysflagsid[10]; + char sysflagsid[10]; #ifdef AMIFLUSH - boolean altmeta; /* use ALT keys as META */ - boolean amiflush; /* kill typeahead */ + 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 */ + 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 */ + boolean fast_map; /* use optimized, less flexible map display */ #endif -#ifdef MFLOPPY - boolean asksavedisk; +#ifdef MFLOPPY + boolean asksavedisk; #endif #ifdef MAC - boolean page_wait; /* put up a --More-- after a page of messages */ + boolean page_wait; /* put up a --More-- after a page of messages */ #endif }; #endif @@ -165,46 +168,46 @@ struct sysflag { */ 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. - */ - int in_lava_effects; /* hack for Boots_off() */ - int last_msg; /* indicator of last message player saw */ - int purge_monsters; /* # of dead monsters still on fmon list */ - int override_ID; /* true to force full identification of objects */ - int suppress_price; /* controls doname() for unpaid objects */ - coord travelcc; /* coordinates for travel_cache */ - boolean window_inited; /* true if init_nhwindows() completed */ - boolean vision_inited; /* true if vision is ready */ - boolean sanity_check; /* run sanity checks */ - boolean mon_polycontrol; /* debug: control monster polymorphs */ - /* stuff that is related to options and/or user or platform preferences */ - unsigned msg_history; /* hint: # of top lines to save */ - 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 config file */ + /* 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. + */ + int in_lava_effects; /* hack for Boots_off() */ + int last_msg; /* indicator of last message player saw */ + int purge_monsters; /* # of dead monsters still on fmon list */ + int override_ID; /* true to force full identification of objects */ + int suppress_price; /* controls doname() for unpaid objects */ + coord travelcc; /* coordinates for travel_cache */ + boolean window_inited; /* true if init_nhwindows() completed */ + boolean vision_inited; /* true if vision is ready */ + boolean sanity_check; /* run sanity checks */ + boolean mon_polycontrol; /* debug: control monster polymorphs */ + /* stuff that is related to options and/or user or platform preferences */ + unsigned msg_history; /* hint: # of top lines to save */ + 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 config file */ #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 cbreak; /* in cbreak mode, rogue format */ - boolean deferred_X; /* deferred entry into explore mode */ - boolean num_pad; /* use numbers for movement commands */ - boolean news; /* print news */ - boolean mention_walls; /* give feedback when bumping walls */ - boolean menu_tab_sep; /* Use tabs to separate option menu fields */ - boolean menu_head_objsym; /* Show obj symbol in menu headings */ - boolean menu_requested; /* Flag for overloaded use of 'm' prefix - * on some non-move commands */ - boolean renameallowed; /* can change hero name during role selection */ - boolean renameinprogress; /* we are changing hero name */ - boolean toptenwin; /* ending list in window instead of stdout */ - boolean zerocomp; /* write zero-compressed save files */ - boolean rlecomp; /* run-length comp of levels when writing savefile */ - uchar num_pad_mode; - boolean echo; /* 1 to echo characters */ - boolean use_menu_color; /* use color in menus; only if wc_color */ + boolean cbreak; /* in cbreak mode, rogue format */ + boolean deferred_X; /* deferred entry into explore mode */ + boolean num_pad; /* use numbers for movement commands */ + boolean news; /* print news */ + boolean mention_walls; /* give feedback when bumping walls */ + boolean menu_tab_sep; /* Use tabs to separate option menu fields */ + boolean menu_head_objsym; /* Show obj symbol in menu headings */ + boolean menu_requested; /* Flag for overloaded use of 'm' prefix + * on some non-move commands */ + boolean renameallowed; /* can change hero name during role selection */ + boolean renameinprogress; /* we are changing hero name */ + boolean toptenwin; /* ending list in window instead of stdout */ + boolean zerocomp; /* write zero-compressed save files */ + boolean rlecomp; /* run-length comp of levels when writing savefile */ + uchar num_pad_mode; + boolean echo; /* 1 to echo characters */ + boolean use_menu_color; /* use color in menus; only if wc_color */ #if 0 boolean DECgraphics; /* use DEC VT-xxx extended character set */ boolean IBMgraphics; /* use IBM extended character set */ @@ -213,108 +216,110 @@ struct instance_flags { as defined in the special font HackFont */ #endif #endif - uchar bouldersym; /* symbol for boulder display */ + uchar bouldersym; /* symbol for boulder display */ #ifdef TTY_GRAPHICS - char prevmsg_window; /* type of old message window to use */ - boolean extmenu; /* extended commands use menu interface */ + char prevmsg_window; /* type of old message window to use */ + boolean extmenu; /* extended commands use menu interface */ #endif #ifdef MFLOPPY - boolean checkspace; /* check disk space before writing files */ - /* (in iflags to allow restore after moving - * to >2GB partition) */ + boolean checkspace; /* check disk space before writing files */ + /* (in iflags to allow restore after moving + * to >2GB partition) */ #endif #ifdef MICRO - boolean BIOS; /* use IBM or ST BIOS calls when appropriate */ + boolean BIOS; /* use IBM or ST BIOS calls when appropriate */ #endif #if defined(MICRO) || defined(WIN32) - boolean rawio; /* whether can use rawio (IOCTL call) */ + 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 */ + 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; + 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; #endif #ifdef MSDOS - boolean hasvga; /* has a vga adapter */ - boolean usevga; /* use the vga adapter */ - boolean grmode; /* currently in graphics mode */ + boolean hasvga; /* has a vga adapter */ + boolean usevga; /* use the vga adapter */ + boolean grmode; /* currently in graphics mode */ #endif #ifdef LAN_FEATURES - boolean lan_mail; /* mail is initialized */ - boolean lan_mail_fetched; /* mail is awaiting display */ + boolean lan_mail; /* mail is initialized */ + boolean lan_mail_fetched; /* mail is awaiting display */ #endif -/* - * Window capability support. - */ - boolean wc_color; /* use color graphics */ - boolean wc_hilite_pet; /* hilight pets */ - boolean wc_ascii_map; /* show map using traditional ascii */ - boolean wc_tiled_map; /* show map using tiles */ - boolean wc_preload_tiles; /* preload tiles into memory */ - int wc_tile_width; /* tile width */ - int wc_tile_height; /* tile height */ - char *wc_tile_file; /* name of tile file;overrides default */ - boolean wc_inverse; /* use inverse video for some things */ - 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 */ - 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 */ - char *wc_backgrnd_message; /* points to backgrnd color name for msg win */ - char *wc_foregrnd_status; /* points to foregrnd color name for status win */ - char *wc_backgrnd_status; /* points to backgrnd color name for status win */ - char *wc_foregrnd_text; /* points to foregrnd color name for text win */ - char *wc_backgrnd_text; /* points to backgrnd color name for text win */ - 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 */ - char *wc_font_menu; /* points to font name for menu win */ - char *wc_font_text; /* points to font name for text win */ - int wc_fontsiz_map; /* font size for the map win */ - int wc_fontsiz_message; /* font size for the message window */ - int wc_fontsiz_status; /* font size for the status window */ - int wc_fontsiz_menu; /* font size for the menu window */ - int wc_fontsiz_text; /* font size for text windows */ - int wc_scroll_amount; /* scroll this amount at scroll_margin */ - int wc_scroll_margin; /* scroll map when this far from - the edge */ - int wc_map_mode; /* specify map viewing options, mostly - for backward compatibility */ - int wc_player_selection; /* method of choosing character */ - 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 */ - boolean wc_eight_bit_input; /* allow eight bit input */ - boolean wc_mouse_support; /* allow mouse support */ - boolean wc2_fullscreen; /* run fullscreen */ - boolean wc2_softkeyboard; /* use software keyboard */ - boolean wc2_wraptext; /* wrap text */ - boolean wc2_selectsaved; /* display a menu of user's saved games */ - boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */ - boolean cmdassist; /* provide detailed assistance for some commands */ - boolean clicklook; /* allow right-clicking for look */ - boolean obsolete; /* obsolete options can point at this, it isn't used */ - struct autopickup_exception *autopickup_exceptions[2]; + /* + * Window capability support. + */ + boolean wc_color; /* use color graphics */ + boolean wc_hilite_pet; /* hilight pets */ + boolean wc_ascii_map; /* show map using traditional ascii */ + boolean wc_tiled_map; /* show map using tiles */ + boolean wc_preload_tiles; /* preload tiles into memory */ + int wc_tile_width; /* tile width */ + int wc_tile_height; /* tile height */ + char *wc_tile_file; /* name of tile file;overrides default */ + boolean wc_inverse; /* use inverse video for some things */ + 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 */ + 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 */ + char *wc_backgrnd_message; /* points to backgrnd color name for msg win */ + char * + wc_foregrnd_status; /* points to foregrnd color name for status win */ + char * + wc_backgrnd_status; /* points to backgrnd color name for status win */ + char *wc_foregrnd_text; /* points to foregrnd color name for text win */ + char *wc_backgrnd_text; /* points to backgrnd color name for text win */ + 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 */ + char *wc_font_menu; /* points to font name for menu win */ + char *wc_font_text; /* points to font name for text win */ + int wc_fontsiz_map; /* font size for the map win */ + int wc_fontsiz_message; /* font size for the message window */ + int wc_fontsiz_status; /* font size for the status window */ + int wc_fontsiz_menu; /* font size for the menu window */ + int wc_fontsiz_text; /* font size for text windows */ + int wc_scroll_amount; /* scroll this amount at scroll_margin */ + int wc_scroll_margin; /* scroll map when this far from + the edge */ + int wc_map_mode; /* specify map viewing options, mostly + for backward compatibility */ + int wc_player_selection; /* method of choosing character */ + 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 */ + boolean wc_eight_bit_input; /* allow eight bit input */ + boolean wc_mouse_support; /* allow mouse support */ + boolean wc2_fullscreen; /* run fullscreen */ + boolean wc2_softkeyboard; /* use software keyboard */ + boolean wc2_wraptext; /* wrap text */ + boolean wc2_selectsaved; /* display a menu of user's saved games */ + boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */ + boolean cmdassist; /* provide detailed assistance for some commands */ + boolean clicklook; /* allow right-clicking for look */ + boolean obsolete; /* obsolete options can point at this, it isn't used */ + struct autopickup_exception *autopickup_exceptions[2]; #define AP_LEAVE 0 -#define AP_GRAB 1 +#define AP_GRAB 1 #ifdef WIN32 #define MAX_ALTKEYHANDLER 25 - char altkeyhandler[MAX_ALTKEYHANDLER]; + char altkeyhandler[MAX_ALTKEYHANDLER]; #endif - /* copies of values in struct u, used during detection when the - originals are temporarily cleared; kept here rather than - locally so that they can be restored during a hangup save */ - Bitfield(save_uinwater,1); - Bitfield(save_uburied,1); + /* copies of values in struct u, used during detection when the + originals are temporarily cleared; kept here rather than + locally so that they can be restored during a hangup save */ + Bitfield(save_uinwater, 1); + Bitfield(save_uburied, 1); }; /* @@ -343,42 +348,42 @@ extern NEARDATA struct sysflag sysflags; extern NEARDATA struct instance_flags iflags; /* last_msg values */ -#define PLNMSG_UNKNOWN 0 /* arbitrary */ -#define PLNMSG_ONE_ITEM_HERE 1 /* "you see here" */ -#define PLNMSG_TOWER_OF_FLAME 2 /* scroll of fire */ -#define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */ -#define PLNMSG_OBJ_GLOWS 4 /* "the glows " */ +#define PLNMSG_UNKNOWN 0 /* arbitrary */ +#define PLNMSG_ONE_ITEM_HERE 1 /* "you see here" */ +#define PLNMSG_TOWER_OF_FLAME 2 /* scroll of fire */ +#define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */ +#define PLNMSG_OBJ_GLOWS 4 /* "the glows " */ /* runmode options */ -#define RUN_TPORT 0 /* don't update display until movement stops */ -#define RUN_LEAP 1 /* update display every 7 steps */ -#define RUN_STEP 2 /* update display every single step */ -#define RUN_CRAWL 3 /* walk w/ extra delay after each update */ +#define RUN_TPORT 0 /* don't update display until movement stops */ +#define RUN_LEAP 1 /* update display every 7 steps */ +#define RUN_STEP 2 /* update display every single step */ +#define RUN_CRAWL 3 /* walk w/ extra delay after each update */ /* paranoid confirmation prompting */ /* any yes confirmations also require explicit no (or ESC) to reject */ -#define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0) +#define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0) /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */ -#define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0) +#define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0) /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */ -#define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0) +#define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0) /* hit: yes vs y for "Save bones?" in wizard mode */ -#define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0) +#define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0) /* hit: yes vs y for "Really attack ?" */ -#define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0) +#define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0) /* pray: ask "Really pray?" (accepts y answer, doesn't require yes), taking over for the old prayconfirm boolean option */ -#define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0) +#define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0) /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory item even when only one accessory or piece of armor is currently worn */ -#define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0) +#define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0) /* command parsing, mainly dealing with number_pad handling; not saved and restored */ #ifdef NHSTDC /* forward declaration sufficient to declare pointers */ -struct func_tab; /* from func_tab.h */ +struct func_tab; /* from func_tab.h */ #endif /* commands[] is used to directly access cmdlist[] instead of looping @@ -389,15 +394,14 @@ struct func_tab; /* from func_tab.h */ 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; /* German keyboads; 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 */ + 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; /* German keyboads; 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 func_tab *commands[256]; /* indexed by input character */ }; diff --git a/include/func_tab.h b/include/func_tab.h index 5b2369141..42ee4f3ef 100644 --- a/include/func_tab.h +++ b/include/func_tab.h @@ -8,16 +8,16 @@ #define FUNC_TAB_H struct func_tab { - char f_char; - boolean can_if_buried; - int NDECL((*f_funct)); - const char *f_text; + char f_char; + boolean can_if_buried; + int NDECL((*f_funct)); + const char *f_text; }; struct ext_func_tab { - const char *ef_txt, *ef_desc; - int NDECL((*ef_funct)); - boolean can_if_buried; + const char *ef_txt, *ef_desc; + int NDECL((*ef_funct)); + boolean can_if_buried; }; extern struct ext_func_tab extcmdlist[]; diff --git a/include/gem_rsc.h b/include/gem_rsc.h index c499d0086..14a879dd8 100644 --- a/include/gem_rsc.h +++ b/include/gem_rsc.h @@ -1,65 +1,64 @@ /* 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 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 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 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 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 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 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 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 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 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 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 */ +#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/global.h b/include/global.h index 4f69ee4e8..96c4eb822 100644 --- a/include/global.h +++ b/include/global.h @@ -8,8 +8,7 @@ #include - -#define BETA /* development or beta testing [MRS] */ +#define BETA /* development or beta testing [MRS] */ #define DEBUG @@ -17,25 +16,24 @@ * Files expected to exist in the playground directory. */ -#define RECORD "record" /* file containing list of topscorers */ -#define HELP "help" /* file containing command descriptions */ -#define SHELP "hh" /* abbreviated form of the same */ -#define DEBUGHELP "wizhelp" /* file containing debug mode cmds */ -#define RUMORFILE "rumors" /* file with fortune cookies */ -#define ORACLEFILE "oracles" /* file with oracular information */ -#define DATAFILE "data" /* file giving the meaning of symbols used */ -#define CMDHELPFILE "cmdhelp" /* file telling what commands do */ -#define HISTORY "history" /* file giving nethack's history */ -#define LICENSE "license" /* file with license information */ -#define OPTIONFILE "opthelp" /* file explaining runtime options */ -#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 RECORD "record" /* file containing list of topscorers */ +#define HELP "help" /* file containing command descriptions */ +#define SHELP "hh" /* abbreviated form of the same */ +#define DEBUGHELP "wizhelp" /* file containing debug mode cmds */ +#define RUMORFILE "rumors" /* file with fortune cookies */ +#define ORACLEFILE "oracles" /* file with oracular information */ +#define DATAFILE "data" /* file giving the meaning of symbols used */ +#define CMDHELPFILE "cmdhelp" /* file telling what commands do */ +#define HISTORY "history" /* file giving nethack's history */ +#define LICENSE "license" /* file with license information */ +#define OPTIONFILE "opthelp" /* file explaining runtime options */ +#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 */ /* Assorted definitions that may depend on selections in config.h. */ @@ -51,21 +49,21 @@ #ifndef STUPID #define STUPID #endif -#endif /* DUMB */ +#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 */ -typedef schar xchar; +typedef schar xchar; #ifndef SKIP_BOOLEAN -typedef xchar boolean; /* 0 or 1 */ +typedef xchar boolean; /* 0 or 1 */ #endif -#ifndef TRUE /* defined in some systems' native include files */ -#define TRUE ((boolean)1) -#define FALSE ((boolean)0) +#ifndef TRUE /* defined in some systems' native include files */ +#define TRUE ((boolean) 1) +#define FALSE ((boolean) 0) #endif /* @@ -73,39 +71,36 @@ typedef xchar boolean; /* 0 or 1 */ */ typedef uchar nhsym; - #ifndef STRNCMPI -# ifndef __SASC_60 /* SAS/C already shifts to stricmp */ -# define strcmpi(a,b) strncmpi((a),(b),-1) -# endif +#ifndef __SASC_60 /* SAS/C already shifts to stricmp */ +#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 */ +#define RLECOMP /* run-length compression of levl array - JLee */ +#define ZEROCOMP /* zero-run compression of everything - Olaf Seibert */ #endif -/* #define SPECIALIZATION */ /* do "specialized" version of new topology */ - +/* #define SPECIALIZATION */ /* do "specialized" version of new topology */ #ifdef BITFIELDS -#define Bitfield(x,n) unsigned x:n +#define Bitfield(x, n) unsigned x : n #else -#define Bitfield(x,n) uchar x +#define Bitfield(x, n) uchar x #endif #define SIZE(x) (int)(sizeof(x) / sizeof(x[0])) - /* A limit for some NetHack int variables. It need not, and for comparable * scoring should not, depend on the actual limit on integers for a * particular machine, although it is set to the minimum required maximum * signed integer for C (2^15 -1). */ -#define LARGEST_INT 32767 +#define LARGEST_INT 32767 #include "coord.h" /* @@ -155,54 +150,54 @@ typedef uchar nhsym; /* 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 -# define PORT_ID "Mac" -# endif -# ifdef __APPLE__ -# define PORT_ID "MacOSX" -# endif -# ifdef MSDOS -# ifdef PC9800 -# define PORT_ID "PC-9800" -# else -# define PORT_ID "PC" -# endif -# ifdef DJGPP -# define PORT_SUB_ID "djgpp" -# else -# ifdef OVERLAY -# define PORT_SUB_ID "overlaid" -# else -# define PORT_SUB_ID "non-overlaid" -# endif -# endif -# endif -# ifdef OS2 -# define PORT_ID "OS/2" -# endif -# ifdef TOS -# define PORT_ID "ST" -# endif - /* Check again in case something more specific has been defined above. */ -# ifndef PORT_ID -# ifdef UNIX -# define PORT_ID "Unix" -# endif -# endif -# ifdef VMS -# define PORT_ID "VMS" -# endif -# ifdef WIN32 -# define PORT_ID "Windows" -# endif +#ifdef AMIGA +#define PORT_ID "Amiga" +#endif +#ifdef MAC +#define PORT_ID "Mac" +#endif +#ifdef __APPLE__ +#define PORT_ID "MacOSX" +#endif +#ifdef MSDOS +#ifdef PC9800 +#define PORT_ID "PC-9800" +#else +#define PORT_ID "PC" +#endif +#ifdef DJGPP +#define PORT_SUB_ID "djgpp" +#else +#ifdef OVERLAY +#define PORT_SUB_ID "overlaid" +#else +#define PORT_SUB_ID "non-overlaid" +#endif +#endif +#endif +#ifdef OS2 +#define PORT_ID "OS/2" +#endif +#ifdef TOS +#define PORT_ID "ST" +#endif +/* Check again in case something more specific has been defined above. */ +#ifndef PORT_ID +#ifdef UNIX +#define PORT_ID "Unix" +#endif +#endif +#ifdef VMS +#define PORT_ID "VMS" +#endif +#ifdef WIN32 +#define PORT_ID "Windows" +#endif #endif #if defined(MICRO) #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS) -#define SHORT_FILENAMES /* filenames are 8.3 */ +#define SHORT_FILENAMES /* filenames are 8.3 */ #endif #endif @@ -212,92 +207,92 @@ typedef uchar nhsym; * main() routines do not terminate with return(), whose value is not * so massaged. */ -# ifdef EXIT_SUCCESS -# undef EXIT_SUCCESS -# endif -# ifdef EXIT_FAILURE -# undef EXIT_FAILURE -# endif +#ifdef EXIT_SUCCESS +#undef EXIT_SUCCESS +#endif +#ifdef EXIT_FAILURE +#undef EXIT_FAILURE +#endif #endif #ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +#define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 +#define EXIT_FAILURE 1 #endif -#if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) || defined(WIN32) -# ifndef USE_TILES -# define USE_TILES /* glyph2tile[] will be available */ -# endif +#if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \ + || defined(WIN32) +#ifndef USE_TILES +#define USE_TILES /* glyph2tile[] will be available */ +#endif #endif #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS) -# ifndef USE_TILES -# define USE_TILES -# endif +#ifndef USE_TILES +#define USE_TILES +#endif #endif #if defined(UNIX) || defined(VMS) || defined(__EMX__) || defined(WIN32) -# define HANGUPHANDLING +#define HANGUPHANDLING #endif -#if defined(SAFERHANGUP) && (defined(NOSAVEONHANGUP) || !defined(HANGUPHANDLING)) -# undef SAFERHANGUP +#if defined(SAFERHANGUP) \ + && (defined(NOSAVEONHANGUP) || !defined(HANGUPHANDLING)) +#undef SAFERHANGUP #endif - -#define Sprintf (void) sprintf -#define Strcat (void) strcat -#define Strcpy (void) strcpy +#define Sprintf (void) sprintf +#define Strcat (void) strcat +#define Strcpy (void) strcpy #ifdef NEED_VARARGS -#define Vprintf (void) vprintf +#define Vprintf (void) vprintf #define Vfprintf (void) vfprintf #define Vsprintf (void) vsprintf #endif - /* primitive memory leak debugging; 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 -# define alloc(a) nhalloc(a,__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 */ +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 +#define alloc(a) nhalloc(a, __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 /* 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. */ 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 */ + 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 */ + unsigned long sfi1; /* compression etc. */ + unsigned long sfi2; /* miscellaneous */ + unsigned long sfi3; /* thirdparty */ }; #ifdef NHSTDC -#define SFI1_EXTERNALCOMP (1UL) -#define SFI1_RLECOMP (1UL << 1) -#define SFI1_ZEROCOMP (1UL << 2) +#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) +#define SFI1_EXTERNALCOMP (1L) +#define SFI1_RLECOMP (1L << 1) +#define SFI1_ZEROCOMP (1L << 2) #endif /* @@ -309,52 +304,53 @@ struct savefile_info { */ /* size of terminal screen is (at least) (ROWNO+3) by COLNO */ -#define COLNO 80 -#define ROWNO 21 +#define COLNO 80 +#define ROWNO 21 -#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 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 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 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 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 */ +#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 */ -#define MAXDUNGEON 16 /* current maximum number of dungeons */ -#define MAXLEVEL 32 /* max number of levels in one dungeon */ -#define MAXSTAIRS 1 /* max # of special stairways in a dungeon */ -#define ALIGNWEIGHT 4 /* generation weight of alignment */ +#define MAXDUNGEON 16 /* current maximum number of dungeons */ +#define MAXLEVEL 32 /* max number of levels in one dungeon */ +#define MAXSTAIRS 1 /* max # of special stairways in a dungeon */ +#define ALIGNWEIGHT 4 /* generation weight of alignment */ -#define MAXULEV 30 /* max character experience level */ +#define MAXULEV 30 /* max character experience level */ -#define MAXMONNO 120 /* extinct monst after this number created */ -#define MHPMAX 500 /* maximum monster hp */ +#define MAXMONNO 120 /* extinct monst after this number created */ +#define MHPMAX 500 /* maximum monster hp */ /* PANICTRACE: Always defined for BETA but only for supported platforms. */ #ifdef UNIX -# ifdef BETA +#ifdef BETA /* see end.c */ -# ifndef PANICTRACE -# define PANICTRACE -# endif -# endif +#ifndef PANICTRACE +#define PANICTRACE +#endif +#endif #endif /* The following are meaningless if PANICTRACE is not defined: */ #if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2) -# define PANICTRACE_LIBC +#define PANICTRACE_LIBC #endif #if defined(MACOSX) -# define PANICTRACE_LIBC +#define PANICTRACE_LIBC #endif #ifdef UNIX -# define PANICTRACE_GDB +#define PANICTRACE_GDB #endif #endif /* GLOBAL_H */ diff --git a/include/hack.h b/include/hack.h index 01c6ab321..3cc925010 100644 --- a/include/hack.h +++ b/include/hack.h @@ -12,110 +12,113 @@ #endif #include "lint.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 } +#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 \ + } /* symbolic names for capacity levels */ -#define UNENCUMBERED 0 -#define SLT_ENCUMBER 1 /* Burdened */ -#define MOD_ENCUMBER 2 /* Stressed */ -#define HVY_ENCUMBER 3 /* Strained */ -#define EXT_ENCUMBER 4 /* Overtaxed */ -#define OVERLOADED 5 /* Overloaded */ +#define UNENCUMBERED 0 +#define SLT_ENCUMBER 1 /* Burdened */ +#define MOD_ENCUMBER 2 /* Stressed */ +#define HVY_ENCUMBER 3 /* Strained */ +#define EXT_ENCUMBER 4 /* Overtaxed */ +#define OVERLOADED 5 /* Overloaded */ /* hunger states - see hu_stat in eat.c */ -#define SATIATED 0 -#define NOT_HUNGRY 1 -#define HUNGRY 2 -#define WEAK 3 -#define FAINTING 4 -#define FAINTED 5 -#define STARVED 6 +#define SATIATED 0 +#define NOT_HUNGRY 1 +#define HUNGRY 2 +#define WEAK 3 +#define FAINTING 4 +#define FAINTED 5 +#define STARVED 6 /* 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 +#define BY_ORACLE 0 +#define BY_COOKIE 1 +#define BY_PAPER 2 +#define BY_OTHER 9 /* Macros for why you are no longer riding */ -#define DISMOUNT_GENERIC 0 -#define DISMOUNT_FELL 1 -#define DISMOUNT_THROWN 2 -#define DISMOUNT_POLY 3 -#define DISMOUNT_ENGULFED 4 -#define DISMOUNT_BONES 5 -#define DISMOUNT_BYCHOICE 6 +#define DISMOUNT_GENERIC 0 +#define DISMOUNT_FELL 1 +#define DISMOUNT_THROWN 2 +#define DISMOUNT_POLY 3 +#define DISMOUNT_ENGULFED 4 +#define DISMOUNT_BONES 5 +#define DISMOUNT_BYCHOICE 6 /* 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_CORPSE 0x01 +#define MG_INVIS 0x02 +#define MG_DETECT 0x04 +#define MG_PET 0x08 +#define MG_RIDDEN 0x10 +#define MG_STATUE 0x20 /* sellobj_state() states */ -#define SELL_NORMAL (0) -#define SELL_DELIBERATE (1) -#define SELL_DONTSELL (2) +#define SELL_NORMAL (0) +#define SELL_DELIBERATE (1) +#define SELL_DONTSELL (2) /* alteration types--keep in synch with costly_alteration(mkobj.c) */ -#define COST_CANCEL 0 /* standard cancellation */ -#define COST_DRAIN 1 /* drain life upon an object */ -#define COST_UNCHRG 2 /* cursed charging */ -#define COST_UNBLSS 3 /* unbless (devalues holy water) */ -#define COST_UNCURS 4 /* uncurse (devalues unholy water) */ -#define COST_DECHNT 5 /* disenchant weapons or armor */ -#define COST_DEGRD 6 /* removal of rustproofing, dulling via engraving */ -#define COST_DILUTE 7 /* potion dilution */ -#define COST_ERASE 8 /* scroll or spellbook blanking */ -#define COST_BURN 9 /* dipped into flaming oil */ -#define COST_NUTRLZ 10 /* neutralized via unicorn horn */ -#define COST_DSTROY 11 /* wand breaking (bill first, useup later) */ -#define COST_SPLAT 12 /* cream pie to own face (ditto) */ -#define COST_BITE 13 /* start eating food */ -#define COST_OPEN 14 /* open tin */ -#define COST_BRKLCK 15 /* break box/chest's lock */ -#define COST_RUST 16 /* rust damage */ -#define COST_ROT 17 /* rotting attack */ +#define COST_CANCEL 0 /* standard cancellation */ +#define COST_DRAIN 1 /* drain life upon an object */ +#define COST_UNCHRG 2 /* cursed charging */ +#define COST_UNBLSS 3 /* unbless (devalues holy water) */ +#define COST_UNCURS 4 /* uncurse (devalues unholy water) */ +#define COST_DECHNT 5 /* disenchant weapons or armor */ +#define COST_DEGRD 6 /* removal of rustproofing, dulling via engraving */ +#define COST_DILUTE 7 /* potion dilution */ +#define COST_ERASE 8 /* scroll or spellbook blanking */ +#define COST_BURN 9 /* dipped into flaming oil */ +#define COST_NUTRLZ 10 /* neutralized via unicorn horn */ +#define COST_DSTROY 11 /* wand breaking (bill first, useup later) */ +#define COST_SPLAT 12 /* cream pie to own face (ditto) */ +#define COST_BITE 13 /* start eating food */ +#define COST_OPEN 14 /* open tin */ +#define COST_BRKLCK 15 /* break box/chest's lock */ +#define COST_RUST 16 /* rust damage */ +#define COST_ROT 17 /* rotting attack */ #define COST_CORRODE 18 /* acid damage */ /* 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 */ +#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 */ /* * 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. */ -#define DIED 0 -#define CHOKING 1 -#define POISONING 2 -#define STARVING 3 -#define DROWNING 4 -#define BURNING 5 -#define DISSOLVED 6 -#define CRUSHING 7 -#define STONING 8 -#define TURNED_SLIME 9 -#define GENOCIDED 10 -#define PANICKED 11 -#define TRICKED 12 -#define QUIT 13 -#define ESCAPED 14 -#define ASCENDED 15 +#define DIED 0 +#define CHOKING 1 +#define POISONING 2 +#define STARVING 3 +#define DROWNING 4 +#define BURNING 5 +#define DISSOLVED 6 +#define CRUSHING 7 +#define STONING 8 +#define TURNED_SLIME 9 +#define GENOCIDED 10 +#define PANICKED 11 +#define TRICKED 12 +#define QUIT 13 +#define ESCAPED 14 +#define ASCENDED 15 #include "align.h" #include "dungeon.h" @@ -128,29 +131,29 @@ #include "decl.h" #include "timeout.h" -NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ +NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ /* types of calls to bhit() */ -#define ZAPPED_WAND 0 -#define THROWN_WEAPON 1 -#define KICKED_WEAPON 2 -#define FLASHED_LIGHT 3 -#define INVIS_BEAM 4 +#define ZAPPED_WAND 0 +#define THROWN_WEAPON 1 +#define KICKED_WEAPON 2 +#define FLASHED_LIGHT 3 +#define INVIS_BEAM 4 /* attack mode for hmon() */ -#define HMON_MELEE 0 /* hand-to-hand */ -#define HMON_THROWN 1 /* normal ranged (or spitting while poly'd) */ -#define HMON_KICKED 2 /* alternate ranged */ -#define HMON_APPLIED 3 /* polearm, treated as ranged */ -#define HMON_DRAGGED 4 /* attached iron ball, pulled into mon */ - -#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)))) +#define HMON_MELEE 0 /* hand-to-hand */ +#define HMON_THROWN 1 /* normal ranged (or spitting while poly'd) */ +#define HMON_KICKED 2 /* alternate ranged */ +#define HMON_APPLIED 3 /* polearm, treated as ranged */ +#define HMON_DRAGGED 4 /* attached iron ball, pulled into mon */ + +#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)))) #include "trap.h" #include "flag.h" @@ -162,14 +165,15 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ #include "region.h" /* 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_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 */ +#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_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 @@ -187,127 +191,132 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ #endif /* USE_TRAMPOLI */ /* flags to control makemon() */ -#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 counter (for revival) */ -#define MM_IGNOREWATER 0x00008 /* ignore water when positioning */ -#define MM_ADJACENTOK 0x00010 /* it is 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 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 counter (for revival) */ +#define MM_IGNOREWATER 0x00008 /* ignore water when positioning */ +#define MM_ADJACENTOK \ + 0x00010 /* it is 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 */ /* 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 CORPSTAT_NONE 0x00 +#define CORPSTAT_INIT 0x01 /* pass init flag to mkcorpstat */ +#define CORPSTAT_BURIED 0x02 /* bury the corpse or statue */ /* 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 */ - -/* special mhpmax value when loading bones monster to flag as extinct or genocided */ -#define DEFUNCT_MONSTER (-100) +#define SHIFT_SEENMSG 0x01 /* put out a message if in sight */ +#define SHIFT_MSG 0x02 /* always put out a message */ + +/* special mhpmax value when loading bones monster to flag as extinct or + * genocided */ +#define DEFUNCT_MONSTER (-100) /* macro form of adjustments of physical damage based on Half_physical_damage. * Can be used on-the-fly with the 1st parameter to losehp() if you don't * need to retain the dmg value beyond that call scope. * Take care to ensure it doesn't get used more than once in other instances. */ -#define Maybe_Half_Phys(dmg) ((Half_physical_damage) ? (((dmg) + 1) / 2) : (dmg)) +#define Maybe_Half_Phys(dmg) \ + ((Half_physical_damage) ? (((dmg) + 1) / 2) : (dmg)) /* flags for special ggetobj status returns */ -#define ALL_FINISHED 0x01 /* called routine already finished the job */ +#define ALL_FINISHED 0x01 /* called routine already finished the job */ /* flags to control query_objlist() */ -#define BY_NEXTHERE 0x1 /* follow objlist by nexthere field */ -#define AUTOSELECT_SINGLE 0x2 /* if only 1 object, don't ask */ -#define USE_INVLET 0x4 /* use object's invlet */ -#define INVORDER_SORT 0x8 /* 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 0x1 /* follow objlist by nexthere field */ +#define AUTOSELECT_SINGLE 0x2 /* if only 1 object, don't ask */ +#define USE_INVLET 0x4 /* use object's invlet */ +#define INVORDER_SORT 0x8 /* 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 */ /* Flags to control query_category() */ /* BY_NEXTHERE used by query_category() too, so skip 0x01 */ #define UNPAID_TYPES 0x02 -#define GOLD_TYPES 0x04 -#define WORN_TYPES 0x08 -#define ALL_TYPES 0x10 +#define GOLD_TYPES 0x04 +#define WORN_TYPES 0x08 +#define ALL_TYPES 0x10 #define BILLED_TYPES 0x20 -#define CHOOSE_ALL 0x40 -#define BUC_BLESSED 0x80 -#define BUC_CURSED 0x100 +#define CHOOSE_ALL 0x40 +#define BUC_BLESSED 0x80 +#define BUC_CURSED 0x100 #define BUC_UNCURSED 0x200 -#define BUC_UNKNOWN 0x400 -#define BUC_ALLBKNOWN (BUC_BLESSED|BUC_CURSED|BUC_UNCURSED) +#define BUC_UNKNOWN 0x400 +#define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED) #define ALL_TYPES_SELECTED -2 /* Flags to control find_mid() */ -#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_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) /* Flags to control pick_[race,role,gend,align] routines in role.c */ -#define PICK_RANDOM 0 -#define PICK_RIGID 1 +#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 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 */ /* Flags to control test_move in hack.c */ -#define DO_MOVE 0 /* really doing the move */ -#define TEST_MOVE 1 /* test a normal move (move there next) */ -#define TEST_TRAV 2 /* test a future travel location */ +#define DO_MOVE 0 /* really doing the move */ +#define TEST_MOVE 1 /* test a normal move (move there next) */ +#define TEST_TRAV 2 /* test a future travel location */ /*** 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 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') /* Macros for scatter */ -#define VIS_EFFECTS 0x01 /* display visual effects */ -#define MAY_HITMON 0x02 /* objects may hit monsters */ -#define MAY_HITYOU 0x04 /* objects may hit you */ -#define MAY_HIT (MAY_HITMON|MAY_HITYOU) -#define MAY_DESTROY 0x08 /* objects may be destroyed at random */ -#define MAY_FRACTURE 0x10 /* boulders & statues may fracture */ +#define VIS_EFFECTS 0x01 /* display visual effects */ +#define MAY_HITMON 0x02 /* objects may hit monsters */ +#define MAY_HITYOU 0x04 /* objects may hit you */ +#define MAY_HIT (MAY_HITMON | MAY_HITYOU) +#define MAY_DESTROY 0x08 /* objects may be destroyed at random */ +#define MAY_FRACTURE 0x10 /* boulders & statues may fracture */ /* Macros for launching objects */ -#define ROLL 0x01 /* the object is rolling */ -#define FLING 0x02 /* the object is flying thru the air */ -#define LAUNCH_UNSEEN 0x40 /* hero neither caused nor saw it */ -#define LAUNCH_KNOWN 0x80 /* the hero caused this by explicit action */ +#define ROLL 0x01 /* the object is rolling */ +#define FLING 0x02 /* the object is flying thru 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 */ -#define EXPL_DARK 0 -#define EXPL_NOXIOUS 1 -#define EXPL_MUDDY 2 -#define EXPL_WET 3 -#define EXPL_MAGICAL 4 -#define EXPL_FIERY 5 -#define EXPL_FROSTY 6 -#define EXPL_MAX 7 +#define EXPL_DARK 0 +#define EXPL_NOXIOUS 1 +#define EXPL_MUDDY 2 +#define EXPL_WET 3 +#define EXPL_MAGICAL 4 +#define EXPL_FIERY 5 +#define EXPL_FROSTY 6 +#define EXPL_MAX 7 /* enlightenment control flags */ -#define BASICENLIGHTENMENT 1 /* show mundane stuff */ -#define MAGICENLIGHTENMENT 2 /* show intrinsics and such */ -#define ENL_GAMEINPROGRESS 0 -#define ENL_GAMEOVERALIVE 1 /* ascension, escape, quit, trickery */ -#define ENL_GAMEOVERDEAD 2 +#define BASICENLIGHTENMENT 1 /* show mundane stuff */ +#define MAGICENLIGHTENMENT 2 /* show intrinsics and such */ +#define ENL_GAMEINPROGRESS 0 +#define ENL_GAMEOVERALIVE 1 /* ascension, escape, quit, trickery */ +#define ENL_GAMEOVERDEAD 2 /* Macros for messages referring to hands, eyes, feet, etc... */ #define ARM 0 @@ -331,26 +340,26 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ #define STOMACH 18 /* indices for some special tin types */ -#define ROTTEN_TIN 0 -#define HOMEMADE_TIN 1 +#define ROTTEN_TIN 0 +#define HOMEMADE_TIN 1 #define SPINACH_TIN (-1) -#define RANDOM_TIN (-2) +#define RANDOM_TIN (-2) #define HEALTHY_TIN (-3) /* Some misc definitions */ -#define POTION_OCCUPANT_CHANCE(n) (13 + 2*(n)) +#define POTION_OCCUPANT_CHANCE(n) (13 + 2 * (n)) #define WAND_BACKFIRE_CHANCE 100 -#define BALL_IN_MON (u.uswallow && uball && uball->where == OBJ_FREE) +#define BALL_IN_MON (u.uswallow && uball && uball->where == OBJ_FREE) #define NODIAG(monnum) ((monnum) == PM_GRID_BUG) /* Flags to control menus */ #define MENUTYPELEN sizeof("traditional ") #define MENU_TRADITIONAL 0 #define MENU_COMBINATION 1 -#define MENU_PARTIAL 2 -#define MENU_FULL 3 +#define MENU_PARTIAL 2 +#define MENU_FULL 3 -#define MENU_SELECTED TRUE +#define MENU_SELECTED TRUE #define MENU_UNSELECTED FALSE /* @@ -359,66 +368,69 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ * 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__IS_VALUE_VALID(s) ( (s < SET_IN_SYS) || (s > SET_IN_GAME) ) - -#define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \ - ((unsigned long)minor << 16) | \ - ((unsigned long)patch << 8) | \ - ((unsigned long)0)) - -#define FEATURE_NOTICE_VER_MAJ (flags.suppress_alert >> 24) -#define FEATURE_NOTICE_VER_MIN (((unsigned long)(0x0000000000FF0000L & flags.suppress_alert)) >> 16) -#define FEATURE_NOTICE_VER_PATCH (((unsigned long)(0x000000000000FF00L & flags.suppress_alert)) >> 8) +#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__IS_VALUE_VALID(s) ((s < SET_IN_SYS) || (s > SET_IN_GAME)) + +#define FEATURE_NOTICE_VER(major, minor, patch) \ + (((unsigned long) major << 24) | ((unsigned long) minor << 16) \ + | ((unsigned long) patch << 8) | ((unsigned long) 0)) + +#define FEATURE_NOTICE_VER_MAJ (flags.suppress_alert >> 24) +#define FEATURE_NOTICE_VER_MIN \ + (((unsigned long) (0x0000000000FF0000L & flags.suppress_alert)) >> 16) +#define FEATURE_NOTICE_VER_PATCH \ + (((unsigned long) (0x000000000000FF00L & flags.suppress_alert)) >> 8) #ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) #endif #ifndef min -#define min(x,y) ((x) < (y) ? (x) : (y)) +#define min(x, y) ((x) < (y) ? (x) : (y)) #endif #define plur(x) (((x) == 1) ? "" : "s") -#define ARM_BONUS(obj) (objects[(obj)->otyp].a_ac + (obj)->spe \ - - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac)) +#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) +#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 rn1(x,y) (rn2(x)+(y)) +#define rn1(x, y) (rn2(x) + (y)) /* negative armor class is randomly weakened to prevent invulnerability */ -#define AC_VALUE(AC) ((AC) >= 0 ? (AC) : -rnd(-(AC))) +#define AC_VALUE(AC) ((AC) >= 0 ? (AC) : -rnd(-(AC))) #if defined(MICRO) && !defined(__DJGPP__) #define getuid() 1 -#define getlogin() ((char *)0) +#define getlogin() ((char *) 0) #endif /* MICRO */ #if defined(OVERLAY) -# define USE_OVLx -# define STATIC_DCL extern -# define STATIC_OVL -# define STATIC_VAR +#define USE_OVLx +#define STATIC_DCL extern +#define STATIC_OVL +#define STATIC_VAR -#else /* !OVERLAY */ +#else /* !OVERLAY */ -# define STATIC_DCL static -# define STATIC_OVL static -# define STATIC_VAR static +#define STATIC_DCL static +#define STATIC_OVL static +#define STATIC_VAR static -#endif /* OVERLAY */ +#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 +#define STATIC_PTR #else -# define STATIC_PTR static +#define STATIC_PTR static #endif /* The function argument to qsort() requires a particular @@ -426,12 +438,12 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ * in that environment. */ #if defined(WIN_CE) -# define CFDECLSPEC __cdecl +#define CFDECLSPEC __cdecl #else -# define CFDECLSPEC +#define CFDECLSPEC #endif #define DEVTEAM_EMAIL "devteam@nethack.org" -#define DEVTEAM_URL "http://www.nethack.org" - +#define DEVTEAM_URL "http://www.nethack.org" + #endif /* HACK_H */ diff --git a/include/lev.h b/include/lev.h index ad4a9565d..5069d0b3a 100644 --- a/include/lev.h +++ b/include/lev.h @@ -9,45 +9,45 @@ #ifndef LEV_H #define LEV_H -#define COUNT_SAVE 0x1 -#define WRITE_SAVE 0x2 -#define FREE_SAVE 0x4 +#define COUNT_SAVE 0x1 +#define WRITE_SAVE 0x2 +#define FREE_SAVE 0x4 -#define MAX_BMASK 4 +#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) +#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; + struct container *next; + xchar x, y; + short what; + genericptr_t list; }; -#define CONS_OBJ 0 -#define CONS_MON 1 -#define CONS_HERO 2 -#define CONS_TRAP 3 +#define CONS_OBJ 0 +#define CONS_MON 1 +#define CONS_HERO 2 +#define CONS_TRAP 3 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; + 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 */ + 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 */ + short type; /* type of light source */ + anything id; /* source's identifier */ } light_source; #endif /* LEV_H */ diff --git a/include/lint.h b/include/lint.h index bf1255c71..8fb79b4a9 100644 --- a/include/lint.h +++ b/include/lint.h @@ -12,20 +12,20 @@ /* cast away implicit const from a string literal (caller's responsibility to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings' (also caller's responsibility to ensure it isn't actually modified!) */ -#define nhStr(str) ((char *)str) +#define nhStr(str) ((char *) str) #if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE) -# define 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; +#define nhUse(arg) nhUse_dummy += (unsigned) arg; extern unsigned nhUse_dummy; #else -# define nhUse(arg) /*empty*/ +#define nhUse(arg) /*empty*/ #endif /* @@ -34,34 +34,43 @@ extern unsigned nhUse_dummy; */ /* [DEBUG shouldn't be defined unless you know what you're doing...] */ #ifdef DEBUG -# define showdebug(file) debugcore(file, TRUE) -# define explicitdebug(file) debugcore(file, FALSE) -# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } 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"); } while (0) -# define debugpline0(str) crtdebug(_RPT0(_CRT_WARN,str)) -# define debugpline1(fmt,arg) crtdebug(_RPT1(_CRT_WARN,fmt,arg)) -# define debugpline2(fmt,a1,a2) crtdebug(_RPT2(_CRT_WARN,fmt,a1,a2)) -# define debugpline3(fmt,a1,a2,a3) crtdebug(_RPT3(_CRT_WARN,fmt,a1,a2,a3)) -# define debugpline4(fmt,a1,a2,a3,a4) crtdebug(_RPT4(_CRT_WARN,fmt,a1,a2,a3,a4)) -# else +#define showdebug(file) debugcore(file, TRUE) +#define explicitdebug(file) debugcore(file, FALSE) +#define ifdebug(stmt) \ + do { \ + if (showdebug(__FILE__)) \ + stmt; \ + } 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"); \ + } while (0) +#define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str)) +#define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg)) +#define debugpline2(fmt, a1, a2) crtdebug(_RPT2(_CRT_WARN, fmt, a1, a2)) +#define debugpline3(fmt, a1, a2, a3) \ + crtdebug(_RPT3(_CRT_WARN, fmt, a1, a2, a3)) +#define debugpline4(fmt, a1, a2, a3, a4) \ + crtdebug(_RPT4(_CRT_WARN, fmt, a1, a2, a3, a4)) +#else /* these don't require compiler support for C99 variadic macros */ -# define debugpline0(str) ifdebug(pline(str)) -# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg)) -# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2)) -# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3)) -# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4)) -# endif +#define debugpline0(str) ifdebug(pline(str)) +#define debugpline1(fmt, arg) ifdebug(pline(fmt, arg)) +#define debugpline2(fmt, a1, a2) ifdebug(pline(fmt, a1, a2)) +#define debugpline3(fmt, a1, a2, a3) ifdebug(pline(fmt, a1, a2, a3)) +#define debugpline4(fmt, a1, a2, a3, a4) ifdebug(pline(fmt, a1, a2, a3, a4)) +#endif #else -# define debugpline0(str) /*empty*/ -# define debugpline1(fmt,arg) /*empty*/ -# define debugpline2(fmt,a1,a2) /*empty*/ -# define debugpline3(fmt,a1,a2,a3) /*empty*/ -# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/ -#endif /*DEBUG*/ +#define debugpline0(str) /*empty*/ +#define debugpline1(fmt, arg) /*empty*/ +#define debugpline2(fmt, a1, a2) /*empty*/ +#define debugpline3(fmt, a1, a2, a3) /*empty*/ +#define debugpline4(fmt, a1, a2, a3, a4) /*empty*/ +#endif /*DEBUG*/ #endif /* LINT_H */ - diff --git a/include/load_img.h b/include/load_img.h index eb4a27db5..a6511832c 100644 --- a/include/load_img.h +++ b/include/load_img.h @@ -1,39 +1,40 @@ /* ------------------------------------------- */ -#define XIMG 0x58494D47 +#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 */ +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 +#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); +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 ); +/* 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 *); @@ -43,4 +44,4 @@ int transform_img(MFDB *); int depack_img(char *, IMG_header *); /* Halves IMG in Device-format, dest memory has to be allocated*/ -int half_img(MFDB *,MFDB *); +int half_img(MFDB *, MFDB *); diff --git a/include/mac-carbon.h b/include/mac-carbon.h index 5c14e437f..63def524f 100644 --- a/include/mac-carbon.h +++ b/include/mac-carbon.h @@ -27,7 +27,7 @@ /* May already be defined by CodeWarrior as 0 or 1 */ #ifdef TARGET_API_MAC_CARBON -# undef TARGET_API_MAC_CARBON +#undef TARGET_API_MAC_CARBON #endif #define TARGET_API_MAC_CARBON 1 diff --git a/include/mac-qt.h b/include/mac-qt.h index a37ba554f..6fa229075 100644 --- a/include/mac-qt.h +++ b/include/mac-qt.h @@ -28,7 +28,7 @@ /* May already be defined by CodeWarrior as 0 or 1 */ #ifdef TARGET_API_MAC_CARBON -# undef TARGET_API_MAC_CARBON +#undef TARGET_API_MAC_CARBON #endif #define TARGET_API_MAC_CARBON 0 diff --git a/include/mac-term.h b/include/mac-term.h index 9de54f1a0..9a6c1bfc4 100644 --- a/include/mac-term.h +++ b/include/mac-term.h @@ -26,11 +26,11 @@ #undef MAC #define UNIX #define BSD -#define __FreeBSD__ /* Darwin is based on FreeBSD */ +#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 +#undef TARGET_API_MAC_CARBON #endif -#define TARGET_API_MAC_CARBON 0 /* Not Carbon */ +#define TARGET_API_MAC_CARBON 0 /* Not Carbon */ diff --git a/include/macconf.h b/include/macconf.h index 5d7d9c1fa..970cc5f23 100644 --- a/include/macconf.h +++ b/include/macconf.h @@ -5,8 +5,8 @@ /* NetHack may be freely redistributed. See license for details. */ #ifdef MAC -# ifndef MACCONF_H -# define MACCONF_H +#ifndef MACCONF_H +#define MACCONF_H /* * Compiler selection is based on the following symbols: @@ -25,21 +25,20 @@ */ #ifndef __powerc -# define MAC68K /* 68K mac (non-powerpc) */ +#define MAC68K /* 68K mac (non-powerpc) */ #endif #ifndef TARGET_API_MAC_CARBON -# define TARGET_API_MAC_CARBON 0 +#define TARGET_API_MAC_CARBON 0 #endif - #ifndef __MACH__ #define RANDOM #endif -#define NO_SIGNAL /* You wouldn't believe our signals ... */ +#define NO_SIGNAL /* You wouldn't believe our signals ... */ #define FILENAME 256 -#define NO_TERMS /* For tty port (see wintty.h) */ +#define NO_TERMS /* For tty port (see wintty.h) */ -#define TEXTCOLOR /* For Mac TTY interface */ +#define TEXTCOLOR /* For Mac TTY interface */ #define CHANGE_COLOR /* Use these two includes instead of system.h. */ @@ -48,25 +47,25 @@ /* Uncomment this line if your headers don't already define off_t */ /*typedef long off_t;*/ -#include /* for time_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 +#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 +#include #endif /* @@ -79,42 +78,44 @@ #define rindex strrchr #define Rand random -extern void error(const char *,...); +extern void error(const char *, ...); #if !defined(O_WRONLY) -# if defined(__MWERKS__) && !TARGET_API_MAC_CARBON -# include -# endif -# include +#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. + * 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 +#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 +#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 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. @@ -124,5 +125,5 @@ extern void error(const char *,...); #define MAC_GRAPHICS_ENV -# endif /* ! MACCONF_H */ +#endif /* ! MACCONF_H */ #endif /* MAC */ diff --git a/include/macpopup.h b/include/macpopup.h index 85aaacdd4..cc86ba2f9 100644 --- a/include/macpopup.h +++ b/include/macpopup.h @@ -5,7 +5,7 @@ /* NetHack may be freely redistributed. See license for details. */ #ifndef MACPOPUP_H -# define MACPOPUP_H +#define MACPOPUP_H /* ### mmodal.c ### */ diff --git a/include/mactty.h b/include/mactty.h index 30524f75d..ac9f3e66c 100644 --- a/include/mactty.h +++ b/include/mactty.h @@ -42,12 +42,12 @@ */ #ifndef _H_tty_public -# define _H_tty_public -#undef red /* undef internal color const strings from decl */ +#define _H_tty_public +#undef red /* undef internal color const strings from decl */ #undef green #undef blue #if 1 /*!TARGET_API_MAC_CARBON*/ -# include +#include #endif /* @@ -65,22 +65,23 @@ /* * 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 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 @@ -91,104 +92,106 @@ extern char game_active; /* flag to window rendering routines not to use ppat */ 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 , + /* + * 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 +#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 +#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 +#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 +#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 , +#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 +#define TA_BLINKING_CURSOR 1L /* * When handling input, do we echo characters as they are typed? */ -# define TA_ECHO_INPUT 2L +#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 +#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 +#define TA_RAW_OUTPUT 8L /* * When getting a NL, do we also move to the left? */ -# define TA_NL_ADD_CR 16L +#define TA_NL_ADD_CR 16L /* * When getting a CR, do we also move down? */ -# define TA_CR_ADD_NL 32L +#define TA_CR_ADD_NL 32L /* * Wait for input or return what we've got? */ -# define TA_NONBLOCKING_IO 64L +#define TA_NONBLOCKING_IO 64L /* - * Use this macro to cast a function pointer to a tty attribute; this will help + * 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)) +#define TA_ATTRIB_FUNC(x) ((long) (x)) -/* - * This symbolic constant is used to check the number of attributes - */ - TTY_NUMBER_ATTRIBUTES + /* + * This symbolic constant is used to check the number of attributes + */ + TTY_NUMBER_ATTRIBUTES -} tty_attrib ; +} tty_attrib; /* * Character returned by end-of-file condition */ -# define TTY_EOF -1 - +#define TTY_EOF -1 /* * Create the window according to a resource WIND template. @@ -201,21 +204,21 @@ typedef enum tty_attrib { * crash. Not passing in_color means everything's rendered in * black & white. */ -extern short create_tty ( WindowPtr * window , short resource_id , - Boolean in_color ) ; +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 ) ; +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 ) ; +extern short destroy_tty(WindowPtr window); /* * Change the font and font size used in the window for drawing after @@ -223,48 +226,45 @@ extern short destroy_tty ( WindowPtr window ) ; * 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 ) ; +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 ) ; +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 ) ; +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 ) ; +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 ) ; +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 ) ; +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 ) ; +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 @@ -272,56 +272,58 @@ extern short set_tty_attrib ( WindowPtr window , tty_attrib attrib , * directly, regardless of the wait-update setting. Does updates before * scrolling. */ -extern short scroll_tty ( WindowPtr window , short delta_x , - short delta_y ) ; +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 ) ; +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 ) ; +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 + * 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 ) ; +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 ) ; +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); - +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 (); +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 + * 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 ) ; +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. @@ -329,20 +331,21 @@ extern short mangle_tty_rows_columns ( WindowPtr window , * 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 ) ; +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 ) ; +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 ) ; +extern short draw_tty_line(WindowPtr window, short from_x, short from_y, + short to_x, short to_y); #endif /* EXTENDED_SUPPORT */ diff --git a/include/macwin.h b/include/macwin.h index d79bfd7c1..d16781865 100644 --- a/include/macwin.h +++ b/include/macwin.h @@ -5,8 +5,8 @@ /* NetHack may be freely redistributed. See license for details. */ #ifndef MACWIN_H -# define MACWIN_H -#undef red /* undef internal color const strings from decl */ +#define MACWIN_H +#undef red /* undef internal color const strings from decl */ #undef green #undef blue @@ -17,17 +17,17 @@ /* more headers */ #ifdef THINK_C -#include /* for CtoPStr and PtoCStr */ +#include /* for CtoPStr and PtoCStr */ #endif /* resources */ -#define PLAYER_NAME_RES_ID 1001 +#define PLAYER_NAME_RES_ID 1001 /* fake some things if we don't have universal headers.. */ -#if 0 /*ndef NewUserItemProc*/ +#if 0 /*ndef NewUserItemProc*/ typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo); typedef UserItemProcPtr UserItemUPP; -#define NewUserItemProc(p) (UserItemUPP)(p) +#define NewUserItemProc(p) (UserItemUPP)(p) typedef pascal void (*ControlActionProcPtr)(ControlHandle theControl, short partCode); typedef ControlActionProcPtr ControlActionUPP; @@ -39,41 +39,41 @@ typedef ModalFilterProcPtr ModalFilterUPP; /* misc */ #ifdef __MWERKS__ -# define ResumeProcPtr long /* for call to InitDialogs */ +#define ResumeProcPtr long /* for call to InitDialogs */ #endif /* working dirs structure */ typedef struct macdirs { - Str32 dataName; - short dataRefNum; - long dataDirID; + Str32 dataName; + short dataRefNum; + long dataDirID; - Str32 saveName; - short saveRefNum; - long saveDirID; + Str32 saveName; + short saveRefNum; + long saveDirID; - Str32 levelName; - short levelRefNum; - long levelDirID; + 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); + 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 MacDirs theDirs; /* used in macfile.c */ extern MacFlags macFlags; /* @@ -99,60 +99,58 @@ extern MacFlags macFlags; #define MIN_RIGHT 350 typedef struct { - anything id; - char accelerator; - char groupAcc; - short line; + 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; + 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 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. */ @@ -161,23 +159,23 @@ extern winid BASE_WINDOW, WIN_MAP, WIN_MESSAGE, WIN_INVEN, WIN_STATUS; /* ### dprintf.c ### */ -extern void dprintf (char *, ...); +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 *)); +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 void showerror(char *, const char *); extern Boolean itworked(short); extern void mustwork(short); extern void attemptingto(char *); -/* appear to be unused +/* appear to be unused extern void comment(char *,long); extern void pushattemptingto(char *); extern void popattempt(void); @@ -185,12 +183,12 @@ 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)); +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 DoMenuEvt(long); extern void InitMenuRes(void); extern void AdjustMenus(short); #define DimMenuBar() AdjustMenus(1) @@ -198,20 +196,21 @@ extern void AdjustMenus(short); /* ### macmain.c ### */ -extern void FDECL (process_openfile, (short s_vol, long s_dir, Str255 fNm, OSType ft)); +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 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; @@ -224,11 +223,11 @@ 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_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_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 @@ -238,7 +237,7 @@ 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 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); diff --git a/include/mail.h b/include/mail.h index 4b59c96b2..24dd6bd02 100644 --- a/include/mail.h +++ b/include/mail.h @@ -3,20 +3,21 @@ /* SCCS Id: @(#)mail.h 3.5 1991/10/11 */ /* NetHack may be freely redistributed. See license for details. */ -/* used by ckmailstatus() to pass information to the mail-daemon in newmail() */ +/* used by ckmailstatus() to pass information to the mail-daemon in newmail() + */ #ifndef MAIL_H #define MAIL_H -#define MSG_OTHER 0 /* catch-all; none of the below... */ -#define MSG_MAIL 1 /* unimportant, uninteresting mail message */ -#define MSG_CALL 2 /* annoying phone/talk/chat-type interruption */ +#define MSG_OTHER 0 /* catch-all; none of the below... */ +#define MSG_MAIL 1 /* unimportant, uninteresting mail message */ +#define MSG_CALL 2 /* annoying phone/talk/chat-type interruption */ struct mail_info { - int message_typ; /* MSG_foo value */ - const char *display_txt; /* text for daemon to verbalize */ - const char *object_nam; /* text to tag object with */ - const char *response_cmd; /* command to eventually execute */ + int message_typ; /* MSG_foo value */ + const char *display_txt; /* text for daemon to verbalize */ + const char *object_nam; /* text to tag object with */ + const char *response_cmd; /* command to eventually execute */ }; #endif /* MAIL_H */ diff --git a/include/mextra.h b/include/mextra.h index 47986a2da..1c4c42a82 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -15,16 +15,19 @@ * * 1. Add the structure definition and any required macros in this file * above the mextra struct. - * 2. Add a pointer to your new struct to the mextra struct in this file. - * 3. Add a referencing macro at the bottom of this file after the mextra + * 2. Add a pointer to your new struct to the mextra struct in this + *file. + * 3. Add a referencing macro at the 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) function + * 4. 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(mtmp) * struct monst *mtmp; @@ -36,8 +39,9 @@ * 0, sizeof(struct XX)); * } * } - * - * 5. Consider adding a new makemon flag MM_XX flag to include/hack.h and + * + * 5. 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(). @@ -55,43 +59,43 @@ * 10. Adjust savemon() in src/save.c to deal with your * struct or data during a save. */ - + /*** ** formerly vault.h -- vault guard extension */ -#define FCSIZ (ROWNO+COLNO) -#define GD_EATGOLD 0x01 -#define GD_DESTROYGOLD 0x02 +#define FCSIZ (ROWNO + COLNO) +#define GD_EATGOLD 0x01 +#define GD_DESTROYGOLD 0x02 struct fakecorridor { - xchar fx, fy, ftyp; + xchar fx, fy, ftyp; }; struct egd { - 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 */ - d_level gdlevel; /* level (& dungeon) guard was created in */ - xchar warncnt; /* number of warnings to follow */ - Bitfield(gddone,1); /* true iff guard has released player */ - Bitfield(witness,2); /* the guard saw you do something */ - Bitfield(unused,5); - struct fakecorridor fakecorr[FCSIZ]; + 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 */ + d_level gdlevel; /* level (& dungeon) guard was created in */ + xchar warncnt; /* number of warnings to follow */ + Bitfield(gddone, 1); /* true iff guard has released player */ + Bitfield(witness, 2); /* the guard saw you do something */ + Bitfield(unused, 5); + struct fakecorridor fakecorr[FCSIZ]; }; /*** ** formerly epri.h -- temple priest extension */ struct epri { - aligntyp shralign; /* alignment of priest's shrine */ - schar shroom; /* index in rooms */ - coord shrpos; /* position of shrine */ - d_level shrlevel; /* level (& dungeon) of shrine */ - long intone_time, /* used to limit verbosity +*/ - enter_time, /*+ of temple entry messages */ - hostile_time, /* forbidding feeling */ - peaceful_time; /* sense of peace */ + aligntyp shralign; /* alignment of priest's shrine */ + schar shroom; /* index in rooms */ + coord shrpos; /* position of shrine */ + d_level shrlevel; /* level (& dungeon) of shrine */ + long intone_time, /* used to limit verbosity +*/ + enter_time, /*+ of temple entry messages */ + hostile_time, /* forbidding feeling */ + peaceful_time; /* sense of peace */ }; /* note: roaming priests (no shrine) switch from ispriest to isminion (and emin extension) */ @@ -99,44 +103,44 @@ struct epri { /*** ** formerly eshk.h -- shopkeeper extension */ -#define REPAIR_DELAY 5 /* minimum delay between shop damage & repair */ -#define BILLSZ 200 +#define REPAIR_DELAY 5 /* minimum delay between shop damage & repair */ +#define BILLSZ 200 struct bill_x { - unsigned bo_id; - boolean useup; - long price; /* price per unit */ - long bquan; /* amount used up */ + unsigned bo_id; + boolean useup; + long price; /* price per unit */ + long bquan; /* amount used up */ }; struct eshk { - 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() */ - schar unused; /* to force alignment for stupid compilers */ - boolean following; /* following customer since he owes us sth */ - boolean surcharge; /* angry shk inflates prices */ - boolean dismiss_kops; /* pacified shk sends kops away */ - coord shk; /* usual position shopkeeper */ - coord shd; /* position shop door */ - 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; - int visitct; /* nr of visits by most recent customer */ - char customer[PL_NSIZ]; /* most recent customer */ - char shknam[PL_NSIZ]; + 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() */ + schar unused; /* to force alignment for stupid compilers */ + boolean following; /* following customer since he owes us sth */ + boolean surcharge; /* angry shk inflates prices */ + boolean dismiss_kops; /* pacified shk sends kops away */ + coord shk; /* usual position shopkeeper */ + coord shd; /* position shop door */ + 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; + int visitct; /* nr of visits by most recent customer */ + char customer[PL_NSIZ]; /* most recent customer */ + char shknam[PL_NSIZ]; }; /*** ** formerly emin.h -- minion extension */ struct emin { - aligntyp min_align; /* alignment of minion */ - boolean renegade; /* hostile co-aligned priest or Angel */ + aligntyp min_align; /* alignment of minion */ + boolean renegade; /* hostile co-aligned priest or Angel */ }; /*** @@ -147,46 +151,46 @@ struct emin { #define CADAVER 1 #define ACCFOOD 2 #define MANFOOD 3 -#define APPORT 4 -#define POISON 5 -#define UNDEF 6 -#define TABU 7 +#define APPORT 4 +#define POISON 5 +#define UNDEF 6 +#define TABU 7 struct edog { - long droptime; /* moment dog dropped object */ - unsigned dropdist; /* dist of drpped obj from @ */ - int apport; /* amount of training */ - long whistletime; /* last time he whistled */ - long hungrytime; /* will get hungry at this time */ - coord ogoal; /* previous goal location */ - int abuse; /* track abuses to this pet */ - int revivals; /* count pet deaths */ - int mhpmax_penalty; /* while starving, points reduced */ - Bitfield(killed_by_u, 1); /* you attempted to kill him */ + long droptime; /* moment dog dropped object */ + unsigned dropdist; /* dist of drpped obj from @ */ + int apport; /* amount of training */ + long whistletime; /* last time he whistled */ + long hungrytime; /* will get hungry at this time */ + coord ogoal; /* previous goal location */ + int abuse; /* track abuses to this pet */ + int revivals; /* count pet deaths */ + int mhpmax_penalty; /* while starving, points reduced */ + Bitfield(killed_by_u, 1); /* you attempted to kill him */ }; /*** ** mextra.h -- collection of all monster extensions */ struct mextra { - char *mname; - struct egd *egd; - struct epri *epri; - struct eshk *eshk; - struct emin *emin; - struct edog *edog; - int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse */ + char *mname; + struct egd *egd; + struct epri *epri; + struct eshk *eshk; + struct emin *emin; + struct edog *edog; + int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse */ }; -#define MNAME(mon) ((mon)->mextra->mname) -#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 MCORPSENM(mon) ((mon)->mextra->mcorpsenm) +#define MNAME(mon) ((mon)->mextra->mname) +#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 MCORPSENM(mon) ((mon)->mextra->mcorpsenm) -#define has_mname(mon) ((mon)->mextra && MNAME(mon)) +#define has_mname(mon) ((mon)->mextra && MNAME(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 93319789b..340c7ce72 100644 --- a/include/mfndpos.h +++ b/include/mfndpos.h @@ -7,26 +7,26 @@ #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 */ -#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 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 */ #ifdef NHSTDC -#define NOGARLIC 0x80000000UL /* hates garlic */ +#define NOGARLIC 0x80000000UL /* hates garlic */ #else -#define NOGARLIC 0x80000000L /* hates garlic */ +#define NOGARLIC 0x80000000L /* hates garlic */ #endif #endif /* MFNDPOS_H */ diff --git a/include/micro.h b/include/micro.h index b8a0f77f8..591b261d4 100644 --- a/include/micro.h +++ b/include/micro.h @@ -13,10 +13,10 @@ extern char levels[], bones[], permbones[], hackdir[]; extern int ramdisk; #ifndef C -#define C(c) (0x1f & (c)) +#define C(c) (0x1f & (c)) #endif #ifndef M -#define M(c) (((char)0x80) | (c)) +#define M(c) (((char) 0x80) | (c)) #endif #define ABORT C('a') diff --git a/include/mkroom.h b/include/mkroom.h index dc27ac131..4e3a51b51 100644 --- a/include/mkroom.h +++ b/include/mkroom.h @@ -9,37 +9,37 @@ /* mkroom.h - types and structures for room and shop initialization */ struct mkroom { - schar lx,hx,ly,hy; /* usually xchar, 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 */ - schar doorct; /* door count */ - schar fdoor; /* index for the first door of the room */ - schar nsubrooms; /* number of subrooms */ - boolean irregular; /* true if room is non-rectangular */ - struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */ - struct monst *resident; /* priest/shopkeeper/guard for this room */ + schar lx, hx, ly, hy; /* usually xchar, 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 */ + schar doorct; /* door count */ + schar fdoor; /* index for the first door of the room */ + schar nsubrooms; /* number of subrooms */ + boolean irregular; /* true if room is non-rectangular */ + 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 */ - char symb; /* this identifies the shop type */ - int prob; /* the shop type probability in % */ - schar shdist; /* object placement type */ -#define D_SCATTER 0 /* normal placement */ -#define D_SHOP 1 /* shop-like placement */ -#define D_TEMPLE 2 /* temple-like placement */ - struct itp { - int iprob; /* probability of an item type */ - int itype; /* item type: if >=0 a class, if < 0 a specific item */ - } iprobs[6]; - const char * const *shknms; /* list of shopkeeper names for this type */ + const char *name; /* name of the shop type */ + char symb; /* this identifies the shop type */ + int prob; /* the shop type probability in % */ + schar shdist; /* object placement type */ +#define D_SCATTER 0 /* normal placement */ +#define D_SHOP 1 /* shop-like placement */ +#define D_TEMPLE 2 /* temple-like placement */ + struct itp { + int iprob; /* probability of an item type */ + int itype; /* item type: if >=0 a class, if < 0 a specific item */ + } iprobs[6]; + const char *const *shknms; /* list of shopkeeper names for this type */ }; -extern NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2]; -extern NEARDATA struct mkroom* subrooms; +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 * some n= rooms && (x) < 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_ROOM_PTR(x) ((x) >= rooms && (x) < 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) #endif /* MKROOM_H */ diff --git a/include/monattk.h b/include/monattk.h index f415fe00d..1a85c132c 100644 --- a/include/monattk.h +++ b/include/monattk.h @@ -10,92 +10,91 @@ /* 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) */ -#define AT_CLAW 1 /* claw (punch, hit, etc.) */ -#define AT_BITE 2 /* bite */ -#define AT_KICK 3 /* kick */ -#define AT_BUTT 4 /* head butt (ex. a unicorn) */ -#define AT_TUCH 5 /* touches */ -#define AT_STNG 6 /* sting */ -#define AT_HUGS 7 /* crushing bearhug */ -#define AT_SPIT 10 /* spits substance - ranged */ -#define AT_ENGL 11 /* engulf (swallow or by a cloud) */ -#define AT_BREA 12 /* breath - ranged */ -#define AT_EXPL 13 /* explodes - proximity */ -#define AT_BOOM 14 /* explodes when killed */ -#define AT_GAZE 15 /* gaze - ranged */ -#define AT_TENT 16 /* tentacles */ +#define AT_ANY (-1) /* fake attack; dmgtype_fromattack wildcard */ +#define AT_NONE 0 /* passive monster (ex. acid blob) */ +#define AT_CLAW 1 /* claw (punch, hit, etc.) */ +#define AT_BITE 2 /* bite */ +#define AT_KICK 3 /* kick */ +#define AT_BUTT 4 /* head butt (ex. a unicorn) */ +#define AT_TUCH 5 /* touches */ +#define AT_STNG 6 /* sting */ +#define AT_HUGS 7 /* crushing bearhug */ +#define AT_SPIT 10 /* spits substance - ranged */ +#define AT_ENGL 11 /* engulf (swallow or by a cloud) */ +#define AT_BREA 12 /* breath - ranged */ +#define AT_EXPL 13 /* explodes - proximity */ +#define AT_BOOM 14 /* explodes when killed */ +#define AT_GAZE 15 /* gaze - ranged */ +#define AT_TENT 16 /* tentacles */ -#define AT_WEAP 254 /* uses weapon */ -#define AT_MAGC 255 /* uses magic spell(s) */ +#define AT_WEAP 254 /* uses weapon */ +#define AT_MAGC 255 /* uses magic spell(s) */ /* 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. */ -#define AD_ANY (-1) /* fake damage; attacktype_fordmg wildcard */ -#define AD_PHYS 0 /* ordinary physical */ -#define AD_MAGM 1 /* magic missiles */ -#define AD_FIRE 2 /* fire damage */ -#define AD_COLD 3 /* frost damage */ -#define AD_SLEE 4 /* sleep ray */ -#define AD_DISN 5 /* disintegration (death ray) */ -#define AD_ELEC 6 /* shock damage */ -#define AD_DRST 7 /* drains str (poison) */ -#define AD_ACID 8 /* acid damage */ -#define AD_SPC1 9 /* for extension of buzz() */ -#define AD_SPC2 10 /* for extension of buzz() */ -#define AD_BLND 11 /* blinds (yellow light) */ -#define AD_STUN 12 /* stuns */ -#define AD_SLOW 13 /* slows */ -#define AD_PLYS 14 /* paralyses */ -#define AD_DRLI 15 /* drains life levels (Vampire) */ -#define AD_DREN 16 /* drains magic energy */ -#define AD_LEGS 17 /* damages legs (xan) */ -#define AD_STON 18 /* petrifies (Medusa, cockatrice) */ -#define AD_STCK 19 /* sticks to you (mimic) */ -#define AD_SGLD 20 /* steals gold (leppie) */ -#define AD_SITM 21 /* steals item (nymphs) */ -#define AD_SEDU 22 /* seduces & steals multiple items */ -#define AD_TLPT 23 /* teleports you (Quantum Mech.) */ -#define AD_RUST 24 /* rusts armour (Rust Monster)*/ -#define AD_CONF 25 /* confuses (Umber Hulk) */ -#define AD_DGST 26 /* digests opponent (trapper, etc.) */ -#define AD_HEAL 27 /* heals opponent's wounds (nurse) */ -#define AD_WRAP 28 /* special "stick" for eels */ -#define AD_WERE 29 /* confers lycanthropy */ -#define AD_DRDX 30 /* drains dexterity (quasit) */ -#define AD_DRCO 31 /* drains constitution */ -#define AD_DRIN 32 /* drains intelligence (mind flayer) */ -#define AD_DISE 33 /* confers diseases */ -#define AD_DCAY 34 /* decays organics (brown Pudding) */ -#define AD_SSEX 35 /* Succubus seduction (extended) */ -#define AD_HALU 36 /* causes hallucination */ -#define AD_DETH 37 /* for Death only */ -#define AD_PEST 38 /* for Pestilence only */ -#define AD_FAMN 39 /* for Famine only */ -#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_ANY (-1) /* fake damage; attacktype_fordmg wildcard */ +#define AD_PHYS 0 /* ordinary physical */ +#define AD_MAGM 1 /* magic missiles */ +#define AD_FIRE 2 /* fire damage */ +#define AD_COLD 3 /* frost damage */ +#define AD_SLEE 4 /* sleep ray */ +#define AD_DISN 5 /* disintegration (death ray) */ +#define AD_ELEC 6 /* shock damage */ +#define AD_DRST 7 /* drains str (poison) */ +#define AD_ACID 8 /* acid damage */ +#define AD_SPC1 9 /* for extension of buzz() */ +#define AD_SPC2 10 /* for extension of buzz() */ +#define AD_BLND 11 /* blinds (yellow light) */ +#define AD_STUN 12 /* stuns */ +#define AD_SLOW 13 /* slows */ +#define AD_PLYS 14 /* paralyses */ +#define AD_DRLI 15 /* drains life levels (Vampire) */ +#define AD_DREN 16 /* drains magic energy */ +#define AD_LEGS 17 /* damages legs (xan) */ +#define AD_STON 18 /* petrifies (Medusa, cockatrice) */ +#define AD_STCK 19 /* sticks to you (mimic) */ +#define AD_SGLD 20 /* steals gold (leppie) */ +#define AD_SITM 21 /* steals item (nymphs) */ +#define AD_SEDU 22 /* seduces & steals multiple items */ +#define AD_TLPT 23 /* teleports you (Quantum Mech.) */ +#define AD_RUST 24 /* rusts armour (Rust Monster)*/ +#define AD_CONF 25 /* confuses (Umber Hulk) */ +#define AD_DGST 26 /* digests opponent (trapper, etc.) */ +#define AD_HEAL 27 /* heals opponent's wounds (nurse) */ +#define AD_WRAP 28 /* special "stick" for eels */ +#define AD_WERE 29 /* confers lycanthropy */ +#define AD_DRDX 30 /* drains dexterity (quasit) */ +#define AD_DRCO 31 /* drains constitution */ +#define AD_DRIN 32 /* drains intelligence (mind flayer) */ +#define AD_DISE 33 /* confers diseases */ +#define AD_DCAY 34 /* decays organics (brown Pudding) */ +#define AD_SSEX 35 /* Succubus seduction (extended) */ +#define AD_HALU 36 /* causes hallucination */ +#define AD_DETH 37 /* for Death only */ +#define AD_PEST 38 /* for Pestilence only */ +#define AD_FAMN 39 /* for Famine only */ +#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_CLRC 240 /* random clerical spell */ -#define AD_SPEL 241 /* random magic spell */ -#define AD_RBRE 242 /* random breath weapon */ - -#define AD_SAMU 252 /* hits, may steal Amulet (Wizard) */ -#define AD_CURS 253 /* random curse (ex. gremlin) */ +#define AD_CLRC 240 /* random clerical spell */ +#define AD_SPEL 241 /* random magic spell */ +#define AD_RBRE 242 /* random breath weapon */ +#define AD_SAMU 252 /* hits, may steal Amulet (Wizard) */ +#define AD_CURS 253 /* random curse (ex. gremlin) */ /* * 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 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 */ #endif /* MONATTK_H */ diff --git a/include/mondata.h b/include/mondata.h index e879cd810..d81baa091 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -7,198 +7,195 @@ #ifndef MONDATA_H #define MONDATA_H -#define verysmall(ptr) ((ptr)->msize < MZ_SMALL) -#define bigmonst(ptr) ((ptr)->msize >= MZ_LARGE) +#define verysmall(ptr) ((ptr)->msize < MZ_SMALL) +#define bigmonst(ptr) ((ptr)->msize >= MZ_LARGE) -#define pm_resistance(ptr,typ) (((ptr)->mresists & (typ)) != 0) +#define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0) -#define resists_fire(mon) (((mon)->mintrinsics & MR_FIRE) != 0) -#define resists_cold(mon) (((mon)->mintrinsics & MR_COLD) != 0) -#define resists_sleep(mon) (((mon)->mintrinsics & MR_SLEEP) != 0) -#define resists_disint(mon) (((mon)->mintrinsics & MR_DISINT) != 0) -#define resists_elec(mon) (((mon)->mintrinsics & MR_ELEC) != 0) -#define resists_poison(mon) (((mon)->mintrinsics & MR_POISON) != 0) -#define resists_acid(mon) (((mon)->mintrinsics & MR_ACID) != 0) -#define resists_ston(mon) (((mon)->mintrinsics & MR_STONE) != 0) +#define resists_fire(mon) (((mon)->mintrinsics & MR_FIRE) != 0) +#define resists_cold(mon) (((mon)->mintrinsics & MR_COLD) != 0) +#define resists_sleep(mon) (((mon)->mintrinsics & MR_SLEEP) != 0) +#define resists_disint(mon) (((mon)->mintrinsics & MR_DISINT) != 0) +#define resists_elec(mon) (((mon)->mintrinsics & MR_ELEC) != 0) +#define resists_poison(mon) (((mon)->mintrinsics & MR_POISON) != 0) +#define resists_acid(mon) (((mon)->mintrinsics & MR_ACID) != 0) +#define resists_ston(mon) (((mon)->mintrinsics & MR_STONE) != 0) -#define is_lminion(mon) (is_minion((mon)->data) && \ - mon_aligntyp(mon) == A_LAWFUL) -#define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L) -#define is_floater(ptr) ((ptr)->mlet == S_EYE) -#define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L) -#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 passes_walls(ptr) (((ptr)->mflags1 & M1_WALLWALK) != 0L) -#define amorphous(ptr) (((ptr)->mflags1 & M1_AMORPHOUS) != 0L) -#define noncorporeal(ptr) ((ptr)->mlet == S_GHOST) -#define tunnels(ptr) (((ptr)->mflags1 & M1_TUNNEL) != 0L) -#define needspick(ptr) (((ptr)->mflags1 & M1_NEEDPICK) != 0L) -#define hides_under(ptr) (((ptr)->mflags1 & M1_CONCEAL) != 0L) -#define is_hider(ptr) (((ptr)->mflags1 & M1_HIDE) != 0L) -#define haseyes(ptr) (((ptr)->mflags1 & M1_NOEYES) == 0L) -#define eyecount(ptr) (!haseyes(ptr) ? 0 : \ - ((ptr) == &mons[PM_CYCLOPS] || \ - (ptr) == &mons[PM_FLOATING_EYE]) ? 1 : 2) -#define nohands(ptr) (((ptr)->mflags1 & M1_NOHANDS) != 0L) -#define nolimbs(ptr) (((ptr)->mflags1 & M1_NOLIMBS) == M1_NOLIMBS) -#define notake(ptr) (((ptr)->mflags1 & M1_NOTAKE) != 0L) -#define has_head(ptr) (((ptr)->mflags1 & M1_NOHEAD) == 0L) -#define has_horns(ptr) (num_horns(ptr) > 0) -#define is_whirly(ptr) ((ptr)->mlet == S_VORTEX || \ - (ptr) == &mons[PM_AIR_ELEMENTAL]) -#define flaming(ptr) ((ptr) == &mons[PM_FIRE_VORTEX] || \ - (ptr) == &mons[PM_FLAMING_SPHERE] || \ - (ptr) == &mons[PM_FIRE_ELEMENTAL] || \ - (ptr) == &mons[PM_SALAMANDER]) -#define is_silent(ptr) ((ptr)->msound == MS_SILENT) -#define unsolid(ptr) (((ptr)->mflags1 & M1_UNSOLID) != 0L) -#define mindless(ptr) (((ptr)->mflags1 & M1_MINDLESS) != 0L) -#define humanoid(ptr) (((ptr)->mflags1 & M1_HUMANOID) != 0L) -#define is_animal(ptr) (((ptr)->mflags1 & M1_ANIMAL) != 0L) -#define slithy(ptr) (((ptr)->mflags1 & M1_SLITHY) != 0L) -#define is_wooden(ptr) ((ptr) == &mons[PM_WOOD_GOLEM]) -#define thick_skinned(ptr) (((ptr)->mflags1 & M1_THICK_HIDE) != 0L) -#define slimeproof(ptr) ((ptr) == &mons[PM_GREEN_SLIME] || \ - flaming(ptr) || noncorporeal(ptr)) -#define lays_eggs(ptr) (((ptr)->mflags1 & M1_OVIPAROUS) != 0L) -#define regenerates(ptr) (((ptr)->mflags1 & M1_REGEN) != 0L) -#define perceives(ptr) (((ptr)->mflags1 & M1_SEE_INVIS) != 0L) -#define can_teleport(ptr) (((ptr)->mflags1 & M1_TPORT) != 0L) -#define control_teleport(ptr) (((ptr)->mflags1 & M1_TPORT_CNTRL) != 0L) -#define telepathic(ptr) ((ptr) == &mons[PM_FLOATING_EYE] || \ - (ptr) == &mons[PM_MIND_FLAYER] || \ - (ptr) == &mons[PM_MASTER_MIND_FLAYER]) -#define is_armed(ptr) attacktype(ptr, AT_WEAP) -#define acidic(ptr) (((ptr)->mflags1 & M1_ACID) != 0L) -#define poisonous(ptr) (((ptr)->mflags1 & M1_POIS) != 0L) -#define carnivorous(ptr) (((ptr)->mflags1 & M1_CARNIVORE) != 0L) -#define herbivorous(ptr) (((ptr)->mflags1 & M1_HERBIVORE) != 0L) -#define metallivorous(ptr) (((ptr)->mflags1 & M1_METALLIVORE) != 0L) -#define polyok(ptr) (((ptr)->mflags2 & M2_NOPOLY) == 0L) -#define is_shapeshifter(ptr) (((ptr)->mflags2 & M2_SHAPESHIFTER) != 0L) -#define is_undead(ptr) (((ptr)->mflags2 & M2_UNDEAD) != 0L) -#define is_were(ptr) (((ptr)->mflags2 & M2_WERE) != 0L) -#define is_elf(ptr) (((ptr)->mflags2 & M2_ELF) != 0L) -#define is_dwarf(ptr) (((ptr)->mflags2 & M2_DWARF) != 0L) -#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 is_bat(ptr) ((ptr) == &mons[PM_BAT] || \ - (ptr) == &mons[PM_GIANT_BAT] || \ - (ptr) == &mons[PM_VAMPIRE_BAT]) -#define is_bird(ptr) ((ptr)->mlet == S_BAT && !is_bat(ptr)) -#define is_giant(ptr) (((ptr)->mflags2 & M2_GIANT) != 0L) -#define is_golem(ptr) ((ptr)->mlet == S_GOLEM) -#define is_domestic(ptr) (((ptr)->mflags2 & M2_DOMESTIC) != 0L) -#define is_demon(ptr) (((ptr)->mflags2 & M2_DEMON) != 0L) -#define is_mercenary(ptr) (((ptr)->mflags2 & M2_MERC) != 0L) -#define is_male(ptr) (((ptr)->mflags2 & M2_MALE) != 0L) -#define is_female(ptr) (((ptr)->mflags2 & M2_FEMALE) != 0L) -#define is_neuter(ptr) (((ptr)->mflags2 & M2_NEUTER) != 0L) -#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 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) -#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) -#define is_lord(ptr) (((ptr)->mflags2 & M2_LORD) != 0L) -#define is_prince(ptr) (((ptr)->mflags2 & M2_PRINCE) != 0L) -#define is_ndemon(ptr) (is_demon(ptr) && \ - (((ptr)->mflags2 & (M2_LORD|M2_PRINCE)) == 0L)) -#define is_dlord(ptr) (is_demon(ptr) && is_lord(ptr)) -#define is_dprince(ptr) (is_demon(ptr) && is_prince(ptr)) -#define is_minion(ptr) (((ptr)->mflags2 & M2_MINION) != 0L) -#define likes_gold(ptr) (((ptr)->mflags2 & M2_GREEDY) != 0L) -#define likes_gems(ptr) (((ptr)->mflags2 & M2_JEWELS) != 0L) -#define likes_objs(ptr) (((ptr)->mflags2 & M2_COLLECT) != 0L || \ - is_armed(ptr)) -#define likes_magic(ptr) (((ptr)->mflags2 & M2_MAGIC) != 0L) -#define webmaker(ptr) ((ptr) == &mons[PM_CAVE_SPIDER] || \ - (ptr) == &mons[PM_GIANT_SPIDER]) -#define is_unicorn(ptr) ((ptr)->mlet == S_UNICORN && likes_gems(ptr)) -#define is_longworm(ptr) (((ptr) == &mons[PM_BABY_LONG_WORM]) || \ - ((ptr) == &mons[PM_LONG_WORM]) || \ - ((ptr) == &mons[PM_LONG_WORM_TAIL])) -#define is_covetous(ptr) ((ptr->mflags3 & M3_COVETOUS)) -#define infravision(ptr) ((ptr->mflags3 & M3_INFRAVISION)) -#define infravisible(ptr) ((ptr->mflags3 & M3_INFRAVISIBLE)) -#define is_displacer(ptr) (((ptr)->mflags3 & M3_DISPLACES) != 0L) -#define is_mplayer(ptr) (((ptr) >= &mons[PM_ARCHEOLOGIST]) && \ - ((ptr) <= &mons[PM_WIZARD])) -#define is_watch(ptr) ((ptr) == &mons[PM_WATCHMAN] || \ - (ptr) == &mons[PM_WATCH_CAPTAIN]) -#define is_rider(ptr) ((ptr) == &mons[PM_DEATH] || \ - (ptr) == &mons[PM_FAMINE] || \ - (ptr) == &mons[PM_PESTILENCE]) -#define is_placeholder(ptr) ((ptr) == &mons[PM_ORC] || \ - (ptr) == &mons[PM_GIANT] || \ - (ptr) == &mons[PM_ELF] || \ - (ptr) == &mons[PM_HUMAN]) +#define is_lminion(mon) \ + (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) +#define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L) +#define is_floater(ptr) ((ptr)->mlet == S_EYE) +#define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L) +#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 passes_walls(ptr) (((ptr)->mflags1 & M1_WALLWALK) != 0L) +#define amorphous(ptr) (((ptr)->mflags1 & M1_AMORPHOUS) != 0L) +#define noncorporeal(ptr) ((ptr)->mlet == S_GHOST) +#define tunnels(ptr) (((ptr)->mflags1 & M1_TUNNEL) != 0L) +#define needspick(ptr) (((ptr)->mflags1 & M1_NEEDPICK) != 0L) +#define hides_under(ptr) (((ptr)->mflags1 & M1_CONCEAL) != 0L) +#define is_hider(ptr) (((ptr)->mflags1 & M1_HIDE) != 0L) +#define haseyes(ptr) (((ptr)->mflags1 & M1_NOEYES) == 0L) +#define eyecount(ptr) \ + (!haseyes(ptr) ? 0 : ((ptr) == &mons[PM_CYCLOPS] \ + || (ptr) == &mons[PM_FLOATING_EYE]) \ + ? 1 \ + : 2) +#define nohands(ptr) (((ptr)->mflags1 & M1_NOHANDS) != 0L) +#define nolimbs(ptr) (((ptr)->mflags1 & M1_NOLIMBS) == M1_NOLIMBS) +#define notake(ptr) (((ptr)->mflags1 & M1_NOTAKE) != 0L) +#define has_head(ptr) (((ptr)->mflags1 & M1_NOHEAD) == 0L) +#define has_horns(ptr) (num_horns(ptr) > 0) +#define is_whirly(ptr) \ + ((ptr)->mlet == S_VORTEX || (ptr) == &mons[PM_AIR_ELEMENTAL]) +#define flaming(ptr) \ + ((ptr) == &mons[PM_FIRE_VORTEX] || (ptr) == &mons[PM_FLAMING_SPHERE] \ + || (ptr) == &mons[PM_FIRE_ELEMENTAL] || (ptr) == &mons[PM_SALAMANDER]) +#define is_silent(ptr) ((ptr)->msound == MS_SILENT) +#define unsolid(ptr) (((ptr)->mflags1 & M1_UNSOLID) != 0L) +#define mindless(ptr) (((ptr)->mflags1 & M1_MINDLESS) != 0L) +#define humanoid(ptr) (((ptr)->mflags1 & M1_HUMANOID) != 0L) +#define is_animal(ptr) (((ptr)->mflags1 & M1_ANIMAL) != 0L) +#define slithy(ptr) (((ptr)->mflags1 & M1_SLITHY) != 0L) +#define is_wooden(ptr) ((ptr) == &mons[PM_WOOD_GOLEM]) +#define thick_skinned(ptr) (((ptr)->mflags1 & M1_THICK_HIDE) != 0L) +#define slimeproof(ptr) \ + ((ptr) == &mons[PM_GREEN_SLIME] || flaming(ptr) || noncorporeal(ptr)) +#define lays_eggs(ptr) (((ptr)->mflags1 & M1_OVIPAROUS) != 0L) +#define regenerates(ptr) (((ptr)->mflags1 & M1_REGEN) != 0L) +#define perceives(ptr) (((ptr)->mflags1 & M1_SEE_INVIS) != 0L) +#define can_teleport(ptr) (((ptr)->mflags1 & M1_TPORT) != 0L) +#define control_teleport(ptr) (((ptr)->mflags1 & M1_TPORT_CNTRL) != 0L) +#define telepathic(ptr) \ + ((ptr) == &mons[PM_FLOATING_EYE] || (ptr) == &mons[PM_MIND_FLAYER] \ + || (ptr) == &mons[PM_MASTER_MIND_FLAYER]) +#define is_armed(ptr) attacktype(ptr, AT_WEAP) +#define acidic(ptr) (((ptr)->mflags1 & M1_ACID) != 0L) +#define poisonous(ptr) (((ptr)->mflags1 & M1_POIS) != 0L) +#define carnivorous(ptr) (((ptr)->mflags1 & M1_CARNIVORE) != 0L) +#define herbivorous(ptr) (((ptr)->mflags1 & M1_HERBIVORE) != 0L) +#define metallivorous(ptr) (((ptr)->mflags1 & M1_METALLIVORE) != 0L) +#define polyok(ptr) (((ptr)->mflags2 & M2_NOPOLY) == 0L) +#define is_shapeshifter(ptr) (((ptr)->mflags2 & M2_SHAPESHIFTER) != 0L) +#define is_undead(ptr) (((ptr)->mflags2 & M2_UNDEAD) != 0L) +#define is_were(ptr) (((ptr)->mflags2 & M2_WERE) != 0L) +#define is_elf(ptr) (((ptr)->mflags2 & M2_ELF) != 0L) +#define is_dwarf(ptr) (((ptr)->mflags2 & M2_DWARF) != 0L) +#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 is_bat(ptr) \ + ((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \ + || (ptr) == &mons[PM_VAMPIRE_BAT]) +#define is_bird(ptr) ((ptr)->mlet == S_BAT && !is_bat(ptr)) +#define is_giant(ptr) (((ptr)->mflags2 & M2_GIANT) != 0L) +#define is_golem(ptr) ((ptr)->mlet == S_GOLEM) +#define is_domestic(ptr) (((ptr)->mflags2 & M2_DOMESTIC) != 0L) +#define is_demon(ptr) (((ptr)->mflags2 & M2_DEMON) != 0L) +#define is_mercenary(ptr) (((ptr)->mflags2 & M2_MERC) != 0L) +#define is_male(ptr) (((ptr)->mflags2 & M2_MALE) != 0L) +#define is_female(ptr) (((ptr)->mflags2 & M2_FEMALE) != 0L) +#define is_neuter(ptr) (((ptr)->mflags2 & M2_NEUTER) != 0L) +#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 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) +#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) +#define is_lord(ptr) (((ptr)->mflags2 & M2_LORD) != 0L) +#define is_prince(ptr) (((ptr)->mflags2 & M2_PRINCE) != 0L) +#define is_ndemon(ptr) \ + (is_demon(ptr) && (((ptr)->mflags2 & (M2_LORD | M2_PRINCE)) == 0L)) +#define is_dlord(ptr) (is_demon(ptr) && is_lord(ptr)) +#define is_dprince(ptr) (is_demon(ptr) && is_prince(ptr)) +#define is_minion(ptr) (((ptr)->mflags2 & M2_MINION) != 0L) +#define likes_gold(ptr) (((ptr)->mflags2 & M2_GREEDY) != 0L) +#define likes_gems(ptr) (((ptr)->mflags2 & M2_JEWELS) != 0L) +#define likes_objs(ptr) (((ptr)->mflags2 & M2_COLLECT) != 0L || is_armed(ptr)) +#define likes_magic(ptr) (((ptr)->mflags2 & M2_MAGIC) != 0L) +#define webmaker(ptr) \ + ((ptr) == &mons[PM_CAVE_SPIDER] || (ptr) == &mons[PM_GIANT_SPIDER]) +#define is_unicorn(ptr) ((ptr)->mlet == S_UNICORN && likes_gems(ptr)) +#define is_longworm(ptr) \ + (((ptr) == &mons[PM_BABY_LONG_WORM]) || ((ptr) == &mons[PM_LONG_WORM]) \ + || ((ptr) == &mons[PM_LONG_WORM_TAIL])) +#define is_covetous(ptr) ((ptr->mflags3 & M3_COVETOUS)) +#define infravision(ptr) ((ptr->mflags3 & M3_INFRAVISION)) +#define infravisible(ptr) ((ptr->mflags3 & M3_INFRAVISIBLE)) +#define is_displacer(ptr) (((ptr)->mflags3 & M3_DISPLACES) != 0L) +#define is_mplayer(ptr) \ + (((ptr) >= &mons[PM_ARCHEOLOGIST]) && ((ptr) <= &mons[PM_WIZARD])) +#define is_watch(ptr) \ + ((ptr) == &mons[PM_WATCHMAN] || (ptr) == &mons[PM_WATCH_CAPTAIN]) +#define is_rider(ptr) \ + ((ptr) == &mons[PM_DEATH] || (ptr) == &mons[PM_FAMINE] \ + || (ptr) == &mons[PM_PESTILENCE]) +#define is_placeholder(ptr) \ + ((ptr) == &mons[PM_ORC] || (ptr) == &mons[PM_GIANT] \ + || (ptr) == &mons[PM_ELF] || (ptr) == &mons[PM_HUMAN]) /* return TRUE if the monster tends to revive */ -#define is_reviver(ptr) (is_rider(ptr) || (ptr)->mlet == S_TROLL) +#define is_reviver(ptr) (is_rider(ptr) || (ptr)->mlet == S_TROLL) /* monsters whose corpses and statues need special handling; note that high priests and the Wizard of Yendor are flagged as unique even though they really aren't; that's ok here */ -#define unique_corpstat(ptr) (((ptr)->geno & G_UNIQ) != 0) +#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 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_FIRE_VORTEX]) ? 1 : \ - ((ptr) == &mons[PM_FIRE_ELEMENTAL]) ? 1 : 0) +#define emits_light(ptr) \ + (((ptr)->mlet == S_LIGHT || (ptr) == &mons[PM_FLAMING_SPHERE] \ + || (ptr) == &mons[PM_SHOCKING_SPHERE] \ + || (ptr) == &mons[PM_FIRE_VORTEX]) \ + ? 1 \ + : ((ptr) == &mons[PM_FIRE_ELEMENTAL]) ? 1 : 0) /* [note: the light ranges above were reduced to 1 for performance...] */ -#define likes_lava(ptr) (ptr == &mons[PM_FIRE_ELEMENTAL] || \ - ptr == &mons[PM_SALAMANDER]) -#define pm_invisible(ptr) ((ptr) == &mons[PM_STALKER] || \ - (ptr) == &mons[PM_BLACK_LIGHT]) +#define likes_lava(ptr) \ + (ptr == &mons[PM_FIRE_ELEMENTAL] || ptr == &mons[PM_SALAMANDER]) +#define pm_invisible(ptr) \ + ((ptr) == &mons[PM_STALKER] || (ptr) == &mons[PM_BLACK_LIGHT]) /* could probably add more */ -#define likes_fire(ptr) ((ptr) == &mons[PM_FIRE_VORTEX] || \ - (ptr) == &mons[PM_FLAMING_SPHERE] || \ - likes_lava(ptr)) +#define likes_fire(ptr) \ + ((ptr) == &mons[PM_FIRE_VORTEX] || (ptr) == &mons[PM_FLAMING_SPHERE] \ + || likes_lava(ptr)) -#define touch_petrifies(ptr) ((ptr) == &mons[PM_COCKATRICE] || \ - (ptr) == &mons[PM_CHICKATRICE]) +#define touch_petrifies(ptr) \ + ((ptr) == &mons[PM_COCKATRICE] || (ptr) == &mons[PM_CHICKATRICE]) -#define is_mind_flayer(ptr) ((ptr) == &mons[PM_MIND_FLAYER] || \ - (ptr) == &mons[PM_MASTER_MIND_FLAYER]) +#define is_mind_flayer(ptr) \ + ((ptr) == &mons[PM_MIND_FLAYER] || (ptr) == &mons[PM_MASTER_MIND_FLAYER]) -#define is_vampire(ptr) ((ptr)->mlet == S_VAMPIRE) +#define is_vampire(ptr) ((ptr)->mlet == S_VAMPIRE) -#define nonliving(ptr) (is_golem(ptr) || is_undead(ptr) || \ - (ptr)->mlet == S_VORTEX || \ - (ptr) == &mons[PM_MANES]) +#define nonliving(ptr) \ + (is_golem(ptr) || is_undead(ptr) || (ptr)->mlet == S_VORTEX \ + || (ptr) == &mons[PM_MANES]) /* Used for conduct with corpses, tins, and digestion attacks */ /* G_NOCORPSE monsters might still be swallowed as a purple worm */ /* Maybe someday this could be in mflags... */ -#define vegan(ptr) ((ptr)->mlet == S_BLOB || \ - (ptr)->mlet == S_JELLY || \ - (ptr)->mlet == S_FUNGUS || \ - (ptr)->mlet == S_VORTEX || \ - (ptr)->mlet == S_LIGHT || \ - ((ptr)->mlet == S_ELEMENTAL && \ - (ptr) != &mons[PM_STALKER]) || \ - ((ptr)->mlet == S_GOLEM && \ - (ptr) != &mons[PM_FLESH_GOLEM] && \ - (ptr) != &mons[PM_LEATHER_GOLEM]) || \ - noncorporeal(ptr)) -#define vegetarian(ptr) (vegan(ptr) || \ - ((ptr)->mlet == S_PUDDING && \ - (ptr) != &mons[PM_BLACK_PUDDING])) +#define vegan(ptr) \ + ((ptr)->mlet == S_BLOB || (ptr)->mlet == S_JELLY \ + || (ptr)->mlet == S_FUNGUS || (ptr)->mlet == S_VORTEX \ + || (ptr)->mlet == S_LIGHT \ + || ((ptr)->mlet == S_ELEMENTAL && (ptr) != &mons[PM_STALKER]) \ + || ((ptr)->mlet == S_GOLEM && (ptr) != &mons[PM_FLESH_GOLEM] \ + && (ptr) != &mons[PM_LEATHER_GOLEM]) || noncorporeal(ptr)) +#define vegetarian(ptr) \ + (vegan(ptr) \ + || ((ptr)->mlet == S_PUDDING && (ptr) != &mons[PM_BLACK_PUDDING])) -#define befriend_with_obj(ptr, obj) ((obj)->oclass == FOOD_CLASS && \ - is_domestic(ptr)) +#define befriend_with_obj(ptr, obj) \ + ((obj)->oclass == FOOD_CLASS && is_domestic(ptr)) #endif /* MONDATA_H */ diff --git a/include/monflag.h b/include/monflag.h index 016dc29fd..bc50ca670 100644 --- a/include/monflag.h +++ b/include/monflag.h @@ -7,198 +7,196 @@ #ifndef MONFLAG_H #define MONFLAG_H -#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 */ +#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 */ /* 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 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 */ #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_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_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 */ #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_INFRAVISIBLE 0x0200 /* visible by infravision */ - -#define M3_DISPLACES 0x0400 /* moves monsters out of its way */ +#define M3_INFRAVISION 0x0100 /* has infravision */ +#define M3_INFRAVISIBLE 0x0200 /* visible by infravision */ -#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 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 */ /* 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 */ +#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_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 */ #endif /* MONFLAG_H */ diff --git a/include/monst.h b/include/monst.h index b416f6caf..b683c0d75 100644 --- a/include/monst.h +++ b/include/monst.h @@ -17,13 +17,13 @@ * that there are enough situations which might make a monster change its * weapon that this is impractical. --KAA */ -# define NO_WEAPON_WANTED 0 -# define NEED_WEAPON 1 -# define NEED_RANGED_WEAPON 2 -# define NEED_HTH_WEAPON 3 -# define NEED_PICK_AXE 4 -# define NEED_AXE 5 -# define NEED_PICK_OR_AXE 6 +#define NO_WEAPON_WANTED 0 +#define NEED_WEAPON 1 +#define NEED_RANGED_WEAPON 2 +#define NEED_HTH_WEAPON 3 +#define NEED_PICK_AXE 4 +#define NEED_AXE 5 +#define NEED_PICK_OR_AXE 6 /* The following flags are used for the second argument to display_minventory * in invent.c: @@ -33,130 +33,132 @@ * just display wielded weapons and worn items. */ #define MINV_NOLET 0x01 -#define MINV_ALL 0x02 +#define MINV_ALL 0x02 #ifndef MEXTRA_H #include "mextra.h" #endif struct monst { - struct monst *nmon; - struct permonst *data; - unsigned m_id; - 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 */ - 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 */ -#define MTSZ 4 - coord mtrack[MTSZ]; /* monster track */ - int mhp, mhpmax; - unsigned mappearance; /* for undetected mimics and the wiz */ - uchar m_ap_type; /* what mappearance is describing: */ -#define M_AP_NOTHING 0 /* mappearance is unused -- monster appears - as itself */ -#define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */ -#define M_AP_OBJECT 2 /* an object */ -#define M_AP_MONSTER 3 /* a monster */ - - schar mtame; /* level of tameness, implies peaceful */ - unsigned short mintrinsics; /* low 8 correspond to mresists */ - int mspec_used; /* monster's special ability attack timeout */ - - Bitfield(female,1); /* is female */ - Bitfield(minvis,1); /* currently invisible */ - Bitfield(invis_blkd,1); /* invisibility blocked */ - Bitfield(perminvis,1); /* intrinsic minvis value */ - Bitfield(mcan,1); /* has been cancelled */ - Bitfield(mburied,1); /* has been buried */ - Bitfield(mundetected,1); /* not seen in present hiding place */ - /* implies one of M1_CONCEAL or M1_HIDE, - * but not mimic (that is, snake, spider, - * trapper, piercer, eel) - */ - Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */ - - Bitfield(mspeed,2); /* current speed */ - Bitfield(permspeed,2); /* intrinsic mspeed value */ - Bitfield(mrevived,1); /* has been revived from the dead */ - Bitfield(mcloned,1); /* has been cloned from another */ - Bitfield(mavenge,1); /* did something to deserve retaliation */ - Bitfield(mflee,1); /* fleeing */ - - Bitfield(mfleetim,7); /* timeout for mflee */ - Bitfield(msleeping,1); /* asleep until woken */ - - Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */ - Bitfield(mstun,1); /* stunned (off balance) */ - - Bitfield(mfrozen,7); - Bitfield(mcanmove,1); /* paralysis, similar to mblinded */ - - Bitfield(mconf,1); /* confused */ - Bitfield(mpeaceful,1); /* does not attack unprovoked */ - Bitfield(mtrapped,1); /* trapped in a pit, web or bear trap */ - Bitfield(mleashed,1); /* monster is on a leash */ - Bitfield(isshk,1); /* is shopkeeper */ - Bitfield(isminion,1); /* is a minion */ - Bitfield(isgd,1); /* is guard */ - Bitfield(ispriest,1); /* is a priest */ - - Bitfield(iswiz,1); /* is the Wizard of Yendor */ - Bitfield(wormno,5); /* at most 31 worms on any level */ - /* 2 free bits */ - -#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ - - unsigned long mstrategy; /* for monsters with mflag3: current strategy */ + struct monst *nmon; + struct permonst *data; + unsigned m_id; + 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 */ + 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 */ +#define MTSZ 4 + coord mtrack[MTSZ]; /* monster track */ + int mhp, mhpmax; + unsigned mappearance; /* for undetected mimics and the wiz */ + uchar m_ap_type; /* what mappearance is describing: */ +#define M_AP_NOTHING \ + 0 /* mappearance is unused -- monster appears \ + as itself */ +#define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */ +#define M_AP_OBJECT 2 /* an object */ +#define M_AP_MONSTER 3 /* a monster */ + + schar mtame; /* level of tameness, implies peaceful */ + unsigned short mintrinsics; /* low 8 correspond to mresists */ + int mspec_used; /* monster's special ability attack timeout */ + + Bitfield(female, 1); /* is female */ + Bitfield(minvis, 1); /* currently invisible */ + Bitfield(invis_blkd, 1); /* invisibility blocked */ + Bitfield(perminvis, 1); /* intrinsic minvis value */ + Bitfield(mcan, 1); /* has been cancelled */ + Bitfield(mburied, 1); /* has been buried */ + Bitfield(mundetected, 1); /* not seen in present hiding place */ + /* implies one of M1_CONCEAL or M1_HIDE, + * but not mimic (that is, snake, spider, + * trapper, piercer, eel) + */ + Bitfield(mcansee, 1); /* cansee 1, temp.blinded 0, blind 0 */ + + Bitfield(mspeed, 2); /* current speed */ + Bitfield(permspeed, 2); /* intrinsic mspeed value */ + Bitfield(mrevived, 1); /* has been revived from the dead */ + Bitfield(mcloned, 1); /* has been cloned from another */ + Bitfield(mavenge, 1); /* did something to deserve retaliation */ + Bitfield(mflee, 1); /* fleeing */ + + Bitfield(mfleetim, 7); /* timeout for mflee */ + Bitfield(msleeping, 1); /* asleep until woken */ + + Bitfield(mblinded, 7); /* cansee 0, temp.blinded n, blind 0 */ + Bitfield(mstun, 1); /* stunned (off balance) */ + + Bitfield(mfrozen, 7); + Bitfield(mcanmove, 1); /* paralysis, similar to mblinded */ + + Bitfield(mconf, 1); /* confused */ + Bitfield(mpeaceful, 1); /* does not attack unprovoked */ + Bitfield(mtrapped, 1); /* trapped in a pit, web or bear trap */ + Bitfield(mleashed, 1); /* monster is on a leash */ + Bitfield(isshk, 1); /* is shopkeeper */ + Bitfield(isminion, 1); /* is a minion */ + Bitfield(isgd, 1); /* is guard */ + Bitfield(ispriest, 1); /* is a priest */ + + Bitfield(iswiz, 1); /* is the Wizard of Yendor */ + Bitfield(wormno, 5); /* at most 31 worms on any level */ +/* 2 free bits */ + +#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ + + unsigned long mstrategy; /* for monsters with mflag3: current strategy */ #ifdef NHSTDC -#define STRAT_APPEARMSG 0x80000000UL +#define STRAT_APPEARMSG 0x80000000UL #else -#define STRAT_APPEARMSG 0x80000000L +#define STRAT_APPEARMSG 0x80000000L #endif -#define STRAT_ARRIVE 0x40000000L /* just arrived on current level */ -#define STRAT_WAITFORU 0x20000000L -#define STRAT_CLOSE 0x10000000L -#define STRAT_WAITMASK (STRAT_CLOSE | STRAT_WAITFORU) -#define STRAT_HEAL 0x08000000L -#define STRAT_GROUND 0x04000000L -#define STRAT_MONSTR 0x02000000L -#define STRAT_PLAYER 0x01000000L -#define STRAT_NONE 0x00000000L +#define STRAT_ARRIVE 0x40000000L /* just arrived on current level */ +#define STRAT_WAITFORU 0x20000000L +#define STRAT_CLOSE 0x10000000L +#define STRAT_WAITMASK (STRAT_CLOSE | STRAT_WAITFORU) +#define STRAT_HEAL 0x08000000L +#define STRAT_GROUND 0x04000000L +#define STRAT_MONSTR 0x02000000L +#define STRAT_PLAYER 0x01000000L +#define STRAT_NONE 0x00000000L #define STRAT_STRATMASK 0x0f000000L -#define STRAT_XMASK 0x00ff0000L -#define STRAT_YMASK 0x0000ff00L -#define STRAT_GOAL 0x000000ffL -#define STRAT_GOALX(s) ((xchar)((s & STRAT_XMASK) >> 16)) -#define STRAT_GOALY(s) ((xchar)((s & STRAT_YMASK) >> 8)) - - long mtrapseen; /* bitmap of traps we've been trapped in */ - long mlstmv; /* for catching up with lost time */ - long mspare1; - struct obj *minvent; - - struct obj *mw; - long misc_worn_check; - xchar weapon_check; - - int meating; /* monster is eating timeout */ - struct mextra *mextra; /* point to mextra struct */ +#define STRAT_XMASK 0x00ff0000L +#define STRAT_YMASK 0x0000ff00L +#define STRAT_GOAL 0x000000ffL +#define STRAT_GOALX(s) ((xchar)((s & STRAT_XMASK) >> 16)) +#define STRAT_GOALY(s) ((xchar)((s & STRAT_YMASK) >> 8)) + + long mtrapseen; /* bitmap of traps we've been trapped in */ + long mlstmv; /* for catching up with lost time */ + long mspare1; + struct obj *minvent; + + struct obj *mw; + long misc_worn_check; + xchar weapon_check; + + int meating; /* monster is eating timeout */ + struct mextra *mextra; /* point to mextra struct */ }; -#define newmonst() (struct monst *)alloc(sizeof(struct monst)) +#define newmonst() (struct monst *) alloc(sizeof(struct monst)) /* these are in mspeed */ -#define MSLOW 1 /* slow monster */ -#define MFAST 2 /* speeded monster */ +#define MSLOW 1 /* slow monster */ +#define MFAST 2 /* speeded monster */ -#define MON_WEP(mon) ((mon)->mw) -#define MON_NOWEP(mon) ((mon)->mw = (struct obj *)0) +#define MON_WEP(mon) ((mon)->mw) +#define MON_NOWEP(mon) ((mon)->mw = (struct obj *) 0) -#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 || \ - (mon)->cham == PM_VLAD_THE_IMPALER) +#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 \ + || (mon)->cham == PM_VLAD_THE_IMPALER) #endif /* MONST_H */ diff --git a/include/monsym.h b/include/monsym.h index 800c1ab1a..e4ab216ff 100644 --- a/include/monsym.h +++ b/include/monsym.h @@ -1,7 +1,7 @@ -/* NetHack 3.6 monsym.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* NetHack 3.6 monsym.h $Date: 2009/05/06 10:44:55 $ $Revision: 1.5 $ */ -/* SCCS Id: @(#)monsym.h 3.5 2007/04/07 */ -/* Monster symbols and creation information rev 1.0 */ +/* NetHack 3.6 monsym.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.6 monsym.h $Date: 2009/05/06 10:44:55 $ $Revision: 1.5 $ */ +/* SCCS Id: @(#)monsym.h 3.5 2007/04/07 */ +/* Monster symbols and creation information rev 1.0 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef MONSYM_H @@ -12,134 +12,138 @@ * them. Monster class 0 is not used or defined so we can use it as a * NULL character. */ -#define S_ANT 1 -#define S_BLOB 2 -#define S_COCKATRICE 3 -#define S_DOG 4 -#define S_EYE 5 -#define S_FELINE 6 -#define S_GREMLIN 7 -#define S_HUMANOID 8 -#define S_IMP 9 -#define S_JELLY 10 -#define S_KOBOLD 11 -#define S_LEPRECHAUN 12 -#define S_MIMIC 13 -#define S_NYMPH 14 -#define S_ORC 15 -#define S_PIERCER 16 -#define S_QUADRUPED 17 -#define S_RODENT 18 -#define S_SPIDER 19 -#define S_TRAPPER 20 -#define S_UNICORN 21 -#define S_VORTEX 22 -#define S_WORM 23 -#define S_XAN 24 -#define S_LIGHT 25 -#define S_ZRUTY 26 -#define S_ANGEL 27 -#define S_BAT 28 -#define S_CENTAUR 29 -#define S_DRAGON 30 -#define S_ELEMENTAL 31 -#define S_FUNGUS 32 -#define S_GNOME 33 -#define S_GIANT 34 -#define S_invisible 35 /* non-class present in def_monsyms[] */ -#define S_JABBERWOCK 36 -#define S_KOP 37 -#define S_LICH 38 -#define S_MUMMY 39 -#define S_NAGA 40 -#define S_OGRE 41 -#define S_PUDDING 42 -#define S_QUANTMECH 43 -#define S_RUSTMONST 44 -#define S_SNAKE 45 -#define S_TROLL 46 -#define S_UMBER 47 -#define S_VAMPIRE 48 -#define S_WRAITH 49 -#define S_XORN 50 -#define S_YETI 51 -#define S_ZOMBIE 52 -#define S_HUMAN 53 -#define S_GHOST 54 -#define S_GOLEM 55 -#define S_DEMON 56 -#define S_EEL 57 -#define S_LIZARD 58 +/* clang-format off */ +#define S_ANT 1 +#define S_BLOB 2 +#define S_COCKATRICE 3 +#define S_DOG 4 +#define S_EYE 5 +#define S_FELINE 6 +#define S_GREMLIN 7 +#define S_HUMANOID 8 +#define S_IMP 9 +#define S_JELLY 10 +#define S_KOBOLD 11 +#define S_LEPRECHAUN 12 +#define S_MIMIC 13 +#define S_NYMPH 14 +#define S_ORC 15 +#define S_PIERCER 16 +#define S_QUADRUPED 17 +#define S_RODENT 18 +#define S_SPIDER 19 +#define S_TRAPPER 20 +#define S_UNICORN 21 +#define S_VORTEX 22 +#define S_WORM 23 +#define S_XAN 24 +#define S_LIGHT 25 +#define S_ZRUTY 26 +#define S_ANGEL 27 +#define S_BAT 28 +#define S_CENTAUR 29 +#define S_DRAGON 30 +#define S_ELEMENTAL 31 +#define S_FUNGUS 32 +#define S_GNOME 33 +#define S_GIANT 34 +#define S_invisible 35 /* non-class present in def_monsyms[] */ +#define S_JABBERWOCK 36 +#define S_KOP 37 +#define S_LICH 38 +#define S_MUMMY 39 +#define S_NAGA 40 +#define S_OGRE 41 +#define S_PUDDING 42 +#define S_QUANTMECH 43 +#define S_RUSTMONST 44 +#define S_SNAKE 45 +#define S_TROLL 46 +#define S_UMBER 47 +#define S_VAMPIRE 48 +#define S_WRAITH 49 +#define S_XORN 50 +#define S_YETI 51 +#define S_ZOMBIE 52 +#define S_HUMAN 53 +#define S_GHOST 54 +#define S_GOLEM 55 +#define S_DEMON 56 +#define S_EEL 57 +#define S_LIZARD 58 -#define S_WORM_TAIL 59 -#define S_MIMIC_DEF 60 +#define S_WORM_TAIL 59 +#define S_MIMIC_DEF 60 +/* clang-format on */ -#define MAXMCLASSES 61 /* number of monster classes */ +#define MAXMCLASSES 61 /* number of monster classes */ /* * Default characters for monsters. These correspond to the monster classes * above. */ -#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 ':' +/* 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 ']' +#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 index c4c867b16..800ebbea8 100644 --- a/include/mttypriv.h +++ b/include/mttypriv.h @@ -11,52 +11,54 @@ */ #ifndef _H_tty_private -# define _H_tty_private +#define _H_tty_private -# ifndef _H_tty_public +#ifndef _H_tty_public #include "mactty.h" -# endif +#endif #if !TARGET_API_MAC_CARBON -# include -# include -# include +#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 +#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 ; + 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 ; + Rect invalid_rect; #else - RgnHandle invalid_part ; + RgnHandle invalid_part; #endif - long attribute [ TTY_NUMBER_ATTRIBUTES ] ; - long last_cursor ; - - Boolean was_allocated ; - Boolean curs_state ; - Boolean uses_gworld ; -} tty_record ; + long attribute[TTY_NUMBER_ATTRIBUTES]; + long last_cursor; + Boolean was_allocated; + Boolean curs_state; + Boolean uses_gworld; +} tty_record; -#endif /* _H_tty_private */ +#endif /* _H_tty_private */ diff --git a/include/ntconf.h b/include/ntconf.h index bc2a0b7ea..245665ee4 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -9,68 +9,75 @@ /* #define SHELL /* nt use of pcsys routines caused a hang */ -#define RANDOM /* have Berkeley random(3) */ -#define TEXTCOLOR /* Color text */ +#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 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 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 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 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 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 SYSCF /* Use a global configuration */ +#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration \ + */ #define USER_SOUNDS -/*#define CHANGE_COLOR*/ /* allow palette changes */ -#define SELECTSAVED /* Provide menu of saved games to choose from at start */ +/*#define CHANGE_COLOR*/ /* allow palette changes */ +#define SELECTSAVED /* Provide menu of saved games to choose from at start \ + */ /* * ----------------------------------------------------------------- * The remaining code shouldn't need modification. * ----------------------------------------------------------------- */ -/* #define SHORT_FILENAMES /* All NT filesystems support long names now */ +/* #define SHORT_FILENAMES /* All NT filesystems support long names now + */ #ifdef MICRO -#undef MICRO /* never define this! */ +#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 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_USED "options" #define OPTIONS_FILE OPTIONS_USED -#define PORT_HELP "porthelp" +#define PORT_HELP "porthelp" -#define PORT_DEBUG /* include ability to debug international keyboard issues */ +#define PORT_DEBUG /* include ability to debug international keyboard issues \ + */ -#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 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. \ + */ /* 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)); +#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)); /* @@ -79,52 +86,54 @@ extern void FDECL(interject, (int)); *=============================================== */ #ifdef _MSC_VER -# if (_MSC_VER > 1000) +#if (_MSC_VER > 1000) /* Visual C 8 warning elimination */ -# ifndef _CRT_SECURE_NO_DEPRECATE +#ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE -# endif -# ifndef _SCL_SECURE_NO_DEPRECATE +#endif +#ifndef _SCL_SECURE_NO_DEPRECATE #define _SCL_SECURE_NO_DEPRECATE -# endif -# ifndef _CRT_NONSTDC_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 -# if 0 -#pragma warning(disable:4018) /* signed/unsigned mismatch */ -#pragma warning(disable:4305) /* init, conv from 'const int' to 'char' */ -# endif -#endif - -#define RUNTIME_PORT_ID /* trigger run-time port identification for - * identification of exe CPU architecture - */ +#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 +#if 0 +#pragma warning(disable : 4018) /* signed/unsigned mismatch */ +#pragma warning(disable : 4305) /* init, conv from 'const int' to 'char' */ +#endif +#endif + +#define RUNTIME_PORT_ID /* trigger run-time port identification for \ + * identification of exe CPU architecture \ + */ /* The following is needed for prototypes of certain functions */ #if defined(_MSC_VER) -#include /* Provides prototypes of exit(), spawn() */ +#include /* Provides prototypes of exit(), spawn() */ #endif -#include /* Provides prototypes of strncmpi(), etc. */ +#include /* Provides prototypes of strncmpi(), etc. */ #ifdef STRNCMPI -#define strncmpi(a,b,c) strnicmp(a,b,c) +#define strncmpi(a, b, c) strnicmp(a, b, c) #endif /* 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 */ +#pragma warning( \ + disable : 4996) /* deprecation warning suggesting snprintf_s */ #endif #include @@ -135,21 +144,21 @@ extern void FDECL(interject, (int)); #undef random #endif -#define PATHLEN BUFSZ /* maximum pathlength */ -#define FILENAME BUFSZ /* maximum filename length (conservative) */ +#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) +#if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ) #undef PATHLEN #undef FILENAME -#define PATHLEN _MAX_PATH -#define FILENAME _MAX_FNAME -# endif +#define PATHLEN _MAX_PATH +#define FILENAME _MAX_FNAME +#endif #endif #define NO_SIGNAL -#define index strchr -#define rindex strrchr +#define index strchr +#define rindex strrchr /* Time stuff */ #include @@ -157,27 +166,27 @@ extern void FDECL(interject, (int)); #define USE_STDARG #ifdef RANDOM /* Use the high quality random number routines. */ -#define Rand() random() +#define Rand() random() #else -#define Rand() rand() +#define Rand() rand() #endif #include -#define FCMASK (_S_IREAD|_S_IWRITE) /* file creation mask */ -#define regularize nt_regularize +#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) ((char) (0x80 | (c))) /* #define M(c) ((c) - 128) */ #endif #ifndef C -#define C(c) (0x1f & (c)) +#define C(c) (0x1f & (c)) #endif #if defined(DLB) -#define FILENAME_CMP stricmp /* case insensitive */ +#define FILENAME_CMP stricmp /* case insensitive */ #endif #if 0 @@ -189,7 +198,7 @@ extern const char *alllevels, *allbones; extern char hackdir[]; #define ABORT C('a') #define getuid() 1 -#define getlogin() ((char *)0) +#define getlogin() ((char *) 0) extern void NDECL(win32_abort); extern void FDECL(nttty_preference_update, (const char *)); extern void NDECL(toggle_mouse_support); @@ -202,20 +211,22 @@ extern void NDECL(raw_clear_screen); #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); +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 #include -#undef kbhit /* Use our special NT kbhit */ +#undef kbhit /* Use our special NT kbhit */ #define kbhit (*nt_kbhit) #ifdef LAN_FEATURES @@ -223,13 +234,13 @@ int _RTLENTRY _EXPFUNC read (int __handle, void _FAR *__buf, unsigned __len); #endif #ifndef alloca -#define ALLOCA_HACK /* used in util/panic.c */ +#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 LEFTBUTTON FROM_LEFT_1ST_BUTTON_PRESSED #define RIGHTBUTTON RIGHTMOST_BUTTON_PRESSED -#define MIDBUTTON FROM_LEFT_2ND_BUTTON_PRESSED +#define MIDBUTTON FROM_LEFT_2ND_BUTTON_PRESSED #define MOUSEMASK (LEFTBUTTON | RIGHTBUTTON | MIDBUTTON) #ifdef CHANGE_COLOR extern int FDECL(alternative_palette, (char *)); diff --git a/include/obj.h b/include/obj.h index 5da64c96e..c061a3143 100644 --- a/include/obj.h +++ b/include/obj.h @@ -7,12 +7,12 @@ #define OBJ_H /* #define obj obj_nh */ /* uncomment for SCO UNIX, which has a conflicting - * typedef for "obj" in */ + * typedef for "obj" in */ union vptrs { - struct obj *v_nexthere; /* floor location lists */ - struct obj *v_ocontainer; /* point back to container */ - struct monst *v_ocarry; /* point back to carrying monst */ + struct obj *v_nexthere; /* floor location lists */ + struct obj *v_ocontainer; /* point back to container */ + struct monst *v_ocarry; /* point back to carrying monst */ }; /**** @@ -20,121 +20,125 @@ union vptrs { ** (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 *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 */ }; struct obj { - struct obj *nobj; - union vptrs v; -#define nexthere v.v_nexthere -#define ocontainer v.v_ocontainer -#define ocarry v.v_ocarry - - struct obj *cobj; /* contents list for containers */ - unsigned o_id; - xchar ox,oy; - short otyp; /* object class number */ - unsigned owt; - long quan; /* number of items */ - - schar spe; /* quality of weapon, armor or ring (+ or -) - number of charges for wand ( >= -1 ) - marks your eggs, tin variety and spinach tins - royal coffers for a court ( == 2) - tells which fruit a fruit is - special for uball and amulet - historic and gender for statues */ + struct obj *nobj; + union vptrs v; +#define nexthere v.v_nexthere +#define ocontainer v.v_ocontainer +#define ocarry v.v_ocarry + + struct obj *cobj; /* contents list for containers */ + unsigned o_id; + xchar ox, oy; + short otyp; /* object class number */ + unsigned owt; + long quan; /* number of items */ + + schar spe; /* quality of weapon, armor or ring (+ or -) + number of charges for wand ( >= -1 ) + marks your eggs, tin variety and spinach tins + royal coffers for a court ( == 2) + tells which fruit a fruit is + special for uball and amulet + historic and gender for statues */ #define STATUE_HISTORIC 0x01 -#define STATUE_MALE 0x02 -#define STATUE_FEMALE 0x04 - char oclass; /* object class */ - char invlet; /* designation in inventory */ - char oartifact; /* artifact array index */ - - xchar 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 */ -#define OBJ_INVENT 3 /* object in the hero's inventory */ -#define OBJ_MINVENT 4 /* object in a monster inventory */ -#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); - 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(oeroded,2); /* rusted/burnt weapon/armor */ - Bitfield(oeroded2,2); /* corroded/rotted weapon/armor */ -#define greatest_erosion(otmp) (int)((otmp)->oeroded > (otmp)->oeroded2 ? (otmp)->oeroded : (otmp)->oeroded2) +#define STATUE_MALE 0x02 +#define STATUE_FEMALE 0x04 + char oclass; /* object class */ + char invlet; /* designation in inventory */ + char oartifact; /* artifact array index */ + + xchar 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 */ +#define OBJ_INVENT 3 /* object in the hero's inventory */ +#define OBJ_MINVENT 4 /* object in a monster inventory */ +#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); + 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(oeroded, 2); /* rusted/burnt weapon/armor */ + Bitfield(oeroded2, 2); /* corroded/rotted weapon/armor */ +#define greatest_erosion(otmp) \ + (int)((otmp)->oeroded > (otmp)->oeroded2 ? (otmp)->oeroded \ + : (otmp)->oeroded2) #define MAX_ERODE 3 -#define orotten oeroded /* rotten food */ -#define odiluted oeroded /* diluted potions */ +#define orotten oeroded /* rotten food */ +#define odiluted oeroded /* diluted potions */ #define norevive oeroded2 - Bitfield(oerodeproof,1); /* erodeproof weapon/armor */ - Bitfield(olocked,1); /* object is locked */ - Bitfield(obroken,1); /* lock has been broken */ -#define degraded_horn obroken /* unicorn horn will poly to non-magic */ - Bitfield(otrapped,1); /* container is trapped */ - /* 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); /* globby; will combine 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(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 */ - - 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.0 tribute - the index of the novel title */ + Bitfield(oerodeproof, 1); /* erodeproof weapon/armor */ + Bitfield(olocked, 1); /* object is locked */ + Bitfield(obroken, 1); /* lock has been broken */ +#define degraded_horn obroken /* unicorn horn will poly to non-magic */ + Bitfield(otrapped, 1); /* container is trapped */ +/* 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); /* globby; will combine 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(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 */ + + 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.0 tribute - the index of the novel title */ #define record_achieve_special corpsenm - int usecount; /* overloaded for various things that tally */ -#define spestudied usecount /* # of times a spellbook has been studied */ - unsigned oeaten; /* nutrition left in food, if partly eaten */ - long age; /* creation date */ - long owornmask; - struct oextra *oextra; /* pointer to oextra struct */ + int usecount; /* overloaded for various things that tally */ +#define spestudied usecount /* # of times a spellbook has been studied */ + unsigned oeaten; /* nutrition left in food, if partly eaten */ + long age; /* creation date */ + long owornmask; + 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 */ -#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 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 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_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)) /* Weapons and weapon-tools */ /* KMH -- now based on skill categories. Formerly: @@ -148,195 +152,193 @@ struct obj { * #define is_multigen(otyp) (otyp <= SHURIKEN) * #define is_poisonable(otyp) (otyp <= BEC_DE_CORBIN) */ -#define is_blade(otmp) (otmp->oclass == WEAPON_CLASS && \ - objects[otmp->otyp].oc_skill >= P_DAGGER && \ - objects[otmp->otyp].oc_skill <= P_SABER) -#define is_axe(otmp) ((otmp->oclass == WEAPON_CLASS || \ - otmp->oclass == TOOL_CLASS) && \ - objects[otmp->otyp].oc_skill == P_AXE) -#define is_pick(otmp) ((otmp->oclass == WEAPON_CLASS || \ - otmp->oclass == TOOL_CLASS) && \ - objects[otmp->otyp].oc_skill == P_PICK_AXE) -#define is_sword(otmp) (otmp->oclass == WEAPON_CLASS && \ - objects[otmp->otyp].oc_skill >= P_SHORT_SWORD && \ - objects[otmp->otyp].oc_skill <= P_SABER) -#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)) -#define is_spear(otmp) (otmp->oclass == WEAPON_CLASS && \ - objects[otmp->otyp].oc_skill == P_SPEAR) -#define is_launcher(otmp) (otmp->oclass == WEAPON_CLASS && \ - objects[otmp->otyp].oc_skill >= P_BOW && \ - objects[otmp->otyp].oc_skill <= P_CROSSBOW) -#define is_ammo(otmp) ((otmp->oclass == WEAPON_CLASS || \ - otmp->oclass == GEM_CLASS) && \ - objects[otmp->otyp].oc_skill >= -P_CROSSBOW && \ - objects[otmp->otyp].oc_skill <= -P_BOW) -#define matching_launcher(a,l) ((l) && objects[(a)->otyp].oc_skill == \ - -objects[(l)->otyp].oc_skill) -#define ammo_and_launcher(a,l) (is_ammo(a) && matching_launcher(a,l)) -#define is_missile(otmp) ((otmp->oclass == WEAPON_CLASS || \ - otmp->oclass == TOOL_CLASS) && \ - objects[otmp->otyp].oc_skill >= -P_BOOMERANG && \ - objects[otmp->otyp].oc_skill <= -P_DART) -#define is_weptool(o) ((o)->oclass == TOOL_CLASS && \ - objects[(o)->otyp].oc_skill != P_NONE) -#define bimanual(otmp) ((otmp->oclass == WEAPON_CLASS || \ - otmp->oclass == TOOL_CLASS) && \ - objects[otmp->otyp].oc_bimanual) -#define is_multigen(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) -#define uslinging() (uwep && objects[uwep->otyp].oc_skill == P_SLING) +#define is_blade(otmp) \ + (otmp->oclass == WEAPON_CLASS \ + && objects[otmp->otyp].oc_skill >= P_DAGGER \ + && objects[otmp->otyp].oc_skill <= P_SABER) +#define is_axe(otmp) \ + ((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \ + && objects[otmp->otyp].oc_skill == P_AXE) +#define is_pick(otmp) \ + ((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \ + && objects[otmp->otyp].oc_skill == P_PICK_AXE) +#define is_sword(otmp) \ + (otmp->oclass == WEAPON_CLASS \ + && objects[otmp->otyp].oc_skill >= P_SHORT_SWORD \ + && objects[otmp->otyp].oc_skill <= P_SABER) +#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)) +#define is_spear(otmp) \ + (otmp->oclass == WEAPON_CLASS && objects[otmp->otyp].oc_skill == P_SPEAR) +#define is_launcher(otmp) \ + (otmp->oclass == WEAPON_CLASS && objects[otmp->otyp].oc_skill >= P_BOW \ + && objects[otmp->otyp].oc_skill <= P_CROSSBOW) +#define is_ammo(otmp) \ + ((otmp->oclass == WEAPON_CLASS || otmp->oclass == GEM_CLASS) \ + && objects[otmp->otyp].oc_skill >= -P_CROSSBOW \ + && objects[otmp->otyp].oc_skill <= -P_BOW) +#define matching_launcher(a, l) \ + ((l) && objects[(a)->otyp].oc_skill == -objects[(l)->otyp].oc_skill) +#define ammo_and_launcher(a, l) (is_ammo(a) && matching_launcher(a, l)) +#define is_missile(otmp) \ + ((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \ + && objects[otmp->otyp].oc_skill >= -P_BOOMERANG \ + && objects[otmp->otyp].oc_skill <= -P_DART) +#define is_weptool(o) \ + ((o)->oclass == TOOL_CLASS && objects[(o)->otyp].oc_skill != P_NONE) +#define bimanual(otmp) \ + ((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \ + && objects[otmp->otyp].oc_bimanual) +#define is_multigen(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) +#define uslinging() (uwep && objects[uwep->otyp].oc_skill == P_SLING) /* Armor */ -#define is_shield(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_SHIELD) -#define is_helmet(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_HELM) -#define is_boots(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_BOOTS) -#define is_gloves(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_GLOVES) -#define is_cloak(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_CLOAK) -#define is_shirt(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_SHIRT) -#define is_suit(otmp) (otmp->oclass == ARMOR_CLASS && \ - objects[otmp->otyp].oc_armcat == ARM_SUIT) -#define is_elven_armor(otmp) ((otmp)->otyp == ELVEN_LEATHER_HELM\ - || (otmp)->otyp == ELVEN_MITHRIL_COAT\ - || (otmp)->otyp == ELVEN_CLOAK\ - || (otmp)->otyp == ELVEN_SHIELD\ - || (otmp)->otyp == ELVEN_BOOTS) -#define is_orcish_armor(otmp) ((otmp)->otyp == ORCISH_HELM\ - || (otmp)->otyp == ORCISH_CHAIN_MAIL\ - || (otmp)->otyp == ORCISH_RING_MAIL\ - || (otmp)->otyp == ORCISH_CLOAK\ - || (otmp)->otyp == URUK_HAI_SHIELD\ - || (otmp)->otyp == ORCISH_SHIELD) -#define is_dwarvish_armor(otmp) ((otmp)->otyp == DWARVISH_IRON_HELM\ - || (otmp)->otyp == DWARVISH_MITHRIL_COAT\ - || (otmp)->otyp == DWARVISH_CLOAK\ - || (otmp)->otyp == DWARVISH_ROUNDSHIELD) -#define is_gnomish_armor(otmp) (FALSE) - - +#define is_shield(otmp) \ + (otmp->oclass == ARMOR_CLASS \ + && objects[otmp->otyp].oc_armcat == ARM_SHIELD) +#define is_helmet(otmp) \ + (otmp->oclass == ARMOR_CLASS && objects[otmp->otyp].oc_armcat == ARM_HELM) +#define is_boots(otmp) \ + (otmp->oclass == ARMOR_CLASS \ + && objects[otmp->otyp].oc_armcat == ARM_BOOTS) +#define is_gloves(otmp) \ + (otmp->oclass == ARMOR_CLASS \ + && objects[otmp->otyp].oc_armcat == ARM_GLOVES) +#define is_cloak(otmp) \ + (otmp->oclass == ARMOR_CLASS \ + && objects[otmp->otyp].oc_armcat == ARM_CLOAK) +#define is_shirt(otmp) \ + (otmp->oclass == ARMOR_CLASS \ + && objects[otmp->otyp].oc_armcat == ARM_SHIRT) +#define is_suit(otmp) \ + (otmp->oclass == ARMOR_CLASS && objects[otmp->otyp].oc_armcat == ARM_SUIT) +#define is_elven_armor(otmp) \ + ((otmp)->otyp == ELVEN_LEATHER_HELM \ + || (otmp)->otyp == ELVEN_MITHRIL_COAT || (otmp)->otyp == ELVEN_CLOAK \ + || (otmp)->otyp == ELVEN_SHIELD || (otmp)->otyp == ELVEN_BOOTS) +#define is_orcish_armor(otmp) \ + ((otmp)->otyp == ORCISH_HELM || (otmp)->otyp == ORCISH_CHAIN_MAIL \ + || (otmp)->otyp == ORCISH_RING_MAIL || (otmp)->otyp == ORCISH_CLOAK \ + || (otmp)->otyp == URUK_HAI_SHIELD || (otmp)->otyp == ORCISH_SHIELD) +#define is_dwarvish_armor(otmp) \ + ((otmp)->otyp == DWARVISH_IRON_HELM \ + || (otmp)->otyp == DWARVISH_MITHRIL_COAT \ + || (otmp)->otyp == DWARVISH_CLOAK \ + || (otmp)->otyp == DWARVISH_ROUNDSHIELD) +#define is_gnomish_armor(otmp) (FALSE) + /* 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)) +#define MAX_EGG_HATCH_TIME 200 /* longest an egg can remain unhatched */ +#define stale_egg(egg) \ + ((monstermoves - (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) #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 \ - || o->otyp == GLOB_OF_GREEN_SLIME \ - || o->otyp == GLOB_OF_BLACK_PUDDING) - +#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 \ + || o->otyp == GLOB_OF_GREEN_SLIME || o->otyp == GLOB_OF_BLACK_PUDDING) /* Containers */ -#define carried(o) ((o)->where == OBJ_INVENT) -#define mcarried(o) ((o)->where == OBJ_MINVENT) -#define Has_contents(o) (/* (Is_container(o) || (o)->otyp == STATUE) && */ \ - (o)->cobj != (struct obj *)0) +#define carried(o) ((o)->where == OBJ_INVENT) +#define mcarried(o) ((o)->where == OBJ_MINVENT) +#define Has_contents(o) \ + (/* (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 SchroedingersBox(o) ((o)->otyp == LARGE_BOX && (o)->spe == 1) +#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 SchroedingersBox(o) ((o)->otyp == LARGE_BOX && (o)->spe == 1) /* dragon gear */ -#define Is_dragon_scales(obj) ((obj)->otyp >= GRAY_DRAGON_SCALES && \ - (obj)->otyp <= YELLOW_DRAGON_SCALES) -#define Is_dragon_mail(obj) ((obj)->otyp >= GRAY_DRAGON_SCALE_MAIL && \ - (obj)->otyp <= YELLOW_DRAGON_SCALE_MAIL) -#define Is_dragon_armor(obj) (Is_dragon_scales(obj) || Is_dragon_mail(obj)) -#define Dragon_scales_to_pm(obj) &mons[PM_GRAY_DRAGON + (obj)->otyp \ - - GRAY_DRAGON_SCALES] -#define Dragon_mail_to_pm(obj) &mons[PM_GRAY_DRAGON + (obj)->otyp \ - - GRAY_DRAGON_SCALE_MAIL] -#define Dragon_to_scales(pm) (GRAY_DRAGON_SCALES + (pm - mons)) +#define Is_dragon_scales(obj) \ + ((obj)->otyp >= GRAY_DRAGON_SCALES && (obj)->otyp <= YELLOW_DRAGON_SCALES) +#define Is_dragon_mail(obj) \ + ((obj)->otyp >= GRAY_DRAGON_SCALE_MAIL \ + && (obj)->otyp <= YELLOW_DRAGON_SCALE_MAIL) +#define Is_dragon_armor(obj) (Is_dragon_scales(obj) || Is_dragon_mail(obj)) +#define Dragon_scales_to_pm(obj) \ + &mons[PM_GRAY_DRAGON + (obj)->otyp - GRAY_DRAGON_SCALES] +#define Dragon_mail_to_pm(obj) \ + &mons[PM_GRAY_DRAGON + (obj)->otyp - GRAY_DRAGON_SCALE_MAIL] +#define Dragon_to_scales(pm) (GRAY_DRAGON_SCALES + (pm - mons)) /* Elven gear */ -#define is_elven_weapon(otmp) ((otmp)->otyp == ELVEN_ARROW\ - || (otmp)->otyp == ELVEN_SPEAR\ - || (otmp)->otyp == ELVEN_DAGGER\ - || (otmp)->otyp == ELVEN_SHORT_SWORD\ - || (otmp)->otyp == ELVEN_BROADSWORD\ - || (otmp)->otyp == ELVEN_BOW) -#define is_elven_obj(otmp) (is_elven_armor(otmp) || is_elven_weapon(otmp)) +#define is_elven_weapon(otmp) \ + ((otmp)->otyp == ELVEN_ARROW || (otmp)->otyp == ELVEN_SPEAR \ + || (otmp)->otyp == ELVEN_DAGGER || (otmp)->otyp == ELVEN_SHORT_SWORD \ + || (otmp)->otyp == ELVEN_BROADSWORD || (otmp)->otyp == ELVEN_BOW) +#define is_elven_obj(otmp) (is_elven_armor(otmp) || is_elven_weapon(otmp)) /* Orcish gear */ -#define is_orcish_obj(otmp) (is_orcish_armor(otmp)\ - || (otmp)->otyp == ORCISH_ARROW\ - || (otmp)->otyp == ORCISH_SPEAR\ - || (otmp)->otyp == ORCISH_DAGGER\ - || (otmp)->otyp == ORCISH_SHORT_SWORD\ - || (otmp)->otyp == ORCISH_BOW) +#define is_orcish_obj(otmp) \ + (is_orcish_armor(otmp) || (otmp)->otyp == ORCISH_ARROW \ + || (otmp)->otyp == ORCISH_SPEAR || (otmp)->otyp == ORCISH_DAGGER \ + || (otmp)->otyp == ORCISH_SHORT_SWORD || (otmp)->otyp == ORCISH_BOW) /* Dwarvish gear */ -#define is_dwarvish_obj(otmp) (is_dwarvish_armor(otmp)\ - || (otmp)->otyp == DWARVISH_SPEAR\ - || (otmp)->otyp == DWARVISH_SHORT_SWORD\ - || (otmp)->otyp == DWARVISH_MATTOCK) +#define is_dwarvish_obj(otmp) \ + (is_dwarvish_armor(otmp) || (otmp)->otyp == DWARVISH_SPEAR \ + || (otmp)->otyp == DWARVISH_SHORT_SWORD \ + || (otmp)->otyp == DWARVISH_MATTOCK) /* Gnomish gear */ -#define is_gnomish_obj(otmp) (is_gnomish_armor(otmp)) +#define is_gnomish_obj(otmp) (is_gnomish_armor(otmp)) /* Light sources */ -#define Is_candle(otmp) (otmp->otyp == TALLOW_CANDLE || \ - otmp->otyp == WAX_CANDLE) -#define MAX_OIL_IN_FLASK 400 /* maximum amount of oil in a potion of oil */ +#define Is_candle(otmp) \ + (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) ((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) +#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) ((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) +#define ignitable(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) /* things that can be read */ -#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) +#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) /* special stones */ -#define is_graystone(obj) ((obj)->otyp == LUCKSTONE || \ - (obj)->otyp == LOADSTONE || \ - (obj)->otyp == FLINT || \ - (obj)->otyp == TOUCHSTONE) +#define is_graystone(obj) \ + ((obj)->otyp == LUCKSTONE || (obj)->otyp == LOADSTONE \ + || (obj)->otyp == FLINT || (obj)->otyp == TOUCHSTONE) /* misc */ -#define is_flimsy(otmp) (objects[(otmp)->otyp].oc_material <= LEATHER || \ - (otmp)->otyp == RUBBER_HOSE) +#define is_flimsy(otmp) \ + (objects[(otmp)->otyp].oc_material <= LEATHER \ + || (otmp)->otyp == RUBBER_HOSE) /* helpers, simple enough to be macros */ -#define is_plural(o) ((o)->quan > 1 || \ - (o)->oartifact == ART_EYES_OF_THE_OVERWORLD) +#define is_plural(o) \ + ((o)->quan > 1 || (o)->oartifact == ART_EYES_OF_THE_OVERWORLD) /* Flags for get_obj_location(). */ -#define CONTAINED_TOO 0x1 -#define BURIED_TOO 0x2 +#define CONTAINED_TOO 0x1 +#define BURIED_TOO 0x2 /* object erosion types */ #define ERODE_BURN 0 @@ -345,37 +347,40 @@ struct obj { #define ERODE_CORRODE 3 /* erosion flags for erode_obj() */ -#define EF_NONE 0 -#define EF_GREASE 0x1 /* check for a greased object */ +#define EF_NONE 0 +#define EF_GREASE 0x1 /* check for a greased object */ #define EF_DESTROY 0x2 /* potentially destroy the object */ #define EF_VERBOSE 0x4 /* print extra messages */ -#define EF_PAY 0x8 /* it's the player's fault */ +#define EF_PAY 0x8 /* it's the player's fault */ /* erosion return values for erode_obj(), water_damage() */ -#define ER_NOTHING 0 /* nothing happened */ -#define ER_GREASED 1 /* protected by grease */ -#define ER_DAMAGED 2 /* object was damaged in some way */ +#define ER_NOTHING 0 /* nothing happened */ +#define ER_GREASED 1 /* protected by grease */ +#define ER_DAMAGED 2 /* object was damaged in some way */ #define ER_DESTROYED 3 /* object was destroyed */ /* * Notes for adding new oextra structures: * - * 1. Add the structure definition and any required macros in an appropriate + * 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 the oextra struct in this file. + * 2. Add a pointer to your new struct to the 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 a newXX(otmp) function and possibly a free_XX(otmp) function + * 5. Create a newXX(otmp) function and possibly a 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(otmp) * struct obj *otmp; @@ -387,7 +392,7 @@ struct obj { * 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. diff --git a/include/objclass.h b/include/objclass.h index 803220e53..2eba2542e 100644 --- a/include/objclass.h +++ b/include/objclass.h @@ -10,116 +10,120 @@ /* definition of a class of objects */ struct objclass { - short oc_name_idx; /* index of actual name */ - short oc_descr_idx; /* description when name unknown */ - char * oc_uname; /* called by user */ - Bitfield(oc_name_known,1); - Bitfield(oc_merge,1); /* merge otherwise equal objects */ - Bitfield(oc_uses_known,1); /* obj->known affects full decription */ - /* 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. */ - 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 */ - Bitfield(oc_nowish,1); /* cannot wish for this object */ - - Bitfield(oc_big,1); -#define oc_bimanual oc_big /* for weapons & tools used as weapons */ -#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 - - /*Bitfield(oc_subtyp,3);*/ /* Now too big for a bitfield... see below */ - - Bitfield(oc_material,5); -#define LIQUID 1 /* currently only for venom */ -#define WAX 2 -#define VEGGY 3 /* foodstuffs */ -#define FLESH 4 /* ditto */ -#define PAPER 5 -#define CLOTH 6 -#define LEATHER 7 -#define WOOD 8 -#define BONE 9 -#define DRAGON_HIDE 10 /* not leather! */ -#define IRON 11 /* Fe - includes steel */ -#define METAL 12 /* Sn, &c. */ -#define COPPER 13 /* Cu - includes brass */ -#define SILVER 14 /* Ag */ -#define GOLD 15 /* Au */ -#define PLATINUM 16 /* Pt */ -#define MITHRIL 17 -#define PLASTIC 18 -#define GLASS 19 -#define GEMSTONE 20 -#define MINERAL 21 - -#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) + short oc_name_idx; /* index of actual name */ + short oc_descr_idx; /* description when name unknown */ + char *oc_uname; /* called by user */ + Bitfield(oc_name_known, 1); + Bitfield(oc_merge, 1); /* merge otherwise equal objects */ + Bitfield(oc_uses_known, 1); /* obj->known affects full decription */ + /* 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. */ + 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 */ + Bitfield(oc_nowish, 1); /* cannot wish for this object */ + + Bitfield(oc_big, 1); +#define oc_bimanual oc_big /* for weapons & tools used as weapons */ +#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 + + /*Bitfield(oc_subtyp,3);*/ /* Now too big for a bitfield... see below */ + + Bitfield(oc_material, 5); +#define LIQUID 1 /* currently only for venom */ +#define WAX 2 +#define VEGGY 3 /* foodstuffs */ +#define FLESH 4 /* ditto */ +#define PAPER 5 +#define CLOTH 6 +#define LEATHER 7 +#define WOOD 8 +#define BONE 9 +#define DRAGON_HIDE 10 /* not leather! */ +#define IRON 11 /* Fe - includes steel */ +#define METAL 12 /* Sn, &c. */ +#define COPPER 13 /* Cu - includes brass */ +#define SILVER 14 /* Ag */ +#define GOLD 15 /* Au */ +#define PLATINUM 16 /* Pt */ +#define MITHRIL 17 +#define PLASTIC 18 +#define GLASS 19 +#define GEMSTONE 20 +#define MINERAL 21 + +#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_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)) - - schar oc_subtyp; -#define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */ -#define oc_armcat oc_subtyp /* for armor */ -#define ARM_SHIELD 1 /* needed for special wear function */ -#define ARM_HELM 2 -#define ARM_GLOVES 3 -#define ARM_BOOTS 4 -#define ARM_CLOAK 5 -#define ARM_SHIRT 6 -#define ARM_SUIT 0 - - uchar oc_oprop; /* property (invis, &c.) conveyed */ - char oc_class; /* object class */ - schar oc_delay; /* delay when using such an object */ - uchar oc_color; /* color of the object */ - - short oc_prob; /* probability, used in mkobj() */ - unsigned short 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 */ - schar oc_wsdam, oc_wldam; /* max small/large monster damage */ - schar oc_oc1, oc_oc2; -#define oc_hitbon oc_oc1 /* weapons: "to hit" bonus */ - -#define a_ac oc_oc1 /* armor class, used in ARM_BONUS in do.c */ -#define a_can oc_oc2 /* armor: used in mhitu.c */ -#define oc_level oc_oc2 /* books: spell level */ - - unsigned short oc_nutrition; /* food value */ +#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)) + + schar oc_subtyp; +#define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */ +#define oc_armcat oc_subtyp /* for armor */ +#define ARM_SHIELD 1 /* needed for special wear function */ +#define ARM_HELM 2 +#define ARM_GLOVES 3 +#define ARM_BOOTS 4 +#define ARM_CLOAK 5 +#define ARM_SHIRT 6 +#define ARM_SUIT 0 + + uchar oc_oprop; /* property (invis, &c.) conveyed */ + char oc_class; /* object class */ + schar oc_delay; /* delay when using such an object */ + uchar oc_color; /* color of the object */ + + short oc_prob; /* probability, used in mkobj() */ + unsigned short 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 */ + schar oc_wsdam, oc_wldam; /* max small/large monster damage */ + schar oc_oc1, oc_oc2; +#define oc_hitbon oc_oc1 /* weapons: "to hit" bonus */ + +#define a_ac oc_oc1 /* armor class, used in ARM_BONUS in do.c */ +#define a_can oc_oc2 /* armor: used in mhitu.c */ +#define oc_level oc_oc2 /* books: spell level */ + + unsigned short oc_nutrition; /* food value */ }; struct class_sym { - char sym; - const char *name; - const char *explain; + char sym; + const char *name; + const char *explain; }; struct objdescr { - const char *oc_name; /* actual name */ - const char *oc_descr; /* description when name unknown */ + const char *oc_name; /* actual name */ + const char *oc_descr; /* description when name unknown */ }; extern NEARDATA struct objclass objects[]; @@ -129,66 +133,67 @@ extern NEARDATA struct objdescr obj_descr[]; * All objects have a class. Make sure that all classes have a corresponding * symbol below. */ -#define RANDOM_CLASS 0 /* used for generating random objects */ -#define ILLOBJ_CLASS 1 -#define WEAPON_CLASS 2 -#define ARMOR_CLASS 3 -#define RING_CLASS 4 -#define AMULET_CLASS 5 -#define TOOL_CLASS 6 -#define FOOD_CLASS 7 -#define POTION_CLASS 8 -#define SCROLL_CLASS 9 -#define SPBOOK_CLASS 10 /* actually SPELL-book */ -#define WAND_CLASS 11 -#define COIN_CLASS 12 -#define GEM_CLASS 13 -#define ROCK_CLASS 14 -#define BALL_CLASS 15 -#define CHAIN_CLASS 16 -#define VENOM_CLASS 17 -#define MAXOCLASSES 18 - -#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) /* */ - -#define BURNING_OIL (MAXOCLASSES+1) /* Can be used as input to explode. */ -#define MON_EXPLODE (MAXOCLASSES+2) /* Exploding monster (e.g. gas spore) */ - -#if 0 /* moved to decl.h so that makedefs.c won't see them */ +#define RANDOM_CLASS 0 /* used for generating random objects */ +#define ILLOBJ_CLASS 1 +#define WEAPON_CLASS 2 +#define ARMOR_CLASS 3 +#define RING_CLASS 4 +#define AMULET_CLASS 5 +#define TOOL_CLASS 6 +#define FOOD_CLASS 7 +#define POTION_CLASS 8 +#define SCROLL_CLASS 9 +#define SPBOOK_CLASS 10 /* actually SPELL-book */ +#define WAND_CLASS 11 +#define COIN_CLASS 12 +#define GEM_CLASS 13 +#define ROCK_CLASS 14 +#define BALL_CLASS 15 +#define CHAIN_CLASS 16 +#define VENOM_CLASS 17 +#define MAXOCLASSES 18 + +#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) /* */ + +#define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode. */ +#define MON_EXPLODE (MAXOCLASSES + 2) /* Exploding monster (e.g. gas spore) \ + */ + +#if 0 /* moved to decl.h so that makedefs.c won't see them */ extern const struct class_sym def_oc_syms[MAXOCLASSES]; /* default class symbols */ 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 '.' +#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; - struct fruit *nextf; + char fname[PL_FSIZ]; + int fid; + struct fruit *nextf; }; -#define newfruit() (struct fruit *)alloc(sizeof(struct fruit)) -#define dealloc_fruit(rind) free((genericptr_t) (rind)) +#define newfruit() (struct fruit *) alloc(sizeof(struct fruit)) +#define dealloc_fruit(rind) free((genericptr_t)(rind)) -#define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name) +#define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name) #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr) #endif /* OBJCLASS_H */ diff --git a/include/os2conf.h b/include/os2conf.h index 24165af1e..2e7feac3f 100644 --- a/include/os2conf.h +++ b/include/os2conf.h @@ -15,20 +15,20 @@ */ /* #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 /* - " - */ +#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_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 */ +#define OS2_32BITAPI /* enable for compilation in OS/2 2.0 */ #endif /* @@ -37,32 +37,32 @@ */ /*#define MFLOPPY /* floppy and ramdisk support */ -#define RANDOM /* Berkeley random(3) */ -#define SHELL /* shell escape */ +#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 */ +#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 */ +#undef MSDOS /* MSC autodefines this but we don't want it */ #endif #ifndef MICRO -# define MICRO /* must be defined to allow some inclusions */ +#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 */ +#define ANSI_DEFAULT /* have to have one or the other */ #endif -#define PATHLEN 260 /* maximum pathlength (HPFS) */ -#define FILENAME 260 /* maximum filename length (HPFS) */ +#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 */ +#include "micro.h" /* necessary externs for [os_name].c */ #endif #ifndef SYSTEM_H @@ -70,10 +70,10 @@ #endif #ifndef index -#define index strchr +#define index strchr #endif #ifndef rindex -#define rindex strrchr +#define rindex strrchr #endif #include @@ -81,9 +81,9 @@ /* the high quality random number routines */ #ifdef RANDOM -# define Rand() random() +#define Rand() random() #else -# define Rand() rand() +#define Rand() rand() #endif /* file creation mask */ @@ -91,13 +91,13 @@ #include #include -#define FCMASK (S_IREAD | S_IWRITE) +#define FCMASK (S_IREAD | S_IWRITE) #include #ifdef __EMX__ #include -#define sethanguphandler(foo) (void)signal(SIGHUP, (SIG_RET_TYPE)foo) +#define sethanguphandler(foo) (void) signal(SIGHUP, (SIG_RET_TYPE) foo) #endif void hangup(int i); diff --git a/include/patchlevel.h b/include/patchlevel.h index fb39c2a1e..0913f300f 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -4,25 +4,23 @@ /* NetHack may be freely redistributed. See license for details. */ /* NetHack 3.6.0 */ -#define VERSION_MAJOR 3 -#define VERSION_MINOR 6 +#define VERSION_MAJOR 3 +#define VERSION_MINOR 6 /* * PATCHLEVEL is updated for each release. */ -#define PATCHLEVEL 0 +#define PATCHLEVEL 0 /* * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 0 +#define EDITLEVEL 0 -#define COPYRIGHT_BANNER_A \ -"NetHack, Copyright 1985-2015" +#define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2015" #define COPYRIGHT_BANNER_B \ -" By Stichting Mathematisch Centrum and M. Stephenson." - /* COPYRIGHT_BANNER_C is generated by makedefs into date.h */ -#define COPYRIGHT_BANNER_D \ -" See license for details." + " By Stichting Mathematisch Centrum and M. Stephenson." +/* COPYRIGHT_BANNER_C is generated by makedefs into date.h */ +#define COPYRIGHT_BANNER_D " See license for details." /* * If two or more successive releases have compatible data files, define @@ -35,7 +33,6 @@ */ /* #define VERSION_COMPATIBILITY 0x03050000L */ - /*****************************************************************************/ /* Version 3.6.x */ @@ -44,7 +41,6 @@ * */ - /*****************************************************************************/ /* Version 3.4.x */ @@ -89,12 +85,13 @@ /* * NetHack 3.4.0, March 20, 2002 * - * Hundreds of general bug fixes including some for sliming, zapping, conduct, + * Hundreds of general bug fixes including some for sliming, zapping, + *conduct, * and several more for riding * Eliminated a few potentially fatal bugs including one for stone-to-flesh, * trouble-fixing during prayer, riding down stairs while punished, * polyd player demon summoning, throwing digging tools into shops, and - * a couple from having the vision system enabled at inappropriate times + * a couple from having the vision system enabled at inappropriate times * Corrected some incorrect calculations in final scoring * Enhanced config file processing and alert to duplication of entries * Player selection prompt enhancements for TTY and X11 @@ -352,7 +349,8 @@ * Patch 5, October 15, 1989 * add support for Macintosh OS (courtesy Johnny Lee) * fix annoying dependency loop via new color.h file - * allow interruption while eating -- general handling of partially eaten food + * allow interruption while eating -- general handling of partially eaten + * food * smarter treatment of iron balls (courtesy Kevin Darcy) * a handful of other bug fixes */ diff --git a/include/pcconf.h b/include/pcconf.h index 2f40c44cc..f5d57f564 100644 --- a/include/pcconf.h +++ b/include/pcconf.h @@ -7,9 +7,9 @@ #ifndef PCCONF_H #define PCCONF_H -#define MICRO /* always define this! */ +#define MICRO /* always define this! */ -#ifdef MSDOS /* some of this material is MS-DOS specific */ +#ifdef MSDOS /* some of this material is MS-DOS specific */ /* * Automatic Defines: @@ -31,17 +31,17 @@ * For pre-V7.0 Microsoft Compilers only, manually define OVERLAY here. */ -/*#define OVERLAY */ /* Manual overlay definition (MSC 6.0ax only) */ +/*#define OVERLAY */ /* Manual overlay definition (MSC 6.0ax only) */ -# ifndef __GO32__ -#define MFLOPPY /* Support for floppy drives and ramdisks by dgk */ -# endif +#ifndef __GO32__ +#define MFLOPPY /* Support for floppy drives and ramdisks by dgk */ +#endif -# define SHELL /* via exec of COMMAND.COM */ +#define SHELL /* via exec of COMMAND.COM */ -# ifdef __BORLANDC__ -#define PCMUSIC /* Music option, enable very basic pc speaker music notes */ -# endif +#ifdef __BORLANDC__ +#define PCMUSIC /* Music option, enable very basic pc speaker music notes */ +#endif /* * Screen control options @@ -53,25 +53,23 @@ * or NO_TERMS */ -/* # define TERMLIB */ /* enable use of termcap file /etc/termcap */ - /* or ./termcap for MSDOS (SAC) */ - /* compile and link in Fred Fish's termcap library, */ - /* enclosed in TERMCAP.ARC, to use this */ - -/* # define ANSI_DEFAULT */ /* allows NetHack to run without a ./termcap */ - -# define NO_TERMS /* Allows Nethack to run without ansi.sys by linking */ - /* screen routines into the .exe */ +/* # define TERMLIB */ /* enable use of termcap file /etc/termcap */ + /* or ./termcap for MSDOS (SAC) */ + /* compile and link in Fred Fish's termcap library, */ + /* enclosed in TERMCAP.ARC, to use this */ -# 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 */ -# endif +/* # define ANSI_DEFAULT */ /* allows NetHack to run without a ./termcap */ +#define NO_TERMS /* Allows Nethack to run without ansi.sys by linking */ + /* screen routines into the .exe */ -/* # define PC9800 */ /* Allows NetHack to run on NEC PC-9800 machines */ - /* Yamamoto Keizo */ +#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 */ +#endif +/* # define PC9800 */ /* Allows NetHack to run on NEC PC-9800 machines */ +/* Yamamoto Keizo */ /* * PC video hardware support options (for graphical tile support) @@ -79,32 +77,32 @@ * You may uncomment any/all of the options below. * */ -# 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 */ -# endif -# endif -# else -# undef NO_TERMS -# undef SCREEN_BIOS -# undef SCREEN_DJGPPFAST -# undef SCREEN_VGA -# undef TERMLIB -# define ANSI_DEFAULT -# endif - -# define RANDOM /* have Berkeley random(3) */ - -# 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 */ - /* hook for mail reader implementation. */ +#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 */ +#endif +#endif +#else +#undef NO_TERMS +#undef SCREEN_BIOS +#undef SCREEN_DJGPPFAST +#undef SCREEN_VGA +#undef TERMLIB +#define ANSI_DEFAULT +#endif + +#define RANDOM /* have Berkeley random(3) */ + +#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 */ + /* hook for mail reader implementation. */ /* The following is needed for prototypes of certain functions */ #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__SC__) -#include /* Provides prototypes of exit(), spawn() */ +#include /* Provides prototypes of exit(), spawn() */ #endif #if defined(_MSC_VER) && (_MSC_VER >= 7) @@ -113,28 +111,28 @@ #ifdef strcmpi #undef strcmpi #endif -#include /* Provides prototypes of strncmpi(), etc. */ +#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 +#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. */ +#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 +#include /* Provides prototypes of strncmpi(), etc. */ +#ifndef M +#define M(c) ((char) (0x80 | (c))) +#endif #endif /* @@ -152,32 +150,32 @@ * simply a flag to turn on or off napping for visual effects at run-time. */ -#define TIMED_DELAY /* enable the `timed_delay' run-time option */ +#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. */ +#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. \ + */ #endif /* MSDOS configuration stuff */ -#define PATHLEN 64 /* maximum pathlength */ -#define FILENAME 80 /* maximum filename length (conservative) */ +#define PATHLEN 64 /* maximum pathlength */ +#define FILENAME 80 /* maximum filename length (conservative) */ #ifndef MICRO_H -#include "micro.h" /* contains necessary externs for [os_name].c */ +#include "micro.h" /* contains necessary externs for [os_name].c */ #endif - /* =================================================== * The remaining code shouldn't need modification. */ #ifndef SYSTEM_H -# if !defined(_MSC_VER) +#if !defined(_MSC_VER) #include "system.h" -# endif +#endif #endif #ifdef __DJGPP__ @@ -189,47 +187,48 @@ #include /* kbhit() */ #define PC_LOCKING #define HOLD_LOCKFILE_OPEN -#define SELF_RECOVER /* NetHack itself can recover games */ +#define SELF_RECOVER /* NetHack itself can recover games */ #endif -# ifdef MSDOS -# ifndef EXEPATH -#define EXEPATH /* HACKDIR is .exe location if not explicitly defined */ -# endif -# endif +#ifdef MSDOS +#ifndef EXEPATH +#define EXEPATH /* HACKDIR is .exe location if not explicitly defined */ +#endif +#endif -# if defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER >= 700) && !defined(FUNCTION_LEVEL_LINKING) -# ifndef MOVERLAY -#define MOVERLAY /* Microsoft's MOVE overlay system (MSC >= 7.0) */ -# endif -# endif +#if defined(_MSC_VER) && defined(MSDOS) +#if (_MSC_VER >= 700) && !defined(FUNCTION_LEVEL_LINKING) +#ifndef MOVERLAY +#define MOVERLAY /* Microsoft's MOVE overlay system (MSC >= 7.0) */ +#endif +#endif #define PC_LOCKING -# endif +#endif /* Borland Stuff */ -# if defined(__BORLANDC__) -# if defined(__OVERLAY__) && !defined(VROOMM) -/* __OVERLAY__ is automatically defined by Borland C if overlay option is on */ -#define VROOMM /* Borland's VROOMM overlay system */ -# endif -# if !defined(STKSIZ) -#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. */ -# endif +#if defined(__BORLANDC__) +#if defined(__OVERLAY__) && !defined(VROOMM) +/* __OVERLAY__ is automatically defined by Borland C if overlay option is on + */ +#define VROOMM /* Borland's VROOMM overlay system */ +#endif +#if !defined(STKSIZ) +#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. */ +#endif #define PC_LOCKING -# endif +#endif #ifdef PC_LOCKING #define HLOCK "NHPERM" #endif #ifndef index -# define index strchr +#define index strchr #endif #ifndef rindex -# define rindex strrchr +#define rindex strrchr #endif #ifndef AMIGA @@ -238,116 +237,118 @@ #ifdef RANDOM /* Use the high quality random number routines. */ -# define Rand() random() +#define Rand() random() #else -# define Rand() rand() +#define Rand() rand() #endif #ifndef TOS -# define FCMASK 0660 /* file creation mask */ +#define FCMASK 0660 /* file creation mask */ #endif #include #ifdef MSDOS -# define TEXTCOLOR /* */ -# define PORT_HELP "msdoshlp.txt" /* msdos port specific help file */ +#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 +#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) +#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__) -# pragma message("Warning -- TERMLIB defined with NO_TERMS in pcconf.h") -# pragma message(" Forcing undef of TERMLIB") -# endif +#ifdef TERMLIB +#if defined(_MSC_VER) || defined(__SC__) +#pragma message("Warning -- TERMLIB defined with NO_TERMS in pcconf.h") +#pragma message(" Forcing undef of TERMLIB") +#endif #undef TERMLIB -# endif -# ifdef ANSI_DEFAULT -# if defined(_MSC_VER) || defined(__SC__) -# pragma message("Warning -- ANSI_DEFAULT defined with NO_TERMS in pcconf.h") -# pragma message(" Forcing undef of ANSI_DEFAULT") -# endif +#endif +#ifdef ANSI_DEFAULT +#if defined(_MSC_VER) || defined(__SC__) +#pragma message("Warning -- ANSI_DEFAULT defined with NO_TERMS in pcconf.h") +#pragma message(" Forcing undef of ANSI_DEFAULT") +#endif #undef ANSI_DEFAULT -# endif +#endif /* only one screen package is allowed */ -# if defined(SCREEN_BIOS) && defined(SCREEN_DJGPPFAST) -# if defined(_MSC_VER) || defined(__SC__) -# pragma message("Warning -- More than one screen package defined in pcconf.h") -# endif -# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__SC__) -# if defined(SCREEN_DJGPPFAST) -# if defined(_MSC_VER) || defined(__SC__) -# pragma message(" Forcing undef of SCREEN_DJGPPFAST") -# endif -#undef SCREEN_DJGPPFAST /* Can't use djgpp fast with other compilers anyway */ -# endif -# else +#if defined(SCREEN_BIOS) && defined(SCREEN_DJGPPFAST) +#if defined(_MSC_VER) || defined(__SC__) +#pragma message("Warning -- More than one screen package defined in pcconf.h") +#endif +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__SC__) +#if defined(SCREEN_DJGPPFAST) +#if defined(_MSC_VER) || defined(__SC__) +#pragma message(" Forcing undef of SCREEN_DJGPPFAST") +#endif +#undef SCREEN_DJGPPFAST /* Can't use djgpp fast with other compilers anyway \ + */ +#endif +#else /* djgpp C compiler */ -# if defined(SCREEN_BIOS) +#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) || defined(SCREEN_VESA) -# undef SCREEN_8514 -# undef SCREEN_VESA -# define SCREEN_VGA -# endif +#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) || defined(SCREEN_VESA) +#undef SCREEN_8514 +#undef SCREEN_VESA +#define SCREEN_VGA +#endif /* Graphical tile sanity checks */ -# ifdef SCREEN_VGA -# define SIMULATE_CURSOR -# define POSITIONBAR +#ifdef SCREEN_VGA +#define SIMULATE_CURSOR +#define POSITIONBAR /* Select appropriate tile file format, and map size */ -# define PLANAR_FILE -# define SMALL_MAP -# endif -#endif /* End of sanity check block */ +#define PLANAR_FILE +#define SMALL_MAP +#endif +#endif /* End of sanity check block */ #if defined(MSDOS) && defined(DLB) -#define FILENAME_CMP stricmp /* case insensitive */ +#define FILENAME_CMP stricmp /* case insensitive */ #endif #if defined(_MSC_VER) && (_MSC_VER >= 7) -#pragma warning(disable:4131) -#pragma warning(disable:4135) -#pragma warning(disable:4309) -#pragma warning(disable:4746) -#pragma warning(disable:4761) +#pragma warning(disable : 4131) +#pragma warning(disable : 4135) +#pragma warning(disable : 4309) +#pragma warning(disable : 4746) +#pragma warning(disable : 4761) #endif #ifdef TIMED_DELAY -# ifdef __DJGPP__ -# define msleep(k) (void) usleep((k)*1000) -# endif -# ifdef __BORLANDC__ -# define msleep(k) delay(k) -# endif -# ifdef __SC__ -# define msleep(k) (void) usleep((long)((k)*1000)) -# endif +#ifdef __DJGPP__ +#define msleep(k) (void) usleep((k) *1000) +#endif +#ifdef __BORLANDC__ +#define msleep(k) delay(k) +#endif +#ifdef __SC__ +#define msleep(k) (void) usleep((long)((k) *1000)) +#endif #endif #endif /* PCCONF_H */ diff --git a/include/permonst.h b/include/permonst.h index 17aed317a..a0967f71c 100644 --- a/include/permonst.h +++ b/include/permonst.h @@ -20,19 +20,19 @@ */ struct attack { - uchar aatyp; - uchar adtyp, damn, damd; + uchar aatyp; + uchar adtyp, damn, damd; }; /* Max # of attacks for any given monster. */ -#define NATTK 6 +#define NATTK 6 /* Weight of a human body */ -#define WT_HUMAN 1450 +#define WT_HUMAN 1450 #ifndef ALIGN_H #include "align.h" @@ -41,31 +41,30 @@ struct attack { #include "monflag.h" struct permonst { - const char *mname; /* full name */ - char mlet; /* symbol */ - schar mlevel, /* base monster level */ - mmove, /* move speed */ - ac, /* (base) armor class */ - mr; /* (base) magic resistance */ - 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 */ - uchar msound; /* noise it makes (6 bits) */ - uchar msize; /* physical size (3 bits) */ - uchar mresists; /* resistances */ - uchar mconveys; /* conveyed by eating */ - unsigned long mflags1, /* boolean bitflags */ - mflags2; /* more boolean bitflags */ - unsigned short mflags3; /* yet more boolean bitflags */ -# ifdef TEXTCOLOR - uchar mcolor; /* color to use */ -# endif + const char *mname; /* full name */ + char mlet; /* symbol */ + schar mlevel, /* base monster level */ + mmove, /* move speed */ + ac, /* (base) armor class */ + mr; /* (base) magic resistance */ + 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 */ + uchar msound; /* noise it makes (6 bits) */ + uchar msize; /* physical size (3 bits) */ + uchar mresists; /* resistances */ + uchar mconveys; /* conveyed by eating */ + unsigned long mflags1, /* boolean bitflags */ + mflags2; /* more boolean bitflags */ + unsigned short mflags3; /* yet more boolean bitflags */ +#ifdef TEXTCOLOR + uchar mcolor; /* color to use */ +#endif }; -extern NEARDATA struct permonst - mons[]; /* the master list of monster types */ +extern NEARDATA struct permonst mons[]; /* the master list of monster types */ #define VERY_SLOW 3 #define SLOW_SPEED 9 @@ -73,10 +72,10 @@ extern NEARDATA struct permonst #define FAST_SPEED 15 #define VERY_FAST 24 -#define NON_PM PM_PLAYERMON /* "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 */ +#define NON_PM PM_PLAYERMON /* "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 */ #endif /* PERMONST_H */ diff --git a/include/prop.h b/include/prop.h index 4da4a4a93..52037f23f 100644 --- a/include/prop.h +++ b/include/prop.h @@ -8,143 +8,142 @@ /*** What the properties are ***/ /* Resistances to troubles */ -#define FIRE_RES 1 -#define COLD_RES 2 -#define SLEEP_RES 3 -#define DISINT_RES 4 -#define SHOCK_RES 5 -#define POISON_RES 6 -#define ACID_RES 7 -#define STONE_RES 8 +#define FIRE_RES 1 +#define COLD_RES 2 +#define SLEEP_RES 3 +#define DISINT_RES 4 +#define SHOCK_RES 5 +#define POISON_RES 6 +#define ACID_RES 7 +#define STONE_RES 8 /* note: for the first eight properties, MR_xxx == (1 << (xxx_RES - 1)) */ -#define DRAIN_RES 9 -#define SICK_RES 10 -#define INVULNERABLE 11 -#define ANTIMAGIC 12 +#define DRAIN_RES 9 +#define SICK_RES 10 +#define INVULNERABLE 11 +#define ANTIMAGIC 12 /* Troubles */ -#define STUNNED 13 -#define CONFUSION 14 -#define BLINDED 15 -#define DEAF 16 -#define SICK 17 -#define STONED 18 -#define STRANGLED 19 -#define VOMITING 20 -#define GLIB 21 -#define SLIMED 22 -#define HALLUC 23 -#define HALLUC_RES 24 -#define FUMBLING 25 -#define WOUNDED_LEGS 26 -#define SLEEPY 27 -#define HUNGER 28 +#define STUNNED 13 +#define CONFUSION 14 +#define BLINDED 15 +#define DEAF 16 +#define SICK 17 +#define STONED 18 +#define STRANGLED 19 +#define VOMITING 20 +#define GLIB 21 +#define SLIMED 22 +#define HALLUC 23 +#define HALLUC_RES 24 +#define FUMBLING 25 +#define WOUNDED_LEGS 26 +#define SLEEPY 27 +#define HUNGER 28 /* Vision and senses */ -#define SEE_INVIS 29 -#define TELEPAT 30 -#define WARNING 31 -#define WARN_OF_MON 32 -#define WARN_UNDEAD 33 -#define SEARCHING 34 -#define CLAIRVOYANT 35 -#define INFRAVISION 36 -#define DETECT_MONSTERS 37 +#define SEE_INVIS 29 +#define TELEPAT 30 +#define WARNING 31 +#define WARN_OF_MON 32 +#define WARN_UNDEAD 33 +#define SEARCHING 34 +#define CLAIRVOYANT 35 +#define INFRAVISION 36 +#define DETECT_MONSTERS 37 /* Appearance and behavior */ -#define ADORNED 38 -#define INVIS 39 -#define DISPLACED 40 -#define STEALTH 41 -#define AGGRAVATE_MONSTER 42 -#define CONFLICT 43 +#define ADORNED 38 +#define INVIS 39 +#define DISPLACED 40 +#define STEALTH 41 +#define AGGRAVATE_MONSTER 42 +#define CONFLICT 43 /* Transportation */ -#define JUMPING 44 -#define TELEPORT 45 -#define TELEPORT_CONTROL 46 -#define LEVITATION 47 -#define FLYING 48 -#define WWALKING 49 -#define SWIMMING 50 -#define MAGICAL_BREATHING 51 -#define PASSES_WALLS 52 +#define JUMPING 44 +#define TELEPORT 45 +#define TELEPORT_CONTROL 46 +#define LEVITATION 47 +#define FLYING 48 +#define WWALKING 49 +#define SWIMMING 50 +#define MAGICAL_BREATHING 51 +#define PASSES_WALLS 52 /* Physical attributes */ -#define SLOW_DIGESTION 53 -#define HALF_SPDAM 54 -#define HALF_PHDAM 55 -#define REGENERATION 56 -#define ENERGY_REGENERATION 57 -#define PROTECTION 58 +#define SLOW_DIGESTION 53 +#define HALF_SPDAM 54 +#define HALF_PHDAM 55 +#define REGENERATION 56 +#define ENERGY_REGENERATION 57 +#define PROTECTION 58 #define PROT_FROM_SHAPE_CHANGERS 59 -#define POLYMORPH 60 -#define POLYMORPH_CONTROL 61 -#define UNCHANGING 62 -#define FAST 63 -#define REFLECTING 64 -#define FREE_ACTION 65 -#define FIXED_ABIL 66 -#define LIFESAVED 67 -#define LAST_PROP (LIFESAVED) - +#define POLYMORPH 60 +#define POLYMORPH_CONTROL 61 +#define UNCHANGING 62 +#define FAST 63 +#define REFLECTING 64 +#define FREE_ACTION 65 +#define FIXED_ABIL 66 +#define LIFESAVED 67 +#define LAST_PROP (LIFESAVED) /*** Where the properties come from ***/ /* Definitions were moved here from obj.h and you.h */ struct prop { - /*** Properties conveyed by objects ***/ - long extrinsic; - /* Armor */ -# define W_ARM 0x00000001L /* Body armor */ -# define W_ARMC 0x00000002L /* Cloak */ -# define W_ARMH 0x00000004L /* Helmet/hat */ -# define W_ARMS 0x00000008L /* Shield */ -# define W_ARMG 0x00000010L /* Gloves/gauntlets */ -# define W_ARMF 0x00000020L /* Footwear */ -# define W_ARMU 0x00000040L /* Undershirt */ -# define W_ARMOR (W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_ARMU) - /* Weapons and artifacts */ -# define W_WEP 0x00000100L /* Wielded weapon */ -# define W_QUIVER 0x00000200L /* Quiver for (f)iring ammo */ -# define W_SWAPWEP 0x00000400L /* Secondary weapon */ -# define W_ART 0x00001000L /* Carrying artifact (not really worn) */ -# define W_ARTI 0x00002000L /* Invoked artifact (not really worn) */ - /* Amulets, rings, tools, and other items */ -# define W_AMUL 0x00010000L /* Amulet */ -# define W_RINGL 0x00020000L /* Left ring */ -# define W_RINGR 0x00040000L /* Right ring */ -# define W_RING (W_RINGL | W_RINGR) -# define W_TOOL 0x00080000L /* Eyewear */ -# define W_SADDLE 0x00100000L /* KMH -- For riding monsters */ -# define W_BALL 0x00200000L /* Punishment ball */ -# define W_CHAIN 0x00400000L /* Punishment chain */ + /*** Properties conveyed by objects ***/ + long extrinsic; +/* Armor */ +#define W_ARM 0x00000001L /* Body armor */ +#define W_ARMC 0x00000002L /* Cloak */ +#define W_ARMH 0x00000004L /* Helmet/hat */ +#define W_ARMS 0x00000008L /* Shield */ +#define W_ARMG 0x00000010L /* Gloves/gauntlets */ +#define W_ARMF 0x00000020L /* Footwear */ +#define W_ARMU 0x00000040L /* Undershirt */ +#define W_ARMOR (W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_ARMU) +/* Weapons and artifacts */ +#define W_WEP 0x00000100L /* Wielded weapon */ +#define W_QUIVER 0x00000200L /* Quiver for (f)iring ammo */ +#define W_SWAPWEP 0x00000400L /* Secondary weapon */ +#define W_ART 0x00001000L /* Carrying artifact (not really worn) */ +#define W_ARTI 0x00002000L /* Invoked artifact (not really worn) */ + /* Amulets, rings, tools, and other items */ +#define W_AMUL 0x00010000L /* Amulet */ +#define W_RINGL 0x00020000L /* Left ring */ +#define W_RINGR 0x00040000L /* Right ring */ +#define W_RING (W_RINGL | W_RINGR) +#define W_TOOL 0x00080000L /* Eyewear */ +#define W_SADDLE 0x00100000L /* KMH -- For riding monsters */ +#define W_BALL 0x00200000L /* Punishment ball */ +#define W_CHAIN 0x00400000L /* Punishment chain */ - /*** Property is blocked by an object ***/ - long blocked; /* Same assignments as extrinsic */ + /*** Property is blocked by an object ***/ + long blocked; /* Same assignments as extrinsic */ - /*** Timeouts, permanent properties, and other flags ***/ - 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 */ -# define FROMOUTSIDE 0x04000000L /* By corpses, prayer, thrones, etc. */ -# define INTRINSIC (FROMOUTSIDE|FROMRACE|FROMEXPER) - /* Control flags */ -# define FROMFORM 0x10000000L /* Polyd; conferred by monster form */ -# define I_SPECIAL 0x20000000L /* Property is controllable */ + /*** Timeouts, permanent properties, and other flags ***/ + 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 */ +#define FROMOUTSIDE 0x04000000L /* By corpses, prayer, thrones, etc. */ +#define INTRINSIC (FROMOUTSIDE | FROMRACE | FROMEXPER) +/* Control flags */ +#define FROMFORM 0x10000000L /* Polyd; conferred by monster form */ +#define I_SPECIAL 0x20000000L /* Property is controllable */ }; /*** Definitions for backwards compatibility ***/ -#define LEFT_RING W_RINGL -#define RIGHT_RING W_RINGR -#define LEFT_SIDE LEFT_RING -#define RIGHT_SIDE RIGHT_RING -#define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) -#define WORN_ARMOR W_ARM -#define WORN_CLOAK W_ARMC -#define WORN_HELMET W_ARMH -#define WORN_SHIELD W_ARMS -#define WORN_GLOVES W_ARMG -#define WORN_BOOTS W_ARMF -#define WORN_AMUL W_AMUL -#define WORN_BLINDF W_TOOL -#define WORN_SHIRT W_ARMU +#define LEFT_RING W_RINGL +#define RIGHT_RING W_RINGR +#define LEFT_SIDE LEFT_RING +#define RIGHT_SIDE RIGHT_RING +#define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) +#define WORN_ARMOR W_ARM +#define WORN_CLOAK W_ARMC +#define WORN_HELMET W_ARMH +#define WORN_SHIELD W_ARMS +#define WORN_GLOVES W_ARMG +#define WORN_BOOTS W_ARMF +#define WORN_AMUL W_AMUL +#define WORN_BLINDF W_TOOL +#define WORN_SHIRT W_ARMU #endif /* PROP_H */ diff --git a/include/qt_clust.h b/include/qt_clust.h index 1630ed922..ce6157a72 100644 --- a/include/qt_clust.h +++ b/include/qt_clust.h @@ -9,23 +9,28 @@ #include -class Clusterizer { -public: - Clusterizer(int maxclusters); - ~Clusterizer(); +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 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); + void clear(); + int + clusters() + { + return count; + } + const QRect &operator[](int i); -private: - QRect* cluster; - int count; - const int max; + private: + QRect *cluster; + int count; + const int max; }; #endif diff --git a/include/qt_kde0.h b/include/qt_kde0.h index 5b072d16f..df7f5d733 100644 --- a/include/qt_kde0.h +++ b/include/qt_kde0.h @@ -6,7 +6,8 @@ #ifndef QT_DUMMYKDE #define QT_DUMMYKDE -class KTopLevelWidget : public QMainWindow { - Q_OBJECT +class KTopLevelWidget : public QMainWindow +{ + Q_OBJECT }; #endif diff --git a/include/qt_win.h b/include/qt_win.h index d9be6c63e..31b8178b1 100644 --- a/include/qt_win.h +++ b/include/qt_win.h @@ -21,17 +21,17 @@ #include #include #include -#include +#include #if defined(QWS) -#include +#include #else -#include +#include #endif #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -51,7 +51,7 @@ #ifdef KDE #include #include -#endif +#endif #include "qt_clust.h" @@ -68,626 +68,662 @@ class NhPSListView; class NetHackQtGlyphs; -class NetHackQtLineEdit : public QLineEdit { -public: - NetHackQtLineEdit(); - NetHackQtLineEdit(QWidget* parent, const char* name); +class NetHackQtLineEdit : public QLineEdit +{ + public: + NetHackQtLineEdit(); + NetHackQtLineEdit(QWidget *parent, const char *name); - void fakeEvent(int key, int ascii, int state); + 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); +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(); + NetHackQtGlyphs &glyphs(); + const QFont &normalFont(); + const QFont &normalFixedFont(); + const QFont &largeFont(); - bool ynInMessages(); + bool ynInMessages(); -signals: - void fontChanged(); - void tilesChanged(); + signals: + void fontChanged(); + void tilesChanged(); -public slots: - void toggleGlyphSize(); - void setGlyphSize(bool); + public slots: + void toggleGlyphSize(); + void setGlyphSize(bool); -private: - QSpinBox tilewidth; - QSpinBox tileheight; - QLabel widthlbl; - QLabel heightlbl; - QCheckBox whichsize; - QSize othersize; + private: + QSpinBox tilewidth; + QSpinBox tileheight; + QLabel widthlbl; + QLabel heightlbl; + QCheckBox whichsize; + QSize othersize; - QComboBox fontsize; + QComboBox fontsize; - QFont normal, normalfixed, large; + QFont normal, normalfixed, large; - NetHackQtGlyphs* theglyphs; + NetHackQtGlyphs *theglyphs; -private slots: - void resizeTiles(); + 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 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(); +class NetHackQtClickBuffer +{ + public: + NetHackQtClickBuffer(); - bool Empty() const; - bool Full() const; + bool Empty() const; + bool Full() const; - void Put(int x, int y, int mod); + void Put(int x, int y, int mod); - int NextX() const; - int NextY() const; - int NextMod() const; + int NextX() const; + int NextY() const; + int NextMod() const; - void Get(); + void Get(); -private: - enum { maxclick=64 }; - struct ClickRec { - int x,y,mod; - } click[maxclick]; - int in,out; + private: + enum { maxclick = 64 }; + struct ClickRec { + int x, y, mod; + } click[maxclick]; + int in, out; }; +class NetHackQtSavedGameSelector : public QDialog +{ + public: + NetHackQtSavedGameSelector(const char **saved); -class NetHackQtSavedGameSelector : public QDialog { -public: - NetHackQtSavedGameSelector(const char** saved); - - int choose(); + 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 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 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 { +class NetHackQtExtCmdRequestor : public QDialog +{ Q_OBJECT - NetHackQtKeyBuffer& keysource; + NetHackQtKeyBuffer &keysource; -public: - NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks); + public: + NetHackQtExtCmdRequestor(NetHackQtKeyBuffer &ks); int get(); -private slots: + 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 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(); +class NetHackQtGlyphs +{ + public: + NetHackQtGlyphs(); - int width() const { return size.width(); } - int height() const { return size.height(); } - void toggleSize(); - void setSize(int w, int h); + 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); + 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; + private: + QImage img; + QPixmap pm, pm1, pm2; + QSize size; + int tiles_per_row; }; -class BlackScrollView : public QScrollView { -public: +class BlackScrollView : public QScrollView +{ + public: BlackScrollView() { - viewport()->setBackgroundColor(black); + 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); +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(); + void timeout(); #endif -protected: - virtual void paintEvent(QPaintEvent*); - virtual void mousePressEvent(QMouseEvent*); + protected: + virtual void paintEvent(QPaintEvent *); + virtual void mousePressEvent(QMouseEvent *); -public: - NetHackQtMapWindow(NetHackQtClickBuffer& click_sink); - ~NetHackQtMapWindow(); + public: + NetHackQtMapWindow(NetHackQtClickBuffer &click_sink); + ~NetHackQtMapWindow(); - virtual QWidget* Widget(); - virtual bool Destroy(); + 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); + 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); + void Scroll(int dx, int dy); - // For messages - void displayMessages(bool block); - void putMessage(int attr, const char* text); - void clearMessages(); + // For messages + void displayMessages(bool block); + void putMessage(int attr, const char *text); + void clearMessages(); - void clickCursor(); + void clickCursor(); }; class NetHackQtScrollText; -class NetHackQtMessageWindow : QObject, public NetHackQtWindow { - Q_OBJECT -public: - NetHackQtMessageWindow(); - ~NetHackQtMessageWindow(); +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); + 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 Scroll(int dx, int dy); - void setMap(NetHackQtMapWindow*); + void setMap(NetHackQtMapWindow *); -private: - NetHackQtScrollText* list; - bool changed; - NetHackQtMapWindow* map; + private: + NetHackQtScrollText *list; + bool changed; + NetHackQtMapWindow *map; -private slots: - void updateFont(); + 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 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 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(); +class NetHackQtMenuDialog : public QDialog +{ + Q_OBJECT + public: + NetHackQtMenuDialog(); - void Accept(); - void Reject(); - void SetResult(int); + void Accept(); + void Reject(); + void SetResult(int); - virtual void done(int); + virtual void done(int); -protected: - void resizeEvent(QResizeEvent*); + protected: + void resizeEvent(QResizeEvent *); -signals: - void Resized(); + 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 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; +class NetHackQtRIP : public QWidget +{ + private: + static QPixmap *pixmap; + char **line; + int riplines; -public: - NetHackQtRIP(QWidget* parent); + public: + NetHackQtRIP(QWidget *parent); - void setLines(char** l, int n); + void setLines(char **l, int n); -protected: - virtual void paintEvent(QPaintEvent* event); - QSize sizeHint() const; + protected: + virtual void paintEvent(QPaintEvent *event); + QSize sizeHint() const; }; +class NetHackQtTextWindow : public QDialog, public NetHackQtWindow +{ + Q_OBJECT + public: + NetHackQtTextWindow(NetHackQtKeyBuffer &); + ~NetHackQtTextWindow(); -class NetHackQtTextWindow : public QDialog, public NetHackQtWindow { - Q_OBJECT -public: - NetHackQtTextWindow(NetHackQtKeyBuffer&); - ~NetHackQtTextWindow(); - - virtual QWidget* Widget(); + 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); + 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(); + public slots: + void Search(); -protected: - virtual void done(int); - virtual void keyPressEvent(QKeyEvent*); + protected: + virtual void done(int); + virtual void keyPressEvent(QKeyEvent *); -private slots: - void doUpdate(); + private slots: + void doUpdate(); -private: - NetHackQtKeyBuffer& keysource; + private: + NetHackQtKeyBuffer &keysource; - bool use_rip; - bool str_fixed; + bool use_rip; + bool str_fixed; - QPushButton ok; - QPushButton search; - NetHackQtTextListBox* lines; + QPushButton ok; + QPushButton search; + NetHackQtTextListBox *lines; - NetHackQtRIP rip; + 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 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; +class NetHackQtDelay : QObject +{ + private: + int msec; -public: - NetHackQtDelay(int ms); - void wait(); - virtual void timerEvent(QTimerEvent* timer); + public: + NetHackQtDelay(int ms); + void wait(); + virtual void timerEvent(QTimerEvent *timer); }; +class NetHackQtInvUsageWindow : public QWidget +{ + public: + NetHackQtInvUsageWindow(QWidget *parent); + virtual void paintEvent(QPaintEvent *); -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); + private: + void drawWorn(QPainter &painter, obj *, int x, int y, bool canbe = TRUE); }; // This class is the main widget for NetHack @@ -705,75 +741,78 @@ private: #include "qt_kde0.h" #endif -class NetHackQtMainWindow : public KTopLevelWidget { - Q_OBJECT -public: - NetHackQtMainWindow(NetHackQtKeyBuffer&); +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 AddMessageWindow(NetHackQtMessageWindow *window); + void AddMapWindow(NetHackQtMapWindow *window); + void AddStatusWindow(NetHackQtStatusWindow *window); + void RemoveWindow(NetHackQtWindow *window); + void updateInventory(); - void fadeHighlighting(); + void fadeHighlighting(); -public slots: - void doMenuItem(int); - void doKeys(const QString&); + 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*); + 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 slots: + void layout(); + void raiseMap(); + void zoomMap(); + void raiseMessages(); + void raiseStatus(); -private: - void ShowIfReady(); + private: + void ShowIfReady(); #ifdef KDE - KMenuBar* menubar; + KMenuBar *menubar; #else - QMenuBar* menubar; + QMenuBar *menubar; #endif - NetHackQtMessageWindow* message; - NetHackQtMapWindow* map; - NetHackQtStatusWindow* status; - NetHackQtInvUsageWindow* invusage; + NetHackQtMessageWindow *message; + NetHackQtMapWindow *map; + NetHackQtStatusWindow *status; + NetHackQtInvUsageWindow *invusage; - NetHackQtKeyBuffer& keysink; - QWidgetStack* stack; - int dirkey; + NetHackQtKeyBuffer &keysink; + QWidgetStack *stack; + int dirkey; - const char* *macro; + const char **macro; }; -class NetHackQtYnDialog : QDialog { - Q_OBJECT -private: - const char* question; - const char* choices; - char def; - NetHackQtKeyBuffer& keysource; +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); + protected: + virtual void keyPressEvent(QKeyEvent *); + virtual void done(int); -private slots: - void doneItem(int); + private slots: + void doneItem(int); -public: - NetHackQtYnDialog(NetHackQtKeyBuffer& keysource,const char*,const char*,char); + public: + NetHackQtYnDialog(NetHackQtKeyBuffer &keysource, const char *, + const char *, char); - char Exec(); + char Exec(); }; #ifdef KDE @@ -784,66 +823,68 @@ public: #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); - 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); +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); + 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 index fcb4b8d8e..0d97bfe02 100644 --- a/include/qt_xpms.h +++ b/include/qt_xpms.h @@ -1,130 +1,4 @@ -/* 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", +/* clang-format off */ /* pixels */ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", @@ -1404,3 +1278,4 @@ static const char *wis_xpm[] = { "oooooooooooooooooooooooooooooooooooooooo", "oooooooooooooooooooooooooooooooooooooooo" }; +/* clang-format on */ diff --git a/include/qtext.h b/include/qtext.h index ac65fc6b3..752cab9f9 100644 --- a/include/qtext.h +++ b/include/qtext.h @@ -7,117 +7,118 @@ #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 */ +#define N_HDR 16 /* Maximum number of categories */ +/* (i.e., num roles + 1) */ +#define LEN_HDR 3 /* Maximum length of a category name */ /* quest text message buffer sizes; used to be hardcoded as 80 and 128, but have been expanded to allow some slop for block message summary lines */ -#define QTEXT_OUTSIZ 200 /* used only by nethack */ +#define QTEXT_OUTSIZ 200 /* used only by nethack */ struct qtmsg { - int msgnum; - char delivery; - long offset, - size, summary_size; + int msgnum; + char delivery; + long offset, size, summary_size; }; -#ifdef MAKEDEFS_C /***** MAKEDEFS *****/ +#ifdef MAKEDEFS_C /***** MAKEDEFS *****/ -#define N_MSG 100 /* arbitrary */ +#define N_MSG 100 /* arbitrary */ struct msghdr { - int n_msg; - struct qtmsg qt_msg[N_MSG]; + int n_msg; + struct qtmsg qt_msg[N_MSG]; }; -struct qthdr { - int n_hdr; - char id[N_HDR][LEN_HDR]; - long offset[N_HDR]; +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" -#define QLINE_TOO_LONG "Line %d too long; truncated\n" - - -#else /***** !MAKEDEFS *****/ - -struct qtlists { - struct qtmsg *common, -#if 0 /* UNUSED but available */ +#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" +#define QLINE_TOO_LONG "Line %d too long; truncated\n" + +#else /***** !MAKEDEFS *****/ + +struct qtlists { + struct qtmsg *common, +#if 0 /* UNUSED but available */ *chrace, #endif - *chrole; + *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_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_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_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_ENCOURAGE 25 /* 1-10 random encouragement messages */ -#define QT_FIRSTLOCATE 35 -#define QT_NEXTLOCATE 36 +#define QT_FIRSTLOCATE 35 +#define QT_NEXTLOCATE 36 -#define QT_FIRSTGOAL 40 -#define QT_NEXTGOAL 41 +#define QT_FIRSTGOAL 40 +#define QT_NEXTGOAL 41 #define QT_FIRSTNEMESIS 50 -#define QT_NEXTNEMESIS 51 +#define QT_NEXTNEMESIS 51 #define QT_OTHERNEMESIS 52 -#define QT_NEMWANTSIT 53 /* you somehow got the artifact */ +#define QT_NEMWANTSIT 53 /* you somehow got the artifact */ -#define QT_DISCOURAGE 60 /* 1-10 random maledictive messages */ +#define QT_DISCOURAGE 60 /* 1-10 random maledictive messages */ -#define QT_GOTIT 70 +#define QT_GOTIT 70 -#define QT_KILLEDNEM 80 -#define QT_OFFEREDIT 81 -#define QT_OFFEREDIT2 82 +#define QT_KILLEDNEM 80 +#define QT_OFFEREDIT 81 +#define QT_OFFEREDIT2 82 -#define QT_POSTHANKS 90 -#define QT_HASAMULET 91 +#define QT_POSTHANKS 90 +#define QT_HASAMULET 91 /* * Message defines for common text used in maledictions. */ -#define COMMON_ID "-" /* Common message id value */ +#define COMMON_ID "-" /* Common message id value */ -#define QT_ANGELIC 10 -#define QTN_ANGELIC 10 +#define QT_ANGELIC 10 +#define QTN_ANGELIC 10 -#define QT_DEMONIC 30 -#define QTN_DEMONIC 20 +#define QT_DEMONIC 30 +#define QTN_DEMONIC 20 -#define QT_BANISHED 60 -#endif /***** !MAKEDEFS *****/ +#define QT_BANISHED 60 +#endif /***** !MAKEDEFS *****/ #endif /* QTEXT_H */ diff --git a/include/qttableview.h b/include/qttableview.h index 07ecea7f6..56b0f09d9 100644 --- a/include/qttableview.h +++ b/include/qttableview.h @@ -25,227 +25,268 @@ 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 ); + 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 ); + 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 ); + bool autoUpdate() const; + virtual void setAutoUpdate(bool); - void updateCell( int row, int column, bool erase=TRUE ); + void updateCell(int row, int column, bool erase = TRUE); - QRect cellUpdateRect() const; - QRect viewRect() const; + QRect cellUpdateRect() const; + QRect viewRect() const; - int lastRowVisible() const; - int lastColVisible() const; + int lastRowVisible() const; + int lastColVisible() const; - bool rowIsVisible( int row ) const; - bool colIsVisible( int col ) 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; + 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= + private: // Disabled copy constructor and operator= #if defined(Q_DISABLE_COPY) - QtTableView( const QtTableView & ); - QtTableView &operator=( const QtTableView & ); + 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_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_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_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; +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::numRows() const +{ + return nRows; +} -inline int QtTableView::topCell() const -{ return yCellOffs; } +inline int +QtTableView::numCols() const +{ + return nCols; +} -inline int QtTableView::leftCell() const -{ return xCellOffs; } +inline int +QtTableView::topCell() const +{ + return yCellOffs; +} -inline int QtTableView::xOffset() const -{ return xOffs; } +inline int +QtTableView::leftCell() const +{ + return xCellOffs; +} -inline int QtTableView::yOffset() const -{ return yOffs; } +inline int +QtTableView::xOffset() const +{ + return xOffs; +} -inline int QtTableView::cellHeight() const -{ return cellH; } +inline int +QtTableView::yOffset() const +{ + return yOffs; +} -inline int QtTableView::cellWidth() const -{ return cellW; } +inline int +QtTableView::cellHeight() const +{ + return cellH; +} -inline uint QtTableView::tableFlags() const -{ return tFlags; } +inline int +QtTableView::cellWidth() const +{ + return cellW; +} -inline bool QtTableView::testTableFlags( uint f ) const -{ return (tFlags & f) != 0; } +inline uint +QtTableView::tableFlags() const +{ + return tFlags; +} -inline QRect QtTableView::cellUpdateRect() const -{ return cellUpdateR; } +inline bool +QtTableView::testTableFlags(uint f) const +{ + return (tFlags & f) != 0; +} -inline bool QtTableView::autoUpdate() const -{ return isUpdatesEnabled(); } +inline QRect +QtTableView::cellUpdateRect() const +{ + return cellUpdateR; +} -inline void QtTableView::repaint( bool erase ) -{ repaint( 0, 0, width(), height(), erase ); } +inline bool +QtTableView::autoUpdate() const +{ + return isUpdatesEnabled(); +} -inline void QtTableView::repaint( const QRect &r, bool erase ) -{ repaint( r.x(), r.y(), r.width(), r.height(), erase ); } +inline void +QtTableView::repaint(bool erase) +{ + repaint(0, 0, width(), height(), erase); +} -inline void QtTableView::updateScrollBars() -{ updateScrollBars( 0 ); } +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 diff --git a/include/quest.h b/include/quest.h index b4e946044..df538110f 100644 --- a/include/quest.h +++ b/include/quest.h @@ -7,44 +7,44 @@ #ifndef QUEST_H #define QUEST_H -struct q_score { /* Quest "scorecard" */ - Bitfield(first_start,1); /* only set the first time */ - Bitfield(met_leader,1); /* has met the leader */ - 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(first_locate,1); /* only set the first time */ - 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 */ - Bitfield(met_nemesis,1); /* has met the nemesis before */ - Bitfield(killed_nemesis,1); /* set when the nemesis is killed */ - Bitfield(in_battle,1); /* set when nemesis fighting you */ - - Bitfield(cheater,1); /* set if cheating detected */ - Bitfield(touched_artifact,1); /* for a special message */ - Bitfield(offered_artifact,1); /* offered to leader */ - Bitfield(got_thanks,1); /* final message from leader */ - - /* used by questpgr code when messages want to use pronouns - (set up at game start instead of waiting until monster creation; - 1 bit each would suffice--nobody involved is actually neuter) */ - Bitfield(ldrgend,2); /* leader's gender: 0=male, 1=female, 2=neuter */ - Bitfield(nemgend,2); /* nemesis's gender */ - Bitfield(godgend,2); /* deity's gender */ - - /* keep track of leader presence/absence even if leader is - polymorphed, raised from dead, etc */ - Bitfield(leader_is_dead,1); - unsigned leader_m_id; +struct q_score { /* Quest "scorecard" */ + Bitfield(first_start, 1); /* only set the first time */ + Bitfield(met_leader, 1); /* has met the leader */ + 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(first_locate, 1); /* only set the first time */ + 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 */ + Bitfield(met_nemesis, 1); /* has met the nemesis before */ + Bitfield(killed_nemesis, 1); /* set when the nemesis is killed */ + Bitfield(in_battle, 1); /* set when nemesis fighting you */ + + Bitfield(cheater, 1); /* set if cheating detected */ + Bitfield(touched_artifact, 1); /* for a special message */ + Bitfield(offered_artifact, 1); /* offered to leader */ + Bitfield(got_thanks, 1); /* final message from leader */ + + /* used by questpgr code when messages want to use pronouns + (set up at game start instead of waiting until monster creation; + 1 bit each would suffice--nobody involved is actually neuter) */ + Bitfield(ldrgend, 2); /* leader's gender: 0=male, 1=female, 2=neuter */ + Bitfield(nemgend, 2); /* nemesis's gender */ + Bitfield(godgend, 2); /* deity's gender */ + + /* keep track of leader presence/absence even if leader is + polymorphed, raised from dead, etc */ + Bitfield(leader_is_dead, 1); + 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 */ - /* note: exp.lev. 14 is threshold level for 5th rank (class title, role.c) */ +#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 */ +/* note: exp.lev. 14 is threshold level for 5th rank (class title, role.c) */ #endif /* QUEST_H */ diff --git a/include/rect.h b/include/rect.h index 24fc10a3d..d8222c8b8 100644 --- a/include/rect.h +++ b/include/rect.h @@ -8,8 +8,8 @@ #define RECT_H typedef struct nhrect { - xchar lx, ly; - xchar hx, hy; + xchar lx, ly; + xchar hx, hy; } NhRect; #endif /* RECT_H */ diff --git a/include/region.h b/include/region.h index 519aaf9d6..414aa6bd9 100644 --- a/include/region.h +++ b/include/region.h @@ -14,14 +14,14 @@ typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t)); /* * player_flags */ -#define REG_HERO_INSIDE 0x01 -#define REG_NOT_HEROS 0x02 -#define hero_inside(r) ((r)->player_flags & REG_HERO_INSIDE) -#define heros_fault(r) (!((r)->player_flags & REG_NOT_HEROS)) -#define set_hero_inside(r) ((r)->player_flags |= REG_HERO_INSIDE) -#define clear_hero_inside(r) ((r)->player_flags &= ~REG_HERO_INSIDE) -#define set_heros_fault(r) ((r)->player_flags &= ~REG_NOT_HEROS) -#define clear_heros_fault(r) ((r)->player_flags |= REG_NOT_HEROS) +#define REG_HERO_INSIDE 0x01 +#define REG_NOT_HEROS 0x02 +#define hero_inside(r) ((r)->player_flags & REG_HERO_INSIDE) +#define heros_fault(r) (!((r)->player_flags & REG_NOT_HEROS)) +#define set_hero_inside(r) ((r)->player_flags |= REG_HERO_INSIDE) +#define clear_hero_inside(r) ((r)->player_flags &= ~REG_HERO_INSIDE) +#define set_heros_fault(r) ((r)->player_flags &= ~REG_NOT_HEROS) +#define clear_heros_fault(r) ((r)->player_flags |= REG_NOT_HEROS) /* * Note: if you change the size/type of any of the fields below, @@ -32,37 +32,37 @@ 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 ? */ - /*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 wether 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 wether 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 */ -#define MONST_INC 5 + 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 ? */ + /*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 wether 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 wether 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 */ +#define MONST_INC 5 - /* Should probably do the same thing about objects */ + /* 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 58631bfbe..583ee1d23 100644 --- a/include/rm.h +++ b/include/rm.h @@ -12,7 +12,8 @@ * 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) */ /* @@ -34,348 +35,350 @@ 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.] */ -#define STONE 0 -#define VWALL 1 -#define HWALL 2 -#define TLCORNER 3 -#define TRCORNER 4 -#define BLCORNER 5 -#define BRCORNER 6 -#define CROSSWALL 7 /* For pretty mazes and special levels */ -#define TUWALL 8 -#define TDWALL 9 -#define TLWALL 10 -#define TRWALL 11 -#define DBWALL 12 -#define TREE 13 /* KMH */ -#define SDOOR 14 -#define SCORR 15 -#define POOL 16 -#define MOAT 17 /* pool that doesn't boil, adjust messages */ -#define WATER 18 -#define DRAWBRIDGE_UP 19 -#define LAVAPOOL 20 -#define IRONBARS 21 /* KMH */ -#define DOOR 22 -#define CORR 23 -#define ROOM 24 -#define STAIRS 25 -#define LADDER 26 -#define FOUNTAIN 27 -#define THRONE 28 -#define SINK 29 -#define GRAVE 30 -#define ALTAR 31 -#define ICE 32 +#define STONE 0 +#define VWALL 1 +#define HWALL 2 +#define TLCORNER 3 +#define TRCORNER 4 +#define BLCORNER 5 +#define BRCORNER 6 +#define CROSSWALL 7 /* For pretty mazes and special levels */ +#define TUWALL 8 +#define TDWALL 9 +#define TLWALL 10 +#define TRWALL 11 +#define DBWALL 12 +#define TREE 13 /* KMH */ +#define SDOOR 14 +#define SCORR 15 +#define POOL 16 +#define MOAT 17 /* pool that doesn't boil, adjust messages */ +#define WATER 18 +#define DRAWBRIDGE_UP 19 +#define LAVAPOOL 20 +#define IRONBARS 21 /* KMH */ +#define DOOR 22 +#define CORR 23 +#define ROOM 24 +#define STAIRS 25 +#define LADDER 26 +#define FOUNTAIN 27 +#define THRONE 28 +#define SINK 29 +#define GRAVE 30 +#define ALTAR 31 +#define ICE 32 #define DRAWBRIDGE_DOWN 33 -#define AIR 34 -#define CLOUD 35 +#define AIR 34 +#define CLOUD 35 -#define MAX_TYPE 36 -#define INVALID_TYPE 127 +#define MAX_TYPE 36 +#define INVALID_TYPE 127 /* * Avoid using the level types in inequalities: * these types are subject to change. * Instead, use one of the macros below. */ -#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_DOOR(typ) ((typ) == DOOR) -#define IS_TREE(typ) ((typ) == TREE || \ - (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_THRONE(typ) ((typ) == THRONE) +#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_DOOR(typ) ((typ) == DOOR) +#define IS_TREE(typ) \ + ((typ) == TREE || (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_THRONE(typ) ((typ) == THRONE) #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN) -#define IS_SINK(typ) ((typ) == SINK) -#define IS_GRAVE(typ) ((typ) == GRAVE) -#define IS_ALTAR(typ) ((typ) == ALTAR) -#define IS_DRAWBRIDGE(typ) ((typ) == DRAWBRIDGE_UP || (typ) == DRAWBRIDGE_DOWN) +#define IS_SINK(typ) ((typ) == SINK) +#define IS_GRAVE(typ) ((typ) == GRAVE) +#define IS_ALTAR(typ) ((typ) == ALTAR) +#define IS_DRAWBRIDGE(typ) \ + ((typ) == DRAWBRIDGE_UP || (typ) == DRAWBRIDGE_DOWN) #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_AIR(typ) ((typ) == AIR || (typ) == CLOUD) +#define IS_SOFT(typ) ((typ) == AIR || (typ) == CLOUD || IS_POOL(typ)) /* * The screen symbols may be the default or defined at game startup time. * See drawing.c for defaults. - * Note: {ibm|dec}_graphics[] arrays (also in drawing.c) must be kept in synch. + * Note: {ibm|dec}_graphics[] arrays (also in drawing.c) must be kept in + * synch. */ /* begin dungeon characters */ -#define S_stone 0 -#define S_vwall 1 -#define S_hwall 2 -#define S_tlcorn 3 -#define S_trcorn 4 -#define S_blcorn 5 -#define S_brcorn 6 -#define S_crwall 7 -#define S_tuwall 8 -#define S_tdwall 9 -#define S_tlwall 10 -#define S_trwall 11 -#define S_ndoor 12 -#define S_vodoor 13 -#define S_hodoor 14 -#define S_vcdoor 15 /* closed door, vertical wall */ -#define S_hcdoor 16 /* closed door, horizontal wall */ -#define S_bars 17 /* KMH -- iron bars */ -#define S_tree 18 /* KMH */ -#define S_room 19 -#define S_darkroom 20 -#define S_corr 21 -#define S_litcorr 22 -#define S_upstair 23 -#define S_dnstair 24 -#define S_upladder 25 -#define S_dnladder 26 -#define S_altar 27 -#define S_grave 28 -#define S_throne 29 -#define S_sink 30 -#define S_fountain 31 -#define S_pool 32 -#define S_ice 33 -#define S_lava 34 -#define S_vodbridge 35 -#define S_hodbridge 36 -#define S_vcdbridge 37 /* closed drawbridge, vertical wall */ -#define S_hcdbridge 38 /* closed drawbridge, horizontal wall */ -#define S_air 39 -#define S_cloud 40 -#define S_water 41 +#define S_stone 0 +#define S_vwall 1 +#define S_hwall 2 +#define S_tlcorn 3 +#define S_trcorn 4 +#define S_blcorn 5 +#define S_brcorn 6 +#define S_crwall 7 +#define S_tuwall 8 +#define S_tdwall 9 +#define S_tlwall 10 +#define S_trwall 11 +#define S_ndoor 12 +#define S_vodoor 13 +#define S_hodoor 14 +#define S_vcdoor 15 /* closed door, vertical wall */ +#define S_hcdoor 16 /* closed door, horizontal wall */ +#define S_bars 17 /* KMH -- iron bars */ +#define S_tree 18 /* KMH */ +#define S_room 19 +#define S_darkroom 20 +#define S_corr 21 +#define S_litcorr 22 +#define S_upstair 23 +#define S_dnstair 24 +#define S_upladder 25 +#define S_dnladder 26 +#define S_altar 27 +#define S_grave 28 +#define S_throne 29 +#define S_sink 30 +#define S_fountain 31 +#define S_pool 32 +#define S_ice 33 +#define S_lava 34 +#define S_vodbridge 35 +#define S_hodbridge 36 +#define S_vcdbridge 37 /* closed drawbridge, vertical wall */ +#define S_hcdbridge 38 /* closed drawbridge, horizontal wall */ +#define S_air 39 +#define S_cloud 40 +#define S_water 41 /* end dungeon characters, begin traps */ -#define S_arrow_trap 42 -#define S_dart_trap 43 -#define S_falling_rock_trap 44 -#define S_squeaky_board 45 -#define S_bear_trap 46 -#define S_land_mine 47 -#define S_rolling_boulder_trap 48 -#define S_sleeping_gas_trap 49 -#define S_rust_trap 50 -#define S_fire_trap 51 -#define S_pit 52 -#define S_spiked_pit 53 -#define S_hole 54 -#define S_trap_door 55 -#define S_teleportation_trap 56 -#define S_level_teleporter 57 -#define S_magic_portal 58 -#define S_web 59 -#define S_statue_trap 60 -#define S_magic_trap 61 -#define S_anti_magic_trap 62 -#define S_polymorph_trap 63 +#define S_arrow_trap 42 +#define S_dart_trap 43 +#define S_falling_rock_trap 44 +#define S_squeaky_board 45 +#define S_bear_trap 46 +#define S_land_mine 47 +#define S_rolling_boulder_trap 48 +#define S_sleeping_gas_trap 49 +#define S_rust_trap 50 +#define S_fire_trap 51 +#define S_pit 52 +#define S_spiked_pit 53 +#define S_hole 54 +#define S_trap_door 55 +#define S_teleportation_trap 56 +#define S_level_teleporter 57 +#define S_magic_portal 58 +#define S_web 59 +#define S_statue_trap 60 +#define S_magic_trap 61 +#define S_anti_magic_trap 62 +#define S_polymorph_trap 63 /* end traps, begin special effects */ -#define S_vbeam 64 /* The 4 zap beam symbols. Do NOT separate. */ -#define S_hbeam 65 /* To change order or add, see function */ -#define S_lslant 66 /* zapdir_to_glyph() in display.c. */ -#define S_rslant 67 -#define S_digbeam 68 /* dig beam symbol */ -#define S_flashbeam 69 /* camera flash symbol */ -#define S_boomleft 70 /* thrown boomerang, open left, e.g ')' */ -#define S_boomright 71 /* thrown boomerand, open right, e.g. '(' */ -#define S_ss1 72 /* 4 magic shield glyphs */ -#define S_ss2 73 -#define S_ss3 74 -#define S_ss4 75 -#define S_poisoncloud 76 -#define S_goodpos 77 /* valid position for targeting */ +#define S_vbeam 64 /* The 4 zap beam symbols. Do NOT separate. */ +#define S_hbeam 65 /* To change order or add, see function */ +#define S_lslant 66 /* zapdir_to_glyph() in display.c. */ +#define S_rslant 67 +#define S_digbeam 68 /* dig beam symbol */ +#define S_flashbeam 69 /* camera flash symbol */ +#define S_boomleft 70 /* thrown boomerang, open left, e.g ')' */ +#define S_boomright 71 /* thrown boomerand, open right, e.g. '(' */ +#define S_ss1 72 /* 4 magic shield glyphs */ +#define S_ss2 73 +#define S_ss3 74 +#define S_ss4 75 +#define S_poisoncloud 76 +#define S_goodpos 77 /* valid position for targeting */ /* The 8 swallow symbols. Do NOT separate. To change order or add, see */ /* the function swallow_to_glyph() in display.c. */ -#define S_sw_tl 78 /* swallow top left [1] */ -#define S_sw_tc 79 /* swallow top center [2] Order: */ -#define S_sw_tr 80 /* swallow top right [3] */ -#define S_sw_ml 81 /* swallow middle left [4] 1 2 3 */ -#define S_sw_mr 82 /* swallow middle right [6] 4 5 6 */ -#define S_sw_bl 83 /* swallow bottom left [7] 7 8 9 */ -#define S_sw_bc 84 /* swallow bottom center [8] */ -#define S_sw_br 85 /* swallow bottom right [9] */ - -#define S_explode1 86 /* explosion top left */ -#define S_explode2 87 /* explosion top center */ -#define S_explode3 88 /* explosion top right Ex. */ -#define S_explode4 89 /* explosion middle left */ -#define S_explode5 90 /* explosion middle center /-\ */ -#define S_explode6 91 /* explosion middle right |@| */ -#define S_explode7 92 /* explosion bottom left \-/ */ -#define S_explode8 93 /* explosion bottom center */ -#define S_explode9 94 /* explosion bottom right */ +#define S_sw_tl 78 /* swallow top left [1] */ +#define S_sw_tc 79 /* swallow top center [2] Order: */ +#define S_sw_tr 80 /* swallow top right [3] */ +#define S_sw_ml 81 /* swallow middle left [4] 1 2 3 */ +#define S_sw_mr 82 /* swallow middle right [6] 4 5 6 */ +#define S_sw_bl 83 /* swallow bottom left [7] 7 8 9 */ +#define S_sw_bc 84 /* swallow bottom center [8] */ +#define S_sw_br 85 /* swallow bottom right [9] */ + +#define S_explode1 86 /* explosion top left */ +#define S_explode2 87 /* explosion top center */ +#define S_explode3 88 /* explosion top right Ex. */ +#define S_explode4 89 /* explosion middle left */ +#define S_explode5 90 /* explosion middle center /-\ */ +#define S_explode6 91 /* explosion middle right |@| */ +#define S_explode7 92 /* explosion bottom left \-/ */ +#define S_explode8 93 /* explosion bottom center */ +#define S_explode9 94 /* explosion bottom right */ /* end effects */ -#define MAXPCHARS 96 /* maximum number of mapped characters */ -#define MAXDCHARS 42 /* maximum of mapped dungeon characters */ -#define MAXTCHARS 22 /* maximum of mapped trap characters */ -#define MAXECHARS 31 /* maximum of mapped effects characters */ -#define MAXEXPCHARS 9 /* number of explosion characters */ +#define MAXPCHARS 96 /* maximum number of mapped characters */ +#define MAXDCHARS 42 /* maximum of mapped dungeon characters */ +#define MAXTCHARS 22 /* maximum of mapped trap characters */ +#define MAXECHARS 31 /* maximum of mapped effects characters */ +#define MAXEXPCHARS 9 /* number of explosion characters */ -#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom) +#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom) struct symdef { uchar sym; - const char *explanation; + 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; + 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 MAXOTHER 2 +#define SYM_BOULDER 0 +#define SYM_INVISIBLE 1 +#define MAXOTHER 2 /* 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 */ - /* 5 free bits */ + 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 */ + /* 5 free bits */ }; /* * Graphics sets for display symbols */ -#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */ -#define PRIMARY 0 /* primary graphics set */ -#define ROGUESET 1 /* rogue graphics set */ -#define NUM_GRAPHICS 2 +#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_UNK 0 +#define H_IBM 1 +#define H_DEC 2 -extern const struct symdef defsyms[MAXPCHARS]; /* defaults */ +extern const struct symdef defsyms[MAXPCHARS]; /* defaults */ extern const struct symdef def_warnsyms[WARNCOUNT]; -extern int currentgraphics; /* from drawing.c */ +extern int currentgraphics; /* from drawing.c */ extern nhsym showsyms[]; -extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ +extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */ #define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht)) /* * 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 */ +#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 */ /* * Some altars are considered as shrines, so we need a flag. */ -#define AM_SHRINE 8 +#define AM_SHRINE 8 /* * Thrones should only be looted once. */ -#define T_LOOTED 1 +#define T_LOOTED 1 /* * Trees have more than one kick result. */ -#define TREE_LOOTED 1 -#define TREE_SWARM 2 +#define TREE_LOOTED 1 +#define TREE_SWARM 2 /* * Fountains have limits, and special warnings. */ -#define F_LOOTED 1 -#define F_WARNED 2 -#define FOUNTAIN_IS_WARNED(x,y) (levl[x][y].looted & F_WARNED) -#define FOUNTAIN_IS_LOOTED(x,y) (levl[x][y].looted & F_LOOTED) -#define SET_FOUNTAIN_WARNED(x,y) levl[x][y].looted |= F_WARNED; -#define SET_FOUNTAIN_LOOTED(x,y) levl[x][y].looted |= F_LOOTED; -#define CLEAR_FOUNTAIN_WARNED(x,y) levl[x][y].looted &= ~F_WARNED; -#define CLEAR_FOUNTAIN_LOOTED(x,y) levl[x][y].looted &= ~F_LOOTED; +#define F_LOOTED 1 +#define F_WARNED 2 +#define FOUNTAIN_IS_WARNED(x, y) (levl[x][y].looted & F_WARNED) +#define FOUNTAIN_IS_LOOTED(x, y) (levl[x][y].looted & F_LOOTED) +#define SET_FOUNTAIN_WARNED(x, y) levl[x][y].looted |= F_WARNED; +#define SET_FOUNTAIN_LOOTED(x, y) levl[x][y].looted |= F_LOOTED; +#define CLEAR_FOUNTAIN_WARNED(x, y) levl[x][y].looted &= ~F_WARNED; +#define CLEAR_FOUNTAIN_LOOTED(x, y) levl[x][y].looted &= ~F_LOOTED; /* * 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! */ -#define D_WARNED 16 +#define D_WARNED 16 /* * Sinks have 3 different types of loot that shouldn't be abused */ -#define S_LPUDDING 1 -#define S_LDWASHER 2 -#define S_LRING 4 +#define S_LPUDDING 1 +#define S_LDWASHER 2 +#define S_LRING 4 /* * The four directions for a DrawBridge. */ -#define DB_NORTH 0 -#define DB_SOUTH 1 -#define DB_EAST 2 -#define DB_WEST 3 -#define DB_DIR 3 /* mask for direction */ +#define DB_NORTH 0 +#define DB_SOUTH 1 +#define DB_EAST 2 +#define DB_WEST 3 +#define DB_DIR 3 /* mask for direction */ /* * What's under a drawbridge. */ -#define DB_MOAT 0 -#define DB_LAVA 4 -#define DB_ICE 8 -#define DB_FLOOR 16 -#define DB_UNDER 28 /* mask for underneath */ +#define DB_MOAT 0 +#define DB_LAVA 4 +#define DB_ICE 8 +#define DB_FLOOR 16 +#define DB_UNDER 28 /* mask for underneath */ /* * Wall information. */ -#define WM_MASK 0x07 /* wall mode (bottom three bits) */ -#define W_NONDIGGABLE 0x08 -#define W_NONPASSWALL 0x10 +#define WM_MASK 0x07 /* wall mode (bottom three bits) */ +#define W_NONDIGGABLE 0x08 +#define W_NONPASSWALL 0x10 /* * Ladders (in Vlad's tower) may be up or down. */ -#define LA_UP 1 -#define LA_DOWN 2 +#define LA_UP 1 +#define LA_DOWN 2 /* * Room areas may be iced pools */ -#define ICED_POOL 8 -#define ICED_MOAT 16 +#define ICED_POOL 8 +#define ICED_MOAT 16 /* * The structure describing a coordinate position. @@ -386,31 +389,34 @@ extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.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 */ - - 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 */ + 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 */ + + 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 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); \ + } \ + } \ + } /* * Add wall angle viewing by defining "modes" for each wall type. Each @@ -450,22 +456,22 @@ struct rm { * 6 bottom left & top right (1/2 rock) */ -#define WM_W_LEFT 1 /* vertical or horizontal wall */ +#define WM_W_LEFT 1 /* vertical or horizontal wall */ #define WM_W_RIGHT 2 #define WM_W_TOP WM_W_LEFT #define WM_W_BOTTOM WM_W_RIGHT -#define WM_C_OUTER 1 /* corner wall */ +#define WM_C_OUTER 1 /* corner wall */ #define WM_C_INNER 2 -#define WM_T_LONG 1 /* T wall */ -#define WM_T_BL 2 -#define WM_T_BR 3 +#define WM_T_LONG 1 /* T wall */ +#define WM_T_BL 2 +#define WM_T_BR 3 -#define WM_X_TL 1 /* cross wall */ -#define WM_X_TR 2 -#define WM_X_BL 3 -#define WM_X_BR 4 +#define WM_X_TL 1 /* cross wall */ +#define WM_X_TR 2 +#define WM_X_BL 3 +#define WM_X_BR 4 #define WM_X_TLBR 5 #define WM_X_BLTR 6 @@ -491,127 +497,124 @@ struct rm { #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 doormask flags -#define altarmask flags -#define wall_info flags -#define ladder flags -#define drawbridgemask flags -#define looted flags -#define icedpool flags - -#define blessedftn horizontal /* a fountain that grants attribs */ -#define disturbed horizontal /* a grave that has been disturbed */ +#define blessedftn horizontal /* a fountain that grants attribs */ +#define disturbed horizontal /* a grave that has been disturbed */ struct damage { - struct damage *next; - long when, cost; - coord place; - schar typ; + struct damage *next; + long when, cost; + coord place; + schar typ; }; /* 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 */ - 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; - boolean bonesknown; + struct cemetery *next; /* next struct is previous dead character... */ + /* "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; + boolean bonesknown; }; struct levelflags { - uchar nfountains; /* number of fountains on level */ - uchar nsinks; /* number of sinks on the level */ - /* Several flags that give hints about what's on the level */ - Bitfield(has_shop, 1); - Bitfield(has_vault, 1); - Bitfield(has_zoo, 1); - Bitfield(has_court, 1); - Bitfield(has_morgue, 1); - Bitfield(has_beehive, 1); - Bitfield(has_barracks, 1); - Bitfield(has_temple, 1); - - Bitfield(has_swamp, 1); - Bitfield(noteleport,1); - Bitfield(hardfloor,1); - Bitfield(nommap,1); - Bitfield(hero_memory,1); /* hero has memory */ - Bitfield(shortsighted,1); /* monsters are shortsighted */ - Bitfield(graveyard,1); /* has_morgue, but remains set */ - Bitfield(sokoban_rules,1); /* fill pits and holes w/ boulders */ - - Bitfield(is_maze_lev,1); - Bitfield(is_cavernous_lev,1); - Bitfield(arboreal, 1); /* Trees replace rock */ - Bitfield(wizard_bones,1); /* set if level came from a bones file - 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 */ + uchar nfountains; /* number of fountains on level */ + uchar nsinks; /* number of sinks on the level */ + /* Several flags that give hints about what's on the level */ + Bitfield(has_shop, 1); + Bitfield(has_vault, 1); + Bitfield(has_zoo, 1); + Bitfield(has_court, 1); + Bitfield(has_morgue, 1); + Bitfield(has_beehive, 1); + Bitfield(has_barracks, 1); + Bitfield(has_temple, 1); + + Bitfield(has_swamp, 1); + Bitfield(noteleport, 1); + Bitfield(hardfloor, 1); + Bitfield(nommap, 1); + Bitfield(hero_memory, 1); /* hero has memory */ + Bitfield(shortsighted, 1); /* monsters are shortsighted */ + Bitfield(graveyard, 1); /* has_morgue, but remains set */ + Bitfield(sokoban_rules, 1); /* fill pits and holes w/ boulders */ + + Bitfield(is_maze_lev, 1); + Bitfield(is_cavernous_lev, 1); + Bitfield(arboreal, 1); /* Trees replace rock */ + Bitfield(wizard_bones, 1); /* set if level came from a bones file + 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 */ }; -typedef struct -{ - struct rm locations[COLNO][ROWNO]; +typedef struct { + struct rm locations[COLNO][ROWNO]; #ifndef MICROPORT_BUG - struct obj *objects[COLNO][ROWNO]; - struct monst *monsters[COLNO][ROWNO]; + 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]; + 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; - struct damage *damagelist; - struct cemetery *bonesinfo; - struct levelflags flags; -} -dlevel_t; + struct obj *objlist; + struct obj *buriedobjlist; + struct monst *monlist; + struct damage *damagelist; + struct cemetery *bonesinfo; + struct levelflags flags; +} dlevel_t; -extern schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */ +extern schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */ -extern dlevel_t level; /* structure describing the current level */ +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 level.locations +#define fobj level.objlist +#define fmon level.monlist /* * Covert 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) (level.objects[x][y] != (struct obj *) 0) /* * Macros for encapsulation of level.monsters references. */ -#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) -#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 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) +#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) +#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 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 diff --git a/include/skills.h b/include/skills.h index e50fd860e..fdbece37b 100644 --- a/include/skills.h +++ b/include/skills.h @@ -11,9 +11,8 @@ * in a separate file so it can be included in objects.c. */ - /* Code to denote that no skill is applicable */ -#define P_NONE 0 +#define P_NONE 0 /* Weapon Skills -- Stephen White * Order matters and are used in macros. @@ -22,61 +21,60 @@ * Update weapon.c if you ammend any skills. * Also used for oc_subtyp. */ -#define P_DAGGER 1 -#define P_KNIFE 2 -#define P_AXE 3 -#define P_PICK_AXE 4 -#define P_SHORT_SWORD 5 -#define P_BROAD_SWORD 6 -#define P_LONG_SWORD 7 -#define P_TWO_HANDED_SWORD 8 -#define P_SCIMITAR 9 -#define P_SABER 10 -#define P_CLUB 11 /* Heavy-shafted bludgeon */ -#define P_MACE 12 -#define P_MORNING_STAR 13 /* Spiked bludgeon */ -#define P_FLAIL 14 /* Two pieces hinged or chained together */ -#define P_HAMMER 15 /* Heavy head on the end */ -#define P_QUARTERSTAFF 16 /* Long-shafted bludgeon */ -#define P_POLEARMS 17 -#define P_SPEAR 18 /* includes javelin */ -#define P_TRIDENT 19 -#define P_LANCE 20 -#define P_BOW 21 -#define P_SLING 22 -#define P_CROSSBOW 23 -#define P_DART 24 -#define P_SHURIKEN 25 -#define P_BOOMERANG 26 -#define P_WHIP 27 -#define P_UNICORN_HORN 28 /* last weapon */ -#define P_FIRST_WEAPON P_DAGGER -#define P_LAST_WEAPON P_UNICORN_HORN +#define P_DAGGER 1 +#define P_KNIFE 2 +#define P_AXE 3 +#define P_PICK_AXE 4 +#define P_SHORT_SWORD 5 +#define P_BROAD_SWORD 6 +#define P_LONG_SWORD 7 +#define P_TWO_HANDED_SWORD 8 +#define P_SCIMITAR 9 +#define P_SABER 10 +#define P_CLUB 11 /* Heavy-shafted bludgeon */ +#define P_MACE 12 +#define P_MORNING_STAR 13 /* Spiked bludgeon */ +#define P_FLAIL 14 /* Two pieces hinged or chained together */ +#define P_HAMMER 15 /* Heavy head on the end */ +#define P_QUARTERSTAFF 16 /* Long-shafted bludgeon */ +#define P_POLEARMS 17 +#define P_SPEAR 18 /* includes javelin */ +#define P_TRIDENT 19 +#define P_LANCE 20 +#define P_BOW 21 +#define P_SLING 22 +#define P_CROSSBOW 23 +#define P_DART 24 +#define P_SHURIKEN 25 +#define P_BOOMERANG 26 +#define P_WHIP 27 +#define P_UNICORN_HORN 28 /* last weapon */ +#define P_FIRST_WEAPON P_DAGGER +#define P_LAST_WEAPON P_UNICORN_HORN /* Spell Skills added by Larry Stewart-Zerba */ -#define P_ATTACK_SPELL 29 -#define P_HEALING_SPELL 30 -#define P_DIVINATION_SPELL 31 +#define P_ATTACK_SPELL 29 +#define P_HEALING_SPELL 30 +#define P_DIVINATION_SPELL 31 #define P_ENCHANTMENT_SPELL 32 -#define P_CLERIC_SPELL 33 -#define P_ESCAPE_SPELL 34 -#define P_MATTER_SPELL 35 -#define P_FIRST_SPELL P_ATTACK_SPELL -#define P_LAST_SPELL P_MATTER_SPELL +#define P_CLERIC_SPELL 33 +#define P_ESCAPE_SPELL 34 +#define P_MATTER_SPELL 35 +#define P_FIRST_SPELL P_ATTACK_SPELL +#define P_LAST_SPELL P_MATTER_SPELL /* Other types of combat */ -#define P_BARE_HANDED_COMBAT 36 /* actually weaponless; gloves are ok */ -#define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */ -#define P_TWO_WEAPON_COMBAT 37 /* Finally implemented */ -#define P_RIDING 38 /* How well you control your steed */ -#define P_LAST_H_TO_H P_RIDING -#define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT +#define P_BARE_HANDED_COMBAT 36 /* actually weaponless; gloves are ok */ +#define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */ +#define P_TWO_WEAPON_COMBAT 37 /* Finally implemented */ +#define P_RIDING 38 /* How well you control your steed */ +#define P_LAST_H_TO_H P_RIDING +#define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT -#define P_NUM_SKILLS (P_LAST_H_TO_H+1) +#define P_NUM_SKILLS (P_LAST_H_TO_H + 1) /* These roles qualify for a martial arts bonus */ -#define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK)) - +#define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK)) /* * These are the standard weapon skill levels. It is important that @@ -85,34 +83,34 @@ * with the current skill-1. To work out for the UNSKILLED case, * a value of 0 needed. */ -#define P_ISRESTRICTED 0 -#define P_UNSKILLED 1 -#define P_BASIC 2 -#define P_SKILLED 3 -#define P_EXPERT 4 -#define P_MASTER 5 /* Unarmed combat/martial arts only */ -#define P_GRAND_MASTER 6 /* Unarmed combat/martial arts only */ +#define P_ISRESTRICTED 0 +#define P_UNSKILLED 1 +#define P_BASIC 2 +#define P_SKILLED 3 +#define P_EXPERT 4 +#define P_MASTER 5 /* Unarmed combat/martial arts only */ +#define P_GRAND_MASTER 6 /* Unarmed combat/martial arts only */ -#define practice_needed_to_advance(level) ((level)*(level)*20) +#define practice_needed_to_advance(level) ((level) * (level) *20) /* The hero's skill in various weapons. */ struct skills { - xchar skill; - xchar max_skill; - unsigned short advance; + xchar skill; + xchar max_skill; + unsigned short advance; }; -#define P_SKILL(type) (u.weapon_skills[type].skill) -#define P_MAX_SKILL(type) (u.weapon_skills[type].max_skill) -#define P_ADVANCE(type) (u.weapon_skills[type].advance) -#define P_RESTRICTED(type) (u.weapon_skills[type].skill == P_ISRESTRICTED) +#define P_SKILL(type) (u.weapon_skills[type].skill) +#define P_MAX_SKILL(type) (u.weapon_skills[type].max_skill) +#define P_ADVANCE(type) (u.weapon_skills[type].advance) +#define P_RESTRICTED(type) (u.weapon_skills[type].skill == P_ISRESTRICTED) -#define P_SKILL_LIMIT 60 /* Max number of skill advancements */ +#define P_SKILL_LIMIT 60 /* Max number of skill advancements */ /* Initial skill matrix structure; used in u_init.c and weapon.c */ struct def_skill { - xchar skill; - xchar skmax; + xchar skill; + xchar skmax; }; -#endif /* SKILLS_H */ +#endif /* SKILLS_H */ diff --git a/include/sp_lev.h b/include/sp_lev.h index c4bc0cd9d..497b1b2fa 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -7,49 +7,50 @@ #ifndef SP_LEV_H #define SP_LEV_H - /* wall directions */ -#define W_NORTH 1 -#define W_SOUTH 2 -#define W_EAST 4 -#define W_WEST 8 -#define W_ANY (W_NORTH|W_SOUTH|W_EAST|W_WEST) - - /* MAP limits */ -#define MAP_X_LIM 76 -#define MAP_Y_LIM 21 - - /* Per level flags */ -#define NOTELEPORT 0x00000001L -#define HARDFLOOR 0x00000002L -#define NOMMAP 0x00000004L -#define SHORTSIGHTED 0x00000008L -#define ARBOREAL 0x00000010L -#define MAZELEVEL 0x00000020L -#define PREMAPPED 0x00000040L /* premapped level & sokoban rules */ -#define SHROUD 0x00000080L -#define GRAVEYARD 0x00000100L -#define ICEDPOOLS 0x00000200L /* for ice locations: ICED_POOL vs ICED_MOAT */ -#define SOLIDIFY 0x00000400L /* outer areas are nondiggable & nonpasswall */ -#define CORRMAZE 0x00000800L /* for maze levels only */ +/* wall directions */ +#define W_NORTH 1 +#define W_SOUTH 2 +#define W_EAST 4 +#define W_WEST 8 +#define W_ANY (W_NORTH | W_SOUTH | W_EAST | W_WEST) + +/* MAP limits */ +#define MAP_X_LIM 76 +#define MAP_Y_LIM 21 + +/* Per level flags */ +#define NOTELEPORT 0x00000001L +#define HARDFLOOR 0x00000002L +#define NOMMAP 0x00000004L +#define SHORTSIGHTED 0x00000008L +#define ARBOREAL 0x00000010L +#define MAZELEVEL 0x00000020L +#define PREMAPPED 0x00000040L /* premapped level & sokoban rules */ +#define SHROUD 0x00000080L +#define GRAVEYARD 0x00000100L +#define ICEDPOOLS 0x00000200L /* for ice locations: ICED_POOL vs ICED_MOAT \ + */ +#define SOLIDIFY 0x00000400L /* outer areas are nondiggable & nonpasswall */ +#define CORRMAZE 0x00000800L /* for maze levels only */ /* different level layout initializers */ -#define LVLINIT_NONE 0 -#define LVLINIT_SOLIDFILL 1 -#define LVLINIT_MAZEGRID 2 -#define LVLINIT_MINES 3 -#define LVLINIT_ROGUE 4 +#define LVLINIT_NONE 0 +#define LVLINIT_SOLIDFILL 1 +#define LVLINIT_MAZEGRID 2 +#define LVLINIT_MINES 3 +#define LVLINIT_ROGUE 4 /* max. layers of object containment */ #define MAX_CONTAINMENT 10 /* max. # of random registers */ -#define MAX_REGISTERS 10 +#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 +#define SPCODER_MAX_RUNTIME 65536 /* Opcodes for creating the level * If you change these, also change opcodestr[] in util/lev_main.c @@ -142,112 +143,118 @@ enum opcode_defs { * mean. */ /* MONSTER */ -#define SP_M_V_PEACEFUL 0 -#define SP_M_V_ALIGN 1 -#define SP_M_V_ASLEEP 2 -#define SP_M_V_APPEAR 3 -#define SP_M_V_NAME 4 - -#define SP_M_V_FEMALE 5 -#define SP_M_V_INVIS 6 -#define SP_M_V_CANCELLED 7 -#define SP_M_V_REVIVED 8 -#define SP_M_V_AVENGE 9 -#define SP_M_V_FLEEING 10 -#define SP_M_V_BLINDED 11 -#define SP_M_V_PARALYZED 12 -#define SP_M_V_STUNNED 13 -#define SP_M_V_CONFUSED 14 -#define SP_M_V_SEENTRAPS 15 - -#define SP_M_V_END 16 /* end of variable parameters */ +#define SP_M_V_PEACEFUL 0 +#define SP_M_V_ALIGN 1 +#define SP_M_V_ASLEEP 2 +#define SP_M_V_APPEAR 3 +#define SP_M_V_NAME 4 + +#define SP_M_V_FEMALE 5 +#define SP_M_V_INVIS 6 +#define SP_M_V_CANCELLED 7 +#define SP_M_V_REVIVED 8 +#define SP_M_V_AVENGE 9 +#define SP_M_V_FLEEING 10 +#define SP_M_V_BLINDED 11 +#define SP_M_V_PARALYZED 12 +#define SP_M_V_STUNNED 13 +#define SP_M_V_CONFUSED 14 +#define SP_M_V_SEENTRAPS 15 + +#define SP_M_V_END 16 /* end of variable parameters */ /* OBJECT */ -#define SP_O_V_SPE 0 -#define SP_O_V_CURSE 1 -#define SP_O_V_CORPSENM 2 -#define SP_O_V_NAME 3 -#define SP_O_V_QUAN 4 -#define SP_O_V_BURIED 5 -#define SP_O_V_LIT 6 -#define SP_O_V_ERODED 7 -#define SP_O_V_LOCKED 8 -#define SP_O_V_TRAPPED 9 -#define SP_O_V_RECHARGED 10 -#define SP_O_V_INVIS 11 -#define SP_O_V_GREASED 12 -#define SP_O_V_BROKEN 13 -#define SP_O_V_COORD 14 -#define SP_O_V_END 15 /* end of variable parameters */ - +#define SP_O_V_SPE 0 +#define SP_O_V_CURSE 1 +#define SP_O_V_CORPSENM 2 +#define SP_O_V_NAME 3 +#define SP_O_V_QUAN 4 +#define SP_O_V_BURIED 5 +#define SP_O_V_LIT 6 +#define SP_O_V_ERODED 7 +#define SP_O_V_LOCKED 8 +#define SP_O_V_TRAPPED 9 +#define SP_O_V_RECHARGED 10 +#define SP_O_V_INVIS 11 +#define SP_O_V_GREASED 12 +#define SP_O_V_BROKEN 13 +#define SP_O_V_COORD 14 +#define SP_O_V_END 15 /* end of variable parameters */ /* When creating objects, we need to know whether * it's a container and/or contents. */ -#define SP_OBJ_CONTENT 0x1 -#define SP_OBJ_CONTAINER 0x2 - +#define SP_OBJ_CONTENT 0x1 +#define SP_OBJ_CONTAINER 0x2 /* SPO_FILTER types */ -#define SPOFILTER_PERCENT 0 -#define SPOFILTER_SELECTION 1 -#define SPOFILTER_MAPCHAR 2 +#define SPOFILTER_PERCENT 0 +#define SPOFILTER_SELECTION 1 +#define SPOFILTER_MAPCHAR 2 /* gradient filter types */ -#define SEL_GRADIENT_RADIAL 0 -#define SEL_GRADIENT_SQUARE 1 +#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 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 0x01000000 -/* Humidity flags for get_location() and friends, used with SP_COORD_PACK_RANDOM() */ -#define DRY 0x1 -#define WET 0x2 -#define HOT 0x4 -#define SOLID 0x8 -#define ANY_LOC 0x10 /* even outside the level */ +/* Humidity flags for get_location() and friends, used with + * SP_COORD_PACK_RANDOM() */ +#define DRY 0x1 +#define WET 0x2 +#define HOT 0x4 +#define SOLID 0x8 +#define ANY_LOC 0x10 /* even outside the level */ #define NO_LOC_WARN 0x20 /* no complaints and set x & y to -1, if no loc */ -#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_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)) +#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)) #define SP_MONST_CLASS(l) (l & 0xff) -#define SP_MONST_PM(l) ((l >> 8) & 0xffff) -#define SP_MONST_PACK(m,c) ((( m ) << 8) + ((char)( c ))) +#define SP_MONST_PM(l) ((l >> 8) & 0xffff) +#define SP_MONST_PACK(m, c) (((m) << 8) + ((char) (c))) -#define SP_OBJ_CLASS(l) (l & 0xff) -#define SP_OBJ_TYP(l) ((l >> 8) & 0xffff) -#define SP_OBJ_PACK(o,c) ((( o ) << 8) + ((char)( c ))) +#define SP_OBJ_CLASS(l) (l & 0xff) +#define SP_OBJ_TYP(l) ((l >> 8) & 0xffff) +#define SP_OBJ_PACK(o, c) (((o) << 8) + ((char) (c))) #define SP_MAPCHAR_TYP(l) (l & 0xff) #define SP_MAPCHAR_LIT(l) ((l >> 8) & 0xff) -#define SP_MAPCHAR_PACK(typ,lit) ((( lit ) << 8) + ((char)( typ ))) - +#define SP_MAPCHAR_PACK(typ, lit) (((lit) << 8) + ((char) (typ))) struct opvar { xchar spovartyp; /* one of SPOVAR_foo */ union { - char *str; - long l; + char *str; + long l; } vardata; }; @@ -256,8 +263,8 @@ struct splev_var { char *name; xchar svtyp; /* SPOVAR_foo */ union { - struct opvar *value; - struct opvar **arrayvalues; + struct opvar *value; + struct opvar **arrayvalues; } data; long array_len; }; @@ -268,7 +275,6 @@ struct splevstack { struct opvar **stackdata; }; - struct sp_frame { struct sp_frame *next; struct splevstack *stack; @@ -276,28 +282,27 @@ struct sp_frame { long n_opcode; }; - struct sp_coder { struct splevstack *stack; struct sp_frame *frame; int premapped; boolean solidify; struct mkroom *croom; - struct mkroom *tmproomlist[MAX_NESTED_ROOMS+1]; - boolean failed_room[MAX_NESTED_ROOMS+1]; + struct mkroom *tmproomlist[MAX_NESTED_ROOMS + 1]; + boolean failed_room[MAX_NESTED_ROOMS + 1]; int n_subroom; boolean exit_script; - int lvl_is_joined; + int lvl_is_joined; - int opcode; /* current opcode */ + int opcode; /* current opcode */ struct opvar *opdat; /* current push data (req. opcode == SPO_PUSH) */ }; /* 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 +#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 @@ -311,33 +316,32 @@ typedef struct { } unpacked_coord; typedef struct { - int cmp_what; - int cmp_val; + int cmp_what; + int cmp_val; } opcmp; typedef struct { - long jmp_target; + long jmp_target; } opjmp; - typedef union str_or_len { - char *str; - int len; + char *str; + int len; } Str_or_Len; typedef struct { - xchar init_style; /* one of LVLINIT_foo */ - long flags; - schar filling; - boolean init_present, padding; - char fg, bg; - boolean smoothed, joined; - xchar lit, walled; - boolean icedpools; + xchar init_style; /* one of LVLINIT_foo */ + long flags; + schar filling; + boolean init_present, padding; + char fg, bg; + boolean smoothed, joined; + xchar lit, walled; + boolean icedpools; } lev_init; typedef struct { - xchar wall, pos, secret, mask; + xchar wall, pos, secret, mask; } room_door; typedef struct { @@ -346,40 +350,41 @@ typedef struct { } trap; typedef struct { - Str_or_Len name, appear_as; - short id; - aligntyp align; + Str_or_Len name, appear_as; + short id; + aligntyp align; packed_coord coord; - xchar x, y, class, appear; - schar peaceful, asleep; - short female, invis, cancelled, revived, avenge, fleeing, blinded, paralyzed, stunned, confused; - long seentraps; - short has_invent; + xchar x, y, class, appear; + schar peaceful, asleep; + short female, invis, cancelled, revived, avenge, fleeing, blinded, + paralyzed, stunned, confused; + long seentraps; + short has_invent; } monster; typedef struct { - Str_or_Len name; - int corpsenm; - short id, spe; + Str_or_Len name; + int corpsenm; + short id, spe; packed_coord coord; - xchar x, y, class, containment; - schar curse_state; - int quan; - short buried; - short lit; - short eroded, locked, trapped, recharged, invis, greased, broken; + xchar x, y, class, containment; + schar curse_state; + int quan; + short buried; + short lit; + short eroded, locked, trapped, recharged, invis, greased, broken; } object; typedef struct { packed_coord coord; - xchar x, y; - aligntyp align; - xchar shrine; + xchar x, y; + aligntyp align; + xchar shrine; } altar; typedef struct { - xchar x1, y1, x2, y2; - xchar rtype, rlit, rirreg; + xchar x1, y1, x2, y2; + xchar rtype, rlit, rirreg; } region; typedef struct { @@ -388,41 +393,45 @@ typedef struct { typedef struct { xchar chance; - xchar x1,y1,x2,y2; + 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; + 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; - } src, dest; + struct { + xchar room; + xchar wall; + xchar 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; + Str_or_Len name; + Str_or_Len parent; + xchar x, y, w, h; + xchar xalign, yalign; + xchar rtype, chance, rlit, filled, joined; } room; typedef struct { - schar zaligntyp; - schar keep_region; - schar halign, valign; - char xsize, ysize; - char **map; + schar zaligntyp; + schar keep_region; + schar halign, valign; + char xsize, ysize; + char **map; } mazepart; typedef struct { @@ -431,16 +440,15 @@ typedef struct { } _opcode; typedef struct { - _opcode *opcodes; - long n_opcodes; + _opcode *opcodes; + long n_opcodes; } sp_lev; typedef struct { - xchar x, y, direction, count, lit; - char typ; + xchar x, y, direction, count, lit; + char typ; } spill; - /* only used by lev_comp */ struct lc_funcdefs_parm { char *name; @@ -476,76 +484,79 @@ struct lc_breakdef { */ #ifdef SPEC_LEV /* compiling lev_comp rather than nethack */ -# ifdef USE_OLDARGS -# undef VA_ARGS -# undef VA_DECL -# undef VA_DECL2 -# undef VA_SHIFT -# define VA_ARGS arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,\ - arg10,arg11,arg12,arg13,arg14 -# define VA_DECL(typ1,var1) (var1,VA_ARGS) \ - typ1 var1; \ - char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9,\ - *arg10,*arg11,*arg12,*arg13,*arg14; { -# define VA_DECL2(typ1,var1,typ2,var2) (var1,var2,VA_ARGS) \ - typ1 var1; typ2 var2; \ - char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9,\ - *arg10,*arg11,*arg12,*arg13,*arg14; { - /* unlike in the core, lev_comp's VA_SHIFT is 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 */ +#ifdef USE_OLDARGS +#undef VA_ARGS +#undef VA_DECL +#undef VA_DECL2 +#undef VA_SHIFT +#define VA_ARGS \ + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, \ + arg12, arg13, arg14 +#define VA_DECL(typ1, var1) \ + (var1, VA_ARGS) typ1 var1; \ + char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9, \ + *arg10, *arg11, *arg12, *arg13, *arg14; \ + { +#define VA_DECL2(typ1, var1, typ2, var2) \ + (var1, var2, VA_ARGS) typ1 var1; \ + typ2 var2; \ + char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9, \ + *arg10, *arg11, *arg12, *arg13, *arg14; \ + { +/* unlike in the core, lev_comp's VA_SHIFT is 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 */ typedef char *Va; -# 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*/ +#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*/ /* You were warned to avert your eyes.... */ #endif /*SPEC_LEV*/ diff --git a/include/spell.h b/include/spell.h index fc3816f9c..7733a0c02 100644 --- a/include/spell.h +++ b/include/spell.h @@ -7,23 +7,23 @@ #ifndef SPELL_H #define SPELL_H -#define NO_SPELL 0 +#define NO_SPELL 0 /* 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 */ + short sp_id; /* spell id (== object.otyp) */ + xchar sp_lev; /* power level */ + int sp_know; /* knowlege of spell */ }; /* levels of memory destruction with a scroll of amnesia */ -#define ALL_MAP 0x1 -#define ALL_SPELLS 0x2 +#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) spl_book[spell].sp_know-- +#define spellid(spell) spl_book[spell].sp_id +#define spellknow(spell) spl_book[spell].sp_know #endif /* SPELL_H */ diff --git a/include/sys.h b/include/sys.h index d58ead5d5..2db949908 100644 --- a/include/sys.h +++ b/include/sys.h @@ -7,40 +7,39 @@ #define SYS_H struct sysopt { - char *support; /* local support contact */ - char *recover; /* how to run recover - may be overridden by win port */ - char *wizards; - char *explorers; - char *shellers; /* like wizards, for ! command (-DSHELL) */ - char *debugfiles; /* files to show debugplines in. '*' is all. */ - int env_dbgfl; /* 1: debugfiles comes from getenv("DEBUGFILES") - * so sysconf's DEBUGFILES shouldn't override it; - * 0: getenv() hasn't been attempted yet; - * -1: getenv() didn't find a value for DEBUGFILES. - */ - int maxplayers; - /* record file */ - int persmax; - int pers_is_uid; - int entrymax; - int pointsmin; - int tt_oname_maxrank; + char *support; /* local support contact */ + char *recover; /* how to run recover - may be overridden by win port */ + char *wizards; + char *explorers; + char *shellers; /* like wizards, for ! command (-DSHELL) */ + char *debugfiles; /* files to show debugplines in. '*' is all. */ + int env_dbgfl; /* 1: debugfiles comes from getenv("DEBUGFILES") + * so sysconf's DEBUGFILES shouldn't override it; + * 0: getenv() hasn't been attempted yet; + * -1: getenv() didn't find a value for DEBUGFILES. + */ + int maxplayers; + /* record file */ + int persmax; + int pers_is_uid; + int entrymax; + int pointsmin; + int tt_oname_maxrank; #ifdef PANICTRACE - /* panic options */ - char *gdbpath; - char *greppath; - int panictrace_gdb; -# ifdef PANICTRACE_LIBC - int panictrace_libc; -# endif + /* panic options */ + char *gdbpath; + char *greppath; + int panictrace_gdb; +#ifdef PANICTRACE_LIBC + int panictrace_libc; #endif - int seduce; - int check_save_uid; /* restoring savefile checks UID? */ +#endif + int seduce; + int check_save_uid; /* restoring savefile checks UID? */ }; -extern struct sysopt sysopt; +extern struct sysopt sysopt; #define SYSOPT_SEDUCE sysopt.seduce #endif /* SYS_H */ - diff --git a/include/system.h b/include/system.h index 2ba65b111..cefa52409 100644 --- a/include/system.h +++ b/include/system.h @@ -17,35 +17,36 @@ #if (defined(VMS) && !defined(__GNUC__)) || defined(MAC) #include #else -# ifndef AMIGA +#ifndef AMIGA #include -# endif +#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(_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 */ +#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 +#define time_t long #endif #if defined(ULTRIX) || defined(VMS) -# define off_t long +#define off_t long #endif #if defined(AZTEC) || defined(THINKC4) || defined(__TURBOC__) -typedef long off_t; +typedef long off_t; #endif #endif /* !__cplusplus && !__GO32__ */ @@ -54,94 +55,96 @@ typedef long off_t; * 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) +#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 +#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 +#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 (*)() +#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) +#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__) +#else +#if !defined(bsdi) && !defined(__FreeBSD__) E int FDECL(srandom, (unsigned int)); -# endif -# endif +#endif +#endif #else E long lrand48(); E void srand48(); #endif /* BSD || ULTRIX || RANDOM */ #if !defined(BSD) || defined(ultrix) - /* real BSD wants all these to return int */ -# ifndef MICRO +/* real BSD wants all these to return int */ +#ifndef MICRO E void FDECL(exit, (int)); -# endif /* MICRO */ +#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 +#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 +#endif +#endif +#endif #if !defined(__SASC_60) && !defined(_DCC) && !defined(__SC__) -# if defined(AMIGA) && !defined(AZTEC_50) && !defined(__GNUC__) +#if defined(AMIGA) && !defined(AZTEC_50) && !defined(__GNUC__) E int FDECL(perror, (const char *)); -# else -# if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) +#else +#if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) E void FDECL(perror, (const char *)); -# endif -# endif +#endif +#endif #endif #endif #ifndef NeXT #ifdef POSIX_TYPES -E void FDECL(qsort, (genericptr_t,size_t,size_t, - int(*)(const genericptr,const genericptr))); +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 +#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 */ @@ -149,76 +152,76 @@ E void FDECL(qsort, (genericptr_t,size_t,size_t, #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 -# ifndef bsdi -E long FDECL(lseek, (int,long,int)); -# endif -# if defined(POSIX_TYPES) || defined(__TURBOC__) -# ifndef bsdi -E int FDECL(write, (int, const void *,unsigned)); -# endif -# else -# ifndef __MWERKS__ /* metrowerks defines write via universal headers */ -E int FDECL(write, (int,genericptr_t,unsigned)); -# endif -# endif -# endif /* ULTRIX */ - -# ifdef OS2_CSET2 /* IBM CSet/2 */ -# ifdef OS2_CSET2_VER_1 +#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 +#ifndef bsdi +E long FDECL(lseek, (int, long, int)); +#endif +#if defined(POSIX_TYPES) || defined(__TURBOC__) +#ifndef bsdi +E int FDECL(write, (int, const void *, unsigned)); +#endif +#else +#ifndef __MWERKS__ /* metrowerks defines write via universal headers */ +E int FDECL(write, (int, genericptr_t, unsigned)); +#endif +#endif +#endif /* ULTRIX */ + +#ifdef OS2_CSET2 /* IBM CSet/2 */ +#ifdef OS2_CSET2_VER_1 E int FDECL(unlink, (char *)); -# else +#else E int FDECL(unlink, (const char *)); /* prototype is ok in ver >= 2 */ -# endif -# else -# ifndef __SC__ +#endif +#else +#ifndef __SC__ E int FDECL(unlink, (const char *)); -# endif -# endif +#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 */ +#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)); +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)); +E int FDECL(read, (int, genericptr_t, unsigned int)); #endif -E int FDECL(open, (const char *,int,...)); +E int FDECL(open, (const char *, int, ...)); E int FDECL(dup2, (int, int)); -E int FDECL(setmode, (int,int)); +E int FDECL(setmode, (int, int)); E int NDECL(kbhit); -# if !defined(_DCC) -# if defined(__TURBOC__) +#if !defined(_DCC) +#if defined(__TURBOC__) E int FDECL(chdir, (const char *)); -# else -# ifndef __EMX__ +#else +#ifndef __EMX__ E int FDECL(chdir, (char *)); -# endif -# endif -# ifndef __EMX__ -E char *FDECL(getcwd, (char *,int)); -# endif -# endif /* !_DCC */ +#endif +#endif +#ifndef __EMX__ +E char *FDECL(getcwd, (char *, int)); +#endif +#endif /* !_DCC */ #endif #ifdef ULTRIX @@ -226,66 +229,66 @@ 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)); +#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)); +#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 */ +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__) +#if defined(ULTRIX_PROTO) || defined(__GNUC__) E int NDECL(fork); -# else +#else E long NDECL(fork); -# endif +#endif #endif /* ULTRIX */ #ifdef VMS -# ifndef abs +#ifndef abs E int FDECL(abs, (int)); -# endif +#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 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)); +#else +E int FDECL(chmod, (const char *, int)); E int FDECL(umask, (int)); -# endif +#endif /* #include */ E int FDECL(close, (int)); -E int VDECL(creat, (const char *,unsigned,...)); +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 long FDECL(lseek, (int,long,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)); +E int FDECL(fstat, (/*_ int, stat_t * _*/)); +E int FDECL(isatty, (int)); /* 1==yes, 0==no, -1==error */ +E long FDECL(lseek, (int, long, 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 */ +#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 +#ifdef ULTRIX E int FDECL(system, (const char *)); -# ifndef _UNISTD_H_ +#ifndef _UNISTD_H_ E int FDECL(execl, (const char *, ...)); -# endif -# endif +#endif +#endif #endif #ifdef MICRO E void NDECL(abort); @@ -301,52 +304,52 @@ E long NDECL(fork); #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)); +#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*() */ +#endif +#else +#ifndef memcmp /* some systems seem to macro these back to b*() */ E int memcmp(); -# endif -# ifndef memcpy +#endif +#ifndef memcpy E char *memcpy(); -# endif -# ifndef memset +#endif +#ifndef memset E char *memset(); -# endif -# endif +#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 +#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)); +#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 */ +#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 */ +#if defined(BSD) && defined(ultrix) /* i.e., old versions of Ultrix */ E void sleep(); #endif #if defined(ULTRIX) || defined(SYSV) @@ -366,30 +369,30 @@ E long NDECL(getuid); E long NDECL(getgid); E long NDECL(getpid); #else -# ifdef POSIX_TYPES +#ifdef POSIX_TYPES E pid_t NDECL(getpid); E uid_t NDECL(getuid); E gid_t NDECL(getgid); -# ifdef VMS +#ifdef VMS E pid_t NDECL(getppid); -# endif -# else /*!POSIX_TYPES*/ -# ifndef getpid /* Borland C defines getpid() as a macro */ +#endif +#else /*!POSIX_TYPES*/ +#ifndef getpid /* Borland C defines getpid() as a macro */ E int NDECL(getpid); -# endif -# ifdef VMS +#endif +#ifdef VMS E int NDECL(getppid); E unsigned NDECL(getuid); E unsigned NDECL(getgid); -# endif -# if defined(ULTRIX) && !defined(_UNISTD_H_) +#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)*/ +#endif +#endif /*?POSIX_TYPES*/ +#endif /*?(HPUX && !_POSIX_SOURCE)*/ /* add more architectures as needed */ #if defined(HPUX) @@ -403,40 +406,41 @@ E int FDECL(setuid, (int)); #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 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 */ +#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 */ +#endif /* !_XtIntrinsic_h_ && !POSIX_TYPES */ #if defined(ULTRIX) && defined(__GNUC__) -E char *FDECL(index, (const char *,int)); -E char *FDECL(rindex, (const char *,int)); +E char *FDECL(index, (const char *, int)); +E char *FDECL(rindex, (const char *, int)); #endif /* Old varieties of BSD have char *sprintf(). @@ -454,63 +458,62 @@ E char *FDECL(rindex, (const char *,int)); #define SPRINTF_PROTO #endif #if defined(TOS) || defined(AZTEC_50) || defined(__sgi) || defined(__GNUC__) - /* problem with prototype mismatches */ +/* problem with prototype mismatches */ #define SPRINTF_PROTO #endif #if defined(__MWERKS__) || defined(__SC__) - /* Metrowerks already has a prototype for sprintf() */ -# define SPRINTF_PROTO +/* 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 +#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 +#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) */ +#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 -# define vprintf printf -# define vfprintf fprintf -# define vsprintf sprintf -# endif +#endif +#endif +#endif +#else +#define vprintf printf +#define vfprintf fprintf +#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(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)); +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 +#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)); +E char *FDECL(tgetstr, (const char *, char **)); +E char *FDECL(tgoto, (const char *, int, int)); #endif #ifdef ALLOC_C @@ -519,32 +522,33 @@ E genericptr_t FDECL(malloc, (size_t)); /* time functions */ -# ifndef LATTICE -# if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) +#ifndef LATTICE +#if !(defined(ULTRIX_PROTO) && defined(__GNUC__)) E struct tm *FDECL(localtime, (const time_t *)); -# endif -# endif +#endif +#endif -# if defined(ULTRIX) || (defined(BSD) && defined(POSIX_TYPES)) || defined(SYSV) || defined(MICRO) || defined(VMS) || defined(MAC) || (defined(HPUX) && defined(_POSIX_SOURCE)) +#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 +#else E long FDECL(time, (time_t *)); -# endif /* ULTRIX */ +#endif /* ULTRIX */ #ifdef VMS - /* used in makedefs.c, but missing from gcc-vms's */ +/* 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 +#ifdef abs +#undef abs +#endif E int FDECL(abs, (int)); -# ifdef atoi -# undef atoi -# endif +#ifdef atoi +#undef atoi +#endif E int FDECL(atoi, (const char *)); #endif diff --git a/include/tcap.h b/include/tcap.h index bbf770da6..2d2c25c28 100644 --- a/include/tcap.h +++ b/include/tcap.h @@ -10,20 +10,20 @@ #define TCAP_H #ifndef MICRO -# define TERMLIB /* include termcap code */ +#define TERMLIB /* include termcap code */ #endif /* might display need graphics code? */ #if !defined(AMIGA) && !defined(TOS) && !defined(MAC) -# if defined(TERMLIB) || defined(OS2) || defined(MSDOS) -# define ASCIIGRAPH -# endif +#if defined(TERMLIB) || defined(OS2) || defined(MSDOS) +#define ASCIIGRAPH +#endif #endif #ifndef DECL_H -extern struct tc_gbl_data { /* also declared in decl.h; defined in decl.c */ - char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */ - int tc_LI, tc_CO; /* lines and columns */ +extern struct tc_gbl_data { /* also declared in decl.h; defined in decl.c */ + 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 @@ -31,7 +31,7 @@ extern struct tc_gbl_data { /* also declared in decl.h; defined in decl.c */ #define CO tc_gbl_data.tc_CO #endif -extern struct tc_lcl_data { /* defined and set up in termcap.c */ +extern struct tc_lcl_data { /* defined and set up in termcap.c */ char *tc_CM, *tc_ND, *tc_CD; char *tc_HI, *tc_HE, *tc_US, *tc_UE; boolean tc_ul_hack; @@ -46,14 +46,14 @@ extern struct tc_lcl_data { /* defined and set up in termcap.c */ #define nh_UE tc_lcl_data.tc_UE #define ul_hack tc_lcl_data.tc_ul_hack -extern short ospeed; /* set up in termcap.c */ +extern short ospeed; /* set up in termcap.c */ #ifdef TEXTCOLOR -# ifdef TOS +#ifdef TOS extern const char *hilites[CLR_MAX]; -# else +#else extern NEARDATA char *hilites[CLR_MAX]; -# endif +#endif #endif #endif /* TCAP_H */ diff --git a/include/tile2x11.h b/include/tile2x11.h index 1deff779b..6a6351be3 100644 --- a/include/tile2x11.h +++ b/include/tile2x11.h @@ -21,4 +21,4 @@ typedef struct { /* how wide each row in the tile file is, in tiles */ #define TILES_PER_ROW (40) -#endif /* TILE2X11_H */ +#endif /* TILE2X11_H */ diff --git a/include/timeout.h b/include/timeout.h index 638e59242..dff3f9eb0 100644 --- a/include/timeout.h +++ b/include/timeout.h @@ -11,37 +11,37 @@ typedef void FDECL((*timeout_proc), (ANY_P *, long)); /* kind of timer */ -#define TIMER_LEVEL 0 /* event specific to level */ -#define TIMER_GLOBAL 1 /* event follows current play */ -#define TIMER_OBJECT 2 /* event follows a object */ -#define TIMER_MONSTER 3 /* event follows a monster */ +#define TIMER_LEVEL 0 /* event specific to level */ +#define TIMER_GLOBAL 1 /* event follows current play */ +#define TIMER_OBJECT 2 /* event follows a object */ +#define TIMER_MONSTER 3 /* event follows a monster */ /* save/restore timer ranges */ -#define RANGE_LEVEL 0 /* save/restore timers staying on level */ -#define RANGE_GLOBAL 1 /* save/restore timers following global play */ +#define RANGE_LEVEL 0 /* save/restore timers staying on level */ +#define RANGE_GLOBAL 1 /* save/restore timers following global play */ /* * Timeout functions. Add a define here, then put it in the table * in timeout.c. "One more level of indirection will fix everything." */ -#define ROT_ORGANIC 0 /* for buried organics */ -#define ROT_CORPSE 1 -#define REVIVE_MON 2 -#define BURN_OBJECT 3 -#define HATCH_EGG 4 -#define FIG_TRANSFORM 5 -#define MELT_ICE_AWAY 6 -#define NUM_TIME_FUNCS 7 +#define ROT_ORGANIC 0 /* for buried organics */ +#define ROT_CORPSE 1 +#define REVIVE_MON 2 +#define BURN_OBJECT 3 +#define HATCH_EGG 4 +#define FIG_TRANSFORM 5 +#define MELT_ICE_AWAY 6 +#define NUM_TIME_FUNCS 7 /* used in timeout.c */ typedef struct fe { - struct fe *next; /* next item in chain */ - long timeout; /* when we time out */ - unsigned long tid; /* timer ID */ - short kind; /* kind of use */ - short func_index; /* what to call when we time out */ - anything arg; /* pointer to timeout argument */ - Bitfield (needs_fixup,1); /* does arg need to be patched? */ + struct fe *next; /* next item in chain */ + long timeout; /* when we time out */ + unsigned long tid; /* timer ID */ + short kind; /* kind of use */ + short func_index; /* what to call when we time out */ + anything arg; /* pointer to timeout argument */ + Bitfield(needs_fixup, 1); /* does arg need to be patched? */ } timer_element; #endif /* TIMEOUT_H */ diff --git a/include/tosconf.h b/include/tosconf.h index 2213cfc80..4c425011b 100644 --- a/include/tosconf.h +++ b/include/tosconf.h @@ -8,7 +8,7 @@ #ifndef TOSCONF_H #define TOSCONF_H -#define MICRO /* must be defined to allow some inclusions */ +#define MICRO /* must be defined to allow some inclusions */ /* Adjust these options to suit your compiler. The default here is for @@ -17,36 +17,36 @@ /*#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 */ +#define MINT /* library supports MiNT extensions to TOS */ #ifdef __MINT__ #define MINT #endif #ifdef O_BINARY -#define FCMASK O_BINARY +#define FCMASK O_BINARY #else -#define FCMASK 0660 +#define FCMASK 0660 #define O_BINARY 0 #endif #ifdef UNIXDEBUG -#define remove(x) unlink(x) +#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 */ +#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 */ +#define SUSPEND /* allow suspending the game */ #endif #ifndef TERMLIB -#define ANSI_DEFAULT /* use vt52 by default */ +#define ANSI_DEFAULT /* use vt52 by default */ #endif #if defined(__GNUC__) || defined(__MINT__) @@ -56,8 +56,8 @@ */ #define STRNCMPI #undef strcmpi -extern int FDECL(strcmpi,(const char *, const char *)); -extern int FDECL(strncmpi,(const char *, const char *, size_t)); +extern int FDECL(strcmpi, (const char *, const char *)); +extern int FDECL(strncmpi, (const char *, const char *, size_t)); #endif #include @@ -73,15 +73,15 @@ extern int FDECL(strncmpi,(const char *, const char *, size_t)); #include "micro.h" #endif #ifndef PCCONF_H -#include "pcconf.h" /* remainder of stuff is same as the PC */ +#include "pcconf.h" /* remainder of stuff is same as the PC */ #endif #ifdef TEXTCOLOR -extern boolean colors_changed; /* in tos.c */ +extern boolean colors_changed; /* in tos.c */ #endif #ifdef __GNUC__ -#define GCC_BUG /* correct a gcc bug involving double for loops */ +#define GCC_BUG /* correct a gcc bug involving double for loops */ #endif #endif /* TOSCONF_H */ diff --git a/include/tradstdc.h b/include/tradstdc.h index 64585517d..d8ea8b3bb 100644 --- a/include/tradstdc.h +++ b/include/tradstdc.h @@ -28,12 +28,12 @@ /* Ultrix seems to be in a constant state of flux. This check attempts to * set up ansi compatibility if it wasn't set up correctly by the compiler. */ -# ifdef mips -# define __mips mips -# endif -# ifdef LANGUAGE_C -# define __LANGUAGE_C LANGUAGE_C -# endif +#ifdef mips +#define __mips mips +#endif +#ifdef LANGUAGE_C +#define __LANGUAGE_C LANGUAGE_C +#endif #endif /* @@ -51,87 +51,109 @@ * others. */ -/* #define USE_VARARGS */ /* use instead of */ -/* #define USE_OLDARGS */ /* don't use any variable argument facilites */ +/* #define USE_VARARGS */ /* use instead of */ +/* #define USE_OLDARGS */ /* don't use any variable argument facilites */ -#if defined(apollo) /* Apollos have stdarg(3) but not stdarg.h */ -# define USE_VARARGS +#if defined(apollo) /* Apollos have stdarg(3) but not stdarg.h */ +#define USE_VARARGS #endif #if defined(NHSTDC) || defined(ULTRIX_PROTO) || defined(MAC) -# if !defined(USE_VARARGS) && !defined(USE_OLDARGS) && !defined(USE_STDARG) -# define USE_STDARG -# endif +#if !defined(USE_VARARGS) && !defined(USE_OLDARGS) && !defined(USE_STDARG) +#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 - * 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 - * would look less strange, where VA_DECL() appeared to introduce a - * 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) - 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() - * 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. - */ +#ifdef NEED_VARARGS /* only define these if necessary */ + /* + * These have changed since 3.4.3. VA_END() now provides an explicit + * 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 + * would look less strange, where VA_DECL() appeared to introduce a + * 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) + 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() + * 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. + */ #ifdef USE_STDARG #include -# define VA_DECL(typ1,var1) (typ1 var1, ...) { va_list the_args; -# define VA_DECL2(typ1,var1,typ2,var2) \ - (typ1 var1, typ2 var2, ...) { va_list the_args; -# define VA_INIT(var1,typ1) -# define VA_NEXT(var1,typ1) var1 = va_arg(the_args, typ1) -# define VA_ARGS the_args -# define VA_START(x) va_start(the_args, x) -# define VA_END() va_end(the_args); } -# if defined(ULTRIX_PROTO) && !defined(_VA_LIST_) -# define _VA_LIST_ /* prevents multiple def in stdio.h */ -# endif +#define VA_DECL(typ1, var1) \ + (typ1 var1, ...) \ + { \ + va_list the_args; +#define VA_DECL2(typ1, var1, typ2, var2) \ + (typ1 var1, typ2 var2, ...) \ + { \ + va_list the_args; +#define VA_INIT(var1, typ1) +#define VA_NEXT(var1, typ1) var1 = va_arg(the_args, typ1) +#define VA_ARGS the_args +#define VA_START(x) va_start(the_args, x) +#define VA_END() \ + va_end(the_args); \ + } +#if defined(ULTRIX_PROTO) && !defined(_VA_LIST_) +#define _VA_LIST_ /* prevents multiple def in stdio.h */ +#endif #else -# ifdef USE_VARARGS +#ifdef USE_VARARGS #include -# define VA_DECL(typ1,var1) (va_alist) va_dcl {\ - va_list the_args; typ1 var1; -# define VA_DECL2(typ1,var1,typ2,var2) (va_alist) va_dcl {\ - va_list the_args; typ1 var1; typ2 var2; -# define VA_ARGS the_args -# define VA_START(x) va_start(the_args) -# define VA_INIT(var1,typ1) var1 = va_arg(the_args, typ1) -# define VA_NEXT(var1,typ1) var1 = va_arg(the_args,typ1) -# define VA_END() va_end(the_args); } -# else -# define VA_ARGS arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9 -# define VA_DECL(typ1,var1) (var1,VA_ARGS) typ1 var1; \ - char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9; { -# define VA_DECL2(typ1,var1,typ2,var2) (var1,var2,VA_ARGS) \ - typ1 var1; typ2 var2; \ - char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9; { -# define VA_START(x) -# define VA_INIT(var1,typ1) - /* this is inherently risky, and should only be attempted as a - very last resort; manipulating arguments which haven't actually - been passed may or may not cause severe trouble depending on - the function-calling/argument-passing mechanism being used */ -# define VA_SHIFT() (arg1=arg2, arg2=arg3, arg3=arg4, arg4=arg5,\ - arg5=arg6, arg6=arg7, arg7=arg8, arg8=arg9) -# define VA_NEXT(var1,typ1) ((var1 = (typ1)arg1), VA_SHIFT(), var1) -# define VA_END() } -# endif +#define VA_DECL(typ1, var1) \ + (va_alist) va_dcl \ + { \ + va_list the_args; \ + typ1 var1; +#define VA_DECL2(typ1, var1, typ2, var2) \ + (va_alist) va_dcl \ + { \ + va_list the_args; \ + typ1 var1; \ + typ2 var2; +#define VA_ARGS the_args +#define VA_START(x) va_start(the_args) +#define VA_INIT(var1, typ1) var1 = va_arg(the_args, typ1) +#define VA_NEXT(var1, typ1) var1 = va_arg(the_args, typ1) +#define VA_END() \ + va_end(the_args); \ + } +#else +#define VA_ARGS arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 +#define VA_DECL(typ1, var1) \ + (var1, VA_ARGS) typ1 var1; \ + char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9; \ + { +#define VA_DECL2(typ1, var1, typ2, var2) \ + (var1, var2, VA_ARGS) typ1 var1; \ + typ2 var2; \ + char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9; \ + { +#define VA_START(x) +#define VA_INIT(var1, typ1) +/* this is inherently risky, and should only be attempted as a + very last resort; manipulating arguments which haven't actually + been passed may or may not cause severe trouble depending on + the function-calling/argument-passing mechanism being used */ +#define VA_SHIFT() \ + (arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \ + arg6 = arg7, arg7 = arg8, arg8 = arg9) +#define VA_NEXT(var1, typ1) ((var1 = (typ1) arg1), VA_SHIFT(), var1) +#define VA_END() } +#endif #endif #endif /* NEED_VARARGS */ -#if defined(NHSTDC) || defined(MSDOS) || defined(MAC) || defined(ULTRIX_PROTO) || defined(__BEOS__) +#if defined(NHSTDC) || defined(MSDOS) || defined(MAC) \ + || defined(ULTRIX_PROTO) || defined(__BEOS__) /* * Used for robust ANSI parameter forward declarations: @@ -145,15 +167,15 @@ void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace * trampoli.* mechanism conflicts with the ANSI <> syntax. */ -# define NDECL(f) f(void) /* overridden later if USE_TRAMPOLI set */ +#define NDECL(f) f(void) /* overridden later if USE_TRAMPOLI set */ -# define FDECL(f,p) f p +#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 +#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 @@ -163,23 +185,23 @@ void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace #define VOID_ARGS void /* generic pointer, always a macro; genericptr_t is usually a typedef */ -# define genericptr void * +#define genericptr void * -# if (defined(ULTRIX_PROTO) && !defined(__GNUC__)) || defined(OS2_CSET2) +#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 +#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. @@ -187,39 +209,40 @@ void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace * 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 +#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 */ +#else /* NHSTDC */ /* a "traditional" C compiler */ -# define NDECL(f) f() -# define FDECL(f,p) f() -# define VDECL(f,p) f() +#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 +#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 +#define signed +#define const +#define volatile #endif /* NHSTDC */ #ifndef genericptr_t -typedef genericptr genericptr_t; /* (void *) or (char *) */ +typedef genericptr genericptr_t; /* (void *) or (char *) */ #endif #if defined(MICRO) || defined(WIN32) @@ -230,7 +253,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ * computers which may have older libraries give reasonable results with * casting pointers to unsigned long int (fmt_ptr() in alloc.c). */ -# define HAS_PTR_FMT +#define HAS_PTR_FMT #endif /* @@ -242,61 +265,61 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ * prototypes to match the standard and thus lose the typechecking. */ #if defined(MSDOS) && !defined(__GO32__) -# define UNWIDENED_PROTOTYPES +#define UNWIDENED_PROTOTYPES #endif #if defined(AMIGA) && !defined(AZTEC_50) -# define UNWIDENED_PROTOTYPES +#define UNWIDENED_PROTOTYPES #endif #if defined(macintosh) && (defined(__SC__) || defined(__MRC__)) -# define WIDENED_PROTOTYPES +#define WIDENED_PROTOTYPES #endif #if defined(__MWERKS__) && defined(__BEOS__) -# define UNWIDENED_PROTOTYPES +#define UNWIDENED_PROTOTYPES #endif #if defined(WIN32) -# define UNWIDENED_PROTOTYPES +#define UNWIDENED_PROTOTYPES #endif #if defined(ULTRIX_PROTO) && defined(ULTRIX_CC20) -# define UNWIDENED_PROTOTYPES +#define UNWIDENED_PROTOTYPES #endif #if defined(apollo) -# define UNWIDENED_PROTOTYPES +#define UNWIDENED_PROTOTYPES #endif #ifndef UNWIDENED_PROTOTYPES -# if defined(NHSTDC) || defined(ULTRIX_PROTO) || defined(THINK_C) -# ifndef WIDENED_PROTOTYPES -# define WIDENED_PROTOTYPES -# endif -# endif +#if defined(NHSTDC) || defined(ULTRIX_PROTO) || defined(THINK_C) +#ifndef WIDENED_PROTOTYPES +#define WIDENED_PROTOTYPES +#endif +#endif #endif /* These are used for arguments within FDECL/VDECL prototype declarations. */ #ifdef UNWIDENED_PROTOTYPES -# define CHAR_P char -# define SCHAR_P schar -# define UCHAR_P uchar -# define XCHAR_P xchar -# define SHORT_P short -# ifndef SKIP_BOOLEAN -# define BOOLEAN_P boolean -# endif -# define ALIGNTYP_P aligntyp +#define CHAR_P char +#define SCHAR_P schar +#define UCHAR_P uchar +#define XCHAR_P xchar +#define SHORT_P short +#ifndef SKIP_BOOLEAN +#define BOOLEAN_P boolean +#endif +#define ALIGNTYP_P aligntyp +#else +#ifdef WIDENED_PROTOTYPES +#define CHAR_P int +#define SCHAR_P int +#define UCHAR_P int +#define XCHAR_P int +#define SHORT_P int +#define BOOLEAN_P int +#define ALIGNTYP_P int #else -# ifdef WIDENED_PROTOTYPES -# define CHAR_P int -# define SCHAR_P int -# define UCHAR_P int -# define XCHAR_P int -# define SHORT_P int -# define BOOLEAN_P int -# 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. */ -# endif +/* Neither widened nor unwidened prototypes. Argument list expansion + * by FDECL/VDECL always empty; all xxx_P vanish so defs aren't needed. */ +#endif #endif /* OBJ_P and MONST_P should _only_ be used for declaring function pointers. @@ -307,11 +330,11 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ * but both seem to work if we put "void*" in the prototype instead. This * gives us minimal prototype checking but avoids the compiler bugs. */ -# define OBJ_P void* -# define MONST_P void* +#define OBJ_P void * +#define MONST_P void * #else -# define OBJ_P struct obj * -# define MONST_P struct monst * +#define OBJ_P struct obj * +#define MONST_P struct monst * #endif #if 0 @@ -328,43 +351,41 @@ 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*/ +#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 - - /* MetaWare High-C defaults to unsigned chars */ - /* AIX 3.2 needs this also */ +/* MetaWare High-C defaults to unsigned chars */ +/* AIX 3.2 needs this also */ #if defined(__HC__) || defined(_AIX32) -# undef signed +#undef signed #endif - /* * Allow gcc2 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 -# define PRINTF_F(f,v) __attribute__ ((format (printf, f, v))) -# endif -# if __GNUC__ >= 3 -# define UNUSED __attribute__ ((unused)) -# endif +#if __GNUC__ >= 2 +#define PRINTF_F(f, v) __attribute__((format(printf, f, v))) +#endif +#if __GNUC__ >= 3 +#define UNUSED __attribute__((unused)) +#endif #endif #ifndef PRINTF_F -# define PRINTF_F(f,v) +#define PRINTF_F(f, v) #endif #ifndef UNUSED -# define UNUSED +#define UNUSED #endif #endif /* TRADSTDC_H */ diff --git a/include/trampoli.h b/include/trampoli.h index 626a06ae7..8fc95856f 100644 --- a/include/trampoli.h +++ b/include/trampoli.h @@ -10,322 +10,280 @@ #ifdef USE_TRAMPOLI /* ### apply.c ### */ -#define dig() dig_() +#define dig() dig_() #define doapply() doapply_() -#define dojump() dojump_() -#define dorub() dorub_() - +#define dojump() dojump_() +#define dorub() dorub_() /* ### artifact.c ### */ -#define doinvoke() doinvoke_() - +#define doinvoke() doinvoke_() /* ### cmd.c ### */ -#define doextcmd() doextcmd_() -#define doextlist() doextlist_() -#define domonability() domonability_() +#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_() +#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_() - +#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 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 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 doputon() doputon_() +#define doremring() doremring_() +#define dotakeoff() dotakeoff_() +#define dowear() dowear_() #define select_off(x) select_off_(x) -#define take_off() take_off_() - +#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_() - +#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 done1(sig) done1_(sig) +#define done2() done2_() #define done_intr(sig) done_intr_(sig) -#if defined(UNIX) || defined (VMS) || defined(__EMX__) +#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 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 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 +#ifdef SUSPEND #define dosuspend() dosuspend_() -# endif /* SUSPEND */ +#endif /* SUSPEND */ #endif /* UNIX */ - /* ### lock.c ### */ -#define doclose() doclose_() -#define doforce() doforce_() -#define doopen() doopen_() +#define doclose() doclose_() +#define doforce() doforce_() +#define doopen() doopen_() #define forcelock() forcelock_() -#define picklock() picklock_() - +#define picklock() picklock_() /* ### mklev.c ### */ -#define do_comp(x, y) comp_(x, y) - +#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) - +#define doname(x) doname_(x) +#define xname(x) xname_(x) /* ### options.c ### */ -#define doset() doset_() +#define doset() doset_() #define dotogglepickup() dotogglepickup_() - /* ### pager.c ### */ -#define dohelp() dohelp_() -#define dohistory() dohistory_() +#define dohelp() dohelp_() +#define dohistory() dohistory_() #ifdef UNIX -#define intruph() intruph_() +#define intruph() intruph_() #endif /* UNIX */ #define dowhatdoes() dowhatdoes_() -#define dowhatis() dowhatis_() -#define doquickwhatis() doquickwhatis_() - +#define dowhatis() dowhatis_() +#define doquickwhatis() doquickwhatis_() /* ### pcsys.c ### */ #ifdef SHELL -#define dosh() dosh_() +#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 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_() - +#define dodip() dodip_() /* ### pray.c ### */ -#define doturn() doturn_() -#define dopray() dopray_() +#define doturn() doturn_() +#define dopray() dopray_() #define prayer_done() prayer_done_() #define dosacrifice() dosacrifice_() - /* ### read.c ### */ -#define doread() doread_() +#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__) +#if defined(UNIX) || defined(VMS) || defined(__EMX__) #define hangup(sig) hangup_(sig) #endif - /* ### search.c ### */ -#define doidtrap() doidtrap_() -#define dosearch() dosearch_() +#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 learn() learn_() +#define docast() docast_() #define dovspell() dovspell_() - /* ### steal.c ### */ #define stealarm() stealarm_() - /* ### trap.c ### */ -#define dotele() dotele_() -#define dountrap() dountrap_() +#define dotele() dotele_() +#define dountrap() dountrap_() #define float_down() float_down_() - /* ### version.c ### */ -#define doversion() doversion_() +#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_() - +#define dozap() dozap_() /* ### getline.c ### */ -#define tty_getlin(x,y) tty_getlin_(x,y) -#define tty_get_ext_cmd() tty_get_ext_cmd_() - +#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_() - +#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) - +#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_() +#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) +#define tty_cliparound(x, y) tty_cliparound_(x, y) #endif #ifdef POSITIONBAR -#define tty_update_positionbar(x) tty_update_positionbar_(x) +#define tty_update_positionbar(x) tty_update_positionbar_(x) #endif -#define tty_print_glyph(a,b,c,d) tty_print_glyph_(a,b,c,d) -#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) +#define tty_print_glyph(a, b, c, d) tty_print_glyph_(a, b, c, d) +#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 */ diff --git a/include/trap.h b/include/trap.h index 8234fc2c2..9ba154b85 100644 --- a/include/trap.h +++ b/include/trap.h @@ -10,74 +10,74 @@ #define TRAP_H union vlaunchinfo { - short v_launch_otyp; /* type of object to be triggered */ - coord v_launch2; /* secondary launch point (for boulders) */ - uchar v_conjoined; /* conjoined pit locations */ - short v_tnote; /* boards: 12 notes */ + short v_launch_otyp; /* type of object to be triggered */ + coord v_launch2; /* secondary launch point (for boulders) */ + uchar v_conjoined; /* conjoined pit locations */ + short v_tnote; /* boards: 12 notes */ }; struct trap { - struct trap *ntrap; - xchar tx,ty; - d_level dst; /* destination for portals */ - coord launch; - 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. */ - union vlaunchinfo vl; -#define launch_otyp vl.v_launch_otyp -#define launch2 vl.v_launch2 -#define conjoined vl.v_conjoined -#define tnote vl.v_tnote + struct trap *ntrap; + xchar tx, ty; + d_level dst; /* destination for portals */ + coord launch; + 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. */ + union vlaunchinfo vl; +#define launch_otyp vl.v_launch_otyp +#define launch2 vl.v_launch2 +#define conjoined vl.v_conjoined +#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)) +#define newtrap() (struct trap *) alloc(sizeof(struct trap)) +#define dealloc_trap(trap) free((genericptr_t)(trap)) /* reasons for statue animation */ -#define ANIMATE_NORMAL 0 +#define ANIMATE_NORMAL 0 #define ANIMATE_SHATTER 1 -#define ANIMATE_SPELL 2 +#define ANIMATE_SPELL 2 /* reasons for animate_statue's failure */ -#define AS_OK 0 /* didn't fail */ -#define AS_NO_MON 1 /* makemon failed */ -#define AS_MON_IS_UNIQUE 2 /* statue monster is unique */ +#define AS_OK 0 /* didn't fail */ +#define AS_NO_MON 1 /* makemon failed */ +#define AS_MON_IS_UNIQUE 2 /* statue monster is unique */ /* Note: if adding/removing a trap, adjust trap_engravings[] in mklev.c */ /* unconditional traps */ -#define NO_TRAP 0 -#define ARROW_TRAP 1 -#define DART_TRAP 2 -#define ROCKTRAP 3 -#define SQKY_BOARD 4 -#define BEAR_TRAP 5 -#define LANDMINE 6 -#define ROLLING_BOULDER_TRAP 7 -#define SLP_GAS_TRAP 8 -#define RUST_TRAP 9 -#define FIRE_TRAP 10 -#define PIT 11 -#define SPIKED_PIT 12 -#define HOLE 13 -#define TRAPDOOR 14 -#define TELEP_TRAP 15 -#define LEVEL_TELEP 16 -#define MAGIC_PORTAL 17 -#define WEB 18 -#define STATUE_TRAP 19 -#define MAGIC_TRAP 20 -#define ANTI_MAGIC 21 -#define POLY_TRAP 22 +#define NO_TRAP 0 +#define ARROW_TRAP 1 +#define DART_TRAP 2 +#define ROCKTRAP 3 +#define SQKY_BOARD 4 +#define BEAR_TRAP 5 +#define LANDMINE 6 +#define ROLLING_BOULDER_TRAP 7 +#define SLP_GAS_TRAP 8 +#define RUST_TRAP 9 +#define FIRE_TRAP 10 +#define PIT 11 +#define SPIKED_PIT 12 +#define HOLE 13 +#define TRAPDOOR 14 +#define TELEP_TRAP 15 +#define LEVEL_TELEP 16 +#define MAGIC_PORTAL 17 +#define WEB 18 +#define STATUE_TRAP 19 +#define MAGIC_TRAP 20 +#define ANTI_MAGIC 21 +#define POLY_TRAP 22 #define VIBRATING_SQUARE 23 #define TRAPNUM 24 diff --git a/include/unixconf.h b/include/unixconf.h index 80e4d00b7..01f06d5a3 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -20,73 +20,73 @@ */ /* define exactly one of the following four choices */ -/* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */ - /* also for relatives like SunOS 4.x, DG/UX, and */ - /* older versions of Linux */ -/* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */ - /* Use BSD for < v3.0 */ - /* "ULTRIX" not to be confused with "ultrix" */ -#define SYSV /* define for System V, Solaris 2.x, newer versions */ - /* of Linux */ -/* #define HPUX */ /* Hewlett-Packard's Unix, version 6.5 or higher */ - /* use SYSV for < v6.5 */ - +/* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */ + /* also for relatives like SunOS 4.x, DG/UX, and */ + /* older versions of Linux */ +/* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */ + /* Use BSD for < v3.0 */ + /* "ULTRIX" not to be confused with "ultrix" */ +#define SYSV /* define for System V, Solaris 2.x, newer versions */ + /* of Linux */ +/* #define HPUX */ /* Hewlett-Packard's Unix, version 6.5 or higher */ + /* use SYSV for < v6.5 */ /* define any of the following that are appropriate */ -#define SVR4 /* use in addition to SYSV for System V Release 4 */ - /* including Solaris 2+ */ -#define NETWORK /* if running on a networked system */ - /* e.g. Suns sharing a playground through NFS */ -/* #define SUNOS4 */ /* SunOS 4.x */ -/* #define LINUX */ /* Another Unix clone */ -/* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */ -/* #define GENIX */ /* Yet Another Unix Clone */ -/* #define HISX */ /* Bull Unix for XPS Machines */ -/* #define BOS */ /* Bull Open Software - Unix for DPX/2 Machines */ -/* #define UNIXPC */ /* use in addition to SYSV for AT&T 7300/3B1 */ -/* #define AIX_31 */ /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain - * job control (note that AIX is SYSV otherwise) - * Also define this for AIX 3.2 */ - -#define TERMINFO /* uses terminfo rather than termcap */ - /* Should be defined for most SYSV, SVR4 (including - * Solaris 2+), HPUX, and Linux systems. In - * 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 */ -#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 */ - /* Define for many recent OS releases, including - * those with specific defines (since types are - * changing toward the standard from earlier chaos). - * For example, platforms using the GNU libraries, - * 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 SVR4 /* use in addition to SYSV for System V Release 4 */ + /* including Solaris 2+ */ +#define NETWORK /* if running on a networked system */ + /* e.g. Suns sharing a playground through NFS */ +/* #define SUNOS4 */ /* SunOS 4.x */ +/* #define LINUX */ /* Another Unix clone */ +/* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */ +/* #define GENIX */ /* Yet Another Unix Clone */ +/* #define HISX */ /* Bull Unix for XPS Machines */ +/* #define BOS */ /* Bull Open Software - Unix for DPX/2 Machines */ +/* #define UNIXPC */ /* use in addition to SYSV for AT&T 7300/3B1 */ +/* #define AIX_31 */ /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain + * job control (note that AIX is SYSV otherwise) + * Also define this for AIX 3.2 */ + +#define TERMINFO /* uses terminfo rather than termcap */ + /* Should be defined for most SYSV, SVR4 (including + * Solaris 2+), HPUX, and Linux systems. In + * 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 */ +#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 */ + /* Define for many recent OS releases, including + * those with specific defines (since types are + * changing toward the standard from earlier chaos). + * For example, platforms using the GNU libraries, + * 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 */ + 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 */ +/* #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 */ - +/* #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, @@ -96,8 +96,8 @@ * Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88) */ -/* #define NO_FILE_LINKS */ /* if no hard links */ -/* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */ +/* #define NO_FILE_LINKS */ /* if no hard links */ +/* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */ /* * If you want the static parts of your playground on a read-only file @@ -105,7 +105,6 @@ */ /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */ - /* * 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. @@ -114,8 +113,6 @@ * #define DEF_PAGER ".../mydir/mypager" */ - - /* * Define PORT_HELP to be the name of the port-specfic help file. * This file is found in HACKDIR. @@ -133,7 +130,7 @@ * "extra output" method is used, but not all systems provide access to * a fine-grained timer. */ -/* #define TIMED_DELAY */ /* usleep() */ +/* #define TIMED_DELAY */ /* usleep() */ #endif /* @@ -144,7 +141,7 @@ * A stat system call is done on the mailbox every MAILCKFREQ moves. */ #if !defined(NOMAIL) -#define MAIL /* Deliver mail during the game */ +#define MAIL /* Deliver mail during the game */ #endif /* The Andrew Message System does mail a little differently from normal @@ -157,7 +154,7 @@ * dl2n+@andrew.cmu.edu (dec 19 1989) */ -/* #define AMS */ /* use Andrew message system for mail */ +/* #define AMS */ /* use Andrew message system for mail */ /* NO_MAILREADER is for kerberos authenticating filesystems where it is * essentially impossible to securely exec child processes, like mail @@ -166,45 +163,44 @@ * dan */ -/* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */ - -#ifdef MAIL -# if defined(BSD) || defined(ULTRIX) -# ifdef AMS -#define AMS_MAILBOX "/Mailbox" -# else -# if defined(__FreeBSD__) || defined(__OpenBSD__) -#define DEF_MAILREADER "/usr/bin/mail" -# else -#define DEF_MAILREADER "/usr/ucb/Mail" -# endif -# endif +/* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */ + +#ifdef MAIL +#if defined(BSD) || defined(ULTRIX) +#ifdef AMS +#define AMS_MAILBOX "/Mailbox" +#else +#if defined(__FreeBSD__) || defined(__OpenBSD__) +#define DEF_MAILREADER "/usr/bin/mail" #else -# if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX) -# if defined(M_XENIX) -#define DEF_MAILREADER "/usr/bin/mail" -# else -# ifdef __sgi -#define DEF_MAILREADER "/usr/sbin/Mail" -# else -#define DEF_MAILREADER "/usr/bin/mailx" -# endif -# endif -# else -#define DEF_MAILREADER "/bin/mail" -# endif -#endif - -#define MAILCKFREQ 50 -#endif /* MAIL */ +#define DEF_MAILREADER "/usr/ucb/Mail" +#endif +#endif +#else +#if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX) +#if defined(M_XENIX) +#define DEF_MAILREADER "/usr/bin/mail" +#else +#ifdef __sgi +#define DEF_MAILREADER "/usr/sbin/Mail" +#else +#define DEF_MAILREADER "/usr/bin/mailx" +#endif +#endif +#else +#define DEF_MAILREADER "/bin/mail" +#endif +#endif + +#define MAILCKFREQ 50 +#endif /* MAIL */ /* * Some terminals or terminal emulators send two character sequence "ESC c" * when Alt+c is pressed. The altmeta run-time option allows the user to * request that "ESC c" be treated as M-c. */ -#define ALTMETA /* support altmeta run-time option */ - +#define ALTMETA /* support altmeta run-time option */ #ifdef COMPRESS /* Some implementations of compress need a 'quiet' option. @@ -215,13 +211,13 @@ /* #define COMPRESS_OPTIONS "-q" */ #endif -#define FCMASK 0660 /* file creation mask */ +#define FCMASK 0660 /* file creation mask */ /* fcntl(2) is a POSIX-portable call for manipulating file descriptors. * Comment out the USE_FCNTL if for some reason you have a strange * OS/filesystem combination for which fcntl(2) does not work. */ #ifdef POSIX_TYPES -# define USE_FCNTL +#define USE_FCNTL #endif /* @@ -229,21 +225,21 @@ */ #ifdef _AUX_SOURCE -# ifdef AUX /* gcc ? */ -# define _SYSV_SOURCE -# define _BSD_SOURCE +#ifdef AUX /* gcc ? */ +#define _SYSV_SOURCE +#define _BSD_SOURCE #else -# define AUX -# endif +#define AUX +#endif #endif /* _AUX_SOURCE */ #if defined(LINUX) || defined(bsdi) -# ifndef POSIX_TYPES -# define POSIX_TYPES -# endif -# ifndef POSIX_JOB_CONTROL -# define POSIX_JOB_CONTROL -# endif +#ifndef POSIX_TYPES +#define POSIX_TYPES +#endif +#ifndef POSIX_JOB_CONTROL +#define POSIX_JOB_CONTROL +#endif #endif /* @@ -258,16 +254,16 @@ * various recent SYSV versions (with possibly tweaks to unixtty.c again). */ #ifndef POSIX_JOB_CONTROL -# if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31) -# define BSD_JOB_CONTROL -# else -# if defined(SVR4) -# define POSIX_JOB_CONTROL -# endif -# endif +#if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31) +#define BSD_JOB_CONTROL +#else +#if defined(SVR4) +#define POSIX_JOB_CONTROL +#endif +#endif #endif #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 */ #endif /* @@ -278,19 +274,18 @@ */ #define SAFERHANGUP - #if defined(BSD) || defined(ULTRIX) #include #else #include #endif -#define HLOCK "perm" /* an empty file used for locking purposes */ +#define HLOCK "perm" /* an empty file used for locking purposes */ #define tgetch getchar #ifndef NOSHELL -# define SHELL /* do not delete the '!' command */ +#define SHELL /* do not delete the '!' command */ #endif #include "system.h" @@ -300,73 +295,75 @@ #include #endif -#if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX) +#if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) \ + || defined(ULTRIX) #include #endif #if defined(BSD) || defined(ULTRIX) -# if !defined(DGUX) && !defined(SUNOS4) -#define memcpy(d, s, n) bcopy(s, d, n) -#define memcmp(s1, s2, n) bcmp(s2, s1, n) -# endif -# ifdef SUNOS4 +#if !defined(DGUX) && !defined(SUNOS4) +#define memcpy(d, s, n) bcopy(s, d, n) +#define memcmp(s1, s2, n) bcmp(s2, s1, n) +#endif +#ifdef SUNOS4 #include -# endif -#else /* therefore SYSV */ -# ifndef index /* some systems seem to do this for you */ -#define index strchr -# endif -# ifndef rindex -#define rindex strrchr -# endif +#endif +#else /* therefore SYSV */ +#ifndef index /* some systems seem to do this for you */ +#define index strchr +#endif +#ifndef rindex +#define rindex strrchr +#endif #endif /* Use the high quality random number routines. */ -#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__) -#define Rand() random() +#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \ + || defined(RANDOM) || defined(__APPLE__) +#define Rand() random() #else -#define Rand() lrand48() +#define Rand() lrand48() #endif #ifdef TIMED_DELAY -# if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX)) -# define msleep(k) usleep((k)*1000) -# endif -# ifdef ULTRIX -# define msleep(k) napms(k) -# endif +#if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX)) +#define msleep(k) usleep((k) *1000) +#endif +#ifdef ULTRIX +#define msleep(k) napms(k) +#endif #endif -#ifdef hc /* older versions of the MetaWare High-C compiler define this */ -# ifdef __HC__ -# undef __HC__ -# endif -# define __HC__ hc -# undef hc +#ifdef hc /* older versions of the MetaWare High-C compiler define this */ +#ifdef __HC__ +#undef __HC__ +#endif +#define __HC__ hc +#undef hc #endif #if defined(GNOME_GRAPHICS) #if defined(LINUX) -# include -# if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */ -# define GETRES_SUPPORT -# endif +#include +#if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */ +#define GETRES_SUPPORT +#endif #else -# if defined(BSD) || defined(SVR4) +#if defined(BSD) || defined(SVR4) /* * [ALI] We assume that SVR4 means we can safely include syscall.h * (although it's really a BSDism). This is certainly true for Solaris 2.5, * Solaris 7, Solaris 8 and Compaq Tru64 5.1 * Later BSD systems will have the getresid system calls. */ -# include -# if (defined (SYS_getuid) || defined(SYS_getresuid)) && \ - (defined(SYS_getgid) || defined(SYS_getresgid)) -# define GETRES_SUPPORT -# endif -# endif /* BSD || SVR4 */ +#include +#if (defined(SYS_getuid) || defined(SYS_getresuid)) \ + && (defined(SYS_getgid) || defined(SYS_getresgid)) +#define GETRES_SUPPORT +#endif +#endif /* BSD || SVR4 */ #endif /* LINUX */ -#endif /* GNOME_GRAPHICS */ +#endif /* GNOME_GRAPHICS */ #endif /* UNIXCONF_H */ #endif /* UNIX */ diff --git a/include/vision.h b/include/vision.h index 7842f3085..f2ec98462 100644 --- a/include/vision.h +++ b/include/vision.h @@ -7,15 +7,15 @@ #ifndef VISION_H #define VISION_H -#if 0 /* (moved to decl.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 */ +#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 */ /* * Light source sources @@ -29,9 +29,9 @@ extern char *viz_rmax; /* max could see indices */ * 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) (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) /* * The following assume the monster is not blind. @@ -43,27 +43,29 @@ extern char *viz_rmax; /* max could see indices */ * 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)) +#define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2)) -#define m_canseeu(m) ((!Invis || perceives((m)->data)) && \ - !(Underwater || u.uburied || (m)->mburied) ? \ - couldsee((m)->mx,(m)->my) : 0) +#define m_canseeu(m) \ + ((!Invis || perceives((m)->data)) \ + && !(Underwater || u.uburied || (m)->mburied) \ + ? couldsee((m)->mx, (m)->my) \ + : 0) /* * Circle information */ -#define MAX_RADIUS 15 /* this is in points from the source */ +#define MAX_RADIUS 15 /* this is in points from the source */ /* Use this macro to get a list of distances of the edges (see vision.c). */ -#define circle_ptr(z) (&circle_data[(int)circle_start[z]]) +#define circle_ptr(z) (&circle_data[(int) circle_start[z]]) /* howmonseen() bitmask values */ -#define MONSEEN_NORMAL 0x0001 /* normal vision */ -#define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */ -#define MONSEEN_INFRAVIS 0x0004 /* via infravision */ -#define MONSEEN_TELEPAT 0x0008 /* via telepathy */ -#define MONSEEN_XRAYVIS 0x0010 /* via Xray vision */ -#define MONSEEN_DETECT 0x0020 /* via extended monster detection */ -#define MONSEEN_WARNMON 0x0040 /* via type-specific warning */ +#define MONSEEN_NORMAL 0x0001 /* normal vision */ +#define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */ +#define MONSEEN_INFRAVIS 0x0004 /* via infravision */ +#define MONSEEN_TELEPAT 0x0008 /* via telepathy */ +#define MONSEEN_XRAYVIS 0x0010 /* via Xray vision */ +#define MONSEEN_DETECT 0x0020 /* via extended monster detection */ +#define MONSEEN_WARNMON 0x0040 /* via type-specific warning */ #endif /* VISION_H */ diff --git a/include/vmsconf.h b/include/vmsconf.h index 11c8c19ac..c9bd971c7 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -16,8 +16,8 @@ * Trailing NULs are present in the default values in order to make some * 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_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" /* * This section cleans up the stuff done in config.h so that it @@ -25,36 +25,37 @@ * config.h is actually edited, the changes won't impact us. */ #ifdef UNIX -# undef UNIX +#undef UNIX #endif #ifdef HACKDIR -# undef HACKDIR +#undef HACKDIR #endif #ifdef WIZARD_NAME -# undef WIZARD_NAME +#undef WIZARD_NAME #endif #define HACKDIR Local_HACKDIR #define WIZARD_NAME Local_WIZARD #ifndef SYSCF -# define SYSCF +#define SYSCF #endif /* filenames require punctuation to avoid redirection via logical names */ #undef RECORD -#define RECORD "record;1" /* scoreboard file (retains high scores) */ +#define RECORD "record;1" /* scoreboard file (retains high scores) */ #undef LOGFILE -#define LOGFILE "logfile;0" /* optional file (records all games) */ +#define LOGFILE "logfile;0" /* optional file (records all games) */ #undef SYSCF_FILE #define SYSCF_FILE "sysconf;0" -#define HLOCK "perm;1" /* an empty file used for locking purposes */ +#define HLOCK "perm;1" /* an empty file used for locking purposes */ -/* want compression--for level & save files--performed within NetHack itself */ +/* want compression--for level & save files--performed within NetHack itself + */ #ifdef COMPRESS -# undef COMPRESS +#undef COMPRESS #endif #ifndef INTERNAL_COMP -# define INTERNAL_COMP +#define INTERNAL_COMP #endif /* @@ -83,7 +84,7 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * Put the readonly data files into a single container rather than into * separate files in the playground directory. */ -#define DLB /* use data librarian code */ +#define DLB /* use data librarian code */ /* * Provide menu of saved games to choose from at start. @@ -106,7 +107,8 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * 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 * allow you to use the Escape key in normal gameplay, and the appropriate - * control characters in Wizard mode. It will work most like the unix version. + * control characters in Wizard mode. It will work most like the unix + * version. * It will also avoid "" being displayed when ^Y is pressed. * * Otherwise, the VMS SMG calls will be used. These calls block use of @@ -114,13 +116,13 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * the same, although the differences are fairly negligible. You must * then use a VTxxx function key or two s to give an ESC response. */ -#define USE_QIO_INPUT /* use SYS$QIOW instead of SMG$READ_KEYSTROKE */ +#define USE_QIO_INPUT /* use SYS$QIOW instead of SMG$READ_KEYSTROKE */ /* * Allow the user to decide whether to pause via timer or excess screen * output for various display effects like explosions and moving objects. */ -#define TIMED_DELAY /* enable the `timed_delay' run-time option */ +#define TIMED_DELAY /* enable the `timed_delay' run-time option */ /* * If you define MAIL, then NetHack will capture incoming broadcast @@ -132,7 +134,7 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * If you undefine MAIL, broadcasts will go straight to the terminal, * resulting in disruption of the screen display; use to redraw. */ -#define MAIL /* enable broadcast trapping */ +#define MAIL /* enable broadcast trapping */ /* * SHELL enables the player to 'escape' into a spawned subprocess via @@ -144,8 +146,8 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * to the parent process with the command; this is not very * close to Unix job control, but it's better than nothing. */ -#define SHELL /* do not delete the '!' command */ -#define SUSPEND /* don't delete the ^Z command, such as it is */ +#define SHELL /* do not delete the '!' command */ +#define SUSPEND /* don't delete the ^Z command, such as it is */ /* * Some terminals or terminal emulators send two character sequence "ESC c" @@ -154,13 +156,11 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * ESC when it is waiting for a command, it will wait for another character * (even if user intended that ESC to be standalone to cancel a count prefix). */ -#define ALTMETA /* support altmeta run-time option */ - +#define ALTMETA /* support altmeta run-time option */ -#define RANDOM /* use sys/share/random.c instead of vaxcrtl rand */ - -#define FCMASK 0660 /* file creation mask */ +#define RANDOM /* use sys/share/random.c instead of vaxcrtl rand */ +#define FCMASK 0660 /* file creation mask */ /* * The remainder of the file should not need to be changed. @@ -168,111 +168,113 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then /* data librarian defs */ #ifdef DLB -# define DLBFILE "nh-data.dlb" - /* - * Since we can do without case insensitive filename comparison, - * avoid enabling it because that requires compiling and linking - * src/hacklib into util/dlb_main. - */ -/* # define FILENAME_CMP strcmpi */ /* case insensitive */ +#define DLBFILE "nh-data.dlb" +/* + * Since we can do without case insensitive filename comparison, + * avoid enabling it because that requires compiling and linking + * src/hacklib into util/dlb_main. + */ +/* # define FILENAME_CMP strcmpi */ /* case insensitive */ #endif #if defined(VAXC) && !defined(ANCIENT_VAXC) -# ifdef volatile -# undef volatile -# endif -# ifdef const -# undef const -# endif +#ifdef volatile +#undef volatile +#endif +#ifdef const +#undef const +#endif #endif #ifdef __DECC -# define STRICT_REF_DEF /* used in lev_main.c */ +#define STRICT_REF_DEF /* used in lev_main.c */ #endif #ifdef STRICT_REF_DEF -# define DEFINE_OSPEED +#define DEFINE_OSPEED #endif #ifndef alloca - /* bison generated foo_yacc.c might try to use alloca() */ -# ifdef __GNUC__ -# define alloca __builtin_alloca -# else -# define ALLOCA_HACK /* used in util/panic.c */ -# endif +/* bison generated foo_yacc.c might try to use alloca() */ +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else +#define ALLOCA_HACK /* used in util/panic.c */ +#endif #endif #ifdef _DECC_V4_SOURCE -/* excludes some necessary typedefs when _DECC_V4_SOURCE is defined */ +/* excludes some necessary typedefs when _DECC_V4_SOURCE is defined + */ #include -# ifndef __PID_T -# define __PID_T +#ifndef __PID_T +#define __PID_T typedef __pid_t pid_t; -# endif -# ifndef __UID_T -# define __UID_T +#endif +#ifndef __UID_T +#define __UID_T typedef __uid_t uid_t; -# endif -# ifndef __GID_T -# define __GID_T +#endif +#ifndef __GID_T +#define __GID_T typedef __gid_t gid_t; -# endif -# ifndef __MODE_T -# define __MODE_T +#endif +#ifndef __MODE_T +#define __MODE_T typedef __mode_t mode_t; -# endif -#endif /* _DECC_V4_SOURCE */ +#endif +#endif /* _DECC_V4_SOURCE */ #include -#if 0 /* is missing for old gcc versions; skip it to save time */ +#if 0 /* is missing for old gcc versions; skip it to save time */ #include -#else /* values needed from missing include file */ -# define O_RDONLY 0 -# define O_WRONLY 1 -# define O_RDWR 2 -# define O_CREAT 0x200 -# define O_TRUNC 0x400 +#else /* values needed from missing include file */ +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 +#define O_CREAT 0x200 +#define O_TRUNC 0x400 #endif #define tgetch vms_getchar #include "system.h" -#define index strchr -#define rindex strrchr +#define index strchr +#define rindex strrchr /* Use the high quality random number routines. */ #if defined(RANDOM) -#define Rand() random() +#define Rand() random() /* VMS V7 adds these entry points to DECC$SHR; stick with the nethack-supplied - code to avoid having to deal with version-specific conditionalized builds */ -#define random nh_random -#define srandom nh_srandom -#define initstate nh_initstate -#define setstate nh_setstate + code to avoid having to deal with version-specific conditionalized builds + */ +#define random nh_random +#define srandom nh_srandom +#define initstate nh_initstate +#define setstate nh_setstate #else -#define Rand() rand() +#define Rand() rand() #endif #ifndef __GNUC__ -# ifndef bcopy -#define bcopy(s,d,n) memcpy((d),(s),(n)) /* vaxcrtl */ -# endif +#ifndef bcopy +#define bcopy(s, d, n) memcpy((d), (s), (n)) /* vaxcrtl */ +#endif #endif -#define abort() vms_abort() /* vmsmisc.c */ -#define creat(f,m) vms_creat(f,m) /* vmsfiles.c */ -#define exit(sts) vms_exit(sts) /* vmsmisc.c */ -#define getuid() vms_getuid() /* vmsunix.c */ -#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 abort() vms_abort() /* vmsmisc.c */ +#define creat(f, m) vms_creat(f, m) /* vmsfiles.c */ +#define exit(sts) vms_exit(sts) /* vmsmisc.c */ +#define getuid() vms_getuid() /* vmsunix.c */ +#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 */ #ifdef VERYOLD_VMS -#define unlink(f0) delete(f0) /* vaxcrtl */ +#define unlink(f0) delete (f0) /* vaxcrtl */ #else -#define unlink(f0) remove(f0) /* vaxcrtl, decc$shr */ +#define unlink(f0) remove(f0) /* vaxcrtl, decc$shr */ #endif -#define C$$TRANSLATE(n) c__translate(n) /* vmsfiles.c */ +#define C$$TRANSLATE(n) c__translate(n) /* vmsfiles.c */ /* VMS global names are case insensitive... */ #define An vms_an @@ -284,9 +286,9 @@ typedef __mode_t mode_t; /* 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 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 */ -#endif /* VMSCONF_H */ -#endif /* VMS */ +#endif /* VMSCONF_H */ +#endif /* VMS */ diff --git a/include/wceconf.h b/include/wceconf.h index e046ea4fd..a3da7bdd5 100644 --- a/include/wceconf.h +++ b/include/wceconf.h @@ -6,41 +6,42 @@ #ifndef WCECONF_H #define WCECONF_H -#pragma warning(disable:4142) /* benign redefinition of type */ +#pragma warning(disable : 4142) /* benign redefinition of type */ -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include /* Detect the targe device */ -#if defined(WIN32_PLATFORM_PSPC) -# if _WIN32_WCE >= 300 -# define WIN_CE_POCKETPC -# else -# define WIN_CE_PS2xx -# endif +#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 +#define WIN_CE_HPCPRO #elif defined(WIN32_PLATFORM_WFSP) -# define WIN_CE_SMARTPHONE +#define WIN_CE_SMARTPHONE #else -# error "Unsupported Windows CE platform" +#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 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 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 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 SELF_RECOVER /* Allow the game itself to recover from an aborted \ + game */ -#define NOTSTDC /* no strerror() */ +#define NOTSTDC /* no strerror() */ #define USER_SOUNDS @@ -49,17 +50,18 @@ * The remaining code shouldn't need modification. * ----------------------------------------------------------------- */ -/* #define SHORT_FILENAMES /* All NT filesystems support long names now */ +/* #define SHORT_FILENAMES /* All NT filesystems support long names now + */ #ifdef MICRO -#undef MICRO /* never define this! */ +#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 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 @@ -67,102 +69,101 @@ #undef OPTIONS_USED #endif #ifdef MSWIN_GRAPHICS -#define OPTIONS_USED "guioptions" +#define OPTIONS_USED "guioptions" #else -#define OPTIONS_USED "ttyoptions" +#define OPTIONS_USED "ttyoptions" #endif #define OPTIONS_FILE OPTIONS_USED -#define PORT_HELP "porthelp" +#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. +#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" +#define PORT_CE_PLATFORM "Pocket PC" #elif defined(WIN_CE_PS2xx) -# define PORT_CE_PLATFORM "Palm-size PC 2.11" +#define PORT_CE_PLATFORM "Palm-size PC 2.11" #elif defined(WIN_CE_HPCPRO) -# define PORT_CE_PLATFORM "H/PC Pro 2.11" +#define PORT_CE_PLATFORM "H/PC Pro 2.11" #elif defined(WIN_CE_SMARTPHONE) -# define PORT_CE_PLATFORM "Smartphone 2002" +#define PORT_CE_PLATFORM "Smartphone 2002" #endif #if defined(ARM) -# define PORT_CE_CPU "ARM" +#define PORT_CE_CPU "ARM" #elif defined(PPC) -# define PORT_CE_CPU "PPC" +#define PORT_CE_CPU "PPC" #elif defined(ALPHA) -# define PORT_CE_CPU "ALPHA" +#define PORT_CE_CPU "ALPHA" #elif defined(SH3) -# define PORT_CE_CPU "SH3" +#define PORT_CE_CPU "SH3" #elif defined(SH4) -# define PORT_CE_CPU "SH4" +#define PORT_CE_CPU "SH4" #elif defined(MIPS) -# define PORT_CE_CPU "MIPS" +#define PORT_CE_CPU "MIPS" #elif defined(X86) || defined(_X86_) -# define PORT_CE_CPU "X86" +#define PORT_CE_CPU "X86" #else -# error Only ARM, PPC, ALPHA, SH3, SH4, MIPS and X86 supported +#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. */ +#define RUNTIME_PORT_ID /* trigger run-time port identification since \ + Makedefs is bootstrapped on a cross-platform. */ -#include /* Provides prototypes of strncmpi(), etc. */ +#include /* Provides prototypes of strncmpi(), etc. */ #ifdef STRNCMPI -#define strncmpi(a,b,c) _strnicmp(a,b,c) +#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) +#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) */ +#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) +#if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ) #undef PATHLEN #undef FILENAME -#define PATHLEN _MAX_PATH -#define FILENAME _MAX_FNAME -# endif +#define PATHLEN _MAX_PATH +#define FILENAME _MAX_FNAME +#endif #endif - #define NO_SIGNAL -#define index strchr -#define rindex strrchr +#define index strchr +#define rindex strrchr #define USE_STDARG #ifdef RANDOM /* Use the high quality random number routines. */ -#define Rand() random() +#define Rand() random() #else -#define Rand() rand() +#define Rand() rand() #endif -#define FCMASK 0660 /* file creation mask */ -#define regularize nt_regularize +#define FCMASK 0660 /* file creation mask */ +#define regularize nt_regularize #define HLOCK "NHPERM" #ifndef M -#define M(c) ((char) (0x80 | (c))) +#define M(c) ((char) (0x80 | (c))) /* #define M(c) ((c) - 128) */ #endif #ifndef C -#define C(c) (0x1f & (c)) +#define C(c) (0x1f & (c)) #endif #if defined(DLB) -#define FILENAME_CMP _stricmp /* case insensitive */ +#define FILENAME_CMP _stricmp /* case insensitive */ #endif #if 0 @@ -174,7 +175,7 @@ extern const char *alllevels, *allbones; extern char hackdir[]; #define ABORT C('a') #define getuid() 1 -#define getlogin() ((char *)0) +#define getlogin() ((char *) 0) extern void NDECL(win32_abort); #ifdef WIN32CON extern void FDECL(nttty_preference_update, (const char *)); @@ -182,60 +183,50 @@ extern void NDECL(toggle_mouse_support); #endif #ifndef alloca -#define ALLOCA_HACK /* used in util/panic.c */ +#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' */ +#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*/ +#pragma warning(disable : 4761) /* integral size mismatch in arg; conv \ + supp*/ #ifdef YYPREFIX -#pragma warning(disable:4102) /* unreferenced label */ +#pragma warning(disable : 4102) /* unreferenced label */ #endif #endif /* UNICODE stuff */ -#define NHSTR_BUFSIZE 255 +#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) ) +#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_W2A(w, a, cb) (strncpy((a), (w), (cb))) - #define NH_A2W(a, w, cb) (strncpy((w), (a), (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 +/* + * 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_assistance(_1, _2, _3, _4) #define interject(_1) /* Missing definitions */ -extern int mswin_have_input(); -#define kbhit mswin_have_input +extern int mswin_have_input(); +#define kbhit mswin_have_input -#define getenv(a) ((char*)NULL) +#define getenv(a) ((char *) NULL) /* __stdio.h__ */ #define perror(a) @@ -244,35 +235,35 @@ 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 */ +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 */ - }; + 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 struct tm *__cdecl localtime(const time_t *); extern time_t __cdecl time(time_t *); -extern time_t __cdecl mktime(struct tm * tb); +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 ) +#define rewind(stream) (void) fseek(stream, 0L, SEEK_SET) /* __io.h__ */ typedef long off_t; @@ -293,63 +284,64 @@ extern int __cdecl access(const char *, int); #endif #define DeleteFile(a) unlink(a) -int chdir( const char *dirname ); -extern char *getcwd( char *buffer, int maxlen ); +int chdir(const char *dirname); +extern char *getcwd(char *buffer, int maxlen); /* __stdlib.h__ */ -#define abort() (void)TerminateProcess(GetCurrentProcess(), 0) +#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 - +#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)) +#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 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); +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 +#ifdef ARM +#undef ARM +#endif /* leave - Windows CE defines leave as part of exception handling (__leave) - It confilicts with existing sources and since we don't use exceptions it is safe + It confilicts with existing sources and since we don't use exceptions it is + safe to undefine it */ -# ifdef leave -# undef leave -# endif +#ifdef leave +#undef leave +#endif #endif /* WCECONF_H */ diff --git a/include/winGnome.h b/include/winGnome.h index 2ac8e0abf..f3cd66602 100644 --- a/include/winGnome.h +++ b/include/winGnome.h @@ -14,7 +14,7 @@ E struct window_procs Gnome_procs; #undef E -#define NHW_WORN 6 +#define NHW_WORN 6 extern winid WIN_WORN; #endif /* WINGNOME_H */ diff --git a/include/winX.h b/include/winX.h index cc7183878..1ba2d0366 100644 --- a/include/winX.h +++ b/include/winX.h @@ -17,106 +17,104 @@ #if defined(BOS) || defined(NHSTDC) #define DIMENSION_P int #else -# ifdef WIDENED_PROTOTYPES +#ifdef WIDENED_PROTOTYPES #define DIMENSION_P unsigned int -# else +#else #define DIMENSION_P Dimension -# endif +#endif #endif /* * Generic text buffer. */ -#define START_SIZE 512 /* starting text buffer size */ +#define START_SIZE 512 /* starting text buffer size */ struct text_buffer { char *text; - int text_size; - int text_last; - int num_lines; + int text_size; + int text_last; + int num_lines; }; - /* * Information specific to a map window. */ struct text_map_info_t { - unsigned char text[ROWNO][COLNO]; /* Actual displayed screen. */ + unsigned char text[ROWNO][COLNO]; /* Actual displayed screen. */ #ifdef TEXTCOLOR - unsigned char colors[ROWNO][COLNO]; /* Color of each character. */ - 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] + unsigned char colors[ROWNO][COLNO]; /* Color of each character. */ + 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 - GC copy_gc, /* Drawing GC */ - inv_copy_gc; /* Inverse drawing GC */ + GC copy_gc, /* Drawing GC */ + inv_copy_gc; /* Inverse drawing GC */ #endif - int square_width, /* Saved font information so */ - square_height, /* we can calculate the correct */ - square_ascent, /* placement of changes. */ - square_lbearing; + int square_width, /* Saved font information so */ + square_height, /* we can calculate the correct */ + square_ascent, /* placement of changes. */ + square_lbearing; }; struct tile_map_info_t { - unsigned short glyphs[ROWNO][COLNO]; /* Saved glyph numbers. */ - GC white_gc; - GC black_gc; - unsigned long image_width; /* dimensions of tile image */ + unsigned short glyphs[ROWNO][COLNO]; /* Saved glyph numbers. */ + GC white_gc; + GC black_gc; + unsigned long image_width; /* dimensions of tile image */ unsigned long image_height; - int square_width, /* Saved tile information so */ - square_height, /* we can calculate the correct */ - square_ascent, /* placement of changes. */ - square_lbearing; + int square_width, /* Saved tile information so */ + square_height, /* we can calculate the correct */ + square_ascent, /* placement of changes. */ + square_lbearing; }; 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. */ - t_stop[ROWNO]; /* Ending column for new info. */ + 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. */ + t_stop[ROWNO]; /* Ending column for new info. */ - boolean is_tile; /* true if currently using tiles */ + boolean is_tile; /* true if currently using tiles */ struct text_map_info_t text_map; struct tile_map_info_t tile_map; }; - /* * Information specific to a message window. */ struct line_element { struct line_element *next; - char *line; /* char buffer */ - int buf_length; /* length of buffer */ - int str_length; /* length of string in buffer */ + char *line; /* char buffer */ + int buf_length; /* length of buffer */ + int str_length; /* length of string in buffer */ }; struct mesg_info_t { - XFontStruct *fs; /* Font for the window. */ - int num_lines; /* line count */ - struct line_element *head; /* head of circular line queue */ - struct line_element *line_here;/* current drawn line position */ - struct line_element *last_pause;/* point to the line after the prev */ - /* bottom of screen */ - struct line_element *last_pause_head;/* pointer to head of previous */ - /* turn */ - GC gc; /* GC for text drawing */ - int char_width, /* Saved font information so we can */ - char_height, /* calculate the correct placement */ - char_ascent, /* of changes. */ - char_lbearing; - Dimension viewport_width, /* Saved viewport size, so we can adjust */ - viewport_height;/* the slider on a resize. */ - Boolean dirty; /* Lines have been added to the window. */ + XFontStruct *fs; /* Font for the window. */ + int num_lines; /* line count */ + struct line_element *head; /* head of circular line queue */ + struct line_element *line_here; /* current drawn line position */ + struct line_element *last_pause; /* point to the line after the prev */ + /* bottom of screen */ + struct line_element *last_pause_head; /* pointer to head of previous */ + /* turn */ + GC gc; /* GC for text drawing */ + int char_width, /* Saved font information so we can */ + char_height, /* calculate the correct placement */ + char_ascent, /* of changes. */ + char_lbearing; + Dimension viewport_width, /* Saved viewport size, so we can adjust */ + viewport_height; /* the slider on a resize. */ + Boolean dirty; /* Lines have been added to the window. */ }; /* * Information specific to a "text" status window. */ struct status_info_t { - struct text_buffer text; /* Just a text buffer. */ + struct text_buffer text; /* Just a text buffer. */ }; /* @@ -125,43 +123,43 @@ struct status_info_t { */ typedef struct x11_mi { struct x11_mi *next; - anything identifier; /* Opaque type to identify this selection */ - long pick_count; /* specific selection count; -1 if none */ - char *str; /* The text of the item. */ - int attr; /* Attribute for the line. */ - boolean selected; /* Been selected? */ - char selector; /* Char used to select this entry. */ - char gselector; /* Group selector. */ + anything identifier; /* Opaque type to identify this selection */ + long pick_count; /* specific selection count; -1 if none */ + char *str; /* The text of the item. */ + int attr; /* Attribute for the line. */ + boolean selected; /* Been selected? */ + char selector; /* Char used to select this entry. */ + char gselector; /* Group selector. */ } x11_menu_item; struct menu { - x11_menu_item *base; /* Starting pointer for item list. */ - x11_menu_item *last; /* End pointer for item list. */ - const char *query; /* Query string. */ - const char *gacc; /* Group accelerators. */ - int count; /* Number of strings. */ - String *list_pointer;/* String list. */ - Boolean *sensitive; /* Active list. */ - char curr_selector;/* Next keyboard accelerator to assign, */ - /* if 0, then we're out. */ + x11_menu_item *base; /* Starting pointer for item list. */ + x11_menu_item *last; /* End pointer for item list. */ + const char *query; /* Query string. */ + const char *gacc; /* Group accelerators. */ + int count; /* Number of strings. */ + String *list_pointer; /* String list. */ + Boolean *sensitive; /* Active list. */ + char curr_selector; /* Next keyboard accelerator to assign, */ + /* if 0, then we're out. */ }; struct menu_info_t { - struct menu curr_menu; /* Menu being displayed. */ - struct menu new_menu; /* New menu being built. */ - - XFontStruct *fs; /* Font for the window. */ - long menu_count; /* number entered by user */ - Dimension line_height; /* Total height of a line of text. */ - Dimension internal_height; /* Internal height between widget & border */ - Dimension internal_width; /* Internal width between widget & border */ - short how; /* Menu mode PICK_NONE, PICK_ONE, PICK_ANY */ - boolean valid_widgets; /* TRUE if widgets have been created. */ - boolean is_menu; /* Has been confirmed to being a menu window. */ - boolean is_active; /* TRUE when waiting for user input. */ - boolean is_up; /* TRUE when window is popped-up. */ - boolean cancelled; /* Menu has been explicitly cancelled. */ - boolean counting; /* true when menu_count has a valid value */ + struct menu curr_menu; /* Menu being displayed. */ + struct menu new_menu; /* New menu being built. */ + + XFontStruct *fs; /* Font for the window. */ + long menu_count; /* number entered by user */ + Dimension line_height; /* Total height of a line of text. */ + Dimension internal_height; /* Internal height between widget & border */ + Dimension internal_width; /* Internal width between widget & border */ + short how; /* Menu mode PICK_NONE, PICK_ONE, PICK_ANY */ + boolean valid_widgets; /* TRUE if widgets have been created. */ + boolean is_menu; /* Has been confirmed to being a menu window. */ + boolean is_active; /* TRUE when waiting for user input. */ + boolean is_up; /* TRUE when window is popped-up. */ + boolean cancelled; /* Menu has been explicitly cancelled. */ + boolean counting; /* true when menu_count has a valid value */ }; /* @@ -169,96 +167,93 @@ struct menu_info_t { */ struct text_info_t { struct text_buffer text; - XFontStruct *fs; /* Font for the text window. */ - int max_width; /* Width of widest line so far. */ - int extra_width, /* Sum of left and right border widths. */ - extra_height; /* Sum of top and bottom border widths. */ - boolean blocked; /* */ - boolean destroy_on_ack; /* Destroy this window when acknowleged. */ + XFontStruct *fs; /* Font for the text window. */ + int max_width; /* Width of widest line so far. */ + int extra_width, /* Sum of left and right border widths. */ + extra_height; /* Sum of top and bottom border widths. */ + boolean blocked; /* */ + boolean destroy_on_ack; /* Destroy this window when acknowleged. */ #ifdef GRAPHIC_TOMBSTONE - boolean is_rip; /* This window needs a tombstone. */ + boolean is_rip; /* This window needs a tombstone. */ #endif }; - /* * Basic window structure. */ struct xwindow { - int type; /* type of nethack window */ - Widget popup; /* direct parent of widget w or viewport */ - Widget w; /* the widget that does things */ - Dimension pixel_width; /* window size, in pixels */ + int type; /* type of nethack window */ + Widget popup; /* direct parent of widget w or viewport */ + Widget w; /* the widget that does things */ + Dimension pixel_width; /* window size, in pixels */ Dimension pixel_height; - int prevx, cursx; /* Cursor position, only used by */ - int prevy, cursy; /* map and "plain" status windows.*/ + int prevx, cursx; /* Cursor position, only used by */ + int prevy, cursy; /* map and "plain" status windows.*/ union { - struct map_info_t *Map_info; /* map window info */ - struct mesg_info_t *Mesg_info; /* message window info */ - struct status_info_t *Status_info; /* status window info */ - struct menu_info_t *Menu_info; /* menu window info */ - struct text_info_t *Text_info; /* menu window info */ + struct map_info_t *Map_info; /* map window info */ + struct mesg_info_t *Mesg_info; /* message window info */ + struct status_info_t *Status_info; /* status window info */ + struct menu_info_t *Menu_info; /* menu window info */ + struct text_info_t *Text_info; /* menu window info */ } Win_info; - boolean keep_window; + boolean keep_window; }; /* Defines to use for the window information union. */ -#define map_information Win_info.Map_info -#define mesg_information Win_info.Mesg_info +#define map_information Win_info.Map_info +#define mesg_information Win_info.Mesg_info #define status_information Win_info.Status_info -#define menu_information Win_info.Menu_info -#define text_information Win_info.Text_info +#define menu_information Win_info.Menu_info +#define text_information Win_info.Text_info +#define MAX_WINDOWS 20 /* max number of open windows */ -#define MAX_WINDOWS 20 /* max number of open windows */ +#define NHW_NONE 0 /* Unallocated window type. Must be */ +/* different from any other NHW_* type. */ -#define NHW_NONE 0 /* Unallocated window type. Must be */ - /* different from any other NHW_* type. */ +#define NO_CLICK 0 /* No click occured on the map window. Must */ +/* be different than CLICK_1 and CLICK_2. */ -#define NO_CLICK 0 /* No click occured on the map window. Must */ - /* be different than CLICK_1 and CLICK_2. */ +#define DEFAULT_MESSAGE_WIDTH 60 /* width in chars of the message window */ -#define DEFAULT_MESSAGE_WIDTH 60/* width in chars of the message window */ +#define DISPLAY_FILE_SIZE 35 /* Max number of lines in the default */ +/* file display window. */ -#define DISPLAY_FILE_SIZE 35 /* Max number of lines in the default */ - /* file display window. */ - -#define MAX_KEY_STRING 64 /* String size for converting a keypress */ - /* event into a character(s) */ +#define MAX_KEY_STRING 64 /* String size for converting a keypress */ +/* 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 */ - +#define MAX_HISTORY 60 /* max history saved on message window */ /* 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 */ -#define EXIT_ON_KEY_PRESS 0 /* valid values for exit_x_event */ +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 */ +#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 +#define EXIT_ON_EXIT 2 +#define EXIT_ON_SENT_EVENT 3 E int click_x, click_y, click_button, updated_inventory; typedef struct { Boolean slow; Boolean autofocus; Boolean message_line; - Boolean double_tile_size; /* double tile size */ - String tile_file; /* name of file to open for tiles */ - String icon; /* name of desired icon */ - int message_lines; /* number of lines to attempt to show */ - String pet_mark_bitmap; /* X11 bitmap file used to mark pets */ - Pixel pet_mark_color; /* color of pet mark */ + Boolean double_tile_size; /* double tile size */ + String tile_file; /* name of file to open for tiles */ + String icon; /* name of desired icon */ + int message_lines; /* number of lines to attempt to show */ + String pet_mark_bitmap; /* X11 bitmap file used to mark pets */ + Pixel pet_mark_color; /* color of pet mark */ #ifdef GRAPHIC_TOMBSTONE - String tombstone; /* name of XPM file for tombstone */ - int tombtext_x; /* x-coord of center of first tombstone text */ - int tombtext_y; /* y-coord of center of first tombstone text */ - int tombtext_dx; /* x-displacement between tombstone line */ - int tombtext_dy; /* y-displacement between tombstone line */ + String tombstone; /* name of XPM file for tombstone */ + int tombtext_x; /* x-coord of center of first tombstone text */ + int tombtext_y; /* y-coord of center of first tombstone text */ + int tombtext_dx; /* x-displacement between tombstone line */ + int tombtext_dy; /* y-displacement between tombstone line */ #endif } AppResources; @@ -268,108 +263,112 @@ E void (*input_func)(); 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) \ + if ((window) < 0 || (window) >= MAX_WINDOWS) { \ + panic("illegal windid [%d] in %s at line %d", window, __FILE__, \ + __LINE__); \ + } /* ### 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)); -E void FDECL(positionpopup,(Widget,BOOLEAN_P)); +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)); +E void FDECL(positionpopup, (Widget, BOOLEAN_P)); /* ### winX.c ### */ -E struct xwindow *FDECL(find_widget,(Widget)); -E Boolean FDECL(nhApproxColor,(Screen*, Colormap, char*, XColor*)); -E Dimension FDECL(nhFontHeight,(Widget)); -E char FDECL(key_event_to_char,(XKeyEvent*)); -E void FDECL(msgkey, (Widget, XtPointer, XEvent*)); +E struct xwindow *FDECL(find_widget, (Widget)); +E Boolean FDECL(nhApproxColor, (Screen *, Colormap, char *, XColor *)); +E Dimension FDECL(nhFontHeight, (Widget)); +E char FDECL(key_event_to_char, (XKeyEvent *)); +E void FDECL(msgkey, (Widget, XtPointer, XEvent *)); E void FDECL(nh_XtPopup, (Widget, int, Widget)); E void FDECL(nh_XtPopdown, (Widget)); E void FDECL(win_X11_init, (int)); -E void FDECL(nh_keyscroll, (Widget, XEvent*, String*, Cardinal*)); +E void FDECL(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*)); +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 *)); /* ### 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)); +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)); /* ### 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*)); +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 *)); /* ### 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(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 */ /* ### 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 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); /* ### 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*)); +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 *)); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(rip_dismiss_text,(Widget, XEvent*, String*, Cardinal*)); +E void FDECL(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*)); +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 *)); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(calculate_rip_text, (int,time_t)); +E void FDECL(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)); +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)); /* external declarations */ 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 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); @@ -377,12 +376,12 @@ 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_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_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); @@ -391,7 +390,7 @@ E void NDECL(X11_wait_synch); #ifdef CLIPPING E void FDECL(X11_cliparound, (int, int)); #endif -E void FDECL(X11_print_glyph, (winid,XCHAR_P,XCHAR_P,int)); +E void FDECL(X11_print_glyph, (winid, XCHAR_P, XCHAR_P, int)); E void FDECL(X11_raw_print, (const char *)); E void FDECL(X11_raw_print_bold, (const char *)); E int NDECL(X11_nhgetch); @@ -399,7 +398,7 @@ 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 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); @@ -409,9 +408,9 @@ E void NDECL(X11_start_screen); E void NDECL(X11_end_screen); #ifdef GRAPHIC_TOMBSTONE -E void FDECL(X11_outrip, (winid,int,time_t)); +E void FDECL(X11_outrip, (winid, int, time_t)); #else -E void FDECL(genl_outrip, (winid,int,time_t)); +E void FDECL(genl_outrip, (winid, int, time_t)); #endif E void FDECL(X11_preference_update, (const char *)); diff --git a/include/winami.h b/include/winami.h index ee3ea875b..752d027cf 100644 --- a/include/winami.h +++ b/include/winami.h @@ -8,7 +8,7 @@ #ifndef WINAMI_H #define WINAMI_H -#define MAXWINTAGS 5 +#define MAXWINTAGS 5 /* * Information specific to a menu window. First a structure for each @@ -16,113 +16,116 @@ */ typedef struct amii_mi { struct amii_mi *next; - anything identifier; /* Opaque type to identify this selection */ - long glyph; /* Glyph for menu item */ - long count; /* Object count */ - char selected; /* Been selected? */ - char selector; /* Char used to select this entry. */ - char gselector; /* Group selector */ - char canselect; /* Can user select this entry. */ - char attr; /* Attribute for the line. */ - char *str; /* The text of the item. */ + anything identifier; /* Opaque type to identify this selection */ + long glyph; /* Glyph for menu item */ + long count; /* Object count */ + char selected; /* Been selected? */ + char selector; /* Char used to select this entry. */ + char gselector; /* Group selector */ + char canselect; /* Can user select this entry. */ + char attr; /* Attribute for the line. */ + char *str; /* The text of the item. */ } amii_menu_item; -struct amii_menu -{ - amii_menu_item *items; /* Starting pointer for item list. */ - amii_menu_item *last; /* End pointer for item list. */ - const char *query; /* Query string */ - int count; /* Number of strings. */ - char chr; /* Character to assign for accelerator */ +struct amii_menu { + amii_menu_item *items; /* Starting pointer for item list. */ + amii_menu_item *last; /* End pointer for item list. */ + const char *query; /* Query string */ + int count; /* Number of strings. */ + char chr; /* Character to assign for accelerator */ }; /* descriptor for Amiga Intuition-based windows. If we decide to cope with * tty-style windows also, then things will need to change. */ /* per-window data */ struct amii_WinDesc { - xchar type; /* type of window */ + xchar 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 */ - short vwx, vwy, vcx, vcy; /* View cursor location */ - short rows, cols; /* dimensions */ - short curx, cury; /* current cursor position */ - short maxrow, maxcol; /* the maximum size used -- for INVEN wins */ - /* maxcol is also used by WIN_MESSAGE for */ - /* tracking the ^P command */ - char **data; /* window data [row][column] */ - menu_item *mi; /* Menu information */ - char *resp; /* valid menu responses (for NHW_INVEN) */ - char *canresp; /* cancel responses; 1st is the return value */ - char *morestr; /* string to display instead of default */ -/* amiga stuff */ - struct Window *win; /* Intuition window pointer */ -#ifdef INTUI_NEW_LOOK - struct ExtNewWindow *newwin; /* NewWindow alloc'd */ + 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 */ + short vwx, vwy, vcx, vcy; /* View cursor location */ + short rows, cols; /* dimensions */ + short curx, cury; /* current cursor position */ + short maxrow, maxcol; /* the maximum size used -- for INVEN wins */ + /* maxcol is also used by WIN_MESSAGE for */ + /* tracking the ^P command */ + char **data; /* window data [row][column] */ + menu_item *mi; /* Menu information */ + char *resp; /* valid menu responses (for NHW_INVEN) */ + char *canresp; /* cancel responses; 1st is the return value */ + char *morestr; /* string to display instead of default */ + /* amiga stuff */ + struct Window *win; /* Intuition window pointer */ +#ifdef INTUI_NEW_LOOK + struct ExtNewWindow *newwin; /* NewWindow alloc'd */ #else - struct NewWindow *newwin; /* ExtNewWindow alloc'd */ + struct NewWindow *newwin; /* ExtNewWindow alloc'd */ #endif -#ifdef INTUI_NEW_LOOK - struct TagItem wintags[ MAXWINTAGS ];/* Tag items for this window */ +#ifdef INTUI_NEW_LOOK + struct TagItem wintags[MAXWINTAGS]; /* Tag items for this window */ #else - long wintags[ MAXWINTAGS*2 ]; + long wintags[MAXWINTAGS * 2]; #endif - void *hook; /* Hook structure pointer for tiles version */ -#define FLMAP_INGLYPH 1 /* An NHW_MAP window is in glyph mode */ -#define FLMAP_CURSUP 2 /* An NHW_MAP window has the cursor displayed */ -#define FLMAP_SKIP 4 -#define FLMSG_FIRST 1 /* First message in the NHW_MESSAGE window for this turn */ + void *hook; /* Hook structure pointer for tiles version */ +#define FLMAP_INGLYPH 1 /* An NHW_MAP window is in glyph mode */ +#define FLMAP_CURSUP 2 /* An NHW_MAP window has the cursor displayed */ +#define FLMAP_SKIP 4 +#define FLMSG_FIRST \ + 1 /* First message in the NHW_MESSAGE window for this turn */ long wflags; - short cursx, cursy; /* Where the cursor is displayed at */ - short curs_apen, /* Color cursor is displayed in */ - curs_bpen; + short cursx, cursy; /* Where the cursor is displayed at */ + short curs_apen, /* Color cursor is displayed in */ + curs_bpen; }; /* descriptor for intuition-based displays -- all the per-display data */ /* this is a generic thing - think of it as Screen level */ struct amii_DisplayDesc { -/* we need this for Screen size (which will vary with display mode) */ - uchar rows, cols; /* width & height of display in text units */ - short xpix, ypix; /* width and height of display in pixels */ - int toplin; /* flag for topl stuff */ - int rawprint; /* number of raw_printed lines since synch */ - winid lastwin; /* last window used for I/O */ + /* we need this for Screen size (which will vary with display mode) */ + uchar rows, cols; /* width & height of display in text units */ + short xpix, ypix; /* width and height of display in pixels */ + int toplin; /* flag for topl stuff */ + int rawprint; /* number of raw_printed lines since synch */ + winid lastwin; /* last window used for I/O */ }; typedef enum { - WEUNK, WEKEY, WEMOUSE, WEMENU, + WEUNK, + WEKEY, + WEMOUSE, + WEMENU, } WETYPE; -typedef struct WEVENT -{ +typedef struct WEVENT { WETYPE type; union { - int key; - struct { - int x, y; - int qual; - } mouse; - long menucode; + int key; + struct { + int x, y; + int qual; + } mouse; + long menucode; } un; } WEVENT; -#define MAXWIN 20 /* maximum number of windows, cop-out */ +#define MAXWIN 20 /* maximum number of windows, cop-out */ /* port specific variable declarations */ extern winid WIN_BASE; extern winid WIN_OVER; -#define NHW_BASE 6 -#define NHW_OVER 7 /* overview window */ - +#define NHW_BASE 6 +#define NHW_OVER 7 /* overview window */ extern struct amii_WinDesc *amii_wins[MAXWIN + 1]; -extern struct amii_DisplayDesc *amiIDisplay; /* the Amiga Intuition descriptor */ +extern struct amii_DisplayDesc + *amiIDisplay; /* the Amiga Intuition descriptor */ -extern char morc; /* last character typed to xwaitforspace */ -extern char defmorestr[]; /* default --more-- prompt */ +extern char morc; /* last character typed to xwaitforspace */ +extern char defmorestr[]; /* default --more-- prompt */ #endif /* WINAMI_H */ diff --git a/include/wingem.h b/include/wingem.h index 29f516f4b..8d88c5bd8 100644 --- a/include/wingem.h +++ b/include/wingem.h @@ -9,18 +9,18 @@ #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; +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 */ +#define MAXWIN 20 /* maximum number of windows, cop-out */ extern struct window_procs Gem_procs; @@ -34,14 +34,14 @@ 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 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)); 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 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); @@ -58,7 +58,7 @@ E void NDECL(mar_map_curs_weiter); 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 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); @@ -67,15 +67,15 @@ 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_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_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 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); @@ -85,7 +85,7 @@ E void FDECL(Gem_cliparound, (int, int)); #ifdef POSITIONBAR E void FDECL(Gem_update_positionbar, (char *)); #endif -E void FDECL(Gem_print_glyph, (winid,XCHAR_P,XCHAR_P,int)); +E void FDECL(Gem_print_glyph, (winid, XCHAR_P, XCHAR_P, int)); E void FDECL(Gem_raw_print, (const char *)); E void FDECL(Gem_raw_print_bold, (const char *)); E int NDECL(Gem_nhgetch); @@ -93,20 +93,20 @@ 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 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); +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)); +E void FDECL(genl_outrip, (winid, int, time_t)); #undef E diff --git a/include/winprocs.h b/include/winprocs.h index 4e334d630..32e4156a2 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -10,15 +10,16 @@ /* 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. */ - unsigned long wincap; /* window port capability options supported */ - unsigned long wincap2; /* additional window port capability options supported */ + const char *name; /* Names should start with [a-z]. Names must + * not start with '-'. Names starting with + * '+' are reserved for processors. */ + unsigned long wincap; /* window port capability options supported */ + unsigned long + wincap2; /* additional window port capability options supported */ void FDECL((*win_init_nhwindows), (int *, char **)); void NDECL((*win_player_selection)); void NDECL((*win_askname)); - void NDECL((*win_get_nh_event)) ; + 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)); @@ -26,16 +27,16 @@ struct window_procs { 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_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_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 *)); + 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)); @@ -45,7 +46,7 @@ struct window_procs { #ifdef POSITIONBAR void FDECL((*win_update_positionbar), (char *)); #endif - void FDECL((*win_print_glyph), (winid,XCHAR_P,XCHAR_P,int)); + void FDECL((*win_print_glyph), (winid, XCHAR_P, XCHAR_P, int)); void FDECL((*win_raw_print), (const char *)); void FDECL((*win_raw_print_bold), (const char *)); int NDECL((*win_nhgetch)); @@ -53,44 +54,45 @@ struct window_procs { 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 *)); + void FDECL((*win_getlin), (const char *, char *)); int NDECL((*win_get_ext_cmd)); void FDECL((*win_number_pad), (int)); void NDECL((*win_delay_output)); #ifdef CHANGE_COLOR - void FDECL((*win_change_color), (int,long,int)); + void FDECL((*win_change_color), (int, long, int)); #ifdef MAC void FDECL((*win_change_background), (int)); short FDECL((*win_set_font_name), (winid, char *)); #endif - char * NDECL((*win_get_color_string)); + char *NDECL((*win_get_color_string)); #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_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)); + char *FDECL((*win_getmsghistory), (BOOLEAN_P)); + void FDECL((*win_putmsghistory), (const char *, BOOLEAN_P)); #ifdef STATUS_VIA_WINDOWPORT 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)); -# ifdef STATUS_HILITES - void FDECL((*win_status_threshold), (int,int,anything,int,int,int)); -# endif + void FDECL((*win_status_enablefield), + (int, const char *, const char *, BOOLEAN_P)); + void FDECL((*win_status_update), (int, genericptr_t, int, int)); +#ifdef STATUS_HILITES + void FDECL((*win_status_threshold), (int, int, anything, int, int, int)); +#endif #endif boolean NDECL((*win_can_suspend)); }; extern #ifdef HANGUPHANDLING -volatile + volatile #endif -NEARDATA struct window_procs windowprocs; + NEARDATA struct window_procs windowprocs; /* * If you wish to only support one window system and not use procedure @@ -176,132 +178,155 @@ NEARDATA struct window_procs windowprocs; * Window port preference capability bits. * Some day this might be better in its own wincap.h file. */ -#define WC_COLOR 0x01L /* 01 Port can display things in color */ -#define WC_HILITE_PET 0x02L /* 02 supports hilite pet */ -#define WC_ASCII_MAP 0x04L /* 03 supports an ascii map */ -#define WC_TILED_MAP 0x08L /* 04 supports a tiled map */ -#define WC_PRELOAD_TILES 0x10L /* 05 supports pre-loading tiles */ -#define WC_TILE_WIDTH 0x20L /* 06 prefer this width of tile */ -#define WC_TILE_HEIGHT 0x40L /* 07 prefer this height of tile */ -#define WC_TILE_FILE 0x80L /* 08 alternative tile file name */ -#define WC_INVERSE 0x100L /* 09 Port supports inverse video */ -#define WC_ALIGN_MESSAGE 0x200L /* 10 supports message alignmt top|b|l|r */ -#define WC_ALIGN_STATUS 0x400L /* 11 supports status alignmt top|b|l|r */ -#define WC_VARY_MSGCOUNT 0x800L /* 12 supports varying message window */ -#define WC_FONT_MAP 0x1000L /* 13 supports specification of map win font */ -#define WC_FONT_MESSAGE 0x2000L /* 14 supports specification of msg win font */ -#define WC_FONT_STATUS 0x4000L /* 15 supports specification of sts win font */ -#define WC_FONT_MENU 0x8000L /* 16 supports specification of mnu win font */ -#define WC_FONT_TEXT 0x10000L /* 17 supports specification of txt win font */ -#define WC_FONTSIZ_MAP 0x20000L /* 18 supports specification of map win font */ -#define WC_FONTSIZ_MESSAGE 0x40000L /* 19 supports specification of msg win font */ -#define WC_FONTSIZ_STATUS 0x80000L /* 20 supports specification of sts win font */ -#define WC_FONTSIZ_MENU 0x100000L /* 21 supports specification of mnu win font */ -#define WC_FONTSIZ_TEXT 0x200000L /* 22 supports specification of txt win font */ -#define WC_SCROLL_MARGIN 0x400000L /* 23 supports setting scroll margin for map */ -#define WC_SPLASH_SCREEN 0x800000L /* 24 supports display of splash screen */ -#define WC_POPUP_DIALOG 0x1000000L /* 25 supports queries in pop dialogs */ -#define WC_SCROLL_AMOUNT 0x2000000L /* 26 scroll this amount at scroll margin */ -#define WC_EIGHT_BIT_IN 0x4000000L /* 27 8-bit character input */ -#define WC_PERM_INVENT 0x8000000L /* 28 8-bit character input */ -#define WC_MAP_MODE 0x10000000L /* 29 map_mode option */ -#define WC_WINDOWCOLORS 0x20000000L /* 30 background color for message window */ -#define WC_PLAYER_SELECTION 0x40000000L /* 31 background color for message window */ +#define WC_COLOR 0x01L /* 01 Port can display things in color */ +#define WC_HILITE_PET 0x02L /* 02 supports hilite pet */ +#define WC_ASCII_MAP 0x04L /* 03 supports an ascii map */ +#define WC_TILED_MAP 0x08L /* 04 supports a tiled map */ +#define WC_PRELOAD_TILES 0x10L /* 05 supports pre-loading tiles */ +#define WC_TILE_WIDTH 0x20L /* 06 prefer this width of tile */ +#define WC_TILE_HEIGHT 0x40L /* 07 prefer this height of tile */ +#define WC_TILE_FILE 0x80L /* 08 alternative tile file name */ +#define WC_INVERSE 0x100L /* 09 Port supports inverse video */ +#define WC_ALIGN_MESSAGE \ + 0x200L /* 10 supports message alignmt top|b|l|r */ +#define WC_ALIGN_STATUS 0x400L /* 11 supports status alignmt top|b|l|r */ +#define WC_VARY_MSGCOUNT \ + 0x800L /* 12 supports varying message window */ +#define WC_FONT_MAP 0x1000L /* 13 supports specification of map win font */ +#define WC_FONT_MESSAGE \ + 0x2000L /* 14 supports specification of msg win font */ +#define WC_FONT_STATUS 0x4000L /* 15 supports specification of sts win font \ + */ +#define WC_FONT_MENU 0x8000L /* 16 supports specification of mnu win font */ +#define WC_FONT_TEXT 0x10000L /* 17 supports specification of txt win font \ + */ +#define WC_FONTSIZ_MAP \ + 0x20000L /* 18 supports specification of map win font */ +#define WC_FONTSIZ_MESSAGE \ + 0x40000L /* 19 supports specification of msg win font */ +#define WC_FONTSIZ_STATUS \ + 0x80000L /* 20 supports specification of sts win font */ +#define WC_FONTSIZ_MENU \ + 0x100000L /* 21 supports specification of mnu win font */ +#define WC_FONTSIZ_TEXT \ + 0x200000L /* 22 supports specification of txt win font */ +#define WC_SCROLL_MARGIN \ + 0x400000L /* 23 supports setting scroll margin for map */ +#define WC_SPLASH_SCREEN \ + 0x800000L /* 24 supports display of splash screen */ +#define WC_POPUP_DIALOG \ + 0x1000000L /* 25 supports queries in pop dialogs */ +#define WC_SCROLL_AMOUNT \ + 0x2000000L /* 26 scroll this amount at scroll margin */ +#define WC_EIGHT_BIT_IN \ + 0x4000000L /* 27 8-bit character input */ +#define WC_PERM_INVENT \ + 0x8000000L /* 28 8-bit character input */ +#define WC_MAP_MODE \ + 0x10000000L /* 29 map_mode option */ +#define WC_WINDOWCOLORS \ + 0x20000000L /* 30 background color for message window */ +#define WC_PLAYER_SELECTION \ + 0x40000000L /* 31 background color for message window */ #ifdef NHSTDC -#define WC_MOUSE_SUPPORT 0x80000000UL /* 32 mouse support */ +#define WC_MOUSE_SUPPORT \ + 0x80000000UL /* 32 mouse support */ #else -#define WC_MOUSE_SUPPORT 0x80000000L /* 32 mouse support */ +#define WC_MOUSE_SUPPORT \ + 0x80000000L /* 32 mouse support */ #endif - /* no free bits */ +/* no free bits */ -#define WC2_FULLSCREEN 0x01L /* 01 display full screen */ -#define WC2_SOFTKEYBOARD 0x02L /* 02 software keyboard */ -#define WC2_WRAPTEXT 0x04L /* 03 wrap long lines of text */ -#define WC2_HILITE_STATUS 0x08L /* 04 hilite fields in status */ -#define WC2_SELECTSAVED 0x10L /* 05 saved game selection menu */ -#define WC2_DARKGRAY 0x20L /* 06 use bold black for black glyphs */ - /* 26 free bits */ +#define WC2_FULLSCREEN 0x01L /* 01 display full screen */ +#define WC2_SOFTKEYBOARD 0x02L /* 02 software keyboard */ +#define WC2_WRAPTEXT 0x04L /* 03 wrap long lines of text */ +#define WC2_HILITE_STATUS \ + 0x08L /* 04 hilite fields in status */ +#define WC2_SELECTSAVED 0x10L /* 05 saved game selection menu */ +#define WC2_DARKGRAY 0x20L /* 06 use bold black for black glyphs */ + /* 26 free bits */ -#define ALIGN_LEFT 1 -#define ALIGN_RIGHT 2 -#define ALIGN_TOP 3 -#define ALIGN_BOTTOM 4 +#define ALIGN_LEFT 1 +#define ALIGN_RIGHT 2 +#define ALIGN_TOP 3 +#define ALIGN_BOTTOM 4 /* player_selection */ -#define VIA_DIALOG 0 -#define VIA_PROMPTS 1 +#define VIA_DIALOG 0 +#define VIA_PROMPTS 1 /* map_mode settings - deprecated */ -#define MAP_MODE_TILES 0 -#define MAP_MODE_ASCII4x6 1 -#define MAP_MODE_ASCII6x8 2 -#define MAP_MODE_ASCII8x8 3 -#define MAP_MODE_ASCII16x8 4 -#define MAP_MODE_ASCII7x12 5 -#define MAP_MODE_ASCII8x12 6 -#define MAP_MODE_ASCII16x12 7 -#define MAP_MODE_ASCII12x16 8 -#define MAP_MODE_ASCII10x18 9 +#define MAP_MODE_TILES 0 +#define MAP_MODE_ASCII4x6 1 +#define MAP_MODE_ASCII6x8 2 +#define MAP_MODE_ASCII8x8 3 +#define MAP_MODE_ASCII16x8 4 +#define MAP_MODE_ASCII7x12 5 +#define MAP_MODE_ASCII8x12 6 +#define MAP_MODE_ASCII16x12 7 +#define MAP_MODE_ASCII12x16 8 +#define MAP_MODE_ASCII10x18 9 #define MAP_MODE_ASCII_FIT_TO_SCREEN 10 #define MAP_MODE_TILES_FIT_TO_SCREEN 11 #if 0 -#define WC_SND_SOUND 0x01L /* 01 Port has some sound capabilities */ -#define WC_SND_SPEAKER 0x02L /* 02 Sound supported via built-in speaker */ -#define WC_SND_STEREO 0x04L /* 03 Stereo sound supported */ -#define WC_SND_RAW 0x08L /* 04 Raw sound supported */ -#define WC_SND_WAVE 0x10L /* 05 Wave support */ -#define WC_SND_MIDI 0x20L /* 06 Midi support */ +#define WC_SND_SOUND 0x01L /* 01 Port has some sound capabilities */ +#define WC_SND_SPEAKER 0x02L /* 02 Sound supported via built-in speaker */ +#define WC_SND_STEREO 0x04L /* 03 Stereo sound supported */ +#define WC_SND_RAW 0x08L /* 04 Raw sound supported */ +#define WC_SND_WAVE 0x10L /* 05 Wave support */ +#define WC_SND_MIDI 0x20L /* 06 Midi support */ /* 26 free bits */ #endif struct wc_Opt { - const char *wc_name; - unsigned long wc_bit; + const char *wc_name; + unsigned long wc_bit; }; /* role selection by player_selection(); this ought to be in the core... */ -#define RS_NAME 0 -#define RS_ROLE 1 -#define RS_RACE 2 -#define RS_GENDER 3 -#define RS_ALGNMNT 4 -#define RS_menu_arg(x) (ROLE_RANDOM - ((x) + 1)) /* 0..4 -> -3..-7 */ +#define RS_NAME 0 +#define RS_ROLE 1 +#define RS_RACE 2 +#define RS_GENDER 3 +#define RS_ALGNMNT 4 +#define RS_menu_arg(x) (ROLE_RANDOM - ((x) + 1)) /* 0..4 -> -3..-7 */ /* Choose_windows() may be called multiple times; these constants tell the * init function whether the window system is coming or going. */ -#define WININIT 0 -#define WININIT_UNDO 1 +#define WININIT 0 +#define WININIT_UNDO 1 #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) - self is the Xprivate* returned earlier - next is struct winprocs * or struct chainprocs * for the next link - nextdata is the Xprivate* for the next link in the chain + Xprivate* is anything window chain entry type X wants back + n is the link count (starting with 1) + self is the Xprivate* returned earlier + next is struct winprocs * or struct chainprocs * for the next link + nextdata is the Xprivate* for the next link in the chain */ -#define WINCHAIN_ALLOC 0 -#define WINCHAIN_INIT 1 +#define WINCHAIN_ALLOC 0 +#define WINCHAIN_INIT 1 #define CARGS void * -extern FILE *wc_tracelogf; /* Expose log file for additional debugging. */ +extern FILE *wc_tracelogf; /* Expose log file for additional debugging. */ struct chain_procs { - const char *name; /* Names should start with [a-z]. Names must - * not start with '-'. Names starting with - * '+' are reserved for processors. */ - unsigned long wincap; /* window port capability options supported */ - unsigned long wincap2; /* additional window port capability options supported */ + const char *name; /* Names should start with [a-z]. Names must + * not start with '-'. Names starting with + * '+' are reserved for processors. */ + unsigned long wincap; /* window port capability options supported */ + unsigned long + wincap2; /* additional window port capability options supported */ 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_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)); @@ -309,16 +334,16 @@ struct chain_procs { 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_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_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 *)); + 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)); @@ -328,43 +353,46 @@ struct chain_procs { #ifdef POSITIONBAR void FDECL((*win_update_positionbar), (CARGS, char *)); #endif - void FDECL((*win_print_glyph), (CARGS, winid,XCHAR_P,XCHAR_P,int)); + void FDECL((*win_print_glyph), (CARGS, winid, XCHAR_P, XCHAR_P, 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 *)); + 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)); #ifdef CHANGE_COLOR - void FDECL((*win_change_color), (CARGS, int,long,int)); + 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 *)); #endif - char * FDECL((*win_get_color_string), (CARGS)); + char *FDECL((*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_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)); + char *FDECL((*win_getmsghistory), (CARGS, BOOLEAN_P)); + void FDECL((*win_putmsghistory), (CARGS, const char *, BOOLEAN_P)); #ifdef STATUS_VIA_WINDOWPORT 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)); -# ifdef STATUS_HILITES - void FDECL((*win_status_threshold), (CARGS, int,int,anything,int,int,int)); -# endif + void FDECL((*win_status_enablefield), + (CARGS, int, const char *, const char *, BOOLEAN_P)); + void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int)); +#ifdef STATUS_HILITES + void FDECL((*win_status_threshold), + (CARGS, int, int, anything, int, int, int)); +#endif #endif boolean FDECL((*win_can_suspend), (CARGS)); }; diff --git a/include/wintty.h b/include/wintty.h index 148d1707d..9f0629e24 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -14,69 +14,69 @@ /* menu structure */ typedef struct tty_mi { struct tty_mi *next; - anything identifier; /* user identifier */ - long count; /* user count */ - char *str; /* description string (including accelerator) */ - int attr; /* string attribute */ - boolean selected; /* TRUE if selected by user */ - char selector; /* keyboard accelerator */ - char gselector; /* group accelerator */ + anything identifier; /* user identifier */ + long count; /* user count */ + char *str; /* description string (including accelerator) */ + int attr; /* string attribute */ + boolean selected; /* TRUE if selected by user */ + 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 */ - short *datlen; /* allocation size for *data */ - char **data; /* window data [row][column] */ - char *morestr; /* string to display instead of default */ - tty_menu_item *mlist; /* menu information (MENU) */ - tty_menu_item **plist; /* menu page pointers (MENU) */ - long plist_size; /* size of allocated plist (MENU) */ - long npages; /* number of pages in menu (MENU) */ - long nitems; /* total number of items (MENU) */ - short how; /* menu mode - pick 1 or N (MENU) */ - char menu_ch; /* menu char (MENU) */ + 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 */ + short *datlen; /* allocation size for *data */ + char **data; /* window data [row][column] */ + char *morestr; /* string to display instead of default */ + tty_menu_item *mlist; /* menu information (MENU) */ + tty_menu_item **plist; /* menu page pointers (MENU) */ + long plist_size; /* size of allocated plist (MENU) */ + long npages; /* number of pages in menu (MENU) */ + long nitems; /* total number of items (MENU) */ + short how; /* menu mode - pick 1 or N (MENU) */ + char menu_ch; /* menu char (MENU) */ }; /* window flags */ #define WIN_CANCELLED 1 -#define WIN_STOP 1 /* for NHW_MESSAGE; stops output */ -#define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */ +#define WIN_STOP 1 /* for NHW_MESSAGE; stops output */ +#define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */ /* 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 */ + short rows, cols; /* width and height of tty display */ + short curx, cury; /* current cursor position on the screen */ #ifdef TEXTCOLOR - int color; /* current color */ + 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-- */ + 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-- */ }; #endif /* WINDOW_STRUCTS */ -#define MAXWIN 20 /* maximum number of windows, cop-out */ +#define MAXWIN 20 /* maximum number of windows, cop-out */ /* tty dependent window types */ #ifdef NHW_BASE #undef NHW_BASE #endif -#define NHW_BASE 6 +#define NHW_BASE 6 extern struct window_procs tty_procs; @@ -85,10 +85,10 @@ extern winid BASE_WINDOW; extern struct WinDesc *wins[MAXWIN]; -extern struct DisplayDesc *ttyDisplay; /* the tty display descriptor */ +extern struct DisplayDesc *ttyDisplay; /* the tty display descriptor */ -extern char morc; /* last character typed to xwaitforspace */ -extern char defmorestr[]; /* default --more-- prompt */ +extern char morc; /* last character typed to xwaitforspace */ +extern char defmorestr[]; /* default --more-- prompt */ /* port specific external function references */ @@ -97,7 +97,7 @@ E void FDECL(xwaitforspace, (const char *)); /* ### termcap.c, video.c ### */ -E void FDECL(tty_startup,(int*, int*)); +E void FDECL(tty_startup, (int *, int *)); #ifndef NO_TERMS E void NDECL(tty_shutdown); #endif @@ -120,13 +120,13 @@ E void NDECL(clear_screen); E void NDECL(home); E void NDECL(standoutbeg); E void NDECL(standoutend); -# if 0 +#if 0 E void NDECL(revbeg); E void NDECL(boldbeg); E void NDECL(blinkbeg); E void NDECL(dimbeg); E void NDECL(m_end); -# endif +#endif E void NDECL(backsp); E void NDECL(graph_on); E void NDECL(graph_off); @@ -138,24 +138,23 @@ E void NDECL(cl_eos); * a color or whatever. wintty.c should concern itself with WHERE to put * stuff in a window. */ -E void FDECL(term_start_attr,(int attr)); -E void FDECL(term_end_attr,(int attr)); +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)); +E void FDECL(term_start_color, (int color)); +E int FDECL(has_color, (int color)); #endif /* TEXTCOLOR */ - /* ### topl.c ### */ E void FDECL(addtopl, (const char *)); E void NDECL(more); E void FDECL(update_topl, (const char *)); -E void FDECL(putsyms, (const char*)); +E void FDECL(putsyms, (const char *)); /* ### wintty.c ### */ #ifdef CLIPPING @@ -170,7 +169,7 @@ E void FDECL(win_tty_init, (int)); E void FDECL(tty_init_nhwindows, (int *, char **)); E void NDECL(tty_player_selection); E void NDECL(tty_askname); -E void NDECL(tty_get_nh_event) ; +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); @@ -179,15 +178,15 @@ 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_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_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 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); @@ -197,7 +196,7 @@ E void FDECL(tty_cliparound, (int, int)); #ifdef POSITIONBAR E void FDECL(tty_update_positionbar, (char *)); #endif -E void FDECL(tty_print_glyph, (winid,XCHAR_P,XCHAR_P,int)); +E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P, int)); E void FDECL(tty_raw_print, (const char *)); E void FDECL(tty_raw_print_bold, (const char *)); E int NDECL(tty_nhgetch); @@ -205,56 +204,55 @@ 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 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); #ifdef CHANGE_COLOR -E void FDECL(tty_change_color,(int color,long rgb,int reverse)); +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 void FDECL(tty_change_background, (int white_or_black)); E short FDECL(set_tty_font_name, (winid, char *)); #endif -E char * NDECL(tty_get_color_string); +E char *NDECL(tty_get_color_string); #endif /* other defs that really should go away (they're tty specific) */ E void NDECL(tty_start_screen); E void NDECL(tty_end_screen); -E void FDECL(genl_outrip, (winid,int,time_t)); +E void FDECL(genl_outrip, (winid, int, time_t)); E char *FDECL(tty_getmsghistory, (BOOLEAN_P)); -E void FDECL(tty_putmsghistory, (const char *,BOOLEAN_P)); - +E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); #ifdef NO_TERMS -# ifdef MAC -# ifdef putchar -# undef putchar -# undef putc -# endif -# define putchar term_putc -# define fflush term_flush -# define puts term_puts +#ifdef MAC +#ifdef putchar +#undef putchar +#undef putc +#endif +#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 */ -# if defined(MSDOS) || defined(WIN32) -# if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32) -# undef putchar -# undef putc -# undef puts -# define putchar(x) xputc(x) /* these are in video.c, nttty.c */ -# define putc(x) xputc(x) -# define puts(x) xputs(x) -# endif/*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32 */ -# ifdef POSITIONBAR +#endif /* MAC */ +#if defined(MSDOS) || defined(WIN32) +#if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32) +#undef putchar +#undef putc +#undef puts +#define putchar(x) xputc(x) /* these are in video.c, nttty.c */ +#define putc(x) xputc(x) +#define puts(x) xputs(x) +#endif /*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32 */ +#ifdef POSITIONBAR E void FDECL(video_update_positionbar, (char *)); -# endif -# endif/*MSDOS*/ -#endif/*NO_TERMS*/ +#endif +#endif /*MSDOS*/ +#endif /*NO_TERMS*/ #undef E diff --git a/include/wintype.h b/include/wintype.h index 924a23cf5..cccc928ce 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -1,20 +1,20 @@ -/* NetHack 3.6 wintype.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* NetHack 3.6 wintype.h $Date: 2009/05/06 10:45:19 $ $Revision: 1.10 $ */ -/* SCCS Id: @(#)wintype.h 3.5 2006/07/08 */ -/* Copyright (c) David Cohrs, 1991 */ +/* NetHack 3.6 wintype.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.6 wintype.h $Date: 2009/05/06 10:45:19 $ $Revision: 1.10 $ */ +/* SCCS Id: @(#)wintype.h 3.5 2006/07/08 */ +/* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ #ifndef WINTYPE_H #define WINTYPE_H -typedef int winid; /* a window identifier */ +typedef int winid; /* a window identifier */ /* generic parameter - must not be any larger than a pointer */ typedef union any { genericptr_t a_void; struct obj *a_obj; struct monst *a_monst; - int a_int; + int a_int; char a_char; schar a_schar; unsigned int a_uint; @@ -27,72 +27,76 @@ typedef union any { /* add types as needed */ } anything; #define ANY_P union any /* avoid typedef in prototypes */ - /* (buggy old Ultrix compiler) */ + /* (buggy old Ultrix compiler) */ /* symbolic names for the data types housed in anything */ -#define ANY_VOID 1 -#define ANY_OBJ 2 /* struct obj */ -#define ANY_MONST 3 /* struct monst (not used) */ -#define ANY_INT 4 /* int */ -#define ANY_CHAR 5 /* char */ -#define ANY_UCHAR 6 /* unsigned char */ -#define ANY_SCHAR 7 /* signed char */ -#define ANY_UINT 8 /* unsigned int */ -#define ANY_LONG 9 /* long */ -#define ANY_ULONG 10 /* unsigned long */ -#define ANY_IPTR 11 /* pointer to int */ -#define ANY_UPTR 12 /* pointer to unsigned int */ -#define ANY_LPTR 13 /* pointer to long */ -#define ANY_ULPTR 14 /* pointer to unsigned long */ -#define ANY_STR 15 /* pointer to null-terminated char string */ -#define ANY_MASK32 16 /* mask of 32 bits (stored as unsigned long) */ - +/* clang-format off */ +#define ANY_VOID 1 +#define ANY_OBJ 2 /* struct obj */ +#define ANY_MONST 3 /* struct monst (not used) */ +#define ANY_INT 4 /* int */ +#define ANY_CHAR 5 /* char */ +#define ANY_UCHAR 6 /* unsigned char */ +#define ANY_SCHAR 7 /* signed char */ +#define ANY_UINT 8 /* unsigned int */ +#define ANY_LONG 9 /* long */ +#define ANY_ULONG 10 /* unsigned long */ +#define ANY_IPTR 11 /* pointer to int */ +#define ANY_UPTR 12 /* pointer to unsigned int */ +#define ANY_LPTR 13 /* pointer to long */ +#define ANY_ULPTR 14 /* pointer to unsigned long */ +#define ANY_STR 15 /* pointer to null-terminated char string */ +#define ANY_MASK32 16 /* 32-bit mask (stored as unsigned long) */ +/* clang-format on */ + /* menu return list */ typedef struct mi { - anything item; /* identifier */ - long count; /* count */ + anything item; /* identifier */ + long count; /* count */ } menu_item; #define MENU_ITEM_P struct mi /* select_menu() "how" argument types */ -#define PICK_NONE 0 /* user picks nothing (display only) */ -#define PICK_ONE 1 /* only pick one */ -#define PICK_ANY 2 /* can pick any amount */ +#define PICK_NONE 0 /* user picks nothing (display only) */ +#define PICK_ONE 1 /* only pick one */ +#define PICK_ANY 2 /* can pick any amount */ /* window types */ /* any additional port specific types should be defined in win*.h */ #define NHW_MESSAGE 1 -#define NHW_STATUS 2 -#define NHW_MAP 3 -#define NHW_MENU 4 -#define NHW_TEXT 5 +#define NHW_STATUS 2 +#define NHW_MAP 3 +#define NHW_MENU 4 +#define NHW_TEXT 5 /* 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_ULINE 4 -#define ATR_BLINK 5 +#define ATR_NONE 0 +#define ATR_BOLD 1 +#define ATR_DIM 2 +#define ATR_ULINE 4 +#define ATR_BLINK 5 #define ATR_INVERSE 7 /* nh_poskey() modifier types */ -#define CLICK_1 1 -#define CLICK_2 2 +#define CLICK_1 1 +#define CLICK_2 2 /* invalid winid */ #define WIN_ERR ((winid) -1) /* menu window keyboard commands (may be mapped) */ -#define MENU_FIRST_PAGE '^' -#define MENU_LAST_PAGE '|' -#define MENU_NEXT_PAGE '>' -#define MENU_PREVIOUS_PAGE '<' -#define MENU_SELECT_ALL '.' -#define MENU_UNSELECT_ALL '-' -#define MENU_INVERT_ALL '@' -#define MENU_SELECT_PAGE ',' -#define MENU_UNSELECT_PAGE '\\' -#define MENU_INVERT_PAGE '~' -#define MENU_SEARCH ':' +/* clang-format off */ +#define MENU_FIRST_PAGE '^' +#define MENU_LAST_PAGE '|' +#define MENU_NEXT_PAGE '>' +#define MENU_PREVIOUS_PAGE '<' +#define MENU_SELECT_ALL '.' +#define MENU_UNSELECT_ALL '-' +#define MENU_INVERT_ALL '@' +#define MENU_SELECT_PAGE ',' +#define MENU_UNSELECT_PAGE '\\' +#define MENU_INVERT_PAGE '~' +#define MENU_SEARCH ':' +/* clang-format on */ #endif /* WINTYPE_H */ diff --git a/include/xwindow.h b/include/xwindow.h index 7fa05020a..b6715fa25 100644 --- a/include/xwindow.h +++ b/include/xwindow.h @@ -55,40 +55,40 @@ resizeCallback Callback Callback NULL */ -/* define any special resource names here that are not in */ - -#define XtNrows "rows" -#define XtNcolumns "columns" -#define XtNblack "black" -#define XtNred "red" -#define XtNgreen "green" -#define XtNbrown "brown" -#define XtNblue "blue" -#define XtNmagenta "magenta" -#define XtNcyan "cyan" -#define XtNgray "gray" -#define XtNorange "orange" -#define XtNbright_green "bright_green" -#define XtNyellow "yellow" -#define XtNbright_blue "bright_blue" -#define XtNbright_magenta "bright_magenta" -#define XtNbright_cyan "bright_cyan" -#define XtNwhite "white" -#define XtNexposeCallback "exposeCallback" -#define XtNresizeCallback "resizeCallback" - +/* define any special resource names here that are not in + */ + +#define XtNrows "rows" +#define XtNcolumns "columns" +#define XtNblack "black" +#define XtNred "red" +#define XtNgreen "green" +#define XtNbrown "brown" +#define XtNblue "blue" +#define XtNmagenta "magenta" +#define XtNcyan "cyan" +#define XtNgray "gray" +#define XtNorange "orange" +#define XtNbright_green "bright_green" +#define XtNyellow "yellow" +#define XtNbright_blue "bright_blue" +#define XtNbright_magenta "bright_magenta" +#define XtNbright_cyan "bright_cyan" +#define XtNwhite "white" +#define XtNexposeCallback "exposeCallback" +#define XtNresizeCallback "resizeCallback" extern XFontStruct *WindowFontStruct(/* Widget */); extern Font WindowFont(/* Widget */); #define XtCWindowResource "WindowResource" -#define XtCRows "Rows" -#define XtCColumns "Columns" +#define XtCRows "Rows" +#define XtCColumns "Columns" /* declare specific WindowWidget class and instance datatypes */ -typedef struct _WindowClassRec *WindowWidgetClass; -typedef struct _WindowRec *WindowWidget; +typedef struct _WindowClassRec *WindowWidgetClass; +typedef struct _WindowRec *WindowWidget; /* declare the class constant */ diff --git a/include/xwindowp.h b/include/xwindowp.h index 08ac7f15e..3130ea55a 100644 --- a/include/xwindowp.h +++ b/include/xwindowp.h @@ -10,17 +10,17 @@ #include "xwindow.h" #ifndef SYSV -#define PRESERVE_NO_SYSV /* X11 include files may define SYSV */ +#define PRESERVE_NO_SYSV /* X11 include files may define SYSV */ #endif /* include superclass private header file */ #include #ifdef PRESERVE_NO_SYSV -# ifdef SYSV -# undef SYSV -# endif -# undef PRESERVE_NO_SYSV +#ifdef SYSV +#undef SYSV +#endif +#undef PRESERVE_NO_SYSV #endif /* define unique representation types not found in */ @@ -32,33 +32,33 @@ typedef struct { } WindowClassPart; typedef struct _WindowClassRec { - CoreClassPart core_class; - WindowClassPart window_class; + CoreClassPart core_class; + WindowClassPart window_class; } WindowClassRec; extern WindowClassRec windowClassRec; typedef struct { /* resources */ - Dimension rows; - Dimension columns; - Pixel foreground; - Pixel black; - Pixel red; - Pixel green; - Pixel brown; - Pixel blue; - Pixel magenta; - Pixel cyan; - Pixel gray; - Pixel orange; - Pixel bright_green; - Pixel yellow; - Pixel bright_blue; - Pixel bright_magenta; - Pixel bright_cyan; - Pixel white; - XFontStruct *font; + Dimension rows; + Dimension columns; + Pixel foreground; + Pixel black; + Pixel red; + Pixel green; + Pixel brown; + Pixel blue; + Pixel magenta; + Pixel cyan; + Pixel gray; + Pixel orange; + Pixel bright_green; + Pixel yellow; + Pixel bright_blue; + Pixel bright_magenta; + Pixel bright_cyan; + Pixel white; + XFontStruct *font; XtCallbackList expose_callback; XtCallbackList input_callback; XtCallbackList resize_callback; @@ -67,8 +67,8 @@ typedef struct { } WindowPart; typedef struct _WindowRec { - CorePart core; - WindowPart window; + CorePart core; + WindowPart window; } WindowRec; #endif /* _xwindowp_h */ diff --git a/include/you.h b/include/you.h index 76da87e33..2697fadbc 100644 --- a/include/you.h +++ b/include/you.h @@ -9,383 +9,382 @@ #include "attrib.h" #include "monst.h" #ifndef PROP_H -#include "prop.h" /* (needed here for util/makedefs.c) */ +#include "prop.h" /* (needed here for util/makedefs.c) */ #endif #include "skills.h" /*** Substructures ***/ struct RoleName { - const char *m; /* name when character is male */ - const char *f; /* when female; null if same as male */ + const char *m; /* name when character is male */ + const char *f; /* when female; null if same as male */ }; 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 */ + /* "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 */ }; struct u_have { - Bitfield(amulet,1); /* carrying Amulet */ - Bitfield(bell,1); /* carrying Bell */ - Bitfield(book,1); /* carrying Book */ - Bitfield(menorah,1); /* carrying Candelabrum */ - Bitfield(questart,1); /* carrying the Quest Artifact */ - Bitfield(unused,3); + Bitfield(amulet, 1); /* carrying Amulet */ + Bitfield(bell, 1); /* carrying Bell */ + Bitfield(book, 1); /* carrying Book */ + Bitfield(menorah, 1); /* carrying Candelabrum */ + Bitfield(questart, 1); /* carrying the Quest Artifact */ + Bitfield(unused, 3); }; struct u_event { - Bitfield(minor_oracle,1); /* received at least 1 cheap oracle */ - Bitfield(major_oracle,1); /* " expensive oracle */ - Bitfield(read_tribute,1); /* read a passage from a novel */ - 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(uopened_dbridge,1); /* opened the drawbridge */ - Bitfield(invoked,1); /* invoked Gate to the Sanctum level */ - Bitfield(gehennom_entered,1); /* entered Gehennom via Valley */ - Bitfield(uhand_of_elbereth,2); /* became Hand of Elbereth */ - Bitfield(udemigod,1); /* killed the wiz */ - Bitfield(uvibrated,1); /* stepped on "vibrating square" */ - Bitfield(ascended,1); /* has offered the Amulet */ + Bitfield(minor_oracle, 1); /* received at least 1 cheap oracle */ + Bitfield(major_oracle, 1); /* " expensive oracle */ + Bitfield(read_tribute, 1); /* read a passage from a novel */ + 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(uopened_dbridge, 1); /* opened the drawbridge */ + Bitfield(invoked, 1); /* invoked Gate to the Sanctum level */ + Bitfield(gehennom_entered, 1); /* entered Gehennom via Valley */ + Bitfield(uhand_of_elbereth, 2); /* became Hand of Elbereth */ + Bitfield(udemigod, 1); /* killed the wiz */ + Bitfield(uvibrated, 1); /* stepped on "vibrating square" */ + Bitfield(ascended, 1); /* has offered the Amulet */ }; 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); + 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); }; struct u_realtime { - long realtime; /* actual playing time up until the last restore, seconds */ - time_t restored; /* time the game was started or restored */ - time_t endtime; + long + realtime; /* actual playing time up until the last restore, seconds */ + time_t restored; /* time the game was started or restored */ + time_t endtime; }; - /* KMH, conduct -- * These are voluntary challenges. Each field denotes the number of * times a challenge has been violated. */ -struct u_conduct { /* number of times... */ - long unvegetarian; /* eaten any animal */ - long unvegan; /* ... or any animal byproduct */ - long food; /* ... or any comestible */ - long gnostic; /* used prayer, priest, or altar */ - long weaphit; /* hit a monster with a weapon */ - long killer; /* killed a monster yourself */ - long literate; /* read something (other than BotD) */ - long polypiles; /* polymorphed an object */ - long polyselfs; /* transformed yourself */ - long wishes; /* used a wish */ - long wisharti; /* wished for an artifact */ - /* genocides already listed at end of game */ +struct u_conduct { /* number of times... */ + long unvegetarian; /* eaten any animal */ + long unvegan; /* ... or any animal byproduct */ + long food; /* ... or any comestible */ + long gnostic; /* used prayer, priest, or altar */ + long weaphit; /* hit a monster with a weapon */ + long killer; /* killed a monster yourself */ + long literate; /* read something (other than BotD) */ + long polypiles; /* polymorphed an object */ + long polyselfs; /* transformed yourself */ + long wishes; /* used a wish */ + long wisharti; /* wished for an artifact */ + /* genocides already listed at end of game */ }; 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 */ + long numbones; /* # of bones files loaded */ }; /*** Unified structure containing role information ***/ struct Role { - /*** Strings that name various things ***/ - struct RoleName name; /* the role's name (from u_init.c) */ - struct RoleName rank[9]; /* names for experience levels (from botl.c) */ - const char *lgod, *ngod, *cgod; /* god names (from pray.c) */ - const char *filecode; /* abbreviation for use in file names */ - const char *homebase; /* quest leader's location (from questpgr.c) */ - 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) */ - petnum, /* PM_ of preferred pet (NON_PM == random) */ - ldrnum, /* PM_ of quest leader (questpgr.c) */ - guardnum, /* PM_ of quest guardians (questpgr.c) */ - neminum, /* PM_ of quest nemesis (questpgr.c) */ - enemy1num, /* specific quest enemies (NON_PM == random) */ - enemy2num; - char enemy1sym, /* quest enemies by class (S_) */ - enemy2sym; - short questarti; /* index (ART_) of quest artifact (questpgr.c) */ - - /*** Bitmasks ***/ - short allow; /* bit mask of allowed variations */ -#define ROLE_RACEMASK 0x0ff8 /* allowable races */ -#define ROLE_GENDMASK 0xf000 /* allowable genders */ -#define ROLE_MALE 0x1000 -#define ROLE_FEMALE 0x2000 -#define ROLE_NEUTER 0x4000 -#define ROLE_ALIGNMASK AM_MASK /* allowable alignments */ -#define ROLE_LAWFUL AM_LAWFUL -#define ROLE_NEUTRAL AM_NEUTRAL -#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 */ - struct RoleAdvance hpadv; /* hit point advancement */ - struct RoleAdvance enadv; /* energy advancement */ - xchar xlev; /* cutoff experience level */ - xchar initrecord; /* initial alignment record */ - - /*** Spell statistics (from spell.c) ***/ - int spelbase; /* base spellcasting penalty */ - int spelheal; /* penalty (-bonus) for healing spells */ - int spelshld; /* penalty for wearing any shield */ - int spelarmr; /* penalty for wearing metal armour */ - int spelstat; /* which stat (A_) is used */ - int spelspec; /* spell (SPE_) the class excels at */ - int spelsbon; /* penalty (-bonus) for that spell */ - - /*** Properties in variable-length arrays ***/ - /* intrinsics (see attrib.c) */ - /* initial inventory (see u_init.c) */ - /* skills (see u_init.c) */ - - /*** Don't forget to add... ***/ - /* quest leader, guardians, nemesis (monst.c) */ - /* quest artifact (artilist.h) */ - /* quest dungeon definition (dat/Xyz.dat) */ - /* quest text (dat/quest.txt) */ - /* dictionary entries (dat/data.bas) */ + /*** Strings that name various things ***/ + struct RoleName name; /* the role's name (from u_init.c) */ + struct RoleName rank[9]; /* names for experience levels (from botl.c) */ + const char *lgod, *ngod, *cgod; /* god names (from pray.c) */ + const char *filecode; /* abbreviation for use in file names */ + const char *homebase; /* quest leader's location (from questpgr.c) */ + 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) */ + petnum, /* PM_ of preferred pet (NON_PM == random) */ + ldrnum, /* PM_ of quest leader (questpgr.c) */ + guardnum, /* PM_ of quest guardians (questpgr.c) */ + neminum, /* PM_ of quest nemesis (questpgr.c) */ + enemy1num, /* specific quest enemies (NON_PM == random) */ + enemy2num; + char enemy1sym, /* quest enemies by class (S_) */ + enemy2sym; + short questarti; /* index (ART_) of quest artifact (questpgr.c) */ + + /*** Bitmasks ***/ + short allow; /* bit mask of allowed variations */ +#define ROLE_RACEMASK 0x0ff8 /* allowable races */ +#define ROLE_GENDMASK 0xf000 /* allowable genders */ +#define ROLE_MALE 0x1000 +#define ROLE_FEMALE 0x2000 +#define ROLE_NEUTER 0x4000 +#define ROLE_ALIGNMASK AM_MASK /* allowable alignments */ +#define ROLE_LAWFUL AM_LAWFUL +#define ROLE_NEUTRAL AM_NEUTRAL +#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 */ + struct RoleAdvance hpadv; /* hit point advancement */ + struct RoleAdvance enadv; /* energy advancement */ + xchar xlev; /* cutoff experience level */ + xchar initrecord; /* initial alignment record */ + + /*** Spell statistics (from spell.c) ***/ + int spelbase; /* base spellcasting penalty */ + int spelheal; /* penalty (-bonus) for healing spells */ + int spelshld; /* penalty for wearing any shield */ + int spelarmr; /* penalty for wearing metal armour */ + int spelstat; /* which stat (A_) is used */ + int spelspec; /* spell (SPE_) the class excels at */ + int spelsbon; /* penalty (-bonus) for that spell */ + + /*** Properties in variable-length arrays ***/ + /* intrinsics (see attrib.c) */ + /* initial inventory (see u_init.c) */ + /* skills (see u_init.c) */ + + /*** Don't forget to add... ***/ + /* quest leader, guardians, nemesis (monst.c) */ + /* quest artifact (artilist.h) */ + /* quest dungeon definition (dat/Xyz.dat) */ + /* quest text (dat/quest.txt) */ + /* dictionary entries (dat/data.bas) */ }; -extern const struct Role roles[]; /* table of available roles */ +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) (urole.malenum == (X)) +#define Role_switch (urole.malenum) /* used during initialization for race, gender, and alignment as well as for character class */ -#define ROLE_NONE (-1) -#define ROLE_RANDOM (-2) +#define ROLE_NONE (-1) +#define ROLE_RANDOM (-2) /*** Unified structure specifying race information ***/ struct Race { - /*** Strings that name various things ***/ - const char *noun; /* noun ("human", "elf") */ - const char *adj; /* adjective ("human", "elven") */ - const char *coll; /* collective ("humanity", "elvenkind") */ - const char *filecode; /* code for filenames */ - 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) */ - mummynum, /* PM_ as a mummy */ - zombienum; /* PM_ as a zombie */ - - /*** Bitmasks ***/ - short allow; /* bit mask of allowed variations */ - short selfmask, /* your own race's bit mask */ - lovemask, /* bit mask of always peaceful */ - hatemask; /* bit mask of always hostile */ - - /*** Attributes ***/ - xchar attrmin[A_MAX]; /* minimum allowable attribute */ - xchar attrmax[A_MAX]; /* maximum allowable attribute */ - struct RoleAdvance hpadv; /* hit point advancement */ - struct RoleAdvance enadv; /* energy advancement */ -#if 0 /* DEFERRED */ + /*** Strings that name various things ***/ + const char *noun; /* noun ("human", "elf") */ + const char *adj; /* adjective ("human", "elven") */ + const char *coll; /* collective ("humanity", "elvenkind") */ + const char *filecode; /* code for filenames */ + 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) */ + mummynum, /* PM_ as a mummy */ + zombienum; /* PM_ as a zombie */ + + /*** Bitmasks ***/ + short allow; /* bit mask of allowed variations */ + short selfmask, /* your own race's bit mask */ + lovemask, /* bit mask of always peaceful */ + hatemask; /* bit mask of always hostile */ + + /*** Attributes ***/ + xchar attrmin[A_MAX]; /* minimum allowable attribute */ + xchar attrmax[A_MAX]; /* maximum allowable attribute */ + struct RoleAdvance hpadv; /* hit point advancement */ + struct RoleAdvance enadv; /* energy advancement */ +#if 0 /* DEFERRED */ int nv_range; /* night vision range */ int xray_range; /* X-ray vision range */ #endif - /*** Properties in variable-length arrays ***/ - /* intrinsics (see attrib.c) */ + /*** Properties in variable-length arrays ***/ + /* intrinsics (see attrib.c) */ - /*** Don't forget to add... ***/ - /* quest leader, guardians, nemesis (monst.c) */ - /* quest dungeon definition (dat/Xyz.dat) */ - /* quest text (dat/quest.txt) */ - /* dictionary entries (dat/data.bas) */ + /*** Don't forget to add... ***/ + /* quest leader, guardians, nemesis (monst.c) */ + /* quest dungeon definition (dat/Xyz.dat) */ + /* quest text (dat/quest.txt) */ + /* dictionary entries (dat/data.bas) */ }; -extern const struct Race races[]; /* Table of available races */ +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) (urace.malenum == (X)) +#define Race_switch (urace.malenum) /*** Unified structure specifying gender information ***/ struct Gender { - const char *adj; /* male/female/neuter */ - const char *he; /* he/she/it */ - const char *him; /* him/her/it */ - const char *his; /* his/her/its */ - const char *filecode; /* file code */ - short allow; /* equivalent ROLE_ mask */ + const char *adj; /* male/female/neuter */ + const char *he; /* he/she/it */ + const char *him; /* him/her/it */ + const char *his; /* his/her/its */ + const char *filecode; /* file code */ + short allow; /* equivalent ROLE_ mask */ }; -#define ROLE_GENDERS 2 /* number of permitted player genders */ - /* increment to 3 if you allow neuter roles */ - -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) -#define mhe(mtmp) (genders[pronoun_gender(mtmp)].he) -#define mhim(mtmp) (genders[pronoun_gender(mtmp)].him) -#define mhis(mtmp) (genders[pronoun_gender(mtmp)].his) +#define ROLE_GENDERS 2 /* number of permitted player genders */ +/* increment to 3 if you allow neuter roles */ +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) +#define mhe(mtmp) (genders[pronoun_gender(mtmp)].he) +#define mhim(mtmp) (genders[pronoun_gender(mtmp)].him) +#define mhis(mtmp) (genders[pronoun_gender(mtmp)].his) /*** Unified structure specifying alignment information ***/ struct Align { - const char *noun; /* law/balance/chaos */ - const char *adj; /* lawful/neutral/chaotic */ - const char *filecode; /* file code */ - short allow; /* equivalent ROLE_ mask */ - aligntyp value; /* equivalent A_ value */ + const char *noun; /* law/balance/chaos */ + const char *adj; /* lawful/neutral/chaotic */ + const char *filecode; /* file code */ + short allow; /* equivalent ROLE_ mask */ + aligntyp value; /* equivalent A_ value */ }; -#define ROLE_ALIGNS 3 /* number of permitted player alignments */ - -extern const struct Align aligns[]; /* table of available alignments */ +#define ROLE_ALIGNS 3 /* number of permitted player alignments */ +extern const struct Align aligns[]; /* table of available alignments */ /*** Information about the player ***/ struct you { - xchar ux, uy; - 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 */ - 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 */ - 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; - unsigned utrap; /* trap timeout */ - unsigned utraptype; /* defined if utrap nonzero */ -#define TT_BEARTRAP 0 -#define TT_PIT 1 -#define TT_WEB 2 -#define TT_LAVA 3 -#define TT_INFLOOR 4 -#define TT_BURIEDBALL 5 - char urooms[5]; /* rooms (roomno + 3) occupied now */ - char urooms0[5]; /* ditto, for previous position */ - char uentered[5]; /* rooms (roomno + 3) entered this turn */ - char ushops[5]; /* shop rooms (roomno + 3) occupied now */ - char ushops0[5]; /* ditto, for previous position */ - 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 */ - unsigned uhs; /* hunger state - see eat.c */ - - struct prop uprops[LAST_PROP+1]; - - unsigned umconf; - Bitfield(usick_type,2); + xchar ux, uy; + 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 */ + 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 */ + 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; + unsigned utrap; /* trap timeout */ + unsigned utraptype; /* defined if utrap nonzero */ +#define TT_BEARTRAP 0 +#define TT_PIT 1 +#define TT_WEB 2 +#define TT_LAVA 3 +#define TT_INFLOOR 4 +#define TT_BURIEDBALL 5 + char urooms[5]; /* rooms (roomno + 3) occupied now */ + char urooms0[5]; /* ditto, for previous position */ + char uentered[5]; /* rooms (roomno + 3) entered this turn */ + char ushops[5]; /* shop rooms (roomno + 3) occupied now */ + char ushops0[5]; /* ditto, for previous position */ + 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 */ + unsigned uhs; /* hunger state - see eat.c */ + + struct prop uprops[LAST_PROP + 1]; + + unsigned umconf; + Bitfield(usick_type, 2); #define SICK_VOMITABLE 0x01 #define SICK_NONVOMITABLE 0x02 #define SICK_ALL 0x03 - /* 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 */ - - /* - * These variables are valid globally only when punished and blind. - */ -#define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */ -#define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */ - int bglyph; /* glyph under the ball */ - int cglyph; /* glyph under the chain */ - int bc_order; /* ball & chain order [see bc_order() in ball.c] */ - int bc_felt; /* mask for ball/chain being felt */ - - int umonster; /* hero's "real" monster num */ - int umonnum; /* current monster number */ - - int mh, mhmax, mtimedone; /* for polymorph-self */ - struct attribs macurr, /* for monster attribs */ - mamax; /* for monster attribs */ - int ulycn; /* lycanthrope type */ - - unsigned ucreamed; - unsigned uswldtim; /* time you have been swallowed */ - - Bitfield(uswallow,1); /* true if swallowed */ - Bitfield(uinwater,1); /* if you're currently in water (only - underwater possible currently) */ - Bitfield(uundetected,1); /* if you're a hiding monster/piercer */ - Bitfield(mfemale,1); /* saved human value of flags.female */ - Bitfield(uinvulnerable,1); /* you're invulnerable (praying) */ - Bitfield(uburied,1); /* you're buried */ - Bitfield(uedibility,1); /* blessed food detection; sense unsafe food */ - /* 1 free bit! */ - - 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 */ - struct u_roleplay uroleplay; - struct attribs acurr, /* your current attributes (eg. str)*/ - aexe, /* for gain/loss via "exercise" */ - abon, /* your bonus attributes (eg. str) */ - amax, /* your max attributes (eg. str) */ - atemp, /* used for temporary loss/gain */ - atime; /* used for loss/gain countdown */ - align ualign; /* character alignment */ -#define CONVERT 2 -#define A_ORIGINAL 1 -#define A_CURRENT 0 - aligntyp ualignbase[CONVERT]; /* for ualign conversion record */ - schar uluck, moreluck; /* luck and luck bonus */ -#define Luck (u.uluck + u.moreluck) -#define LUCKADD 3 /* added value when carrying luck stone */ -#define LUCKMAX 10 -#define LUCKMIN (-10) - schar uhitinc; - schar udaminc; - schar uac; - uchar uspellprot; /* protection by SPE_PROTECTION */ - uchar usptime; /* #moves until uspellprot-- */ - uchar uspmtime; /* #moves between uspellprot-- */ - int uhp,uhpmax; - int uen, uenmax; /* magical energy - M. Stephenson */ - xchar uhpinc[MAXULEV], ueninc[MAXULEV]; /* increases from 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 ucleansed; /* to record moves when player was cleansed */ - long usleep; /* sleeping; monstermove you last started */ - int uinvault; - struct monst *ustuck; - struct monst *usteed; - long ugallop; - int urideturns; - 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 */ - struct skills weapon_skills[P_NUM_SKILLS]; - boolean twoweap; /* KMH -- Using two-weapon combat */ - -}; /* end of `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 */ + +/* + * These variables are valid globally only when punished and blind. + */ +#define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */ +#define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */ + int bglyph; /* glyph under the ball */ + int cglyph; /* glyph under the chain */ + int bc_order; /* ball & chain order [see bc_order() in ball.c] */ + int bc_felt; /* mask for ball/chain being felt */ + + int umonster; /* hero's "real" monster num */ + int umonnum; /* current monster number */ + + int mh, mhmax, mtimedone; /* for polymorph-self */ + struct attribs macurr, /* for monster attribs */ + mamax; /* for monster attribs */ + int ulycn; /* lycanthrope type */ + + unsigned ucreamed; + unsigned uswldtim; /* time you have been swallowed */ + + Bitfield(uswallow, 1); /* true if swallowed */ + Bitfield(uinwater, 1); /* if you're currently in water (only + underwater possible currently) */ + Bitfield(uundetected, 1); /* if you're a hiding monster/piercer */ + Bitfield(mfemale, 1); /* saved human value of flags.female */ + Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */ + Bitfield(uburied, 1); /* you're buried */ + Bitfield(uedibility, 1); /* blessed food detection; sense unsafe food */ + /* 1 free bit! */ + + 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 */ + struct u_roleplay uroleplay; + struct attribs acurr, /* your current attributes (eg. str)*/ + aexe, /* for gain/loss via "exercise" */ + abon, /* your bonus attributes (eg. str) */ + amax, /* your max attributes (eg. str) */ + atemp, /* used for temporary loss/gain */ + atime; /* used for loss/gain countdown */ + align ualign; /* character alignment */ +#define CONVERT 2 +#define A_ORIGINAL 1 +#define A_CURRENT 0 + aligntyp ualignbase[CONVERT]; /* for ualign conversion record */ + schar uluck, moreluck; /* luck and luck bonus */ +#define Luck (u.uluck + u.moreluck) +#define LUCKADD 3 /* added value when carrying luck stone */ +#define LUCKMAX 10 +#define LUCKMIN (-10) + schar uhitinc; + schar udaminc; + schar uac; + uchar uspellprot; /* protection by SPE_PROTECTION */ + uchar usptime; /* #moves until uspellprot-- */ + uchar uspmtime; /* #moves between uspellprot-- */ + int uhp, uhpmax; + int uen, uenmax; /* magical energy - M. Stephenson */ + xchar uhpinc[MAXULEV], ueninc[MAXULEV]; /* increases from 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 ucleansed; /* to record moves when player was cleansed */ + long usleep; /* sleeping; monstermove you last started */ + int uinvault; + struct monst *ustuck; + struct monst *usteed; + long ugallop; + int urideturns; + 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 */ + struct skills weapon_skills[P_NUM_SKILLS]; + boolean twoweap; /* KMH -- Using two-weapon combat */ + +}; /* end of `struct you' */ #define Upolyd (u.umonnum != u.umonster) -#endif /* YOU_H */ +#endif /* YOU_H */ diff --git a/include/youprop.h b/include/youprop.h index f78b17282..14a92b1ba 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -11,7 +11,6 @@ #include "mondata.h" #include "pm.h" - /* KMH, intrinsics patch. * Reorganized and rewritten for >32-bit properties. * HXxx refers to intrinsic bitfields while in human form. @@ -22,349 +21,341 @@ * intrinsic conferred by being polymorphed.] */ - -#define maybe_polyd(if_so,if_not) (Upolyd ? (if_so) : (if_not)) - +#define maybe_polyd(if_so, if_not) (Upolyd ? (if_so) : (if_not)) /*** Resistances to troubles ***/ /* With intrinsics and extrinsics */ -#define HFire_resistance u.uprops[FIRE_RES].intrinsic -#define EFire_resistance u.uprops[FIRE_RES].extrinsic -#define Fire_resistance (HFire_resistance || EFire_resistance) +#define HFire_resistance u.uprops[FIRE_RES].intrinsic +#define EFire_resistance u.uprops[FIRE_RES].extrinsic +#define Fire_resistance (HFire_resistance || EFire_resistance) -#define HCold_resistance u.uprops[COLD_RES].intrinsic -#define ECold_resistance u.uprops[COLD_RES].extrinsic -#define Cold_resistance (HCold_resistance || ECold_resistance) +#define HCold_resistance u.uprops[COLD_RES].intrinsic +#define ECold_resistance u.uprops[COLD_RES].extrinsic +#define Cold_resistance (HCold_resistance || ECold_resistance) -#define HSleep_resistance u.uprops[SLEEP_RES].intrinsic -#define ESleep_resistance u.uprops[SLEEP_RES].extrinsic -#define Sleep_resistance (HSleep_resistance || ESleep_resistance) +#define HSleep_resistance u.uprops[SLEEP_RES].intrinsic +#define ESleep_resistance u.uprops[SLEEP_RES].extrinsic +#define Sleep_resistance (HSleep_resistance || ESleep_resistance) -#define HDisint_resistance u.uprops[DISINT_RES].intrinsic -#define EDisint_resistance u.uprops[DISINT_RES].extrinsic -#define Disint_resistance (HDisint_resistance || EDisint_resistance) +#define HDisint_resistance u.uprops[DISINT_RES].intrinsic +#define EDisint_resistance u.uprops[DISINT_RES].extrinsic +#define Disint_resistance (HDisint_resistance || EDisint_resistance) -#define HShock_resistance u.uprops[SHOCK_RES].intrinsic -#define EShock_resistance u.uprops[SHOCK_RES].extrinsic -#define Shock_resistance (HShock_resistance || EShock_resistance) +#define HShock_resistance u.uprops[SHOCK_RES].intrinsic +#define EShock_resistance u.uprops[SHOCK_RES].extrinsic +#define Shock_resistance (HShock_resistance || EShock_resistance) -#define HPoison_resistance u.uprops[POISON_RES].intrinsic -#define EPoison_resistance u.uprops[POISON_RES].extrinsic -#define Poison_resistance (HPoison_resistance || EPoison_resistance) +#define HPoison_resistance u.uprops[POISON_RES].intrinsic +#define EPoison_resistance u.uprops[POISON_RES].extrinsic +#define Poison_resistance (HPoison_resistance || EPoison_resistance) -#define HDrain_resistance u.uprops[DRAIN_RES].intrinsic -#define EDrain_resistance u.uprops[DRAIN_RES].extrinsic -#define Drain_resistance (HDrain_resistance || EDrain_resistance) +#define HDrain_resistance u.uprops[DRAIN_RES].intrinsic +#define EDrain_resistance u.uprops[DRAIN_RES].extrinsic +#define Drain_resistance (HDrain_resistance || EDrain_resistance) /* Hxxx due to FROMFORM only */ -#define HAntimagic u.uprops[ANTIMAGIC].intrinsic -#define EAntimagic u.uprops[ANTIMAGIC].extrinsic -#define Antimagic (HAntimagic || EAntimagic) +#define HAntimagic u.uprops[ANTIMAGIC].intrinsic +#define EAntimagic u.uprops[ANTIMAGIC].extrinsic +#define Antimagic (HAntimagic || EAntimagic) -#define HAcid_resistance u.uprops[ACID_RES].intrinsic -#define EAcid_resistance u.uprops[ACID_RES].extrinsic -#define Acid_resistance (HAcid_resistance || EAcid_resistance) +#define HAcid_resistance u.uprops[ACID_RES].intrinsic +#define EAcid_resistance u.uprops[ACID_RES].extrinsic +#define Acid_resistance (HAcid_resistance || EAcid_resistance) -#define HStone_resistance u.uprops[STONE_RES].intrinsic -#define EStone_resistance u.uprops[STONE_RES].extrinsic -#define Stone_resistance (HStone_resistance || EStone_resistance) +#define HStone_resistance u.uprops[STONE_RES].intrinsic +#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 Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ +#define HSick_resistance u.uprops[SICK_RES].intrinsic +#define Sick_resistance (HSick_resistance || defends(AD_DISE, uwep)) +#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ /*** Troubles ***/ /* Pseudo-property */ -#define Punished (uball != 0) +#define Punished (uball != 0) /* Those implemented solely as timeouts (we use just intrinsic) */ -#define HStun u.uprops[STUNNED].intrinsic -#define Stunned HStun - -#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 (!Blinded && haseyes(youmonst.data) && Blindfolded && \ - !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)) - /* blind because of a blindfold, and *only* that */ - -#define Sick u.uprops[SICK].intrinsic -#define Stoned u.uprops[STONED].intrinsic -#define Strangled u.uprops[STRANGLED].intrinsic -#define Vomiting u.uprops[VOMITING].intrinsic -#define Glib u.uprops[GLIB].intrinsic -#define Slimed u.uprops[SLIMED].intrinsic /* [Tom] */ +#define HStun u.uprops[STUNNED].intrinsic +#define Stunned HStun + +#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 \ + (!Blinded && haseyes(youmonst.data) && Blindfolded \ + && !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)) +/* blind because of a blindfold, and *only* that */ + +#define Sick u.uprops[SICK].intrinsic +#define Stoned u.uprops[STONED].intrinsic +#define Strangled u.uprops[STRANGLED].intrinsic +#define Vomiting u.uprops[VOMITING].intrinsic +#define Glib u.uprops[GLIB].intrinsic +#define Slimed u.uprops[SLIMED].intrinsic /* [Tom] */ /* Hallucination is solely a timeout */ -#define HHallucination u.uprops[HALLUC].intrinsic -#define HHalluc_resistance u.uprops[HALLUC_RES].intrinsic -#define EHalluc_resistance u.uprops[HALLUC_RES].extrinsic -#define Halluc_resistance (HHalluc_resistance || EHalluc_resistance) -#define Hallucination (HHallucination && !Halluc_resistance) +#define HHallucination u.uprops[HALLUC].intrinsic +#define HHalluc_resistance u.uprops[HALLUC_RES].intrinsic +#define EHalluc_resistance u.uprops[HALLUC_RES].extrinsic +#define Halluc_resistance (HHalluc_resistance || EHalluc_resistance) +#define Hallucination (HHallucination && !Halluc_resistance) /* Timeout, plus a worn mask */ -#define HDeaf u.uprops[DEAF].intrinsic -#define EDeaf u.uprops[DEAF].extrinsic -#define Deaf (HDeaf || EDeaf) +#define HDeaf u.uprops[DEAF].intrinsic +#define EDeaf u.uprops[DEAF].extrinsic +#define Deaf (HDeaf || EDeaf) -#define HFumbling u.uprops[FUMBLING].intrinsic -#define EFumbling u.uprops[FUMBLING].extrinsic -#define Fumbling (HFumbling || EFumbling) +#define HFumbling u.uprops[FUMBLING].intrinsic +#define EFumbling u.uprops[FUMBLING].extrinsic +#define Fumbling (HFumbling || EFumbling) -#define HWounded_legs u.uprops[WOUNDED_LEGS].intrinsic -#define EWounded_legs u.uprops[WOUNDED_LEGS].extrinsic -#define Wounded_legs (HWounded_legs || EWounded_legs) +#define HWounded_legs u.uprops[WOUNDED_LEGS].intrinsic +#define EWounded_legs u.uprops[WOUNDED_LEGS].extrinsic +#define Wounded_legs (HWounded_legs || EWounded_legs) -#define HSleepy u.uprops[SLEEPY].intrinsic -#define ESleepy u.uprops[SLEEPY].extrinsic -#define Sleepy (HSleepy || ESleepy) - -#define HHunger u.uprops[HUNGER].intrinsic -#define EHunger u.uprops[HUNGER].extrinsic -#define Hunger (HHunger || EHunger) +#define HSleepy u.uprops[SLEEPY].intrinsic +#define ESleepy u.uprops[SLEEPY].extrinsic +#define Sleepy (HSleepy || ESleepy) +#define HHunger u.uprops[HUNGER].intrinsic +#define EHunger u.uprops[HUNGER].extrinsic +#define Hunger (HHunger || EHunger) /*** Vision and senses ***/ -#define HSee_invisible u.uprops[SEE_INVIS].intrinsic -#define ESee_invisible u.uprops[SEE_INVIS].extrinsic -#define See_invisible (HSee_invisible || ESee_invisible) +#define HSee_invisible u.uprops[SEE_INVIS].intrinsic +#define ESee_invisible u.uprops[SEE_INVIS].extrinsic +#define See_invisible (HSee_invisible || ESee_invisible) -#define HTelepat u.uprops[TELEPAT].intrinsic -#define ETelepat u.uprops[TELEPAT].extrinsic -#define Blind_telepat (HTelepat || ETelepat) -#define Unblind_telepat (ETelepat) +#define HTelepat u.uprops[TELEPAT].intrinsic +#define ETelepat u.uprops[TELEPAT].extrinsic +#define Blind_telepat (HTelepat || ETelepat) +#define Unblind_telepat (ETelepat) -#define HWarning u.uprops[WARNING].intrinsic -#define EWarning u.uprops[WARNING].extrinsic -#define Warning (HWarning || EWarning) +#define HWarning u.uprops[WARNING].intrinsic +#define EWarning u.uprops[WARNING].extrinsic +#define Warning (HWarning || EWarning) /* Warning for a specific type of monster */ -#define HWarn_of_mon u.uprops[WARN_OF_MON].intrinsic -#define EWarn_of_mon u.uprops[WARN_OF_MON].extrinsic -#define Warn_of_mon (HWarn_of_mon || EWarn_of_mon) - -#define HUndead_warning u.uprops[WARN_UNDEAD].intrinsic -#define Undead_warning (HUndead_warning) +#define HWarn_of_mon u.uprops[WARN_OF_MON].intrinsic +#define EWarn_of_mon u.uprops[WARN_OF_MON].extrinsic +#define Warn_of_mon (HWarn_of_mon || EWarn_of_mon) -#define HSearching u.uprops[SEARCHING].intrinsic -#define ESearching u.uprops[SEARCHING].extrinsic -#define Searching (HSearching || ESearching) +#define HUndead_warning u.uprops[WARN_UNDEAD].intrinsic +#define Undead_warning (HUndead_warning) -#define HClairvoyant u.uprops[CLAIRVOYANT].intrinsic -#define EClairvoyant u.uprops[CLAIRVOYANT].extrinsic -#define BClairvoyant u.uprops[CLAIRVOYANT].blocked -#define Clairvoyant ((HClairvoyant || EClairvoyant) && \ - !BClairvoyant) +#define HSearching u.uprops[SEARCHING].intrinsic +#define ESearching u.uprops[SEARCHING].extrinsic +#define Searching (HSearching || ESearching) -#define HInfravision u.uprops[INFRAVISION].intrinsic -#define EInfravision u.uprops[INFRAVISION].extrinsic -#define Infravision (HInfravision || EInfravision) +#define HClairvoyant u.uprops[CLAIRVOYANT].intrinsic +#define EClairvoyant u.uprops[CLAIRVOYANT].extrinsic +#define BClairvoyant u.uprops[CLAIRVOYANT].blocked +#define Clairvoyant ((HClairvoyant || EClairvoyant) && !BClairvoyant) -#define HDetect_monsters u.uprops[DETECT_MONSTERS].intrinsic -#define EDetect_monsters u.uprops[DETECT_MONSTERS].extrinsic -#define Detect_monsters (HDetect_monsters || EDetect_monsters) +#define HInfravision u.uprops[INFRAVISION].intrinsic +#define EInfravision u.uprops[INFRAVISION].extrinsic +#define Infravision (HInfravision || EInfravision) +#define HDetect_monsters u.uprops[DETECT_MONSTERS].intrinsic +#define EDetect_monsters u.uprops[DETECT_MONSTERS].extrinsic +#define Detect_monsters (HDetect_monsters || EDetect_monsters) /*** Appearance and behavior ***/ -#define Adornment u.uprops[ADORNED].extrinsic +#define Adornment u.uprops[ADORNED].extrinsic -#define HInvis u.uprops[INVIS].intrinsic -#define EInvis u.uprops[INVIS].extrinsic -#define BInvis u.uprops[INVIS].blocked -#define Invis ((HInvis || EInvis) && !BInvis) -#define Invisible (Invis && !See_invisible) - /* Note: invisibility also hides inventory and steed */ +#define HInvis u.uprops[INVIS].intrinsic +#define EInvis u.uprops[INVIS].extrinsic +#define BInvis u.uprops[INVIS].blocked +#define Invis ((HInvis || EInvis) && !BInvis) +#define Invisible (Invis && !See_invisible) +/* Note: invisibility also hides inventory and steed */ -#define EDisplaced u.uprops[DISPLACED].extrinsic -#define Displaced EDisplaced +#define EDisplaced u.uprops[DISPLACED].extrinsic +#define Displaced EDisplaced -#define HStealth u.uprops[STEALTH].intrinsic -#define EStealth u.uprops[STEALTH].extrinsic -#define BStealth u.uprops[STEALTH].blocked -#define Stealth ((HStealth || EStealth) && !BStealth) +#define HStealth u.uprops[STEALTH].intrinsic +#define EStealth u.uprops[STEALTH].extrinsic +#define BStealth u.uprops[STEALTH].blocked +#define Stealth ((HStealth || EStealth) && !BStealth) -#define HAggravate_monster u.uprops[AGGRAVATE_MONSTER].intrinsic -#define EAggravate_monster u.uprops[AGGRAVATE_MONSTER].extrinsic -#define Aggravate_monster (HAggravate_monster || EAggravate_monster) - -#define HConflict u.uprops[CONFLICT].intrinsic -#define EConflict u.uprops[CONFLICT].extrinsic -#define Conflict (HConflict || EConflict) +#define HAggravate_monster u.uprops[AGGRAVATE_MONSTER].intrinsic +#define EAggravate_monster u.uprops[AGGRAVATE_MONSTER].extrinsic +#define Aggravate_monster (HAggravate_monster || EAggravate_monster) +#define HConflict u.uprops[CONFLICT].intrinsic +#define EConflict u.uprops[CONFLICT].extrinsic +#define Conflict (HConflict || EConflict) /*** Transportation ***/ -#define HJumping u.uprops[JUMPING].intrinsic -#define EJumping u.uprops[JUMPING].extrinsic -#define Jumping (HJumping || EJumping) - -#define HTeleportation u.uprops[TELEPORT].intrinsic -#define ETeleportation u.uprops[TELEPORT].extrinsic -#define Teleportation (HTeleportation || ETeleportation) - -#define HTeleport_control u.uprops[TELEPORT_CONTROL].intrinsic -#define ETeleport_control u.uprops[TELEPORT_CONTROL].extrinsic -#define Teleport_control (HTeleport_control || ETeleport_control) - -#define HLevitation u.uprops[LEVITATION].intrinsic -#define ELevitation u.uprops[LEVITATION].extrinsic -#define BLevitation u.uprops[LEVITATION].blocked -#define Levitation ((HLevitation || ELevitation) && !BLevitation) - /* Can't touch surface, can't go under water; overrides all others */ -#define Lev_at_will (((HLevitation & I_SPECIAL) != 0L || \ - (ELevitation & W_ARTI) != 0L) && \ - (HLevitation & ~(I_SPECIAL|TIMEOUT)) == 0L && \ - (ELevitation & ~W_ARTI) == 0L) - -#define HFlying u.uprops[FLYING].intrinsic -#define EFlying u.uprops[FLYING].extrinsic -#define BFlying u.uprops[FLYING].blocked -# define Flying ((HFlying || EFlying || \ - (u.usteed && is_flyer(u.usteed->data))) && \ - !BFlying) - /* May touch surface; does not override any others */ - -#define Wwalking (u.uprops[WWALKING].extrinsic && \ - !Is_waterlevel(&u.uz)) - /* Don't get wet, can't go under water; overrides others except levitation */ - /* Wwalking is meaningless on water level */ - -#define HSwimming u.uprops[SWIMMING].intrinsic -#define ESwimming u.uprops[SWIMMING].extrinsic /* [Tom] */ -# define Swimming (HSwimming || ESwimming || \ - (u.usteed && is_swimmer(u.usteed->data))) - /* Get wet, don't go under water unless if amphibious */ - -#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)) - /* Get wet, may go under surface */ - -#define Breathless (HMagical_breathing || EMagical_breathing || \ - breathless(youmonst.data)) - -#define Underwater (u.uinwater) +#define HJumping u.uprops[JUMPING].intrinsic +#define EJumping u.uprops[JUMPING].extrinsic +#define Jumping (HJumping || EJumping) + +#define HTeleportation u.uprops[TELEPORT].intrinsic +#define ETeleportation u.uprops[TELEPORT].extrinsic +#define Teleportation (HTeleportation || ETeleportation) + +#define HTeleport_control u.uprops[TELEPORT_CONTROL].intrinsic +#define ETeleport_control u.uprops[TELEPORT_CONTROL].extrinsic +#define Teleport_control (HTeleport_control || ETeleport_control) + +#define HLevitation u.uprops[LEVITATION].intrinsic +#define ELevitation u.uprops[LEVITATION].extrinsic +#define BLevitation u.uprops[LEVITATION].blocked +#define Levitation ((HLevitation || ELevitation) && !BLevitation) +/* Can't touch surface, can't go under water; overrides all others */ +#define Lev_at_will \ + (((HLevitation & I_SPECIAL) != 0L || (ELevitation & W_ARTI) != 0L) \ + && (HLevitation & ~(I_SPECIAL | TIMEOUT)) == 0L \ + && (ELevitation & ~W_ARTI) == 0L) + +#define HFlying u.uprops[FLYING].intrinsic +#define EFlying u.uprops[FLYING].extrinsic +#define BFlying u.uprops[FLYING].blocked +#define Flying \ + ((HFlying || EFlying || (u.usteed && is_flyer(u.usteed->data))) \ + && !BFlying) +/* May touch surface; does not override any others */ + +#define Wwalking (u.uprops[WWALKING].extrinsic && !Is_waterlevel(&u.uz)) +/* Don't get wet, can't go under water; overrides others except levitation */ +/* Wwalking is meaningless on water level */ + +#define HSwimming u.uprops[SWIMMING].intrinsic +#define ESwimming u.uprops[SWIMMING].extrinsic /* [Tom] */ +#define Swimming \ + (HSwimming || ESwimming || (u.usteed && is_swimmer(u.usteed->data))) +/* Get wet, don't go under water unless if amphibious */ + +#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)) +/* Get wet, may go under surface */ + +#define Breathless \ + (HMagical_breathing || EMagical_breathing || breathless(youmonst.data)) + +#define Underwater (u.uinwater) /* Note that Underwater and u.uinwater are both used in code. The latter form is for later implementation of other in-water states, like swimming, wading, etc. */ -#define HPasses_walls u.uprops[PASSES_WALLS].intrinsic -#define EPasses_walls u.uprops[PASSES_WALLS].extrinsic -#define Passes_walls (HPasses_walls || EPasses_walls) - +#define HPasses_walls u.uprops[PASSES_WALLS].intrinsic +#define EPasses_walls u.uprops[PASSES_WALLS].extrinsic +#define Passes_walls (HPasses_walls || EPasses_walls) /*** Physical attributes ***/ -#define HSlow_digestion u.uprops[SLOW_DIGESTION].intrinsic -#define ESlow_digestion u.uprops[SLOW_DIGESTION].extrinsic -#define Slow_digestion (HSlow_digestion || ESlow_digestion) /* KMH */ +#define HSlow_digestion u.uprops[SLOW_DIGESTION].intrinsic +#define ESlow_digestion u.uprops[SLOW_DIGESTION].extrinsic +#define Slow_digestion (HSlow_digestion || ESlow_digestion) /* KMH */ -#define HHalf_spell_damage u.uprops[HALF_SPDAM].intrinsic -#define EHalf_spell_damage u.uprops[HALF_SPDAM].extrinsic -#define Half_spell_damage (HHalf_spell_damage || EHalf_spell_damage) +#define HHalf_spell_damage u.uprops[HALF_SPDAM].intrinsic +#define EHalf_spell_damage u.uprops[HALF_SPDAM].extrinsic +#define Half_spell_damage (HHalf_spell_damage || EHalf_spell_damage) /* * Physical damage * * Damage is NOT physical damage if (in order of priority): * 1. it already qualifies for some other special category - * for which a special resistance already exists in the game + * for which a special resistance already exists in the game * including: cold, fire, shock, acid, and magic. * Note that fire is extended to include all non-acid forms of * burning, even boiling water since that is already dealt with - * by fire resistance, and in most or all cases is caused by fire. - * 2. it doesn't leave a mark. Marks include destruction of, or - * damage to, an internal organ (including the brain), + * by fire resistance, and in most or all cases is caused by fire. + * 2. it doesn't leave a mark. Marks include destruction of, or + * damage to, an internal organ (including the brain), * lacerations, bruises, crushed body parts, bleeding. * * The following were evaluated and determined _NOT_ to be * susceptable to Half_physical_damage protection: - * Being caught in a fireball [fire damage] - * Sitting in lava [lava damage] - * Thrown potion (acid) [acid damage] - * Splattered burning oil from thrown potion [fire damage] - * Mixing water and acid [acid damage] - * Molten lava (entering or being splashed) [lava damage] - * boiling water from a sink [fire damage] - * Fire traps [fire damage] - * Scrolls of fire (confused and otherwise) [fire damage] - * Alchemical explosion [not physical] - * System shock [shock damage] - * Bag of holding explosion [magical] - * Being undead-turned by your god [magical] - * Level-drain [magical] - * Magical explosion of a magic trap [magical] - * Sitting on a throne with a bad effect [magical] - * Contaminated water from a sink [poison/sickness] - * Contact-poisoned spellbooks [poison/sickness] - * Eating acidic/poisonous/mildly-old corpses [poison/sickness] - * Eating a poisoned weapon while polyselfed [poison/sickness] - * Engulfing a zombie or mummy (AT_ENGL in hmonas) [poison/sickness] - * Quaffed potions of sickness, lit oil, acid [poison/sickness] - * Pyrolisks' fiery gaze [fire damage] - * Any passive attack [most don't qualify] + * Being caught in a fireball [fire damage] + * Sitting in lava [lava damage] + * Thrown potion (acid) [acid damage] + * Splattered burning oil from thrown potion [fire damage] + * Mixing water and acid [acid damage] + * Molten lava (entering or being splashed) [lava damage] + * boiling water from a sink [fire damage] + * Fire traps [fire damage] + * Scrolls of fire (confused and otherwise) [fire damage] + * Alchemical explosion [not physical] + * System shock [shock damage] + * Bag of holding explosion [magical] + * Being undead-turned by your god [magical] + * Level-drain [magical] + * Magical explosion of a magic trap [magical] + * Sitting on a throne with a bad effect [magical] + * Contaminated water from a sink [poison/sickness] + * Contact-poisoned spellbooks [poison/sickness] + * Eating acidic/poisonous/mildly-old corpses [poison/sickness] + * Eating a poisoned weapon while polyselfed [poison/sickness] + * Engulfing a zombie or mummy (AT_ENGL in hmonas) [poison/sickness] + * Quaffed potions of sickness, lit oil, acid [poison/sickness] + * Pyrolisks' fiery gaze [fire damage] + * Any passive attack [most don't qualify] */ -#define HHalf_physical_damage u.uprops[HALF_PHDAM].intrinsic -#define EHalf_physical_damage u.uprops[HALF_PHDAM].extrinsic -#define Half_physical_damage (HHalf_physical_damage || EHalf_physical_damage) +#define HHalf_physical_damage u.uprops[HALF_PHDAM].intrinsic +#define EHalf_physical_damage u.uprops[HALF_PHDAM].extrinsic +#define Half_physical_damage (HHalf_physical_damage || EHalf_physical_damage) -#define HRegeneration u.uprops[REGENERATION].intrinsic -#define ERegeneration u.uprops[REGENERATION].extrinsic -#define Regeneration (HRegeneration || ERegeneration) +#define HRegeneration u.uprops[REGENERATION].intrinsic +#define ERegeneration u.uprops[REGENERATION].extrinsic +#define Regeneration (HRegeneration || ERegeneration) -#define HEnergy_regeneration u.uprops[ENERGY_REGENERATION].intrinsic -#define EEnergy_regeneration u.uprops[ENERGY_REGENERATION].extrinsic -#define Energy_regeneration (HEnergy_regeneration || EEnergy_regeneration) +#define HEnergy_regeneration u.uprops[ENERGY_REGENERATION].intrinsic +#define EEnergy_regeneration u.uprops[ENERGY_REGENERATION].extrinsic +#define Energy_regeneration (HEnergy_regeneration || EEnergy_regeneration) -#define HProtection u.uprops[PROTECTION].intrinsic -#define EProtection u.uprops[PROTECTION].extrinsic -#define Protection (HProtection || EProtection) +#define HProtection u.uprops[PROTECTION].intrinsic +#define EProtection u.uprops[PROTECTION].extrinsic +#define Protection (HProtection || EProtection) #define HProtection_from_shape_changers \ - u.uprops[PROT_FROM_SHAPE_CHANGERS].intrinsic + u.uprops[PROT_FROM_SHAPE_CHANGERS].intrinsic #define EProtection_from_shape_changers \ - u.uprops[PROT_FROM_SHAPE_CHANGERS].extrinsic + u.uprops[PROT_FROM_SHAPE_CHANGERS].extrinsic #define Protection_from_shape_changers \ - (HProtection_from_shape_changers || \ - EProtection_from_shape_changers) + (HProtection_from_shape_changers || EProtection_from_shape_changers) -#define HPolymorph u.uprops[POLYMORPH].intrinsic -#define EPolymorph u.uprops[POLYMORPH].extrinsic -#define Polymorph (HPolymorph || EPolymorph) +#define HPolymorph u.uprops[POLYMORPH].intrinsic +#define EPolymorph u.uprops[POLYMORPH].extrinsic +#define Polymorph (HPolymorph || EPolymorph) -#define HPolymorph_control u.uprops[POLYMORPH_CONTROL].intrinsic -#define EPolymorph_control u.uprops[POLYMORPH_CONTROL].extrinsic -#define Polymorph_control (HPolymorph_control || EPolymorph_control) +#define HPolymorph_control u.uprops[POLYMORPH_CONTROL].intrinsic +#define EPolymorph_control u.uprops[POLYMORPH_CONTROL].extrinsic +#define Polymorph_control (HPolymorph_control || EPolymorph_control) -#define HUnchanging u.uprops[UNCHANGING].intrinsic -#define EUnchanging u.uprops[UNCHANGING].extrinsic -#define Unchanging (HUnchanging || EUnchanging) /* KMH */ +#define HUnchanging u.uprops[UNCHANGING].intrinsic +#define EUnchanging u.uprops[UNCHANGING].extrinsic +#define Unchanging (HUnchanging || EUnchanging) /* KMH */ -#define HFast u.uprops[FAST].intrinsic -#define EFast u.uprops[FAST].extrinsic -#define Fast (HFast || EFast) -#define Very_fast ((HFast & ~INTRINSIC) || EFast) +#define HFast u.uprops[FAST].intrinsic +#define EFast u.uprops[FAST].extrinsic +#define Fast (HFast || EFast) +#define Very_fast ((HFast & ~INTRINSIC) || EFast) -#define HReflecting u.uprops[REFLECTING].intrinsic -#define EReflecting u.uprops[REFLECTING].extrinsic -#define Reflecting (HReflecting || EReflecting) +#define HReflecting u.uprops[REFLECTING].intrinsic +#define EReflecting u.uprops[REFLECTING].extrinsic +#define Reflecting (HReflecting || EReflecting) -#define Free_action u.uprops[FREE_ACTION].extrinsic /* [Tom] */ +#define Free_action u.uprops[FREE_ACTION].extrinsic /* [Tom] */ -#define Fixed_abil u.uprops[FIXED_ABIL].extrinsic /* KMH */ +#define Fixed_abil u.uprops[FIXED_ABIL].extrinsic /* KMH */ -#define Lifesaved u.uprops[LIFESAVED].extrinsic +#define Lifesaved u.uprops[LIFESAVED].extrinsic /* * Some pseudo-properties. @@ -372,8 +363,8 @@ /* 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 (multi < 0 && (unconscious() || is_fainted())) -#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(youmonst.data)) +#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(youmonst.data)) #endif /* YOUPROP_H */ diff --git a/sys/amiga/windefs.h b/sys/amiga/windefs.h index daeb01082..fb7405fb7 100644 --- a/sys/amiga/windefs.h +++ b/sys/amiga/windefs.h @@ -27,24 +27,24 @@ * around with the rest of the #includes. --AMC */ #if defined(_DCC) && !defined(HACK_H) -# define ptrdiff_t ptrdiff_t_ -# define size_t size_t_ -# define wchar_t wchar_t_ +#define ptrdiff_t ptrdiff_t_ +#define size_t size_t_ +#define wchar_t wchar_t_ #endif #include -#undef strcmpi +#undef strcmpi #include #include #if defined(_DCC) && !defined(HACK_H) -# undef ptrdiff_t -# undef size_t -# undef wchar_T +#undef ptrdiff_t +#undef size_t +#undef wchar_T #endif -#ifdef IDCMP_CLOSEWINDOW -# ifndef INTUI_NEW_LOOK -# define INTUI_NEW_LOOK -# endif +#ifdef IDCMP_CLOSEWINDOW +#ifndef INTUI_NEW_LOOK +#define INTUI_NEW_LOOK +#endif #endif #ifndef HACK_H @@ -54,12 +54,12 @@ #include "winami.h" #include "func_tab.h" -#ifndef CLIPPING +#ifndef CLIPPING CLIPPING must be defined for the AMIGA version #endif -#undef LI -#undef CO +#undef LI +#undef CO /*#define TOPL_GETLINE /* Don't use a window for getlin() */ /*#define WINDOW_YN /* Use a window for y/n questions */ @@ -85,22 +85,22 @@ CLIPPING must be defined for the AMIGA version #endif /* kludge - see amirip for why */ -# undef red -# undef green -# undef blue +#undef red +#undef green +#undef blue #ifdef _DCC -# include +#include #else -# include +#include #endif #ifdef _DCC -# define __asm /* DICE doesn't like __asm */ +#define __asm /* DICE doesn't like __asm */ #endif #ifndef __SASC_60 #undef index -# define index strchr +#define index strchr #endif #ifdef _DCC @@ -110,24 +110,24 @@ CLIPPING must be defined for the AMIGA version #endif #endif -#ifdef SHAREDLIB +#ifdef SHAREDLIB #include "NH:sys/amiga/lib/libmacs.h" #endif -#ifdef INTUI_NEW_LOOK +#ifdef INTUI_NEW_LOOK #include #endif -#define WINVERS_AMII (strcmp("amii",windowprocs.name)==0) -#define WINVERS_AMIV (strcmp("amitile",windowprocs.name)==0) -#define WINVERS_AMIT (strcmp("amitty",windowprocs.name)==0) +#define WINVERS_AMII (strcmp("amii", windowprocs.name) == 0) +#define WINVERS_AMIV (strcmp("amitile", windowprocs.name) == 0) +#define WINVERS_AMIT (strcmp("amitty", windowprocs.name) == 0) /* cw->data[x] contains 2 characters worth of special information. These * characters are stored at the offsets as described here. */ -#define VATTR 0 /* Video attribute is in this slot */ -#define SEL_ITEM 1 /* If this is a select item, slot is 1 else 0 */ -#define SOFF 2 /* The string starts here. */ +#define VATTR 0 /* Video attribute is in this slot */ +#define SEL_ITEM 1 /* If this is a select item, slot is 1 else 0 */ +#define SOFF 2 /* The string starts here. */ #undef NULL #define NULL 0L @@ -138,68 +138,68 @@ CLIPPING must be defined for the AMIGA version * don't have that version number in the 1.2 ROM. */ -#define LIBRARY_FONT_VERSION 34L -#define LIBRARY_TILE_VERSION 37L +#define LIBRARY_FONT_VERSION 34L +#define LIBRARY_TILE_VERSION 37L -/* These values are just sorta suggestions in use, but are minimum requirements +/* These values are just sorta suggestions in use, but are minimum + * requirements * in reality... */ -#define WINDOWHEIGHT 192 -#define SCREENHEIGHT 200 -#define WIDTH 640 +#define WINDOWHEIGHT 192 +#define SCREENHEIGHT 200 +#define WIDTH 640 /* This character is a solid block (cursor) in Hack.font */ -#define CURSOR_CHAR 0x90 +#define CURSOR_CHAR 0x90 -#define FONTHEIGHT 8 -#define FONTWIDTH 8 -#define FONTBASELINE 8 +#define FONTHEIGHT 8 +#define FONTWIDTH 8 +#define FONTBASELINE 8 -#define MAPFTWIDTH 8 -#define MAPFTHEIGHT 8 -#define MAPFTBASELN 6 +#define MAPFTWIDTH 8 +#define MAPFTHEIGHT 8 +#define MAPFTBASELN 6 /* If Compiling with the "New Look", redefine these now */ -#ifdef INTUI_NEW_LOOK +#ifdef INTUI_NEW_LOOK #define NewWindow ExtNewWindow #define NewScreen ExtNewScreen #endif -#define SIZEOF_DISKNAME 8 - -#define CSI '\x9b' -#define NO_CHAR -1 -#define RAWHELP 0x5F /* Rawkey code of the HELP key */ - - -#define C_BLACK 0 -#define C_WHITE 1 -#define C_BROWN (WINVERS_AMIV ? 11 : 2) -#define C_CYAN (WINVERS_AMIV ? 2 : 3) -#define C_GREEN (WINVERS_AMIV ? 5 : 4) -#define C_MAGENTA (WINVERS_AMIV ? 10 : 5) -#define C_BLUE (WINVERS_AMIV ? 4 : 6) -#define C_RED 7 -#define C_ORANGE 3 -#define C_GREY 6 -#define C_LTGREEN 8 -#define C_YELLOW 9 -#define C_GREYBLUE 12 -#define C_LTBROWN 13 -#define C_LTGREY 14 -#define C_PEACH 15 +#define SIZEOF_DISKNAME 8 + +#define CSI '\x9b' +#define NO_CHAR -1 +#define RAWHELP 0x5F /* Rawkey code of the HELP key */ + +#define C_BLACK 0 +#define C_WHITE 1 +#define C_BROWN (WINVERS_AMIV ? 11 : 2) +#define C_CYAN (WINVERS_AMIV ? 2 : 3) +#define C_GREEN (WINVERS_AMIV ? 5 : 4) +#define C_MAGENTA (WINVERS_AMIV ? 10 : 5) +#define C_BLUE (WINVERS_AMIV ? 4 : 6) +#define C_RED 7 +#define C_ORANGE 3 +#define C_GREY 6 +#define C_LTGREEN 8 +#define C_YELLOW 9 +#define C_GREYBLUE 12 +#define C_LTBROWN 13 +#define C_LTGREY 14 +#define C_PEACH 15 /* Structure describing tile files */ struct PDAT { - long nplanes; /* Depth of images */ - long pbytes; /* Bytes in a plane of data */ - long across; /* Number of tiles across */ - long down; /* Number of tiles down */ - long npics; /* Number of pictures in this file */ - long xsize; /* X-size of a tile */ - long ysize; /* Y-size of a-tile */ + long nplanes; /* Depth of images */ + long pbytes; /* Bytes in a plane of data */ + long across; /* Number of tiles across */ + long down; /* Number of tiles down */ + long npics; /* Number of pictures in this file */ + long xsize; /* X-size of a tile */ + long ysize; /* Y-size of a-tile */ }; -#undef MAXCOLORS -#define MAXCOLORS 256 +#undef MAXCOLORS +#define MAXCOLORS 256 diff --git a/sys/amiga/winext.h b/sys/amiga/winext.h index 6996fcfb0..50038a511 100644 --- a/sys/amiga/winext.h +++ b/sys/amiga/winext.h @@ -6,7 +6,7 @@ extern int reclip; -#ifdef CLIPPING +#ifdef CLIPPING extern int clipping; extern int clipx; extern int clipy; @@ -20,14 +20,15 @@ extern int LI; extern int scrollmsg; extern int alwaysinvent; -#ifndef SHAREDLIB -extern unsigned short amii_defpens[ 20 ]; -extern struct amii_DisplayDesc *amiIDisplay; /* the Amiga Intuition descriptor */ +#ifndef SHAREDLIB +extern unsigned short amii_defpens[20]; +extern struct amii_DisplayDesc + *amiIDisplay; /* the Amiga Intuition descriptor */ extern struct window_procs amii_procs; extern struct window_procs amiv_procs; -extern unsigned short amii_initmap[ AMII_MAXCOLORS ]; -extern unsigned short amiv_init_map[ AMII_MAXCOLORS ]; -extern unsigned short amii_init_map[ AMII_MAXCOLORS ]; +extern unsigned short amii_initmap[AMII_MAXCOLORS]; +extern unsigned short amiv_init_map[AMII_MAXCOLORS]; +extern unsigned short amii_init_map[AMII_MAXCOLORS]; extern int bigscreen; extern int amii_numcolors; extern long amii_scrnmode; @@ -35,7 +36,7 @@ extern winid amii_rawprwin; extern struct Screen *HackScreen; extern char Initialized; /* These have already been defined elsewhere (and some are conflicting) - * ... going ... going once ... going twice .... + * ... going ... going once ... going twice .... * extern const char *roles[]; * extern struct Library *ConsoleDevice; * extern char toplines[ TBUFSZ ]; @@ -79,7 +80,7 @@ extern struct IOStdReq ConsoleIO; extern struct MsgPort *HackPort; extern int txwidth, txheight, txbaseline; -#ifdef SUPERBITMAP_MAP +#ifdef SUPERBITMAP_MAP extern struct BitMap amii_vbm; #endif @@ -95,10 +96,9 @@ extern struct Gadget MsgScroll; extern struct TagItem tags[]; -extern struct win_setup -{ +extern struct win_setup { struct NewWindow newwin; - UWORD offx,offy,maxrow,rows,maxcol,cols; /* CHECK TYPES */ + UWORD offx, offy, maxrow, rows, maxcol, cols; /* CHECK TYPES */ } new_wins[]; extern UWORD scrnpens[]; @@ -109,32 +109,36 @@ extern struct TagItem scrntags[]; extern struct NewScreen NewHackScreen; extern int topl_addspace; -extern char spaces[ 76 ]; -extern int wincnt; /* # of nh windows opened */ +extern char spaces[76]; +extern int wincnt; /* # of nh windows opened */ extern struct Rectangle lastinvent, lastmsg; typedef struct { - UWORD w, h; - WORD x, y; - UBYTE nPlanes; - UBYTE masking; - UBYTE compression; - UBYTE reserved1; - UWORD transparentColor; - UBYTE xAspect, yAspect; - WORD pageWidth, pageHeight; + UWORD w, h; + WORD x, y; + UBYTE nPlanes; + UBYTE masking; + UBYTE compression; + UBYTE reserved1; + UWORD transparentColor; + UBYTE xAspect, yAspect; + WORD pageWidth, pageHeight; } BitMapHeader; -typedef enum {COL_MAZE_BRICK,COL_MAZE_STONE,COL_MAZE_HEAT,COL_MAZE_WOOD} MazeType; +typedef enum { + COL_MAZE_BRICK, + COL_MAZE_STONE, + COL_MAZE_HEAT, + COL_MAZE_WOOD +} MazeType; extern struct PDAT pictdata; extern struct Hook fillhook; extern struct TagItem wintags[]; -#ifndef SHAREDLIB +#ifndef SHAREDLIB #ifndef __GNUC__ -void __asm LayerFillHook( - register __a0 struct Hook *hk, - register __a2 struct RastPort *rp, - register __a1 struct FillParams *fp ); +void __asm LayerFillHook(register __a0 struct Hook *hk, + register __a2 struct RastPort *rp, + register __a1 struct FillParams *fp); #else #ifdef __PPC__ struct EmulLibEntry LayerFillHook; diff --git a/sys/amiga/winproto.h b/sys/amiga/winproto.h index 35bbc9725..1f10499fa 100644 --- a/sys/amiga/winproto.h +++ b/sys/amiga/winproto.h @@ -4,143 +4,146 @@ /* NetHack may be freely redistributed. See license for details. */ /* winreq.c */ -void EditColor ( void ); -void EditClipping( void ); -void DrawCol ( struct Window *w , int idx , UWORD *colors ); -void DispCol ( struct Window *w , int idx , UWORD *colors ); -void amii_change_color( int, long, int ); -char *amii_get_color_string( ); -void amii_getlin ( const char *prompt , char *bufp ); -void getlind ( const char *prompt , char *bufp , const char *dflt ); -char *amii_get_color_string( void ); -int filecopy( char *from, char *to ); -char *basename( char *str ); -char *dirname( char *str ); +void EditColor(void); +void EditClipping(void); +void DrawCol(struct Window *w, int idx, UWORD *colors); +void DispCol(struct Window *w, int idx, UWORD *colors); +void amii_change_color(int, long, int); +char *amii_get_color_string(); +void amii_getlin(const char *prompt, char *bufp); +void getlind(const char *prompt, char *bufp, const char *dflt); +char *amii_get_color_string(void); +int filecopy(char *from, char *to); +char *basename(char *str); +char *dirname(char *str); /* winstr.c */ -void amii_putstr ( winid window , int attr , const char *str ); -void outmore ( struct amii_WinDesc *cw ); -void outsubstr ( struct amii_WinDesc *cw , char *str , int len, int fudge ); -void amii_putsym ( winid st , int i , int y , CHAR_P c ); -void amii_addtopl ( const char *s ); -void TextSpaces ( struct RastPort *rp , int nr ); -void amii_remember_topl ( void ); -long CountLines( winid ); -long FindLine( winid, int ); -int amii_doprev_message ( void ); -void flushIDCMP( struct MsgPort * ); -int amii_msgborder( struct Window * ); -void amii_scrollmsg( register struct Window *w, register struct amii_WinDesc *cw ); +void amii_putstr(winid window, int attr, const char *str); +void outmore(struct amii_WinDesc *cw); +void outsubstr(struct amii_WinDesc *cw, char *str, int len, int fudge); +void amii_putsym(winid st, int i, int y, CHAR_P c); +void amii_addtopl(const char *s); +void TextSpaces(struct RastPort *rp, int nr); +void amii_remember_topl(void); +long CountLines(winid); +long FindLine(winid, int); +int amii_doprev_message(void); +void flushIDCMP(struct MsgPort *); +int amii_msgborder(struct Window *); +void amii_scrollmsg(register struct Window *w, + register struct amii_WinDesc *cw); /* winkey.c */ -int amii_nh_poskey ( int *x , int *y , int *mod ); -int amii_nhgetch ( void ); -void amii_get_nh_event ( void ); -void amii_getret ( void ); +int amii_nh_poskey(int *x, int *y, int *mod); +int amii_nhgetch(void); +void amii_get_nh_event(void); +void amii_getret(void); /* winmenu.c */ -void amii_start_menu ( winid window ); -void FDECL(amii_add_menu, (winid,int,const anything *,CHAR_P,CHAR_P,int,const char *,BOOLEAN_P)); +void amii_start_menu(winid window); +void FDECL(amii_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int, + const char *, BOOLEAN_P)); void FDECL(amii_end_menu, (winid, const char *)); int FDECL(amii_select_menu, (winid, int, menu_item **)); -int DoMenuScroll ( int win , int blocking, int how, menu_item ** ); -void ReDisplayData ( winid win ); -void DisplayData ( winid win , int start ); -void SetPropInfo ( struct Window *win , struct Gadget *gad , long vis , long total , long top ); +int DoMenuScroll(int win, int blocking, int how, menu_item **); +void ReDisplayData(winid win); +void DisplayData(winid win, int start); +void SetPropInfo(struct Window *win, struct Gadget *gad, long vis, long total, + long top); /* amiwind.c */ -struct Window *OpenShWindow ( struct NewWindow *nw ); -void CloseShWindow ( struct Window *win ); -int ConvertKey ( struct IntuiMessage *message ); -int kbhit ( void ); -int kbhit ( void ); -int amikbhit ( void ); -int WindowGetchar ( void ); -WETYPE WindowGetevent ( void ); -void amii_cleanup ( void ); -#ifndef SHAREDLIB -void Abort ( long rc ); +struct Window *OpenShWindow(struct NewWindow *nw); +void CloseShWindow(struct Window *win); +int ConvertKey(struct IntuiMessage *message); +int kbhit(void); +int kbhit(void); +int amikbhit(void); +int WindowGetchar(void); +WETYPE WindowGetevent(void); +void amii_cleanup(void); +#ifndef SHAREDLIB +void Abort(long rc); #endif -void CleanUp ( void ); -void flush_glyph_buffer ( struct Window *w ); -void amiga_print_glyph ( winid window , int color_index , int glyph ); -void start_glyphout ( winid window ); -void amii_end_glyphout ( winid window ); -struct NewWindow *DupNewWindow ( struct NewWindow *win ); -void FreeNewWindow ( struct NewWindow *win ); -void bell ( void ); -void amii_delay_output ( void ); -void amii_number_pad ( int state ); -#ifndef SHAREDLIB -void amiv_loadlib ( void ); -void amii_loadlib ( void ); +void CleanUp(void); +void flush_glyph_buffer(struct Window *w); +void amiga_print_glyph(winid window, int color_index, int glyph); +void start_glyphout(winid window); +void amii_end_glyphout(winid window); +struct NewWindow *DupNewWindow(struct NewWindow *win); +void FreeNewWindow(struct NewWindow *win); +void bell(void); +void amii_delay_output(void); +void amii_number_pad(int state); +#ifndef SHAREDLIB +void amiv_loadlib(void); +void amii_loadlib(void); #endif -void preserve_icon( void ); -void clear_icon( void ); +void preserve_icon(void); +void clear_icon(void); /* winfuncs.c */ -void amii_destroy_nhwindow ( winid win ); -int amii_create_nhwindow ( int type ); -void amii_init_nhwindows ( int *, char ** ); -void amii_setdrawpens( struct Window *, int type ); -void amii_sethipens( struct Window *, int type, int attr ); -void amii_setfillpens( struct Window *, int type ); -void amii_clear_nhwindow ( winid win ); -void dismiss_nhwindow ( winid win ); -void amii_exit_nhwindows ( const char *str ); -void amii_display_nhwindow ( winid win , boolean blocking ); -void amii_curs ( winid window , int x , int y ); -void kill_nhwindows ( int all ); -void amii_cl_end ( struct amii_WinDesc *cw , int i ); -void cursor_off ( winid window ); -void cursor_on ( winid window ); -void amii_suspend_nhwindows ( const char *str ); -void amii_resume_nhwindows ( void ); -void amii_bell ( void ); -void removetopl ( int cnt ); -void port_help ( void ); -void amii_print_glyph ( winid win , xchar x , xchar y , int glyph ); -void amii_raw_print ( const char *s ); -void amii_raw_print_bold ( const char *s ); -void amii_update_inventory ( void ); -void amii_mark_synch ( void ); -void amii_wait_synch ( void ); -void amii_setclipped ( void ); -void amii_cliparound ( int x , int y ); -void amii_set_text_font( char *font, int size ); -BitMapHeader ReadImageFiles( char **, struct BitMap **, char ** ); +void amii_destroy_nhwindow(winid win); +int amii_create_nhwindow(int type); +void amii_init_nhwindows(int *, char **); +void amii_setdrawpens(struct Window *, int type); +void amii_sethipens(struct Window *, int type, int attr); +void amii_setfillpens(struct Window *, int type); +void amii_clear_nhwindow(winid win); +void dismiss_nhwindow(winid win); +void amii_exit_nhwindows(const char *str); +void amii_display_nhwindow(winid win, boolean blocking); +void amii_curs(winid window, int x, int y); +void kill_nhwindows(int all); +void amii_cl_end(struct amii_WinDesc *cw, int i); +void cursor_off(winid window); +void cursor_on(winid window); +void amii_suspend_nhwindows(const char *str); +void amii_resume_nhwindows(void); +void amii_bell(void); +void removetopl(int cnt); +void port_help(void); +void amii_print_glyph(winid win, xchar x, xchar y, int glyph); +void amii_raw_print(const char *s); +void amii_raw_print_bold(const char *s); +void amii_update_inventory(void); +void amii_mark_synch(void); +void amii_wait_synch(void); +void amii_setclipped(void); +void amii_cliparound(int x, int y); +void amii_set_text_font(char *font, int size); +BitMapHeader ReadImageFiles(char **, struct BitMap **, char **); BitMapHeader ReadTileImageFiles(void); -void FreeImageFiles( char **, struct BitMap ** ); +void FreeImageFiles(char **, struct BitMap **); void FreeTileImageFiles(); /* winami.c */ -#ifdef SHAREDLIB -int __UserLibInit ( void ); -void __UserLibCleanup ( void ); +#ifdef SHAREDLIB +int __UserLibInit(void); +void __UserLibCleanup(void); #endif -void amii_askname ( void ); -void amii_player_selection ( void ); -void RandomWindow ( char *name ); -int amii_get_ext_cmd ( void ); -char amii_yn_function ( const char *prompt , const char *resp , char def ); -char amii_yn_function ( const char *query , const char *resp , char def ); -void amii_display_file ( const char *fn , boolean complain ); -void SetBorder ( struct Gadget *gd ); -void *malloc ( register unsigned size ); -void free ( void *q ); +void amii_askname(void); +void amii_player_selection(void); +void RandomWindow(char *name); +int amii_get_ext_cmd(void); +char amii_yn_function(const char *prompt, const char *resp, char def); +char amii_yn_function(const char *query, const char *resp, char def); +void amii_display_file(const char *fn, boolean complain); +void SetBorder(struct Gadget *gd); +void *malloc(register unsigned size); +void free(void *q); -#ifdef SHAREDLIB +#ifdef SHAREDLIB /* amilib.c */ -void amii_loadlib ( void ); -void amiv_loadlib ( void ); -void CleanUp ( void ); -void setup_librefs ( WinamiBASE *base ); +void amii_loadlib(void); +void amiv_loadlib(void); +void CleanUp(void); +void setup_librefs(WinamiBASE *base); #else -void Abort ( long rc ); +void Abort(long rc); #endif /* amirip.c */ -void FDECL(amii_outrip, ( winid tmpwin, int how, time_t when )); +void FDECL(amii_outrip, (winid tmpwin, int how, time_t when)); /* winchar.c */ void SetMazeType(MazeType); diff --git a/sys/msdos/pctiles.h b/sys/msdos/pctiles.h index 6b9065062..72df6f1fb 100644 --- a/sys/msdos/pctiles.h +++ b/sys/msdos/pctiles.h @@ -6,61 +6,60 @@ /* */ /* * pctiles.h - Definitions for PC graphical tile support - * + * *Edit History: * Initial Creation M. Allison 93/10/30 * */ #ifdef USE_TILES -#define NETHACK_PLANAR_TILEFILE "NetHack1.tib" /* Planar style tiles */ -#define NETHACK_PACKED_TILEFILE "NetHack2.tib" /* Packed style tiles */ +#define NETHACK_PLANAR_TILEFILE "NetHack1.tib" /* Planar style tiles */ +#define NETHACK_PACKED_TILEFILE "NetHack2.tib" /* Packed style tiles */ #define NETHACK_OVERVIEW_TILEFILE "NetHacko.tib" /* thin overview tiles */ -#define ROWS_PER_TILE TILE_Y -#define COLS_PER_TILE TILE_X -#define EMPTY_TILE -1 -#define TIBHEADER_SIZE 1024 /* Use this for size, allows expansion */ -#define PLANAR_STYLE 0 -#define PACKED_STYLE 1 -#define DJGPP_COMP 0 -#define MSC_COMP 1 -#define BC_COMP 2 -#define OTHER_COMP 10 +#define ROWS_PER_TILE TILE_Y +#define COLS_PER_TILE TILE_X +#define EMPTY_TILE -1 +#define TIBHEADER_SIZE 1024 /* Use this for size, allows expansion */ +#define PLANAR_STYLE 0 +#define PACKED_STYLE 1 +#define DJGPP_COMP 0 +#define MSC_COMP 1 +#define BC_COMP 2 +#define OTHER_COMP 10 struct tibhdr_struct { - char ident[80]; /* Identifying string */ - char timestamp[26]; /* Ascii timestamp */ - char tilestyle; /* 0 = planar, 1 = pixel */ - char compiler; /* 0 = DJGPP, 1 = MSC, 2= BC etc. see above */ - short tilecount; /* number of tiles in file */ - short numcolors; /* number of colors in palette */ - char palette[256 * 3]; /* palette */ + char ident[80]; /* Identifying string */ + char timestamp[26]; /* Ascii timestamp */ + char tilestyle; /* 0 = planar, 1 = pixel */ + char compiler; /* 0 = DJGPP, 1 = MSC, 2= BC etc. see above */ + short tilecount; /* number of tiles in file */ + short numcolors; /* number of colors in palette */ + char palette[256 * 3]; /* palette */ }; - /* Note on packed style tile file: * Each record consists of one of the following arrays: * char packtile[TILE_Y][TILE_X]; */ - + extern void FDECL(CloseTileFile, (BOOLEAN_P)); -extern int FDECL(OpenTileFile, (char *, BOOLEAN_P)); -extern int FDECL(ReadTileFileHeader, (struct tibhdr_struct *, BOOLEAN_P)); +extern int FDECL(OpenTileFile, (char *, BOOLEAN_P)); +extern int FDECL(ReadTileFileHeader, (struct tibhdr_struct *, BOOLEAN_P)); -# ifdef PLANAR_FILE -# ifdef SCREEN_VGA -extern int FDECL(ReadPlanarTileFile,(int, struct planar_cell_struct **)); -extern int FDECL(ReadPlanarTileFile_O, - (int, struct overview_planar_cell_struct **)); -# endif -# endif +#ifdef PLANAR_FILE +#ifdef SCREEN_VGA +extern int FDECL(ReadPlanarTileFile, (int, struct planar_cell_struct **)); +extern int FDECL(ReadPlanarTileFile_O, + (int, struct overview_planar_cell_struct **)); +#endif +#endif -# ifdef PACKED_FILE -extern int FDECL(ReadPackedTileFile, (int, char (*)[TILE_X])); -# endif +#ifdef PACKED_FILE +extern int FDECL(ReadPackedTileFile, (int, char (*)[TILE_X])); +#endif -extern short glyph2tile[MAX_GLYPH]; /* in tile.c (made from tilemap.c) */ +extern short glyph2tile[MAX_GLYPH]; /* in tile.c (made from tilemap.c) */ #endif /* USE_TILES */ diff --git a/sys/msdos/pcvideo.h b/sys/msdos/pcvideo.h index 49da193e7..a5c5224a4 100644 --- a/sys/msdos/pcvideo.h +++ b/sys/msdos/pcvideo.h @@ -6,7 +6,7 @@ /* */ /* * pcvideo.h - Hardware video support definitions and prototypes - * + * *Edit History: * Initial Creation M. Allison 93/10/30 * @@ -17,197 +17,208 @@ #include "portio.h" -# ifdef SCREEN_BIOS -# if !defined(PC9800) -# define MONO_CHECK /* Video BIOS can do the check */ -# endif -# endif +#ifdef SCREEN_BIOS +#if !defined(PC9800) +#define MONO_CHECK /* Video BIOS can do the check */ +#endif +#endif -# ifdef SCREEN_DJGPPFAST +#ifdef SCREEN_DJGPPFAST /*# define MONO_CHECK /* djgpp should be able to do check */ -# endif +#endif /* * PC interrupts */ -# ifdef PC9800 -#define CRT_BIOS 0x18 -#define DOS_EXT_FUNC 0xdc -#define DIRECT_CON_IO 0x10 -# else -#define VIDEO_BIOS 0x10 -# endif -#define DOSCALL 0x21 - +#ifdef PC9800 +#define CRT_BIOS 0x18 +#define DOS_EXT_FUNC 0xdc +#define DIRECT_CON_IO 0x10 +#else +#define VIDEO_BIOS 0x10 +#endif +#define DOSCALL 0x21 /* * Video BIOS functions */ -# if defined(PC9800) -#define SENSEMODE 0x0b /* Sense CRT Mode */ - -#define PUTCHAR 0x00 /* Put Character */ -#define SETATT 0x02 /* Set Attribute */ -#define SETCURPOS 0x03 /* Set Cursor Position */ -#define CURSOR_RIGHT 0x08 /* Move Cursor Right */ -#define CURSOR_LEFT 0x09 /* Move Cursor Left */ -#define SCREEN_CLEAR 0x0a /* Clear Screen */ -#define LINE_CLEAR 0x0b /* Clear Line */ -# else -#define SETCURPOS 0x02 /* Set Cursor Position */ -# endif - -#define GETCURPOS 0x03 /* Get Cursor Position */ -#define GETMODE 0x0f /* Get Video Mode */ -#define SETMODE 0x00 /* Set Video Mode */ -#define SETPAGE 0x05 /* Set Video Page */ -#define FONTINFO 0x1130 /* Get Font Info */ -#define SCROLL 0x06 /* Scroll or initialize window */ -#define PUTCHARATT 0x09 /* Write attribute & char at cursor */ +#if defined(PC9800) +#define SENSEMODE 0x0b /* Sense CRT Mode */ + +#define PUTCHAR 0x00 /* Put Character */ +#define SETATT 0x02 /* Set Attribute */ +#define SETCURPOS 0x03 /* Set Cursor Position */ +#define CURSOR_RIGHT 0x08 /* Move Cursor Right */ +#define CURSOR_LEFT 0x09 /* Move Cursor Left */ +#define SCREEN_CLEAR 0x0a /* Clear Screen */ +#define LINE_CLEAR 0x0b /* Clear Line */ +#else +#define SETCURPOS 0x02 /* Set Cursor Position */ +#endif + +#define GETCURPOS 0x03 /* Get Cursor Position */ +#define GETMODE 0x0f /* Get Video Mode */ +#define SETMODE 0x00 /* Set Video Mode */ +#define SETPAGE 0x05 /* Set Video Page */ +#define FONTINFO 0x1130 /* Get Font Info */ +#define SCROLL 0x06 /* Scroll or initialize window */ +#define PUTCHARATT 0x09 /* Write attribute & char at cursor */ /* * VGA Specific Stuff */ -# ifdef SCREEN_VGA +#ifdef SCREEN_VGA /* #define HW_PANNING /* Hardware panning enabled */ -#define USHORT unsigned short -#define MODE640x480 0x0012 /* Switch to VGA 640 x 480 Graphics mode */ -#define MODETEXT 0x0003 /* Switch to Text mode 3 */ +#define USHORT unsigned short +#define MODE640x480 0x0012 /* Switch to VGA 640 x 480 Graphics mode */ +#define MODETEXT 0x0003 /* Switch to Text mode 3 */ #ifdef HW_PANNING -#define PIXELINC 16 /* How much to increment by when panning */ +#define PIXELINC 16 /* How much to increment by when panning */ /*#define PIXELINC 1 /* How much to increment by when panning */ -#define SCREENBYTES 128 -#define CharRows 30 -#define VERT_RETRACE {while (!(inportb(crt_status) & 0x08)); } -#define VERT_RETRACE_END {while ( (inportb(crt_status) & 0x08)); } +#define SCREENBYTES 128 +#define CharRows 30 +#define VERT_RETRACE \ + { \ + while (!(inportb(crt_status) & 0x08)) \ + ; \ + } +#define VERT_RETRACE_END \ + { \ + while ((inportb(crt_status) & 0x08)) \ + ; \ + } #else -#define SCREENBYTES 80 +#define SCREENBYTES 80 #endif #define CharacterWidth 8 -#define SCREENHEIGHT 480 +#define SCREENHEIGHT 480 #define SCREENWIDTH (SCREENBYTES * CharacterWidth) -#define VIDEOSEG 0xa000 +#define VIDEOSEG 0xa000 #define FONT_PTR_SEGMENT 0x0000 -#define FONT_PTR_OFFSET 0x010C -#define SCREENPLANES 4 -#define COLORDEPTH 16 -#define egawriteplane(n) { outportb(0x3c4,2); outportb(0x3c5,n); } -#define egareadplane(n) { outportb(0x3ce,4); outportb(0x3cf,n); } -#define col2x8(c) ((c) * 8) -#define col2x16(c) ((c) * 16) -#define col2x(c) ((c) * 2) -#define row2y(c) ((c) * 16) +#define FONT_PTR_OFFSET 0x010C +#define SCREENPLANES 4 +#define COLORDEPTH 16 +#define egawriteplane(n) \ + { \ + outportb(0x3c4, 2); \ + outportb(0x3c5, n); \ + } +#define egareadplane(n) \ + { \ + outportb(0x3ce, 4); \ + outportb(0x3cf, n); \ + } +#define col2x8(c) ((c) *8) +#define col2x16(c) ((c) *16) +#define col2x(c) ((c) *2) +#define row2y(c) ((c) *16) #define MAX_ROWS_PER_CELL 16 #define MAX_COLS_PER_CELL 16 -#define MAX_BYTES_PER_CELL 2 /* MAX_COLS_PER_CELL/8 */ -#define ROWS_PER_CELL MAX_ROWS_PER_CELL -#define COLS_PER_CELL MAX_COLS_PER_CELL +#define MAX_BYTES_PER_CELL 2 /* MAX_COLS_PER_CELL/8 */ +#define ROWS_PER_CELL MAX_ROWS_PER_CELL +#define COLS_PER_CELL MAX_COLS_PER_CELL #define BYTES_PER_CELL MAX_BYTES_PER_CELL struct cellplane { - char image[MAX_ROWS_PER_CELL][MAX_BYTES_PER_CELL]; + char image[MAX_ROWS_PER_CELL][MAX_BYTES_PER_CELL]; }; - + struct planar_cell_struct { - struct cellplane plane[SCREENPLANES]; + struct cellplane plane[SCREENPLANES]; }; struct overview_cellplane { - char image[MAX_ROWS_PER_CELL][1]; + char image[MAX_ROWS_PER_CELL][1]; }; struct overview_planar_cell_struct { - struct overview_cellplane plane[SCREENPLANES]; + struct overview_cellplane plane[SCREENPLANES]; }; - - -# endif /* SCREEN_VGA */ - +#endif /* SCREEN_VGA */ /* * Default color Indexes for hardware palettes - * + * * Do not change the values below. - * These are the color mappings defined by the particular video + * These are the color mappings defined by the particular video * hardware/mode. You can rearrange the NetHack color mappings at * run-time via the defaults.nh "videocolors" and "videoshades" * settings. * */ -# if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) -#define M_BLACK 8 -#define M_WHITE 15 -#define M_GRAY 7 /* low-intensity white */ -#define M_RED 4 -#define M_GREEN 2 -#define M_BROWN 6 /* low-intensity yellow */ -#define M_BLUE 1 -#define M_MAGENTA 5 -#define M_CYAN 3 -#define M_ORANGE 12 -#define M_BRIGHTGREEN 10 -#define M_YELLOW 14 -#define M_BRIGHTBLUE 9 -#define M_BRIGHTMAGENTA 13 -#define M_BRIGHTCYAN 11 - -#define M_TEXT M_GRAY -#define BACKGROUND_COLOR 0 -#define ATTRIB_NORMAL M_TEXT /* Normal attribute */ -#define ATTRIB_INTENSE M_WHITE /* Intense White */ -#define ATTRIB_MONO_NORMAL 0x01 /* Underlined,white */ -#define ATTRIB_MONO_UNDERLINE 0x01 /* Underlined,white */ -#define ATTRIB_MONO_BLINK 0x87 /* Flash bit, white */ -#define ATTRIB_MONO_REVERSE 0x70 /* Black on white */ -# endif /*SCREEN_BIOS || SCREEN_DJGPPFAST */ - -# if defined(SCREEN_VGA) || defined(SCREEN_8514) -#define BACKGROUND_VGA_COLOR 0 -#define ATTRIB_VGA_NORMAL CLR_GRAY /* Normal attribute */ -#define ATTRIB_VGA_INTENSE 13 /* Intense White 94/06/07 palette chg*/ -# endif /*SCREEN_VGA || SCREEN_8514*/ - -# if defined(PC9800) +#if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) +#define M_BLACK 8 +#define M_WHITE 15 +#define M_GRAY 7 /* low-intensity white */ +#define M_RED 4 +#define M_GREEN 2 +#define M_BROWN 6 /* low-intensity yellow */ +#define M_BLUE 1 +#define M_MAGENTA 5 +#define M_CYAN 3 +#define M_ORANGE 12 +#define M_BRIGHTGREEN 10 +#define M_YELLOW 14 +#define M_BRIGHTBLUE 9 +#define M_BRIGHTMAGENTA 13 +#define M_BRIGHTCYAN 11 + +#define M_TEXT M_GRAY +#define BACKGROUND_COLOR 0 +#define ATTRIB_NORMAL M_TEXT /* Normal attribute */ +#define ATTRIB_INTENSE M_WHITE /* Intense White */ +#define ATTRIB_MONO_NORMAL 0x01 /* Underlined,white */ +#define ATTRIB_MONO_UNDERLINE 0x01 /* Underlined,white */ +#define ATTRIB_MONO_BLINK 0x87 /* Flash bit, white */ +#define ATTRIB_MONO_REVERSE 0x70 /* Black on white */ +#endif /*SCREEN_BIOS || SCREEN_DJGPPFAST */ + +#if defined(SCREEN_VGA) || defined(SCREEN_8514) +#define BACKGROUND_VGA_COLOR 0 +#define ATTRIB_VGA_NORMAL CLR_GRAY /* Normal attribute */ +#define ATTRIB_VGA_INTENSE 13 /* Intense White 94/06/07 palette chg*/ +#endif /*SCREEN_VGA || SCREEN_8514*/ + +#if defined(PC9800) static unsigned char attr98[CLR_MAX] = { - 0xe1, /* 0 white */ - 0x21, /* 1 blue */ - 0x81, /* 2 green */ - 0xa1, /* 3 cyan */ - 0x41, /* 4 red */ - 0x61, /* 5 magenta */ - 0xc1, /* 6 yellow */ - 0xe1, /* 7 white */ - 0xe1, /* 8 white */ - 0x25, /* 9 reversed blue */ - 0x85, /* 10 reversed green */ - 0xa5, /* 11 reversed cyan */ - 0x45, /* 12 reversed red */ - 0x65, /* 13 reversed magenta */ - 0xc5, /* 14 reversed yellow */ - 0xe5, /* 15 reversed white */ + 0xe1, /* 0 white */ + 0x21, /* 1 blue */ + 0x81, /* 2 green */ + 0xa1, /* 3 cyan */ + 0x41, /* 4 red */ + 0x61, /* 5 magenta */ + 0xc1, /* 6 yellow */ + 0xe1, /* 7 white */ + 0xe1, /* 8 white */ + 0x25, /* 9 reversed blue */ + 0x85, /* 10 reversed green */ + 0xa5, /* 11 reversed cyan */ + 0x45, /* 12 reversed red */ + 0x65, /* 13 reversed magenta */ + 0xc5, /* 14 reversed yellow */ + 0xe5, /* 15 reversed white */ }; -# endif +#endif -# ifdef SIMULATE_CURSOR -#define CURSOR_HEIGHT 3 /* this should go - MJA */ +#ifdef SIMULATE_CURSOR +#define CURSOR_HEIGHT 3 /* this should go - MJA */ /* cursor styles */ -#define CURSOR_INVIS 0 /* cursor not visible at all */ -#define CURSOR_FRAME 1 /* block around the current tile */ -#define CURSOR_UNDERLINE 2 /* thin line at bottom of the tile */ -#define CURSOR_CORNER 3 /* cursor visible at the 4 tile corners */ -#define NUM_CURSOR_TYPES 4 /* number of different cursor types */ -#define CURSOR_DEFAULT_STYLE CURSOR_CORNER +#define CURSOR_INVIS 0 /* cursor not visible at all */ +#define CURSOR_FRAME 1 /* block around the current tile */ +#define CURSOR_UNDERLINE 2 /* thin line at bottom of the tile */ +#define CURSOR_CORNER 3 /* cursor visible at the 4 tile corners */ +#define NUM_CURSOR_TYPES 4 /* number of different cursor types */ +#define CURSOR_DEFAULT_STYLE CURSOR_CORNER #define CURSOR_DEFAULT_COLOR M_GRAY /* global variables for cursor */ extern int cursor_type; extern int cursor_flag; extern int cursor_color; -# endif - +#endif /* * Function Prototypes @@ -218,55 +229,55 @@ extern int cursor_color; /* ### video.c ### */ -# ifdef SIMULATE_CURSOR +#ifdef SIMULATE_CURSOR E void NDECL(DrawCursor); E void NDECL(HideCursor); -# endif +#endif /* ### vidtxt.c ### */ -# ifdef NO_TERMS +#ifdef NO_TERMS E void NDECL(txt_backsp); E void NDECL(txt_clear_screen); -E void FDECL(txt_cl_end,(int,int)); +E void FDECL(txt_cl_end, (int, int)); E void NDECL(txt_cl_eos); E void NDECL(txt_get_scr_size); -E void FDECL(txt_gotoxy,(int,int)); -E int NDECL(txt_monoadapt_check); +E void FDECL(txt_gotoxy, (int, int)); +E int NDECL(txt_monoadapt_check); E void NDECL(txt_nhbell); -E void FDECL(txt_startup,(int*,int*)); +E void FDECL(txt_startup, (int *, int *)); E void FDECL(txt_xputs, (const char *, int, int)); E void FDECL(txt_xputc, (CHAR_P, int)); /* ### vidvga.c ### */ -# ifdef SCREEN_VGA +#ifdef SCREEN_VGA E void NDECL(vga_backsp); -E void FDECL(vga_clear_screen,(int)); -E void FDECL(vga_cl_end,(int,int)); -E void FDECL(vga_cl_eos,(int)); -E int NDECL(vga_detect); -# ifdef SIMULATE_CURSOR +E void FDECL(vga_clear_screen, (int)); +E void FDECL(vga_cl_end, (int, int)); +E void FDECL(vga_cl_eos, (int)); +E int NDECL(vga_detect); +#ifdef SIMULATE_CURSOR E void NDECL(vga_DrawCursor); -# endif +#endif E void FDECL(vga_DisplayCell, (struct planar_cell_struct *, int, int)); -E void FDECL(vga_DisplayCell_O, - (struct overview_planar_cell_struct *, int, int)); +E void FDECL(vga_DisplayCell_O, + (struct overview_planar_cell_struct *, int, int)); E void NDECL(vga_Finish); E char __far *NDECL(vga_FontPtrs); E void NDECL(vga_get_scr_size); -E void FDECL(vga_gotoloc,(int,int)); -# ifdef POSITIONBAR +E void FDECL(vga_gotoloc, (int, int)); +#ifdef POSITIONBAR E void FDECL(vga_update_positionbar, (char *)); -# endif -# ifdef SIMULATE_CURSOR +#endif +#ifdef SIMULATE_CURSOR E void NDECL(vga_HideCursor); -# endif +#endif E void NDECL(vga_Init); E void FDECL(vga_SwitchMode, (unsigned int)); E void FDECL(vga_SetPalette, (char *)); E void NDECL(vga_tty_end_screen); -E void FDECL(vga_tty_startup,(int*,int*)); +E void FDECL(vga_tty_startup, (int *, int *)); E void FDECL(vga_WriteChar, (int, int, int, int)); E void FDECL(vga_WriteStr, (char *, int, int, int, int)); E void FDECL(vga_xputs, (const char *, int, int)); @@ -276,8 +287,8 @@ E void FDECL(vga_userpan, (BOOLEAN_P)); E void FDECL(vga_overview, (BOOLEAN_P)); E void FDECL(vga_traditional, (BOOLEAN_P)); E void NDECL(vga_refresh); -# endif /* SCREEN_VGA */ -# endif /* NO_TERMS */ +#endif /* SCREEN_VGA */ +#endif /* NO_TERMS */ #undef E diff --git a/sys/msdos/portio.h b/sys/msdos/portio.h index 967888757..f4b37de28 100644 --- a/sys/msdos/portio.h +++ b/sys/msdos/portio.h @@ -7,30 +7,30 @@ /* * portio.h - PC port I/O Hardware support definitions and other * low-level definitions. - * + * */ #ifndef PORTIO_H #define PORTIO_H -# if defined(__GO32__) || defined(__DJGPP__) +#if defined(__GO32__) || defined(__DJGPP__) #define __far #include #include #include #endif -# if defined(_MSC_VER) +#if defined(_MSC_VER) #define outportb _outp #define outportw _outpw #define inportb _inp -# endif -# if defined(__BORLANDC__) +#endif +#if defined(__BORLANDC__) #define outportw outport /* #define inportb inport */ -# endif +#endif -# ifndef MK_PTR +#ifndef MK_PTR /* * Depending on environment, this is a macro to construct either: * @@ -38,36 +38,38 @@ * - a far pointer from segment and offset values * */ -# if defined(_MSC_VER) || defined(__BORLANDC__) -#define MK_PTR(seg, offset) (void __far *)(((unsigned long)seg << 16) \ - + (unsigned long)(unsigned)offset) +#if defined(_MSC_VER) || defined(__BORLANDC__) +#define MK_PTR(seg, offset) \ + (void __far *)(((unsigned long) seg << 16) \ + + (unsigned long) (unsigned) offset) #define READ_ABSOLUTE(x) *(x) #define READ_ABSOLUTE_WORD(x) *(x) -#define WRITE_ABSOLUTE(x,y) *(x) = (y) -#define WRITE_ABSOLUTE_WORD(x,y) *(x) = (y) -# endif +#define WRITE_ABSOLUTE(x, y) *(x) = (y) +#define WRITE_ABSOLUTE_WORD(x, y) *(x) = (y) +#endif -# if defined(__GO32__) || defined(__DJGPP__) -#define MK_PTR(seg, offset) (void *)(((unsigned)seg << 4) + (unsigned)offset) +#if defined(__GO32__) || defined(__DJGPP__) +#define MK_PTR(seg, offset) \ + (void *)(((unsigned) seg << 4) + (unsigned) offset) #define READ_ABSOLUTE(x) \ - (_farpeekb(_go32_conventional_mem_selector(), (unsigned)x)) + (_farpeekb(_go32_conventional_mem_selector(), (unsigned) x)) #define READ_ABSOLUTE_WORD(x) \ - (_farpeekw(_go32_conventional_mem_selector(), (unsigned)x)) -#define WRITE_ABSOLUTE(x,y) \ - _farpokeb(_go32_conventional_mem_selector(), (unsigned)x, (y)) -#define WRITE_ABSOLUTE_WORD(x,y) \ - _farpokew(_go32_conventional_mem_selector(), (unsigned)x, (y)) -# endif + (_farpeekw(_go32_conventional_mem_selector(), (unsigned) x)) +#define WRITE_ABSOLUTE(x, y) \ + _farpokeb(_go32_conventional_mem_selector(), (unsigned) x, (y)) +#define WRITE_ABSOLUTE_WORD(x, y) \ + _farpokew(_go32_conventional_mem_selector(), (unsigned) x, (y)) +#endif -# ifdef OBSOLETE /* old djgpp V1.x way of mapping 1st MB */ -#define MK_PTR(seg, offset) (void *)(0xE0000000+((((unsigned)seg << 4) \ - + (unsigned)offset))) +#ifdef OBSOLETE /* old djgpp V1.x way of mapping 1st MB */ +#define MK_PTR(seg, offset) \ + (void *)(0xE0000000 + ((((unsigned) seg << 4) + (unsigned) offset))) #define READ_ABSOLUTE(x) *(x) #define READ_ABSOLUTE_WORD(x) *(x) -#define WRITE_ABSOLUTE(x,y) *(x) = (y) -#define WRITE_ABSOLUTE_WORD(x,y) *(x) = (y) -# endif -# endif /* MK_PTR */ +#define WRITE_ABSOLUTE(x, y) *(x) = (y) +#define WRITE_ABSOLUTE_WORD(x, y) *(x) = (y) +#endif +#endif /* MK_PTR */ #endif /* PORTIO_H */ /* portio.h */ diff --git a/sys/share/dgn_comp.h b/sys/share/dgn_comp.h index 8544faaea..6dede16f0 100644 --- a/sys/share/dgn_comp.h +++ b/sys/share/dgn_comp.h @@ -2,20 +2,20 @@ /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -28,39 +28,38 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INTEGER = 258, - A_DUNGEON = 259, - BRANCH = 260, - CHBRANCH = 261, - LEVEL = 262, - RNDLEVEL = 263, - CHLEVEL = 264, - RNDCHLEVEL = 265, - UP_OR_DOWN = 266, - PROTOFILE = 267, - DESCRIPTION = 268, - DESCRIPTOR = 269, - LEVELDESC = 270, - ALIGNMENT = 271, - LEVALIGN = 272, - ENTRY = 273, - STAIR = 274, - NO_UP = 275, - NO_DOWN = 276, - PORTAL = 277, - STRING = 278 - }; +#define YYTOKENTYPE +/* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ +enum yytokentype { + INTEGER = 258, + A_DUNGEON = 259, + BRANCH = 260, + CHBRANCH = 261, + LEVEL = 262, + RNDLEVEL = 263, + CHLEVEL = 264, + RNDCHLEVEL = 265, + UP_OR_DOWN = 266, + PROTOFILE = 267, + DESCRIPTION = 268, + DESCRIPTOR = 269, + LEVELDESC = 270, + ALIGNMENT = 271, + LEVALIGN = 272, + ENTRY = 273, + STAIR = 274, + NO_UP = 275, + NO_DOWN = 276, + PORTAL = 277, + STRING = 278 +}; #endif /* Tokens. */ #define INTEGER 258 @@ -85,29 +84,20 @@ #define PORTAL 277 #define STRING 278 - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - +#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE { /* Line 1676 of yacc.c */ #line 69 "dgn_comp.y" - int i; - char* str; - - + int i; + char *str; /* Line 1676 of yacc.c */ #line 105 "y.tab.h" } YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 +#define YYSTYPE_IS_TRIVIAL 1 +#define yystype YYSTYPE /* obsolescent; will be withdrawn */ +#define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; - - diff --git a/sys/share/lev_comp.h b/sys/share/lev_comp.h index b0c5cafaf..80f63652a 100644 --- a/sys/share/lev_comp.h +++ b/sys/share/lev_comp.h @@ -2,20 +2,20 @@ /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -28,192 +28,191 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - CHAR = 258, - INTEGER = 259, - BOOLEAN = 260, - PERCENT = 261, - SPERCENT = 262, - MINUS_INTEGER = 263, - PLUS_INTEGER = 264, - MAZE_GRID_ID = 265, - SOLID_FILL_ID = 266, - MINES_ID = 267, - ROGUELEV_ID = 268, - MESSAGE_ID = 269, - MAZE_ID = 270, - LEVEL_ID = 271, - LEV_INIT_ID = 272, - GEOMETRY_ID = 273, - NOMAP_ID = 274, - OBJECT_ID = 275, - COBJECT_ID = 276, - MONSTER_ID = 277, - TRAP_ID = 278, - DOOR_ID = 279, - DRAWBRIDGE_ID = 280, - object_ID = 281, - monster_ID = 282, - terrain_ID = 283, - MAZEWALK_ID = 284, - WALLIFY_ID = 285, - REGION_ID = 286, - FILLING = 287, - IRREGULAR = 288, - JOINED = 289, - ALTAR_ID = 290, - LADDER_ID = 291, - STAIR_ID = 292, - NON_DIGGABLE_ID = 293, - NON_PASSWALL_ID = 294, - ROOM_ID = 295, - PORTAL_ID = 296, - TELEPRT_ID = 297, - BRANCH_ID = 298, - LEV = 299, - MINERALIZE_ID = 300, - CORRIDOR_ID = 301, - GOLD_ID = 302, - ENGRAVING_ID = 303, - FOUNTAIN_ID = 304, - POOL_ID = 305, - SINK_ID = 306, - NONE = 307, - RAND_CORRIDOR_ID = 308, - DOOR_STATE = 309, - LIGHT_STATE = 310, - CURSE_TYPE = 311, - ENGRAVING_TYPE = 312, - DIRECTION = 313, - RANDOM_TYPE = 314, - RANDOM_TYPE_BRACKET = 315, - A_REGISTER = 316, - ALIGNMENT = 317, - LEFT_OR_RIGHT = 318, - CENTER = 319, - TOP_OR_BOT = 320, - ALTAR_TYPE = 321, - UP_OR_DOWN = 322, - SUBROOM_ID = 323, - NAME_ID = 324, - FLAGS_ID = 325, - FLAG_TYPE = 326, - MON_ATTITUDE = 327, - MON_ALERTNESS = 328, - MON_APPEARANCE = 329, - ROOMDOOR_ID = 330, - IF_ID = 331, - ELSE_ID = 332, - TERRAIN_ID = 333, - HORIZ_OR_VERT = 334, - REPLACE_TERRAIN_ID = 335, - EXIT_ID = 336, - SHUFFLE_ID = 337, - QUANTITY_ID = 338, - BURIED_ID = 339, - LOOP_ID = 340, - FOR_ID = 341, - TO_ID = 342, - SWITCH_ID = 343, - CASE_ID = 344, - BREAK_ID = 345, - DEFAULT_ID = 346, - ERODED_ID = 347, - TRAPPED_ID = 348, - RECHARGED_ID = 349, - INVIS_ID = 350, - GREASED_ID = 351, - FEMALE_ID = 352, - CANCELLED_ID = 353, - REVIVED_ID = 354, - AVENGE_ID = 355, - FLEEING_ID = 356, - BLINDED_ID = 357, - PARALYZED_ID = 358, - STUNNED_ID = 359, - CONFUSED_ID = 360, - SEENTRAPS_ID = 361, - ALL_ID = 362, - MONTYPE_ID = 363, - GRAVE_ID = 364, - ERODEPROOF_ID = 365, - FUNCTION_ID = 366, - MSG_OUTPUT_TYPE = 367, - COMPARE_TYPE = 368, - UNKNOWN_TYPE = 369, - rect_ID = 370, - fillrect_ID = 371, - line_ID = 372, - randline_ID = 373, - grow_ID = 374, - selection_ID = 375, - flood_ID = 376, - rndcoord_ID = 377, - circle_ID = 378, - ellipse_ID = 379, - filter_ID = 380, - complement_ID = 381, - gradient_ID = 382, - GRADIENT_TYPE = 383, - LIMITED = 384, - HUMIDITY_TYPE = 385, - STRING = 386, - MAP_ID = 387, - NQSTRING = 388, - VARSTRING = 389, - CFUNC = 390, - CFUNC_INT = 391, - CFUNC_STR = 392, - CFUNC_COORD = 393, - CFUNC_REGION = 394, - VARSTRING_INT = 395, - VARSTRING_INT_ARRAY = 396, - VARSTRING_STRING = 397, - VARSTRING_STRING_ARRAY = 398, - VARSTRING_VAR = 399, - VARSTRING_VAR_ARRAY = 400, - VARSTRING_COORD = 401, - VARSTRING_COORD_ARRAY = 402, - VARSTRING_REGION = 403, - VARSTRING_REGION_ARRAY = 404, - VARSTRING_MAPCHAR = 405, - VARSTRING_MAPCHAR_ARRAY = 406, - VARSTRING_MONST = 407, - VARSTRING_MONST_ARRAY = 408, - VARSTRING_OBJ = 409, - VARSTRING_OBJ_ARRAY = 410, - VARSTRING_SEL = 411, - VARSTRING_SEL_ARRAY = 412, - METHOD_INT = 413, - METHOD_INT_ARRAY = 414, - METHOD_STRING = 415, - METHOD_STRING_ARRAY = 416, - METHOD_VAR = 417, - METHOD_VAR_ARRAY = 418, - METHOD_COORD = 419, - METHOD_COORD_ARRAY = 420, - METHOD_REGION = 421, - METHOD_REGION_ARRAY = 422, - METHOD_MAPCHAR = 423, - METHOD_MAPCHAR_ARRAY = 424, - METHOD_MONST = 425, - METHOD_MONST_ARRAY = 426, - METHOD_OBJ = 427, - METHOD_OBJ_ARRAY = 428, - METHOD_SEL = 429, - METHOD_SEL_ARRAY = 430, - DICE = 431 - }; +#define YYTOKENTYPE +/* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ +enum yytokentype { + CHAR = 258, + INTEGER = 259, + BOOLEAN = 260, + PERCENT = 261, + SPERCENT = 262, + MINUS_INTEGER = 263, + PLUS_INTEGER = 264, + MAZE_GRID_ID = 265, + SOLID_FILL_ID = 266, + MINES_ID = 267, + ROGUELEV_ID = 268, + MESSAGE_ID = 269, + MAZE_ID = 270, + LEVEL_ID = 271, + LEV_INIT_ID = 272, + GEOMETRY_ID = 273, + NOMAP_ID = 274, + OBJECT_ID = 275, + COBJECT_ID = 276, + MONSTER_ID = 277, + TRAP_ID = 278, + DOOR_ID = 279, + DRAWBRIDGE_ID = 280, + object_ID = 281, + monster_ID = 282, + terrain_ID = 283, + MAZEWALK_ID = 284, + WALLIFY_ID = 285, + REGION_ID = 286, + FILLING = 287, + IRREGULAR = 288, + JOINED = 289, + ALTAR_ID = 290, + LADDER_ID = 291, + STAIR_ID = 292, + NON_DIGGABLE_ID = 293, + NON_PASSWALL_ID = 294, + ROOM_ID = 295, + PORTAL_ID = 296, + TELEPRT_ID = 297, + BRANCH_ID = 298, + LEV = 299, + MINERALIZE_ID = 300, + CORRIDOR_ID = 301, + GOLD_ID = 302, + ENGRAVING_ID = 303, + FOUNTAIN_ID = 304, + POOL_ID = 305, + SINK_ID = 306, + NONE = 307, + RAND_CORRIDOR_ID = 308, + DOOR_STATE = 309, + LIGHT_STATE = 310, + CURSE_TYPE = 311, + ENGRAVING_TYPE = 312, + DIRECTION = 313, + RANDOM_TYPE = 314, + RANDOM_TYPE_BRACKET = 315, + A_REGISTER = 316, + ALIGNMENT = 317, + LEFT_OR_RIGHT = 318, + CENTER = 319, + TOP_OR_BOT = 320, + ALTAR_TYPE = 321, + UP_OR_DOWN = 322, + SUBROOM_ID = 323, + NAME_ID = 324, + FLAGS_ID = 325, + FLAG_TYPE = 326, + MON_ATTITUDE = 327, + MON_ALERTNESS = 328, + MON_APPEARANCE = 329, + ROOMDOOR_ID = 330, + IF_ID = 331, + ELSE_ID = 332, + TERRAIN_ID = 333, + HORIZ_OR_VERT = 334, + REPLACE_TERRAIN_ID = 335, + EXIT_ID = 336, + SHUFFLE_ID = 337, + QUANTITY_ID = 338, + BURIED_ID = 339, + LOOP_ID = 340, + FOR_ID = 341, + TO_ID = 342, + SWITCH_ID = 343, + CASE_ID = 344, + BREAK_ID = 345, + DEFAULT_ID = 346, + ERODED_ID = 347, + TRAPPED_ID = 348, + RECHARGED_ID = 349, + INVIS_ID = 350, + GREASED_ID = 351, + FEMALE_ID = 352, + CANCELLED_ID = 353, + REVIVED_ID = 354, + AVENGE_ID = 355, + FLEEING_ID = 356, + BLINDED_ID = 357, + PARALYZED_ID = 358, + STUNNED_ID = 359, + CONFUSED_ID = 360, + SEENTRAPS_ID = 361, + ALL_ID = 362, + MONTYPE_ID = 363, + GRAVE_ID = 364, + ERODEPROOF_ID = 365, + FUNCTION_ID = 366, + MSG_OUTPUT_TYPE = 367, + COMPARE_TYPE = 368, + UNKNOWN_TYPE = 369, + rect_ID = 370, + fillrect_ID = 371, + line_ID = 372, + randline_ID = 373, + grow_ID = 374, + selection_ID = 375, + flood_ID = 376, + rndcoord_ID = 377, + circle_ID = 378, + ellipse_ID = 379, + filter_ID = 380, + complement_ID = 381, + gradient_ID = 382, + GRADIENT_TYPE = 383, + LIMITED = 384, + HUMIDITY_TYPE = 385, + STRING = 386, + MAP_ID = 387, + NQSTRING = 388, + VARSTRING = 389, + CFUNC = 390, + CFUNC_INT = 391, + CFUNC_STR = 392, + CFUNC_COORD = 393, + CFUNC_REGION = 394, + VARSTRING_INT = 395, + VARSTRING_INT_ARRAY = 396, + VARSTRING_STRING = 397, + VARSTRING_STRING_ARRAY = 398, + VARSTRING_VAR = 399, + VARSTRING_VAR_ARRAY = 400, + VARSTRING_COORD = 401, + VARSTRING_COORD_ARRAY = 402, + VARSTRING_REGION = 403, + VARSTRING_REGION_ARRAY = 404, + VARSTRING_MAPCHAR = 405, + VARSTRING_MAPCHAR_ARRAY = 406, + VARSTRING_MONST = 407, + VARSTRING_MONST_ARRAY = 408, + VARSTRING_OBJ = 409, + VARSTRING_OBJ_ARRAY = 410, + VARSTRING_SEL = 411, + VARSTRING_SEL_ARRAY = 412, + METHOD_INT = 413, + METHOD_INT_ARRAY = 414, + METHOD_STRING = 415, + METHOD_STRING_ARRAY = 416, + METHOD_VAR = 417, + METHOD_VAR_ARRAY = 418, + METHOD_COORD = 419, + METHOD_COORD_ARRAY = 420, + METHOD_REGION = 421, + METHOD_REGION_ARRAY = 422, + METHOD_MAPCHAR = 423, + METHOD_MAPCHAR_ARRAY = 424, + METHOD_MONST = 425, + METHOD_MONST_ARRAY = 426, + METHOD_OBJ = 427, + METHOD_OBJ_ARRAY = 428, + METHOD_SEL = 429, + METHOD_SEL_ARRAY = 430, + DICE = 431 +}; #endif /* Tokens. */ #define CHAR 258 @@ -391,61 +390,52 @@ #define METHOD_SEL_ARRAY 430 #define DICE 431 - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - +#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE { /* Line 1676 of yacc.c */ #line 149 "lev_comp.y" - long i; - char* map; - struct { - long room; - long wall; - long door; - } corpos; + long i; + char *map; struct { - long area; - long x1; - long y1; - long x2; - long y2; + long room; + long wall; + long door; + } corpos; + struct { + long area; + long x1; + long y1; + long x2; + long y2; } lregn; struct { - long x; - long y; + long x; + long y; } crd; struct { - long ter; - long lit; + long ter; + long lit; } terr; struct { - long height; - long width; + long height; + long width; } sze; struct { - long die; - long num; + long die; + long num; } dice; struct { - long cfunc; - char *varstr; + long cfunc; + char *varstr; } meth; - - /* Line 1676 of yacc.c */ #line 443 "y.tab.h" } YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 +#define YYSTYPE_IS_TRIVIAL 1 +#define yystype YYSTYPE /* obsolescent; will be withdrawn */ +#define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; - - diff --git a/sys/vms/lev_lex.h b/sys/vms/lev_lex.h index 43ea96777..f59f43c2e 100644 --- a/sys/vms/lev_lex.h +++ b/sys/vms/lev_lex.h @@ -18,10 +18,10 @@ #include #ifdef stdin -# undef stdin +#undef stdin #endif -#define stdin 0 +#define stdin 0 #ifdef stdout -# undef stdout +#undef stdout #endif #define stdout 0 diff --git a/sys/wince/ceinc/assert.h b/sys/wince/ceinc/assert.h index 8844d2a39..1c18ba66a 100644 --- a/sys/wince/ceinc/assert.h +++ b/sys/wince/ceinc/assert.h @@ -3,14 +3,15 @@ * ****/ -#undef assert +#undef assert -#ifdef NDEBUG +#ifdef NDEBUG -#define assert(exp) ((void)0) +#define assert(exp) ((void) 0) #else -#define assert(exp) (void)( (exp) || (panic("%s at %s line %ld", #exp, __FILE__,__LINE__), 1) ) +#define assert(exp) \ + (void)((exp) || (panic("%s at %s line %ld", #exp, __FILE__, __LINE__), 1)) -#endif /* NDEBUG */ +#endif /* NDEBUG */ diff --git a/sys/wince/ceinc/errno.h b/sys/wince/ceinc/errno.h index c6c3193a8..6645e2bb9 100644 --- a/sys/wince/ceinc/errno.h +++ b/sys/wince/ceinc/errno.h @@ -1,4 +1,3 @@ /* empty file */ extern int errno; - diff --git a/sys/wince/ceinc/fcntl.h b/sys/wince/ceinc/fcntl.h index a9136c8b4..0b1524b2b 100644 --- a/sys/wince/ceinc/fcntl.h +++ b/sys/wince/ceinc/fcntl.h @@ -13,55 +13,55 @@ #ifndef _INC_FCNTL #define _INC_FCNTL -#define _O_RDONLY 0x0000 /* open for reading only */ -#define _O_WRONLY 0x0001 /* open for writing only */ -#define _O_RDWR 0x0002 /* open for reading and writing */ -#define _O_APPEND 0x0008 /* writes done at eof */ +#define _O_RDONLY 0x0000 /* open for reading only */ +#define _O_WRONLY 0x0001 /* open for writing only */ +#define _O_RDWR 0x0002 /* open for reading and writing */ +#define _O_APPEND 0x0008 /* writes done at eof */ -#define _O_CREAT 0x0100 /* create and open file */ -#define _O_TRUNC 0x0200 /* open and truncate */ -#define _O_EXCL 0x0400 /* open only if file doesn't already exist */ +#define _O_CREAT 0x0100 /* create and open file */ +#define _O_TRUNC 0x0200 /* open and truncate */ +#define _O_EXCL 0x0400 /* open only if file doesn't already exist */ /* O_TEXT files have sequences translated to on read()'s, ** and sequences translated to on write()'s */ -#define _O_TEXT 0x4000 /* file mode is text (translated) */ -#define _O_BINARY 0x8000 /* file mode is binary (untranslated) */ +#define _O_TEXT 0x4000 /* file mode is text (translated) */ +#define _O_BINARY 0x8000 /* file mode is binary (untranslated) */ /* macro to translate the C 2.0 name used to force binary mode for files */ -#define _O_RAW _O_BINARY +#define _O_RAW _O_BINARY /* Open handle inherit bit */ -#define _O_NOINHERIT 0x0080 /* child process doesn't inherit file */ +#define _O_NOINHERIT 0x0080 /* child process doesn't inherit file */ /* Temporary file bit - file is deleted when last handle is closed */ -#define _O_TEMPORARY 0x0040 /* temporary file bit */ +#define _O_TEMPORARY 0x0040 /* temporary file bit */ /* sequential/random access hints */ -#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */ -#define _O_RANDOM 0x0010 /* file access is primarily random */ +#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */ +#define _O_RANDOM 0x0010 /* file access is primarily random */ -#if !__STDC__ || defined(_POSIX_) +#if !__STDC__ || defined(_POSIX_) /* Non-ANSI names for compatibility */ -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_EXCL _O_EXCL -#define O_TEXT _O_TEXT -#define O_BINARY _O_BINARY -#define O_RAW _O_BINARY -#define O_TEMPORARY _O_TEMPORARY -#define O_NOINHERIT _O_NOINHERIT -#define O_SEQUENTIAL _O_SEQUENTIAL -#define O_RANDOM _O_RANDOM -#endif /* __STDC__ */ +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_RAW _O_BINARY +#define O_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT +#define O_SEQUENTIAL _O_SEQUENTIAL +#define O_RANDOM _O_RANDOM +#endif /* __STDC__ */ -#endif /* _INC_FCNTL */ +#endif /* _INC_FCNTL */ diff --git a/sys/wince/ceinc/sys/stat.h b/sys/wince/ceinc/sys/stat.h index dbb39b699..fa882cb5b 100644 --- a/sys/wince/ceinc/sys/stat.h +++ b/sys/wince/ceinc/sys/stat.h @@ -1,2 +1 @@ /* empty file */ - diff --git a/sys/wince/mhaskyn.h b/sys/wince/mhaskyn.h index dbf0285ae..4127d99a5 100644 --- a/sys/wince/mhaskyn.h +++ b/sys/wince/mhaskyn.h @@ -9,6 +9,6 @@ #include "winMS.h" -int mswin_yes_no_dialog( const char *question, const char *choices, int def); +int mswin_yes_no_dialog(const char *question, const char *choices, int def); #endif /* MSWINAskYesNO_h */ diff --git a/sys/wince/mhcmd.h b/sys/wince/mhcmd.h index 87f4f4b22..feaf605ce 100644 --- a/sys/wince/mhcmd.h +++ b/sys/wince/mhcmd.h @@ -7,19 +7,19 @@ #include "config.h" #include "global.h" -HWND mswin_init_command_window (); +HWND mswin_init_command_window(); -/* if either sz->cx or sz->cy are already set this function will - no modify it. It will adjust them to the minimum size +/* if either sz->cx or sz->cy are already set this function will + no modify it. It will adjust them to the minimum size required by the command window */ -void mswin_command_window_size (HWND hwnd, LPSIZE sz); +void mswin_command_window_size(HWND hwnd, LPSIZE sz); #if defined(WIN_CE_SMARTPHONE) /* special keypad input handling for SmartPhone */ -BOOL NHSPhoneTranslateKbdMessage(WPARAM wParam, LPARAM lParam, BOOL keyDown); -void NHSPhoneSetKeypadFromString(const char* str); -void NHSPhoneSetKeypadDirection(); -void NHSPhoneSetKeypadDefault(); +BOOL NHSPhoneTranslateKbdMessage(WPARAM wParam, LPARAM lParam, BOOL keyDown); +void NHSPhoneSetKeypadFromString(const char *str); +void NHSPhoneSetKeypadDirection(); +void NHSPhoneSetKeypadDefault(); #endif #endif /* MSWINCMDWindow_h */ diff --git a/sys/wince/mhdlg.h b/sys/wince/mhdlg.h index 03cfa3bcd..afa4e53e5 100644 --- a/sys/wince/mhdlg.h +++ b/sys/wince/mhdlg.h @@ -11,8 +11,9 @@ #include "config.h" #include "global.h" -int mswin_getlin_window (const char *question, char *result, size_t result_size); -int mswin_ext_cmd_window (int* selection); -int mswin_player_selection_window(int* selection); +int mswin_getlin_window(const char *question, char *result, + size_t result_size); +int mswin_ext_cmd_window(int *selection); +int mswin_player_selection_window(int *selection); #endif /* MSWINDlgWindow_h */ diff --git a/sys/wince/mhinput.h b/sys/wince/mhinput.h index 64f4aef34..b4f723f75 100644 --- a/sys/wince/mhinput.h +++ b/sys/wince/mhinput.h @@ -10,30 +10,43 @@ /* nethack input queue - store/extract input events */ #include "winMS.h" -#define NHEVENT_CHAR 1 -#define NHEVENT_MOUSE 2 +#define NHEVENT_CHAR 1 +#define NHEVENT_MOUSE 2 typedef struct mswin_event { - int type; - union { - struct { - int ch; - } kbd; - - struct { - int mod; - int x, y; - } ms; - }; + int type; + union { + struct { + int ch; + } kbd; + + struct { + int mod; + int x, y; + } ms; + }; } MSNHEvent, *PMSNHEvent; -#define NHEVENT_KBD(c) { MSNHEvent e; e.type=NHEVENT_CHAR; e.kbd.ch=(c); mswin_input_push(&e); } -#define NHEVENT_MS(_mod, _x, _y) { MSNHEvent e; e.type=NHEVENT_MOUSE; e.ms.mod = (_mod); e.ms.x=(_x); e.ms.y=(_y); mswin_input_push(&e); } - -void mswin_nh_input_init(); -int mswin_have_input(); -void mswin_input_push(PMSNHEvent event); -PMSNHEvent mswin_input_pop(); -PMSNHEvent mswin_input_peek(); +#define NHEVENT_KBD(c) \ + { \ + MSNHEvent e; \ + e.type = NHEVENT_CHAR; \ + e.kbd.ch = (c); \ + mswin_input_push(&e); \ + } +#define NHEVENT_MS(_mod, _x, _y) \ + { \ + MSNHEvent e; \ + e.type = NHEVENT_MOUSE; \ + e.ms.mod = (_mod); \ + e.ms.x = (_x); \ + e.ms.y = (_y); \ + mswin_input_push(&e); \ + } + +void mswin_nh_input_init(); +int mswin_have_input(); +void mswin_input_push(PMSNHEvent event); +PMSNHEvent mswin_input_pop(); +PMSNHEvent mswin_input_peek(); #endif /* MSWINInput_h */ - diff --git a/sys/wince/mhmain.h b/sys/wince/mhmain.h index fea0b25e5..6f69e263e 100644 --- a/sys/wince/mhmain.h +++ b/sys/wince/mhmain.h @@ -12,9 +12,8 @@ #include "winMS.h" extern TCHAR szMainWindowClass[]; -HWND mswin_init_main_window (); +HWND mswin_init_main_window(); void mswin_layout_main_window(HWND changed_child); void mswin_select_map_mode(int map_mode); #endif /* MSWINMainWindow_h */ - diff --git a/sys/wince/mhmap.h b/sys/wince/mhmap.h index f140e8c85..626100057 100644 --- a/sys/wince/mhmap.h +++ b/sys/wince/mhmap.h @@ -10,15 +10,14 @@ #include "config.h" #include "global.h" - -HWND mswin_init_map_window (void); +HWND mswin_init_map_window(void); void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw); int mswin_map_mode(HWND hWnd, int mode); -void mswin_map_get_cursor(HWND hWnd, int* x, int* y); +void mswin_map_get_cursor(HWND hWnd, int *x, int *y); -#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16 +#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16 -#define DEF_CLIPAROUND_MARGIN 5 -#define DEF_CLIPAROUND_AMOUNT 1 +#define DEF_CLIPAROUND_MARGIN 5 +#define DEF_CLIPAROUND_AMOUNT 1 #endif /* MSWINMapWindow_h */ diff --git a/sys/wince/mhmenu.h b/sys/wince/mhmenu.h index e1ec643f5..7ef5bee06 100644 --- a/sys/wince/mhmenu.h +++ b/sys/wince/mhmenu.h @@ -11,11 +11,11 @@ #include "config.h" #include "global.h" -#define MENU_TYPE_TEXT 1 -#define MENU_TYPE_MENU 2 +#define MENU_TYPE_TEXT 1 +#define MENU_TYPE_MENU 2 -HWND mswin_init_menu_window ( int type ); -int mswin_menu_window_select_menu (HWND hwnd, int how, MENU_ITEM_P **); -void mswin_menu_window_size (HWND hwnd, LPSIZE sz); +HWND mswin_init_menu_window(int type); +int mswin_menu_window_select_menu(HWND hwnd, int how, MENU_ITEM_P **); +void mswin_menu_window_size(HWND hwnd, LPSIZE sz); #endif /* MSWINTextWindow_h */ diff --git a/sys/wince/mhmsg.h b/sys/wince/mhmsg.h index 22312c116..716294338 100644 --- a/sys/wince/mhmsg.h +++ b/sys/wince/mhmsg.h @@ -8,56 +8,56 @@ #define MHNethackMessages_H /* nethack messages */ -#define WM_MSNH_COMMAND (WM_APP+1) - -#define MSNH_MSG_ADDWND 100 -#define MSNH_MSG_PUTSTR 101 -#define MSNH_MSG_PRINT_GLYPH 102 -#define MSNH_MSG_CLEAR_WINDOW 103 -#define MSNH_MSG_CLIPAROUND 104 -#define MSNH_MSG_STARTMENU 105 -#define MSNH_MSG_ADDMENU 106 -#define MSNH_MSG_CURSOR 107 -#define MSNH_MSG_ENDMENU 108 +#define WM_MSNH_COMMAND (WM_APP + 1) + +#define MSNH_MSG_ADDWND 100 +#define MSNH_MSG_PUTSTR 101 +#define MSNH_MSG_PRINT_GLYPH 102 +#define MSNH_MSG_CLEAR_WINDOW 103 +#define MSNH_MSG_CLIPAROUND 104 +#define MSNH_MSG_STARTMENU 105 +#define MSNH_MSG_ADDMENU 106 +#define MSNH_MSG_CURSOR 107 +#define MSNH_MSG_ENDMENU 108 typedef struct mswin_nhmsg_add_wnd { - winid wid; + winid wid; } MSNHMsgAddWnd, *PMSNHMsgAddWnd; typedef struct mswin_nhmsg_putstr { - int attr; - const char* text; - boolean append; + int attr; + const char *text; + boolean append; } MSNHMsgPutstr, *PMSNHMsgPutstr; typedef struct mswin_nhmsg_print_glyph { - XCHAR_P x; - XCHAR_P y; - int glyph; + XCHAR_P x; + XCHAR_P y; + int glyph; } MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph; typedef struct mswin_nhmsg_cliparound { - int x; - int y; + int x; + int y; } MSNHMsgClipAround, *PMSNHMsgClipAround; typedef struct mswin_nhmsg_add_menu { - int glyph; - const ANY_P* identifier; - CHAR_P accelerator; - CHAR_P group_accel; - int attr; - const char * str; - BOOLEAN_P presel; + int glyph; + const ANY_P *identifier; + CHAR_P accelerator; + CHAR_P group_accel; + int attr; + const char *str; + BOOLEAN_P presel; } MSNHMsgAddMenu, *PMSNHMsgAddMenu; typedef struct mswin_nhmsg_cursor { - int x; - int y; + int x; + int y; } MSNHMsgCursor, *PMSNHMsgCursor; typedef struct mswin_nhmsg_end_menu { - const char* text; + const char *text; } MSNHMsgEndMenu, *PMSNHMsgEndMenu; #endif diff --git a/sys/wince/mhmsgwnd.h b/sys/wince/mhmsgwnd.h index 883194cc2..628c44217 100644 --- a/sys/wince/mhmsgwnd.h +++ b/sys/wince/mhmsgwnd.h @@ -11,8 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_message_window (); -void mswin_message_window_size (HWND hWnd, LPSIZE sz); - +HWND mswin_init_message_window(); +void mswin_message_window_size(HWND hWnd, LPSIZE sz); #endif /* MSWINMessageWindow_h */ diff --git a/sys/wince/mhrip.h b/sys/wince/mhrip.h index b65b25b16..d97422d42 100644 --- a/sys/wince/mhrip.h +++ b/sys/wince/mhrip.h @@ -11,8 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_RIP_window (); -void mswin_display_RIP_window (HWND hwnd); +HWND mswin_init_RIP_window(); +void mswin_display_RIP_window(HWND hwnd); #endif /* MSWINRIPWindow_h */ - diff --git a/sys/wince/mhstatus.h b/sys/wince/mhstatus.h index 2258b91dd..b55da83cb 100644 --- a/sys/wince/mhstatus.h +++ b/sys/wince/mhstatus.h @@ -11,7 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_status_window (); -void mswin_status_window_size (HWND hWnd, LPSIZE sz); +HWND mswin_init_status_window(); +void mswin_status_window_size(HWND hWnd, LPSIZE sz); #endif /* MSWINStatusWindow_h */ diff --git a/sys/wince/mhtext.h b/sys/wince/mhtext.h index 568b39684..183d59937 100644 --- a/sys/wince/mhtext.h +++ b/sys/wince/mhtext.h @@ -11,7 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_text_window (); -void mswin_display_text_window (HWND hwnd); +HWND mswin_init_text_window(); +void mswin_display_text_window(HWND hwnd); #endif /* MSWINTextWindow_h */ diff --git a/sys/wince/mhtxtbuf.h b/sys/wince/mhtxtbuf.h index 4be3537b9..ac31e1e6a 100644 --- a/sys/wince/mhtxtbuf.h +++ b/sys/wince/mhtxtbuf.h @@ -8,10 +8,10 @@ #include "winMS.h" -typedef struct mswin_nethack_text_buffer* PNHTextBuffer; +typedef struct mswin_nethack_text_buffer *PNHTextBuffer; PNHTextBuffer mswin_init_text_buffer(BOOL wrap_text); void mswin_free_text_buffer(PNHTextBuffer pb); -void mswin_add_text(PNHTextBuffer pb, int attr, const char* text); +void mswin_add_text(PNHTextBuffer pb, int attr, const char *text); void mswin_set_text_wrap(PNHTextBuffer pb, BOOL wrap_text); BOOL mswin_get_text_wrap(PNHTextBuffer pb); void mswin_render_text(PNHTextBuffer pb, HWND edit_control); diff --git a/sys/wince/newres.h b/sys/wince/newres.h index fa66dcbb6..420dfec2d 100644 --- a/sys/wince/newres.h +++ b/sys/wince/newres.h @@ -2,39 +2,38 @@ #define __NEWRES_H__ #if !defined(UNDER_CE) - #define UNDER_CE _WIN32_WCE +#define UNDER_CE _WIN32_WCE #endif #if defined(_WIN32_WCE) - #if !defined(WCEOLE_ENABLE_DIALOGEX) - #define DIALOGEX DIALOG DISCARDABLE - #endif - #include - #define SHMENUBAR RCDATA - #if (defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) && (_WIN32_WCE >= 300) - #include - #else - #define I_IMAGENONE (-2) - #define NOMENU 0xFFFF - #define IDS_SHNEW 1 - - #define IDM_SHAREDNEW 10 - #define IDM_SHAREDNEWDEFAULT 11 - #endif +#if !defined(WCEOLE_ENABLE_DIALOGEX) +#define DIALOGEX DIALOG DISCARDABLE +#endif +#include +#define SHMENUBAR RCDATA +#if (defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) \ + && (_WIN32_WCE >= 300) +#include +#else +#define I_IMAGENONE (-2) +#define NOMENU 0xFFFF +#define IDS_SHNEW 1 + +#define IDM_SHAREDNEW 10 +#define IDM_SHAREDNEWDEFAULT 11 +#endif #endif // _WIN32_WCE - #ifdef RC_INVOKED #ifndef _INC_WINDOWS #define _INC_WINDOWS - #include "winuser.h" // extract from windows header +#include "winuser.h" // extract from windows header #endif #endif #ifdef IDC_STATIC #undef IDC_STATIC #endif -#define IDC_STATIC (-1) +#define IDC_STATIC (-1) #endif //__NEWRES_H__ - diff --git a/sys/wince/resource.h b/sys/wince/resource.h index 25c7179f3..d214c9866 100644 --- a/sys/wince/resource.h +++ b/sys/wince/resource.h @@ -2,163 +2,163 @@ // Microsoft Developer Studio generated include file. // Used by winhcksp.rc // -#define IDC_MYICON 2 -#define IDD_WINHACK_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDS_APP_TITLE 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDS_HELLO 106 -#define IDI_WINHACK 107 -#define IDC_WINHACK 109 -#define IDC_SPHONE_DIALOGBAR 111 -#define IDC_SPHONE_TEXTDIALOGBAR 112 -#define IDR_MAINFRAME 128 -#define IDB_TILES 129 -#define IDD_TEXT 130 -#define IDD_NHTEXT 130 -#define IDD_MENU 132 -#define IDB_MENU_SEL 133 -#define IDB_MENU_UNSEL 134 -#define IDD_COMMANDS 136 -#define IDD_GETLIN 138 -#define IDD_EXTCMD 139 -#define IDD_PLAYER_SELECTOR 141 -#define IDB_PETMARK 145 -#define IDB_MENU_SEL_COUNT 146 -#define IDB_KEYPAD 147 -#define IDB_MENUBAR 154 -#define IDC_TEXT_VIEW 1001 -#define IDC_CMD_MOVE_NW 1001 -#define IDC_CMD_MOVE_N 1002 -#define IDC_MENU_LIST 1003 -#define IDC_CMD_MOVE_NE 1003 -#define IDC_MENU_TEXT 1004 -#define IDC_CMD_MOVE_W 1004 -#define IDC_CMD_MOVE_SELF 1005 -#define IDC_CMD_MOVE_E 1006 -#define IDC_CMD_MOVE_SW 1007 -#define IDC_CMD_MOVE_S 1008 -#define IDC_CMD_MOVE_SE 1009 -#define IDC_CMD_MOVE_UP 1010 -#define IDC_CMD_MOVE_DOWN 1011 -#define IDC_CMD_5 1012 -#define IDC_CMD_A 1013 -#define IDC_CMD_B 1014 -#define IDC_CMD_C 1015 -#define IDC_CMD_D 1016 -#define IDC_CMD_E 1017 -#define IDC_CMD_F 1018 -#define IDC_CMD_G 1019 -#define IDC_CMD_H 1020 -#define IDC_CMD_I 1021 -#define IDC_CMD_J 1022 -#define IDC_CMD_K 1023 -#define IDC_CMD_L 1024 -#define IDC_CMD_M 1025 -#define IDC_CMD_N 1026 -#define IDC_CMD_O 1027 -#define IDC_CMD_P 1028 -#define IDC_CMD_Q 1029 -#define IDC_CMD_R 1030 -#define IDC_CMD_S 1031 -#define IDC_CMD_T 1032 -#define IDC_CMD_U 1033 -#define IDC_CMD_V 1034 -#define IDC_CMD_W 1035 -#define IDC_CMD_X 1036 -#define IDC_CMD_Y 1037 -#define IDC_CMD_Z 1038 -#define IDC_CMD_AA 1039 -#define IDC_CMD_BB 1040 -#define IDC_CMD_CC 1041 -#define IDC_CMD_DD 1042 -#define IDC_CMD_EE 1043 -#define IDC_CMD_FF 1044 -#define IDC_CMD_GG 1045 -#define IDC_CMD_HH 1046 -#define IDC_CMD_II 1047 -#define IDC_CMD_JJ 1048 -#define IDC_CMD_KK 1049 -#define IDC_CMD_LL 1050 -#define IDC_CMD_MM 1051 -#define IDC_CMD_NN 1052 -#define IDC_CMD_OO 1053 -#define IDC_CMD_PP 1054 -#define IDC_CMD_QQ 1055 -#define IDC_CMD_RR 1056 -#define IDC_CMD_SS 1057 -#define IDC_CMD_TT 1058 -#define IDC_CMD_UU 1059 -#define IDC_CMD_VV 1060 -#define IDC_CMD_WW 1061 -#define IDC_CMD_XX 1062 -#define IDC_CMD_YY 1063 -#define IDC_CMD_ZZ 1064 -#define IDC_CMD_FIRST 1100 -#define IDC_CMD_LAST 1300 -#define IDC_GETLIN_EDIT 1309 -#define IDC_EXTCMD_LIST 1310 -#define IDC_PLSEL_NAME 1314 -#define IDC_PLSEL_ROLE_RANDOM 1315 -#define IDC_PLSEL_RACE_RANDOM 1318 -#define IDC_PLSEL_GENDER_RANDOM 1319 -#define IDC_PLSEL_ALIGN_RANDOM 1320 -#define IDC_PLSEL_ROLE_LIST 1323 -#define IDC_PLSEL_RACE_LIST 1324 -#define IDC_PLSEL_ALIGN_LIST 1325 -#define IDC_PLSEL_GENDER_LIST 1326 -#define IDC_ABOUT_VERSION 1327 -#define IDC_TEXT_CONTROL 1331 -#define IDC_ABOUT_COPYRIGHT 1332 -#define IDC_TEXT_TOGGLE_WRAP 1333 -#define IDM_SAVE 32771 -#define IDM_HELP_LONG 32772 -#define IDM_HELP_COMMANDS 32773 -#define IDM_HELP_HISTORY 32774 -#define IDM_HELP_INFO_CHAR 32775 -#define IDM_HELP_INFO_KEY 32776 -#define IDM_HELP_OPTIONS 32777 -#define IDM_HELP_OPTIONS_LONG 32778 -#define IDM_HELP_EXTCMD 32779 -#define IDM_HELP_LICENSE 32780 -#define IDM_MAP_TILES 32781 -#define IDM_MAP_ASCII4X6 32782 -#define IDM_MAP_ASCII6X8 32783 -#define IDM_MAP_ASCII8X8 32784 -#define IDM_MAP_ASCII16X8 32785 -#define IDM_MAP_ASCII7X12 32786 -#define IDM_MAP_ASCII8X12 32787 -#define IDM_MAP_ASCII16X12 32788 -#define IDM_MAP_ASCII12X16 32789 -#define IDM_MAP_ASCII10X18 32790 -#define IDM_MAP_FIT_TO_SCREEN 32791 -#define ID_FILE 32792 -#define IDS_CAP_FILE 32793 -#define ID_HELP 32794 -#define IDS_CAP_HELP 32795 -#define IDS_CAP_TEMP 32796 -#define ID_MAP 32797 -#define IDS_CAP_AMP 32798 -#define IDS_CAP_MAP 32799 -#define IDM_VIEW_KEYPAD 32800 -#define ID_VIEW 32801 -#define IDS_CAP_VIEW 32802 -#define IDS_CAP_ENTIREMAP 32826 -#define IDS_CAP_NORMALMAP 32827 -#define IDM_HELP_MENU 32828 -#define IDM_VIEW_OPTIONS 32829 -#define IDM_DIRECT_COMMAND 32830 -#define IDS_TEXT_WRAP 32831 -#define IDS_TEXT_UNWRAP 32832 +#define IDC_MYICON 2 +#define IDD_WINHACK_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDS_HELLO 106 +#define IDI_WINHACK 107 +#define IDC_WINHACK 109 +#define IDC_SPHONE_DIALOGBAR 111 +#define IDC_SPHONE_TEXTDIALOGBAR 112 +#define IDR_MAINFRAME 128 +#define IDB_TILES 129 +#define IDD_TEXT 130 +#define IDD_NHTEXT 130 +#define IDD_MENU 132 +#define IDB_MENU_SEL 133 +#define IDB_MENU_UNSEL 134 +#define IDD_COMMANDS 136 +#define IDD_GETLIN 138 +#define IDD_EXTCMD 139 +#define IDD_PLAYER_SELECTOR 141 +#define IDB_PETMARK 145 +#define IDB_MENU_SEL_COUNT 146 +#define IDB_KEYPAD 147 +#define IDB_MENUBAR 154 +#define IDC_TEXT_VIEW 1001 +#define IDC_CMD_MOVE_NW 1001 +#define IDC_CMD_MOVE_N 1002 +#define IDC_MENU_LIST 1003 +#define IDC_CMD_MOVE_NE 1003 +#define IDC_MENU_TEXT 1004 +#define IDC_CMD_MOVE_W 1004 +#define IDC_CMD_MOVE_SELF 1005 +#define IDC_CMD_MOVE_E 1006 +#define IDC_CMD_MOVE_SW 1007 +#define IDC_CMD_MOVE_S 1008 +#define IDC_CMD_MOVE_SE 1009 +#define IDC_CMD_MOVE_UP 1010 +#define IDC_CMD_MOVE_DOWN 1011 +#define IDC_CMD_5 1012 +#define IDC_CMD_A 1013 +#define IDC_CMD_B 1014 +#define IDC_CMD_C 1015 +#define IDC_CMD_D 1016 +#define IDC_CMD_E 1017 +#define IDC_CMD_F 1018 +#define IDC_CMD_G 1019 +#define IDC_CMD_H 1020 +#define IDC_CMD_I 1021 +#define IDC_CMD_J 1022 +#define IDC_CMD_K 1023 +#define IDC_CMD_L 1024 +#define IDC_CMD_M 1025 +#define IDC_CMD_N 1026 +#define IDC_CMD_O 1027 +#define IDC_CMD_P 1028 +#define IDC_CMD_Q 1029 +#define IDC_CMD_R 1030 +#define IDC_CMD_S 1031 +#define IDC_CMD_T 1032 +#define IDC_CMD_U 1033 +#define IDC_CMD_V 1034 +#define IDC_CMD_W 1035 +#define IDC_CMD_X 1036 +#define IDC_CMD_Y 1037 +#define IDC_CMD_Z 1038 +#define IDC_CMD_AA 1039 +#define IDC_CMD_BB 1040 +#define IDC_CMD_CC 1041 +#define IDC_CMD_DD 1042 +#define IDC_CMD_EE 1043 +#define IDC_CMD_FF 1044 +#define IDC_CMD_GG 1045 +#define IDC_CMD_HH 1046 +#define IDC_CMD_II 1047 +#define IDC_CMD_JJ 1048 +#define IDC_CMD_KK 1049 +#define IDC_CMD_LL 1050 +#define IDC_CMD_MM 1051 +#define IDC_CMD_NN 1052 +#define IDC_CMD_OO 1053 +#define IDC_CMD_PP 1054 +#define IDC_CMD_QQ 1055 +#define IDC_CMD_RR 1056 +#define IDC_CMD_SS 1057 +#define IDC_CMD_TT 1058 +#define IDC_CMD_UU 1059 +#define IDC_CMD_VV 1060 +#define IDC_CMD_WW 1061 +#define IDC_CMD_XX 1062 +#define IDC_CMD_YY 1063 +#define IDC_CMD_ZZ 1064 +#define IDC_CMD_FIRST 1100 +#define IDC_CMD_LAST 1300 +#define IDC_GETLIN_EDIT 1309 +#define IDC_EXTCMD_LIST 1310 +#define IDC_PLSEL_NAME 1314 +#define IDC_PLSEL_ROLE_RANDOM 1315 +#define IDC_PLSEL_RACE_RANDOM 1318 +#define IDC_PLSEL_GENDER_RANDOM 1319 +#define IDC_PLSEL_ALIGN_RANDOM 1320 +#define IDC_PLSEL_ROLE_LIST 1323 +#define IDC_PLSEL_RACE_LIST 1324 +#define IDC_PLSEL_ALIGN_LIST 1325 +#define IDC_PLSEL_GENDER_LIST 1326 +#define IDC_ABOUT_VERSION 1327 +#define IDC_TEXT_CONTROL 1331 +#define IDC_ABOUT_COPYRIGHT 1332 +#define IDC_TEXT_TOGGLE_WRAP 1333 +#define IDM_SAVE 32771 +#define IDM_HELP_LONG 32772 +#define IDM_HELP_COMMANDS 32773 +#define IDM_HELP_HISTORY 32774 +#define IDM_HELP_INFO_CHAR 32775 +#define IDM_HELP_INFO_KEY 32776 +#define IDM_HELP_OPTIONS 32777 +#define IDM_HELP_OPTIONS_LONG 32778 +#define IDM_HELP_EXTCMD 32779 +#define IDM_HELP_LICENSE 32780 +#define IDM_MAP_TILES 32781 +#define IDM_MAP_ASCII4X6 32782 +#define IDM_MAP_ASCII6X8 32783 +#define IDM_MAP_ASCII8X8 32784 +#define IDM_MAP_ASCII16X8 32785 +#define IDM_MAP_ASCII7X12 32786 +#define IDM_MAP_ASCII8X12 32787 +#define IDM_MAP_ASCII16X12 32788 +#define IDM_MAP_ASCII12X16 32789 +#define IDM_MAP_ASCII10X18 32790 +#define IDM_MAP_FIT_TO_SCREEN 32791 +#define ID_FILE 32792 +#define IDS_CAP_FILE 32793 +#define ID_HELP 32794 +#define IDS_CAP_HELP 32795 +#define IDS_CAP_TEMP 32796 +#define ID_MAP 32797 +#define IDS_CAP_AMP 32798 +#define IDS_CAP_MAP 32799 +#define IDM_VIEW_KEYPAD 32800 +#define ID_VIEW 32801 +#define IDS_CAP_VIEW 32802 +#define IDS_CAP_ENTIREMAP 32826 +#define IDS_CAP_NORMALMAP 32827 +#define IDM_HELP_MENU 32828 +#define IDM_VIEW_OPTIONS 32829 +#define IDM_DIRECT_COMMAND 32830 +#define IDS_TEXT_WRAP 32831 +#define IDS_TEXT_UNWRAP 32832 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 155 -#define _APS_NEXT_COMMAND_VALUE 32833 -#define _APS_NEXT_CONTROL_VALUE 1334 -#define _APS_NEXT_SYMED_VALUE 110 +#define _APS_NEXT_RESOURCE_VALUE 155 +#define _APS_NEXT_COMMAND_VALUE 32833 +#define _APS_NEXT_CONTROL_VALUE 1334 +#define _APS_NEXT_SYMED_VALUE 110 #endif #endif diff --git a/sys/wince/winMS.h b/sys/wince/winMS.h index b1ed1bd96..4824864e0 100644 --- a/sys/wince/winMS.h +++ b/sys/wince/winMS.h @@ -6,7 +6,7 @@ #ifndef WINMS_H #define WINMS_H -#pragma warning(disable:4142) /* benign redefinition of type */ +#pragma warning(disable : 4142) /* benign redefinition of type */ #define WIN32_LEAN_AND_MEAN #include @@ -17,12 +17,12 @@ #include "hack.h" #if defined(WIN_CE_POCKETPC) -#include +#include #include #endif #if defined(WIN_CE_SMARTPHONE) -#include +#include #include #include #include @@ -45,8 +45,8 @@ #endif /* RIP window ID */ -#define NHW_RIP 32 -#define NHW_KEYPAD 33 +#define NHW_RIP 32 +#define NHW_KEYPAD 33 /* size of tiles */ #ifndef TILE_X @@ -55,7 +55,7 @@ #define TILE_Y 16 /* tiles per line in the bitmap */ -#define TILES_PER_LINE 40 +#define TILES_PER_LINE 40 /* tile background color */ #define TILE_BK_COLOR RGB(71, 108, 108) @@ -67,42 +67,43 @@ #define NHFONT_SIZE_MAX 20 typedef struct mswin_nhwindow_data { - HWND win; - int type; - int dead; + HWND win; + int type; + int dead; } MSNHWinData, *PMSNHWinData; /* global application data - alailable thour GetNHApp() */ typedef struct mswin_nhwindow_app { - HINSTANCE hApp; /* hInstance from WinMain */ - int nCmdShow; /* main window mode flag */ - HWND hMainWnd; /* main window handle */ - HACCEL hAccelTable; /* accelerator table */ - HWND hPopupWnd; /* active dialog window (nethack menu, text, etc) */ - HWND hMenuBar; /* menu bar */ - - MSNHWinData windowlist[MAXWINDOWS]; /* nethack windows array */ - - HBITMAP bmpTiles; /* nethack tiles */ - HBITMAP bmpPetMark; /* pet mark Bitmap */ - HBITMAP bmpMapTiles; /* alternative map tiles */ - int mapTile_X; /* alt. tiles width */ - int mapTile_Y; /* alt. tiles height */ - int mapTilesPerLine; /* number of tile per row in the bitmap */ - - boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */ - boolean bNoVScroll; /* disable cliparound for vertical grid (map) */ - - int mapDisplayModeSave; /* saved map display mode */ - - int bCmdPad; /* command pad - on-screen keyboard */ - HWND hCmdWnd; /* handle of on-screen keyboard window */ - - /* options */ - boolean bWrapText; /* format text to fit the window */ - boolean bFullScreen;/* run nethack in full-screen mode */ - boolean bHideScrollBars; /* hide scroll bars */ - boolean bUseSIP; /* use SIP (built-in software keyboard) for menus (PocketPC only) */ + HINSTANCE hApp; /* hInstance from WinMain */ + int nCmdShow; /* main window mode flag */ + HWND hMainWnd; /* main window handle */ + HACCEL hAccelTable; /* accelerator table */ + HWND hPopupWnd; /* active dialog window (nethack menu, text, etc) */ + HWND hMenuBar; /* menu bar */ + + MSNHWinData windowlist[MAXWINDOWS]; /* nethack windows array */ + + HBITMAP bmpTiles; /* nethack tiles */ + HBITMAP bmpPetMark; /* pet mark Bitmap */ + HBITMAP bmpMapTiles; /* alternative map tiles */ + int mapTile_X; /* alt. tiles width */ + int mapTile_Y; /* alt. tiles height */ + int mapTilesPerLine; /* number of tile per row in the bitmap */ + + boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */ + boolean bNoVScroll; /* disable cliparound for vertical grid (map) */ + + int mapDisplayModeSave; /* saved map display mode */ + + int bCmdPad; /* command pad - on-screen keyboard */ + HWND hCmdWnd; /* handle of on-screen keyboard window */ + + /* options */ + boolean bWrapText; /* format text to fit the window */ + boolean bFullScreen; /* run nethack in full-screen mode */ + boolean bHideScrollBars; /* hide scroll bars */ + boolean bUseSIP; /* use SIP (built-in software keyboard) for menus + (PocketPC only) */ } NHWinApp, *PNHWinApp; extern PNHWinApp GetNHApp(); @@ -113,7 +114,7 @@ E struct window_procs mswin_procs; #undef E /* Some prototypes */ -void mswin_init_nhwindows(int* argc, char** argv); +void mswin_init_nhwindows(int *argc, char **argv); void mswin_player_selection(void); void mswin_askname(void); void mswin_get_nh_event(void); @@ -127,28 +128,27 @@ void mswin_destroy_nhwindow(winid wid); void mswin_curs(winid wid, int x, int y); void mswin_putstr(winid wid, int attr, const char *text); void mswin_putstr_ex(winid wid, int attr, const char *text, boolean append); -void mswin_display_file(const char *filename,BOOLEAN_P must_exist); +void mswin_display_file(const char *filename, BOOLEAN_P must_exist); void mswin_start_menu(winid wid); -void mswin_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); +void mswin_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); void mswin_end_menu(winid wid, const char *prompt); -int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); +int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); void mswin_update_inventory(void); void mswin_mark_synch(void); void mswin_wait_synch(void); void mswin_cliparound(int x, int y); -void mswin_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph); +void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph); void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str); -int mswin_nhgetch(void); -int mswin_nh_poskey(int *x, int *y, int *mod); +int mswin_nhgetch(void); +int mswin_nh_poskey(int *x, int *y, int *mod); void mswin_nhbell(void); -int mswin_doprev_message(void); -char mswin_yn_function(const char *question, const char *choices, - CHAR_P def); +int mswin_doprev_message(void); +char mswin_yn_function(const char *question, const char *choices, CHAR_P def); void mswin_getlin(const char *question, char *input); -int mswin_get_ext_cmd(void); +int mswin_get_ext_cmd(void); void mswin_number_pad(int state); void mswin_delay_output(void); void mswin_change_color(void); @@ -164,16 +164,15 @@ winid mswin_winid_from_type(int type); winid mswin_winid_from_handle(HWND hWnd); void mswin_window_mark_dead(winid wid); void bail(const char *mesg); -void nhapply_image_transparent( - HDC hDC, int x, int y, int width, int height, - HDC sourceDC, int s_x, int s_y, int s_width, int s_height, - COLORREF cTransparent -); -void mswin_popup_display(HWND popup, int* done_indicator); +void nhapply_image_transparent(HDC hDC, int x, int y, int width, int height, + HDC sourceDC, int s_x, int s_y, int s_width, + int s_height, COLORREF cTransparent); +void mswin_popup_display(HWND popup, int *done_indicator); void mswin_popup_destroy(HWND popup); #if defined(WIN_CE_SMARTPHONE) -void NHSPhoneDialogSetup(HWND hDlg, UINT nToolBarId, BOOL is_edit, BOOL is_fullscreen); +void NHSPhoneDialogSetup(HWND hDlg, UINT nToolBarId, BOOL is_edit, + BOOL is_fullscreen); #endif void mswin_read_reg(void); diff --git a/sys/winnt/win32api.h b/sys/winnt/win32api.h index a10e1cd3e..45075acb8 100644 --- a/sys/winnt/win32api.h +++ b/sys/winnt/win32api.h @@ -1,7 +1,8 @@ /* NetHack 3.6 win32api.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.6 win32api.h $Date: 2009/05/06 10:53:39 $ $Revision: 1.6 $ */ /* SCCS Id: @(#)win32api.h 3.5 $NHDT-Date$ */ -/* SCCS Id: @(#)win32api.h 3.5 $Date: 2009/05/06 10:53:39 $ */ +/* SCCS Id: @(#)win32api.h 3.5 $Date: 2009/05/06 10:53:39 $ + */ /* Copyright (c) NetHack PC Development Team 1996 */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,21 +11,21 @@ * header files & NetHack before including windows.h, so all NetHack * files should include "win32api.h" rather than . */ -# if defined(_MSC_VER) -# undef strcmpi -# undef min -# undef max -# pragma warning(disable:4142) /* Warning, Benign redefinition of type */ -# pragma pack(8) -# endif +#if defined(_MSC_VER) +#undef strcmpi +#undef min +#undef max +#pragma warning(disable : 4142) /* Warning, Benign redefinition of type */ +#pragma pack(8) +#endif #define WIN32_LEAN_AND_MEAN #include #include -# if defined(_MSC_VER) -# pragma pack() -# endif +#if defined(_MSC_VER) +#pragma pack() +#endif /*win32api.h*/ diff --git a/util/mdgrep.h b/util/mdgrep.h index 6a5cbc46b..51f4f521f 100644 --- a/util/mdgrep.h +++ b/util/mdgrep.h @@ -7,279 +7,277 @@ * This file generated by mdgrep.pl version 1.7. * DO NOT EDIT! Your changes will be lost. */ -static struct grep_var grep_vars[]={ - {"0", 0}, - {"1", 1}, +static struct grep_var grep_vars[] = { { "0", 0 }, + { "1", 1 }, #if defined(ALLDOCS) - {"ALLDOCS", 1}, + { "ALLDOCS", 1 }, #else - {"ALLDOCS", 0}, + { "ALLDOCS", 0 }, #endif #if defined(AMIGA) - {"AMIGA", 1}, + { "AMIGA", 1 }, #else - {"AMIGA", 0}, + { "AMIGA", 0 }, #endif #if defined(AMII_GRAPHICS) - {"AMII_GRAPHICS", 1}, + { "AMII_GRAPHICS", 1 }, #else - {"AMII_GRAPHICS", 0}, + { "AMII_GRAPHICS", 0 }, #endif #if defined(ASCIIGRAPH) - {"ASCIIGRAPH", 1}, + { "ASCIIGRAPH", 1 }, #else - {"ASCIIGRAPH", 0}, + { "ASCIIGRAPH", 0 }, #endif #if defined(BETA) - {"BETA", 1}, + { "BETA", 1 }, #else - {"BETA", 0}, + { "BETA", 0 }, #endif #if defined(BSD_JOB_CONTROL) - {"BSD_JOB_CONTROL", 1}, + { "BSD_JOB_CONTROL", 1 }, #else - {"BSD_JOB_CONTROL", 0}, + { "BSD_JOB_CONTROL", 0 }, #endif #if defined(CLIPPING) - {"CLIPPING", 1}, + { "CLIPPING", 1 }, #else - {"CLIPPING", 0}, + { "CLIPPING", 0 }, #endif #if defined(COMPRESS) - {"COMPRESS", 1}, + { "COMPRESS", 1 }, #else - {"COMPRESS", 0}, + { "COMPRESS", 0 }, #endif #if defined(DLB) - {"DLB", 1}, + { "DLB", 1 }, #else - {"DLB", 0}, + { "DLB", 0 }, #endif - {"FALSE", 0}, + { "FALSE", 0 }, #if defined(GEM_GRAPHICS) - {"GEM_GRAPHICS", 1}, + { "GEM_GRAPHICS", 1 }, #else - {"GEM_GRAPHICS", 0}, + { "GEM_GRAPHICS", 0 }, #endif #if defined(GNOME_GRAPHICS) - {"GNOME_GRAPHICS", 1}, + { "GNOME_GRAPHICS", 1 }, #else - {"GNOME_GRAPHICS", 0}, + { "GNOME_GRAPHICS", 0 }, #endif #if defined(HANGUPHANDLING) - {"HANGUPHANDLING", 1}, + { "HANGUPHANDLING", 1 }, #else - {"HANGUPHANDLING", 0}, + { "HANGUPHANDLING", 0 }, #endif #if defined(INSURANCE) - {"INSURANCE", 1}, + { "INSURANCE", 1 }, #else - {"INSURANCE", 0}, + { "INSURANCE", 0 }, #endif #if defined(LIFE) - {"LIFE", 1}, + { "LIFE", 1 }, #else - {"LIFE", 0}, + { "LIFE", 0 }, #endif #if defined(MAC) - {"MAC", 1}, + { "MAC", 1 }, #else - {"MAC", 0}, + { "MAC", 0 }, #endif #if defined(MAC_GRAPHICS) - {"MAC_GRAPHICS", 1}, + { "MAC_GRAPHICS", 1 }, #else - {"MAC_GRAPHICS", 0}, + { "MAC_GRAPHICS", 0 }, #endif #if defined(MAIL) - {"MAIL", 1}, + { "MAIL", 1 }, #else - {"MAIL", 0}, + { "MAIL", 0 }, #endif #if defined(MFLOPPY) - {"MFLOPPY", 1}, + { "MFLOPPY", 1 }, #else - {"MFLOPPY", 0}, + { "MFLOPPY", 0 }, #endif #if defined(MSDOS) - {"MSDOS", 1}, + { "MSDOS", 1 }, #else - {"MSDOS", 0}, + { "MSDOS", 0 }, #endif #if defined(MSWIN_GRAPHICS) - {"MSWIN_GRAPHICS", 1}, + { "MSWIN_GRAPHICS", 1 }, #else - {"MSWIN_GRAPHICS", 0}, + { "MSWIN_GRAPHICS", 0 }, #endif #if defined(NOCWD_ASSUMPTIONS) - {"NOCWD_ASSUMPTIONS", 1}, + { "NOCWD_ASSUMPTIONS", 1 }, #else - {"NOCWD_ASSUMPTIONS", 0}, + { "NOCWD_ASSUMPTIONS", 0 }, #endif #if defined(NOSAVEONHANGUP) - {"NOSAVEONHANGUP", 1}, + { "NOSAVEONHANGUP", 1 }, #else - {"NOSAVEONHANGUP", 0}, + { "NOSAVEONHANGUP", 0 }, #endif #if defined(OS2) - {"OS2", 1}, + { "OS2", 1 }, #else - {"OS2", 0}, + { "OS2", 0 }, #endif #if defined(POSIX_JOB_CONTROL) - {"POSIX_JOB_CONTROL", 1}, + { "POSIX_JOB_CONTROL", 1 }, #else - {"POSIX_JOB_CONTROL", 0}, + { "POSIX_JOB_CONTROL", 0 }, #endif #if defined(QT_GRAPHICS) - {"QT_GRAPHICS", 1}, + { "QT_GRAPHICS", 1 }, #else - {"QT_GRAPHICS", 0}, + { "QT_GRAPHICS", 0 }, #endif #if defined(RANDOM) - {"RANDOM", 1}, + { "RANDOM", 1 }, #else - {"RANDOM", 0}, + { "RANDOM", 0 }, #endif #if defined(SAFERHANGUP) - {"SAFERHANGUP", 1}, + { "SAFERHANGUP", 1 }, #else - {"SAFERHANGUP", 0}, + { "SAFERHANGUP", 0 }, #endif #if defined(SECURE) - {"SECURE", 1}, + { "SECURE", 1 }, #else - {"SECURE", 0}, + { "SECURE", 0 }, #endif #if defined(SHELL) - {"SHELL", 1}, + { "SHELL", 1 }, #else - {"SHELL", 0}, + { "SHELL", 0 }, #endif #if defined(SUSPEND) - {"SUSPEND", 1}, + { "SUSPEND", 1 }, #else - {"SUSPEND", 0}, + { "SUSPEND", 0 }, #endif #if defined(TEXTCOLOR) - {"TEXTCOLOR", 1}, + { "TEXTCOLOR", 1 }, #else - {"TEXTCOLOR", 0}, + { "TEXTCOLOR", 0 }, #endif #if defined(TOS) - {"TOS", 1}, + { "TOS", 1 }, #else - {"TOS", 0}, + { "TOS", 0 }, #endif - {"TRUE", 1}, + { "TRUE", 1 }, #if defined(TTY_GRAPHICS) - {"TTY_GRAPHICS", 1}, + { "TTY_GRAPHICS", 1 }, #else - {"TTY_GRAPHICS", 0}, + { "TTY_GRAPHICS", 0 }, #endif #if defined(UNICODE_DRAWING) - {"UNICODE_DRAWING", 1}, + { "UNICODE_DRAWING", 1 }, #else - {"UNICODE_DRAWING", 0}, + { "UNICODE_DRAWING", 0 }, #endif #if defined(UNICODE_PLAYERTEXT) - {"UNICODE_PLAYERTEXT", 1}, + { "UNICODE_PLAYERTEXT", 1 }, #else - {"UNICODE_PLAYERTEXT", 0}, + { "UNICODE_PLAYERTEXT", 0 }, #endif #if defined(UNICODE_WIDEWINPORT) - {"UNICODE_WIDEWINPORT", 1}, + { "UNICODE_WIDEWINPORT", 1 }, #else - {"UNICODE_WIDEWINPORT", 0}, + { "UNICODE_WIDEWINPORT", 0 }, #endif #if defined(UNIX) - {"UNIX", 1}, + { "UNIX", 1 }, #else - {"UNIX", 0}, + { "UNIX", 0 }, #endif #if defined(USER_SOUNDS) - {"USER_SOUNDS", 1}, + { "USER_SOUNDS", 1 }, #else - {"USER_SOUNDS", 0}, + { "USER_SOUNDS", 0 }, #endif #if defined(USE_TILES) - {"USE_TILES", 1}, + { "USE_TILES", 1 }, #else - {"USE_TILES", 0}, + { "USE_TILES", 0 }, #endif #if defined(VAR_PLAYGROUND) - {"VAR_PLAYGROUND", 1}, + { "VAR_PLAYGROUND", 1 }, #else - {"VAR_PLAYGROUND", 0}, + { "VAR_PLAYGROUND", 0 }, #endif #if defined(VMS) - {"VMS", 1}, + { "VMS", 1 }, #else - {"VMS", 0}, + { "VMS", 0 }, #endif #if defined(WIN32) - {"WIN32", 1}, + { "WIN32", 1 }, #else - {"WIN32", 0}, + { "WIN32", 0 }, #endif #if defined(WIN32_PLATFORM_HPCPRO) - {"WIN32_PLATFORM_HPCPRO", 1}, + { "WIN32_PLATFORM_HPCPRO", 1 }, #else - {"WIN32_PLATFORM_HPCPRO", 0}, + { "WIN32_PLATFORM_HPCPRO", 0 }, #endif #if defined(WIN32_PLATFORM_WFSP) - {"WIN32_PLATFORM_WFSP", 1}, + { "WIN32_PLATFORM_WFSP", 1 }, #else - {"WIN32_PLATFORM_WFSP", 0}, + { "WIN32_PLATFORM_WFSP", 0 }, #endif #if defined(WINNT) - {"WINNT", 1}, + { "WINNT", 1 }, #else - {"WINNT", 0}, + { "WINNT", 0 }, #endif #if defined(WIN_CE) - {"WIN_CE", 1}, + { "WIN_CE", 1 }, #else - {"WIN_CE", 0}, + { "WIN_CE", 0 }, #endif #if defined(WIN_CE_POCKETPC) - {"WIN_CE_POCKETPC", 1}, + { "WIN_CE_POCKETPC", 1 }, #else - {"WIN_CE_POCKETPC", 0}, + { "WIN_CE_POCKETPC", 0 }, #endif #if defined(WIN_CE_PS2xx) - {"WIN_CE_PS2xx", 1}, + { "WIN_CE_PS2xx", 1 }, #else - {"WIN_CE_PS2xx", 0}, + { "WIN_CE_PS2xx", 0 }, #endif #if defined(WIN_CE_SMARTPHONE) - {"WIN_CE_SMARTPHONE", 1}, + { "WIN_CE_SMARTPHONE", 1 }, #else - {"WIN_CE_SMARTPHONE", 0}, + { "WIN_CE_SMARTPHONE", 0 }, #endif - {"WIZARD", 1}, + { "WIZARD", 1 }, #if defined(X11_GRAPHICS) - {"X11_GRAPHICS", 1}, + { "X11_GRAPHICS", 1 }, #else - {"X11_GRAPHICS", 0}, + { "X11_GRAPHICS", 0 }, #endif #if defined(ZEROCOMP) - {"ZEROCOMP", 1}, + { "ZEROCOMP", 1 }, #else - {"ZEROCOMP", 0}, + { "ZEROCOMP", 0 }, #endif #if defined(ZLIB_COMP) - {"ZLIB_COMP", 1}, + { "ZLIB_COMP", 1 }, #else - {"ZLIB_COMP", 0}, + { "ZLIB_COMP", 0 }, #endif #if defined(__BEOS__) - {"__BEOS__", 1}, + { "__BEOS__", 1 }, #else - {"__BEOS__", 0}, + { "__BEOS__", 0 }, #endif - {0,0} -}; + { 0, 0 } }; /* Command ids */ #define TODO_GREP 1 diff --git a/win/Qt/tileedit.h b/win/Qt/tileedit.h index 4875d0453..95144d771 100644 --- a/win/Qt/tileedit.h +++ b/win/Qt/tileedit.h @@ -11,27 +11,28 @@ #include #include -class TilePickerTab : public QWidget { +class TilePickerTab : public QWidget +{ Q_OBJECT -public: - TilePickerTab(const char* basename, int id, QWidget* parent); + public: + TilePickerTab(const char *basename, int id, QWidget *parent); bool save(); int numTiles(); -signals: - void pick(const QImage&); - void pickName(const QString&); + signals: + void pick(const QImage &); + void pickName(const QString &); -public slots: - void setCurrent(const QImage&); + public slots: + void setCurrent(const QImage &); -protected: - void paintEvent( QPaintEvent* ); + protected: + void paintEvent(QPaintEvent *); QSize sizeHint() const; - void mousePressEvent(QMouseEvent*); + void mousePressEvent(QMouseEvent *); -private: + private: QString filename; int id; int last_pick; @@ -40,89 +41,95 @@ private: QImage image; }; -class TilePicker : public QTabWidget { +class TilePicker : public QTabWidget +{ Q_OBJECT -public: - TilePicker(QWidget* parent); + public: + TilePicker(QWidget *parent); - void setTile(int tilenum, const QImage&); + void setTile(int tilenum, const QImage &); -signals: - void pick(const QImage&); - void pickName(const QString&); + signals: + void pick(const QImage &); + void pickName(const QString &); -public slots: - void setCurrent(const QImage&); + public slots: + void setCurrent(const QImage &); void save(); }; -class TrivialTileEditor : public QWidget { +class TrivialTileEditor : public QWidget +{ Q_OBJECT -public: - TrivialTileEditor( QWidget* parent ); - const QImage& image() const; + public: + TrivialTileEditor(QWidget *parent); + const QImage &image() const; -signals: - void edited(const QImage&); + signals: + void edited(const QImage &); void pick(QRgb); -public slots: + public slots: void setColor(QRgb); - void setImage( const QImage& ); + void setImage(const QImage &); -protected: - void paintEvent( QPaintEvent* ); - void mousePressEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); + protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); QSize sizeHint() const; QSize sizeForWidth(int) const; QSizePolicy sizePolicy() const; -private: - void fill(QPainter& painter, QPoint p, uchar from); + private: + void fill(QPainter &painter, QPoint p, uchar from); QImage img; QColor pen; int penpixel; - void paintPoint(QPainter& painter, QPoint p); + void paintPoint(QPainter &painter, QPoint p); QPoint screenPoint(QPoint) const; QPoint imagePoint(QPoint) const; }; -class TilePalette : public QWidget { +class TilePalette : public QWidget +{ Q_OBJECT -public: - TilePalette( QWidget* parent ); + public: + TilePalette(QWidget *parent); ~TilePalette(); - void setFromImage( const QImage& ); -protected: - void paintEvent( QPaintEvent* ); - void mousePressEvent(QMouseEvent*); + void setFromImage(const QImage &); + + protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); QSize sizeHint() const; QSizePolicy sizePolicy() const; -signals: + signals: void pick(QRgb); -public slots: + public slots: void setColor(QRgb); -private: + + private: int num; QRgb *rgb; }; -class TileEditor : public QVBox { +class TileEditor : public QVBox +{ Q_OBJECT -public: - TileEditor(QWidget* parent); + public: + TileEditor(QWidget *parent); - const QImage& image() const; + const QImage &image() const; -signals: - void edited(const QImage&); + signals: + void edited(const QImage &); -public slots: - void edit(const QImage&); + public slots: + void edit(const QImage &); -private: + private: TrivialTileEditor editor; TilePalette palette; }; diff --git a/win/gem/gr_rect.h b/win/gem/gr_rect.h index 3927340f6..f5782b334 100644 --- a/win/gem/gr_rect.h +++ b/win/gem/gr_rect.h @@ -6,13 +6,13 @@ #include /********** structs **********/ typedef struct { - GRECT *rects; - int max,used; + GRECT *rects; + int max, used; } dirty_rect; /********* functions ************/ dirty_rect *new_dirty_rect(int size); void delete_dirty_rect(dirty_rect *this); -int add_dirty_rect(dirty_rect *dr,GRECT *area); -int get_dirty_rect(dirty_rect* dr,GRECT *area); +int add_dirty_rect(dirty_rect *dr, GRECT *area); +int get_dirty_rect(dirty_rect *dr, GRECT *area); int clear_dirty_rect(dirty_rect *dr); -int resize_dirty_rect(dirty_rect *dr,int new_size); +int resize_dirty_rect(dirty_rect *dr, int new_size); diff --git a/win/gnome/gn_xpms.h b/win/gnome/gn_xpms.h index ced094946..fef637fe5 100644 --- a/win/gnome/gn_xpms.h +++ b/win/gnome/gn_xpms.h @@ -4,7 +4,7 @@ /* Copyright (C) 1998 by Erik Andersen */ /* NetHack may be freely redistributed. See license for details. */ /* These XPMs are the artwork of Warwick Allison - * . They have been borrowed from + * . They have been borrowed from * the most excellent NetHackQt, until such time as * we can come up with something better. * @@ -12,6 +12,7 @@ * http://www.troll.no/~warwick/nethack/ */ +/* clang-format off */ /* XPM */ static char *blind_xpm[] = { /* width height ncolors chars_per_pixel */ @@ -1449,4 +1450,4 @@ static char *nothing_xpm[] = { "oooooooooooooooooooooooooooooooooooooooo", "oooooooooooooooooooooooooooooooooooooooo" }; - +/* clang-format on */ diff --git a/win/gnome/gnaskstr.h b/win/gnome/gnaskstr.h index d8f9c37d6..79fa9142d 100644 --- a/win/gnome/gnaskstr.h +++ b/win/gnome/gnaskstr.h @@ -7,10 +7,8 @@ #ifndef GnomeHackAskStringDialog_h #define GnomeHackAskStringDialog_h - int ghack_ask_string_dialog(const char *szMessageStr, - const char *szDefaultStr, const char *szTitleStr, - char *buffer); + const char *szDefaultStr, const char *szTitleStr, + char *buffer); #endif /* GnomeHackAskStringDialog_h */ - diff --git a/win/gnome/gnbind.h b/win/gnome/gnbind.h index 4d8ebe84b..8261aea93 100644 --- a/win/gnome/gnbind.h +++ b/win/gnome/gnbind.h @@ -9,7 +9,7 @@ /* * This header files defines the interface between the window port specific - * code in the Gnome port and the rest of the nethack game engine. + * code in the Gnome port and the rest of the nethack game engine. */ #include @@ -28,7 +28,6 @@ #include "gnglyph.h" #include "gnworn.h" - /* Create an array to keep track of the various windows */ #ifndef MAXWINDOWS @@ -36,13 +35,12 @@ #endif typedef struct gnome_nhwindow_data { - GtkWidget* win; - int type; + GtkWidget *win; + int type; } GNHWinData; - /* Some prototypes */ -void gnome_init_nhwindows(int* argc, char** argv); +void gnome_init_nhwindows(int *argc, char **argv); void gnome_player_selection(void); void gnome_askname(void); void gnome_get_nh_event(void); @@ -56,14 +54,14 @@ void gnome_display_nhwindow(winid wid, BOOLEAN_P block); void gnome_destroy_nhwindow(winid wid); void gnome_curs(winid wid, int x, int y); void gnome_putstr(winid wid, int attr, const char *text); -void gnome_display_file(const char *filename,BOOLEAN_P must_exist); +void gnome_display_file(const char *filename, BOOLEAN_P must_exist); void gnome_start_menu(winid wid); -void gnome_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); +void gnome_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); void gnome_end_menu(winid wid, const char *prompt); -int gnome_select_menu(winid wid, int how, MENU_ITEM_P **selected); -/* No need for message_menu -- we'll use genl_message_menu instead */ +int gnome_select_menu(winid wid, int how, MENU_ITEM_P **selected); +/* No need for message_menu -- we'll use genl_message_menu instead */ void gnome_update_inventory(void); void gnome_mark_synch(void); void gnome_wait_synch(void); @@ -72,25 +70,21 @@ void gnome_cliparound(int x, int y); * gnome_cliparound (which lacks the winid) simply calls this funtion. */ void gnome_cliparound_proper(winid wid, int x, int y); -void gnome_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph); +void gnome_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph); void gnome_raw_print(const char *str); void gnome_raw_print_bold(const char *str); -int gnome_nhgetch(void); -int gnome_nh_poskey(int *x, int *y, int *mod); +int gnome_nhgetch(void); +int gnome_nh_poskey(int *x, int *y, int *mod); void gnome_nhbell(void); -int gnome_doprev_message(void); -char gnome_yn_function(const char *question, const char *choices, - CHAR_P def); +int gnome_doprev_message(void); +char gnome_yn_function(const char *question, const char *choices, CHAR_P def); void gnome_getlin(const char *question, char *input); -int gnome_get_ext_cmd(void); +int gnome_get_ext_cmd(void); void gnome_number_pad(int state); void gnome_delay_output(void); void gnome_start_screen(void); void gnome_end_screen(void); void gnome_outrip(winid wid, int how, time_t when); -void gnome_delete_nhwindow_by_reference( GtkWidget *menuWin); - +void gnome_delete_nhwindow_by_reference(GtkWidget *menuWin); #endif /* GnomeHackBind_h */ - - diff --git a/win/gnome/gnglyph.h b/win/gnome/gnglyph.h index 4bb693d1e..e4db0e598 100644 --- a/win/gnome/gnglyph.h +++ b/win/gnome/gnglyph.h @@ -14,7 +14,7 @@ that trigger spurious warnings if gcc's `-Wshadow' option is used */ #undef index #define index _hide_index_ -#define time _hide_time_ +#define time _hide_time_ #include #include @@ -23,22 +23,21 @@ #define index strchr #undef time - -extern short glyph2tile[]; /* From tile.c */ +extern short glyph2tile[]; /* From tile.c */ typedef struct { - GdkImlibImage* im; - int count; - int width; - int height; + GdkImlibImage *im; + int count; + int width; + int height; } GHackGlyphs; -extern int ghack_init_glyphs( const char *); -extern void ghack_free_glyphs( void); -extern void ghack_dispose_glyphs( void); -extern int ghack_glyph_count( void); -extern GdkImlibImage* ghack_image_from_glyph( int, gboolean); -extern int ghack_glyph_height( void); -extern int ghack_glyph_width( void); +extern int ghack_init_glyphs(const char *); +extern void ghack_free_glyphs(void); +extern void ghack_dispose_glyphs(void); +extern int ghack_glyph_count(void); +extern GdkImlibImage *ghack_image_from_glyph(int, gboolean); +extern int ghack_glyph_height(void); +extern int ghack_glyph_width(void); -#endif /* GnomeHackGlyph_h */ +#endif /* GnomeHackGlyph_h */ diff --git a/win/gnome/gnmain.h b/win/gnome/gnmain.h index b5932ef5d..ee03020e7 100644 --- a/win/gnome/gnmain.h +++ b/win/gnome/gnmain.h @@ -10,19 +10,15 @@ #include #include - -void ghack_init_main_window( int argc, char** argv); -void ghack_main_window_add_map_window(GtkWidget* win); -void ghack_main_window_add_message_window(GtkWidget* win); -void ghack_main_window_add_status_window(GtkWidget* win); +void ghack_init_main_window(int argc, char **argv); +void ghack_main_window_add_map_window(GtkWidget *win); +void ghack_main_window_add_message_window(GtkWidget *win); +void ghack_main_window_add_status_window(GtkWidget *win); void ghack_main_window_add_text_window(GtkWidget *); -void ghack_main_window_add_worn_window(GtkWidget* win); +void ghack_main_window_add_worn_window(GtkWidget *win); void ghack_main_window_remove_window(GtkWidget *); void ghack_main_window_update_inventory(); void ghack_save_game_cb(GtkWidget *widget, gpointer data); -GtkWidget* ghack_get_main_window(); - - +GtkWidget *ghack_get_main_window(); #endif /* GnomeHackMainWindow_h */ - diff --git a/win/gnome/gnmenu.h b/win/gnome/gnmenu.h index 214083107..795678530 100644 --- a/win/gnome/gnmenu.h +++ b/win/gnome/gnmenu.h @@ -12,23 +12,22 @@ #include "global.h" #include "gnomeprv.h" -GtkWidget* ghack_init_menu_window( void ); +GtkWidget *ghack_init_menu_window(void); -struct _GHackMenuItem -{ - int glyph; - const ANY_P *identifier; - CHAR_P accelerator; - CHAR_P group_accel; - int attr; - const char* str; - BOOLEAN_P presel; +struct _GHackMenuItem { + int glyph; + const ANY_P *identifier; + CHAR_P accelerator; + CHAR_P group_accel; + int attr; + const char *str; + BOOLEAN_P presel; }; typedef struct _GHackMenuItem GHackMenuItem; -int ghack_menu_window_select_menu (GtkWidget *menuWin, - MENU_ITEM_P **_selected, gint how); +int ghack_menu_window_select_menu(GtkWidget *menuWin, MENU_ITEM_P **_selected, + gint how); int ghack_menu_ext_cmd(void); -#endif /* GnomeHackMenuWindow_h */ +#endif /* GnomeHackMenuWindow_h */ diff --git a/win/gnome/gnmesg.h b/win/gnome/gnmesg.h index 3e88a3d45..2927d1fec 100644 --- a/win/gnome/gnmesg.h +++ b/win/gnome/gnmesg.h @@ -10,16 +10,15 @@ #include #include "config.h" -GtkWidget* ghack_init_message_window ( /* GnomeHackKeyBuffer g_keybuffer, - GnomeHackClickBuffer g_clickbuffer */ ); +GtkWidget *ghack_init_message_window(/* GnomeHackKeyBuffer g_keybuffer, + GnomeHackClickBuffer g_clickbuffer */); void ghack_message_window_clear(GtkWidget *widget, gpointer data); void ghack_message_window_destroy(); void ghack_message_window_display(GtkWidget *widget, boolean block, gpointer data); void ghack_message_window_put_string(GtkWidget *widget, int attr, - const char* text, gpointer data); + const char *text, gpointer data); void ghack_message_window_use_RIP(int how); void ghack_message_window_scroll(int dx, int dy); - #endif /* GnomeHackMessageWindow_h */ diff --git a/win/gnome/gnomeprv.h b/win/gnome/gnomeprv.h index f15ed34c2..dcb170339 100644 --- a/win/gnome/gnomeprv.h +++ b/win/gnome/gnomeprv.h @@ -14,7 +14,4 @@ #include "winGnome.h" -#endif /* GnomeHack_h */ - - - +#endif /* GnomeHack_h */ diff --git a/win/gnome/gnopts.h b/win/gnome/gnopts.h index f2ae33c77..8da582d08 100644 --- a/win/gnome/gnopts.h +++ b/win/gnome/gnopts.h @@ -7,9 +7,6 @@ #ifndef GnomeHackSettings_h #define GnomeHackSettings_h - -void ghack_settings_dialog( void); - +void ghack_settings_dialog(void); #endif /* GnomeHackSettings.h */ - diff --git a/win/gnome/gnplayer.h b/win/gnome/gnplayer.h index def098a00..412986430 100644 --- a/win/gnome/gnplayer.h +++ b/win/gnome/gnplayer.h @@ -7,6 +7,6 @@ #ifndef GnomeHackPlayerSelDialog_h #define GnomeHackPlayerSelDialog_h -int ghack_player_sel_dialog(const char **, const gchar*, const gchar*); +int ghack_player_sel_dialog(const char **, const gchar *, const gchar *); #endif /* GnomeHackPlayerSelDialog_h */ diff --git a/win/gnome/gnsignal.h b/win/gnome/gnsignal.h index 27310f564..436529bac 100644 --- a/win/gnome/gnsignal.h +++ b/win/gnome/gnsignal.h @@ -15,33 +15,32 @@ /* The list of custom signals */ enum { - GHSIG_CURS, - GHSIG_PUTSTR, - GHSIG_PRINT_GLYPH, - GHSIG_CLEAR, - GHSIG_DISPLAY, - GHSIG_START_MENU, - GHSIG_ADD_MENU, - GHSIG_END_MENU, - GHSIG_SELECT_MENU, - GHSIG_CLIPAROUND, - GHSIG_FADE_HIGHLIGHT, - GHSIG_DELAY, - GHSIG_LAST_SIG + GHSIG_CURS, + GHSIG_PUTSTR, + GHSIG_PRINT_GLYPH, + GHSIG_CLEAR, + GHSIG_DISPLAY, + GHSIG_START_MENU, + GHSIG_ADD_MENU, + GHSIG_END_MENU, + GHSIG_SELECT_MENU, + GHSIG_CLIPAROUND, + GHSIG_FADE_HIGHLIGHT, + GHSIG_DELAY, + GHSIG_LAST_SIG }; guint ghack_signals[GHSIG_LAST_SIG]; -extern void ghack_init_signals( void); +extern void ghack_init_signals(void); - -void ghack_handle_key_press(GtkWidget *widget, GdkEventKey *event, - gpointer data); -void ghack_handle_button_press(GtkWidget *widget, GdkEventButton *event, - gpointer data); +void ghack_handle_key_press(GtkWidget *widget, GdkEventKey *event, + gpointer data); +void ghack_handle_button_press(GtkWidget *widget, GdkEventButton *event, + gpointer data); typedef struct { - int x, y, mod; + int x, y, mod; } GHClick; extern GList *g_keyBuffer; @@ -51,8 +50,6 @@ extern int g_numClicks; extern int g_askingQuestion; -void ghack_delay( GtkWidget *win, int numMillisecs, gpointer data); - - -#endif /* GnomeHackSignals_h */ +void ghack_delay(GtkWidget *win, int numMillisecs, gpointer data); +#endif /* GnomeHackSignals_h */ diff --git a/win/gnome/gnstatus.h b/win/gnome/gnstatus.h index c9ae8c049..5f9bae0d0 100644 --- a/win/gnome/gnstatus.h +++ b/win/gnome/gnstatus.h @@ -11,6 +11,6 @@ #include "config.h" #include "global.h" -GtkWidget* ghack_init_status_window (); +GtkWidget *ghack_init_status_window(); #endif /* GnomeHackStatusWindow_h */ diff --git a/win/gnome/gntext.h b/win/gnome/gntext.h index 8e6c1addd..05d0c7da0 100644 --- a/win/gnome/gntext.h +++ b/win/gnome/gntext.h @@ -11,14 +11,13 @@ #include "config.h" #include "global.h" -GtkWidget* ghack_init_text_window ( ); +GtkWidget *ghack_init_text_window(); void ghack_text_window_clear(GtkWidget *widget, gpointer data); void ghack_text_window_destroy(); void ghack_text_window_display(GtkWidget *widget, boolean block, - gpointer data); + gpointer data); void ghack_text_window_put_string(GtkWidget *widget, int attr, - const char* text, gpointer data); -void ghack_text_window_rip_string( const char* ripString); - + const char *text, gpointer data); +void ghack_text_window_rip_string(const char *ripString); #endif /* GnomeHackTextWindow_h */ diff --git a/win/gnome/gnworn.h b/win/gnome/gnworn.h index fd5f3acbd..e1f39e1ed 100644 --- a/win/gnome/gnworn.h +++ b/win/gnome/gnworn.h @@ -13,6 +13,6 @@ #include "config.h" #include "global.h" -GtkWidget* ghack_init_worn_window(); +GtkWidget *ghack_init_worn_window(); #endif /* GnomeHackWornWindow_h */ diff --git a/win/gnome/gnyesno.h b/win/gnome/gnyesno.h index a9b49c6b8..2dfd5a312 100644 --- a/win/gnome/gnyesno.h +++ b/win/gnome/gnyesno.h @@ -7,8 +7,7 @@ #ifndef GnomeHackYesNoDialog_h #define GnomeHackYesNoDialog_h -int ghack_yes_no_dialog( const char* szQuestionStr, - const char* szChoicesStr, int nDefault); - +int ghack_yes_no_dialog(const char *szQuestionStr, const char *szChoicesStr, + int nDefault); #endif diff --git a/win/share/tile.h b/win/share/tile.h index 974170a15..ed27247a8 100644 --- a/win/share/tile.h +++ b/win/share/tile.h @@ -6,11 +6,11 @@ typedef struct pixel_s { pixval r, g, b; } pixel; -#define MAXCOLORMAPSIZE 256 +#define MAXCOLORMAPSIZE 256 -#define CM_RED 0 -#define CM_GREEN 1 -#define CM_BLUE 2 +#define CM_RED 0 +#define CM_GREEN 1 +#define CM_BLUE 2 /* shared between reader and writer */ extern pixval ColorMap[3][MAXCOLORMAPSIZE]; @@ -19,7 +19,7 @@ extern int colorsinmap; extern pixval MainColorMap[3][MAXCOLORMAPSIZE]; extern int colorsinmainmap; -#include "dlb.h" /* for MODEs */ +#include "dlb.h" /* for MODEs */ /* size of tiles */ #ifndef TILE_X @@ -31,10 +31,9 @@ extern int colorsinmainmap; #define Fprintf (void) fprintf - extern boolean FDECL(fopen_text_file, (const char *, const char *)); -extern boolean FDECL(read_text_tile, (pixel (*)[TILE_X])); -extern boolean FDECL(write_text_tile, (pixel (*)[TILE_X])); +extern boolean FDECL(read_text_tile, (pixel(*) [TILE_X])); +extern boolean FDECL(write_text_tile, (pixel(*) [TILE_X])); extern int NDECL(fclose_text_file); extern void NDECL(init_colormap); @@ -42,7 +41,7 @@ extern void NDECL(merge_colormap); #if defined(MICRO) || defined(WIN32) #undef exit -# if !defined(MSDOS) && !defined(WIN32) +#if !defined(MSDOS) && !defined(WIN32) extern void FDECL(exit, (int)); -# endif +#endif #endif diff --git a/win/win32/mhaskyn.h b/win/win32/mhaskyn.h index 793a0b00e..bff23418e 100644 --- a/win/win32/mhaskyn.h +++ b/win/win32/mhaskyn.h @@ -9,7 +9,6 @@ #include "winMS.h" -int mswin_yes_no_dialog( const char *question, const char *choices, int def); +int mswin_yes_no_dialog(const char *question, const char *choices, int def); #endif /* MSWINAskYesNO_h */ - diff --git a/win/win32/mhdlg.h b/win/win32/mhdlg.h index 39cb8edcd..e7ff67077 100644 --- a/win/win32/mhdlg.h +++ b/win/win32/mhdlg.h @@ -10,9 +10,9 @@ #include "config.h" #include "global.h" -int mswin_getlin_window (const char *question, char *result, size_t result_size); -int mswin_ext_cmd_window (int* selection); -int mswin_player_selection_window(int* selection); +int mswin_getlin_window(const char *question, char *result, + size_t result_size); +int mswin_ext_cmd_window(int *selection); +int mswin_player_selection_window(int *selection); #endif /* MSWINDlgWindow_h */ - diff --git a/win/win32/mhfont.h b/win/win32/mhfont.h index a388a542f..437554355 100644 --- a/win/win32/mhfont.h +++ b/win/win32/mhfont.h @@ -17,4 +17,3 @@ void mswin_destroy_splashfonts(void); UINT mswin_charset(void); #endif /* MSWINFont_h */ - diff --git a/win/win32/mhinput.h b/win/win32/mhinput.h index f3eb9a6de..5e9e7d0ac 100644 --- a/win/win32/mhinput.h +++ b/win/win32/mhinput.h @@ -10,30 +10,43 @@ /* nethack input queue - store/extract input events */ #include "winMS.h" -#define NHEVENT_CHAR 1 -#define NHEVENT_MOUSE 2 +#define NHEVENT_CHAR 1 +#define NHEVENT_MOUSE 2 typedef struct mswin_event { - int type; - union { - struct { - int ch; - } kbd; - - struct { - int mod; - int x, y; - } ms; - }; + int type; + union { + struct { + int ch; + } kbd; + + struct { + int mod; + int x, y; + } ms; + }; } MSNHEvent, *PMSNHEvent; -#define NHEVENT_KBD(c) { MSNHEvent e; e.type=NHEVENT_CHAR; e.kbd.ch=(c); mswin_input_push(&e); } -#define NHEVENT_MS(_mod, _x, _y) { MSNHEvent e; e.type=NHEVENT_MOUSE; e.ms.mod = (_mod); e.ms.x=(_x); e.ms.y=(_y); mswin_input_push(&e); } - -void mswin_nh_input_init(void); -int mswin_have_input(void); -void mswin_input_push(PMSNHEvent event); -PMSNHEvent mswin_input_pop(void); -PMSNHEvent mswin_input_peek(void); +#define NHEVENT_KBD(c) \ + { \ + MSNHEvent e; \ + e.type = NHEVENT_CHAR; \ + e.kbd.ch = (c); \ + mswin_input_push(&e); \ + } +#define NHEVENT_MS(_mod, _x, _y) \ + { \ + MSNHEvent e; \ + e.type = NHEVENT_MOUSE; \ + e.ms.mod = (_mod); \ + e.ms.x = (_x); \ + e.ms.y = (_y); \ + mswin_input_push(&e); \ + } + +void mswin_nh_input_init(void); +int mswin_have_input(void); +void mswin_input_push(PMSNHEvent event); +PMSNHEvent mswin_input_pop(void); +PMSNHEvent mswin_input_peek(void); #endif /* MSWINInput_h */ - diff --git a/win/win32/mhmain.h b/win/win32/mhmain.h index 3567093fd..305b088bf 100644 --- a/win/win32/mhmain.h +++ b/win/win32/mhmain.h @@ -11,10 +11,9 @@ #include "winMS.h" -HWND mswin_init_main_window (void); +HWND mswin_init_main_window(void); void mswin_layout_main_window(HWND changed_child); void mswin_select_map_mode(int map_mode); void mswin_menu_check_intf_mode(void); #endif /* MSWINMainWindow_h */ - diff --git a/win/win32/mhmap.h b/win/win32/mhmap.h index 9181a7bde..4c0ad3422 100644 --- a/win/win32/mhmap.h +++ b/win/win32/mhmap.h @@ -11,16 +11,14 @@ #include "config.h" #include "global.h" - -COLORREF nhcolor_to_RGB (int c); -HWND mswin_init_map_window (void); +COLORREF nhcolor_to_RGB(int c); +HWND mswin_init_map_window(void); void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw); int mswin_map_mode(HWND hWnd, int mode); -#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16 +#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16 -#define DEF_CLIPAROUND_MARGIN 5 -#define DEF_CLIPAROUND_AMOUNT 1 +#define DEF_CLIPAROUND_MARGIN 5 +#define DEF_CLIPAROUND_AMOUNT 1 #endif /* MSWINMapWindow_h */ - diff --git a/win/win32/mhmenu.h b/win/win32/mhmenu.h index dc66a4f68..a2c372fe6 100644 --- a/win/win32/mhmenu.h +++ b/win/win32/mhmenu.h @@ -11,13 +11,13 @@ #include "config.h" #include "global.h" -#define MENU_TYPE_TEXT 1 -#define MENU_TYPE_MENU 2 +#define MENU_TYPE_TEXT 1 +#define MENU_TYPE_MENU 2 -extern COLORREF nhcolor_to_RGB (int c); -HWND mswin_init_menu_window ( int type ); -int mswin_menu_window_select_menu (HWND hwnd, int how, MENU_ITEM_P ** selected, BOOL activate); -void mswin_menu_window_size (HWND hwnd, LPSIZE sz); +extern COLORREF nhcolor_to_RGB(int c); +HWND mswin_init_menu_window(int type); +int mswin_menu_window_select_menu(HWND hwnd, int how, MENU_ITEM_P **selected, + BOOL activate); +void mswin_menu_window_size(HWND hwnd, LPSIZE sz); #endif /* MSWINTextWindow_h */ - diff --git a/win/win32/mhmsg.h b/win/win32/mhmsg.h index 0a6a062e8..671dee5d0 100644 --- a/win/win32/mhmsg.h +++ b/win/win32/mhmsg.h @@ -8,73 +8,72 @@ #define MHNethackMessages_H /* nethack messages */ -#define WM_MSNH_COMMAND (WM_APP+1) +#define WM_MSNH_COMMAND (WM_APP + 1) -#define MSNH_MSG_ADDWND 100 -#define MSNH_MSG_PUTSTR 101 -#define MSNH_MSG_PRINT_GLYPH 102 -#define MSNH_MSG_CLEAR_WINDOW 103 -#define MSNH_MSG_CLIPAROUND 104 -#define MSNH_MSG_STARTMENU 105 -#define MSNH_MSG_ADDMENU 106 -#define MSNH_MSG_CURSOR 107 -#define MSNH_MSG_ENDMENU 108 -#define MSNH_MSG_DIED 109 -#define MSNH_MSG_CARET 110 -#define MSNH_MSG_GETTEXT 111 -#define MSNH_MSG_UPDATE_STATUS 112 +#define MSNH_MSG_ADDWND 100 +#define MSNH_MSG_PUTSTR 101 +#define MSNH_MSG_PRINT_GLYPH 102 +#define MSNH_MSG_CLEAR_WINDOW 103 +#define MSNH_MSG_CLIPAROUND 104 +#define MSNH_MSG_STARTMENU 105 +#define MSNH_MSG_ADDMENU 106 +#define MSNH_MSG_CURSOR 107 +#define MSNH_MSG_ENDMENU 108 +#define MSNH_MSG_DIED 109 +#define MSNH_MSG_CARET 110 +#define MSNH_MSG_GETTEXT 111 +#define MSNH_MSG_UPDATE_STATUS 112 typedef struct mswin_nhmsg_add_wnd { - winid wid; + winid wid; } MSNHMsgAddWnd, *PMSNHMsgAddWnd; typedef struct mswin_nhmsg_putstr { - int attr; - const char* text; - int append; + int attr; + const char *text; + int append; } MSNHMsgPutstr, *PMSNHMsgPutstr; typedef struct mswin_nhmsg_print_glyph { - XCHAR_P x; - XCHAR_P y; - int glyph; + XCHAR_P x; + XCHAR_P y; + int glyph; } MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph; typedef struct mswin_nhmsg_cliparound { - int x; - int y; + int x; + int y; } MSNHMsgClipAround, *PMSNHMsgClipAround; typedef struct mswin_nhmsg_add_menu { - int glyph; - const ANY_P* identifier; - CHAR_P accelerator; - CHAR_P group_accel; - int attr; - const char * str; - BOOLEAN_P presel; + int glyph; + const ANY_P *identifier; + CHAR_P accelerator; + CHAR_P group_accel; + int attr; + const char *str; + BOOLEAN_P presel; } MSNHMsgAddMenu, *PMSNHMsgAddMenu; typedef struct mswin_nhmsg_cursor { - int x; - int y; + int x; + int y; } MSNHMsgCursor, *PMSNHMsgCursor; typedef struct mswin_nhmsg_end_menu { - const char* text; + const char *text; } MSNHMsgEndMenu, *PMSNHMsgEndMenu; typedef struct mswin_nhmsg_get_text { - size_t max_size; - char buffer[]; + size_t max_size; + char buffer[]; } MSNHMsgGetText, *PMSNHMsgGetText; typedef struct mswin_nhmsg_update_status { - int n_fields; - const char** vals; - boolean* activefields; - int* colors; + int n_fields; + const char **vals; + boolean *activefields; + int *colors; } MSNHMsgUpdateStatus, *PMSNHMsgUpdateStatus; #endif - diff --git a/win/win32/mhmsgwnd.h b/win/win32/mhmsgwnd.h index aea6cf9a3..c10ef8da2 100644 --- a/win/win32/mhmsgwnd.h +++ b/win/win32/mhmsgwnd.h @@ -11,9 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_message_window (void); -void mswin_message_window_size (HWND hWnd, LPSIZE sz); - +HWND mswin_init_message_window(void); +void mswin_message_window_size(HWND hWnd, LPSIZE sz); #endif /* MSWINMessageWindow_h */ - diff --git a/win/win32/mhrip.h b/win/win32/mhrip.h index ca7761638..829e3bf4e 100644 --- a/win/win32/mhrip.h +++ b/win/win32/mhrip.h @@ -12,8 +12,7 @@ #include "global.h" void mswin_finish_rip_text(winid wid); -HWND mswin_init_RIP_window (void); -void mswin_display_RIP_window (HWND hwnd); +HWND mswin_init_RIP_window(void); +void mswin_display_RIP_window(HWND hwnd); #endif /* MSWINRIPWindow_h */ - diff --git a/win/win32/mhsplash.h b/win/win32/mhsplash.h index 7d8ab4eb4..48bc92f19 100644 --- a/win/win32/mhsplash.h +++ b/win/win32/mhsplash.h @@ -12,7 +12,6 @@ $Date: 2003/03/03 23:31:36 $ $Revision: 1.3 $ #include "config.h" #include "global.h" -void mswin_display_splash_window (BOOL); +void mswin_display_splash_window(BOOL); #endif /* MSWINSplashWindow_h */ - diff --git a/win/win32/mhstatus.h b/win/win32/mhstatus.h index 937de4fc8..7b7e83906 100644 --- a/win/win32/mhstatus.h +++ b/win/win32/mhstatus.h @@ -11,8 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_status_window (void); -void mswin_status_window_size (HWND hWnd, LPSIZE sz); +HWND mswin_init_status_window(void); +void mswin_status_window_size(HWND hWnd, LPSIZE sz); #endif /* MSWINStatusWindow_h */ - diff --git a/win/win32/mhtext.h b/win/win32/mhtext.h index c4c3eeb6a..f4f3d1916 100644 --- a/win/win32/mhtext.h +++ b/win/win32/mhtext.h @@ -11,8 +11,7 @@ #include "config.h" #include "global.h" -HWND mswin_init_text_window (void); -void mswin_display_text_window (HWND hwnd); +HWND mswin_init_text_window(void); +void mswin_display_text_window(HWND hwnd); #endif /* MSWINTextWindow_h */ - diff --git a/win/win32/resource.h b/win/win32/resource.h index caca5debd..6d566bf3f 100644 --- a/win/win32/resource.h +++ b/win/win32/resource.h @@ -2,154 +2,154 @@ // Microsoft Visual C++ generated include file. // Used by winhack.rc // -#define IDC_MYICON 2 -#define IDD_WINHACK_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDS_APP_TITLE 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDS_HELLO 106 -#define IDI_NETHACKW 107 -#define IDC_NETHACKW 109 -#define IDS_APP_TITLE_SHORT 110 -#define IDR_MAINFRAME 128 -#define IDB_TILES 129 -#define IDD_TEXT 130 -#define IDD_NHTEXT 130 -#define IDD_MENU 132 -#define IDB_MENU_SEL 133 -#define IDB_MENU_UNSEL 134 -#define IDD_COMMANDS 136 -#define IDD_GETLIN 138 -#define IDD_EXTCMD 139 -#define IDD_PLAYER_SELECTOR 141 -#define IDB_PETMARK 143 -#define IDB_MENU_SEL_COUNT 144 -#define IDD_NHRIP 145 -#define IDB_SPLASH 146 -#define IDB_RIP 147 -#define IDD_SPLASH 148 -#define IDC_TEXT_VIEW 1000 -#define IDC_TEXT_CONTROL 1000 -#define IDC_CMD_MOVE_NW 1001 -#define IDC_CMD_MOVE_N 1002 -#define IDC_MENU_LIST 1003 -#define IDC_CMD_MOVE_NE 1003 -#define IDC_MENU_TEXT 1004 -#define IDC_CMD_MOVE_W 1004 -#define IDC_CMD_MOVE_SELF 1005 -#define IDC_CMD_MOVE_E 1006 -#define IDC_CMD_MOVE_SW 1007 -#define IDC_CMD_MOVE_S 1008 -#define IDC_CMD_MOVE_SE 1009 -#define IDC_CMD_MOVE_UP 1010 -#define IDC_CMD_MOVE_DOWN 1011 -#define IDC_CMD_5 1012 -#define IDC_CMD_A 1013 -#define IDC_CMD_B 1014 -#define IDC_CMD_C 1015 -#define IDC_CMD_D 1016 -#define IDC_CMD_E 1017 -#define IDC_CMD_F 1018 -#define IDC_CMD_G 1019 -#define IDC_CMD_H 1020 -#define IDC_CMD_I 1021 -#define IDC_CMD_J 1022 -#define IDC_CMD_K 1023 -#define IDC_CMD_L 1024 -#define IDC_CMD_M 1025 -#define IDC_CMD_N 1026 -#define IDC_CMD_O 1027 -#define IDC_CMD_P 1028 -#define IDC_CMD_Q 1029 -#define IDC_CMD_R 1030 -#define IDC_CMD_S 1031 -#define IDC_CMD_T 1032 -#define IDC_CMD_U 1033 -#define IDC_CMD_V 1034 -#define IDC_CMD_W 1035 -#define IDC_CMD_X 1036 -#define IDC_CMD_Y 1037 -#define IDC_CMD_Z 1038 -#define IDC_CMD_AA 1039 -#define IDC_CMD_BB 1040 -#define IDC_CMD_CC 1041 -#define IDC_CMD_DD 1042 -#define IDC_CMD_EE 1043 -#define IDC_CMD_FF 1044 -#define IDC_CMD_GG 1045 -#define IDC_CMD_HH 1046 -#define IDC_CMD_II 1047 -#define IDC_CMD_JJ 1048 -#define IDC_CMD_KK 1049 -#define IDC_CMD_LL 1050 -#define IDC_CMD_MM 1051 -#define IDC_CMD_NN 1052 -#define IDC_CMD_OO 1053 -#define IDC_CMD_PP 1054 -#define IDC_CMD_QQ 1055 -#define IDC_CMD_RR 1056 -#define IDC_CMD_SS 1057 -#define IDC_CMD_TT 1058 -#define IDC_CMD_UU 1059 -#define IDC_CMD_VV 1060 -#define IDC_CMD_WW 1061 -#define IDC_CMD_XX 1062 -#define IDC_CMD_YY 1063 -#define IDC_CMD_ZZ 1064 -#define IDC_CMD_FIRST 1100 -#define IDC_CMD_LAST 1300 -#define IDC_GETLIN_EDIT 1309 -#define IDC_EXTCMD_LIST 1310 -#define IDC_PLSEL_NAME 1314 -#define IDC_PLSEL_ROLE_RANDOM 1315 -#define IDC_PLSEL_RACE_RANDOM 1318 -#define IDC_PLSEL_GENDER_RANDOM 1319 -#define IDC_PLSEL_ALIGN_RANDOM 1320 -#define IDC_PLSEL_ROLE_LIST 1323 -#define IDC_PLSEL_RACE_LIST 1324 -#define IDC_PLSEL_ALIGN_LIST 1325 -#define IDC_PLSEL_GENDER_LIST 1326 -#define IDC_ABOUT_VERSION 1327 -#define IDC_ABOUT_COPYRIGHT 1328 -#define IDC_EXTRAINFO 1331 -#define IDM_SAVE 32771 -#define IDM_HELP_LONG 32772 -#define IDM_HELP_COMMANDS 32773 -#define IDM_HELP_HISTORY 32774 -#define IDM_HELP_INFO_CHAR 32775 -#define IDM_HELP_INFO_KEY 32776 -#define IDM_HELP_OPTIONS 32777 -#define IDM_HELP_OPTIONS_LONG 32778 -#define IDM_HELP_EXTCMD 32779 -#define IDM_HELP_LICENSE 32780 -#define IDM_HELP_PORTHELP 32781 -#define IDM_MAP_TILES 32782 -#define IDM_MAP_ASCII4X6 32783 -#define IDM_MAP_ASCII6X8 32784 -#define IDM_MAP_ASCII8X8 32785 -#define IDM_MAP_ASCII16X8 32786 -#define IDM_MAP_ASCII7X12 32787 -#define IDM_MAP_ASCII8X12 32788 -#define IDM_MAP_ASCII16X12 32789 -#define IDM_MAP_ASCII12X16 32790 -#define IDM_MAP_ASCII10X18 32791 -#define IDM_MAP_FIT_TO_SCREEN 32792 -#define IDM_NHMODE 32794 -#define IDM_CLEARSETTINGS 32795 -#define IDM_SETTING_AUTOLAYOUT 32796 -#define IDM_SETTING_LOCKWINDOWS 32797 +#define IDC_MYICON 2 +#define IDD_WINHACK_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDS_HELLO 106 +#define IDI_NETHACKW 107 +#define IDC_NETHACKW 109 +#define IDS_APP_TITLE_SHORT 110 +#define IDR_MAINFRAME 128 +#define IDB_TILES 129 +#define IDD_TEXT 130 +#define IDD_NHTEXT 130 +#define IDD_MENU 132 +#define IDB_MENU_SEL 133 +#define IDB_MENU_UNSEL 134 +#define IDD_COMMANDS 136 +#define IDD_GETLIN 138 +#define IDD_EXTCMD 139 +#define IDD_PLAYER_SELECTOR 141 +#define IDB_PETMARK 143 +#define IDB_MENU_SEL_COUNT 144 +#define IDD_NHRIP 145 +#define IDB_SPLASH 146 +#define IDB_RIP 147 +#define IDD_SPLASH 148 +#define IDC_TEXT_VIEW 1000 +#define IDC_TEXT_CONTROL 1000 +#define IDC_CMD_MOVE_NW 1001 +#define IDC_CMD_MOVE_N 1002 +#define IDC_MENU_LIST 1003 +#define IDC_CMD_MOVE_NE 1003 +#define IDC_MENU_TEXT 1004 +#define IDC_CMD_MOVE_W 1004 +#define IDC_CMD_MOVE_SELF 1005 +#define IDC_CMD_MOVE_E 1006 +#define IDC_CMD_MOVE_SW 1007 +#define IDC_CMD_MOVE_S 1008 +#define IDC_CMD_MOVE_SE 1009 +#define IDC_CMD_MOVE_UP 1010 +#define IDC_CMD_MOVE_DOWN 1011 +#define IDC_CMD_5 1012 +#define IDC_CMD_A 1013 +#define IDC_CMD_B 1014 +#define IDC_CMD_C 1015 +#define IDC_CMD_D 1016 +#define IDC_CMD_E 1017 +#define IDC_CMD_F 1018 +#define IDC_CMD_G 1019 +#define IDC_CMD_H 1020 +#define IDC_CMD_I 1021 +#define IDC_CMD_J 1022 +#define IDC_CMD_K 1023 +#define IDC_CMD_L 1024 +#define IDC_CMD_M 1025 +#define IDC_CMD_N 1026 +#define IDC_CMD_O 1027 +#define IDC_CMD_P 1028 +#define IDC_CMD_Q 1029 +#define IDC_CMD_R 1030 +#define IDC_CMD_S 1031 +#define IDC_CMD_T 1032 +#define IDC_CMD_U 1033 +#define IDC_CMD_V 1034 +#define IDC_CMD_W 1035 +#define IDC_CMD_X 1036 +#define IDC_CMD_Y 1037 +#define IDC_CMD_Z 1038 +#define IDC_CMD_AA 1039 +#define IDC_CMD_BB 1040 +#define IDC_CMD_CC 1041 +#define IDC_CMD_DD 1042 +#define IDC_CMD_EE 1043 +#define IDC_CMD_FF 1044 +#define IDC_CMD_GG 1045 +#define IDC_CMD_HH 1046 +#define IDC_CMD_II 1047 +#define IDC_CMD_JJ 1048 +#define IDC_CMD_KK 1049 +#define IDC_CMD_LL 1050 +#define IDC_CMD_MM 1051 +#define IDC_CMD_NN 1052 +#define IDC_CMD_OO 1053 +#define IDC_CMD_PP 1054 +#define IDC_CMD_QQ 1055 +#define IDC_CMD_RR 1056 +#define IDC_CMD_SS 1057 +#define IDC_CMD_TT 1058 +#define IDC_CMD_UU 1059 +#define IDC_CMD_VV 1060 +#define IDC_CMD_WW 1061 +#define IDC_CMD_XX 1062 +#define IDC_CMD_YY 1063 +#define IDC_CMD_ZZ 1064 +#define IDC_CMD_FIRST 1100 +#define IDC_CMD_LAST 1300 +#define IDC_GETLIN_EDIT 1309 +#define IDC_EXTCMD_LIST 1310 +#define IDC_PLSEL_NAME 1314 +#define IDC_PLSEL_ROLE_RANDOM 1315 +#define IDC_PLSEL_RACE_RANDOM 1318 +#define IDC_PLSEL_GENDER_RANDOM 1319 +#define IDC_PLSEL_ALIGN_RANDOM 1320 +#define IDC_PLSEL_ROLE_LIST 1323 +#define IDC_PLSEL_RACE_LIST 1324 +#define IDC_PLSEL_ALIGN_LIST 1325 +#define IDC_PLSEL_GENDER_LIST 1326 +#define IDC_ABOUT_VERSION 1327 +#define IDC_ABOUT_COPYRIGHT 1328 +#define IDC_EXTRAINFO 1331 +#define IDM_SAVE 32771 +#define IDM_HELP_LONG 32772 +#define IDM_HELP_COMMANDS 32773 +#define IDM_HELP_HISTORY 32774 +#define IDM_HELP_INFO_CHAR 32775 +#define IDM_HELP_INFO_KEY 32776 +#define IDM_HELP_OPTIONS 32777 +#define IDM_HELP_OPTIONS_LONG 32778 +#define IDM_HELP_EXTCMD 32779 +#define IDM_HELP_LICENSE 32780 +#define IDM_HELP_PORTHELP 32781 +#define IDM_MAP_TILES 32782 +#define IDM_MAP_ASCII4X6 32783 +#define IDM_MAP_ASCII6X8 32784 +#define IDM_MAP_ASCII8X8 32785 +#define IDM_MAP_ASCII16X8 32786 +#define IDM_MAP_ASCII7X12 32787 +#define IDM_MAP_ASCII8X12 32788 +#define IDM_MAP_ASCII16X12 32789 +#define IDM_MAP_ASCII12X16 32790 +#define IDM_MAP_ASCII10X18 32791 +#define IDM_MAP_FIT_TO_SCREEN 32792 +#define IDM_NHMODE 32794 +#define IDM_CLEARSETTINGS 32795 +#define IDM_SETTING_AUTOLAYOUT 32796 +#define IDM_SETTING_LOCKWINDOWS 32797 #define IDM_SETTING_SCREEN_TO_CLIPBOARD 32798 -#define IDM_SETTING_SCREEN_TO_FILE 32799 -#define IDC_STATIC -1 +#define IDM_SETTING_SCREEN_TO_FILE 32799 +#define IDC_STATIC -1 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 145 -#define _APS_NEXT_COMMAND_VALUE 32800 -#define _APS_NEXT_CONTROL_VALUE 1332 -#define _APS_NEXT_SYMED_VALUE 110 +#define _APS_NEXT_RESOURCE_VALUE 145 +#define _APS_NEXT_COMMAND_VALUE 32800 +#define _APS_NEXT_CONTROL_VALUE 1332 +#define _APS_NEXT_SYMED_VALUE 110 #endif #endif diff --git a/win/win32/winMS.h b/win/win32/winMS.h index 419dd429c..1fb8ad126 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -8,18 +8,18 @@ #define WINMS_H #ifdef _MSC_VER -# if _MSC_VER >= 1400 +#if _MSC_VER >= 1400 /* Visual C 8 warning elimination */ -# ifndef _CRT_SECURE_NO_DEPRECATE +#ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE -# endif -# ifndef _SCL_SECURE_NO_DEPRECATE +#endif +#ifndef _SCL_SECURE_NO_DEPRECATE #define _SCL_SECURE_NO_DEPRECATE -# endif -# ifndef _CRT_NONSTDC_NO_DEPRECATE +#endif +#ifndef _CRT_NONSTDC_NO_DEPRECATE #define _CRT_NONSTDC_NO_DEPRECATE -# endif -# endif +#endif +#endif #endif #define WIN32_LEAN_AND_MEAN @@ -34,15 +34,15 @@ #define MAXWINDOWS 15 #endif -#define NHW_RIP 32 -#define NHW_INVEN 33 +#define NHW_RIP 32 +#define NHW_INVEN 33 #ifndef TILE_X #define TILE_X 16 #endif #define TILE_Y 16 -#define TILES_PER_LINE 40 +#define TILES_PER_LINE 40 /* tile background color */ #define TILE_BK_COLOR RGB(71, 108, 108) @@ -55,58 +55,60 @@ #define MAX_LOADSTRING 100 typedef struct mswin_nhwindow_data { - HWND win; - int type; - int dead; + HWND win; + int type; + int dead; } MSNHWinData, *PMSNHWinData; typedef struct mswin_nhwindow_app { - HINSTANCE hApp; - HWND hMainWnd; - HACCEL hAccelTable; - HWND hPopupWnd; /* current popup window */ - - MSNHWinData windowlist[MAXWINDOWS]; - - HBITMAP bmpTiles; - HBITMAP bmpPetMark; - HBITMAP bmpMapTiles; /* custom tiles bitmap */ - HBITMAP bmpRip; - HBITMAP bmpSplash; - int mapTile_X; /* tile width */ - int mapTile_Y; /* tile height */ - int mapTilesPerLine; /* number of tile per row in the bitmap */ - - boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */ - boolean bNoVScroll; /* disable cliparound for vertical grid (map) */ - - int mapDisplayModeSave; /* saved map display mode */ - - char* saved_text; - - DWORD saveRegistrySettings; /* Flag if we should save this time */ - DWORD regNetHackMode; /* NetHack mode means no Windows keys in some places */ - - LONG regMainMinX; - LONG regMainMinY; - LONG regMainMaxX; - LONG regMainMaxY; - LONG regMainLeft; - LONG regMainTop; - LONG regMainBottom; - LONG regMainRight; - DWORD regMainShowState; - - BOOL bAutoLayout; - RECT rtMapWindow; - RECT rtMsgWindow; - RECT rtStatusWindow; - RECT rtMenuWindow; - RECT rtTextWindow; - RECT rtInvenWindow; - BOOL bWindowsLocked; /* TRUE if windows are "locked" - no captions */ - - BOOL bNoSounds; /* disable sounds */ + HINSTANCE hApp; + HWND hMainWnd; + HACCEL hAccelTable; + HWND hPopupWnd; /* current popup window */ + + MSNHWinData windowlist[MAXWINDOWS]; + + HBITMAP bmpTiles; + HBITMAP bmpPetMark; + HBITMAP bmpMapTiles; /* custom tiles bitmap */ + HBITMAP bmpRip; + HBITMAP bmpSplash; + int mapTile_X; /* tile width */ + int mapTile_Y; /* tile height */ + int mapTilesPerLine; /* number of tile per row in the bitmap */ + + boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */ + boolean bNoVScroll; /* disable cliparound for vertical grid (map) */ + + int mapDisplayModeSave; /* saved map display mode */ + + char *saved_text; + + DWORD saveRegistrySettings; /* Flag if we should save this time */ + DWORD + regNetHackMode; /* NetHack mode means no Windows keys in some places + */ + + LONG regMainMinX; + LONG regMainMinY; + LONG regMainMaxX; + LONG regMainMaxY; + LONG regMainLeft; + LONG regMainTop; + LONG regMainBottom; + LONG regMainRight; + DWORD regMainShowState; + + BOOL bAutoLayout; + RECT rtMapWindow; + RECT rtMsgWindow; + RECT rtStatusWindow; + RECT rtMenuWindow; + RECT rtTextWindow; + RECT rtInvenWindow; + BOOL bWindowsLocked; /* TRUE if windows are "locked" - no captions */ + + BOOL bNoSounds; /* disable sounds */ } NHWinApp, *PNHWinApp; #define E extern @@ -117,7 +119,7 @@ E struct window_procs mswin_procs; #undef E /* Some prototypes */ -void mswin_init_nhwindows(int* argc, char** argv); +void mswin_init_nhwindows(int *argc, char **argv); void mswin_player_selection(void); void mswin_askname(void); void mswin_get_nh_event(void); @@ -131,28 +133,27 @@ void mswin_destroy_nhwindow(winid wid); void mswin_curs(winid wid, int x, int y); void mswin_putstr(winid wid, int attr, const char *text); void mswin_putstr_ex(winid wid, int attr, const char *text, int); -void mswin_display_file(const char *filename,BOOLEAN_P must_exist); +void mswin_display_file(const char *filename, BOOLEAN_P must_exist); void mswin_start_menu(winid wid); -void mswin_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); +void mswin_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); void mswin_end_menu(winid wid, const char *prompt); -int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); +int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); void mswin_update_inventory(void); void mswin_mark_synch(void); void mswin_wait_synch(void); void mswin_cliparound(int x, int y); -void mswin_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph); +void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph); void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str); -int mswin_nhgetch(void); -int mswin_nh_poskey(int *x, int *y, int *mod); +int mswin_nhgetch(void); +int mswin_nh_poskey(int *x, int *y, int *mod); void mswin_nhbell(void); -int mswin_doprev_message(void); -char mswin_yn_function(const char *question, const char *choices, - CHAR_P def); +int mswin_doprev_message(void); +char mswin_yn_function(const char *question, const char *choices, CHAR_P def); void mswin_getlin(const char *question, char *input); -int mswin_get_ext_cmd(void); +int mswin_get_ext_cmd(void); void mswin_number_pad(int state); void mswin_delay_output(void); void mswin_change_color(void); @@ -162,17 +163,19 @@ void mswin_end_screen(void); void mswin_outrip(winid wid, int how, time_t when); void mswin_preference_update(const char *pref); char *mswin_getmsghistory(BOOLEAN_P init); -void mswin_putmsghistory(const char * msg,BOOLEAN_P); +void mswin_putmsghistory(const char *msg, BOOLEAN_P); #ifdef STATUS_VIA_WINDOWPORT void mswin_status_init(void); void mswin_status_finish(void); -void mswin_status_enablefield(int fieldidx, const char *nm, const char *fmt, boolean enable); +void mswin_status_enablefield(int fieldidx, const char *nm, const char *fmt, + boolean enable); void mswin_status_update(int idx, genericptr_t ptr, int chg, int percent); -# ifdef STATUS_HILITES -void mswin_status_threshold(int fldidx, int thresholdtype, anything threshold, int behavior, int under, int over); -# endif /* STATUS_HILITES */ +#ifdef STATUS_HILITES +void mswin_status_threshold(int fldidx, int thresholdtype, anything threshold, + int behavior, int under, int over); +#endif /* STATUS_HILITES */ #endif /*STATUS_VIA_WINDOWPORT*/ /* helper function */ @@ -181,13 +184,11 @@ winid mswin_winid_from_type(int type); winid mswin_winid_from_handle(HWND hWnd); void mswin_window_mark_dead(winid wid); void bail(const char *mesg); -void nhapply_image_transparent( - HDC hDC, int x, int y, int width, int height, - HDC sourceDC, int s_x, int s_y, int s_width, int s_height, - COLORREF cTransparent -); +void nhapply_image_transparent(HDC hDC, int x, int y, int width, int height, + HDC sourceDC, int s_x, int s_y, int s_width, + int s_height, COLORREF cTransparent); -void mswin_popup_display(HWND popup, int* done_indicator); +void mswin_popup_display(HWND popup, int *done_indicator); void mswin_popup_destroy(HWND popup); void mswin_read_reg(void); @@ -199,7 +200,6 @@ void mswin_update_window_placement(int type, LPRECT rt); int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type); - extern HBRUSH menu_bg_brush; extern HBRUSH menu_fg_brush; extern HBRUSH text_bg_brush; @@ -218,41 +218,28 @@ extern COLORREF status_fg_color; extern COLORREF message_bg_color; extern COLORREF message_fg_color; - #define SYSCLR_TO_BRUSH(x) ((HBRUSH)((x) + 1)) /* unicode stuff */ -#define NH_CODEPAGE (SYMHANDLING(H_IBM)?GetOEMCP():GetACP()) +#define NH_CODEPAGE (SYMHANDLING(H_IBM) ? GetOEMCP() : GetACP()) #ifdef _UNICODE - #define NH_W2A(w, a, cb) ( WideCharToMultiByte( \ - NH_CODEPAGE, \ - 0, \ - (w), \ - -1, \ - (a), \ - (cb), \ - NULL, \ - NULL), (a) ) - - #define NH_A2W(a, w, cb) ( MultiByteToWideChar( \ - NH_CODEPAGE, \ - 0, \ - (a), \ - -1, \ - (w), \ - (cb)), (w) ) +#define NH_W2A(w, a, cb) \ + (WideCharToMultiByte(NH_CODEPAGE, 0, (w), -1, (a), (cb), NULL, NULL), (a)) + +#define NH_A2W(a, w, cb) \ + (MultiByteToWideChar(NH_CODEPAGE, 0, (a), -1, (w), (cb)), (w)) #else - #define NH_W2A(w, a, cb) (strncpy((a), (w), (cb))) +#define NH_W2A(w, a, cb) (strncpy((a), (w), (cb))) - #define NH_A2W(a, w, cb) (strncpy((w), (a), (cb))) +#define NH_A2W(a, w, cb) (strncpy((w), (a), (cb))) #endif /* map mode macros */ -#define IS_MAP_FIT_TO_SCREEN(mode) ((mode)==MAP_MODE_ASCII_FIT_TO_SCREEN || \ - (mode)==MAP_MODE_TILES_FIT_TO_SCREEN ) - -#define IS_MAP_ASCII(mode) ((mode)!=MAP_MODE_TILES && (mode)!=MAP_MODE_TILES_FIT_TO_SCREEN) +#define IS_MAP_FIT_TO_SCREEN(mode) \ + ((mode) == MAP_MODE_ASCII_FIT_TO_SCREEN \ + || (mode) == MAP_MODE_TILES_FIT_TO_SCREEN) +#define IS_MAP_ASCII(mode) \ + ((mode) != MAP_MODE_TILES && (mode) != MAP_MODE_TILES_FIT_TO_SCREEN) #endif /* WINMS_H */ - -- 2.50.1