From 384f98b61f77f3ef0648ee561d63c062ad61c6b0 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 30 Oct 2019 17:37:04 -0700 Subject: [PATCH 1/6] Guidebook tweak This sample comment attending the sample SYMBOLS statement fit ok in the pdf output but wrapped to another line in the plain text output, so shorten it. S_xan, S_pet_override, and S_player_override still wrap, but by a bit less than before. Their width causes the line of dashes at the top of the table to wrap too. Guidebook.tex is still lagging behind. --- doc/Guidebook.mn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 34ad975e0..55bfcd5e2 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.317 $ $NHDT-Date: 1572448817 2019/10/30 15:20:17 $ +.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.318 $ $NHDT-Date: 1572482202 2019/10/31 00:36:42 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -2749,7 +2749,7 @@ See the \(lqModifying NetHack Symbols\(rq section. .lp "" Example: .sd -\f(CR# replace small punctuation (tick marks) with easier to see digits\fP +\f(CR# replace small punctuation (tick marks) with digits\fP \f(CRSYMBOLS=S_boulder:0,S_golem:7\fP .ed .lp WIZKIT @@ -4579,8 +4579,8 @@ X S_xorn (xorn) Y S_yeti (apelike creature) Z S_zombie (zombie) z S_zruty (zruty) - S_pet_override (pet override if sysconf accessibility is set) - S_player_override (player override if sysconf accessibility is set) +\ S_pet_override (any pet if sysconf accessibility is set) +\ S_player_override (hero if sysconf accessibility is set) .\"TABLE_END Do not delete this line. .TE .pg @@ -4663,7 +4663,7 @@ of moving 8 units at a time. .lp nostatus_updates Prevent updates to the status lines at the bottom of the screen, if your screen-reader reads those lines. The same information can be -seen via the #attributes command. +seen via the \(lq#attributes\(rq command. .hn 2 Global Configuration for System Administrators .pg From 86473526b8eb2948744c1965bcc734ed211ce987 Mon Sep 17 00:00:00 2001 From: Bart House Date: Wed, 30 Oct 2019 19:17:03 -0700 Subject: [PATCH 2/6] Save a copy of the symbols file to symbols.save when updating. --- include/ntconf.h | 6 ++++++ src/files.c | 2 +- sys/winnt/windmain.c | 43 +++++++++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/include/ntconf.h b/include/ntconf.h index c38770e17..af84c3ef0 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -80,6 +80,12 @@ * objects being thrown when the hangup occurs. \ */ +#define CONFIG_FILE "defaults.nh" +#define CONFIG_TEMPLATE "defaults.template" +#define SYSCF_TEMPLATE "sysconf.template" +#define SYMBOLS_TEMPLATE "symbols.template" +#define GUIDEBOOK_FILE "Guidebook.txt" + /* Stuff to help the user with some common, yet significant errors */ #define INTERJECT_PANIC 0 #define INTERJECTION_TYPES (INTERJECT_PANIC + 1) diff --git a/src/files.c b/src/files.c index 7228cd7e8..f89e5e061 100644 --- a/src/files.c +++ b/src/files.c @@ -1910,7 +1910,7 @@ const char *default_configfile = "NetHack Defaults"; #else #if defined(MSDOS) || defined(WIN32) - "defaults.nh"; + CONFIG_FILE; #else "NetHack.cnf"; #endif diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index 1e140b0d6..f88fbaa37 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -301,7 +301,8 @@ update_file( const char * dst_folder, const char * dst_name, const char * src_folder, - const char * src_name) + const char * src_name, + BOOL save_copy) { char dst_path[MAX_PATH]; strcpy(dst_path, dst_folder); @@ -311,12 +312,20 @@ update_file( strcpy(src_path, src_folder); strcat(src_path, src_name); + char save_path[MAX_PATH]; + strcpy(save_path, dst_folder); + strcat(save_path, dst_name); + strcat(save_path, ".save"); + if(!file_exists(src_path)) error("Unable to copy file '%s' as it does not exist", src_path); if (!file_newer(src_path, dst_path)) return; + if (file_exists(dst_path) && save_copy) + CopyFileA(dst_path, save_path, FALSE); + BOOL success = CopyFileA(src_path, dst_path, FALSE); if(!success) error("Failed to update '%s' to '%s'", src_path, dst_path); @@ -325,37 +334,39 @@ update_file( void copy_config_content() { /* Keep templates up to date */ - update_file(fqn_prefix[CONFIGPREFIX], "defaults.tmp", - fqn_prefix[DATAPREFIX], "defaults.nh"); - update_file(fqn_prefix[SYSCONFPREFIX], "sysconf.tmp", - fqn_prefix[DATAPREFIX], SYSCF_FILE); + /* TODO: Update the package to store config file as .nethackrc */ + update_file(fqn_prefix[CONFIGPREFIX], CONFIG_TEMPLATE, + fqn_prefix[DATAPREFIX], CONFIG_FILE, FALSE); + update_file(fqn_prefix[SYSCONFPREFIX], SYSCF_TEMPLATE, + fqn_prefix[DATAPREFIX], SYSCF_FILE, FALSE); /* If the required early game file does not exist, copy it */ - copy_file(fqn_prefix[CONFIGPREFIX], "defaults.nh", - fqn_prefix[DATAPREFIX], "defaults.nh"); + /* NOTE: We never replace .nethackrc or sysconf */ + copy_file(fqn_prefix[CONFIGPREFIX], CONFIG_FILE, + fqn_prefix[DATAPREFIX], CONFIG_FILE); copy_file(fqn_prefix[SYSCONFPREFIX], SYSCF_FILE, fqn_prefix[DATAPREFIX], SYSCF_FILE); - /* If a required game file does not exist, copy it */ + /* Update symbols and save a copy if we are replacing */ /* TODO: Can't HACKDIR be changed during option parsing causing us to perhaps be checking options against the wrong symbols file? */ - copy_file(fqn_prefix[HACKPREFIX], SYMBOLS, - fqn_prefix[DATAPREFIX], SYMBOLS); + update_file(fqn_prefix[HACKPREFIX], SYMBOLS, + fqn_prefix[DATAPREFIX], SYMBOLS, TRUE); } void copy_hack_content() { /* Keep Guidebook and opthelp up to date */ - update_file(fqn_prefix[HACKPREFIX], "Guidebook.txt", - fqn_prefix[DATAPREFIX], "Guidebook.txt"); - update_file(fqn_prefix[HACKPREFIX], "opthelp", - fqn_prefix[DATAPREFIX], "opthelp"); + update_file(fqn_prefix[HACKPREFIX], GUIDEBOOK_FILE, + fqn_prefix[DATAPREFIX], GUIDEBOOK_FILE, FALSE); + update_file(fqn_prefix[HACKPREFIX], OPTIONFILE, + fqn_prefix[DATAPREFIX], OPTIONFILE, FALSE); /* Keep templates up to date */ - update_file(fqn_prefix[HACKPREFIX], "symbols.tmp", - fqn_prefix[DATAPREFIX], "symbols"); + update_file(fqn_prefix[HACKPREFIX], SYMBOLS_TEMPLATE, + fqn_prefix[DATAPREFIX], SYMBOLS, FALSE); } From eb825a2da5c2c2f28e01bcbc92d3e756aaf5e750 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 31 Oct 2019 05:31:39 -0700 Subject: [PATCH 3/6] catch Guidebook.tex up with Guidebook.mn Only with the past couple of changes, not a complete reconciliation. Not tested. --- doc/Guidebook.mn | 4 ++- doc/Guidebook.tex | 78 +++++++++++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 55bfcd5e2..a9d828728 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.318 $ $NHDT-Date: 1572482202 2019/10/31 00:36:42 $ +.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.319 $ $NHDT-Date: 1572525093 2019/10/31 12:31:33 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -2683,7 +2683,9 @@ HACKDIR, must be writable. .lp TROUBLEDIR The location that a record of game aborts and self-diagnosed game problems is kept. Defaults to HACKDIR, must be writable. +.\" .\" config file entries beyond this point are shown alphabetically +.\" .lp AUTOCOMPLETE Enable or disable an extended command autocompletion. Autocompletion has no effect for the X11 windowport. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 4b9357e52..92b4d742a 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -2895,9 +2895,13 @@ Section names are case insensitive. %.pg You can use different configuration statements in the file, some -of which can be used multiple times. In general, the statements are +of which can be used multiple times. +In general, the statements are written in capital letters, followed by an equals sign, followed by -settings particular to that statement. Here is a list of allowed statements: +settings particular to that statement. + +%.pg +Here is a list of allowed statements: %.lp \blist{} @@ -2912,7 +2916,7 @@ You can specify multiple OPTIONS statements, and multiple options separated by commas in a single OPTIONS statement. (Comma separated options are processed from right to left.) -%.pg +%.lp "" Example: %.sd \begin{verbatim} @@ -2946,6 +2950,9 @@ HACKDIR, must be writable. \item[\bb{TROUBLEDIR}] The location that a record of game aborts and self-diagnosed game problems is kept. Defaults to HACKDIR, must be writable. +% +% config file entries beyond this point are shown alphabetically +% %.lp \item[\bb{AUTOCOMPLETE}] Enable or disable an extended command autocompletion. @@ -2955,11 +2962,11 @@ autocompletion, list the extended command. Prefix the command with ``{{\tt !}}'' to disable the autocompletion for that command. -%.pg +%.lp "" Example: %.sd \begin{verbatim} - AUTOCOMPLETE=zap,!annotate + AUTOCOMPLETE=zap,!annotate \end{verbatim} %.ed @@ -2974,7 +2981,7 @@ extended commands. You can specify multiple bindings. Format is key followed by the command, separated by a colon. See the ``Changing Key Bindings`` section for more information. -%.pg +%.lp "" Example: %.sd \begin{verbatim} @@ -2987,7 +2994,7 @@ Example: Chooses at random one of the comma-separated parameters as an active section name. Lines in other sections are ignored. -%.pg +%.lp "" Example: %.sd \begin{verbatim} @@ -3000,23 +3007,37 @@ Example: \end{verbatim} %.ed -%.lp -\item[\bb{MSGTYPE}] -Change the way messages are shown in the top status line. -See the ``Configuring Message Types`` section. %.lp \item[\bb{MENUCOLOR}] Highlight menu lines with different colors. See the ``Configuring Menu Colors`` section. %.lp -\item[\bb{SYMBOLS},\bb{ROGUESYMBOLS}] -Override one or more symbols in the symbols files. +\item[\bb{MSGTYPE}] +Change the way messages are shown in the top status line. +See the ``Configuring Message Types`` section. +%.lp +\item[\bb{ROGUESYMBOLS}] +Custom symbols for for the rogue level's symbol set. +See {\it SYMBOLS} below. +%.lp +\item[\bb{SOUND}] +Define a sound mapping. +See the ``Configuring User Sounds'' section. +%.lp +\item[\bb{SOUNDDIR}] +Define the directory that contains the sound files. +See the ``Configuring User Sounds'' section. +%.lp +\item[\bb{SYMBOLS} +Override one or more symbols in the symbol set used for all dungeon +levels except for the special rogue level. See the ``Modifying {\it NetHack\/} Symbols'' section. %.pg Example: %.sd \begin{verbatim} - SYMBOLS=S_boulder:0 + # replace small punctuation (tick marks) with digits + SYMBOLS=S_boulder:0,S_golem:7 \end{verbatim} %.ed @@ -3026,22 +3047,17 @@ Debug mode only: extra items to add to initial inventory. Value is the name of a text file containing a list of item names, one per line, up to a maximum of 128 lines. Each line is processed by the function that handles wishing. -%.pg + +%.lp "" Example: %.sd \begin{verbatim} - WIZKIT=~/wizkit.txt + WIZKIT=~/wizkit.txt \end{verbatim} %.ed -%.lp -\item[\bb{SOUNDDIR}] -Define the directory that contains the sound files. -See the ``Configuring User Sounds'' section. -%.lp -\item[\bb{SOUND}] -Define a sound mapping. See the ``Configuring User Sounds'' section. \elist +%.lp "" %.pg Here is a short example of config file contents: %.sd @@ -4880,11 +4896,13 @@ on the rogue level. \elist You can also override one or more symbols using the {\it SYMBOLS\/} and -{\it ROGUESYMBOLS\/} config file options. Symbols are specified as -{\it name:value\/} pairs. Note that {\it NetHack\/} escape-processes -the {\it value\/} string in conventional C fashion. This means that `\verb+\+' -is a prefix to take the following character literally. Thus `\verb+\+' needs -to be represented as `\verb+\\+'. +{\it ROGUESYMBOLS\/} config file options. +Symbols are specified as {\it name:value\/} pairs. +Note that {\it NetHack\/} escape-processes +the {\it value\/} string in conventional C fashion. +This means that `\verb+\+' is a prefix to take the following character +literally. +Thus `\verb+\+' needs to be represented as `\verb+\\+'. The special prefix `\verb+\m+' switches on the meta bit in the symbol value, and the `{\tt \^{}}' prefix causes the following character to be treated as a control @@ -5071,8 +5089,8 @@ Default & Symbol Name & Description\\ \verb@Y@ & S\verb+_+yeti & (apelike creature)\\ \verb@Z@ & S\verb+_+zombie & (zombie)\\ \verb@z@ & S\verb+_+zruty & (zruty)\\ -\verb@ @ & S\verb+_+pet\verb+_+override & (pet override if sysconf accessibility is set)\\ -\verb@ @ & S\verb+_+player\verb+_+override & (player override if sysconf accessibility is set) +\verb@ @ & S\verb+_+pet\verb+_+override & (any pet if sysconf accessibility is set)\\ +\verb@ @ & S\verb+_+player\verb+_+override & (hero if sysconf accessibility is set) \end{longtable}% } From 7cc59eb9297af5a5bebbdca7a2aff2110d35eddf Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 31 Oct 2019 06:57:16 -0700 Subject: [PATCH 4/6] fix #H9374 - initial rendering of guardian angel Creation of guardian angel bypasses tamedog() and marks it tame directly but it wasn't updating the map after changing the monster. So if 'hilite_pet' was On when entering the Astral Plane level, the angel appeared to be ordinary monster rather than a tame one until it moved or the screen was redrawn. Also, the message about it appearing was issued before marking it tame, so a tiny bit of code reordering has been done to get the sequence correct. --- doc/fixes36.3 | 4 +++- src/minion.c | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 5940e16aa..c95a46c4c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ $NHDT-Date: 1572141706 2019/10/27 02:01:46 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.151 $ $NHDT-Date: 1572530225 2019/10/31 13:57:05 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -208,6 +208,8 @@ parsing for the argument to 'scores' option was sloppy; "3a/o" (slash) and "3a 1o" (space and digit one, not lowercase L) both worked but "3a o" (just space) was supposed to but didn't wizmakemap could leave genocided monsters on map +when entering Astral level, initial rendering of guardian angel didn't show + it as tame; noticeable if the level was entered with 'hilite_pet' On Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/minion.c b/src/minion.c index 85acbe51c..e752ddbce 100644 --- a/src/minion.c +++ b/src/minion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 minion.c $NHDT-Date: 1561061319 2019/06/20 20:08:39 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.42 $ */ +/* NetHack 3.6 minion.c $NHDT-Date: 1572530226 2019/10/31 13:57:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.43 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -481,15 +481,18 @@ gain_guardian_angel() && (mtmp = mk_roamer(&mons[PM_ANGEL], u.ualign.type, mm.x, mm.y, TRUE)) != 0) { mtmp->mstrategy &= ~STRAT_APPEARMSG; + /* guardian angel -- the one case mtame doesn't imply an + * edog structure, so we don't want to call tamedog(). + * [Note: this predates mon->mextra which allows a monster + * to have both emin and edog at the same time.] + */ + mtmp->mtame = 10; + /* for 'hilite_pet'; after making tame, before next message */ + newsym(mtmp->mx, mtmp->my); if (!Blind) pline("An angel appears near you."); else You_feel("the presence of a friendly angel near you."); - /* guardian angel -- the one case mtame doesn't - * imply an edog structure, so we don't want to - * call tamedog(). - */ - mtmp->mtame = 10; /* make him strong enough vs. endgame foes */ mtmp->m_lev = rn1(8, 15); mtmp->mhp = mtmp->mhpmax = From b110ee9eaf10876e8a567adb9cd6c57fa1a22e34 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 31 Oct 2019 12:00:59 -0400 Subject: [PATCH 5/6] msdos build fix following recent files.c change --- include/pcconf.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/pcconf.h b/include/pcconf.h index fb210b8ca..e3f764625 100644 --- a/include/pcconf.h +++ b/include/pcconf.h @@ -21,6 +21,11 @@ * Note: 3.6.x was not verified with Symantec C. */ +#if defined(MSDOS) +#define CONFIG_FILE "defaults.nh" +#define GUIDEBOOK_FILE "Guidebook.txt" +#endif + /* * The following options are somewhat configurable depending on * your compiler. From 919765f67f1f45c67f731044d5a1ede81074a26b Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 31 Oct 2019 12:16:03 -0400 Subject: [PATCH 6/6] Windows: link with ole32.lib and shell32.lib --- sys/winnt/Makefile.msc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 492153d1b..ad55dad0e 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -526,7 +526,8 @@ guilflags = $(lflags) -subsystem:windows,$(EXEVER) dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll # basic subsystem specific libraries, less the C Run-Time -baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib +baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib \ + ole32.lib Shell32.lib winlibs = $(baselibs) user32.lib comdlg32.lib winspool.lib # for Windows applications that use the C Run-Time libraries