diff -Nurd --exclude-from=diff_ign.txt nh343orig/README.nh343jl nh343jl/README.nh343jl --- nh343orig/README.nh343jl 1970-01-01 02:00:00.000000000 +0200 +++ nh343jl/README.nh343jl 2004-03-29 16:40:58.000000000 +0300 @@ -0,0 +1,104 @@ +nh343jl.diff is a diff for Nethack 3.4.3, containing the following +patches (better explanations and diffs for most individual patches +available at http://www.netsonic.fi/~walker/nethack.html) : + +- Tom Friedetzky's "dump character" patch somewhat modified by me, Darshan + Shaligram and some others (include/decl.h, include/extern.h, + src/botl.c, src/cmd.c, src/decl.c, src/display.c, src/end.c, + src/invent.c, src/options.c, src/spell.c, src/topten.c, src/weapon.c, + win/tty/wintty.c, dat/opthelp, doc/Guidebook.*) +- record the number of moves, and mark wizard/explore mode games in + logfile / record (src/topten.c) +- show extincted monsters among the genocided ones and the numbers of + different monsters born in the "vanquished" list after the numbers killed. + (Wingnut, Jukka Lahtinen) + (include/flag.h, src/cmd.c, src/end.c, src/options.c, + dat/opthelp, dat/wizhelp, doc/Guidebook.*) +- paranoid, by David Damerell, Jonathan Nieder, Jukka Lahtinen and + Stanislav Traykov + (include/flag.h, src/cmd.c, src/do_wear.c, src/end.c, src/options.c, + src/uhitm.c, dat/opthelp, doc/Guidebook.*) +- Ralph Churchill's colored Hp monitor (src/botl.c) +- Compile-time options for not writing #quit games to the record file + (FORGET_QUITTER) and not writing explore mode games to the logfile + (PROMPT_LOGEXP). (src/end.c, src/topten.c) +- The compile time setting SCORE_ON_BOTL is overriden in the magic number + in the bones and save files, so compatibility with the official binaries + can be kept regardless of that option. (src/version.c) +- Allow definitions for variable playground locations, such as separate + bones and levels directories, for OS/2. Use bones in directory "bones" + under the playground directory in unix systems. + (include/os2conf.h, src/files.c, sys/share/pcunix.c) +- prompt for entering explore mode at death (include/flag.h, src/cmd.c, + src/end.c, src/options.c, dat/opthelp, doc/Guidebook.*) +- Jeroen Demeyer's sortloot patch to optionally sort the pickup lists to + ascending order of descriptions within each item class + (dat/opthelp, doc/Guidebook.*, include/extern.h, include/flag.h, + src/end.c, src/invent.c, src/objnam.c, src/options.c, src/pickup.c) +- Pasi Kallinen's menucolor patch (http://www.cs.joensuu.fi/~pkalli) + (dat/opthelp, include/color.h, include/extern.h, include/flag.h, + src/decl.c, src/files.c, src/options.c, src/save.c, + win/tty/wintty.c) +- Pasi Kallinen's window edge patch, optionally aligning menus and text + windows left instead of right in the tty interface. + http://cs.joensuu.fi/~pkalli/code/nh342-winedge.diff + (doc/Guidebook.*, dat/opthelp, include/flag.h, src/options.c, + win/tty/wintty.c) +- Stanislav Traykov's patch for additional item categories in the menus + http://home.in.tum.de/~traykovs/nethack/ + (dat/opthelp, doc/Guidebook.*, include/extern.h, include/flag.h, + include/hack.h, include/objclass.h, include/obj.h, src/do.c, + src/invent.c, src/options.c, src/pickup.c) +- Sam Dennis's patch to allow the #adjust command to split stacks + (src/invent.c) +- Pasi Kallinen's helplessness patch that replaces the "while helpless" + text to be written to the record/logfile with the reason of + helplessness + (include/decl.h, include/extern.h, src/allmain.c, src/apply.c, + src/artifact.c, src/ball.c, src/decl.c, src/detect.c, src/dig.c, + src/dothrow.c, src/do_wear.c, src/eat.c, src/end.c, src/engrave.c, + src/explode.c, src/hack.c, src/mcastu.c, src/mhitu.c, src/mthrowu.c, + src/muse.c, src/pickup.c, src/polyself.c, src/potion.c, src/pray.c, + src/priest.c, src/save.c, src/sounds.c, src/spell.c, src/steal.c, + src/teleport.c, src/timeout.c, src/trap.c, src/uhitm.c, src/vault.c, + src/zap.c) + +Most of these patches need some #define in include/config.h to get +compiled in. I included a diff for config.h to set them all on. + +On unix systems with the dump patch, it is recommended for security reasons +to define the DUMP_FN in include/config.h to prevent users from defining +the dumpfile name themselves, but here it is commented out because there is +no single directory name that would be good for EVERY patched Nethack +installation to have the dump files in and I try to keep this patch +collection generic. + +If you find any bugs in these patches, please let me know. +Mail sent to jukkal@despammed.com should get forwarded to whatever my +current address is. And I read rec.games.roguelike.nethack regularly. + +Of course, if you have some other changes made to the same files, you may +need to edit some of the source files to insert some chunks of this diff +manually. Check especially include/config.h for options that you may like +to be set differently from my setup. + +Some of the patches also need some options defined in your configuration file +(~/.nethackrc in Linux and other unix-like systems, nethack.cnf in OS/2, +defaults.nh in NT, maybe something else on some other platforms) to take +effect. To turn all of thse on, set + +OPTIONS=dumpfile:%n.nh (for the dump character patch in single user systems) +OPTIONS=showborn (to see the numbers of monsters born) +OPTIONS=paranoid_hit,paranoid_quit,paranoid_remove (for the paranoid patch) +OPTIONS=death_explore (to be prompted for explore mode when you die) +OPTIONS=sortloot:loot (for the sortloot patch) +OPTIONS=menucolors (to turn on the menucolor option) +MENUCOLOR="* blessed *"=green (some menucolor definition examples) +MENUCOLOR="* holy *"=green (if you have MENU_COLOR_REGEX defined +MENUCOLOR="* cursed *"=red in config.h, leave the asterisks out from +MENUCOLOR="* unholy *"=red the beginning and ending of the options) +MENUCOLOR="* cursed .* (being worn)*"=orange&underline + +-- +Jukka Lahtinen, 29.3.2004 +jukkal@despammed.com diff -ru nethack-3.4.3/dat/opthelp nethack-3.4.3-new/dat/opthelp --- nethack-3.4.3/dat/opthelp 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/dat/opthelp 2004-06-13 02:55:44.000000000 +0200 @@ -51,6 +51,10 @@ There are further boolean options controlled by compilation flags. +Boolean option if ITEMCAT was set at compile time: +like_swimming allow category "Items known to be Rustprone" in + selection menus [FALSE] + Boolean option if INSURANCE was set at compile time: checkpoint save game state after each level change, for possible [TRUE] recovery after program crash @@ -61,6 +65,9 @@ Boolean option if MFLOPPY was set at compile time: checkspace check free disk space before writing files to disk [TRUE] +Boolean option if DEATH_EXPLORE was set at compile time: +death_explore prompt for changing to explore mode when you die [FALSE] + Boolean option if EXP_ON_BOTL was set at compile time: showexp display your accumulated experience points [FALSE] @@ -71,6 +78,22 @@ color use different colors for objects on screen [TRUE for micros] hilite_pet display pets in a highlighted manner [FALSE] +Boolean option if TEXTCOLOR and MENU_COLOR were set at compile time: +menucolors use different colors for menus [TRUE for micros] + +Boolean option if PARANOID was set at compile time: +paranoid_hit ask for explicit 'yes' when hitting peacefuls [FALSE] + +Boolean option if PARANOID was set at compile time: +paranoid_quit ask for explicit 'yes' when quitting [FALSE] + +Boolean option if PARANOID was set at compile time: +paranoid_remove always show menu with the T and R commands [FALSE] + +Boolean option if SHOW_BORN was set at compile time: +showborn show numbers of created monsters after the number + vanquished [FALSE] + Boolean option if TIMED_DELAY was set at compile time (tty interface only): timed_delay on unix and VMS, use a timer instead of sending extra screen output when attempting to pause for @@ -82,6 +105,9 @@ start of the game. Doing so enhances performance of the tile graphics, but uses more memory. [TRUE] +Boolean option if WIN_EDGE was set at compile time (tty interface only): +win_edge align menus and text windows left instead of right [FALSE] + Any Boolean option can be negated by prefixing it with a '!' or 'no'. @@ -92,6 +118,9 @@ boulder override the default boulder symbol with another default: [`] disclose the types of information you want offered at the end of the game [ni na nv ng nc] +dumpfile the name of the file where to dump the disclosure information + when the game ends (only if the patch has been compiled in) + [none] fruit the name of a fruit you enjoy eating [slime mold] (basically a whimsy which NetHack uses from time to time). menustyle user interface for selection of multiple objects: @@ -120,6 +149,11 @@ scores the parts of the score list you wish to see when the game ends You choose a combination of top scores, scores around the top scores, and all of your own scores. [!own/3 top/2 around] +sortloot controls the sortloot patch [none]: + full -- All pickup lists of items are sorted by item description + loot -- When inventory letters are shown, has no effect. + Otherwise sorts by description + none -- Works the traditional way, like without the patch suppress_alert disable various version-specific warnings about changes in game play or the user interface, such as notification given for the 'Q' command that quitting is now done via #quit @@ -169,6 +203,21 @@ still denote your gender using the "male" and "female" options, the "gender" option will take precedence. [RANDOM] horsename the name of your first horse [NONE] +menucolor Set colors for menus. (menucolor:"regex_string"=color) + If boolean option ``menucolors'' is true, menus will be shown + with different colors. + For example, setting ``menucolor:" blessed "=green'' shows + all lines in a menu with the text " blessed " in green. + The string is matched using regular expressions. + Valid values for the color are black, red, green, brown, blue, + magenta, cyan, gray, orange, lightgreen, yellow, lightblue, + lightmagenta, lightcyan and white. + You can define menucolor as many times as you wish; those + defined later will take precedence. + Instead of using this with OPTIONS, consider using + MENUCOLOR="regex_string"=color in the configuration file. + Setting menucolor has effect only if TEXTCOLOR and MENU_COLOR + were set at compile time. [NONE] menu_* create single character accelerators for menu commands. Below is a list of all commands. Each is followed by a list of window- ports that implement them: 'x' is X11, 't' is tty, 'g' is Gem, diff -ru nethack-3.4.3/dat/wizhelp nethack-3.4.3-new/dat/wizhelp --- nethack-3.4.3/dat/wizhelp 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/dat/wizhelp 2004-06-13 02:55:44.000000000 +0200 @@ -16,6 +16,7 @@ #panic == panic test #polyself == polymorph self #seenv == show seen vectors +#showkills == show numbers of monsters killed #stats == show memory statistics #timeout == look at timeout queue #vision == show vision array diff -ru nethack-3.4.3/doc/Guidebook.mn nethack-3.4.3-new/doc/Guidebook.mn --- nethack-3.4.3/doc/Guidebook.mn 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/doc/Guidebook.mn 2004-06-13 02:55:44.000000000 +0200 @@ -1723,6 +1723,8 @@ .lp "confirm " Have user confirm attacks on pets, shopkeepers, and other peaceable creatures (default on). +.lp death_explore +Prompt for changing to explore mode when your character dies. .lp DECgraphics Use a predefined selection of characters from the DEC VT-xxx/DEC Rainbow/ANSI line-drawing character set to display the dungeon/effects/traps @@ -1770,6 +1772,12 @@ .lp dogname Name your starting dog (ex. ``dogname:Fang''). Cannot be set with the `O' command. +.lp dumpfile +The name of a file where the disclosure information is written when the +game ends. You may use the macro %n that will be replaced with the name +of your player character. The game must have write permissions to the +directory where the file is written. Normally /tmp may be used for unix +systems. .lp dungeon Set the graphics symbols for displaying the dungeon (default \&``\ |--------||.-|++##.##<><>_|\e\e#{}.}..##\ #}''). @@ -1874,6 +1882,8 @@ Ignore interrupt signals, including breaks (default off). .lp legacy Display an introductory message when starting the game (default on). +.lp like_swimming +Allow category ``Items known to be Rustprone'' in selection menus. .lp lit_corridor Show corridor squares seen by night vision or a light source held by your character as lit (default off). @@ -2027,6 +2037,15 @@ The value of this option should be a string containing the symbols for the various object types. Any omitted types are filled in at the end from the previous order. +.lp paranoid_hit +If true, asks you to type the word ``yes'' when hitting any peaceful +monster, not just the letter ``y''. +.lp paranoid_quit +If true, asks you to type the word ``yes'' when quitting or entering +Explore mode, not just the letter ``y''. +.lp paranoid_remove +If true, always show menu with the R and T commands even when there is +only one item to remove or take off. .lp perm_invent If true, always display your current inventory in a window. This only makes sense for windowing system interfaces that implement this feature. @@ -2088,6 +2107,10 @@ Control what parts of the score list you are shown at the end (ex. ``scores:5 top scores/4 around my score/own scores''). Only the first letter of each category (`t', `a', or `o') is necessary. +.lp showborn +When the game ends, show the number of each monster created +in the "Vanquished creatures" list, if it differs from the +number of those monsters killed. .lp showexp Show your accumulated experience points on bottom line (default off). .lp showrace @@ -2098,6 +2121,18 @@ Show your approximate accumulated score on bottom line (default off). .lp "silent " Suppress terminal beeps (default on). +.lp sortloot +Controls the behavior of the sortloot patch that sorts pickup lists for +inventory and #loot commands and some others. +The possible values are: +.sd +.si +full - always sort the lists; +loot - only sort the lists that don't use inventory + letters, like with the #loot and pickup commands; +none - show lists the traditional way without sorting. +.ei +.ed .lp sortpack Sort the pack contents by type when displaying inventory (default on). .lp sound @@ -2157,6 +2192,8 @@ Select which windowing system to use, such as ``tty'' or ``X11'' (default depends on version). Cannot be set with the `O' command. +.lp win_edge +Align menus and text windows in tty left instead of right. (default off) .hn 2 Window Port Customization options .pg diff -ru nethack-3.4.3/doc/Guidebook.tex nethack-3.4.3-new/doc/Guidebook.tex --- nethack-3.4.3/doc/Guidebook.tex 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/doc/Guidebook.tex 2004-06-13 02:55:44.000000000 +0200 @@ -2161,6 +2161,9 @@ Have user confirm attacks on pets, shopkeepers, and other peaceable creatures (default on). %.lp +\item[\ib{death_explore}] +Prompt for changing to explore mode when your character dies. +%.lp \item[\ib{DECgraphics}] Use a predefined selection of characters from the DEC VT-xxx/DEC Rainbow/ANSI line-drawing character set to display the dungeon/effects/traps @@ -2209,6 +2212,13 @@ Name your starting dog (ex.\ ``{\tt dogname:Fang}''). Cannot be set with the `{\tt O}' command. %.lp +\item[\ib{dumpfile}] +The name of a file where the disclosure information is written when the +game ends. You may use the macro %n that will be replaced with the name +of your player character. The game must have write permissions to the +directory where the file is written. Normally /tmp may be used for unix +systems. +%.lp \item[\ib{dungeon}] Set the graphics symbols for displaying the dungeon (default ``\verb& |--------||.-|++##& \verb&.##<><>_|\\#{}.}..## #}&''). @@ -2321,6 +2331,9 @@ \item[\ib{legacy}] Display an introductory message when starting the game (default on). %.lp +\item[\ib{like\_swimming}] +Allow category ``Items known to be Rustprone'' in selection menus. +%.lp \item[\ib{lit\_corridor}] Show corridor squares seen by night vision or a light source held by your character as lit (default off). @@ -2486,6 +2499,18 @@ containing the symbols for the various object types. Any omitted types are filled in at the end from the previous order. %.lp +\item[\ib{paranoid\_hit}] +If true, asks you to type the word ``yes'' when hitting any peaceful +monster, not just the letter ``y''. +%.lp +\item[\ib{paranoid\_quit}] +If true, asks you to type the word ``yes'' when quitting or entering +Explore mode, not just the letter ``y''. +%.lp +\item[\ib{paranoid\_remove}] +If true, always show menu with the R and T commands even when there is +only one item to remove or take off. +%.lp \item[\ib{perm\_invent}] If true, always display your current inventory in a window. This only makes sense for windowing system interfaces that implement this feature. @@ -2559,6 +2584,11 @@ ``{\tt scores:5top scores/4around my score/own scores}''). Only the first letter of each category (`{\tt t}', `{\tt a}' or `{\tt o}') is necessary. %.lp +\item[\ib{showborn}] +When the game ends, show the number of each monster created +in the ``Vanquished creatures'' list, if it differs from the +number of those monsters killed. +%.lp \item[\ib{showexp}] Show your accumulated experience points on bottom line (default off). %.lp @@ -2573,6 +2603,21 @@ \item[\ib{silent}] Suppress terminal beeps (default on). %.lp +\item[\ib{sortloot}] +Controls the behavior of the sortloot patch that sorts pickup lists for +inventory and \#loot commands and some others. + +The possible values are: +%.sd +%.si +{\tt full} --- always sort the lists;\\ +{\tt loot} --- only sort the lists that don't use inventory + letters, like with the \#loot and pickup commands;\\ +{\tt none} --- show lists the traditional way without sorting. +%.ei +%.ed +%.lp +The default is 'none', the way an unpatched game works. \item[\ib{sortpack}] Sort the pack contents by type when displaying inventory (default on). %.lp @@ -2640,6 +2685,9 @@ Select which windowing system to use, such as ``{\tt tty}'' or ``{\tt X11}'' (default depends on version). Cannot be set with the `{\tt O}' command. +%.lp +\item[\ib{win_edge}] +Align menus and text windows in tty left instead of right. (default off) \elist %.hn 2 diff -ru nethack-3.4.3/doc/Guidebook.txt nethack-3.4.3-new/doc/Guidebook.txt --- nethack-3.4.3/doc/Guidebook.txt 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/doc/Guidebook.txt 2004-06-13 02:55:44.000000000 +0200 @@ -2223,6 +2223,9 @@ Have user confirm attacks on pets, shopkeepers, and other peaceable creatures (default on). + death_explore + Prompt for changing to explore mode when your character dies. + DECgraphics Use a predefined selection of characters from the DEC VT- xxx/DEC Rainbow/ANSI line-drawing character set to display the @@ -2274,6 +2277,13 @@ Name your starting dog (ex. ``dogname:Fang''). Cannot be set with the `O' command. + dumpfile + The name of a file where the disclosure information is + written when the game ends. You may use the macro %n that + will be replaced with the name of your player character. + The game must have write permissions to the directory where + the file is written. Normally /tmp may be used for unixes. + dungeon Set the graphics symbols for displaying the dungeon (default `` |--------||.-|++##.##<><>_|\\#{}.}..## #}''). The dungeon @@ -2413,6 +2423,10 @@ Display an introductory message when starting the game (default on). + like_swimming + Allow category "Items known to be Rustprone" in selection + menus. + lit_corridor Show corridor squares seen by night vision or a light source held by your character as lit (default off). @@ -2607,6 +2621,18 @@ Any omitted types are filled in at the end from the previous order. + paranoid_hit + If true, asks you to type the word ``yes'' when hitting any + peaceful monster, not just the letter ``y''. + + paranoid_quit + If true, asks you to type the word ``yes'' when quitting or + entering Explore mode, not just the letter ``y''. + + paranoid_remove + If true, always show menu with the R and T commands even when + there is only one item to remove or take off. + perm_invent If true, always display your current inventory in a window. This only makes sense for windowing system interfaces that im- @@ -2693,6 +2719,11 @@ Only the first letter of each category (`t', `a', or `o') is necessary. + showborn + When the game ends, show the number of each monster created + in the "Vanquished creatures" list, if it differs from the + number of those monsters killed. + showexp Show your accumulated experience points on bottom line (default off). @@ -2723,6 +2754,18 @@ silent Suppress terminal beeps (default on). + sortloot + Controls the behavior of the sortloot patch that sorts + pickup lists for inventory and #loot commands and some + others. + The possible values are: + + full - always sort the lists + loot - only sort the lists that don't use inventory + letters, like with the #loot and pickup commands + none - show lists the traditional way without sorting + The default is 'none', the way an unpatched game works. + sortpack Sort the pack contents by type when displaying inventory (de- fault on). @@ -2808,6 +2851,10 @@ ``X11'' (default depends on version). Cannot be set with the `O' command. + win_edge + Align menus and text windows in tty left instead of right. + (default off) + 9.5. Window Port Customization options Here are explanations of the various options that are used diff -ru nethack-3.4.3/include/color.h nethack-3.4.3-new/include/color.h --- nethack-3.4.3/include/color.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/color.h 2004-06-13 02:55:44.000000000 +0200 @@ -5,6 +5,12 @@ #ifndef COLOR_H #define COLOR_H +#ifdef MENU_COLOR +# ifdef MENU_COLOR_REGEX +# include +# endif +#endif + /* * The color scheme used is tailored for an IBM PC. It consists of the * standard 8 colors, folowed by their bright counterparts. There are @@ -49,4 +55,16 @@ #define DRAGON_SILVER CLR_BRIGHT_CYAN #define HI_ZAP CLR_BRIGHT_BLUE +#ifdef MENU_COLOR +struct menucoloring { +# ifdef MENU_COLOR_REGEX + struct re_pattern_buffer match; +# else + char *match; +# endif + int color, attr; + struct menucoloring *next; +}; +#endif /* MENU_COLOR */ + #endif /* COLOR_H */ diff -ru nethack-3.4.3/include/config.h nethack-3.4.3-new/include/config.h --- nethack-3.4.3/include/config.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/config.h 2004-06-13 02:55:44.000000000 +0200 @@ -349,7 +349,32 @@ */ /*#define GOLDOBJ */ /* Gold is kept on obj chains - Helge Hafting */ -/*#define AUTOPICKUP_EXCEPTIONS */ /* exceptions to autopickup */ +#define AUTOPICKUP_EXCEPTIONS /* exceptions to autopickup */ +#define DUMP_LOG /* Dump game end information to a file */ +/* #define DUMP_FN "/tmp/%n.nh" */ /* Fixed dumpfile name, if you want + * to prevent definition by users */ +#define LOG_MOVES /* Move count and wiz/exp mode info in logfile */ +#define SHOW_BORN /* Show numbers of each monster created */ +#define SHOW_EXTINCT /* Show extinct species in the genocide list */ +#define SORTLOOT /* Enable alphabetical sorting of pickup lists */ +#define PARANOID /* Require "yes" for quit or switch to explore */ +#ifdef TTY_GRAPHICS +# define HPMON /* Color hp monitor */ +# define MENU_COLOR +/*# define MENU_COLOR_REGEX */ +/* if MENU_COLOR_REGEX is defined, use regular expressions (GNU regex.h) + * otherwise use pmatch() to match menu color lines. + * pmatch() provides basic globbing: '*' and '?' wildcards. + */ +# define WIN_EDGE /* windows aligned left&top */ +#endif +#define FORGET_QUITTER /* No record entry for quitters */ +#define PROMPT_LOGEXP /* Prompt for log entry in wizard or explore mode */ +#define DEATH_EXPLORE /* Prompt for explore mode on death */ +#define ITEMCAT /* Additional item categories */ +#define ITEMCAT_JP /* "just picked" category */ +#define ADJSPLIT /* splittable #adjust command */ +#define HELPLESS /* "while helpless" patch */ /* End of Section 5 */ diff -ru nethack-3.4.3/include/decl.h nethack-3.4.3-new/include/decl.h --- nethack-3.4.3/include/decl.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/decl.h 2004-06-13 02:55:44.000000000 +0200 @@ -27,6 +27,9 @@ E NEARDATA int bases[MAXOCLASSES]; E NEARDATA int multi; +#ifdef HELPLESS +E char multi_txt[BUFSZ]; +#endif #if 0 E NEARDATA int warnlevel; #endif @@ -184,6 +187,9 @@ E long done_money; #endif E char killer_buf[BUFSZ]; +#ifdef DUMP_LOG +E char dump_fn[]; /* dumpfile name (dump patch) */ +#endif E const char *configfile; E NEARDATA char plname[PL_NSIZ]; E NEARDATA char dogname[]; diff -ru nethack-3.4.3/include/extern.h nethack-3.4.3-new/include/extern.h --- nethack-3.4.3/include/extern.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/extern.h 2004-06-13 02:56:01.000000000 +0200 @@ -131,6 +131,10 @@ E int FDECL(describe_level, (char *)); E const char *FDECL(rank_of, (int,SHORT_P,BOOLEAN_P)); E void NDECL(bot); +#ifdef DUMP_LOG +E void FDECL(bot1str, (char *)); +E void FDECL(bot2str, (char *)); +#endif /* ### cmd.c ### */ @@ -166,6 +170,10 @@ E int NDECL(extcmd_via_menu); E void FDECL(enlightenment, (int)); E void FDECL(show_conduct, (int)); +#ifdef DUMP_LOG +E void FDECL(dump_enlightenment, (int)); +E void FDECL(dump_conduct, (int)); +#endif E int FDECL(xytod, (SCHAR_P,SCHAR_P)); E void FDECL(dtoxy, (coord *,int)); E int FDECL(movecmd, (CHAR_P)); @@ -281,6 +289,9 @@ E void FDECL(row_refresh, (int,int,int)); E void NDECL(cls); E void FDECL(flush_screen, (int)); +#ifdef DUMP_LOG +E void NDECL(dump_screen); +#endif 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)); @@ -553,6 +564,10 @@ #if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) E void FDECL(done, (int)); E void FDECL(container_contents, (struct obj *,BOOLEAN_P,BOOLEAN_P)); +#ifdef DUMP_LOG +E void FDECL(dump, (char *, char *)); +E void FDECL(do_containerconts, (struct obj *,BOOLEAN_P,BOOLEAN_P,BOOLEAN_P)); +#endif E void FDECL(terminate, (int)); E int NDECL(num_genocides); @@ -694,7 +709,11 @@ E int NDECL(dopickup); E void NDECL(lookaround); E int NDECL(monster_nearby); +#ifdef HELPLESS +E void FDECL(nomul, (int, const char *)); +#else E void FDECL(nomul, (int)); +#endif E void FDECL(unmul, (const char *)); E void FDECL(losehp, (int,const char *,BOOLEAN_P)); E int NDECL(weight_cap); @@ -790,6 +809,9 @@ 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)); +#ifdef DUMP_LOG +E char FDECL(dump_inventory, (const char *,BOOLEAN_P)); +#endif 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 *)); @@ -1360,6 +1382,9 @@ E boolean FDECL(not_fully_identified, (struct obj *)); E char *FDECL(corpse_xname, (struct obj *,BOOLEAN_P)); E char *FDECL(cxname, (struct obj *)); +#ifdef SORTLOOT +E char *FDECL(cxname2, (struct obj *)); +#endif E char *FDECL(killer_xname, (struct obj *)); E const char *FDECL(singular, (struct obj *,char *(*)(OBJ_P))); E char *FDECL(an, (const char *)); @@ -1405,6 +1430,9 @@ E int FDECL(add_autopickup_exception, (const char *)); E void NDECL(free_autopickup_exceptions); #endif /* AUTOPICKUP_EXCEPTIONS */ +#ifdef MENU_COLOR +E boolean FDECL(add_menu_coloring, (char *)); +#endif /* MENU_COLOR */ /* ### pager.c ### */ @@ -1483,6 +1511,13 @@ E int FDECL(in_container, (struct obj *)); E int FDECL(out_container, (struct obj *)); #endif +#ifdef ITEMCAT_JP +E void FDECL(jpick_free, (struct obj *)); +#endif +#ifdef ITEMCAT_AP +E int FDECL(is_autopicked, (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, @@ -2237,6 +2272,9 @@ E int NDECL(abon); E int NDECL(dbon); E int NDECL(enhance_weapon_skill); +#ifdef DUMP_LOG +E void NDECL(dump_weapon_skill); +#endif E void FDECL(unrestrict_weapon_skill, (int)); E void FDECL(use_skill, (int,int)); E void FDECL(add_weapon_skill, (int)); Only in nethack-3.4.3-new/include: extern.h.orig diff -ru nethack-3.4.3/include/flag.h nethack-3.4.3-new/include/flag.h --- nethack-3.4.3/include/flag.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/flag.h 2004-06-13 02:56:01.000000000 +0200 @@ -155,6 +155,9 @@ */ struct instance_flags { +#ifdef ITEMCAT + boolean like_swimming; /* category r - Items known to be Rustprone */ +#endif /* ITEMCAT */ boolean cbreak; /* in cbreak mode, rogue format */ boolean DECgraphics; /* use DEC VT-xxx extended character set */ boolean echo; /* 1 to echo characters */ @@ -183,6 +186,12 @@ char prevmsg_window; /* type of old message window to use */ boolean extmenu; /* extended commands use menu interface */ #endif +#ifdef MENU_COLOR + boolean use_menu_color; /* use color in menus; only if wc_color */ +#endif +#ifdef WIN_EDGE + boolean win_edge; /* are the menus aligned left&top */ +#endif #ifdef MFLOPPY boolean checkspace; /* check disk space before writing files */ /* (in iflags to allow restore after moving @@ -216,6 +225,20 @@ boolean lan_mail; /* mail is initialized */ boolean lan_mail_fetched; /* mail is awaiting display */ #endif +#ifdef SHOW_BORN + boolean show_born; /* show numbers of created monsters */ +#endif +#ifdef SORTLOOT + char sortloot; /* sort items to loot alphabetically */ +#endif +#ifdef PARANOID + boolean paranoid_hit; /* Ask for 'yes' when hitting peacefuls */ + boolean paranoid_quit; /* Ask for 'yes' when quitting */ + boolean paranoid_remove; /* Always show menu for 'T' and 'R' */ +#endif +#ifdef DEATH_EXPLORE + boolean death_expl; /* prompt for explore mode at death */ +#endif /* * Window capability support. */ diff -ru nethack-3.4.3/include/hack.h nethack-3.4.3-new/include/hack.h --- nethack-3.4.3/include/hack.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/hack.h 2004-06-13 02:56:01.000000000 +0200 @@ -169,6 +169,16 @@ #define BUC_UNCURSED 0x200 #define BUC_UNKNOWN 0x400 #define BUC_ALLBKNOWN (BUC_BLESSED|BUC_CURSED|BUC_UNCURSED) +#ifdef ITEMCAT +#define UNIDENTIFIED 0x800 +#define RUSTPRONE 0x1000 +#endif +#ifdef ITEMCAT_JP +#define JUSTPICKED 0x2000 +#endif +#ifdef ITEMCAT_AP +#define AUTOPICKED 0x4000 +#endif #define ALL_TYPES_SELECTED -2 /* Flags to control find_mid() */ diff -ru nethack-3.4.3/include/objclass.h nethack-3.4.3-new/include/objclass.h --- nethack-3.4.3/include/objclass.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/objclass.h 2004-06-13 02:56:01.000000000 +0200 @@ -70,6 +70,14 @@ /* primary damage: fire/rust/--- */ /* is_flammable(otmp), is_rottable(otmp) in mkobj.c */ #define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON) +#ifdef ITEMCAT +/* is rustprone, and rust matters (is displayed in inventory listing) */ +#define is_rustprone2(otmp) (is_rustprone(otmp) && (otmp->oclass==WEAPON_CLASS || otmp->oclass==ARMOR_CLASS || otmp->oclass==TOOL_CLASS || otmp->oclass==WAND_CLASS || otmp->oclass==RING_CLASS || otmp->oclass==BALL_CLASS || otmp->oclass==CHAIN_CLASS)) +/* rustproneness should not be immediately visible */ +#define hide_rust(otmp) ((otmp->otyp==GAUNTLETS_OF_POWER || otmp->otyp==KICKING_BOOTS) && !otmp->oeroded) +/* object is known to be rustprone and is NOT known to be rustproof */ +#define is_known_rustprone(otmp) (is_rustprone2(otmp) && !(otmp->rknown && otmp->oerodeproof) && (!hide_rust(otmp) || objects[otmp->otyp].oc_name_known)) +#endif /* ITEMCAT */ /* secondary damage: rot/acid/acid */ #define is_corrodeable(otmp) (objects[otmp->otyp].oc_material == COPPER || objects[otmp->otyp].oc_material == IRON) diff -ru nethack-3.4.3/include/obj.h nethack-3.4.3-new/include/obj.h --- nethack-3.4.3/include/obj.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/obj.h 2004-06-13 02:56:01.000000000 +0200 @@ -303,4 +303,21 @@ #define CONTAINED_TOO 0x1 #define BURIED_TOO 0x2 +#ifdef ITEMCAT +#ifdef ITEMCAT_OLDSTYLE +# ifdef MAIL +# define BKNOWN(otmp) (otmp->bknown || otmp->otyp == SCR_MAIL) +# else +# define BKNOWN(otmp) (otmp->bknown) +# endif +#else +# define BKNOWN(otmp) (1) +#endif + +/* faster version of not_fully_identified() for item selection + * (invent.c/pickup.c) */ +#define NOT_IDENTIFIED_ITEMCAT(otmp) (otmp->oclass != COIN_CLASS && !(otmp->known && otmp->dknown && BKNOWN(otmp) && objects[otmp->otyp].oc_name_known) || (otmp->oartifact && undiscovered_artifact(otmp->oartifact)) || (!otmp->rknown && ((otmp->oclass == ARMOR_CLASS || otmp->oclass == WEAPON_CLASS || is_weptool(otmp) || otmp->oclass == BALL_CLASS)) && (is_rustprone(otmp) || is_corrodeable(otmp) || is_flammable(otmp)))) + +#endif /* ITEMCAT */ + #endif /* OBJ_H */ diff -ru nethack-3.4.3/include/os2conf.h nethack-3.4.3-new/include/os2conf.h --- nethack-3.4.3/include/os2conf.h 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/include/os2conf.h 2004-06-13 02:55:44.000000000 +0200 @@ -28,7 +28,10 @@ #if defined(OS2_GCC) || defined(OS2_CSET2) # define OS2_32BITAPI /* enable for compilation in OS/2 2.0 */ #endif - +/* These are needed to allow defining directory names in the config file */ +#define NOCWD_ASSUMPTIONS +#define PC_LOCKING +#define HLOCK "NHPERM" /* * Other configurable options. Generally no * reason to touch the defaults, I think. diff -ru nethack-3.4.3/src/allmain.c nethack-3.4.3-new/src/allmain.c --- nethack-3.4.3/src/allmain.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/allmain.c 2004-06-13 02:55:44.000000000 +0200 @@ -245,7 +245,11 @@ if (occupation) stop_occupation(); else - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (change == 1) polyself(FALSE); else you_were(); change = 0; @@ -438,7 +442,11 @@ sync_hunger(); */ #ifdef REDO - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); pushch(0); #endif } diff -ru nethack-3.4.3/src/apply.c nethack-3.4.3-new/src/apply.c --- nethack-3.4.3/src/apply.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/apply.c 2004-06-13 02:55:44.000000000 +0200 @@ -624,7 +624,11 @@ pline(Hallucination ? "Yow! The mirror stares back!" : "Yikes! You've frozen yourself!"); - nomul(-rnd((MAXULEV+6) - u.ulevel)); + nomul(-rnd((MAXULEV+6) - u.ulevel) +#ifdef HELPLESS + , "gazing into a mirror" +#endif + ); } else You("stiffen momentarily under your gaze."); } else if (youmonst.data->mlet == S_VAMPIRE) You("don't have a reflection."); @@ -788,7 +792,11 @@ break; case 2: /* no explanation; it just happens... */ nomovemsg = ""; - nomul(-rnd(2)); + nomul(-rnd(2) +#ifdef HELPLESS + , 0 +#endif + ); break; } } @@ -1358,7 +1366,11 @@ change_luck(-1); teleds(cc.x, cc.y, TRUE); - nomul(-1); + nomul(-1 +#ifdef HELPLESS + , "jumping around" +#endif + ); nomovemsg = ""; morehungry(rnd(25)); return 1; @@ -2750,7 +2762,11 @@ current_wand = 0; if (obj) delobj(obj); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return 1; } @@ -3012,11 +3028,19 @@ } pline("Sorry, I don't know how to use that."); xit: - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return 0; } if (res && obj && obj->oartifact) arti_speak(obj); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return res; } diff -ru nethack-3.4.3/src/artifact.c nethack-3.4.3-new/src/artifact.c --- nethack-3.4.3/src/artifact.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/artifact.c 2004-06-13 02:55:44.000000000 +0200 @@ -856,7 +856,11 @@ if (Antimagic) { resisted = TRUE; } else { - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "being scared stiff" +#endif + ); nomovemsg = ""; if (magr && magr == u.ustuck && sticks(youmonst.data)) { u.ustuck = (struct monst *)0; diff -ru nethack-3.4.3/src/ball.c nethack-3.4.3-new/src/ball.c --- nethack-3.4.3/src/ball.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/ball.c 2004-06-13 02:55:44.000000000 +0200 @@ -557,7 +557,11 @@ if (near_capacity() > SLT_ENCUMBER && dist2(x, y, u.ux, u.uy) <= 2) { You("cannot %sdrag the heavy iron ball.", invent ? "carry all that and also " : ""); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return FALSE; } @@ -595,7 +599,11 @@ u.uy = uchain->oy; newsym(u.ux0, u.uy0); } - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); *bc_control = BC_BALL; move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy); diff -ru nethack-3.4.3/src/botl.c nethack-3.4.3-new/src/botl.c --- nethack-3.4.3/src/botl.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/botl.c 2004-06-13 02:55:44.000000000 +0200 @@ -165,10 +165,16 @@ } #endif +#ifdef DUMP_LOG +void bot1str(char *newbot1) +#else STATIC_OVL void bot1() +#endif { +#ifndef DUMP_LOG char newbot1[MAXCO]; +#endif register char *nb; register int i,j; @@ -215,6 +221,15 @@ if (flags.showscore) Sprintf(nb = eos(nb), " S:%ld", botl_score()); #endif +#ifdef DUMP_LOG +} +STATIC_OVL void +bot1() +{ + char newbot1[MAXCO]; + + bot1str(newbot1); +#endif curs(WIN_STATUS, 1, 0); putstr(WIN_STATUS, 0, newbot1); } @@ -242,12 +257,22 @@ return ret; } +#ifdef DUMP_LOG +void bot2str(newbot2) +char* newbot2; +#else STATIC_OVL void bot2() +#endif { +#ifndef DUMP_LOG char newbot2[MAXCO]; +#endif register char *nb; int hp, hpmax; +#ifdef HPMON + int hpcolor, hpattr; +#endif int cap = near_capacity(); hp = Upolyd ? u.mh : u.uhp; @@ -256,6 +281,15 @@ if(hp < 0) hp = 0; (void) describe_level(newbot2); Sprintf(nb = eos(newbot2), +#ifdef HPMON + "%c:%-2ld HP:", oc_syms[COIN_CLASS], +#ifndef GOLDOBJ + u.ugold +#else + money_cnt(invent) +#endif + ); +#else /* HPMON */ "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", oc_syms[COIN_CLASS], #ifndef GOLDOBJ u.ugold, @@ -263,6 +297,39 @@ money_cnt(invent), #endif hp, hpmax, u.uen, u.uenmax, u.uac); +#endif /* HPMON */ +#ifdef HPMON + curs(WIN_STATUS, 1, 1); + putstr(WIN_STATUS, 0, newbot2); + + Sprintf(nb = eos(newbot2), "%d(%d)", hp, hpmax); +#ifdef TEXTCOLOR + if (iflags.use_color) { + curs(WIN_STATUS, 1, 1); + hpattr = ATR_NONE; + if(hp == hpmax){ + hpcolor = NO_COLOR; + } else if(hp > (hpmax*2/3)) { + hpcolor = CLR_GREEN; + } else if(hp <= (hpmax/3)) { + hpcolor = CLR_RED; + if(hp<=(hpmax/10)) + hpattr = ATR_BLINK; + } else { + hpcolor = CLR_YELLOW; + } + if (hpcolor != NO_COLOR) + term_start_color(hpcolor); + if(hpattr!=ATR_NONE)term_start_attr(hpattr); + putstr(WIN_STATUS, hpattr, newbot2); + if(hpattr!=ATR_NONE)term_end_attr(hpattr); + if (hpcolor != NO_COLOR) + term_end_color(); + } +#endif /* TEXTCOLOR */ + Sprintf(nb = eos(newbot2), " Pw:%d(%d) AC:%-2d", + u.uen, u.uenmax, u.uac); +#endif /* HPMON */ if (Upolyd) Sprintf(nb = eos(nb), " HD:%d", mons[u.umonnum].mlevel); @@ -292,6 +359,14 @@ if(Slimed) Sprintf(nb = eos(nb), " Slime"); if(cap > UNENCUMBERED) Sprintf(nb = eos(nb), " %s", enc_stat[cap]); +#ifdef DUMP_LOG +} +STATIC_OVL void +bot2() +{ + char newbot2[MAXCO]; + bot2str(newbot2); +#endif curs(WIN_STATUS, 1, 1); putstr(WIN_STATUS, 0, newbot2); } diff -ru nethack-3.4.3/src/cmd.c nethack-3.4.3-new/src/cmd.c --- nethack-3.4.3/src/cmd.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/cmd.c 2004-06-13 02:55:44.000000000 +0200 @@ -123,6 +123,10 @@ STATIC_PTR int NDECL(wiz_show_vision); STATIC_PTR int NDECL(wiz_mon_polycontrol); STATIC_PTR int NDECL(wiz_show_wmodes); +STATIC_PTR int NDECL(wiz_showkills); /* showborn patch */ +#ifdef SHOW_BORN +extern void FDECL(list_vanquished, (int, BOOLEAN_P)); /* showborn patch */ +#endif /* SHOW_BORN */ #if defined(__BORLANDC__) && !defined(_WIN32) extern void FDECL(show_borlandc_stats, (winid)); #endif @@ -139,7 +143,7 @@ STATIC_DCL int NDECL(wiz_port_debug); # endif # endif -STATIC_PTR int NDECL(enter_explore_mode); +int NDECL(enter_explore_mode); /* deathexplore patch */ STATIC_PTR int NDECL(doattributes); STATIC_PTR int NDECL(doconduct); /**/ STATIC_PTR boolean NDECL(minimal_enlightenment); @@ -475,12 +479,29 @@ return 0; } -STATIC_PTR int +int /* deathexplore patch */ enter_explore_mode() { +#ifdef PARANOID + char buf[BUFSZ]; + int really_xplor = FALSE; +#endif if(!discover && !wizard) { pline("Beware! From explore mode there will be no return to normal game."); +#ifdef PARANOID + if (iflags.paranoid_quit) { + getlin ("Do you want to enter explore mode? [yes/no]?",buf); + (void) lcase (buf); + if (!(strcmp (buf, "yes"))) really_xplor = TRUE; + } else { + if (yn("Do you want to enter explore mode?") == 'y') { + really_xplor = TRUE; + } + } + if (really_xplor) { +#else if (yn("Do you want to enter explore mode?") == 'y') { +#endif clear_nhwindow(WIN_MESSAGE); You("are now in non-scoring explore mode."); discover = TRUE; @@ -756,6 +777,13 @@ return 0; } +/* #showkills command */ +STATIC_PTR int wiz_showkills() /* showborn patch */ +{ + list_vanquished('y', FALSE); + return 0; +} + #endif /* WIZARD */ @@ -1126,6 +1154,308 @@ return; } +#ifdef DUMP_LOG +void +dump_enlightenment(final) +int final; +{ + int ltmp; + char buf[BUFSZ]; + char buf2[BUFSZ]; + const char *enc_stat[] = { /* copied from botl.c */ + "", + "burdened", + "stressed", + "strained", + "overtaxed", + "overloaded" + }; + char *youwere = " You were "; + char *youhave = " You have "; + char *youhad = " You had "; + char *youcould = " You could "; + + dump("", "Final attributes"); + +#ifdef ELBERETH + if (u.uevent.uhand_of_elbereth) { + static const char * const hofe_titles[3] = { + "the Hand of Elbereth", + "the Envoy of Balance", + "the Glory of Arioch" + }; + dump(youwere, + (char *)hofe_titles[u.uevent.uhand_of_elbereth - 1]); + } +#endif + + if (u.ualign.record >= 20) + dump(youwere, "piously aligned"); + else if (u.ualign.record > 13) + dump(youwere, "devoutly aligned"); + else if (u.ualign.record > 8) + dump(youwere, "fervently aligned"); + else if (u.ualign.record > 3) + dump(youwere, "stridently aligned"); + else if (u.ualign.record == 3) + dump(youwere, "aligned"); + else if (u.ualign.record > 0) + dump(youwere, "haltingly aligned"); + else if (u.ualign.record == 0) + dump(youwere, "nominally aligned"); + else if (u.ualign.record >= -3) dump(youhave, "strayed"); + else if (u.ualign.record >= -8) dump(youhave, "sinned"); + else dump(" You have ", "transgressed"); +#ifdef WIZARD + if (wizard) { + Sprintf(buf, " %d", u.ualign.record); + dump(" Your alignment was ", buf); + } +#endif + + /*** Resistances to troubles ***/ + if (Fire_resistance) dump(youwere, "fire resistant"); + if (Cold_resistance) dump(youwere, "cold resistant"); + if (Sleep_resistance) dump(youwere, "sleep resistant"); + if (Disint_resistance) dump(youwere, "disintegration-resistant"); + if (Shock_resistance) dump(youwere, "shock resistant"); + if (Poison_resistance) dump(youwere, "poison resistant"); + if (Drain_resistance) dump(youwere, "level-drain resistant"); + if (Sick_resistance) dump(youwere, "immune to sickness"); + if (Antimagic) dump(youwere, "magic-protected"); + if (Acid_resistance) dump(youwere, "acid resistant"); + if (Stone_resistance) dump(youwere, "petrification resistant"); + if (Invulnerable) dump(youwere, "invulnerable"); + if (u.uedibility) dump(youcould, "recognize detrimental food"); + + /*** Troubles ***/ + if (Halluc_resistance) dump(" ", "You resisted hallucinations"); + if (Hallucination) dump(youwere, "hallucinating"); + if (Stunned) dump(youwere, "stunned"); + if (Confusion) dump(youwere, "confused"); + if (Blinded) dump(youwere, "blinded"); + if (Sick) { + if (u.usick_type & SICK_VOMITABLE) + dump(youwere, "sick from food poisoning"); + if (u.usick_type & SICK_NONVOMITABLE) + dump(youwere, "sick from illness"); + } + if (Stoned) dump(youwere, "turning to stone"); + if (Slimed) dump(youwere, "turning into slime"); + if (Strangled) + dump(youwere, (u.uburied) ? "buried" : "being strangled"); + if (Glib) { + Sprintf(buf, "slippery %s", makeplural(body_part(FINGER))); + dump(youhad, buf); + } + if (Fumbling) dump(" ", "You fumbled"); + if (Wounded_legs +#ifdef STEED + && !u.usteed +#endif + ) { + Sprintf(buf, "wounded %s", makeplural(body_part(LEG))); + dump(youhad, buf); + } +#ifdef STEED + if (Wounded_legs && u.usteed) { + Strcpy(buf, x_monnam(u.usteed, ARTICLE_YOUR, (char *)0, + SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION, FALSE)); + *buf = highc(*buf); + Strcat(buf, " had wounded legs"); + dump(" ", buf); + } +#endif + if (Sleeping) dump(" ", "You fell asleep"); + if (Hunger) dump(" ", "You hungered rapidly"); + + /*** Vision and senses ***/ + if (See_invisible) dump(" ", "You saw invisible"); + if (Blind_telepat) dump(youwere, "telepathic"); + if (Warning) dump(youwere, "warned"); + if (Warn_of_mon && flags.warntype) { + Sprintf(buf, "aware of the presence of %s", + (flags.warntype & M2_ORC) ? "orcs" : + (flags.warntype & M2_DEMON) ? "demons" : + something); + dump(youwere, buf); + } + if (Undead_warning) dump(youwere, "warned of undead"); + if (Searching) dump(youhad, "automatic searching"); + if (Clairvoyant) dump(youwere, "clairvoyant"); + if (Infravision) dump(youhad, "infravision"); + if (Detect_monsters) + dump(youwere, "sensing the presence of monsters"); + if (u.umconf) dump(youwere, "going to confuse monsters"); + + /*** Appearance and behavior ***/ + if (Adornment) { + int adorn = 0; + if(uleft && uleft->otyp == RIN_ADORNMENT) adorn += uleft->spe; + if(uright && uright->otyp == RIN_ADORNMENT) adorn += uright->spe; + if (adorn < 0) + dump(youwere, "poorly adorned"); + else + dump(youwere, "adorned"); + } + if (Invisible) dump(youwere, "invisible"); + else if (Invis) dump(youwere, "invisible to others"); + /* ordinarily "visible" is redundant; this is a special case for + the situation when invisibility would be an expected attribute */ + else if ((HInvis || EInvis || pm_invisible(youmonst.data)) && BInvis) + dump(youwere, "visible"); + if (Displaced) dump(youwere, "displaced"); + if (Stealth) dump(youwere, "stealthy"); + if (Aggravate_monster) dump(" ", "You aggravated monsters"); + if (Conflict) dump(" ", "You caused conflict"); + + /*** Transportation ***/ + if (Jumping) dump(youcould, "jump"); + if (Teleportation) dump(youcould, "teleport"); + if (Teleport_control) dump(youhad, "teleport control"); + if (Lev_at_will) dump(youwere, "levitating, at will"); + else if (Levitation) + dump(youwere, "levitating"); /* without control */ + else if (Flying) dump(youcould, "fly"); + if (Wwalking) dump(youcould, "walk on water"); + if (Swimming) dump(youcould, "swim"); + if (Breathless) dump(youcould, "survive without air"); + else if (Amphibious) dump(youcould, "breathe water"); + if (Passes_walls) dump(youcould, "walk through walls"); +#ifdef STEED + if (u.usteed && (final < 2 || strcmp(killer, "riding accident"))) { + Sprintf(buf, "riding %s", y_monnam(u.usteed)); + dump(youwere, buf); + } +#endif + if (u.uswallow) { + Sprintf(buf, "swallowed by %s", a_monnam(u.ustuck)); +#ifdef WIZARD + if (wizard) Sprintf(eos(buf), " (%u)", u.uswldtim); +#endif + dump(youwere, buf); + } else if (u.ustuck) { + Sprintf(buf, "%s %s", + (Upolyd && sticks(youmonst.data)) ? "holding" : "held by", + a_monnam(u.ustuck)); + dump(youwere, buf); + } + + /*** Physical attributes ***/ + if (u.uhitinc) + dump(youhad, + enlght_combatinc("to hit", u.uhitinc, final, buf)); + if (u.udaminc) + dump(youhad, + enlght_combatinc("damage", u.udaminc, final, buf)); + if (Slow_digestion) dump(youhad, "slower digestion"); + if (Regeneration) dump(" ", "You regenerated"); + if (u.uspellprot || Protection) { + int prot = 0; + + if(uleft && uleft->otyp == RIN_PROTECTION) prot += uleft->spe; + if(uright && uright->otyp == RIN_PROTECTION) prot += uright->spe; + if (HProtection & INTRINSIC) prot += u.ublessed; + prot += u.uspellprot; + + if (prot < 0) + dump(youwere, "ineffectively protected"); + else + dump(youwere, "protected"); + } + if (Protection_from_shape_changers) + dump(youwere, "protected from shape changers"); + if (Polymorph) dump(youwere, "polymorphing"); + if (Polymorph_control) dump(youhad, "polymorph control"); + if (u.ulycn >= LOW_PM) { + Strcpy(buf, an(mons[u.ulycn].mname)); + dump(youwere, buf); + } + if (Upolyd) { + if (u.umonnum == u.ulycn) Strcpy(buf, "in beast form"); + else Sprintf(buf, "polymorphed into %s", + an(youmonst.data->mname)); +#ifdef WIZARD + if (wizard) Sprintf(eos(buf), " (%d)", u.mtimedone); +#endif + dump(youwere, buf); + } + if (Unchanging) + dump(youcould, "not change from your current form"); + if (Fast) dump(youwere, Very_fast ? "very fast" : "fast"); + if (Reflecting) dump(youhad, "reflection"); + if (Free_action) dump(youhad, "free action"); + if (Fixed_abil) dump(youhad, "fixed abilities"); + if (Lifesaved) + dump(" ", "Your life would have been saved"); + if (u.twoweap) dump(youwere, "wielding two weapons at once"); + + /*** Miscellany ***/ + if (Luck) { + ltmp = abs((int)Luck); + Sprintf(buf, "%s%slucky (%d)", + ltmp >= 10 ? "extremely " : ltmp >= 5 ? "very " : "", + Luck < 0 ? "un" : "", Luck); + dump(youwere, buf); + } +#ifdef WIZARD + else if (wizard) dump(" ", "Your luck was zero"); +#endif + if (u.moreluck > 0) dump(youhad, "extra luck"); + else if (u.moreluck < 0) dump(youhad, "reduced luck"); + if (carrying(LUCKSTONE) || stone_luck(TRUE)) { + ltmp = stone_luck(FALSE); + if (ltmp <= 0) + dump(" ", "Bad luck did not time out for you"); + if (ltmp >= 0) + dump(" ", "Good luck did not time out for you"); + } + + if (u.ugangr) { + Sprintf(buf, " %sangry with you", + u.ugangr > 6 ? "extremely " : u.ugangr > 3 ? "very " : ""); +#ifdef WIZARD + if (wizard) Sprintf(eos(buf), " (%d)", u.ugangr); +#endif + Sprintf(buf2, "%s was %s", u_gname(), buf); + dump(" ", buf2); + } + + { + const char *p; + + buf[0] = '\0'; + if (final < 2) { /* quit/escaped/ascended */ + p = "survived after being killed "; + switch (u.umortality) { + case 0: p = "survived"; break; + case 1: Strcpy(buf, "once"); break; + case 2: Strcpy(buf, "twice"); break; + case 3: Strcpy(buf, "thrice"); break; + default: Sprintf(buf, "%d times", u.umortality); + break; + } + } else { /* game ended in character's death */ + p = "are dead"; + switch (u.umortality) { + case 0: impossible("dead without dying?"); + case 1: break; /* just "are dead" */ + default: Sprintf(buf, " (%d%s time!)", u.umortality, + ordin(u.umortality)); + break; + } + } + if (p) { + Sprintf(buf2, "You %s %s", p, buf); + dump(" ", buf2); + } + } + dump("", ""); + return; + +} /* dump_enlightenment */ +#endif + /* * Courtesy function for non-debug, non-explorer mode players * to help refresh them about who/what they are. @@ -1341,6 +1671,99 @@ destroy_nhwindow(en_win); } +#ifdef DUMP_LOG +void +dump_conduct(final) +int final; +{ + char buf[BUFSZ]; + int ngenocided; + + dump("", "Voluntary challenges"); + + if (!u.uconduct.food) + dump("", " You went without food"); + /* But beverages are okay */ + else if (!u.uconduct.unvegan) + dump("", " You followed a strict vegan diet"); + else if (!u.uconduct.unvegetarian) + dump("", " You were a vegetarian"); + else if (Role_if(PM_MONK) && u.uconduct.unvegetarian < 10) { + sprintf(buf, " You ate non-vegetarian food %ld time%s.", + u.uconduct.unvegetarian, plur(u.uconduct.unvegetarian)); + dump("", buf); + } + + if (!u.uconduct.gnostic) + dump("", " You were an atheist"); + + if (!u.uconduct.weaphit) + dump("", " You never hit with a wielded weapon"); + else if (Role_if(PM_MONK) && u.uconduct.weaphit < 10) { + Sprintf(buf, " You hit with a wielded weapon %ld time%s", + u.uconduct.weaphit, plur(u.uconduct.weaphit)); + dump("", buf); + } +#ifdef WIZARD + else if (wizard) { + Sprintf(buf, "hit with a wielded weapon %ld time%s", + u.uconduct.weaphit, plur(u.uconduct.weaphit)); + dump(" You ", buf); + } +#endif + if (!u.uconduct.killer) + dump("", " You were a pacifist"); + + if (!u.uconduct.literate) + dump("", " You were illiterate"); +#ifdef WIZARD + else if (wizard) { + Sprintf(buf, "read items or engraved %ld time%s", + u.uconduct.literate, plur(u.uconduct.literate)); + dump(" You ", buf); + } +#endif + + ngenocided = num_genocides(); + if (ngenocided == 0) { + dump("", " You never genocided any monsters"); + } else { + Sprintf(buf, "genocided %d type%s of monster%s", + ngenocided, plur(ngenocided), plur(ngenocided)); + dump(" You ", buf); + } + + if (!u.uconduct.polypiles) + dump("", " You never polymorphed an object"); + else { + Sprintf(buf, "polymorphed %ld item%s", + u.uconduct.polypiles, plur(u.uconduct.polypiles)); + dump(" You ", buf); + } + + if (!u.uconduct.polyselfs) + dump("", " You never changed form"); + else { + Sprintf(buf, "changed form %ld time%s", + u.uconduct.polyselfs, plur(u.uconduct.polyselfs)); + dump(" You ", buf); + } + + if (!u.uconduct.wishes) + dump("", " You used no wishes"); + else { + Sprintf(buf, "used %ld wish%s", + u.uconduct.wishes, (u.uconduct.wishes > 1L) ? "es" : ""); + dump(" You ", buf); + + if (!u.uconduct.wisharti) + dump("", " You did not wish for any artifacts"); + } + + dump("", ""); +} +#endif /* DUMP_LOG */ + #endif /* OVLB */ #ifdef OVL1 @@ -1519,6 +1942,7 @@ {(char *)0, (char *)0, donull, TRUE}, #endif {(char *)0, (char *)0, donull, TRUE}, + {(char *)0, (char *)0, donull, TRUE}, /* showkills (showborn patch) */ {(char *)0, (char *)0, donull, TRUE}, {(char *)0, (char *)0, donull, TRUE}, {(char *)0, (char *)0, donull, TRUE}, @@ -1544,6 +1968,7 @@ {"portdebug", "wizard port debug command", wiz_port_debug, TRUE}, #endif {"seenv", "show seen vectors", wiz_show_seenv, TRUE}, + {"showkills", "show list of monsters killed", wiz_showkills, TRUE}, {"stats", "show memory statistics", wiz_show_stats, TRUE}, {"timeout", "look at timeout queue", wiz_timeout_queue, TRUE}, {"vision", "show vision array", wiz_show_vision, TRUE}, diff -ru nethack-3.4.3/src/decl.c nethack-3.4.3-new/src/decl.c --- nethack-3.4.3/src/decl.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/decl.c 2004-06-13 02:55:44.000000000 +0200 @@ -20,6 +20,9 @@ NEARDATA int bases[MAXOCLASSES] = DUMMY; NEARDATA int multi = 0; +#ifdef HELPLESS +char multi_txt[BUFSZ] = DUMMY; +#endif #if 0 NEARDATA int warnlevel = 0; /* used by movemon and dochugw */ #endif @@ -209,6 +212,15 @@ NEARDATA struct mvitals mvitals[NUMMONS]; +/* originally from end.c */ +#ifdef DUMP_LOG +#ifdef DUMP_FN +char dump_fn[] = DUMP_FN; +#else +char dump_fn[PL_PSIZ] = DUMMY; +#endif +#endif /* DUMP_LOG */ + NEARDATA struct c_color_names c_color_names = { "black", "amber", "golden", "light blue", "red", "green", @@ -235,6 +247,10 @@ "white", /* CLR_WHITE */ }; +#ifdef MENU_COLOR +struct menucoloring *menu_colorings = 0; +#endif + struct c_common_strings c_common_strings = { "Nothing happens.", "That's enough tries!", "That is a silly thing to %s.", "shudder for a moment.", diff -ru nethack-3.4.3/src/detect.c nethack-3.4.3-new/src/detect.c --- nethack-3.4.3/src/detect.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/detect.c 2004-06-13 02:55:44.000000000 +0200 @@ -861,7 +861,11 @@ return; } You("peer into %s...", the(xname(obj))); - nomul(-rnd(10)); + nomul(-rnd(10) +#ifdef HELPLESS + , "gazing into a crystal ball" +#endif + ); nomovemsg = ""; if (obj->spe <= 0) pline_The("vision is unclear."); @@ -1191,7 +1195,11 @@ if(rnl(7-fund)) continue; cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ exercise(A_WIS, TRUE); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (Blind && !aflag) feel_location(x,y); /* make sure it shows up */ else @@ -1201,7 +1209,11 @@ levl[x][y].typ = CORR; unblock_point(x,y); /* vision */ exercise(A_WIS, TRUE); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); newsym(x,y); } else { /* Be careful not to find anything in an SCORR or SDOOR */ @@ -1246,7 +1258,11 @@ } if ((trap = t_at(x,y)) && !trap->tseen && !rnl(8)) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (trap->ttyp == STATUE_TRAP) { if (activate_statue_trap(trap, x, y, FALSE)) diff -ru nethack-3.4.3/src/dig.c nethack-3.4.3-new/src/dig.c --- nethack-3.4.3/src/dig.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/dig.c 2004-06-13 02:55:44.000000000 +0200 @@ -916,7 +916,11 @@ aobjnam(obj, "become")); /* you ought to be able to let go; tough luck */ /* (maybe `move_into_trap()' would be better) */ - nomul(-d(2,2)); + nomul(-d(2,2) +#ifdef HELPLESS + , "stuck in a spider web" +#endif + ); nomovemsg = "You pull free."; } else if (lev->typ == IRONBARS) { pline("Clang!"); diff -ru nethack-3.4.3/src/display.c nethack-3.4.3-new/src/display.c --- nethack-3.4.3/src/display.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/display.c 2004-06-13 02:55:44.000000000 +0200 @@ -1370,6 +1370,106 @@ /* ========================================================================= */ +#ifdef DUMP_LOG +/* D: Added to dump screen to output file */ +STATIC_PTR uchar get_glyph_char(glyph) +int glyph; +{ + uchar ch; + register int offset; + + if (glyph >= NO_GLYPH) + return ; + + /* + * Map the glyph back to a character. + * + * Warning: For speed, this makes an assumption on the order of + * offsets. The order is set in display.h. + */ + if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */ + ch = def_warnsyms[offset].sym; + } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */ + /* see swallow_to_glyph() in display.c */ + ch = (uchar) defsyms[S_sw_tl + (offset & 0x7)].sym; + } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */ + /* see zapdir_to_glyph() in display.c */ + ch = defsyms[S_vbeam + (offset & 0x3)].sym; + } else if ((offset = (glyph - GLYPH_CMAP_OFF)) >= 0) { /* cmap */ + ch = defsyms[offset].sym; + } else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) { /* object */ + ch = def_oc_syms[(int)objects[offset].oc_class]; + } else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */ + ch = def_monsyms[(int)mons[offset].mlet]; + } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { /* a corpse */ + ch = def_oc_syms[(int)objects[CORPSE].oc_class]; + } else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */ + ch = def_monsyms[(int)mons[offset].mlet]; + } else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { /* invisible */ + ch = DEF_INVISIBLE; + } else if ((offset = (glyph - GLYPH_PET_OFF)) >= 0) { /* a pet */ + ch = def_monsyms[(int)mons[offset].mlet]; + } else { /* a monster */ + ch = monsyms[(int)mons[glyph].mlet]; + } + return ch; +} + +#ifdef TTY_GRAPHICS +extern const char * FDECL(compress_str, (const char *)); +#else +const char* +compress_str(str) /* copied from win/tty/wintty.c */ +const char *str; +{ + static char cbuf[BUFSZ]; + /* compress in case line too long */ + if((int)strlen(str) >= 80) { + register const char *bp0 = str; + register char *bp1 = cbuf; + + do { + if(*bp0 != ' ' || bp0[1] != ' ') + *bp1++ = *bp0; + } while(*bp0++); + } else + return str; + return cbuf; +} +#endif /* TTY_GRAPHICS */ + +/* Take a screen dump */ +void dump_screen() +{ + register int x,y; + int lastc; + /* D: botl.c has a closer approximation to the size, but we'll go with + * this */ + char buf[300], *ptr; + + for (y = 0; y < ROWNO; y++) { + lastc = 0; + ptr = buf; + for (x = 1; x < COLNO; x++) { + uchar c = get_glyph_char(gbuf[y][x].glyph); + *ptr++ = c; + if (c != ' ') + lastc = x; + } + buf[lastc] = '\0'; + dump("", buf); + } + dump("", ""); + bot1str(buf); + ptr = (char *) compress_str((const char *) buf); + dump("", ptr); + bot2str(buf); + dump("", buf); + dump("", ""); + dump("", ""); +} +#endif /* DUMP_LOG */ + /* * back_to_glyph() * diff -ru nethack-3.4.3/src/do.c nethack-3.4.3-new/src/do.c --- nethack-3.4.3/src/do.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/do.c 2004-06-13 02:56:01.000000000 +0200 @@ -647,7 +647,11 @@ #endif menu_item *pick_list; boolean all_categories = TRUE; +#ifndef ITEMCAT_NEG boolean drop_everything = FALSE; +#else + int drop_everything = 0; +#endif #ifndef GOLDOBJ if (u.ugold) { @@ -667,18 +671,43 @@ all_categories = FALSE; n = query_category("Drop what type of items?", invent, - UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL | - BUC_BLESSED | BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN, + UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL +#ifdef ITEMCAT_JP + | JUSTPICKED +#endif +#ifdef ITEMCAT_AP + | AUTOPICKED +#endif +#ifdef ITEMCAT + | UNIDENTIFIED | RUSTPRONE +#endif + | BUC_BLESSED | BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN, &pick_list, PICK_ANY); if (!n) goto drop_done; for (i = 0; i < n; i++) { +#ifdef ITEMCAT_NEG + if (pick_list[i].item.a_int == 'Z') + drop_everything|=2; +#endif if (pick_list[i].item.a_int == ALL_TYPES_SELECTED) all_categories = TRUE; else if (pick_list[i].item.a_int == 'A') +#ifndef ITEMCAT_NEG drop_everything = TRUE; +#else + drop_everything|=1; +#endif else add_valid_menu_class(pick_list[i].item.a_int); } +#ifdef ITEMCAT_NEG + switch(drop_everything) { + case 3: + return 0; + case 2: + drop_everything=0; + } +#endif free((genericptr_t) pick_list); } else if (flags.menu_style == MENU_COMBINATION) { unsigned ggoresults = 0; diff -ru nethack-3.4.3/src/dothrow.c nethack-3.4.3-new/src/dothrow.c --- nethack-3.4.3/src/dothrow.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/dothrow.c 2004-06-13 02:55:44.000000000 +0200 @@ -608,13 +608,21 @@ */ if(Punished && !carried(uball)) { You_feel("a tug from the iron ball."); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } else if (u.utrap) { You("are anchored by the %s.", u.utraptype == TT_WEB ? "web" : u.utraptype == TT_LAVA ? "lava" : u.utraptype == TT_INFLOOR ? surface(u.ux,u.uy) : "trap"); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } @@ -624,7 +632,11 @@ if(!range || (!dx && !dy) || u.ustuck) return; /* paranoia */ - nomul(-range); + nomul(-range +#ifdef HELPLESS + , "moving through the air" +#endif + ); if (verbose) You("%s in the opposite direction.", range > 1 ? "hurtle" : "float"); /* if we're in the midst of shooting multiple projectiles, stop */ diff -ru nethack-3.4.3/src/do_wear.c nethack-3.4.3-new/src/do_wear.c --- nethack-3.4.3/src/do_wear.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/do_wear.c 2004-06-13 02:55:45.000000000 +0200 @@ -1078,7 +1078,11 @@ " Use 'R' command to remove accessories." : ""); return 0; } - if (armorpieces > 1) + if (armorpieces > 1 +#ifdef PARANOID + || iflags.paranoid_remove +#endif + ) otmp = getobj(clothes, "take off"); if (otmp == 0) return(0); if (!(otmp->owornmask & W_ARMOR)) { @@ -1128,7 +1132,11 @@ " Use 'T' command to take off armor." : ""); return(0); } - if (Accessories != 1) otmp = getobj(accessories, "remove"); + if (Accessories != 1 +#ifdef PARANOID + || iflags.paranoid_remove +#endif + ) otmp = getobj(accessories, "remove"); if(!otmp) return(0); if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) { You("are not wearing that."); @@ -1184,7 +1192,11 @@ if(cursed(otmp)) return(0); if(delay) { - nomul(delay); + nomul(delay +#ifdef HELPLESS + , "disrobing" +#endif + ); if (is_helmet(otmp)) { nomovemsg = "You finish taking off your helmet."; afternmv = Helmet_off; @@ -1441,7 +1453,11 @@ setworn(otmp, mask); delay = -objects[otmp->otyp].oc_delay; if(delay){ - nomul(delay); + nomul(delay +#ifdef HELPLESS + , "dressing up" +#endif + ); if(is_boots(otmp)) afternmv = Boots_on; if(is_helmet(otmp)) afternmv = Helmet_on; if(is_gloves(otmp)) afternmv = Gloves_on; diff -ru nethack-3.4.3/src/eat.c nethack-3.4.3-new/src/eat.c --- nethack-3.4.3/src/eat.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/eat.c 2004-06-13 02:55:45.000000000 +0200 @@ -862,7 +862,11 @@ /* A pile of gold can't ride. */ if (u.usteed) dismount_steed(DISMOUNT_FELL); #endif - nomul(-tmp); + nomul(-tmp +#ifdef HELPLESS + , "pretending to be a pile of gold" +#endif + ); Sprintf(buf, Hallucination ? "You suddenly dread being peeled and mimic %s again!" : "You now prefer mimicking %s again.", @@ -1224,7 +1228,11 @@ surface(u.ux,u.uy); pline_The("world spins and %s %s.", what, where); flags.soundok = 0; - nomul(-rnd(10)); + nomul(-rnd(10) +#ifdef HELPLESS + , "unconscious from rotten food" +#endif + ); nomovemsg = "You are conscious again."; afternmv = Hear_again; return(1); @@ -2244,7 +2252,11 @@ void reset_faint() /* call when a faint must be prematurely terminated */ { - if(is_fainted()) nomul(0); + if(is_fainted()) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } #if 0 @@ -2255,7 +2267,11 @@ if(is_fainted()) { flags.soundok = 0; - nomul(-10+(u.uhunger/10)); + nomul(-10+(u.uhunger/10) +#ifdef HELPLESS + , "fainted from lack of food" +#endif + ); nomovemsg = "You regain consciousness."; afternmv = unfaint; } @@ -2320,7 +2336,11 @@ stop_occupation(); You("faint from lack of food."); flags.soundok = 0; - nomul(-10+(u.uhunger/10)); + nomul(-10+(u.uhunger/10) +#ifdef HELPLESS + , "fainted from lack of food" +#endif + ); nomovemsg = "You regain consciousness."; afternmv = unfaint; newhs = FAINTED; @@ -2489,7 +2509,11 @@ vomit() /* A good idea from David Neves */ { make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE); - nomul(-2); + nomul(-2 +#ifdef HELPLESS + , "vomiting" +#endif + ); } int diff -ru nethack-3.4.3/src/end.c nethack-3.4.3-new/src/end.c --- nethack-3.4.3/src/end.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/end.c 2004-06-13 02:55:45.000000000 +0200 @@ -10,6 +10,9 @@ #include #endif #include "dlb.h" +#ifdef DEATH_EXPLORE +extern int NDECL(enter_explore_mode); +#endif /* these probably ought to be generated by makedefs, like LAST_GEM */ #define FIRST_GEM DILITHIUM_CRYSTAL @@ -39,8 +42,14 @@ STATIC_DCL void FDECL(sort_valuables, (struct valuable_data *,int)); STATIC_DCL void FDECL(artifact_score, (struct obj *,BOOLEAN_P,winid)); STATIC_DCL void FDECL(savelife, (int)); -STATIC_DCL void FDECL(list_vanquished, (CHAR_P,BOOLEAN_P)); +void FDECL(list_vanquished, (CHAR_P,BOOLEAN_P)); +#ifdef DUMP_LOG +extern void NDECL(dump_spells); +void FDECL(do_vanquished, (int, BOOLEAN_P, BOOLEAN_P)); +STATIC_DCL void FDECL(list_genocided, (int, BOOLEAN_P, BOOLEAN_P)); +#else STATIC_DCL void FDECL(list_genocided, (CHAR_P,BOOLEAN_P)); +#endif /* DUMP_LOG */ STATIC_DCL boolean FDECL(should_query_disclose_option, (int,char *)); #if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2) @@ -86,6 +95,62 @@ extern const char * const killed_by_prefix[]; /* from topten.c */ +#ifdef DUMP_LOG +FILE *dump_fp = (FILE *)0; /* file pointer for dumps */ +/* functions dump_init, dump_exit and dump are from the dump patch */ + +void +dump_init () +{ + if (dump_fn[0]) { + char *p = (char *) strstr(dump_fn, "%n"); + if (p) { + int new_dump_fn_len = strlen(dump_fn)+strlen(plname)-2; /* %n */ + char *new_dump_fn = (char *) alloc((unsigned)(new_dump_fn_len+1)); + char *q = new_dump_fn; + strncpy(q, dump_fn, p-dump_fn); + q += p-dump_fn; + strncpy(q, plname, strlen(plname) + 1); + regularize(q); + q[strlen(plname)] = '\0'; + q += strlen(q); + p += 2; /* skip "%n" */ + strncpy(q, p, strlen(p)); + new_dump_fn[new_dump_fn_len] = '\0'; + + dump_fp = fopen(new_dump_fn, "w"); + if (!dump_fp) { + pline("Can't open %s for output.", new_dump_fn); + pline("Dump file not created."); + } + free(new_dump_fn); + + } else { + dump_fp = fopen (dump_fn, "w"); + + if (!dump_fp) { + pline("Can't open %s for output.", dump_fn); + pline("Dump file not created."); + } + } + } +} + +void +dump_exit () +{ + if (dump_fp) + fclose (dump_fp); +} + +void dump (pre, str) + char *pre, *str; +{ + if (dump_fp) + fprintf (dump_fp, "%s%s\n", pre, str); +} +#endif /* DUMP_LOG */ + /*ARGSUSED*/ void done1(sig_unused) /* called as signal() handler, so sent at least one arg */ @@ -101,7 +166,11 @@ clear_nhwindow(WIN_MESSAGE); curs_on_u(); wait_synch(); - if(multi > 0) nomul(0); + if(multi > 0) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } else { (void)done2(); } @@ -112,14 +181,32 @@ int done2() { +#ifdef PARANOID + char buf[BUFSZ]; + int really_quit = FALSE; + + if (iflags.paranoid_quit) { + getlin ("Really quit [yes/no]?",buf); + (void) lcase (buf); + if (!(strcmp (buf, "yes"))) really_quit = TRUE; + } else { + if(yn("Really quit?") == 'y') really_quit = TRUE; + } + if (!really_quit) { +#else /* PARANOID */ if(yn("Really quit?") == 'n') { +#endif /* PARANOID */ #ifndef NO_SIGNAL (void) signal(SIGINT, (SIG_RET_TYPE) done1); #endif clear_nhwindow(WIN_MESSAGE); curs_on_u(); wait_synch(); - if(multi > 0) nomul(0); + if(multi > 0) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if(multi == 0) { u.uinvulnerable = FALSE; /* avoid ctrl-C bug -dlc */ u.usleep = 0; @@ -224,7 +311,14 @@ Sprintf(eos(buf), " called %s", NAME(mtmp)); } - if (multi) Strcat(buf, ", while helpless"); + if (multi) { +#ifdef HELPLESS + if (strlen(multi_txt) > 0) + Sprintf(eos(buf), ", while %s", multi_txt); + else +#endif + Strcat(buf, ", while helpless"); + } killer = buf; if (mtmp->data->mlet == S_WRAITH) u.ugrave_arise = PM_WRAITH; @@ -373,8 +467,13 @@ makeknown(obj->otyp); obj->known = obj->bknown = obj->dknown = obj->rknown = 1; } +#ifdef DUMP_LOG + (void) dump_inventory((char *)0, TRUE); + do_containerconts(invent, TRUE, TRUE, TRUE); +#else (void) display_inventory((char *)0, TRUE); container_contents(invent, TRUE, TRUE); +#endif /* DUMP_LOG */ } if (c == 'q') done_stopprint++; } @@ -388,14 +487,28 @@ enlightenment(how >= PANICKED ? 1 : 2); /* final */ if (c == 'q') done_stopprint++; } +#ifdef DUMP_LOG + if (dump_fp) { + dump_enlightenment((int) (how >= PANICKED ? 1 : 2)); + dump_spells(); + } +#endif ask = should_query_disclose_option('v', &defquery); if (!done_stopprint) +#ifdef DUMP_LOG + do_vanquished(defquery, ask, TRUE); +#else list_vanquished(defquery, ask); +#endif ask = should_query_disclose_option('g', &defquery); if (!done_stopprint) +#ifdef DUMP_LOG + list_genocided(defquery, ask,TRUE); +#else list_genocided(defquery, ask); +#endif ask = should_query_disclose_option('c', &defquery); if (!done_stopprint) { @@ -405,6 +518,12 @@ show_conduct(how >= PANICKED ? 1 : 2); if (c == 'q') done_stopprint++; } +#ifdef DUMP_LOG + if (dump_fp) { + dump_conduct(how >= PANICKED ? 1 : 2); + dump_weapon_skill(); + } +#endif } /* try to get the player back in a viable state after being killed */ @@ -524,6 +643,10 @@ OBJ_NAME(objects[otmp->otyp]), value, currency(value), points); putstr(endwin, 0, pbuf); +#ifdef DUMP_LOG + if (dump_fp) + dump("", pbuf); +#endif } } if (Has_contents(otmp)) @@ -536,10 +659,20 @@ done(how) int how; { +#if defined(WIZARD) && defined(PARANOID) + char paranoid_buf[BUFSZ]; + int really_bon = TRUE; +#endif boolean taken; +#ifdef DEATH_EXPLORE + boolean goexplore = FALSE; +#endif char kilbuf[BUFSZ], pbuf[BUFSZ]; winid endwin = WIN_ERR; boolean bones_ok, have_windows = iflags.window_inited; +#ifdef PROMPT_LOGEXP + boolean update_log; +#endif struct obj *corpse = (struct obj *)0; long umoney; @@ -591,6 +724,7 @@ return; } } + bones_ok = (how < GENOCIDED) && can_make_bones(); /* dthexpl patch */ if (( #ifdef WIZARD wizard || @@ -605,15 +739,49 @@ killer_format = 0; return; } +#ifdef DEATH_EXPLORE + else if (iflags.death_expl && how <= GENOCIDED && !bones_ok && +#ifdef WIZARD + !wizard && +#endif + !discover) { + if(yn("Continue in explore mode?") == 'y') { + enter_explore_mode(); + if (discover) goexplore = TRUE; + } + } +#endif /* DEATH_EXPLORE */ /* * The game is now over... */ die: +#ifdef DEATH_EXPLORE + if (!goexplore) { +#endif program_state.gameover = 1; /* in case of a subsequent panic(), there's no point trying to save */ program_state.something_worth_saving = 0; +#ifdef DUMP_LOG + /* D: Grab screen dump right here */ + if (dump_fn[0]) { + dump_init(); + Sprintf(pbuf, "%s, %s %s %s %s", plname, + aligns[1 - u.ualign.type].adj, + genders[flags.female].adj, + urace.adj, + (flags.female && urole.name.f)? + urole.name.f : urole.name.m); + dump("", pbuf); + /* D: Add a line for clearance from the screen dump */ + dump("", ""); + dump_screen(); + } +#endif /* DUMP_LOG */ +#ifdef DEATH_EXPLORE + } +#endif /* render vision subsystem inoperative */ iflags.vision_inited = 0; /* might have been killed while using a disposable item, so make sure @@ -628,6 +796,9 @@ pline("Do not pass go. Do not collect 200 %s.", currency(200L)); if (have_windows) wait_synch(); /* flush screen output */ +#ifdef DEATH_EXPLORE + if (!goexplore) { +#endif #ifndef NO_SIGNAL (void) signal(SIGINT, (SIG_RET_TYPE) done_intr); # if defined(UNIX) || defined(VMS) || defined (__EMX__) @@ -636,7 +807,7 @@ # endif #endif /* NO_SIGNAL */ - bones_ok = (how < GENOCIDED) && can_make_bones(); + /* bones_ok = (how < GENOCIDED) && can_make_bones(); moved up */ if (how == TURNED_SLIME) u.ugrave_arise = PM_GREEN_SLIME; @@ -668,6 +839,9 @@ make_grave(u.ux, u.uy, pbuf); } } +#ifdef DEATH_EXPLORE + } /* if (!goexplore) */ +#endif if (how == QUIT) { killer_format = NO_KILLER_PREFIX; @@ -688,6 +862,9 @@ clearpriests(); } else taken = FALSE; /* lint; assert( !bones_ok ); */ +#ifdef DEATH_EXPLORE + if (!goexplore) { +#endif clearlocks(); if (have_windows) display_nhwindow(WIN_MESSAGE, FALSE); @@ -696,6 +873,9 @@ disclose(how, taken); /* finish_paybill should be called after disclosure but before bones */ if (bones_ok && taken) finish_paybill(); +#ifdef DEATH_EXPLORE + } +#endif /* calculate score, before creating bones [container gold] */ { @@ -721,18 +901,53 @@ if (deepest > 20) u.urexp += 1000L * (long)((deepest > 30) ? 10 : deepest - 20); if (how == ASCENDED) u.urexp *= 2L; +#ifdef DEATH_EXPLORE + if (goexplore) { + discover = FALSE; /* a kludge to fool the topten function.. */ + topten(how); + /* undo some things that were done for score calculation */ + /* this branch is not entered when you ascend, escape or quit */ + discover = TRUE; + umoney -= hidden_gold(); + u.urexp -= tmp; + u.urexp -= 50L * (long)(deepest - 1); + /* now do what is done when you refuse to die in explore mode */ + if (u.uhpmax <= 0) u.uhpmax = u.ulevel * 8; + savelife(how); + killer = 0; + killer_format = 0; + vision_reset(); + return; + } +#endif } if (bones_ok) { #ifdef WIZARD +# ifdef PARANOID + if(wizard) { + getlin("Save WIZARD MODE bones? [no/yes]", paranoid_buf); + (void) lcase (paranoid_buf); + if (strcmp (paranoid_buf, "yes")) + really_bon = FALSE; + } + if(really_bon) +# else if (!wizard || yn("Save bones?") == 'y') -#endif +# endif /* PARANOID */ +#endif /* WIZARD */ savebones(corpse); /* corpse may be invalid pointer now so ensure that it isn't used again */ corpse = (struct obj *)0; } - +#ifdef PROMPT_LOGEXP + if (wizard || discover) { + update_log = (yn("Update logfile?") == 'y'); + } else { + update_log = TRUE; + } +#endif /* update gold for the rip output, which can't use hidden_gold() (containers will be gone by then if bones just got saved...) */ #ifndef GOLDOBJ @@ -770,15 +985,18 @@ /* don't bother counting to see whether it should be plural */ } + Sprintf(pbuf, "%s %s the %s...", Goodbye(), plname, + how != ASCENDED ? + (const char *) ((flags.female && urole.name.f) ? + urole.name.f : urole.name.m) : + (const char *) (flags.female ? "Demigoddess" : "Demigod")); if (!done_stopprint) { - Sprintf(pbuf, "%s %s the %s...", Goodbye(), plname, - how != ASCENDED ? - (const char *) ((flags.female && urole.name.f) ? - urole.name.f : urole.name.m) : - (const char *) (flags.female ? "Demigoddess" : "Demigod")); putstr(endwin, 0, pbuf); putstr(endwin, 0, ""); } +#ifdef DUMP_LOG + if (dump_fp) dump("", pbuf); +#endif if (how == ESCAPED || how == ASCENDED) { register struct monst *mtmp; @@ -805,25 +1023,30 @@ keepdogs(TRUE); viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */ mtmp = mydogs; - if (!done_stopprint) Strcpy(pbuf, "You"); + Strcpy(pbuf, "You"); if (mtmp) { while (mtmp) { - if (!done_stopprint) - Sprintf(eos(pbuf), " and %s", mon_nam(mtmp)); + Sprintf(eos(pbuf), " and %s", mon_nam(mtmp)); if (mtmp->mtame) u.urexp += mtmp->mhp; mtmp = mtmp->nmon; } if (!done_stopprint) putstr(endwin, 0, pbuf); +#ifdef DUMP_LOG + if (dump_fp) dump("", pbuf); +#endif pbuf[0] = '\0'; } else { if (!done_stopprint) Strcat(pbuf, " "); } - if (!done_stopprint) { - Sprintf(eos(pbuf), "%s with %ld point%s,", + Sprintf(eos(pbuf), "%s with %ld point%s,", how==ASCENDED ? "went to your reward" : "escaped from the dungeon", u.urexp, plur(u.urexp)); +#ifdef DUMP_LOG + if (dump_fp) dump("", pbuf); +#endif + if (!done_stopprint) { putstr(endwin, 0, pbuf); } @@ -855,6 +1078,9 @@ count, plur(count)); } putstr(endwin, 0, pbuf); +#ifdef DUMP_LOG + if (dump_fp) dump("", pbuf); +#endif } } @@ -879,12 +1105,22 @@ Sprintf(eos(pbuf), " with %ld point%s,", u.urexp, plur(u.urexp)); putstr(endwin, 0, pbuf); +#ifdef DUMP_LOG + if (dump_fp) dump("", pbuf); +#endif } if (!done_stopprint) { Sprintf(pbuf, "and %ld piece%s of gold, after %ld move%s.", umoney, plur(umoney), moves, plur(moves)); putstr(endwin, 0, pbuf); +#ifdef DUMP_LOG + if (dump_fp) { + dump("", pbuf); + Sprintf(pbuf, "Killer: %s", killer); + dump("", pbuf); + } +#endif } if (!done_stopprint) { Sprintf(pbuf, @@ -892,6 +1128,9 @@ u.ulevel, u.uhpmax, plur(u.uhpmax), ends[how]); putstr(endwin, 0, pbuf); putstr(endwin, 0, ""); +#ifdef DUMP_LOG + if (dump_fp) dump("", pbuf); +#endif } if (!done_stopprint) display_nhwindow(endwin, TRUE); @@ -901,14 +1140,23 @@ /* "So when I die, the first thing I will see in Heaven is a * score list?" */ if (flags.toptenwin) { +#ifdef PROMPT_LOGEXP + if (update_log) +#endif topten(how); if (have_windows) exit_nhwindows((char *)0); } else { if (have_windows) exit_nhwindows((char *)0); +#ifdef PROMPT_LOGEXP + if (update_log) +#endif topten(how); } +#ifdef DUMP_LOG + if (dump_fp) dump_exit(); +#endif if(done_stopprint) { raw_print(""); raw_print(""); } terminate(EXIT_SUCCESS); @@ -919,8 +1167,23 @@ container_contents(list, identified, all_containers) struct obj *list; boolean identified, all_containers; +#ifdef DUMP_LOG +{ + do_containerconts(list, identified, all_containers, FALSE); +} + +void do_containerconts(list, identified, all_containers, want_dump) +struct obj *list; +boolean identified, all_containers, want_dump; +#endif +/* The original container_contents function */ { register struct obj *box, *obj; +#ifdef SORTLOOT + struct obj **oarray; + int i,j,n; + char *invlet; +#endif /* SORTLOOT */ char buf[BUFSZ]; for (box = list; box; box = box->nobj) { @@ -929,24 +1192,84 @@ continue; /* wrong type of container */ } else if (box->cobj) { winid tmpwin = create_nhwindow(NHW_MENU); +#ifdef SORTLOOT + /* count the number of items */ + for (n = 0, obj = box->cobj; obj; obj = obj->nobj) n++; + /* Make a temporary array to store the objects sorted */ + oarray = (struct obj **) alloc(n*sizeof(struct obj*)); + + /* Add objects to the array */ + i = 0; + invlet = flags.inv_order; + nextclass: + for (obj = box->cobj; obj; obj = obj->nobj) { + if (!flags.sortpack || obj->oclass == *invlet) { + if (iflags.sortloot == 'f' + || iflags.sortloot == 'l') { + /* Insert object at correct index */ + for (j = i; j; j--) { + if (strcmpi(cxname2(obj), cxname2(oarray[j-1]))>0 + || (flags.sortpack && + oarray[j-1]->oclass != obj->oclass)) + break; + oarray[j] = oarray[j-1]; + } + oarray[j] = obj; + i++; + } else { + /* Just add it to the array */ + oarray[i++] = obj; + } + } + } /* for loop */ + if (flags.sortpack) { + if (*++invlet) goto nextclass; + } +#endif /* SORTLOOT */ Sprintf(buf, "Contents of %s:", the(xname(box))); putstr(tmpwin, 0, buf); putstr(tmpwin, 0, ""); +#ifdef DUMP_LOG + if (dump_fp) dump("", buf); +#endif +#ifdef SORTLOOT + for (i = 0; i < n; i++) { + obj = oarray[i]; +#else for (obj = box->cobj; obj; obj = obj->nobj) { +#endif if (identified) { makeknown(obj->otyp); obj->known = obj->bknown = obj->dknown = obj->rknown = 1; } putstr(tmpwin, 0, doname(obj)); +#ifdef DUMP_LOG + if (want_dump) dump(" ", doname(obj)); +#endif } +#ifdef DUMP_LOG + if (want_dump) dump("",""); +#endif display_nhwindow(tmpwin, TRUE); destroy_nhwindow(tmpwin); - if (all_containers) + if (all_containers) { +#ifdef DUMP_LOG + do_containerconts(box->cobj, identified, TRUE, + want_dump); +#else container_contents(box->cobj, identified, TRUE); +#endif /* DUMP_LOG */ + } } else { pline("%s empty.", Tobjnam(box, "are")); display_nhwindow(WIN_MESSAGE, FALSE); +#ifdef DUMP_LOG + if (want_dump) { + dump(The(xname(box)), " is empty."); + dump("", ""); + } +#endif } } if (!all_containers) @@ -973,10 +1296,21 @@ nethack_exit(status); } -STATIC_OVL void +void /* showborn patch */ list_vanquished(defquery, ask) char defquery; boolean ask; +#ifdef DUMP_LOG +{ + do_vanquished(defquery, ask, FALSE); +} + +void +do_vanquished(defquery, ask, want_dump) +int defquery; +boolean ask; +boolean want_dump; +#endif { register int i, lev; int ntypes = 0, max_lev = 0, nkilled; @@ -1003,6 +1337,9 @@ klwin = create_nhwindow(NHW_MENU); putstr(klwin, 0, "Vanquished creatures:"); putstr(klwin, 0, ""); +#ifdef DUMP_LOG + if (want_dump) dump("", "Vanquished creatures"); +#endif /* countdown by monster "toughness" */ for (lev = max_lev; lev >= 0; lev--) @@ -1029,8 +1366,16 @@ else Sprintf(buf, "%d %s", nkilled, makeplural(mons[i].mname)); +#ifdef SHOW_BORN + if (iflags.show_born && nkilled != mvitals[i].born) + Sprintf(buf + strlen(buf), " (%d created)", + (int) mvitals[i].born); +#endif } putstr(klwin, 0, buf); +#ifdef DUMP_LOG + if (want_dump) dump(" ", buf); +#endif } /* * if (Hallucination) @@ -1040,9 +1385,15 @@ putstr(klwin, 0, ""); Sprintf(buf, "%ld creatures vanquished.", total_killed); putstr(klwin, 0, buf); +#ifdef DUMP_LOG + if (want_dump) dump(" ", buf); +#endif } display_nhwindow(klwin, TRUE); destroy_nhwindow(klwin); +#ifdef DUMP_LOG + if (want_dump) dump("", ""); +#endif } } } @@ -1059,43 +1410,112 @@ return n; } +#ifdef DUMP_LOG +STATIC_OVL void +list_genocided(defquery, ask, want_dump) +int defquery; +boolean ask; +boolean want_dump; +#else STATIC_OVL void list_genocided(defquery, ask) char defquery; boolean ask; +#endif { register int i; - int ngenocided; + int ngenocided=0; +#ifdef SHOW_EXTINCT + int nextincted=0; +#endif char c; winid klwin; char buf[BUFSZ]; + /* get totals first */ +#ifdef SHOW_EXTINCT + for (i = LOW_PM; i < NUMMONS; i++) { + if (mvitals[i].mvflags & G_GENOD) + ngenocided++; + else if ( (mvitals[i].mvflags & G_GONE) && !(mons[i].geno & G_UNIQ) ) + nextincted++; + } ngenocided = num_genocides(); +#endif /* genocided species list */ - if (ngenocided != 0) { + if (ngenocided != 0 +#ifdef SHOW_EXTINCT + || nextincted != 0 +#endif + ) { +#ifdef SHOW_EXTINCT + if (nextincted != 0) + c = ask ? + yn_function("Do you want a list of species genocided or extincted?", + ynqchars, defquery) : defquery; + else +#endif c = ask ? yn_function("Do you want a list of species genocided?", ynqchars, defquery) : defquery; if (c == 'q') done_stopprint++; if (c == 'y') { klwin = create_nhwindow(NHW_MENU); - putstr(klwin, 0, "Genocided species:"); +#ifdef SHOW_EXTINCT + Sprintf(buf, "Genocided or extincted species:"); +#else + Sprintf(buf, "Genocided species:"); +#endif + putstr(klwin, 0, buf); putstr(klwin, 0, ""); +#ifdef DUMP_LOG + if (want_dump) dump("", buf); +#endif for (i = LOW_PM; i < NUMMONS; i++) +#ifdef SHOW_EXTINCT + if (mvitals[i].mvflags & G_GONE && !(mons[i].geno & G_UNIQ) ){ +#else if (mvitals[i].mvflags & G_GENOD) { +#endif if ((mons[i].geno & G_UNIQ) && i != PM_HIGH_PRIEST) Sprintf(buf, "%s%s", !type_is_pname(&mons[i]) ? "" : "the ", mons[i].mname); else Strcpy(buf, makeplural(mons[i].mname)); +#ifdef SHOW_EXTINCT + if( !(mvitals[i].mvflags & G_GENOD) ) + Strcat(buf, " (extinct)"); +#endif putstr(klwin, 0, buf); +#ifdef DUMP_LOG + if (want_dump) dump(" ", buf); +#endif } putstr(klwin, 0, ""); +#ifdef SHOW_EXTINCT + if (ngenocided>0) { +#endif Sprintf(buf, "%d species genocided.", ngenocided); putstr(klwin, 0, buf); +#ifdef DUMP_LOG + if (want_dump) dump(" ", buf); +#endif +#ifdef SHOW_EXTINCT + } + if (nextincted>0) { + Sprintf(buf, "%d species extincted.", nextincted); + putstr(klwin, 0, buf); +#ifdef DUMP_LOG + if (want_dump) dump(" ", buf); +#endif + } +#endif /* SHOW_EXTINCT */ +#ifdef DUMP_LOG + if (want_dump) dump("", ""); +#endif display_nhwindow(klwin, TRUE); destroy_nhwindow(klwin); diff -ru nethack-3.4.3/src/engrave.c nethack-3.4.3-new/src/engrave.c --- nethack-3.4.3/src/engrave.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/engrave.c 2004-06-13 02:55:45.000000000 +0200 @@ -343,7 +343,11 @@ et = ep->engr_txt; You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et); - if(flags.run > 1) nomul(0); + if(flags.run > 1) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } } } diff -ru nethack-3.4.3/src/explode.c nethack-3.4.3-new/src/explode.c --- nethack-3.4.3/src/explode.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/explode.c 2004-06-13 02:55:45.000000000 +0200 @@ -513,7 +513,11 @@ if (scflags & MAY_HITYOU) { int hitvalu, hitu; - if (multi) nomul(0); + if (multi) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); hitvalu = 8 + stmp->obj->spe; if (bigmonst(youmonst.data)) hitvalu++; hitu = thitu(hitvalu, diff -ru nethack-3.4.3/src/files.c nethack-3.4.3-new/src/files.c --- nethack-3.4.3/src/files.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/files.c 2004-06-13 02:55:45.000000000 +0200 @@ -57,7 +57,7 @@ #endif #if !defined(MFLOPPY) && !defined(VMS) && !defined(WIN32) -char bones[] = "bonesnn.xxx"; +char bones[] = "bones/bonesnn.xxx"; char lock[PL_NSIZ+14] = "1lock"; /* long enough for uid+name+.99 */ #else # if defined(MFLOPPY) @@ -614,8 +614,13 @@ s_level *sptr; char *dptr; +#ifdef UNIX + Sprintf(file, "bones/bon%c%s", dungeons[lev->dnum].boneid, + In_quest(lev) ? urole.filecode : "0"); +#else Sprintf(file, "bon%c%s", dungeons[lev->dnum].boneid, In_quest(lev) ? urole.filecode : "0"); +#endif dptr = eos(file); if ((sptr = Is_special(lev)) != 0) Sprintf(dptr, ".%c", sptr->boneid); @@ -1794,6 +1799,10 @@ } else if (match_varname(buf, "BOULDER", 3)) { (void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE, 1, "BOULDER"); + } else if (match_varname(buf, "MENUCOLOR", 9)) { +#ifdef MENU_COLOR + (void) add_menu_coloring(bufp); +#endif } else if (match_varname(buf, "GRAPHICS", 4)) { len = get_uchars(fp, buf, bufp, translate, FALSE, MAXPCHARS, "GRAPHICS"); diff -ru nethack-3.4.3/src/hack.c nethack-3.4.3-new/src/hack.c --- nethack-3.4.3/src/hack.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/hack.c 2004-06-13 02:55:45.000000000 +0200 @@ -72,7 +72,11 @@ rx = u.ux + 2 * u.dx; /* boulder destination position */ ry = u.uy + 2 * u.dy; - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (Levitation || Is_airlevel(&u.uz)) { if (Blind) feel_location(sx, sy); You("don't have enough leverage to push %s.", the(xname(otmp))); @@ -323,7 +327,11 @@ if (!boulder && IS_ROCK(lev->typ) && !may_dig(x,y)) { You("hurt your teeth on the %s.", IS_TREE(lev->typ) ? "tree" : "hard stone"); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return 1; } else if (digging.pos.x != x || digging.pos.y != y || !on_level(&digging.level, &u.uz)) { @@ -719,7 +727,11 @@ if (test_move(u.ux, u.uy, u.tx-u.ux, u.ty-u.uy, TEST_MOVE)) { u.dx = u.tx-u.ux; u.dy = u.ty-u.uy; - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); iflags.travelcc.x = iflags.travelcc.y = -1; return TRUE; } @@ -785,7 +797,11 @@ u.dx = x-ux; u.dy = y-uy; if (x == u.tx && y == u.ty) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); /* reset run so domove run checks work */ flags.run = 8; iflags.travelcc.x = iflags.travelcc.y = -1; @@ -855,7 +871,11 @@ found: u.dx = 0; u.dy = 0; - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return FALSE; } @@ -891,7 +911,11 @@ exercise(A_CON, FALSE); } else You("collapse under your load."); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } if(u.uswallow) { @@ -943,7 +967,11 @@ do { if(tries++ > 50) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } confdir(); @@ -955,14 +983,22 @@ if (u.uinwater) { water_friction(); if (!u.dx && !u.dy) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } x = u.ux + u.dx; y = u.uy + u.dy; } if(!isok(x, y)) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } if (((trap = t_at(x, y)) && trap->tseen) || @@ -970,11 +1006,19 @@ !is_clinger(youmonst.data) && (is_pool(x, y) || is_lava(x, y)) && levl[x][y].seenv)) { if(flags.run >= 2) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); flags.move = 0; return; } else - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) { @@ -1015,7 +1059,11 @@ !Conflict && !u.ustuck->mconf) goto pull_free; You("cannot escape from %s!", mon_nam(u.ustuck)); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } } @@ -1031,7 +1079,11 @@ mtmp->m_ap_type != M_AP_OBJECT) || Protection_from_shape_changers)) || sensemon(mtmp))) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); flags.move = 0; return; } @@ -1046,7 +1098,11 @@ /* attack monster */ if(mtmp) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); /* only attack if we know it's there */ /* or if we used the 'F' command to fight blindly */ /* or if it hides_under, in which case we call attack() to print @@ -1108,7 +1164,11 @@ is_pool(x,y) ? "empty water" : buf); unmap_object(x, y); /* known empty -- remove 'I' if present */ newsym(x, y); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (expl) { u.mh = -1; /* dead in the current form */ rehumanize(); @@ -1123,7 +1183,11 @@ #ifdef STEED if (u.usteed && !u.usteed->mcanmove && (u.dx || u.dy)) { pline("%s won't move!", upstart(y_monnam(u.usteed))); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } else #endif @@ -1131,7 +1195,11 @@ You("are rooted %s.", Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) ? "in place" : "to the ground"); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } if(u.utrap) { @@ -1254,7 +1322,11 @@ if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) { flags.move = 0; - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } @@ -1370,7 +1442,11 @@ if ( flags.run < 8 ) if (IS_DOOR(tmpr->typ) || IS_ROCK(tmpr->typ) || IS_FURNITURE(tmpr->typ)) - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } if (hides_under(youmonst.data)) @@ -1408,7 +1484,11 @@ /* delay next move because of ball dragging */ /* must come after we finished picking up, in spoteffects() */ if (cause_delay) { - nomul(-2); + nomul(-2 +#ifdef HELPLESS + , "dragging an iron ball" +#endif + ); nomovemsg = ""; } @@ -1436,7 +1516,11 @@ char buf[BUFSZ]; struct obj *otmp = carrying(CANDELABRUM_OF_INVOCATION); - nomul(0); /* stop running or travelling */ + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); /* stop running or travelling */ #ifdef STEED if (u.usteed) Sprintf(buf, "beneath %s", y_monnam(u.usteed)); else @@ -1924,7 +2008,11 @@ /* Grid bugs stop if trying to move diagonal, even if blind. Maybe */ /* they polymorphed while in the middle of a long move. */ if (u.umonnum == PM_GRID_BUG && u.dx && u.dy) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } @@ -2001,7 +2089,11 @@ continue; } stop: - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return; } /* end for loops */ @@ -2063,14 +2155,27 @@ return(0); } +#ifdef HELPLESS +void +nomul(nval, txt) + register int nval; + const char *txt; +#else void nomul(nval) register int nval; +#endif { if(multi < nval) return; /* This is a bug fix by ab@unido */ u.uinvulnerable = FALSE; /* Kludge to avoid ctrl-C bug -dlc */ u.usleep = 0; multi = nval; +#ifdef HELPLESS + if (txt && txt[0]) + (void) strncpy(multi_txt, txt, BUFSZ); + else + (void) memset(multi_txt, 0, BUFSZ); +#endif flags.travel = iflags.travel1 = flags.mv = flags.run = 0; } @@ -2080,6 +2185,9 @@ const char *msg_override; { multi = 0; /* caller will usually have done this already */ +#ifdef HELPLESS + (void) memset(multi_txt, 0, BUFSZ); +#endif if (msg_override) nomovemsg = msg_override; else if (!nomovemsg) nomovemsg = You_can_move_again; if (*nomovemsg) pline(nomovemsg); diff -ru nethack-3.4.3/src/invent.c nethack-3.4.3-new/src/invent.c --- nethack-3.4.3/src/invent.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/invent.c 2004-06-13 02:56:01.000000000 +0200 @@ -19,7 +19,12 @@ STATIC_DCL boolean FDECL(putting_on, (const char *)); STATIC_PTR int FDECL(ckunpaid,(struct obj *)); STATIC_PTR int FDECL(ckvalidcat,(struct obj *)); +#ifdef DUMP_LOG +static char FDECL(display_pickinv, + (const char *,BOOLEAN_P, long *, BOOLEAN_P)); +#else static char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *)); +#endif /* DUMP_LOG */ #ifdef OVLB STATIC_DCL boolean FDECL(this_type_only, (struct obj *)); STATIC_DCL void NDECL(dounpaid); @@ -532,6 +537,11 @@ freeinv(obj) register struct obj *obj; { +#ifdef ITEMCAT_JP +/* this is a very uncritical thing so we do it here. if the jpicklist was + * persistent, this should have been in extract_nobj() itself */ + jpick_free(obj); +#endif /* ITEMCAT_JP */ extract_nobj(obj, &invent); freeinv_core(obj); update_inventory(); @@ -1017,7 +1027,11 @@ if (ilet == '?' && !*lets && *altlets) allowed_choices = altlets; ilet = display_pickinv(allowed_choices, TRUE, - allowcnt ? &ctmp : (long *)0); + allowcnt ? &ctmp : (long *)0 +#ifdef DUMP_LOG + , FALSE +#endif + ); if(!ilet) continue; if (allowcnt && ctmp >= 0) { cnt = ctmp; @@ -1689,13 +1703,26 @@ * inventory and return a count as well as a letter. If out_cnt is not null, * any count returned from the menu selection is placed here. */ +#ifdef DUMP_LOG +static char +display_pickinv(lets, want_reply, out_cnt, want_dump) +register const char *lets; +boolean want_reply; +long* out_cnt; +boolean want_dump; +#else static char display_pickinv(lets, want_reply, out_cnt) register const char *lets; boolean want_reply; long* out_cnt; +#endif { struct obj *otmp; +#ifdef SORTLOOT + struct obj **oarray; + int i, j; +#endif char ilet, ret; char *invlet = flags.inv_order; int n, classcount; @@ -1713,6 +1740,10 @@ } else win = WIN_INVEN; +#ifdef DUMP_LOG + if (want_dump) dump("", "Your inventory"); +#endif + /* Exit early if no inventory -- but keep going if we are doing a permanent inventory update. We need to keep going so the @@ -1730,6 +1761,16 @@ #else pline("Not carrying anything."); #endif +#ifdef DUMP_LOG + if (want_dump) { +#ifdef GOLDOBJ + dump(" ", "Not carrying anything"); +#else + dump(" Not carrying anything", + u.ugold ? " except gold." : "."); +#endif + } +#endif return 0; } @@ -1747,16 +1788,80 @@ want_reply ? PICK_ONE : PICK_NONE, xprname(otmp, (char *)0, lets[0], TRUE, 0L, 0L)); if (out_cnt) *out_cnt = -1L; /* select all */ +#ifdef DUMP_LOG + if (want_dump) { + char letbuf[7]; + sprintf(letbuf, " %c - ", lets[0]); + dump(letbuf, + xprname(otmp, (char *)0, lets[0], TRUE, 0L, 0L)); + } +#endif break; } } return ret; } +#ifdef SORTLOOT + /* count the number of items */ + for (n = 0, otmp = invent; otmp; otmp = otmp->nobj) + if(!lets || !*lets || index(lets, otmp->invlet)) n++; + + /* Make a temporary array to store the objects sorted */ + oarray = (struct obj **)alloc(n*sizeof(struct obj*)); + + /* Add objects to the array */ + i = 0; + for(otmp = invent; otmp; otmp = otmp->nobj) + if(!lets || !*lets || index(lets, otmp->invlet)) { + if (iflags.sortloot == 'f') { + /* Insert object at correct index */ + for (j = i; j; j--) { + if (strcmpi(cxname2(otmp), cxname2(oarray[j-1]))>0) break; + oarray[j] = oarray[j-1]; + } + oarray[j] = otmp; + i++; + } else { + /* Just add it to the array */ + oarray[i++] = otmp; + } + } +#endif /* SORTLOOT */ + start_menu(win); nextclass: classcount = 0; any.a_void = 0; /* set all bits to zero */ +#ifdef SORTLOOT + for(i = 0; i < n; i++) { + otmp = oarray[i]; + ilet = otmp->invlet; + if (!flags.sortpack || otmp->oclass == *invlet) { + if (flags.sortpack && !classcount) { + any.a_void = 0; /* zero */ + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_INVERSE, + let_to_name(*invlet, FALSE), MENU_UNSELECTED); +#ifdef DUMP_LOG + if (want_dump) + dump(" ", let_to_name(*invlet, FALSE)); +#endif + classcount++; + } + any.a_char = ilet; + add_menu(win, obj_to_glyph(otmp), + &any, ilet, 0, ATR_NONE, doname(otmp), + MENU_UNSELECTED); +#ifdef DUMP_LOG + if (want_dump) { + char letbuf[7]; + sprintf(letbuf, " %c - ", ilet); + dump(letbuf, doname(otmp)); + } +#endif + } + } +#else /* SORTLOOT */ for(otmp = invent; otmp; otmp = otmp->nobj) { ilet = otmp->invlet; if(!lets || !*lets || index(lets, ilet)) { @@ -1765,15 +1870,27 @@ any.a_void = 0; /* zero */ add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, let_to_name(*invlet, FALSE), MENU_UNSELECTED); +#ifdef DUMP_LOG + if (want_dump) + dump(" ", let_to_name(*invlet, FALSE)); +#endif classcount++; } any.a_char = ilet; add_menu(win, obj_to_glyph(otmp), &any, ilet, 0, ATR_NONE, doname(otmp), MENU_UNSELECTED); +#ifdef DUMP_LOG + if (want_dump) { + char letbuf[7]; + sprintf(letbuf, " %c - ", ilet); + dump(letbuf, doname(otmp)); + } +#endif } } } +#endif /* SORTLOOT */ if (flags.sortpack) { if (*++invlet) goto nextclass; #ifdef WIZARD @@ -1783,6 +1900,9 @@ } #endif } +#ifdef SORTLOOT + free(oarray); +#endif end_menu(win, (char *) 0); n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected); @@ -1792,6 +1912,9 @@ free((genericptr_t)selected); } else ret = !n ? '\0' : '\033'; /* cancelled */ +#ifdef DUMP_LOG + if (want_dump) dump("", ""); +#endif return ret; } @@ -1808,9 +1931,24 @@ register const char *lets; boolean want_reply; { - return display_pickinv(lets, want_reply, (long *)0); + return display_pickinv(lets, want_reply, (long *)0 +#ifdef DUMP_LOG + , FALSE +#endif + ); } +#ifdef DUMP_LOG +/* See display_inventory. This is the same thing WITH dumpfile creation */ +char +dump_inventory(lets, want_reply) +register const char *lets; +boolean want_reply; +{ + return display_pickinv(lets, want_reply, (long *)0, TRUE); +} +#endif + /* * Returns the number of unpaid items within the given list. This includes * contained objects. @@ -1861,6 +1999,21 @@ if (list->oclass != COIN_CLASS && !list->bknown) count++; break; +#ifdef ITEMCAT + case UNIDENTIFIED: + if (NOT_IDENTIFIED_ITEMCAT(list)) + count++; + break; + case RUSTPRONE: + if (list->oclass != COIN_CLASS && is_known_rustprone(list)) + count++; + break; +#endif /* ITEMCAT */ +#ifdef ITEMCAT_AP + case AUTOPICKED: + count+=is_autopicked(list); + break; +#endif default: impossible("need count of curse status %d?", type); return 0; @@ -2650,13 +2803,23 @@ register char let; char alphabet[52+1], buf[52+1]; char qbuf[QBUFSZ]; +#ifdef ADJSPLIT + char allowallcnt[3]; +#else char allowall[2]; +#endif const char *adj_type; if (!flags.invlet_constant) reassign(); /* get a pointer to the object the user wants to organize */ +#ifdef ADJSPLIT + allowallcnt[0] = ALLOW_COUNT; allowallcnt[1] = ALL_CLASSES; + allowallcnt[2] = '\0'; + if (!(obj = getobj(allowallcnt,"adjust"))) return(0); +#else allowall[0] = ALL_CLASSES; allowall[1] = '\0'; if (!(obj = getobj(allowall,"adjust"))) return(0); +#endif /* initialize the list with all upper and lower case letters */ for (let = 'a', ix = 0; let <= 'z';) alphabet[ix++] = let++; @@ -2685,7 +2848,11 @@ let = yn_function(qbuf, (char *)0, '\0'); if(index(quitchars,let)) { pline(Never_mind); +#ifdef ADJSPLIT + goto cleansplit; +#else return(0); +#endif } if (let == '@' || !letter(let)) pline("Select an inventory slot letter."); @@ -2694,7 +2861,9 @@ } /* change the inventory and print the resulting item */ +#ifndef ADJSPLIT adj_type = "Moving:"; +#endif /* * don't use freeinv/addinv to avoid double-touching artifacts, @@ -2702,19 +2871,56 @@ */ extract_nobj(obj, &invent); +#ifdef ADJSPLIT + for (otmp = invent; otmp && otmp->invlet != let;) + otmp = otmp->nobj; + if (!otmp) + adj_type = "Moving:"; + else if (merged(&otmp,&obj)) { +#else for (otmp = invent; otmp;) if (merged(&otmp,&obj)) { +#endif adj_type = "Merging:"; obj = otmp; +#ifndef ADJSPLIT otmp = otmp->nobj; +#endif extract_nobj(obj, &invent); } else { +#ifdef ADJSPLIT + struct obj *otmp2; + for (otmp2 = invent; otmp2 + && otmp2->invlet != obj->invlet;) + otmp2 = otmp2->nobj; + + if (otmp2) { + char oldlet = obj->invlet; + + adj_type = "Displacing:"; + + /* Here be a nasty hack; solutions that don't + * require duplication of assigninvlet's code + * here are welcome. + */ + assigninvlet(obj); + + if (obj->invlet == NOINVSYM) { + pline("There's nowhere to put that."); + obj->invlet = oldlet; + goto cleansplit; + } + } else +#else if (otmp->invlet == let) { +#endif adj_type = "Swapping:"; otmp->invlet = obj->invlet; } +#ifndef ADJSPLIT otmp = otmp->nobj; } +#endif /* inline addinv (assuming flags.invlet_constant and !merged) */ obj->invlet = let; @@ -2726,6 +2932,14 @@ prinv(adj_type, obj, 0L); update_inventory(); return(0); +#ifdef ADJSPLIT +cleansplit: + for (otmp = invent; otmp; otmp = otmp->nobj) + if (otmp != obj && otmp->invlet == obj->invlet) + merged( &otmp, &obj ); + + return 0; +#endif } /* common to display_minventory and display_cinventory */ Only in nethack-3.4.3-new/src: invent.c.orig diff -ru nethack-3.4.3/src/mcastu.c nethack-3.4.3-new/src/mcastu.c --- nethack-3.4.3/src/mcastu.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/mcastu.c 2004-06-13 02:55:45.000000000 +0200 @@ -228,7 +228,11 @@ return(0); } - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if(rn2(ml*10) < (mtmp->mconf ? 100 : 20)) { /* fumbled attack */ if (canseemon(mtmp) && flags.soundok) pline_The("air crackles around %s.", mon_nam(mtmp)); @@ -600,13 +604,21 @@ shieldeff(u.ux, u.uy); if (multi >= 0) You("stiffen briefly."); - nomul(-1); + nomul(-1 +#ifdef HELPLESS + , "paralyzed by a monster" +#endif + ); } else { if (multi >= 0) You("are frozen in place!"); dmg = 4 + (int)mtmp->m_lev; if (Half_spell_damage) dmg = (dmg + 1) / 2; - nomul(-dmg); + nomul(-dmg +#ifdef HELPLESS + , "paralyzed by a monster" +#endif + ); } dmg = 0; break; @@ -771,7 +783,11 @@ return(0); } if(lined_up(mtmp) && rn2(3)) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if(mattk->adtyp && (mattk->adtyp < 11)) { /* no cf unsigned >0 */ if(canseemon(mtmp)) pline("%s zaps you with a %s!", Monnam(mtmp), diff -ru nethack-3.4.3/src/mhitu.c nethack-3.4.3-new/src/mhitu.c --- nethack-3.4.3/src/mhitu.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/mhitu.c 2004-06-13 02:55:45.000000000 +0200 @@ -317,7 +317,11 @@ * invisible, or you might be blind.... */ - if(!ranged) nomul(0); + if(!ranged) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if(mtmp->mhp <= 0 || (Underwater && !is_swimmer(mtmp->data))) return(0); @@ -1122,7 +1126,11 @@ if (Blind) You("are frozen!"); else You("are frozen by %s!", mon_nam(mtmp)); nomovemsg = 0; /* default: "you can move again" */ - nomul(-rnd(10)); + nomul(-rnd(10) +#ifdef HELPLESS + , "paralyzed by a monster" +#endif + ); exercise(A_DEX, FALSE); } } diff -ru nethack-3.4.3/src/mthrowu.c nethack-3.4.3-new/src/mthrowu.c --- nethack-3.4.3/src/mthrowu.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/mthrowu.c 2004-06-13 02:55:45.000000000 +0200 @@ -324,7 +324,11 @@ if (ohitmon(mtmp, singleobj, range, TRUE)) break; } else if (bhitpos.x == u.ux && bhitpos.y == u.uy) { - if (multi) nomul(0); + if (multi) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (singleobj->oclass == GEM_CLASS && singleobj->otyp <= LAST_GEM+9 /* 9 glass colors */ @@ -608,7 +612,11 @@ m_shot.o = STRANGE_OBJECT; m_shot.s = FALSE; - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } #endif /* OVL1 */ @@ -646,7 +654,11 @@ pline("%s spits venom!", Monnam(mtmp)); m_throw(mtmp, mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), distmin(mtmp->mx,mtmp->my,mtmp->mux,mtmp->muy), otmp); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); return 0; } } @@ -684,7 +696,11 @@ breathwep[typ-1]); buzz((int) (-20 - (typ-1)), (int)mattk->damn, mtmp->mx, mtmp->my, sgn(tbx), sgn(tby)); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); /* breath runs out sometimes. Also, give monster some * cunning; don't breath if the player fell asleep. */ diff -ru nethack-3.4.3/src/muse.c nethack-3.4.3-new/src/muse.c --- nethack-3.4.3/src/muse.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/muse.c 2004-06-13 02:55:45.000000000 +0200 @@ -1121,7 +1121,11 @@ losehp(tmp, "wand", KILLED_BY_AN); } else pline_The("wand misses you."); stop_occupation(); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } else if (resists_magm(mtmp)) { shieldeff(mtmp->mx, mtmp->my); pline("Boing!"); diff -ru nethack-3.4.3/src/objnam.c nethack-3.4.3-new/src/objnam.c --- nethack-3.4.3/src/objnam.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/objnam.c 2004-06-13 02:55:45.000000000 +0200 @@ -15,6 +15,9 @@ #endif static char *NDECL(nextobuf); static void FDECL(add_erosion_words, (struct obj *, char *)); +#ifdef SORTLOOT +char * FDECL(xname2, (struct obj *, boolean)); +#endif struct Jitem { int item; @@ -233,6 +236,15 @@ char * xname(obj) register struct obj *obj; +#ifdef SORTLOOT +{ + return xname2(obj, FALSE); +} +char * +xname2(obj, ignore_oquan) +register struct obj *obj; +boolean ignore_oquan; +#endif { register char *buf; register int typ = obj->otyp; @@ -469,6 +481,9 @@ default: Sprintf(buf,"glorkum %d %d %d", obj->oclass, typ, obj->spe); } +#ifdef SORTLOOT + if (!ignore_oquan) +#endif if (obj->quan != 1L) Strcpy(buf, makeplural(buf)); if (obj->onamelth && obj->dknown) { @@ -853,6 +868,16 @@ return corpse_xname(obj, FALSE); return xname(obj); } +#ifdef SORTLOOT +char * +cxname2(obj) +struct obj *obj; +{ + if (obj->otyp == CORPSE) + return corpse_xname(obj, TRUE); + return xname2(obj, TRUE); +} +#endif /* SORTLOOT */ /* treat an object as fully ID'd when it might be used as reason for death */ char * diff -ru nethack-3.4.3/src/options.c nethack-3.4.3-new/src/options.c --- nethack-3.4.3/src/options.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/options.c 2004-06-13 02:56:01.000000000 +0200 @@ -75,6 +75,9 @@ {"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/ # endif {"confirm",&flags.confirm, TRUE, SET_IN_GAME}, +#ifdef DEATH_EXPLORE + {"death_explore", &iflags.death_expl, FALSE, SET_IN_GAME}, +#endif #if defined(TERMLIB) && !defined(MAC_GRAPHICS_ENV) {"DECgraphics", &iflags.DECgraphics, FALSE, SET_IN_GAME}, #else @@ -113,6 +116,9 @@ #endif {"large_font", &iflags.obsolete, FALSE, SET_IN_FILE}, /* OBSOLETE */ {"legacy", &flags.legacy, TRUE, DISP_IN_GAME}, +#ifdef ITEMCAT + {"like_swimming", &iflags.like_swimming, FALSE, SET_IN_GAME}, +#endif /* ITEMCAT */ {"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME}, {"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME}, #ifdef MAC_GRAPHICS_ENV @@ -125,6 +131,15 @@ #else {"mail", (boolean *)0, TRUE, SET_IN_FILE}, #endif +#ifdef MENU_COLOR +# ifdef MICRO + {"menucolors", &iflags.use_menu_color, TRUE, SET_IN_GAME}, +# else + {"menucolors", &iflags.use_menu_color, FALSE, SET_IN_GAME}, +# endif +#else + {"menucolors", (boolean *)0, FALSE, SET_IN_GAME}, +#endif #ifdef WIZARD /* for menu debugging only*/ {"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME}, @@ -143,6 +158,11 @@ #else {"page_wait", (boolean *)0, FALSE, SET_IN_FILE}, #endif +#ifdef PARANOID + {"paranoid_hit", &iflags.paranoid_hit, FALSE, SET_IN_GAME}, + {"paranoid_quit", &iflags.paranoid_quit, FALSE, SET_IN_GAME}, + {"paranoid_remove", &iflags.paranoid_remove, FALSE, SET_IN_GAME}, +#endif {"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME}, {"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/ {"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME}, @@ -160,6 +180,9 @@ #else {"sanity_check", (boolean *)0, FALSE, SET_IN_FILE}, #endif +#ifdef SHOW_BORN + {"showborn", &iflags.show_born, FALSE, SET_IN_GAME}, +#endif #ifdef EXP_ON_BOTL {"showexp", &flags.showexp, FALSE, SET_IN_GAME}, #else @@ -193,6 +216,11 @@ #else {"use_inverse", &iflags.wc_inverse, FALSE, SET_IN_GAME}, /*WC*/ #endif +#ifdef WIN_EDGE + {"win_edge", &iflags.win_edge, FALSE, SET_IN_GAME}, +#else + {"win_edge", (boolean *)0, TRUE, SET_IN_FILE}, +#endif {"verbose", &flags.verbose, TRUE, SET_IN_GAME}, {"wraptext", &iflags.wc2_wraptext, FALSE, SET_IN_GAME}, {(char *)0, (boolean *)0, FALSE, 0} @@ -224,6 +252,14 @@ SET_IN_GAME }, { "dogname", "the name of your (first) dog (e.g., dogname:Fang)", PL_PSIZ, DISP_IN_GAME }, +#ifdef DUMP_LOG + { "dumpfile", "where to dump data (e.g., dumpfile:/tmp/dump.nh)", +#ifdef DUMP_FN + PL_PSIZ, DISP_IN_GAME }, +#else + PL_PSIZ, SET_IN_GAME }, +#endif +#endif { "dungeon", "the symbols to use in drawing the dungeon map", MAXDCHARS+1, SET_IN_FILE }, { "effects", "the symbols to use in drawing special effects", @@ -246,6 +282,9 @@ { "horsename", "the name of your (first) horse (e.g., horsename:Silver)", PL_PSIZ, DISP_IN_GAME }, { "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/ +#ifdef MENU_COLOR + { "menucolor", "set menu colors", PL_PSIZ, SET_IN_FILE }, +#endif { "menustyle", "user interface for object selection", MENUTYPELEN, SET_IN_GAME }, { "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE }, @@ -306,6 +345,9 @@ { "scroll_amount", "amount to scroll map when scroll_margin is reached", 20, DISP_IN_GAME }, /*WC*/ { "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/ +#ifdef SORTLOOT + { "sortloot", "sort object selection lists by description", 4, SET_IN_GAME }, +#endif #ifdef MSDOS { "soundcard", "type of sound card to use", 20, SET_IN_FILE }, #endif @@ -532,6 +574,10 @@ flags.warnlevel = 1; flags.warntype = 0L; +#ifdef SORTLOOT + iflags.sortloot = 'n'; +#endif + /* assert( sizeof flags.inv_order == sizeof def_inv_order ); */ (void)memcpy((genericptr_t)flags.inv_order, (genericptr_t)def_inv_order, sizeof flags.inv_order); @@ -964,6 +1010,120 @@ } } +#ifdef MENU_COLOR +extern struct menucoloring *menu_colorings; + +static const struct { + const char *name; + const int color; +} colornames[] = { + {"black", CLR_BLACK}, + {"red", CLR_RED}, + {"green", CLR_GREEN}, + {"brown", CLR_BROWN}, + {"blue", CLR_BLUE}, + {"magenta", CLR_MAGENTA}, + {"cyan", CLR_CYAN}, + {"gray", CLR_GRAY}, + {"orange", CLR_ORANGE}, + {"lightgreen", CLR_BRIGHT_GREEN}, + {"yellow", CLR_YELLOW}, + {"lightblue", CLR_BRIGHT_BLUE}, + {"lightmagenta", CLR_BRIGHT_MAGENTA}, + {"lightcyan", CLR_BRIGHT_CYAN}, + {"white", CLR_WHITE} +}; + +static const struct { + const char *name; + const int attr; +} attrnames[] = { + {"none", ATR_NONE}, + {"bold", ATR_BOLD}, + {"dim", ATR_DIM}, + {"underline", ATR_ULINE}, + {"blink", ATR_BLINK}, + {"inverse", ATR_INVERSE} + +}; + +/* parse '"regex_string"=color&attr' and add it to menucoloring */ +boolean +add_menu_coloring(str) +char *str; +{ + int i, c = NO_COLOR, a = ATR_NONE; + struct menucoloring *tmp; + char *tmps, *cs = strchr(str, '='); + const char *err = (char *)0; + + if (!cs || !str) return FALSE; + + tmps = cs; + tmps++; + while (*tmps && isspace(*tmps)) tmps++; + + for (i = 0; i < SIZE(colornames); i++) + if (strstri(tmps, colornames[i].name) == tmps) { + c = colornames[i].color; + break; + } + if ((i == SIZE(colornames)) && (*tmps >= '0' && *tmps <='9')) + c = atoi(tmps); + + if (c > 15) return FALSE; + + tmps = strchr(str, '&'); + if (tmps) { + tmps++; + while (*tmps && isspace(*tmps)) tmps++; + for (i = 0; i < SIZE(attrnames); i++) + if (strstri(tmps, attrnames[i].name) == tmps) { + a = attrnames[i].attr; + break; + } + if ((i == SIZE(attrnames)) && (*tmps >= '0' && *tmps <='9')) + a = atoi(tmps); + } + + *cs = '\0'; + tmps = str; + if ((*tmps == '"') || (*tmps == '\'')) { + cs--; + while (isspace(*cs)) cs--; + if (*cs == *tmps) { + *cs = '\0'; + tmps++; + } + } + + tmp = (struct menucoloring *)alloc(sizeof(struct menucoloring)); +#ifdef MENU_COLOR_REGEX + tmp->match.translate = 0; + tmp->match.fastmap = 0; + tmp->match.buffer = 0; + tmp->match.allocated = 0; + tmp->match.regs_allocated = REGS_FIXED; + err = re_compile_pattern(tmps, strlen(tmps), &tmp->match); +#else + tmp->match = (char *)alloc(strlen(tmps)+1); + (void) memcpy((genericptr_t)tmp->match, (genericptr_t)tmps, strlen(tmps)+1); +#endif + if (err) { + raw_printf("\nMenucolor regex error: %s\n", err); + wait_synch(); + free(tmp); + return FALSE; + } else { + tmp->next = menu_colorings; + tmp->color = c; + tmp->attr = a; + menu_colorings = tmp; + return TRUE; + } +} +#endif /* MENU_COLOR */ + void parseoptions(opts, tinitial, tfrom_file) register char *opts; @@ -1077,6 +1237,19 @@ return; } +#ifdef DUMP_LOG + fullname = "dumpfile"; + if (match_optname(opts, fullname, 3, TRUE)) { +#ifndef DUMP_FN + if (negated) bad_negation(fullname, FALSE); + else if ((op = string_for_opt(opts, !tfrom_file)) != 0 + && strlen(op) > 1) + nmcpy(dump_fn, op, PL_PSIZ); +#endif + return; + } +#endif + fullname = "horsename"; if (match_optname(opts, fullname, 5, TRUE)) { if (negated) bad_negation(fullname, FALSE); @@ -1133,6 +1306,18 @@ return; } + /* menucolor:"regex_string"=color */ + fullname = "menucolor"; + if (match_optname(opts, fullname, 9, TRUE)) { +#ifdef MENU_COLOR + if (negated) bad_negation(fullname, FALSE); + else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) + if (!add_menu_coloring(op)) + badoption(opts); +#endif + return; + } + fullname = "msghistory"; if (match_optname(opts, fullname, 3, TRUE)) { op = string_for_env_opt(fullname, opts, negated); @@ -1839,6 +2024,24 @@ return; } +#ifdef SORTLOOT + fullname = "sortloot"; + if (match_optname(opts, fullname, 4, TRUE)) { + op = string_for_env_opt(fullname, opts, FALSE); + if (op) { + switch (tolower(*op)) { + case 'n': + case 'l': + case 'f': iflags.sortloot = tolower(*op); + break; + default: badoption(opts); + return; + } + } + return; + } +#endif /* SORTLOOT */ + fullname = "suppress_alert"; if (match_optname(opts, fullname, 4, TRUE)) { op = string_for_opt(opts, negated); @@ -2263,6 +2466,12 @@ "teleport", "run", "walk", "crawl" }; +#ifdef SORTLOOT +static NEARDATA const char *sortltype[] = { + "none", "loot", "full" +}; +#endif + /* * Convert the given string of object classes to a string of default object * symbols. @@ -2540,7 +2749,7 @@ boolean retval = FALSE; /* Special handling of menustyle, pickup_burden, pickup_types, - * disclose, runmode, msg_window, menu_headings, and number_pad options. + * disclose, runmode, msg_window, menu_headings, number_pad and sortloot #ifdef AUTOPICKUP_EXCEPTIONS * Also takes care of interactive autopickup_exception_handling changes. #endif @@ -2761,6 +2970,26 @@ } destroy_nhwindow(tmpwin); retval = TRUE; +#ifdef SORTLOOT + } else if (!strcmp("sortloot", optname)) { + const char *sortl_name; + menu_item *sortl_pick = (menu_item *)0; + tmpwin = create_nhwindow(NHW_MENU); + start_menu(tmpwin); + for (i = 0; i < SIZE(sortltype); i++) { + sortl_name = sortltype[i]; + any.a_char = *sortl_name; + add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, + ATR_NONE, sortl_name, MENU_UNSELECTED); + } + end_menu(tmpwin, "Select loot sorting type:"); + if (select_menu(tmpwin, PICK_ONE, &sortl_pick) > 0) { + iflags.sortloot = sortl_pick->item.a_char; + free((genericptr_t)sortl_pick); + } + destroy_nhwindow(tmpwin); + retval = TRUE; +#endif /* SORTLOOT */ } else if (!strcmp("menu_headings", optname)) { static const char *mhchoices[3] = {"bold", "inverse", "underline"}; const char *npletters = "biu"; @@ -2933,6 +3162,10 @@ } else if (!strcmp(optname, "dogname")) Sprintf(buf, "%s", dogname[0] ? dogname : none ); +#ifdef DUMP_LOG + else if (!strcmp(optname, "dumpfile")) + Sprintf(buf, "%s", dump_fn[0] ? dump_fn: none ); +#endif else if (!strcmp(optname, "dungeon")) Sprintf(buf, "%s", to_be_done); else if (!strcmp(optname, "effects")) @@ -3072,6 +3305,17 @@ if (iflags.wc_scroll_margin) Sprintf(buf, "%d",iflags.wc_scroll_margin); else Strcpy(buf, defopt); } +#ifdef SORTLOOT + else if (!strcmp(optname, "sortloot")) { + char *sortname = (char *)NULL; + for (i=0; i < SIZE(sortltype) && sortname==(char *)NULL; i++) { + if (iflags.sortloot == sortltype[i][0]) + sortname = (char *)sortltype[i]; + } + if (sortname != (char *)NULL) + Sprintf(buf, "%s", sortname); + } +#endif /* SORTLOOT */ else if (!strcmp(optname, "player_selection")) Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog"); #ifdef MSDOS Only in nethack-3.4.3-new/src: options.c.orig diff -ru nethack-3.4.3/src/pickup.c nethack-3.4.3-new/src/pickup.c --- nethack-3.4.3/src/pickup.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/pickup.c 2004-06-13 02:56:02.000000000 +0200 @@ -39,6 +39,14 @@ STATIC_DCL boolean FDECL(able_to_loot, (int, int)); STATIC_DCL boolean FDECL(mon_beside, (int, int)); +#ifdef ITEMCAT_JP +char *ctg_justpicked="Items just Picked up"; +char *ctg_justremoved="Items just taken out"; +char **jpick_ctg=&ctg_justpicked; +STATIC_PTR int FDECL(is_justpicked,(struct obj *)); +#define DESTROY_JPICK(j) while(*(j)) { struct jpick *next=(*(j))->next_pick; free((genericptr_t) *(j)); *(j)=next; } +#endif + /* define for query_objlist() and autopickup() */ #define FOLLOW(curr, flags) \ (((flags) & BY_NEXTHERE) ? (curr)->nexthere : (curr)->nobj) @@ -87,6 +95,61 @@ } } +#ifdef ITEMCAT_AP +int +is_autopicked(obj) +register struct obj *obj; +{ + const char *otypes = flags.pickup_types; +#ifndef AUTOPICKUP_EXCEPTIONS + if (!*otypes || index(otypes, obj->oclass)) +#else + if ((!*otypes || index(otypes, obj->oclass) || + is_autopickup_exception(obj, TRUE)) && + !is_autopickup_exception(obj, FALSE)) +#endif + return 1; + return 0; +} +#endif /* ITEMCAT_AP */ +#ifdef ITEMCAT_JP +/* just picked items llist */ +struct jpick { + struct obj *o; + struct jpick *next_pick; +}; +static NEARDATA struct jpick *jpick_head=(struct jpick *)0; +STATIC_PTR int +is_justpicked(obj) +register struct obj *obj; +{ + struct jpick *list=jpick_head; + while(list) { + if(obj==list->o) + return 1; + list=list->next_pick; + } + return 0; +} +void +jpick_free(obj) +register struct obj *obj; +{ + struct jpick **p=&jpick_head; + struct jpick *next; + + while(*p) { + next=(*p)->next_pick; + if(obj==(*p)->o) { + free((genericptr_t) *p); + *p=next; + break; + } + p=&(*p)->next_pick; + } +} +#endif /* ITEMCAT_JP */ + #ifndef GOLDOBJ int collect_obj_classes(ilets, otmp, here, incl_gold, filter, itemcount) @@ -267,7 +330,13 @@ /* If there are objects here, take a look. */ if (ct) { - if (flags.run) nomul(0); + if (flags.run) { + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); + } flush_screen(1); (void) look_here(ct, picked_some); } else { @@ -324,24 +393,53 @@ allow_category(obj) struct obj *obj; { +#ifdef ITEMCAT_NEG + int result=0; + int itemcat_negate=(index(valid_menu_classes,'Z') != (char *)0); +#define Return result = +#else +#define Return return +#endif if (Role_if(PM_PRIEST)) obj->bknown = TRUE; if (((index(valid_menu_classes,'u') != (char *)0) && obj->unpaid) || (index(valid_menu_classes, obj->oclass) != (char *)0)) - return TRUE; + Return TRUE; else if (((index(valid_menu_classes,'U') != (char *)0) && (obj->oclass != COIN_CLASS && obj->bknown && !obj->blessed && !obj->cursed))) - return TRUE; + Return TRUE; else if (((index(valid_menu_classes,'B') != (char *)0) && (obj->oclass != COIN_CLASS && obj->bknown && obj->blessed))) - return TRUE; + Return TRUE; else if (((index(valid_menu_classes,'C') != (char *)0) && (obj->oclass != COIN_CLASS && obj->bknown && obj->cursed))) - return TRUE; + Return TRUE; else if (((index(valid_menu_classes,'X') != (char *)0) && (obj->oclass != COIN_CLASS && !obj->bknown))) - return TRUE; + Return TRUE; +#ifdef ITEMCAT + else if (((index(valid_menu_classes,'I') != (char *)0) && + NOT_IDENTIFIED_ITEMCAT(obj))) + Return TRUE; + else if (((index(valid_menu_classes,'r') != (char *)0) && + (obj->oclass != COIN_CLASS && is_known_rustprone(obj)))) + Return TRUE; +#endif /* ITEMCAT */ +#ifdef ITEMCAT_JP + else if (((index(valid_menu_classes,'P') != (char *)0) && + (is_justpicked(obj)))) + Return TRUE; +#endif +#ifdef ITEMCAT_AP + else if (((index(valid_menu_classes,'Q') != (char *)0) && + (is_autopicked(obj)))) + Return TRUE; +#endif else - return FALSE; + Return FALSE; +#ifdef ITEMCAT_NEG + return itemcat_negate?(!result):result; +#undef Return +#endif } #if 0 /* not used */ @@ -390,6 +488,9 @@ boolean autopickup = what > 0; struct obj *objchain; int traverse_how; +#ifdef ITEMCAT_JP + struct jpick *jtmp=jpick_head; +#endif if (what < 0) /* pick N of something */ count = -what; @@ -440,9 +541,20 @@ } /* if there's anything here, stop running */ - if (OBJ_AT(u.ux,u.uy) && flags.run && flags.run != 8 && !flags.nopick) nomul(0); + if (OBJ_AT(u.ux,u.uy) && flags.run + && flags.run != 8 && !flags.nopick) { + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); + } } +#ifdef ITEMCAT_JP + jpick_head=(struct jpick *) 0; +#endif + add_valid_menu_class(0); /* reset */ if (!u.uswallow) { objchain = level.objects[u.ux][u.uy]; @@ -528,7 +640,19 @@ FALSE, #endif &via_menu)) { - if (!via_menu) return (0); + if (!via_menu) +#ifdef ITEMCAT_JP + { + if(jpick_head) { + jpick_ctg=&ctg_justpicked; + DESTROY_JPICK(&jtmp) + } else + jpick_head=jtmp; + return (0); + } +#else + return (0); +#endif /* ITEMCAT_JP */ n = query_objlist("Pick up what?", objchain, traverse_how|(selective ? 0 : INVORDER_SORT), @@ -592,6 +716,13 @@ /* see whether there's anything else here, after auto-pickup is done */ if (autopickup) check_here(n_picked > 0); } +#ifdef ITEMCAT_JP + if(jpick_head) { + jpick_ctg=&ctg_justpicked; + DESTROY_JPICK(&jtmp) + } else + jpick_head=jtmp; +#endif return (n_tried > 0); } @@ -690,9 +821,15 @@ int how; /* type of query */ boolean FDECL((*allow), (OBJ_P));/* allow function */ { +#ifdef SORTLOOT + int i, j; +#endif int n; winid win; struct obj *curr, *last; +#ifdef SORTLOOT + struct obj **oarray; +#endif char *pack; anything any; boolean printed_type_name; @@ -717,6 +854,33 @@ return 1; } +#ifdef SORTLOOT + /* Make a temporary array to store the objects sorted */ + oarray = (struct obj **)alloc(n*sizeof(struct obj*)); + + /* Add objects to the array */ + i = 0; + for (curr = olist; curr; curr = FOLLOW(curr, qflags)) { + if ((*allow)(curr)) { + if (iflags.sortloot == 'f' || + (iflags.sortloot == 'l' && !(qflags & USE_INVLET))) + { + /* Insert object at correct index */ + for (j = i; j; j--) + { + if (strcmpi(cxname2(curr), cxname2(oarray[j-1]))>0) break; + oarray[j] = oarray[j-1]; + } + oarray[j] = curr; + i++; + } else { + /* Just add it to the array */ + oarray[i++] = curr; + } + } + } +#endif /* SORTLOOT */ + win = create_nhwindow(NHW_MENU); start_menu(win); any.a_obj = (struct obj *) 0; @@ -730,7 +894,12 @@ pack = flags.inv_order; do { printed_type_name = FALSE; +#ifdef SORTLOOT + for (i = 0; i < n; i++) { + curr = oarray[i]; +#else /* SORTLOOT */ for (curr = olist; curr; curr = FOLLOW(curr, qflags)) { +#endif /* SORTLOOT */ if ((qflags & FEEL_COCKATRICE) && curr->otyp == CORPSE && will_feel_cockatrice(curr, FALSE)) { destroy_nhwindow(win); /* stop the menu and revert */ @@ -758,6 +927,9 @@ pack++; } while (qflags & INVORDER_SORT && *pack); +#ifdef SORTLOOT + free(oarray); +#endif end_menu(win, qstr); n = select_menu(win, how, pick_list); destroy_nhwindow(win); @@ -796,6 +968,19 @@ boolean collected_type_name; char invlet; int ccount; +#ifdef ITEMCAT + boolean do_unident = FALSE; + boolean do_rustprone = FALSE; +#endif +#ifdef ITEMCAT_JP + boolean do_justpicked = FALSE; +#endif +#ifdef ITEMCAT_AP + boolean do_autopicked = FALSE; +#endif +#ifdef ITEMCAT_NEG + boolean do_invsel = FALSE; +#endif boolean do_unpaid = FALSE; boolean do_blessed = FALSE, do_cursed = FALSE, do_uncursed = FALSE, do_buc_unknown = FALSE; @@ -821,6 +1006,27 @@ num_buc_types++; } +#ifdef ITEMCAT + if ((qflags & UNIDENTIFIED) && count_buc(olist, UNIDENTIFIED)) + do_unident = TRUE; + + if (iflags.like_swimming && (qflags & RUSTPRONE) && count_buc(olist, RUSTPRONE)) + do_rustprone = TRUE; + +#endif +#ifdef ITEMCAT_JP + if ((qflags & JUSTPICKED) && jpick_head!=(struct jpick *) 0) + do_justpicked = TRUE; +#endif +#ifdef ITEMCAT_AP + if ((qflags & AUTOPICKED) && count_buc(olist, AUTOPICKED)) + do_autopicked = TRUE; +#endif +#ifdef ITEMCAT_NEG + if (how!=PICK_ONE) + do_invsel = TRUE; +#endif + ccount = count_categories(olist, qflags); /* no point in actually showing a menu for a single category */ if (ccount == 1 && !do_unpaid && num_buc_types <= 1 && !(qflags & BILLED_TYPES)) { @@ -905,6 +1111,48 @@ "Auto-select every item being worn" : "Auto-select every item", MENU_UNSELECTED); } +#ifdef ITEMCAT_JP + if (do_justpicked) { + invlet = 'P'; + any.a_void = 0; + any.a_int = 'P'; + add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, + *jpick_ctg, + MENU_UNSELECTED); + } +#endif /*ITEMCAT_JP*/ +#ifdef ITEMCAT + if (do_unident) { + invlet = 'I'; + any.a_void = 0; + any.a_int = 'I'; + add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, + "Unidentified Items", + MENU_UNSELECTED); + } +#endif /* ITEMCAT */ +#ifdef ITEMCAT_AP + if (do_autopicked) { + invlet = 'Q'; + any.a_void = 0; + any.a_int = 'Q'; + add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, + "Auto-picked items", + MENU_UNSELECTED + ); + } +#endif /* ITEMCAT_AP */ +#ifdef ITEMCAT_NEG + if (do_invsel) { + invlet = 'Z'; + any.a_void = 0; + any.a_int = 'Z'; + add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, + "Inverse selection", + MENU_UNSELECTED + ); + } +#endif /* ITEMCAT_AP */ /* items with b/u/c/unknown if there are any */ if (do_blessed) { invlet = 'B'; @@ -935,6 +1183,16 @@ "Items of unknown B/C/U status", MENU_UNSELECTED); } +#ifdef ITEMCAT + if (iflags.like_swimming && do_rustprone) { + invlet = 'r'; + any.a_void = 0; + any.a_int = 'r'; + add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, + "Items known to be Rustprone", + MENU_UNSELECTED); + } +#endif /* ITEMCAT */ end_menu(win, qstr); n = select_menu(win, how, pick_list); destroy_nhwindow(win); @@ -1301,7 +1559,13 @@ obj->quan -= count; } flags.botl = 1; - if (flags.run) nomul(0); + if (flags.run) { + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); + } return 1; #endif } else if (obj->otyp == CORPSE) { @@ -1373,6 +1637,9 @@ pick_obj(otmp) struct obj *otmp; { +#ifdef ITEMCAT_JP + struct jpick *pick; +#endif obj_extract_self(otmp); if (!u.uswallow && otmp != uball && costly_spot(otmp->ox, otmp->oy)) { char saveushops[5], fakeshop[2]; @@ -1394,7 +1661,18 @@ if (otmp->no_charge) /* only applies to objects outside invent */ otmp->no_charge = 0; newsym(otmp->ox, otmp->oy); - return addinv(otmp); /* might merge it with other objects */ +#ifdef ITEMCAT_JP + otmp=addinv(otmp); /* might merge it with other objects */ + if(otmp->oclass!=COIN_CLASS) { + pick=(struct jpick *) alloc(sizeof(struct jpick)); + pick->next_pick=jpick_head; + pick->o=otmp; + jpick_head=pick; + } + return otmp; +#else + return addinv(otmp); +#endif /* ITEMCAT_JP */ } /* @@ -1931,6 +2209,9 @@ boolean is_gold = (obj->oclass == COIN_CLASS); int res, loadlev; long count; +#ifdef ITEMCAT_JP + struct jpick *pick; +#endif if (!current_container) { impossible(" no current_container?"); @@ -1985,6 +2266,14 @@ verbalize("You sneaky cad! Get out of here with that pick!"); otmp = addinv(obj); +#ifdef ITEMCAT_JP + if(!is_gold) { + pick=(struct jpick *) alloc(sizeof(struct jpick)); + pick->next_pick=jpick_head; + pick->o=otmp; + jpick_head=pick; + } +#endif loadlev = near_capacity(); prinv(loadlev ? (loadlev < MOD_ENCUMBER ? @@ -2101,7 +2390,11 @@ (void) chest_trap(obj, HAND, FALSE); /* even if the trap fails, you've used up this turn */ if (multi >= 0) { /* in case we didn't become paralyzed */ - nomul(-1); + nomul(-1 +#ifdef HELPLESS + , "opening a container" +#endif + ); nomovemsg = ""; } return 1; @@ -2186,6 +2479,14 @@ FALSE, #endif &menu_on_request)) { +#ifdef ITEMCAT_JP + /* normally one wouldn't use traditional + itemcat_jp, + * so we don't make extra checks whether something + * relevant was in fact picked up, just destroy the + * list for consistency. */ + jpick_ctg=&ctg_justremoved; + DESTROY_JPICK(&jpick_head) +#endif if (askchain((struct obj **)¤t_container->cobj, (one_by_one ? (char *)0 : select), allflag, out_container, @@ -2311,14 +2612,33 @@ menu_item *pick_list; int mflags, res; long count; +#ifdef ITEMCAT_JP + struct jpick *jtmp; +#endif if (retry) { all_categories = (retry == -2); } else if (flags.menu_style == MENU_FULL) { all_categories = FALSE; Sprintf(buf,"%s what type of objects?", put_in ? putin : takeout); - mflags = put_in ? ALL_TYPES | BUC_ALLBKNOWN | BUC_UNKNOWN : - ALL_TYPES | CHOOSE_ALL | BUC_ALLBKNOWN | BUC_UNKNOWN; + mflags = put_in ? ALL_TYPES | BUC_ALLBKNOWN | BUC_UNKNOWN +#ifdef ITEMCAT_JP + | JUSTPICKED +#endif +#ifdef ITEMCAT_AP + | AUTOPICKED +#endif +#ifdef ITEMCAT + | UNIDENTIFIED | RUSTPRONE +#endif + : ALL_TYPES | CHOOSE_ALL | BUC_ALLBKNOWN | BUC_UNKNOWN +#ifdef ITEMCAT + | UNIDENTIFIED | RUSTPRONE +#endif +#ifdef ITEMCAT_AP + | AUTOPICKED +#endif + ; n = query_category(buf, put_in ? invent : container->cobj, mflags, &pick_list, PICK_ANY); if (!n) return 0; @@ -2334,11 +2654,26 @@ } if (loot_everything) { +#ifdef ITEMCAT_NEG + if(index(valid_menu_classes,'Z') != (char *)0) + return 0; +#endif +#ifdef ITEMCAT_JP + jtmp=jpick_head; + jpick_head=(struct jpick *) 0; +#endif for (otmp = container->cobj; otmp; otmp = otmp2) { otmp2 = otmp->nobj; res = out_container(otmp); if (res < 0) break; } +#ifdef ITEMCAT_JP + if(jpick_head) { + jpick_ctg=&ctg_justremoved; + DESTROY_JPICK(&jtmp) + } else + jpick_head=jtmp; +#endif } else { mflags = INVORDER_SORT; if (put_in && flags.invlet_constant) mflags |= USE_INVLET; @@ -2348,6 +2683,12 @@ all_categories ? allow_all : allow_category); if (n) { n_looted = n; +#ifdef ITEMCAT_JP + if(!put_in) { + jtmp=jpick_head; + jpick_head=(struct jpick *) 0; + } +#endif for (i = 0; i < n; i++) { otmp = pick_list[i].item.a_obj; count = pick_list[i].count; @@ -2364,6 +2705,15 @@ break; } } +#ifdef ITEMCAT_JP + if(!put_in) { + if(jpick_head) { + jpick_ctg=&ctg_justremoved; + DESTROY_JPICK(&jtmp) + } else + jpick_head=jtmp; + } +#endif free((genericptr_t)pick_list); } } Only in nethack-3.4.3-new/src: pickup.c.orig diff -ru nethack-3.4.3/src/polyself.c nethack-3.4.3-new/src/polyself.c --- nethack-3.4.3/src/polyself.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/polyself.c 2004-06-13 02:55:45.000000000 +0200 @@ -729,7 +729,11 @@ done(DIED); } if (!uarmg) selftouch("No longer petrify-resistant, you"); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); flags.botl = 1; vision_full_recalc = 1; @@ -1019,7 +1023,11 @@ nomul((u.ulevel > 6 || rn2(4)) ? -d((int)mtmp->m_lev+1, (int)mtmp->data->mattk[0].damd) - : -200); + : -200 +#ifdef HELPLESS + , "frozen by a monster's gaze" +#endif + ); return 1; } else You("stiffen momentarily under %s gaze.", diff -ru nethack-3.4.3/src/potion.c nethack-3.4.3-new/src/potion.c --- nethack-3.4.3/src/potion.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/potion.c 2004-06-13 02:55:45.000000000 +0200 @@ -316,7 +316,11 @@ Hallucination ? rndmonnam() : (const char *)"ghost"); if(flags.verbose) You("are frightened to death, and unable to move."); - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "being frightened to death" +#endif + ); nomovemsg = "You regain your composure."; } @@ -603,7 +607,11 @@ else Your("%s are frozen to the %s!", makeplural(body_part(FOOT)), surface(u.ux, u.uy)); - nomul(-(rn1(10, 25 - 12*bcsign(otmp)))); + nomul(-(rn1(10, 25 - 12*bcsign(otmp))) +#ifdef HELPLESS + , "frozen by a potion" +#endif + ); nomovemsg = You_can_move_again; exercise(A_DEX, FALSE); } @@ -1255,7 +1263,11 @@ kn++; if (!Free_action) { pline("%s seems to be holding you.", Something); - nomul(-rnd(5)); + nomul(-rnd(5) +#ifdef HELPLESS + , "frozen by a potion" +#endif + ); nomovemsg = You_can_move_again; exercise(A_DEX, FALSE); } else You("stiffen momentarily."); @@ -1264,7 +1276,11 @@ kn++; if (!Free_action && !Sleep_resistance) { You_feel("rather tired."); - nomul(-rnd(5)); + nomul(-rnd(5) +#ifdef HELPLESS + , "sleeping off a magical draught" +#endif + ); nomovemsg = You_can_move_again; exercise(A_DEX, FALSE); } else You("yawn."); diff -ru nethack-3.4.3/src/pray.c nethack-3.4.3-new/src/pray.c --- nethack-3.4.3/src/pray.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/pray.c 2004-06-13 02:55:45.000000000 +0200 @@ -1206,7 +1206,11 @@ if (sgn(u.ualign.type) == sgn(dmon->data->maligntyp)) dmon->mpeaceful = TRUE; You("are terrified, and unable to move."); - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "being terrified of a demon" +#endif + ); } else pline_The("%s.", demonless_msg); } @@ -1579,7 +1583,11 @@ } } #endif - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "praying" +#endif + ); nomovemsg = "You finish your prayer."; afternmv = prayer_done; @@ -1739,7 +1747,11 @@ } } } - nomul(-5); + nomul(-5 +#ifdef HELPLESS + , "trying to turn the monsters" +#endif + ); return(1); } diff -ru nethack-3.4.3/src/priest.c nethack-3.4.3-new/src/priest.c --- nethack-3.4.3/src/priest.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/priest.c 2004-06-13 02:55:45.000000000 +0200 @@ -393,7 +393,11 @@ set_malign(mtmp); if(flags.verbose) You("are frightened to death, and unable to move."); - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "frightened to death" +#endif + ); nomovemsg = "You regain your composure."; } } diff -ru nethack-3.4.3/src/save.c nethack-3.4.3-new/src/save.c --- nethack-3.4.3/src/save.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/save.c 2004-06-13 02:55:45.000000000 +0200 @@ -48,6 +48,10 @@ #define HUP #endif +#ifdef MENU_COLOR +extern struct menucoloring *menu_colorings; +#endif + /* need to preserve these during save to avoid accessing freed memory */ static unsigned ustuck_id = 0, usteed_id = 0; @@ -57,7 +61,11 @@ clear_nhwindow(WIN_MESSAGE); if(yn("Really save?") == 'n') { clear_nhwindow(WIN_MESSAGE); - if(multi > 0) nomul(0); + if(multi > 0) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } else { clear_nhwindow(WIN_MESSAGE); pline("Saving..."); @@ -953,12 +961,34 @@ return; } +#ifdef MENU_COLOR +void +free_menu_coloring() +{ + struct menucoloring *tmp = menu_colorings; + + while (tmp) { + struct menucoloring *tmp2 = tmp->next; +# ifdef MENU_COLOR_REGEX + (void) regfree(&tmp->match); +# else + free(tmp->match); +# endif + free(tmp); + tmp = tmp2; + } +} +#endif /* MENU_COLOR */ + void freedynamicdata() { unload_qtlist(); free_invbuf(); /* let_to_name (invent.c) */ free_youbuf(); /* You_buf,&c (pline.c) */ +#ifdef MENU_COLOR + free_menu_coloring(); +#endif tmp_at(DISP_FREEMEM, 0); /* temporary display effects */ #ifdef FREE_ALL_MEMORY # define freeobjchn(X) (saveobjchn(0, X, FREE_SAVE), X = 0) diff -ru nethack-3.4.3/src/sounds.c nethack-3.4.3-new/src/sounds.c --- nethack-3.4.3/src/sounds.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/sounds.c 2004-06-13 02:55:45.000000000 +0200 @@ -325,7 +325,11 @@ growl_verb = growl_sound(mtmp); if (growl_verb) { pline("%s %s!", Monnam(mtmp), vtense((char *)0, growl_verb)); - if(flags.run) nomul(0); + if(flags.run) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18); } } @@ -366,7 +370,11 @@ } if (yelp_verb) { pline("%s %s!", Monnam(mtmp), vtense((char *)0, yelp_verb)); - if(flags.run) nomul(0); + if(flags.run) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12); } } @@ -398,7 +406,11 @@ } if (whimper_verb) { pline("%s %s.", Monnam(mtmp), vtense((char *)0, whimper_verb)); - if(flags.run) nomul(0); + if(flags.run) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6); } } @@ -627,7 +639,11 @@ case MS_BONES: pline("%s rattles noisily.", Monnam(mtmp)); You("freeze for a moment."); - nomul(-2); + nomul(-2 +#ifdef HELPLESS + , "scared by rattling" +#endif + ); break; case MS_LAUGH: { diff -ru nethack-3.4.3/src/spell.c nethack-3.4.3-new/src/spell.c --- nethack-3.4.3/src/spell.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/spell.c 2004-06-13 02:55:45.000000000 +0200 @@ -325,7 +325,11 @@ if (Confusion) { /* became confused while learning */ (void) confused_book(book); book = 0; /* no longer studying */ - nomul(delay); /* remaining delay is uninterrupted */ + nomul(delay +#ifdef HELPLESS + , "reading a book" +#endif + ); /* remaining delay is uninterrupted */ delay = 0; return(0); } @@ -463,7 +467,11 @@ if (too_hard) { boolean gone = cursed_book(spellbook); - nomul(delay); /* study time */ + nomul(delay +#ifdef HELPLESS + , "reading a book" +#endif + ); /* study time */ delay = 0; if(gone || !rn2(3)) { if (!gone) pline_The("spellbook crumbles to dust!"); @@ -478,7 +486,11 @@ if (!confused_book(spellbook)) { spellbook->in_use = FALSE; } - nomul(delay); + nomul(delay +#ifdef HELPLESS + , "reading a book" +#endif + ); delay = 0; return(1); } @@ -1114,6 +1126,35 @@ return FALSE; } +#ifdef DUMP_LOG +void +dump_spells() +{ + int i, n; + char buf[BUFSZ]; + + if (spellid(0) == NO_SPELL) { + dump("", "You didn't know any spells."); + dump("", ""); + return; + } + dump("", "Spells known in the end"); + + Sprintf(buf, "%-20s Level %-12s Fail", " Name", "Category"); + dump(" ",buf); + for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) { + Sprintf(buf, "%c - %-20s %2d%s %-12s %3d%%", + spellet(i), spellname(i), spellev(i), + spellknow(i) ? " " : "*", + spelltypemnemonic(spell_skilltype(spellid(i))), + 100 - percent_success(i)); + dump(" ", buf); + } + dump("",""); + +} /* dump_spells */ +#endif + /* Integer square root function without using floating point. */ STATIC_OVL int isqrt(val) diff -ru nethack-3.4.3/src/steal.c nethack-3.4.3-new/src/steal.c --- nethack-3.4.3/src/steal.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/steal.c 2004-06-13 02:55:45.000000000 +0200 @@ -382,7 +382,11 @@ equipname(otmp)); named++; /* the following is to set multi for later on */ - nomul(-armordelay); + nomul(-armordelay +#ifdef HELPLESS + , "taking off clothes" +#endif + ); remove_worn_item(otmp, TRUE); otmp->cursed = curssv; if(multi < 0){ diff -ru nethack-3.4.3/src/teleport.c nethack-3.4.3-new/src/teleport.c --- nethack-3.4.3/src/teleport.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/teleport.c 2004-06-13 02:55:45.000000000 +0200 @@ -326,7 +326,11 @@ newsym(u.ux0,u.uy0); see_monsters(); vision_full_recalc = 1; - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); vision_recalc(0); /* vision before effects */ spoteffects(TRUE); invocation_message(); diff -ru nethack-3.4.3/src/timeout.c nethack-3.4.3-new/src/timeout.c --- nethack-3.4.3/src/timeout.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/timeout.c 2004-06-13 02:55:45.000000000 +0200 @@ -35,7 +35,11 @@ if (i == 5L) HFast = 0L; if (i == 3L) - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "getting stoned" +#endif + ); exercise(A_DEX, FALSE); } @@ -137,7 +141,11 @@ if (i == 3L) { /* limbs becoming oozy */ HFast = 0L; /* lose intrinsic speed */ stop_occupation(); - if (multi > 0) nomul(0); + if (multi > 0) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } exercise(A_DEX, FALSE); } @@ -327,7 +335,11 @@ /* otherwise handle fumbling msgs locally. */ if (u.umoved && !Levitation) { slip_or_trip(); - nomul(-2); + nomul(-2 +#ifdef HELPLESS + , "fumbling" +#endif + ); nomovemsg = ""; /* The more you are carrying the more likely you * are to make noise when you fumble. Adjustments @@ -362,7 +374,11 @@ boolean wakeup_msg; { stop_occupation(); - nomul(how_long); + nomul(how_long +#ifdef HELPLESS + , "sleeping" +#endif + ); /* generally don't notice sounds while sleeping */ if (wakeup_msg && multi == how_long) { /* caller can follow with a direct call to Hear_again() if @@ -1220,7 +1236,11 @@ pline("Kaboom!!! Boom!! Boom!!"); if(!u.uinvulnerable) { stop_occupation(); - nomul(-3); + nomul(-3 +#ifdef HELPLESS + , "hiding from thunderstorm" +#endif + ); } } else You_hear("a rumbling noise."); diff -ru nethack-3.4.3/src/topten.c nethack-3.4.3-new/src/topten.c --- nethack-3.4.3/src/topten.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/topten.c 2004-06-13 02:55:45.000000000 +0200 @@ -38,7 +38,7 @@ #define ENTRYMAX 100 /* must be >= 10 */ #if !defined(MICRO) && !defined(MAC) && !defined(WIN32) -#define PERS_IS_UID /* delete for PERSMAX per name; now per uid */ +/*#define PERS_IS_UID*/ /* delete for PERSMAX per name; now per uid */ #endif struct toptenentry { struct toptenentry *tt_next; @@ -252,6 +252,7 @@ FILE *rfile; register int flg = 0; boolean t0_used; + char buf[15]; #ifdef LOGFILE FILE *lfile; #endif /* LOGFILE */ @@ -331,6 +332,16 @@ (void) strncat(t0->death, killer, DTHSZ); break; } +#ifdef LOG_MOVES + /* jl 08.2000 - 09.2003 */ + sprintf(buf," {%ld}",moves); + if (strlen(t0->death) + strlen(buf) < DTHSZ) + Strcat(t0->death, buf); + if (wizard && strlen(t0->death) < DTHSZ - 6) + Strcat(t0->death, " {wiz}"); + if (discover && strlen(t0->death) < DTHSZ - 6) + Strcat(t0->death, " {exp}"); +#endif t0->birthdate = yyyymmdd(u.ubirthday); t0->deathdate = yyyymmdd((time_t)0L); t0->tt_next = 0; @@ -358,9 +369,29 @@ "Since you were in %s mode, the score list will not be checked.", wizard ? "wizard" : "discover"); topten_print(pbuf); +#ifdef DUMP_LOG + if (dump_fn[0]) { + dump("", pbuf); + dump("", ""); + } +#endif } goto showwin; } +#ifdef FORGET_QUITTER + if (how == QUIT) { + char pbuf[]="Since you quit, the score list will not be checked."; + topten_print(""); + topten_print(pbuf); +#ifdef DUMP_LOG + if (dump_fn) { + dump("", ""); + dump("", pbuf); + } +#endif + goto showwin; + } +#endif if (!lock_file(RECORD, SCOREPREFIX, 60)) goto destroywin; @@ -378,6 +409,9 @@ } HUP topten_print(""); +#ifdef DUMP_LOG + dump("", ""); +#endif /* assure minimum number of points */ if(t0->points < POINTSMIN) t0->points = 0; @@ -422,6 +456,10 @@ t1->points); topten_print(pbuf); topten_print(""); +#ifdef DUMP_LOG + dump("", pbuf); + dump("", ""); +#endif } } if(occ_cnt < 0) { @@ -453,16 +491,25 @@ } #endif /* UPDATE_RECORD_IN_PLACE */ if(!done_stopprint) if(rank0 > 0){ - if(rank0 <= 10) + if(rank0 <= 10) { topten_print("You made the top ten list!"); - else { +#ifdef DUMP_LOG + dump("", "You made the top ten list!"); +#endif + } else { char pbuf[BUFSZ]; Sprintf(pbuf, "You reached the %d%s place on the top %d list.", rank0, ordin(rank0), ENTRYMAX); topten_print(pbuf); +#ifdef DUMP_LOG + dump("", pbuf); +#endif } topten_print(""); +#ifdef DUMP_LOG + dump("", ""); +#endif } } if(rank0 == 0) rank0 = rank1; @@ -488,8 +535,12 @@ )) continue; if (rank == rank0 - flags.end_around && rank0 > flags.end_top + flags.end_around + 1 && - !flags.end_own) + !flags.end_own) { topten_print(""); +#ifdef DUMP_LOG + dump("", ""); +#endif + } if(rank != rank0) outentry(rank, t1, FALSE); else if(!rank1) @@ -547,6 +598,9 @@ while(bp < linebuf + COLNO - 9) *bp++ = ' '; Strcpy(bp, "Hp [max]"); topten_print(linebuf); +#ifdef DUMP_LOG + dump("", linebuf); +#endif } /* so>0: standout line; so=0: ordinary line */ @@ -665,8 +719,15 @@ while (bp < linebuf + (COLNO-1)) *bp++ = ' '; *bp = 0; topten_print_bold(linebuf); - } else +#ifdef DUMP_LOG + dump("*", linebuf[0]==' '? linebuf+1: linebuf); +#endif + } else { topten_print(linebuf); +#ifdef DUMP_LOG + dump(" ", linebuf[0]==' '? linebuf+1: linebuf); +#endif + } Sprintf(linebuf, "%15s %s", "", linebuf3); lngr = strlen(linebuf); } @@ -691,6 +752,9 @@ topten_print_bold(linebuf); } else topten_print(linebuf); +#ifdef DUMP_LOG + dump(" ", linebuf[0]==' '? linebuf+1: linebuf); +#endif } STATIC_OVL int diff -ru nethack-3.4.3/src/trap.c nethack-3.4.3-new/src/trap.c --- nethack-3.4.3/src/trap.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/trap.c 2004-06-13 02:55:45.000000000 +0200 @@ -591,7 +591,11 @@ boolean webmsgok = (!(trflags & NOWEBMSG)); boolean forcebungle = (trflags & FORCEBUNGLE); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); /* KMH -- You can't escape the Sokoban level traps */ if (In_sokoban(&u.uz) && @@ -1415,7 +1419,11 @@ break; } } else if (bhitpos.x == u.ux && bhitpos.y == u.uy) { - if (multi) nomul(0); + if (multi) nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst), singleobj, (char *)0)) @@ -3741,7 +3749,11 @@ case 3: if (!Free_action) { pline("Suddenly you are frozen in place!"); - nomul(-d(5, 6)); + nomul(-d(5, 6) +#ifdef HELPLESS + , "frozen by a trap" +#endif + ); exercise(A_DEX, FALSE); nomovemsg = You_can_move_again; } else You("momentarily stiffen."); diff -ru nethack-3.4.3/src/uhitm.c nethack-3.4.3-new/src/uhitm.c --- nethack-3.4.3/src/uhitm.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/uhitm.c 2004-06-13 02:55:46.000000000 +0200 @@ -99,6 +99,9 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */ { char qbuf[QBUFSZ]; +#ifdef PARANOID + char buf[BUFSZ]; +#endif /* if you're close enough to attack, alert any waiting monster */ mtmp->mstrategy &= ~STRAT_WAITMASK; @@ -199,11 +202,26 @@ return(FALSE); } if (canspotmon(mtmp)) { +#ifdef PARANOID + Sprintf(qbuf, "Really attack %s? [no/yes]", + mon_nam(mtmp)); + if (iflags.paranoid_hit) { + getlin (qbuf, buf); + (void) lcase (buf); + if (strcmp (buf, "yes")) { + flags.move = 0; + return(TRUE); + } + } else { +#endif Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp)); if (yn(qbuf) != 'y') { flags.move = 0; return(TRUE); } +#ifdef PARANOID + } +#endif } } @@ -1813,7 +1831,11 @@ */ You("digest %s.", mon_nam(mdef)); if (Slow_digestion) tmp *= 2; - nomul(-tmp); + nomul(-tmp +#ifdef HELPLESS + , "digesting something" +#endif + ); nomovemsg = msgbuf; } else pline("%s", msgbuf); if (mdef->data == &mons[PM_GREEN_SLIME]) { @@ -2267,7 +2289,11 @@ else { You("are frozen by %s gaze!", s_suffix(mon_nam(mon))); - nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127); + nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127 +#ifdef HELPLESS + , "frozen by a monster's gaze" +#endif + ); } } else { pline("%s cannot defend itself.", @@ -2279,7 +2305,11 @@ } else { /* gelatinous cube */ You("are frozen by %s!", mon_nam(mon)); nomovemsg = 0; /* default: "you can move again" */ - nomul(-tmp); + nomul(-tmp +#ifdef HELPLESS + , "frozen by a monster" +#endif + ); exercise(A_DEX, FALSE); } break; diff -ru nethack-3.4.3/src/vault.c nethack-3.4.3-new/src/vault.c --- nethack-3.4.3/src/vault.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/vault.c 2004-06-13 02:55:46.000000000 +0200 @@ -260,7 +260,14 @@ } stop_occupation(); /* if occupied, stop it *now* */ - if (multi > 0) { nomul(0); unmul((char *)0); } + if (multi > 0) { + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); + unmul((char *)0); + } trycount = 5; do { getlin("\"Hello stranger, who are you?\" -", buf); diff -ru nethack-3.4.3/src/version.c nethack-3.4.3-new/src/version.c --- nethack-3.4.3/src/version.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/version.c 2004-06-13 02:55:46.000000000 +0200 @@ -16,6 +16,9 @@ /* #define BETA_INFO "" */ /* "[ beta n]" */ +/* Don't store SCORE_ON_BOTL option in save file or bones */ +#define HIDDEN_FEATURES (1L << 21) + /* fill buffer with short version (so caller can avoid including date.h) */ char * version_string(buf) @@ -70,6 +73,11 @@ const char *filename; boolean complain; { + boolean check=TRUE; +#ifdef HIDDEN_FEATURES + unsigned long true_features = version_data->feature_set; + version_data->feature_set &= ~HIDDEN_FEATURES; +#endif if ( #ifdef VERSION_COMPATIBILITY version_data->incarnation < VERSION_COMPATIBILITY || @@ -80,7 +88,7 @@ ) { if (complain) pline("Version mismatch for file \"%s\".", filename); - return FALSE; + check = FALSE; } else if ( #ifndef IGNORED_FEATURES version_data->feature_set != VERSION_FEATURES || @@ -93,9 +101,12 @@ if (complain) pline("Configuration incompatibility for file \"%s\".", filename); - return FALSE; + check = FALSE; } - return TRUE; +#ifdef HIDDEN_FEATURES + version_data->feature_set = true_features; +#endif + return check; } /* this used to be based on file date and somewhat OS-dependant, @@ -130,7 +141,11 @@ int fd; { const static struct version_info version_data = { +#ifdef HIDDEN_FEATURES + VERSION_NUMBER, VERSION_FEATURES & ~HIDDEN_FEATURES, +#else VERSION_NUMBER, VERSION_FEATURES, +#endif VERSION_SANITY1, VERSION_SANITY2 }; diff -ru nethack-3.4.3/src/weapon.c nethack-3.4.3-new/src/weapon.c --- nethack-3.4.3/src/weapon.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/weapon.c 2004-06-13 02:55:46.000000000 +0200 @@ -9,6 +9,10 @@ */ #include "hack.h" +#ifdef DUMP_LOG +STATIC_DCL int FDECL(enhance_skill, (boolean)); +#endif + /* Categories whose names don't come from OBJ_NAME(objects[type]) */ #define PN_BARE_HANDED (-1) /* includes martial arts */ @@ -851,6 +855,23 @@ */ int enhance_weapon_skill() +#ifdef DUMP_LOG +{ + return enhance_skill(FALSE); +} + +void dump_weapon_skill() +{ + enhance_skill(TRUE); +} + +int enhance_skill(boolean want_dump) +/* This is the original enhance_weapon_skill() function slightly modified + * to write the skills to the dump file. I added the wrapper functions just + * because it looked like the easiest way to add a parameter to the + * function call. - Jukka Lahtinen, August 2001 + */ +#endif { int pass, i, n, len, longest, to_advance, eventually_advance, maxxed_cnt; @@ -860,8 +881,15 @@ anything any; winid win; boolean speedy = FALSE; +#ifdef DUMP_LOG + char buf2[BUFSZ]; + boolean logged; +#endif #ifdef WIZARD +#ifdef DUMP_LOG + if (!want_dump) +#endif if (wizard && yn("Advance skills without practice?") == 'y') speedy = TRUE; #endif @@ -878,6 +906,11 @@ else if (peaked_skill(i)) maxxed_cnt++; } +#ifdef DUMP_LOG + if (want_dump) + dump("","Your skills at the end"); + else { +#endif win = create_nhwindow(NHW_MENU); start_menu(win); @@ -905,6 +938,9 @@ add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); } +#ifdef DUMP_LOG + } /* want_dump or not */ +#endif /* List the skills, making ones that could be advanced selectable. List the miscellaneous skills first. @@ -916,8 +952,26 @@ /* Print headings for skill types */ any.a_void = 0; if (i == skill_ranges[pass].first) +#ifdef DUMP_LOG + if (want_dump) { + dump(" ",(char *)skill_ranges[pass].name); + logged=FALSE; + } else +#endif add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, skill_ranges[pass].name, MENU_UNSELECTED); +#ifdef DUMP_LOG + if (want_dump) { + if (P_SKILL(i) > P_UNSKILLED) { + Sprintf(buf2,"%-*s [%s]", + longest, P_NAME(i),skill_level_name(i, buf)); + dump(" ",buf2); + logged=TRUE; + } else if (i == skill_ranges[pass].last && !logged) { + dump(" ","(none)"); + } + } else { +#endif if (P_RESTRICTED(i)) continue; /* @@ -962,6 +1016,9 @@ any.a_int = can_advance(i, speedy) ? i+1 : 0; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); +#ifdef DUMP_LOG + } /* !want_dump */ +#endif } Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:" : @@ -971,6 +1028,12 @@ Sprintf(eos(buf), " (%d slot%s available)", u.weapon_slots, plur(u.weapon_slots)); #endif +#ifdef DUMP_LOG + if (want_dump) { + dump("",""); + n=0; + } else { +#endif end_menu(win, buf); n = select_menu(win, to_advance ? PICK_ONE : PICK_NONE, &selected); destroy_nhwindow(win); @@ -987,6 +1050,9 @@ } } } +#ifdef DUMP_LOG + } +#endif } while (speedy && n > 0); return 0; } diff -ru nethack-3.4.3/src/zap.c nethack-3.4.3-new/src/zap.c --- nethack-3.4.3/src/zap.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/src/zap.c 2004-06-13 02:55:46.000000000 +0200 @@ -3436,7 +3436,11 @@ miss(fltxt,mon); } } else if (sx == u.ux && sy == u.uy && range >= 0) { - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); #ifdef STEED if (u.usteed && !rn2(3) && !mon_reflects(u.usteed, (char *)0)) { mon = u.usteed; @@ -3466,7 +3470,11 @@ if (!Blind) Your(vision_clears); } stop_occupation(); - nomul(0); + nomul(0 +#ifdef HELPLESS + , 0 +#endif + ); } if(!ZAP_POS(lev->typ) || (closed_door(sx, sy) && (range >= 0))) { diff -ru nethack-3.4.3/sys/share/pcunix.c nethack-3.4.3-new/sys/share/pcunix.c --- nethack-3.4.3/sys/share/pcunix.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/sys/share/pcunix.c 2004-06-13 02:55:46.000000000 +0200 @@ -8,11 +8,11 @@ #include "wintty.h" #include -#if defined(WIN32) || defined(MSDOS) +#if defined(WIN32) || defined(MSDOS) || defined(PC_LOCKING) #include #endif -#if defined(WIN32) || defined(MSDOS) +#if defined(WIN32) || defined(MSDOS) || defined(PC_LOCKING) extern char orgdir[]; # ifdef WIN32 extern void NDECL(backsp); diff -ru nethack-3.4.3/sys/unix/Makefile.top nethack-3.4.3-new/sys/unix/Makefile.top --- nethack-3.4.3/sys/unix/Makefile.top 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/sys/unix/Makefile.top 2004-06-13 02:55:46.000000000 +0200 @@ -234,12 +234,12 @@ # set up the directories # not all mkdirs have -p; those that don't will create a -p directory -mkdir -p $(SHELLDIR) - -rm -rf $(GAMEDIR) $(VARDIR) - -mkdir -p $(GAMEDIR) $(VARDIR) $(VARDIR)/save +# -rm -rf $(GAMEDIR) $(VARDIR) + -mkdir -p $(GAMEDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/bones -rmdir ./-p - -$(CHOWN) $(GAMEUID) $(GAMEDIR) $(VARDIR) $(VARDIR)/save - $(CHGRP) $(GAMEGRP) $(GAMEDIR) $(VARDIR) $(VARDIR)/save - chmod $(DIRPERM) $(GAMEDIR) $(VARDIR) $(VARDIR)/save + -$(CHOWN) $(GAMEUID) $(GAMEDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/bones + $(CHGRP) $(GAMEGRP) $(GAMEDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/bones + chmod $(DIRPERM) $(GAMEDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/bones # set up the game files ( $(MAKE) dofiles ) # set up some additional files diff -ru nethack-3.4.3/sys/unix/nethack.sh nethack-3.4.3-new/sys/unix/nethack.sh --- nethack-3.4.3/sys/unix/nethack.sh 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/sys/unix/nethack.sh 2004-06-13 02:55:46.000000000 +0200 @@ -63,6 +63,14 @@ exec $HACK "$@" ;; *) - exec $HACK "$@" $MAXNROFPLAYERS +# Alt key as 'meta' + if [ "$TERM" == "linux" ] + then setmetamode meta > /dev/null + fi + $HACK "$@" $MAXNROFPLAYERS +# Change alt key back + if [ "$TERM" == "linux" ] + then setmetamode esc > /dev/null + fi ;; esac diff -ru nethack-3.4.3/sys/unix/unixmain.c nethack-3.4.3-new/sys/unix/unixmain.c --- nethack-3.4.3/sys/unix/unixmain.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/sys/unix/unixmain.c 2004-06-13 02:55:46.000000000 +0200 @@ -262,6 +262,7 @@ #endif check_special_room(FALSE); wd_message(); + save_currentstate(); if (discover || wizard) { if(yn("Do you want to keep the save file?") == 'n') diff -ru nethack-3.4.3/util/makedefs.c nethack-3.4.3-new/util/makedefs.c --- nethack-3.4.3/util/makedefs.c 2003-12-08 00:39:13.000000000 +0100 +++ nethack-3.4.3-new/util/makedefs.c 2004-06-13 02:55:46.000000000 +0200 @@ -417,6 +417,9 @@ * This should go away in the next version update. */ #define IGNORED_FEATURES ( 0L \ + | (1L << 17) /* TEXTCOLOR */ \ + | (1L << 20) /* EXP_ON_BOTL */ \ + | (1L << 21) /* SCORE_ON_BOTL */ \ | (1L << 23) /* TIMED_DELAY */ \ ) @@ -775,6 +778,70 @@ "zero-compressed save files", #endif save_bones_compat_buf, +#ifdef AOY_CONTAINER + "patch: baggable special items", +#endif +#ifdef HPMON + "patch: colored Hp monitor", +#endif +#ifdef DUMP_LOG + "patch: dump game end info", +#endif +#ifdef DYNKEY + "patch: dynamic keybinding", +#endif +#ifdef DEATH_EXPLORE + "patch: explore mode at death", +#endif +#ifdef GERMANKB + "patch: german keyboard (hardcoded)", +#endif +#ifdef HELPLESS + "patch: helplessness reasons", +#endif +#if defined(ITEMCAT) || defined(ITEMCAT_JP) || defined(ITEMCAT_AP) || defined(ITEMCAT_NEG) + "patch: item categories", +#endif +#ifdef LOG_MOVES + "patch: log move counter", +#endif +#ifdef FORGET_QUITTER + "patch: no record entry for quitting", +#endif +#ifdef SHOP_CREDIT + "patch: no shop credit", +#endif +#ifdef QWERTZ + "patch: optionally change y/z commands", +#endif +#ifdef PARANOID + "patch: paranoid", +#endif +#ifdef PROMPT_LOGEXP + "patch: prompt explore/wizard mode logging", +#endif +#ifdef SHOW_EXTINCT + "patch: show extinct monsters", +#endif +#ifdef SHOW_BORN + "patch: show monsters born", +#endif +#ifdef SORTLOOT + "patch: sortloot", +#endif +#ifdef ADJSPLIT + "patch: splittable #adjust", +#endif +#ifdef MENU_COLOR +# ifdef MENU_COLOR_REGEX + "patch: tty menu colors via regular expressions", +# else + "patch: tty menu colors via pmatch", +# endif +#endif +#ifdef WIN_EDGE + "patch: win_edge", +#endif "basic NetHack features" }; diff -ru nethack-3.4.3/win/tty/wintty.c nethack-3.4.3-new/win/tty/wintty.c --- nethack-3.4.3/win/tty/wintty.c 2003-12-08 00:39:14.000000000 +0100 +++ nethack-3.4.3-new/win/tty/wintty.c 2004-06-13 02:55:46.000000000 +0200 @@ -125,6 +125,10 @@ static char winpanicstr[] = "Bad window id %d"; char defmorestr[] = "--More--"; +#ifdef MENU_COLOR +extern struct menucoloring *menu_colorings; +#endif + #ifdef CLIPPING # if defined(USE_TILES) && defined(MSDOS) boolean clipping = FALSE; /* clipping on? */ @@ -162,7 +166,7 @@ STATIC_DCL void FDECL(process_menu_window, (winid,struct WinDesc *)); STATIC_DCL void FDECL(process_text_window, (winid,struct WinDesc *)); STATIC_DCL tty_menu_item *FDECL(reverse, (tty_menu_item *)); -STATIC_DCL const char * FDECL(compress_str, (const char *)); +const char * FDECL(compress_str, (const char *)); STATIC_DCL void FDECL(tty_putsym, (winid, int, int, CHAR_P)); static char *FDECL(copy_of, (const char *)); STATIC_DCL void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */ @@ -1128,6 +1132,28 @@ } } +#ifdef MENU_COLOR +STATIC_OVL boolean +get_menu_coloring(str, color, attr) +char *str; +int *color, *attr; +{ + struct menucoloring *tmpmc; + if (iflags.use_menu_color) + for (tmpmc = menu_colorings; tmpmc; tmpmc = tmpmc->next) +# ifdef MENU_COLOR_REGEX + if (re_search(&tmpmc->match, str, strlen(str), 0, 9999, 0) >= 0) { +# else + if (pmatch(tmpmc->match, str)) { +# endif + *color = tmpmc->color; + *attr = tmpmc->attr; + return TRUE; + } + return FALSE; +} +#endif /* MENU_COLOR */ + STATIC_OVL void process_menu_window(window, cw) winid window; @@ -1204,6 +1230,10 @@ for (page_lines = 0, curr = page_start; curr != page_end; page_lines++, curr = curr->next) { +#ifdef MENU_COLOR + int color = NO_COLOR, attr = ATR_NONE; + boolean menucolr = FALSE; +#endif if (curr->selector) *rp++ = curr->selector; @@ -1219,6 +1249,13 @@ * actually output the character. We're faster doing * this. */ +#ifdef MENU_COLOR + if (iflags.use_menu_color && + (menucolr = get_menu_coloring(curr->str, &color,&attr))) { + term_start_attr(attr); + if (color != NO_COLOR) term_start_color(color); + } else +#endif term_start_attr(curr->attr); for (n = 0, cp = curr->str; #ifndef WIN32CON @@ -1236,6 +1273,12 @@ (void) putchar('#'); /* count selected */ } else (void) putchar(*cp); +#ifdef MENU_COLOR + if (iflags.use_menu_color && menucolr) { + if (color != NO_COLOR) term_end_color(); + term_end_attr(attr); + } else +#endif term_end_attr(curr->attr); } } else { @@ -1529,11 +1572,19 @@ /* avoid converting to uchar before calculations are finished */ cw->offx = (uchar) (int) max((int) 10, (int) (ttyDisplay->cols - cw->maxcol - 1)); - if(cw->type == NHW_MENU) + if(cw->type == NHW_MENU +#ifdef WIN_EDGE + || iflags.win_edge +#endif + ) cw->offy = 0; if(ttyDisplay->toplin == 1) tty_display_nhwindow(WIN_MESSAGE, TRUE); - if(cw->offx == 10 || cw->maxrow >= (int) ttyDisplay->rows) { + if(cw->offx == 10 || cw->maxrow >= (int) ttyDisplay->rows +#ifdef WIN_EDGE + || iflags.win_edge +#endif + ) { cw->offx = 0; if(cw->offy) { tty_curs(window, 1, 0); @@ -1722,7 +1773,7 @@ } -STATIC_OVL const char* +const char* compress_str(str) const char *str; {