diff -Nurd nethack-3.4.3/README.menucolor nh343_gentoo/README.menucolor
--- nethack-3.4.3/README.menucolor 1969-12-31 18:00:00.000000000 -0600
+++ nh343_gentoo/README.menucolor 2005-11-21 21:30:22.000000000 -0600
@@ -0,0 +1,102 @@
+
+ This is version 1.4 of the menucolors patch.
+
+ This patch allows the user to define in what color menus are shown.
+ For example, putting
+
+ OPTIONS=menucolors
+ MENUCOLOR=" blessed "=green
+ MENUCOLOR=" holy "=green
+ MENUCOLOR=" cursed "=red
+ MENUCOLOR=" unholy "=red
+ MENUCOLOR=" cursed .* (being worn)"=orange&underline
+
+ in the configuration file makes all known blessed items
+ show up in green, all cursed items show up in red and
+ all cursed worn items show up in orange and underlined
+ when viewing inventory.
+
+ If you have regex.h but it is not GNU (e.g. DJGPP, *BSD), uncomment
+ #define MENU_COLOR_REGEX_POSIX in include/config.h
+
+ If you do not have regex.h, comment
+ #define MENU_COLOR_REGEX out from include/config.h
+ and replace the MENUCOLOR lines in your config file with these:
+
+ MENUCOLOR="* blessed *"=green
+ MENUCOLOR="* holy *"=green
+ MENUCOLOR="* cursed *"=red
+ MENUCOLOR="* unholy *"=red
+ MENUCOLOR="* cursed * (being worn)"=orange&underline
+
+
+ Colors: black, red, green, brown, blue, magenta, cyan, gray, orange,
+ lightgreen, yellow, lightblue, lightmagenta, lightcyan, white.
+ Attributes: none, bold, dim, underline, blink, inverse.
+
+ Note that the terminal is free to interpret the attributes however
+ it wants.
+
+
+ TODO/BUGS:
+
+ o Only works with TTY
+ o You can't use '=' or '&' in the match-string.
+ o Maybe add color-field to tty_menu_item in include/wintty.h
+ (so there's no need to find the color for the line again)
+ o Guidebook is not up to date
+ o Better place to put the functions, colornames[] and attrnames[]?
+ o Some menus do not need coloring; maybe add new parameter
+ to process_menu_window()?
+
+
+ FIXES:
+
+ v1.4:
+ o Option to use standard instead of GNU regex functions.
+
+ v1.3:
+ o Updated to use 3.4.3 codebase.
+ o Added a text to #version to show menucolors is compiled in.
+
+ v1.2:
+ o Updated to use 3.4.2 codebase.
+
+ v1.1:
+ o Updated to use 3.4.1 codebase.
+ o replaced USE_REGEX_MATCH with MENU_COLOR_REGEX
+
+ v1.04:
+ o Oops! 1.03 worked only on *nixes... (GNU regex.h)
+ o Compile-time option USE_REGEX_MATCH: if it's defined, use regex,
+ otherwise use globbing. ('?' and '*' wildcards)
+
+ v1.03:
+
+ o Now using Nethack 3.4.0 codebase
+ o Compile-time option MENU_COLOR
+ o Strings match using regular expressions instead of globbing
+ o You can use attribute with color (attr must come after '&')
+ o Use ``MENUCOLOR="foo"=color'' instead of ``OPTIONS=menucolor=...''
+ (Both work, but OPTIONS complains if you define menucolor
+ more than once)
+
+ v1.02:
+
+ o Should now work with OS/2, thanks to Jukka Lahtinen
+ o Strings match now using simple globbing. ('?' and '*' wildcards)
+
+ v1.01:
+
+ o Moved 'menucolors' boolean option, so now the options-menu
+ is in alphabetical order.
+ o Fixed 'menucolor' description in dat/opthelp.
+ o menu_colorings is now initialized to null in src/decl.c.
+
+ v1.0:
+
+ o Initial release
+
+--
+ Pasi Kallinen
+ pkalli@cs.joensuu.fi
diff -Nurd nethack-3.4.3/README.statuscolors nh343_gentoo/README.statuscolors
--- nethack-3.4.3/README.statuscolors 1969-12-31 18:00:00.000000000 -0600
+++ nh343_gentoo/README.statuscolors 2005-11-21 21:30:14.000000000 -0600
@@ -0,0 +1,57 @@
+Statuscolors is a patch for Nethack (version 3.4.3) that attempts to generalize
+the hpmon patch to be more like the menucolors patch. Unlike menucolors, it
+does not use regexps. Instead, it provides the following options:
+
+To enable statuscolors:
+ OPTIONS=statuscolors
+
+To specify statuscolor options, write:
+ STATUSCOLOR=,
+
+Numeric options have the format %:. For
+example:
+ STATUSCOLOR=hp%15:red&bold,pw%100=green
+
+Text options have the format :. Text is case-insensitive.
+For example:
+ STATUSCOLOR=hallu:orange,foodpois:red&inverse&blink
+
+A color option is a followed by an optional sequence of &. Color
+and attribute names are case insensitive. Valid colors are:
+ black blue brown cyan gray green lightblue lightcyan lightgreen
+ lightmagenta magenta none orange red white yellow
+
+Valid attributes are:
+ blink bold dim inverse none underline
+
+A reasonable set of defaults might be:
+ # HP
+ STATUSCOLOR=hp%100=green,hp%66=yellow,hp%50=orange
+ STATUSCOLOR=hp%33=red&bold,hp%15:red&inverse,hp%0:red&inverse&blink
+ # Pw
+ STATUSCOLOR=pw%100=green,pw%66=yellow,pw%50:orange,pw%33=red&bold
+ # Carry
+ STATUSCOLOR=burdened:yellow,stressed:orange,strained:red&bold
+ STATUSCOLOR=overtaxed:red&inverse,overloaded:red&inverse&blink
+ # Hunger
+ STATUSCOLOR=satiated:yellow,hungry:orange,weak:red&bold
+ STATUSCOLOR=fainting:red&inverse,fainted:red&inverse&blink
+ # Mental
+ STATUSCOLOR=hallu:yellow,conf:orange,stun:red&bold
+ # Health
+ STATUSCOLOR=ill:red&inverse,foodpois:red&inverse,slime:red&inverse
+ # Other
+ STATUSCOLOR=held:red&inverse,blind:red&inverse
+
+ChangeLog:
+
+ v1.1:
+ - Fixed several shameful bugs.
+
+ v1.0:
+ - Initial release.
+
+---
+Shachaf & Oren Ben-Kiki
+shachaf+nethack@gmail.com
+nethack-oren@ben-kiki.org
diff -Nurd nethack-3.4.3/dat/opthelp nh343_gentoo/dat/opthelp
--- nethack-3.4.3/dat/opthelp 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/dat/opthelp 2005-11-21 21:30:22.000000000 -0600
@@ -61,6 +61,19 @@
Boolean option if MFLOPPY was set at compile time:
checkspace check free disk space before writing files to disk [TRUE]
+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 EXP_ON_BOTL was set at compile time:
showexp display your accumulated experience points [FALSE]
@@ -71,6 +84,9 @@
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 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
@@ -92,6 +108,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 +139,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 +193,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 -Nurd nethack-3.4.3/dat/wizhelp nh343_gentoo/dat/wizhelp
--- nethack-3.4.3/dat/wizhelp 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/dat/wizhelp 2005-11-21 21:29:39.000000000 -0600
@@ -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 -Nurd nethack-3.4.3/doc/Guidebook.mn nh343_gentoo/doc/Guidebook.mn
--- nethack-3.4.3/doc/Guidebook.mn 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/doc/Guidebook.mn 2005-11-21 21:30:05.000000000 -0600
@@ -1770,6 +1770,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#{}.}..##\ #}'').
@@ -2027,6 +2033,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 +2103,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 +2117,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
diff -Nurd nethack-3.4.3/doc/Guidebook.tex nh343_gentoo/doc/Guidebook.tex
--- nethack-3.4.3/doc/Guidebook.tex 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/doc/Guidebook.tex 2005-11-21 21:30:05.000000000 -0600
@@ -2209,6 +2209,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&.##<><>_|\\#{}.}..## #}&'').
@@ -2486,6 +2493,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 +2578,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 +2597,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
diff -Nurd nethack-3.4.3/doc/Guidebook.txt nh343_gentoo/doc/Guidebook.txt
--- nethack-3.4.3/doc/Guidebook.txt 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/doc/Guidebook.txt 2005-11-21 21:30:05.000000000 -0600
@@ -2274,6 +2274,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
@@ -2607,6 +2614,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 +2712,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 +2747,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).
diff -Nurd nethack-3.4.3/include/color.h nh343_gentoo/include/color.h
--- nethack-3.4.3/include/color.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/color.h 2005-11-21 21:30:22.000000000 -0600
@@ -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,39 @@
#define DRAGON_SILVER CLR_BRIGHT_CYAN
#define HI_ZAP CLR_BRIGHT_BLUE
+#ifdef MENU_COLOR
+struct menucoloring {
+# ifdef MENU_COLOR_REGEX
+# ifdef MENU_COLOR_REGEX_POSIX
+ regex_t match;
+# else
+ struct re_pattern_buffer match;
+# endif
+# else
+ char *match;
+# endif
+ int color, attr;
+ struct menucoloring *next;
+};
+#endif /* MENU_COLOR */
+
+#ifdef STATUS_COLORS
+struct color_option {
+ int color;
+ int attr_bits;
+};
+
+struct percent_color_option {
+ int percentage;
+ struct color_option color_option;
+ const struct percent_color_option *next;
+};
+
+struct text_color_option {
+ const char *text;
+ struct color_option color_option;
+ const struct text_color_option *next;
+};
+#endif
+
#endif /* COLOR_H */
diff -Nurd nethack-3.4.3/include/config.h nh343_gentoo/include/config.h
--- nethack-3.4.3/include/config.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/config.h 2005-11-21 21:30:14.000000000 -0600
@@ -169,8 +169,8 @@
#ifdef UNIX
/* path and file name extension for compression program */
-#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */
-#define COMPRESS_EXTENSION ".Z" /* compress's extension */
+#define COMPRESS "/bin/bzip2" /* Lempel-Ziv compression */
+#define COMPRESS_EXTENSION ".bz2" /* compress's extension */
/* An example of one alternative you might want to use: */
/* #define COMPRESS "/usr/local/bin/gzip" */ /* FSF gzip compression */
/* #define COMPRESS_EXTENSION ".gz" */ /* normal gzip extension */
@@ -185,7 +185,7 @@
* a tar-like file, thus making a neater installation. See *conf.h
* for detailed configuration.
*/
-/* #define DLB */ /* not supported on all platforms */
+#define DLB 1 /* not supported on all platforms */
/*
* Defining INSURANCE slows down level changes, but allows games that
@@ -204,7 +204,7 @@
* otherwise it will be the current directory.
*/
# ifndef HACKDIR
-# define HACKDIR "/usr/games/lib/nethackdir"
+# define HACKDIR "GENTOO_HACKDIR"
# endif
/*
@@ -300,7 +300,7 @@
* functions that have been macroized.
*/
-/* #define VISION_TABLES */ /* use vision tables generated at compile time */
+#define VISION_TABLES 1 /* use vision tables generated at compile time */
#ifndef VISION_TABLES
# ifndef NO_MACRO_CPATH
# define MACRO_CPATH /* use clear_path macros instead of functions */
@@ -338,7 +338,7 @@
#endif
#define EXP_ON_BOTL /* Show experience on bottom line */
-/* #define SCORE_ON_BOTL */ /* added by Gary Erickson (erickson@ucivax) */
+#define SCORE_ON_BOTL /* added by Gary Erickson (erickson@ucivax) */
/*
* Section 5: EXPERIMENTAL STUFF
@@ -348,9 +348,26 @@
* bugs left here.
*/
+#define STATUS_COLORS
+
/*#define GOLDOBJ */ /* Gold is kept on obj chains - Helge Hafting */
/*#define AUTOPICKUP_EXCEPTIONS */ /* exceptions to autopickup */
+#define SHOW_BORN
+#define SHOW_EXTINCT
+#define DUMP_LOG
+#define SORTLOOT
+#define PARANOID
+#define DYNKEY
+#define MENU_COLOR
+#define MENU_COLOR_REGEX
+/* #define MENU_COLOR_REGEX_POSIX */
+/* if MENU_COLOR_REGEX is defined, use regular expressions (regex.h,
+ * GNU specific functions by default, POSIX functions with
+ * MENU_COLOR_REGEX_POSIX).
+ * otherwise use pmatch() to match menu color lines.
+ * pmatch() provides basic globbing: '*' and '?' wildcards.
+ */
/* End of Section 5 */
#include "global.h" /* Define everything else according to choices above */
diff -Nurd nethack-3.4.3/include/decl.h nh343_gentoo/include/decl.h
--- nethack-3.4.3/include/decl.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/decl.h 2005-11-21 21:29:33.000000000 -0600
@@ -184,6 +184,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 -Nurd nethack-3.4.3/include/extern.h nh343_gentoo/include/extern.h
--- nethack-3.4.3/include/extern.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/extern.h 2005-11-21 21:30:35.000000000 -0600
@@ -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));
@@ -174,7 +182,14 @@
E int FDECL(isok, (int,int));
E int FDECL(get_adjacent_loc, (const char *, const char *, XCHAR_P, XCHAR_P, coord *));
E const char *FDECL(click_to_cmd, (int,int,int));
+#ifdef DYNKEY
+E int FDECL(map_dkb, (char, char));
+E char FDECL(keydesc2char, (char *));
+E char FDECL(greadchar, (boolean));
+#define readchar() greadchar(FALSE)
+#else
E char NDECL(readchar);
+#endif
#ifdef WIZARD
E void NDECL(sanity_check);
#endif
@@ -281,6 +296,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 +571,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,BOOLEAN_P));
+#endif
E void FDECL(terminate, (int));
E int NDECL(num_genocides);
@@ -790,6 +812,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,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 +1385,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 *));
@@ -1401,10 +1429,16 @@
E void FDECL(set_wc_option_mod_status, (unsigned long, int));
E void FDECL(set_wc2_option_mod_status, (unsigned long, int));
E void FDECL(set_option_mod_status, (const char *,int));
+#ifdef DYNKEY
+E void FDECL(add_dkb, (char *, boolean));
+#endif
#ifdef AUTOPICKUP_EXCEPTIONS
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 ### */
@@ -2237,6 +2271,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));
diff -Nurd nethack-3.4.3/include/flag.h nh343_gentoo/include/flag.h
--- nethack-3.4.3/include/flag.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/flag.h 2005-11-21 21:30:43.000000000 -0600
@@ -167,6 +167,7 @@
boolean menu_tab_sep; /* Use tabs to separate option menu fields */
boolean menu_requested; /* Flag for overloaded use of 'm' prefix
* on some non-move commands */
+ int chargfx; /* one of ASCII_GRAPHICS, DEC_GRAPHICS, IBM_GRAPHICS, MAC_GRAPHICS */
uchar num_pad_mode;
int menu_headings; /* ATR for menu headings */
int purge_monsters; /* # of dead monsters still on fmon list */
@@ -183,6 +184,12 @@
char prevmsg_window; /* type of old message window to use */
boolean extmenu; /* extended commands use menu interface */
#endif
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ boolean use_status_colors; /* use color in status line; only if wc_color */
+#endif
+#ifdef MENU_COLOR
+ boolean use_menu_color; /* use color in menus; only if wc_color */
+#endif
#ifdef MFLOPPY
boolean checkspace; /* check disk space before writing files */
/* (in iflags to allow restore after moving
@@ -216,6 +223,17 @@
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
/*
* Window capability support.
*/
diff -Nurd nethack-3.4.3/include/func_tab.h nh343_gentoo/include/func_tab.h
--- nethack-3.4.3/include/func_tab.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/func_tab.h 2005-11-21 21:30:35.000000000 -0600
@@ -5,6 +5,13 @@
#ifndef FUNC_TAB_H
#define FUNC_TAB_H
+#ifdef DYNKEY
+struct dkb_tab {
+ char bound_char;
+ char cmd_char;
+};
+#endif
+
struct func_tab {
char f_char;
boolean can_if_buried;
@@ -19,5 +26,6 @@
};
extern struct ext_func_tab extcmdlist[];
+extern struct dkb_tab *dkblist;
#endif /* FUNC_TAB_H */
diff -Nurd nethack-3.4.3/include/unixconf.h nh343_gentoo/include/unixconf.h
--- nethack-3.4.3/include/unixconf.h 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/include/unixconf.h 2005-11-21 21:28:27.000000000 -0600
@@ -37,7 +37,7 @@
#define NETWORK /* if running on a networked system */
/* e.g. Suns sharing a playground through NFS */
/* #define SUNOS4 */ /* SunOS 4.x */
-/* #define LINUX */ /* Another Unix clone */
+#define LINUX 1 /* Another Unix clone */
/* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */
/* #define GENIX */ /* Yet Another Unix Clone */
/* #define HISX */ /* Bull Unix for XPS Machines */
@@ -96,13 +96,13 @@
*/
/* #define NO_FILE_LINKS */ /* if no hard links */
-/* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */
+#define LOCKDIR "GENTOO_STATEDIR"
/*
* If you want the static parts of your playground on a read-only file
* system, define VAR_PLAYGROUND to be where the variable parts are kept.
*/
-/* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
+#define VAR_PLAYGROUND "GENTOO_STATEDIR"
/*
@@ -132,7 +132,7 @@
* "extra output" method is used, but not all systems provide access to
* a fine-grained timer.
*/
-/* #define TIMED_DELAY */ /* usleep() */
+#define TIMED_DELAY 1
#endif
/*
diff -Nurd nethack-3.4.3/src/Makefile nh343_gentoo/src/Makefile
--- nethack-3.4.3/src/Makefile 2005-11-21 19:49:49.000000000 -0600
+++ nh343_gentoo/src/Makefile 2005-11-21 21:28:27.000000000 -0600
@@ -231,7 +231,7 @@
# WINTTYLIB = -lcurses
# WINTTYLIB = -lcurses16
# WINTTYLIB = -lncurses
-WINTTYLIB = -ltermlib
+WINTTYLIB = -lncurses
#
# libraries for X11
# If USE_XPM is defined in config.h, you will also need -lXpm here.
diff -Nurd nethack-3.4.3/src/botl.c nh343_gentoo/src/botl.c
--- nethack-3.4.3/src/botl.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/botl.c 2005-11-21 21:30:14.000000000 -0600
@@ -34,6 +34,106 @@
#define MAXCO (COLNO+20)
#endif
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+
+extern const struct percent_color_option *hp_colors;
+extern const struct percent_color_option *pw_colors;
+extern const struct text_color_option *text_colors;
+
+struct color_option
+text_color_of(text, color_options)
+const char *text;
+const struct text_color_option *color_options;
+{
+ if (color_options == NULL) {
+ struct color_option result = {NO_COLOR, 0};
+ return result;
+ }
+ if (strstri(color_options->text, text)
+ || strstri(text, color_options->text))
+ return color_options->color_option;
+ return text_color_of(text, color_options->next);
+}
+
+struct color_option
+percentage_color_of(value, max, color_options)
+int value, max;
+const struct percent_color_option *color_options;
+{
+ if (color_options == NULL) {
+ struct color_option result = {NO_COLOR, 0};
+ return result;
+ }
+ if (100 * value <= color_options->percentage * max)
+ return color_options->color_option;
+ return percentage_color_of(value, max, color_options->next);
+}
+
+void
+start_color_option(color_option)
+struct color_option color_option;
+{
+ int i;
+ if (color_option.color != NO_COLOR)
+ term_start_color(color_option.color);
+ for (i = 0; (1 << i) <= color_option.attr_bits; ++i)
+ if (i != ATR_NONE && color_option.attr_bits & (1 << i))
+ term_start_attr(i);
+}
+
+void
+end_color_option(color_option)
+struct color_option color_option;
+{
+ int i;
+ if (color_option.color != NO_COLOR)
+ term_end_color(color_option.color);
+ for (i = 0; (1 << i) <= color_option.attr_bits; ++i)
+ if (i != ATR_NONE && color_option.attr_bits & (1 << i))
+ term_end_attr(i);
+}
+
+void
+apply_color_option(color_option, newbot2)
+struct color_option color_option;
+const char *newbot2;
+{
+ if (!iflags.use_status_colors) return;
+ curs(WIN_STATUS, 1, 1);
+ start_color_option(color_option);
+ putstr(WIN_STATUS, 0, newbot2);
+ end_color_option(color_option);
+}
+
+void
+add_colored_text(text, newbot2)
+const char *text;
+char *newbot2;
+{
+ char *nb;
+ struct color_option color_option;
+
+ if (*text == '\0') return;
+
+ if (!iflags.use_status_colors) {
+ Sprintf(nb = eos(newbot2), " %s", text);
+ return;
+ }
+
+ Strcat(nb = eos(newbot2), " ");
+ curs(WIN_STATUS, 1, 1);
+ putstr(WIN_STATUS, 0, newbot2);
+
+ Strcat(nb = eos(nb), text);
+ curs(WIN_STATUS, 1, 1);
+ color_option = text_color_of(text, text_colors);
+ start_color_option(color_option);
+ putstr(WIN_STATUS, 0, newbot2);
+ end_color_option(color_option);
+}
+
+#endif
+
#ifndef OVLB
STATIC_DCL int mrank_sz;
#else /* OVLB */
@@ -165,10 +265,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 +321,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,28 +357,60 @@
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;
int cap = near_capacity();
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR) && !defined(DUMP_LOG)
+ struct color_option color_option;
+ int save_botlx = flags.botlx;
+#endif
hp = Upolyd ? u.mh : u.uhp;
hpmax = Upolyd ? u.mhmax : u.uhpmax;
if(hp < 0) hp = 0;
(void) describe_level(newbot2);
- Sprintf(nb = eos(newbot2),
- "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", oc_syms[COIN_CLASS],
+ Sprintf(nb = eos(newbot2), "%c:%-2ld", oc_syms[COIN_CLASS],
#ifndef GOLDOBJ
- u.ugold,
+ u.ugold
#else
- money_cnt(invent),
+ money_cnt(invent)
#endif
- hp, hpmax, u.uen, u.uenmax, u.uac);
+ );
+
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ Strcat(nb = eos(newbot2), " HP:");
+ curs(WIN_STATUS, 1, 1);
+ putstr(WIN_STATUS, 0, newbot2);
+ flags.botlx = 0;
+
+ Sprintf(nb = eos(nb), "%d(%d)", hp, hpmax);
+ apply_color_option(percentage_color_of(hp, hpmax, hp_colors), newbot2);
+#else
+ Sprintf(nb = eos(nb), " HP:%d(%d)", hp, hpmax);
+#endif
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ Strcat(nb = eos(nb), " Pw:");
+ curs(WIN_STATUS, 1, 1);
+ putstr(WIN_STATUS, 0, newbot2);
+ Sprintf(nb = eos(nb), "%d(%d)", u.uen, u.uenmax);
+ apply_color_option(percentage_color_of(u.uen, u.uenmax, pw_colors), newbot2);
+#else
+ Sprintf(nb = eos(nb), " Pw:%d(%d)", u.uen, u.uenmax);
+#endif
+ Sprintf(nb = eos(nb), " AC:%-2d", u.uac);
if (Upolyd)
Sprintf(nb = eos(nb), " HD:%d", mons[u.umonnum].mlevel);
#ifdef EXP_ON_BOTL
@@ -275,25 +422,77 @@
if(flags.time)
Sprintf(nb = eos(nb), " T:%ld", moves);
- if(strcmp(hu_stat[u.uhs], " ")) {
- Sprintf(nb = eos(nb), " ");
- Strcat(newbot2, hu_stat[u.uhs]);
- }
- if(Confusion) Sprintf(nb = eos(nb), " Conf");
+ if(strcmp(hu_stat[u.uhs], " "))
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text(hu_stat[u.uhs], newbot2);
+#else
+ Sprintf(nb = eos(nb), " %s", hu_stat[u.uhs]);
+#endif
+ if(Confusion)
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("Conf", newbot2);
+#else
+ Strcat(nb = eos(nb), " Conf");
+#endif
if(Sick) {
if (u.usick_type & SICK_VOMITABLE)
- Sprintf(nb = eos(nb), " FoodPois");
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("FoodPois", newbot2);
+#else
+ Strcat(nb = eos(nb), " FoodPois");
+#endif
if (u.usick_type & SICK_NONVOMITABLE)
- Sprintf(nb = eos(nb), " Ill");
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("Ill", newbot2);
+#else
+ Strcat(nb = eos(nb), " Ill");
+#endif
}
- if(Blind) Sprintf(nb = eos(nb), " Blind");
- if(Stunned) Sprintf(nb = eos(nb), " Stun");
- if(Hallucination) Sprintf(nb = eos(nb), " Hallu");
- if(Slimed) Sprintf(nb = eos(nb), " Slime");
+ if(Blind)
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("Blind", newbot2);
+#else
+ Strcat(nb = eos(nb), " Blind");
+#endif
+ if(Stunned)
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("Stun", newbot2);
+#else
+ Strcat(nb = eos(nb), " Stun");
+#endif
+ if(Hallucination)
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("Hallu", newbot2);
+#else
+ Strcat(nb = eos(nb), " Hallu");
+#endif
+ if(Slimed)
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text("Slime", newbot2);
+#else
+ Strcat(nb = eos(nb), " Slime");
+#endif
if(cap > UNENCUMBERED)
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ add_colored_text(enc_stat[cap], newbot2);
+#else
Sprintf(nb = eos(nb), " %s", enc_stat[cap]);
+#endif
+#ifdef DUMP_LOG
+}
+STATIC_OVL void
+bot2()
+{
+ char newbot2[MAXCO];
+ bot2str(newbot2);
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ struct color_option color_option;
+ int save_botlx = flags.botlx;
+#endif
+#endif
curs(WIN_STATUS, 1, 1);
putstr(WIN_STATUS, 0, newbot2);
+ flags.botlx = save_botlx;
}
void
diff -Nurd nethack-3.4.3/src/cmd.c nh343_gentoo/src/cmd.c
--- nethack-3.4.3/src/cmd.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/cmd.c 2005-11-21 21:30:35.000000000 -0600
@@ -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
@@ -478,9 +482,26 @@
STATIC_PTR int
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,305 @@
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");
+ Sprintf(buf, " %d", u.ualign.record);
+ dump(" Your alignment was ", buf);
+
+
+ /*** 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 +1668,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
@@ -1474,6 +1894,58 @@
{0,0,0,0}
};
+#ifdef DYNKEY
+
+/* let's not get too dynamic */
+#define DYNKEY_SZ (sizeof(struct dkb_tab) * (26*4+40))
+
+struct dkb_tab *dkblist = (struct dkb_tab *) 0;
+
+static int dkblist_sz=-1;
+
+int
+map_dkb(b, c)
+char b, c;
+{
+ if(dkblist_sz<0) {
+ dkblist=(struct dkb_tab *) alloc(DYNKEY_SZ+1); /* 0-term */
+ memset(dkblist, 0, DYNKEY_SZ+1);
+ dkblist_sz=0;
+ }
+ dkblist_sz++;
+ if(sizeof(struct dkb_tab) * dkblist_sz>DYNKEY_SZ)
+ return 0;
+ dkblist[dkblist_sz-1].bound_char=b;
+ dkblist[dkblist_sz-1].cmd_char=c;
+ return 1;
+}
+
+char
+keydesc2char(desc)
+char *desc;
+{
+ char key;
+ int l=strlen(desc);
+
+ if(l)
+ key=desc[l-1];
+ switch(l) {
+ case 1:
+ return key;
+ case 3:
+ if(desc[1]=='-')
+ if(desc[0]=='M')
+ return M(key);
+ else if(desc[0]=='C')
+ return C(key);
+ /*fall through*/
+ default:
+ return 0;
+ }
+}
+#undef DYNKEY_SZ
+#endif /* DYNKEY */
+
struct ext_func_tab extcmdlist[] = {
{"adjust", "adjust inventory letters", doorganize, TRUE},
{"chat", "talk to someone", dotalk, TRUE}, /* converse? */
@@ -1519,6 +1991,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 +2017,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},
@@ -2083,9 +2557,14 @@
#ifdef REDO
if(in_doagain || *readchar_queue)
- dirsym = readchar();
- else
+ dirsym =
+#ifdef DYNKEY
+ greadchar(TRUE);
+#else
+ readchar();
#endif
+ else
+#endif /* REDO */
dirsym = yn_function ((s && *s != '^') ? s : "In what direction?",
(char *)0, '\0');
#ifdef REDO
@@ -2331,9 +2810,20 @@
flags.move = 1;
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
- if (!iflags.num_pad || (foo = readchar()) == 'n')
+ if (!iflags.num_pad || (foo =
+#ifdef DYNKEY
+ greadchar(TRUE)
+#else
+ readchar()
+#endif
+ ) == 'n')
for (;;) {
- foo = readchar();
+ foo =
+#ifdef DYNKEY
+ greadchar(TRUE);
+#else
+ readchar();
+#endif
if (foo >= '0' && foo <= '9') {
multi = 10 * multi + foo - '0';
if (multi < 0 || multi >= LARGEST_INT) multi = LARGEST_INT;
@@ -2371,7 +2861,13 @@
in_line[1] = '\0';
if (foo == 'g' || foo == 'G' || foo == 'm' || foo == 'M' ||
foo == 'F' || (iflags.num_pad && (foo == '5' || foo == '-'))) {
- foo = readchar();
+ foo =
+#ifdef DYNKEY
+ greadchar(TRUE);
+#else
+ readchar();
+#endif
+
#ifdef REDO
savech((char)foo);
#endif
@@ -2405,7 +2901,12 @@
#ifdef OVL0
char
+#ifdef DYNKEY
+greadchar(dynkey)
+boolean dynkey;
+#else
readchar()
+#endif
{
register int sym;
int x = u.ux, y = u.uy, mod = 0;
@@ -2443,6 +2944,17 @@
readchar_queue = click_to_cmd(x, y, mod);
sym = *readchar_queue++;
}
+#ifdef DYNKEY
+ if(dkblist && dynkey) {
+ register const struct dkb_tab *dlist;
+
+ for(dlist = dkblist; dlist->bound_char; dlist++) {
+ if((sym & 0xff) != (dlist->bound_char & 0xff)) continue;
+ sym=dlist->cmd_char;
+ break;
+ }
+ }
+#endif
return((char) sym);
}
diff -Nurd nethack-3.4.3/src/decl.c nh343_gentoo/src/decl.c
--- nethack-3.4.3/src/decl.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/decl.c 2005-11-21 21:30:22.000000000 -0600
@@ -209,6 +209,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 +244,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 -Nurd nethack-3.4.3/src/display.c nh343_gentoo/src/display.c
--- nethack-3.4.3/src/display.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/display.c 2005-11-21 21:29:33.000000000 -0600
@@ -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 -Nurd nethack-3.4.3/src/do.c nh343_gentoo/src/do.c
--- nethack-3.4.3/src/do.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/do.c 2005-11-21 21:30:49.000000000 -0600
@@ -789,7 +789,8 @@
}
if (!stairs_down && !ladder_down) {
if (!(trap = t_at(u.ux,u.uy)) ||
- (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE)
+ (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE &&
+ trap->ttyp != PIT && trap->ttyp != SPIKED_PIT)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !flags.nopick &&
@@ -821,6 +822,14 @@
return(0);
}
+ /* Move into the pit */
+ if (trap && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
+ You("carefully slide down into the %spit",
+ trap->ttyp == SPIKED_PIT ? "spiked " : "");
+ u.utraptype = TT_PIT;
+ u.utrap = rn1(6,2);
+ return(0);
+ } else {
if (trap)
You("%s %s.", locomotion(youmonst.data, "jump"),
trap->ttyp == HOLE ? "down the hole" : "through the trap door");
@@ -832,6 +841,7 @@
next_level(!trap);
at_ladder = FALSE;
}
+ }
return(1);
}
diff -Nurd nethack-3.4.3/src/do_name.c nh343_gentoo/src/do_name.c
--- nethack-3.4.3/src/do_name.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/do_name.c 2005-11-21 21:30:35.000000000 -0600
@@ -69,7 +69,21 @@
lock_mouse_cursor(TRUE);
#endif
for (;;) {
+#ifdef DYNKEY
+#include "func_tab.h"
+#endif
c = nh_poskey(&tx, &ty, &sidx);
+#ifdef DYNKEY
+ if(dkblist) {
+ register const struct dkb_tab *dlist;
+
+ for(dlist = dkblist; dlist->bound_char; dlist++) {
+ if((c & 0xff) != (dlist->bound_char & 0xff)) continue;
+ c=dlist->cmd_char;
+ break;
+ }
+ }
+#endif
if (c == '\033') {
cx = cy = -10;
msg_given = TRUE; /* force clear */
diff -Nurd nethack-3.4.3/src/do_wear.c nh343_gentoo/src/do_wear.c
--- nethack-3.4.3/src/do_wear.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/do_wear.c 2005-11-21 21:30:05.000000000 -0600
@@ -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.");
diff -Nurd nethack-3.4.3/src/drawing.c nh343_gentoo/src/drawing.c
--- nethack-3.4.3/src/drawing.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/drawing.c 2005-11-21 21:30:43.000000000 -0600
@@ -655,6 +655,9 @@
switch_graphics(gr_set_flag)
int gr_set_flag;
{
+ if ((gr_set_flag < ASCII_GRAPHICS) || (gr_set_flag > MAC_GRAPHICS))
+ gr_set_flag = ASCII_GRAPHICS;
+ iflags.chargfx = gr_set_flag;
switch (gr_set_flag) {
default:
case ASCII_GRAPHICS:
@@ -672,8 +675,6 @@
* to the ISO 8859 character set. We should probably do a VioSetCp() call to
* set the codepage to 437.
*/
- iflags.IBMgraphics = TRUE;
- iflags.DECgraphics = FALSE;
assign_graphics(ibm_graphics, SIZE(ibm_graphics), MAXPCHARS, 0);
#ifdef PC9800
if (ibmgraphics_mode_callback) (*ibmgraphics_mode_callback)();
@@ -685,8 +686,6 @@
/*
* Use the VT100 line drawing character set.
*/
- iflags.DECgraphics = TRUE;
- iflags.IBMgraphics = FALSE;
assign_graphics(dec_graphics, SIZE(dec_graphics), MAXPCHARS, 0);
if (decgraphics_mode_callback) (*decgraphics_mode_callback)();
break;
@@ -795,7 +794,7 @@
for (i = 0; i < MAXMCLASSES; i++)
monsyms[i] = def_monsyms[i];
# if defined(ASCIIGRAPH) && !defined(MSWIN_GRAPHICS)
- if (iflags.IBMgraphics
+ if (iflags.chargfx == IBM_GRAPHICS
# if defined(USE_TILES) && defined(MSDOS)
&& !iflags.grmode
# endif
@@ -812,7 +811,7 @@
*/
# ifdef ASCIIGRAPH
- if (!iflags.IBMgraphics
+ if (!(iflags.chargfx == IBM_GRAPHICS)
# if defined(USE_TILES) && defined(MSDOS)
|| iflags.grmode
# endif
@@ -871,7 +870,7 @@
for (i = 0; i < MAXOCLASSES; i++) {
#ifdef ASCIIGRAPH
- if (iflags.IBMgraphics
+ if (iflags.chargfx == IBM_GRAPHICS
# if defined(USE_TILES) && defined(MSDOS)
&& !iflags.grmode
# endif
diff -Nurd nethack-3.4.3/src/eat.c nh343_gentoo/src/eat.c
--- nethack-3.4.3/src/eat.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/eat.c 2005-11-21 21:30:49.000000000 -0600
@@ -1888,6 +1888,28 @@
}
}
+ /* Can't eat trapped food - Chris Becker (topher@csh.rit.edu) */
+ {
+ struct trap* ttmp = t_at(u.ux,u.uy);
+ if (ttmp) {
+ switch(ttmp->ttyp) {
+ case PIT:
+ case SPIKED_PIT:
+ if (!(u.utraptype == TT_PIT && u.utrap)) {
+ You("can't reach %s, it's at the bottom of the %s!", the(xname(otmp)),
+ ttmp->ttyp == PIT ? "pit" : "spiked pit" );
+ return 0;
+ }
+ break;
+ case WEB:
+ You("can't eat %s, it's caught in the spider web%s!", the(xname(otmp)),
+ u.utraptype == TT_WEB && u.utrap ? " with you" : "" );
+ return 0;
+ default:
+ break;
+ }
+ }
+ }
/* We have to make non-foods take 1 move to eat, unless we want to
* do ridiculous amounts of coding to deal with partly eaten plate
* mails, players who polymorph back to human in the middle of their
diff -Nurd nethack-3.4.3/src/end.c nh343_gentoo/src/end.c
--- nethack-3.4.3/src/end.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/end.c 2005-11-21 21:30:05.000000000 -0600
@@ -39,8 +39,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 +92,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 */
@@ -112,7 +174,21 @@
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
@@ -366,18 +442,30 @@
ask = should_query_disclose_option('i', &defquery);
if (!done_stopprint) {
c = ask ? yn_function(qbuf, ynqchars, defquery) : defquery;
- if (c == 'y') {
+ } else {
+ c = 'n';
+ }
+ {
+#ifdef DUMP_LOG
+ boolean want_disp = (c == 'y')? TRUE: FALSE;
+#endif
struct obj *obj;
for (obj = invent; obj; obj = obj->nobj) {
makeknown(obj->otyp);
obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
}
+#ifdef DUMP_LOG
+ (void) dump_inventory((char *)0, TRUE, want_disp);
+ do_containerconts(invent, TRUE, TRUE, TRUE, want_disp);
+#else
+ if (c == 'y') {
(void) display_inventory((char *)0, TRUE);
container_contents(invent, TRUE, TRUE);
+ }
+#endif /* DUMP_LOG */
}
if (c == 'q') done_stopprint++;
- }
}
ask = should_query_disclose_option('a', &defquery);
@@ -388,14 +476,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);
+#ifdef DUMP_LOG
+ do_vanquished(defquery, ask, TRUE);
+#else
if (!done_stopprint)
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 +507,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 */
@@ -523,6 +631,11 @@
otmp->oartifact ? artifact_name(xname(otmp), &dummy) :
OBJ_NAME(objects[otmp->otyp]),
value, currency(value), points);
+#ifdef DUMP_LOG
+ if (dump_fp)
+ dump("", pbuf);
+ if (endwin != WIN_ERR)
+#endif
putstr(endwin, 0, pbuf);
}
}
@@ -536,6 +649,10 @@
done(how)
int how;
{
+#if defined(WIZARD) && defined(PARANOID)
+ char paranoid_buf[BUFSZ];
+ int really_bon = TRUE;
+#endif
boolean taken;
char kilbuf[BUFSZ], pbuf[BUFSZ];
winid endwin = WIN_ERR;
@@ -614,6 +731,22 @@
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 */
/* render vision subsystem inoperative */
iflags.vision_inited = 0;
/* might have been killed while using a disposable item, so make sure
@@ -725,8 +858,18 @@
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 */
@@ -770,15 +913,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,31 +951,39 @@
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);
}
if (!done_stopprint)
artifact_score(invent, FALSE, endwin); /* list artifacts */
-
+#ifdef DUMP_LOG
+ else
+ artifact_score(invent, FALSE, WIN_ERR);
+#endif
/* list valuables here */
for (val = valuables; val->list; val++) {
sort_valuables(val->list, val->size);
@@ -855,10 +1009,13 @@
count, plur(count));
}
putstr(endwin, 0, pbuf);
+#ifdef DUMP_LOG
+ if (dump_fp) dump("", pbuf);
+#endif
}
}
- } else if (!done_stopprint) {
+ } else {
/* did not escape or ascend */
if (u.uz.dnum == 0 && u.uz.dlevel <= 0) {
/* level teleported out of the dungeon; `how' is DIED,
@@ -878,21 +1035,32 @@
Sprintf(eos(pbuf), " with %ld point%s,",
u.urexp, plur(u.urexp));
- putstr(endwin, 0, pbuf);
+ if (!done_stopprint) 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);
+ Sprintf(pbuf, "and %ld piece%s of gold, after %ld move%s.",
+ umoney, plur(umoney), moves, plur(moves));
+ if (!done_stopprint) putstr(endwin, 0, pbuf);
+#ifdef DUMP_LOG
+ if (dump_fp) {
+ dump("", pbuf);
+ Sprintf(pbuf, "Killer: %s", killer);
+ dump("", pbuf);
}
- if (!done_stopprint) {
- Sprintf(pbuf,
+#endif
+ Sprintf(pbuf,
"You were level %d with a maximum of %d hit point%s when you %s.",
- u.ulevel, u.uhpmax, plur(u.uhpmax), ends[how]);
+ u.ulevel, u.uhpmax, plur(u.uhpmax), ends[how]);
+ if (!done_stopprint) {
putstr(endwin, 0, pbuf);
putstr(endwin, 0, "");
}
+#ifdef DUMP_LOG
+ if (dump_fp) dump("", pbuf);
+#endif
if (!done_stopprint)
display_nhwindow(endwin, TRUE);
if (endwin != WIN_ERR)
@@ -909,6 +1077,9 @@
exit_nhwindows((char *)0);
topten(how);
}
+#ifdef DUMP_LOG
+ if (dump_fp) dump_exit();
+#endif
if(done_stopprint) { raw_print(""); raw_print(""); }
terminate(EXIT_SUCCESS);
@@ -919,8 +1090,23 @@
container_contents(list, identified, all_containers)
struct obj *list;
boolean identified, all_containers;
+#ifdef DUMP_LOG
+{
+ do_containerconts(list, identified, all_containers, FALSE, TRUE);
+}
+
+void do_containerconts(list, identified, all_containers, want_dump, want_disp)
+struct obj *list;
+boolean identified, all_containers, want_dump, want_disp;
+#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) {
@@ -928,25 +1114,101 @@
if (box->otyp == BAG_OF_TRICKS) {
continue; /* wrong type of container */
} else if (box->cobj) {
- winid tmpwin = create_nhwindow(NHW_MENU);
+ winid tmpwin;
+#ifdef DUMP_LOG
+ if (want_disp)
+#endif
+ 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)));
+#ifdef DUMP_LOG
+ if (want_disp) {
+#endif
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;
}
+#ifdef DUMP_LOG
+ if (want_dump) dump(" ", doname(obj));
+ if (want_disp)
+#endif
putstr(tmpwin, 0, doname(obj));
}
+#ifdef DUMP_LOG
+ if (want_dump) dump("","");
+ if (want_disp) {
+#endif
display_nhwindow(tmpwin, TRUE);
destroy_nhwindow(tmpwin);
- if (all_containers)
+#ifdef DUMP_LOG
+ }
+ if (all_containers) {
+ do_containerconts(box->cobj, identified, TRUE,
+ want_dump, want_disp);
+#else
+ if (all_containers) {
container_contents(box->cobj, identified, TRUE);
+#endif /* DUMP_LOG */
+ }
} else {
+#ifdef DUMP_LOG
+ if (want_disp) {
+#endif
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 +1235,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;
@@ -996,13 +1269,22 @@
* includes all dead monsters, not just those killed by the player
*/
if (ntypes != 0) {
- c = ask ? yn_function("Do you want an account of creatures vanquished?",
+#ifdef DUMP_LOG
+ c = done_stopprint ? 'n': ask ?
+#else
+ c = ask ?
+#endif
+ yn_function("Do you want an account of creatures vanquished?",
ynqchars, defquery) : defquery;
if (c == 'q') done_stopprint++;
if (c == 'y') {
klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Vanquished creatures:");
putstr(klwin, 0, "");
+#ifdef DUMP_LOG
+ } /* the original end of block removed by the patch */
+ if (want_dump) dump("", "Vanquished creatures");
+#endif
/* countdown by monster "toughness" */
for (lev = max_lev; lev >= 0; lev--)
@@ -1029,21 +1311,38 @@
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);
+ if (c == 'y') putstr(klwin, 0, buf);
+#ifdef DUMP_LOG
+ if (want_dump) dump(" ", buf);
+#endif
}
/*
* if (Hallucination)
* putstr(klwin, 0, "and a partridge in a pear tree");
*/
if (ntypes > 1) {
- putstr(klwin, 0, "");
+ if (c == 'y') putstr(klwin, 0, "");
Sprintf(buf, "%ld creatures vanquished.", total_killed);
- putstr(klwin, 0, buf);
+ if (c == 'y') putstr(klwin, 0, buf);
+#ifdef DUMP_LOG
+ if (want_dump) dump(" ", buf);
+#endif
}
+ if (c == 'y') {
display_nhwindow(klwin, TRUE);
destroy_nhwindow(klwin);
- }
+ }
+#ifdef DUMP_LOG
+ if (want_dump) dump("", "");
+#else
+ } /* the original end of if (c == 'y') */
+#endif
}
}
@@ -1059,43 +1358,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 extinct?",
+ 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 extinct 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 extinct.", 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 -Nurd nethack-3.4.3/src/files.c nh343_gentoo/src/files.c
--- nethack-3.4.3/src/files.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/files.c 2005-11-21 21:32:22.000000000 -0600
@@ -999,7 +999,7 @@
#if defined(UNIX) && defined(QT_GRAPHICS)
int myuid=getuid();
struct dirent **namelist;
- int n = scandir("save", &namelist, 0, alphasort);;
+ int n = scandir(fqname("save",SAVE_PREFIX,0), &namelist, 0, alphasort);;
if ( n > 0 ) {
int i,j=0;
char** result = (char**)alloc((n+1)*sizeof(char*)); /* at most */
@@ -1720,6 +1720,12 @@
} else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) {
add_autopickup_exception(bufp);
#endif
+#ifdef DYNKEY
+ } else if (match_varname(buf, "MAPPING", 3)) {
+ add_dkb(bufp, FALSE);
+ } else if (match_varname(buf, "SWAP", 4)) {
+ add_dkb(bufp, TRUE);
+#endif
#ifdef NOCWD_ASSUMPTIONS
} else if (match_varname(buf, "HACKDIR", 4)) {
adjust_prefix(bufp, HACKPREFIX);
@@ -1794,6 +1800,14 @@
} 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
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ } else if (match_varname(buf, "STATUSCOLOR", 11)) {
+ (void) parse_status_color_options(bufp);
+#endif
} else if (match_varname(buf, "GRAPHICS", 4)) {
len = get_uchars(fp, buf, bufp, translate, FALSE,
MAXPCHARS, "GRAPHICS");
diff -Nurd nethack-3.4.3/src/invent.c nh343_gentoo/src/invent.c
--- nethack-3.4.3/src/invent.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/invent.c 2005-11-21 21:29:54.000000000 -0600
@@ -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, 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);
@@ -1017,7 +1022,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, TRUE
+#endif
+ );
if(!ilet) continue;
if (allowcnt && ctmp >= 0) {
cnt = ctmp;
@@ -1689,13 +1698,27 @@
* 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, want_disp)
+register const char *lets;
+boolean want_reply;
+long* out_cnt;
+boolean want_dump;
+boolean want_disp;
+#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;
@@ -1704,6 +1727,9 @@
anything any;
menu_item *selected;
+#ifdef DUMP_LOG
+ if (want_disp) {
+#endif
/* overriden by global flag */
if (flags.perm_invent) {
win = (lets && *lets) ? local_win : WIN_INVEN;
@@ -1713,6 +1739,11 @@
} 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
@@ -1725,11 +1756,24 @@
to here is short circuited away.
*/
if (!invent && !(flags.perm_invent && !lets && !want_reply)) {
+#ifdef DUMP_LOG
+ if (want_disp) {
+#endif
#ifndef GOLDOBJ
pline("Not carrying anything%s.", u.ugold ? " except gold" : "");
#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;
}
@@ -1743,37 +1787,124 @@
ret = '\0';
for (otmp = invent; otmp; otmp = otmp->nobj) {
if (otmp->invlet == lets[0]) {
+#ifdef DUMP_LOG
+ if (want_disp) {
+#endif
ret = message_menu(lets[0],
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 */
+
+#ifdef DUMP_LOG
+ if (want_disp)
+#endif
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 */
+#ifdef DUMP_LOG
+ if (want_dump)
+ dump(" ", let_to_name(*invlet, FALSE));
+ if (want_disp)
+#endif
+ add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
+ let_to_name(*invlet, FALSE), MENU_UNSELECTED);
+ classcount++;
+ }
+ any.a_char = ilet;
+#ifdef DUMP_LOG
+ if (want_dump) {
+ char letbuf[7];
+ sprintf(letbuf, " %c - ", ilet);
+ dump(letbuf, doname(otmp));
+ }
+ if (want_disp)
+#endif
+ add_menu(win, obj_to_glyph(otmp),
+ &any, ilet, 0, ATR_NONE, doname(otmp),
+ MENU_UNSELECTED);
+ }
+ }
+#else /* SORTLOOT */
for(otmp = invent; otmp; otmp = otmp->nobj) {
ilet = otmp->invlet;
if(!lets || !*lets || index(lets, ilet)) {
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
any.a_void = 0; /* zero */
+#ifdef DUMP_LOG
+ if (want_dump)
+ dump(" ", let_to_name(*invlet, FALSE));
+ if (want_disp)
+#endif
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE), MENU_UNSELECTED);
classcount++;
}
any.a_char = ilet;
+#ifdef DUMP_LOG
+ if (want_dump) {
+ char letbuf[7];
+ sprintf(letbuf, " %c - ", ilet);
+ dump(letbuf, doname(otmp));
+ }
+ if (want_disp)
+#endif
add_menu(win, obj_to_glyph(otmp),
&any, ilet, 0, ATR_NONE, doname(otmp),
MENU_UNSELECTED);
}
}
}
+#endif /* SORTLOOT */
if (flags.sortpack) {
if (*++invlet) goto nextclass;
#ifdef WIZARD
@@ -1783,6 +1914,12 @@
}
#endif
}
+#ifdef SORTLOOT
+ free(oarray);
+#endif
+#ifdef DUMP_LOG
+ if (want_disp) {
+#endif
end_menu(win, (char *) 0);
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);
@@ -1792,6 +1929,10 @@
free((genericptr_t)selected);
} else
ret = !n ? '\0' : '\033'; /* cancelled */
+#ifdef DUMP_LOG
+ } /* want_disp */
+ if (want_dump) dump("", "");
+#endif
return ret;
}
@@ -1808,8 +1949,23 @@
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 , TRUE
+#endif
+ );
+}
+
+#ifdef DUMP_LOG
+/* See display_inventory. This is the same thing WITH dumpfile creation */
+char
+dump_inventory(lets, want_reply, want_disp)
+register const char *lets;
+boolean want_reply, want_disp;
+{
+ return display_pickinv(lets, want_reply, (long *)0, TRUE, want_disp);
}
+#endif
/*
* Returns the number of unpaid items within the given list. This includes
diff -Nurd nethack-3.4.3/src/mapglyph.c nh343_gentoo/src/mapglyph.c
--- nethack-3.4.3/src/mapglyph.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/mapglyph.c 2005-11-21 21:30:43.000000000 -0600
@@ -50,10 +50,10 @@
#ifdef ROGUE_COLOR
# if defined(USE_TILES) && defined(MSDOS)
-#define HAS_ROGUE_IBM_GRAPHICS (iflags.IBMgraphics && !iflags.grmode && \
+#define HAS_ROGUE_IBM_GRAPHICS (iflags.chargfx == IBM_GRAPHICS && !iflags.grmode && \
Is_rogue_level(&u.uz))
# else
-#define HAS_ROGUE_IBM_GRAPHICS (iflags.IBMgraphics && Is_rogue_level(&u.uz))
+#define HAS_ROGUE_IBM_GRAPHICS (iflags.chargfx == IBM_GRAPHICS && Is_rogue_level(&u.uz))
# endif
#endif
diff -Nurd nethack-3.4.3/src/mcastu.c nh343_gentoo/src/mcastu.c
--- nethack-3.4.3/src/mcastu.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/mcastu.c 2005-11-21 21:30:49.000000000 -0600
@@ -515,6 +515,14 @@
pline("A bolt of lightning strikes down at you from above!");
reflects = ureflects("It bounces off your %s%s.", "");
+
+ /* copied from zap.c
+ * Chris Becker (topher@csh.rit.edu)
+ */
+ You("are blinded by the flash!");
+ make_blinded((long)rnd(100),FALSE);
+ if (!Blind) Your(vision_clears);
+
if (reflects || Shock_resistance) {
shieldeff(u.ux, u.uy);
dmg = 0;
diff -Nurd nethack-3.4.3/src/objnam.c nh343_gentoo/src/objnam.c
--- nethack-3.4.3/src/objnam.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/objnam.c 2005-11-21 21:29:54.000000000 -0600
@@ -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 -Nurd nethack-3.4.3/src/options.c nh343_gentoo/src/options.c
--- nethack-3.4.3/src/options.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/options.c 2005-11-21 21:30:43.000000000 -0600
@@ -23,6 +23,20 @@
#define PREFER_TILED FALSE
#endif
+static struct Char_Gfx {
+ int gfx;
+ char *txt;
+ char let;
+} const chargfx[] = {
+ {ASCII_GRAPHICS, "ASCII", 'a'},
+ {DEC_GRAPHICS, "DEC", 'd'},
+ {IBM_GRAPHICS, "IBM", 'i'},
+#ifdef MAC_GRAPHICS_ENV
+ {MAC_GRAPHICS, "Mac", 'm'},
+#endif
+};
+
+
/*
* NOTE: If you add (or delete) an option, please update the short
* options help (option_help()), the long options help (dat/opthelp),
@@ -76,7 +90,7 @@
# endif
{"confirm",&flags.confirm, TRUE, SET_IN_GAME},
#if defined(TERMLIB) && !defined(MAC_GRAPHICS_ENV)
- {"DECgraphics", &iflags.DECgraphics, FALSE, SET_IN_GAME},
+ {"DECgraphics", &iflags.DECgraphics, FALSE, SET_IN_FILE},
#else
{"DECgraphics", (boolean *)0, FALSE, SET_IN_FILE},
#endif
@@ -102,7 +116,7 @@
{"help", &flags.help, TRUE, SET_IN_GAME},
{"hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME}, /*WC*/
#ifdef ASCIIGRAPH
- {"IBMgraphics", &iflags.IBMgraphics, FALSE, SET_IN_GAME},
+ {"IBMgraphics", &iflags.IBMgraphics, FALSE, SET_IN_FILE},
#else
{"IBMgraphics", (boolean *)0, FALSE, SET_IN_FILE},
#endif
@@ -116,7 +130,7 @@
{"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME},
{"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME},
#ifdef MAC_GRAPHICS_ENV
- {"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_GAME},
+ {"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_FILE},
#else
{"Macgraphics", (boolean *)0, FALSE, SET_IN_FILE},
#endif
@@ -125,6 +139,20 @@
#else
{"mail", (boolean *)0, TRUE, SET_IN_FILE},
#endif
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ {"statuscolors", &iflags.use_status_colors, TRUE, SET_IN_GAME},
+#else
+ {"statuscolors", (boolean *)0, TRUE, SET_IN_GAME},
+#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 +171,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 +193,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
@@ -219,11 +255,20 @@
1, SET_IN_GAME },
{ "catname", "the name of your (first) cat (e.g., catname:Tabby)",
PL_PSIZ, DISP_IN_GAME },
+ { "chargfx", "use special character set for display", PL_PSIZ, SET_IN_GAME },
{ "disclose", "the kinds of information to disclose at end of game",
sizeof(flags.end_disclose) * 2,
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 +291,7 @@
{ "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*/
+ { "menucolor", "set menu colors", PL_PSIZ, SET_IN_FILE },
{ "menustyle", "user interface for object selection",
MENUTYPELEN, SET_IN_GAME },
{ "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE },
@@ -306,9 +352,13 @@
{ "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
+ { "statuscolor", "set status colors", PL_PSIZ, SET_IN_FILE },
{ "suppress_alert", "suppress alerts about version-specific features",
8, SET_IN_GAME },
{ "tile_width", "width of tiles", 20, DISP_IN_GAME}, /*WC*/
@@ -532,6 +582,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);
@@ -551,6 +605,7 @@
*/
/* this detects the IBM-compatible console on most 386 boxes */
if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) {
+ iflags.chargfx = IBM_GRAPHICS;
switch_graphics(IBM_GRAPHICS);
# ifdef TEXTCOLOR
iflags.use_color = TRUE;
@@ -563,12 +618,14 @@
if ((opts = nh_getenv("TERM")) &&
!strncmpi(opts, "vt", 2) && AS && AE &&
index(AS, '\016') && index(AE, '\017')) {
+ iflags.chargfx = DEC_GRAPHICS;
switch_graphics(DEC_GRAPHICS);
}
# endif
#endif /* UNIX || VMS */
#ifdef MAC_GRAPHICS_ENV
+ iflags.chargfx = MAC_GRAPHICS;
switch_graphics(MAC_GRAPHICS);
#endif /* MAC_GRAPHICS_ENV */
flags.menu_style = MENU_FULL;
@@ -891,6 +948,133 @@
return 1;
}
+#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, '=');
+#ifdef MENU_COLOR_REGEX_POSIX
+ int errnum;
+ char errbuf[80];
+#endif
+ 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
+#ifdef MENU_COLOR_REGEX_POSIX
+ errnum = regcomp(&tmp->match, tmps, REG_EXTENDED | REG_NOSUB);
+ if (errnum != 0)
+ {
+ regerror(errnum, &tmp->match, errbuf, sizeof(errbuf));
+ err = errbuf;
+ }
+#else
+ 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);
+#endif
+#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
set_duplicate_opt_detection(on_or_off)
int on_or_off;
@@ -964,6 +1148,165 @@
}
}
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+
+struct name_value {
+ char *name;
+ int value;
+};
+
+const struct name_value status_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 },
+ { NULL, -1 }
+};
+
+const struct name_value status_attrnames[] = {
+ { "none", ATR_NONE },
+ { "bold", ATR_BOLD },
+ { "dim", ATR_DIM },
+ { "underline", ATR_ULINE },
+ { "blink", ATR_BLINK },
+ { "inverse", ATR_INVERSE },
+ { NULL, -1 }
+};
+
+int
+value_of_name(name, name_values)
+const char *name;
+const struct name_value *name_values;
+{
+ while (name_values->name && !strstri(name_values->name, name))
+ ++name_values;
+ return name_values->value;
+}
+
+struct color_option
+parse_color_option(start)
+char *start;
+{
+ struct color_option result = {NO_COLOR, 0};
+ char last;
+ char *end;
+ int attr;
+
+ for (end = start; *end != '&' && *end != '\0'; ++end);
+ last = *end;
+ *end = '\0';
+ result.color = value_of_name(start, status_colornames);
+
+ while (last == '&') {
+ for (start = ++end; *end != '&' && *end != '\0'; ++end);
+ last = *end;
+ *end = '\0';
+ attr = value_of_name(start, status_attrnames);
+ if (attr >= 0)
+ result.attr_bits |= 1 << attr;
+ }
+
+ return result;
+}
+
+const struct percent_color_option *hp_colors = NULL;
+const struct percent_color_option *pw_colors = NULL;
+const struct text_color_option *text_colors = NULL;
+
+struct percent_color_option *
+add_percent_option(new_option, list_head)
+struct percent_color_option *new_option;
+struct percent_color_option *list_head;
+{
+ if (list_head == NULL)
+ return new_option;
+ if (new_option->percentage <= list_head->percentage) {
+ new_option->next = list_head;
+ return new_option;
+ }
+ list_head->next = add_percent_option(new_option, list_head->next);
+ return list_head;
+}
+
+boolean
+parse_status_color_option(start)
+char *start;
+{
+ char *middle;
+
+ while (*start && isspace(*start)) start++;
+ for (middle = start; *middle != ':' && *middle != '=' && *middle != '\0'; ++middle);
+ *middle++ = '\0';
+ if (middle - start > 2 && start[2] == '%') {
+ struct percent_color_option *percent_color_option =
+ (struct percent_color_option *)alloc(sizeof(*percent_color_option));
+ percent_color_option->next = NULL;
+ percent_color_option->percentage = atoi(start + 3);
+ percent_color_option->color_option = parse_color_option(middle);
+ start[2] = '\0';
+ if (percent_color_option->color_option.color >= 0
+ && percent_color_option->color_option.attr_bits >= 0) {
+ if (!strcmpi(start, "hp")) {
+ hp_colors = add_percent_option(percent_color_option, hp_colors);
+ return TRUE;
+ }
+ if (!strcmpi(start, "pw")) {
+ pw_colors = add_percent_option(percent_color_option, pw_colors);
+ return TRUE;
+ }
+ }
+ free(percent_color_option);
+ return FALSE;
+ } else {
+ int length = strlen(start) + 1;
+ struct text_color_option *text_color_option =
+ (struct text_color_option *)alloc(sizeof(*text_color_option));
+ text_color_option->next = NULL;
+ text_color_option->text = (char *)alloc(length);
+ memcpy((char *)text_color_option->text, start, length);
+ text_color_option->color_option = parse_color_option(middle);
+ if (text_color_option->color_option.color >= 0
+ && text_color_option->color_option.attr_bits >= 0) {
+ text_color_option->next = text_colors;
+ text_colors = text_color_option;
+ return TRUE;
+ }
+ free(text_color_option->text);
+ free(text_color_option);
+ return FALSE;
+ }
+}
+
+boolean
+parse_status_color_options(start)
+char *start;
+{
+ char last = ',';
+ char *end = start - 1;
+ boolean ok = TRUE;
+ while (last == ',') {
+ for (start = ++end; *end != ',' && *end != '\0'; ++end);
+ last = *end;
+ *end = '\0';
+ ok = parse_status_color_option(start) && ok;
+ }
+ return ok;
+}
+
+
+#endif /* STATUS_COLORS */
+
void
parseoptions(opts, tinitial, tfrom_file)
register char *opts;
@@ -1077,6 +1420,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);
@@ -1114,6 +1470,32 @@
return;
}
+ fullname = "chargfx";
+ if (match_optname(opts, fullname, 5, TRUE)) {
+ if (negated) {
+ iflags.chargfx = ASCII_GRAPHICS;
+ } else if ((op = string_for_opt(opts, FALSE)) != 0) {
+ int i;
+ for (i = 0; i < SIZE(chargfx); i++)
+ if (!strncmpi(op, chargfx[i].txt, strlen(op))) {
+ iflags.chargfx = chargfx[i].gfx;
+ need_redraw = TRUE;
+# ifdef REINCARNATION
+ if (!initial && Is_rogue_level(&u.uz))
+ assign_rogue_graphics(FALSE);
+# endif
+ switch_graphics(iflags.chargfx);
+# ifdef REINCARNATION
+ if (!initial && Is_rogue_level(&u.uz))
+ assign_rogue_graphics(TRUE);
+# endif
+ return;
+ }
+ badoption(opts);
+ }
+ return;
+ }
+
fullname = "runmode";
if (match_optname(opts, fullname, 4, TRUE)) {
if (negated) {
@@ -1133,6 +1515,29 @@
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 = "statuscolor";
+ if (match_optname(opts, fullname, 11, TRUE)) {
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ if (negated) bad_negation(fullname, FALSE);
+ else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
+ if (!parse_status_color_options(op))
+ badoption(opts);
+#endif
+ return;
+ }
+
fullname = "msghistory";
if (match_optname(opts, fullname, 3, TRUE)) {
op = string_for_env_opt(fullname, opts, negated);
@@ -1839,6 +2244,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);
@@ -2168,19 +2591,20 @@
need_redraw = TRUE;
# ifdef TERMLIB
if ((boolopt[i].addr) == &iflags.DECgraphics)
- switch_graphics(iflags.DECgraphics ?
- DEC_GRAPHICS : ASCII_GRAPHICS);
+ iflags.chargfx = iflags.DECgraphics ?
+ DEC_GRAPHICS : ASCII_GRAPHICS;
# endif
# ifdef ASCIIGRAPH
if ((boolopt[i].addr) == &iflags.IBMgraphics)
- switch_graphics(iflags.IBMgraphics ?
- IBM_GRAPHICS : ASCII_GRAPHICS);
+ iflags.chargfx = iflags.IBMgraphics ?
+ IBM_GRAPHICS : ASCII_GRAPHICS;
# endif
# ifdef MAC_GRAPHICS_ENV
if ((boolopt[i].addr) == &iflags.MACgraphics)
- switch_graphics(iflags.MACgraphics ?
- MAC_GRAPHICS : ASCII_GRAPHICS);
+ iflags.chargfx = iflags.MACgraphics ?
+ MAC_GRAPHICS : ASCII_GRAPHICS;
# endif
+ switch_graphics(iflags.chargfx);
# ifdef REINCARNATION
if (!initial && Is_rogue_level(&u.uz))
assign_rogue_graphics(TRUE);
@@ -2263,6 +2687,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 +2970,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
@@ -2565,6 +2995,32 @@
}
destroy_nhwindow(tmpwin);
retval = TRUE;
+ } else if (!strcmp("chargfx", optname)) {
+ menu_item *gfx_pick = (menu_item *)0;
+ tmpwin = create_nhwindow(NHW_MENU);
+ start_menu(tmpwin);
+ for (i = 0; i < SIZE(chargfx); i++) {
+ const char *t = chargfx[i].txt;
+ any.a_int = chargfx[i].gfx + 1;
+ add_menu(tmpwin, NO_GLYPH, &any, chargfx[i].let, 0, ATR_NONE, t, MENU_UNSELECTED);
+ }
+ end_menu(tmpwin, "Select character graphics type");
+ if (select_menu(tmpwin, PICK_ONE, &gfx_pick) > 0) {
+ iflags.chargfx = gfx_pick->item.a_int-1;
+# ifdef REINCARNATION
+ if (Is_rogue_level(&u.uz))
+ assign_rogue_graphics(FALSE);
+# endif
+ switch_graphics(iflags.chargfx);
+# ifdef REINCARNATION
+ if (Is_rogue_level(&u.uz))
+ assign_rogue_graphics(TRUE);
+# endif
+ need_redraw = TRUE;
+ free((genericptr_t)gfx_pick);
+ }
+ destroy_nhwindow(tmpwin);
+ retval = TRUE;
} else if (!strcmp("pickup_burden", optname)) {
const char *burden_name, *burden_letters = "ubsntl";
menu_item *burden_pick = (menu_item *)0;
@@ -2761,6 +3217,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";
@@ -2875,6 +3351,8 @@
retval = TRUE;
#endif /* AUTOPICKUP_EXCEPTIONS */
}
+ if (need_redraw)
+ (void) doredraw();
return retval;
}
@@ -2920,7 +3398,14 @@
iflags.bouldersym : oc_syms[(int)objects[BOULDER].oc_class]);
else if (!strcmp(optname, "catname"))
Sprintf(buf, "%s", catname[0] ? catname : none );
- else if (!strcmp(optname, "disclose")) {
+ else if (!strcmp(optname, "chargfx")) {
+ Sprintf(buf, "Unknown");
+ for (i = 0; i < SIZE(chargfx); i++)
+ if (iflags.chargfx == chargfx[i].gfx) {
+ Sprintf(buf, "%s", chargfx[i].txt);
+ break;
+ }
+ } else if (!strcmp(optname, "disclose")) {
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
char topt[2];
if (i) Strcat(buf," ");
@@ -2933,6 +3418,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 +3561,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
@@ -3262,6 +3762,31 @@
}
#endif /* AUTOPICKUP_EXCEPTIONS */
+#ifdef DYNKEY
+void
+add_dkb(bufp, swap)
+char *bufp;
+boolean swap;
+{
+ char *p;
+ char b, c;
+
+ if(!(p=index(bufp,' '))) {
+ raw_printf("DYNKEY MAP: bad mapping: %s.", bufp);
+ return;
+ }
+ *p++='\0';
+
+ b=keydesc2char(bufp);
+ c=keydesc2char(p);
+ if(b && c) {
+ if(!map_dkb(b, c) || (swap && !map_dkb(c, b)))
+ raw_printf("DYNKEY MAP: map_dkb error");
+ } else
+ raw_printf("DYNKEY MAP: invalid key: %s.", b==0?bufp:p);
+}
+#endif /* DYNKEY */
+
/* data for option_help() */
static const char *opt_intro[] = {
"",
diff -Nurd nethack-3.4.3/src/pickup.c nh343_gentoo/src/pickup.c
--- nethack-3.4.3/src/pickup.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/pickup.c 2005-11-21 21:29:54.000000000 -0600
@@ -690,9 +690,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 +723,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 +763,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 +796,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);
diff -Nurd nethack-3.4.3/src/save.c nh343_gentoo/src/save.c
--- nethack-3.4.3/src/save.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/save.c 2005-11-21 21:30:22.000000000 -0600
@@ -48,6 +48,16 @@
#define HUP
#endif
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+extern const struct percent_color_option *hp_colors;
+extern const struct percent_color_option *pw_colors;
+extern const struct text_color_option *text_colors;
+#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;
@@ -953,12 +963,67 @@
return;
}
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+
+void
+free_percent_color_options(list_head)
+const struct percent_color_option *list_head;
+{
+ if (list_head == NULL) return;
+ free_percent_color_options(list_head->next);
+ free(list_head);
+}
+
+void
+free_text_color_options(list_head)
+const struct text_color_option *list_head;
+{
+ if (list_head == NULL) return;
+ free_text_color_options(list_head->next);
+ free(list_head->text);
+ free(list_head);
+}
+
+void
+free_status_colors()
+{
+ free_percent_color_options(hp_colors); hp_colors = NULL;
+ free_percent_color_options(pw_colors); pw_colors = NULL;
+ free_text_color_options(text_colors); text_colors = NULL;
+}
+#endif
+
+#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
+#if defined(STATUS_COLORS) && defined(TEXTCOLOR)
+ free_status_colors();
+#endif
tmp_at(DISP_FREEMEM, 0); /* temporary display effects */
#ifdef FREE_ALL_MEMORY
# define freeobjchn(X) (saveobjchn(0, X, FREE_SAVE), X = 0)
diff -Nurd nethack-3.4.3/src/sit.c nh343_gentoo/src/sit.c
--- nethack-3.4.3/src/sit.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/sit.c 2005-11-21 21:30:49.000000000 -0600
@@ -64,9 +64,49 @@
register struct obj *obj;
obj = level.objects[u.ux][u.uy];
- You("sit on %s.", the(xname(obj)));
- if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
- pline("It's not very comfortable...");
+
+ /* Corpse effects when sitting - Chris Becker (topher@csh.rit.edu)
+ */
+ if (obj->otyp == CORPSE ) {
+ /* so we get the monster's name */
+ You("sit on %s.", singular(obj, doname));
+ if (touch_petrifies(&mons[obj->corpsenm]) && !uarm
+ && !Stone_resistance ) {
+ char kbuf[BUFSZ];
+ pline("Sitting on %s corpse without armor is a fatal mistake...",
+ an(mons[obj->corpsenm].mname));
+ Sprintf(kbuf, "sitting on %s corpse without armor",
+ an(mons[obj->corpsenm].mname));
+ instapetrify(kbuf);
+ } else if (acidic(&mons[obj->corpsenm])) {
+ if (!Acid_resistance) {
+ pline( "Ouch! That burns!" );
+ losehp(d(1,6), "sitting on an acidic corpse", KILLED_BY);
+ }
+ if (uarm && !rn2(3)) /* corrode armor */
+ (void)rust_dmg(uarm, xname(uarm), 3, TRUE, &youmonst);
+ if (obj->corpsenm == PM_GREEN_SLIME) {
+ if (!uarm && !rn2(4)) { /* you touched it */
+ if (flaming(youmonst.data) || Unchanging ||
+ youmonst.data == &mons[PM_GREEN_SLIME]) {
+ pline_The("Yuck!");
+ } else if (!Slimed) {
+ You("don't feel very well.");
+ Slimed = 10L;
+ flags.botl = 1;
+ killer_format = KILLED_BY_AN;
+ delayed_killer = (&mons[obj->corpsenm])->mname;
+ }
+ }
+ } else {
+ pline("It's not very comfortable...");
+ }
+ }
+ } else {
+ You("sit on %s.", the(xname(obj)));
+ if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
+ pline("It's not very comfortable...");
+ }
} else if ((trap = t_at(u.ux, u.uy)) != 0 ||
(u.utrap && (u.utraptype >= TT_LAVA))) {
diff -Nurd nethack-3.4.3/src/spell.c nh343_gentoo/src/spell.c
--- nethack-3.4.3/src/spell.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/spell.c 2005-11-21 21:29:33.000000000 -0600
@@ -1114,6 +1114,35 @@
return FALSE;
}
+#ifdef DUMP_LOG
+void
+dump_spells()
+{
+ int i;
+ 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 -Nurd nethack-3.4.3/src/topten.c nh343_gentoo/src/topten.c
--- nethack-3.4.3/src/topten.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/topten.c 2005-11-21 21:29:33.000000000 -0600
@@ -358,6 +358,12 @@
"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;
}
@@ -378,6 +384,9 @@
}
HUP topten_print("");
+#ifdef DUMP_LOG
+ dump("", "");
+#endif
/* assure minimum number of points */
if(t0->points < POINTSMIN) t0->points = 0;
@@ -422,6 +431,10 @@
t1->points);
topten_print(pbuf);
topten_print("");
+#ifdef DUMP_LOG
+ dump("", pbuf);
+ dump("", "");
+#endif
}
}
if(occ_cnt < 0) {
@@ -452,17 +465,27 @@
goto destroywin;
}
#endif /* UPDATE_RECORD_IN_PLACE */
- if(!done_stopprint) if(rank0 > 0){
- if(rank0 <= 10)
- topten_print("You made the top ten list!");
- else {
+ if(rank0 > 0){
+ if(rank0 <= 10) {
+ if(!done_stopprint)
+ topten_print("You made the top ten list!");
+#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);
+ if(!done_stopprint) topten_print(pbuf);
+#ifdef DUMP_LOG
+ dump("", pbuf);
+#endif
}
- topten_print("");
+ if(!done_stopprint) topten_print("");
+#ifdef DUMP_LOG
+ dump("", "");
+#endif
}
}
if(rank0 == 0) rank0 = rank1;
@@ -475,7 +498,7 @@
&& rank >= rank0
#endif
) writeentry(rfile, t1);
- if (done_stopprint) continue;
+ /* if (done_stopprint) continue; */
if (rank > flags.end_top &&
(rank < rank0 - flags.end_around ||
rank > rank0 + flags.end_around) &&
@@ -488,8 +511,12 @@
)) continue;
if (rank == rank0 - flags.end_around &&
rank0 > flags.end_top + flags.end_around + 1 &&
- !flags.end_own)
- topten_print("");
+ !flags.end_own) {
+ if(!done_stopprint) topten_print("");
+#ifdef DUMP_LOG
+ dump("", "");
+#endif
+ }
if(rank != rank0)
outentry(rank, t1, FALSE);
else if(!rank1)
@@ -546,7 +573,10 @@
bp = eos(linebuf);
while(bp < linebuf + COLNO - 9) *bp++ = ' ';
Strcpy(bp, "Hp [max]");
- topten_print(linebuf);
+ if(!done_stopprint) topten_print(linebuf);
+#ifdef DUMP_LOG
+ dump("", linebuf);
+#endif
}
/* so>0: standout line; so=0: ordinary line */
@@ -664,9 +694,16 @@
if (so) {
while (bp < linebuf + (COLNO-1)) *bp++ = ' ';
*bp = 0;
- topten_print_bold(linebuf);
- } else
- topten_print(linebuf);
+ if(!done_stopprint) topten_print_bold(linebuf);
+#ifdef DUMP_LOG
+ dump("*", linebuf[0]==' '? linebuf+1: linebuf);
+#endif
+ } else {
+ if(!done_stopprint) topten_print(linebuf);
+#ifdef DUMP_LOG
+ dump(" ", linebuf[0]==' '? linebuf+1: linebuf);
+#endif
+ }
Sprintf(linebuf, "%15s %s", "", linebuf3);
lngr = strlen(linebuf);
}
@@ -688,9 +725,12 @@
if (so >= COLNO) so = COLNO-1;
while (bp < linebuf + so) *bp++ = ' ';
*bp = 0;
- topten_print_bold(linebuf);
+ if(!done_stopprint) topten_print_bold(linebuf);
} else
- topten_print(linebuf);
+ if(!done_stopprint) topten_print(linebuf);
+#ifdef DUMP_LOG
+ dump(" ", linebuf[0]==' '? linebuf+1: linebuf);
+#endif
}
STATIC_OVL int
diff -Nurd nethack-3.4.3/src/uhitm.c nh343_gentoo/src/uhitm.c
--- nethack-3.4.3/src/uhitm.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/uhitm.c 2005-11-21 21:30:49.000000000 -0600
@@ -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
}
}
@@ -597,6 +615,12 @@
if (mdat != &mons[PM_SHADE])
tmp++;
}
+ /* silver arrows do silver damage - Chris Becker (topher@csh.rit.edu) */
+ if (objects[obj->otyp].oc_material == SILVER
+ && hates_silver(mdat)) {
+ silvermsg = TRUE; silverobj = TRUE;
+ tmp += rnd(20);
+ }
} else {
tmp = dmgval(obj, mon);
/* a minimal hit doesn't exercise proficiency */
diff -Nurd nethack-3.4.3/src/version.c nh343_gentoo/src/version.c
--- nethack-3.4.3/src/version.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/version.c 2005-11-21 21:30:28.000000000 -0600
@@ -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 -Nurd nethack-3.4.3/src/weapon.c nh343_gentoo/src/weapon.c
--- nethack-3.4.3/src/weapon.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/src/weapon.c 2005-11-21 21:29:33.000000000 -0600
@@ -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 -Nurd nethack-3.4.3/sys/wince/mhfont.c nh343_gentoo/sys/wince/mhfont.c
--- nethack-3.4.3/sys/wince/mhfont.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/sys/wince/mhfont.c 2005-11-21 21:30:43.000000000 -0600
@@ -154,7 +154,7 @@
UINT mswin_charset()
{
CHARSETINFO cis;
- if( iflags.IBMgraphics )
+ if( iflags.chargfx == IBM_GRAPHICS )
if( TranslateCharsetInfo((DWORD*)GetOEMCP(), &cis, TCI_SRCCODEPAGE) )
return cis.ciCharset;
else
diff -Nurd nethack-3.4.3/util/Makefile nh343_gentoo/util/Makefile
--- nethack-3.4.3/util/Makefile 2005-11-21 19:49:49.000000000 -0600
+++ nh343_gentoo/util/Makefile 2005-11-21 21:29:11.000000000 -0600
@@ -101,11 +101,11 @@
# yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
# if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
-YACC = yacc
-LEX = lex
-# YACC = bison -y
+#YACC = yacc
+#LEX = lex
+ YACC = bison -y
# YACC = byacc
-# LEX = flex
+ LEX = flex
# these are the names of the output files from YACC/LEX. Under MS-DOS
# and similar systems, they may differ
diff -Nurd nethack-3.4.3/util/makedefs.c nh343_gentoo/util/makedefs.c
--- nethack-3.4.3/util/makedefs.c 2003-12-07 17:39:13.000000000 -0600
+++ nh343_gentoo/util/makedefs.c 2005-11-21 21:30:22.000000000 -0600
@@ -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 */ \
)
@@ -679,6 +682,13 @@
#ifdef MAIL
"mail daemon",
#endif
+#ifdef MENU_COLOR
+# ifdef MENU_COLOR_REGEX
+ "menu colors via regular expressions",
+# else
+ "menu colors via pmatch",
+# endif
+#endif
#ifdef GNUDOS
"MSDOS protected mode",
#endif
@@ -775,6 +785,73 @@
"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)
+ "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 ARTI_WITH_OWNER
+ "patch: owned artifacts",
+#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 -Nurd nethack-3.4.3/win/tty/termcap.c nh343_gentoo/win/tty/termcap.c
--- nethack-3.4.3/win/tty/termcap.c 2003-12-07 17:39:14.000000000 -0600
+++ nh343_gentoo/win/tty/termcap.c 2005-11-21 21:30:43.000000000 -0600
@@ -397,7 +397,7 @@
* Do not select NA ASCII as the primary font since people may
* reasonably be using the UK character set.
*/
- if (iflags.DECgraphics) xputs("\033)0");
+ if (iflags.chargfx == DEC_GRAPHICS) xputs("\033)0");
#ifdef PC9800
init_hilite();
#endif
@@ -460,19 +460,19 @@
xputs(TI);
xputs(VS);
#ifdef PC9800
- if (!iflags.IBMgraphics && !iflags.DECgraphics)
+ if (!(iflags.chargfx == IBM_GRAPHICS) && !(iflags.chargfx == DEC_GRAPHICS))
tty_ascgraphics_hilite_fixup();
/* set up callback in case option is not set yet but toggled later */
ascgraphics_mode_callback = tty_ascgraphics_hilite_fixup;
# ifdef ASCIIGRAPH
- if (iflags.IBMgraphics) init_hilite();
+ if (iflags.chargfx == IBM_GRAPHICS) init_hilite();
/* set up callback in case option is not set yet but toggled later */
ibmgraphics_mode_callback = init_hilite;
# endif
#endif /* PC9800 */
#ifdef TERMLIB
- if (iflags.DECgraphics) tty_decgraphics_termcap_fixup();
+ if (iflags.chargfx == DEC_GRAPHICS) tty_decgraphics_termcap_fixup();
/* set up callback in case option is not set yet but toggled later */
decgraphics_mode_callback = tty_decgraphics_termcap_fixup;
#endif
diff -Nurd nethack-3.4.3/win/tty/wintty.c nh343_gentoo/win/tty/wintty.c
--- nethack-3.4.3/win/tty/wintty.c 2003-12-07 17:39:14.000000000 -0600
+++ nh343_gentoo/win/tty/wintty.c 2005-11-21 21:30:43.000000000 -0600
@@ -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,32 @@
}
}
+#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
+# ifdef MENU_COLOR_REGEX_POSIX
+ if (regexec(&tmpmc->match, str, 0, NULL, 0) == 0) {
+# else
+ if (re_search(&tmpmc->match, str, strlen(str), 0, 9999, 0) >= 0) {
+# endif
+# 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 +1234,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 +1253,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 +1277,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 {
@@ -1722,7 +1769,7 @@
}
-STATIC_OVL const char*
+const char*
compress_str(str)
const char *str;
{
@@ -2328,7 +2375,7 @@
register char ch = (char)in_ch;
# if defined(ASCIIGRAPH) && !defined(NO_TERMS)
- if (iflags.IBMgraphics || iflags.eight_bit_tty) {
+ if (iflags.chargfx == IBM_GRAPHICS || iflags.eight_bit_tty) {
/* IBM-compatible displays don't need other stuff */
(void) putchar(ch);
} else if (ch & 0x80) {
diff -Nurd nethack-3.4.3/win/win32/mhfont.c nh343_gentoo/win/win32/mhfont.c
--- nethack-3.4.3/win/win32/mhfont.c 2003-12-07 17:39:14.000000000 -0600
+++ nh343_gentoo/win/win32/mhfont.c 2005-11-21 21:30:43.000000000 -0600
@@ -182,7 +182,7 @@
UINT mswin_charset()
{
CHARSETINFO cis;
- if( iflags.IBMgraphics )
+ if( iflags.chargfx == IBM_GRAPHICS )
if( TranslateCharsetInfo((DWORD*)GetOEMCP(), &cis, TCI_SRCCODEPAGE) )
return cis.ciCharset;
else