diff --git a/doc/.gitattributes b/doc/.gitattributes index 91b0cde0c..add1a82f7 100644 --- a/doc/.gitattributes +++ b/doc/.gitattributes @@ -5,6 +5,7 @@ window.doc NHSUBST config.nh NHSUBST Guidebook.txt NH_header=no tmac.n NH_header=no +tmac.nh NUSUBST fixes* NH_header=no *.txt NH_header=no * NH_filestag=(file%s_for_all_versions) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 460433aa3..6b40f0ec5 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.284 $ $NHDT-Date: 1539898655 2018/10/18 21:37:35 $ +.\" $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.286 $ $NHDT-Date: 1540625949 2018/10/27 07:39:09 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -15,6 +15,9 @@ .\"| ter each sentence. .\"||| .\" +. +.so tmac.nh \" extra macros which aren't in tmac.n +. .ds h0 "NetHack Guidebook .ds h1 .ds h2 % @@ -23,67 +26,6 @@ .ds f1 .ds f2 "October 16, 2018 . -.\" labeled paragraph start (should be part of tmac.n, but I don't want to -.\" make changes to that file) -.\" .PS word -.\" set the width for the label column -.\" .PL word -.\" label for the entry -.\" .PE -.\" clean up -.de PS -.nr PY \\w'\\$1\ -\ 'u \" width of label plus " - " -.nr PX \\w'\ -\ 'u \" width of " - " -.sn \\n(pdu \" tmac.n: inter-paragraph space -.in +\\n(PYu \" additional indent past label (etc) -.si \" tmac.n: start indented section -.. -.\" labeled paragraph label (and first line) -.de PL -.br -\\h'|-\\n(PYu'\\$1\\h'|-\\n(PXu'\ -\ \\c \" back up, output the label, then -. \" skip to width-of(" - ") before the -. \" normal indentation, output the " - " -. \" then attach the next line (the -. \" text) without stopping (\c: nroff -. \" section 4.2) -.. -.\"labeled paragraph end -.de PE -.ei \" tmac.n: end indented section -.in -\\n(PYu \" undo indent past label (etc) -.sn \\n(pdu \" tmac.n: inter-paragraph space -.. -.\" end of labeled paragraph -.\" -.\" aligned single character key with SHORT definition (if it overflows one -.\" line, all bets are off) -.\" Usage: -.\" .CC k "definition here" -.nr CZ \w'\fBW' \" width of the key character column -.nr CW \n(CZ/2 \" half the width of the key character column -.de CC -.nr CX \\w'\\fB\\$1'u/2 \" half the width of the key character -.nr CY \\n(CWu-\\n(CXu \" difference between the two half widths -.\" output: move right CR units, print the key letter, move right to -.\" the full width of the column, print " - " and the definition -\\h'|\\n(CYu'\\fB\\$1\\fP\\h'|\\n(CZu'\ -\ \\$2 -.. -.\" '.UX' is verbatim copy of tmac.n's '.ux' with the exception that -.\" the trademark owner for "UNIX" has been updated. (tmac.n contains -.\" a comment asking that modified versions not be distributed, so we -.\" are using this substitute instead of modifying that file.) -.de UX \" print "UNIX" -.ie \\n(ux \\&\\$2\\s-1UNIX\\s0\\$1 -.el \{\ -. nr ux +1 \" mark footnote as dropped -\\&\\$2\\s-1UNIX\\s0\\*(rg\\$1 -. fn \" put out the footnote -\\&\\*(rgUNIX is a registered trademark of The Open Group. -. ef \" short and sweet ... -.\} -.. -. .\" A note on some special characters: .\" \(lq = left double quote .\" \(rq = right double quote \(dq = double quote character @@ -285,8 +227,7 @@ replaces the \(lqYou see ...\(rq descriptions of text adventure games. Figure 1 is a sample of what a NetHack screen might look like. The way the screen looks for you depends on your platform. . -.br \" break - advance to next line -\ \" space to force non-empty line before table +.BR 2 .ft CR \" set font to constant-width Roman .TS S center box tab(~); @@ -2479,7 +2420,8 @@ Very large humanoids (giants and their ilk) have been known to use boulders as weapons. .pg For some configurations of the program, statues are no longer shown as -\(oq\`\(cq but by the letter representing the monster they depict instead. +\(oq\f(CR\`\fP\(cq but by the letter representing the monster they depict +instead. .hn 2 Gold (\(oq$\(cq) .pg @@ -2816,6 +2758,7 @@ OPTIONS=lit_corridor OPTIONS=!splash_screen .ft \" revert to previous font .ed +.BR 2 .hn 2 Using the NETHACKOPTIONS environment variable .pg @@ -2823,32 +2766,46 @@ The NETHACKOPTIONS variable is a comma-separated list of initial values for the various options. Some can only be turned on or off. You turn one of these on by adding the name of the option to the list, -and turn it off by typing a \(oq!\(cq or \(lqno\(rq before the name. +and turn it off by typing a \(oq\f(CR!\fP\(cq or \(lq\f(CRno\fP\(rq +before the name. Others take a character string as a value. You can set string options by typing the option name, a colon or equals sign, and then the value of the string. The value is terminated by the next comma or the end of string. .pg -For example, to set up an environment variable so that \(lqcolor\(rq -is on, \(lqautopickup\(rq is off, the name is set to \(lqBlue Meanie\(rq, -and the fruit is set to \(lqpapaya\(rq, you would enter the command -.sd -% \f(CRsetenv NETHACKOPTIONS "color,\e!autopickup,name:Blue Meanie,fruit:papaya"\fP -.ed +For example, to set up an environment variable so that +\fIcolor\fP is \f(CRon\fP, +\fIlegacy\fP is \f(CRoff\fP, +character \fIname\fP is set to \(lq\f(CRBlue Meanie\fP\(rq, +and named \fIfruit\fP is set to \(lq\f(CRlime\fP\(rq, +you would enter the command +.\" Guidebook.ps looks better with the normal indentation for .sd (.SD i) +.\" but the 'setenv' example is too wide for Guidebook.txt unless the +.\" indentation is suppressed (.SD n). Even though the second example +.\" can be indented, it should match the first or they'll both look odd. +.\" groff has a built-in register allowing recognition of '-T', but we +.\" can't rely on that. Assume Guidebook.ps uses a proportional font +.\" and Guidebook.txt a fixed-width one and test which sort we're using. +.ds sD i \" assume proportional, indentation acceptable and preferred +.\" Check for fixed-width font; 'f' will be same width as 'F'. +.if (\w'f'p)=(\w'F'p) .ds sD n \" if same width, suppress indentation +.SD \*(sD +\f(CR% setenv NETHACKOPTIONS "color,\\!leg,name:Blue Meanie,fruit:lime"\fP +.ED in \fIcsh\fP (note the need to escape the \(oq!\(cq since it's special -to the shell), or -.sd -$ \f(CRNETHACKOPTIONS="color,!autopickup,name:Blue Meanie,fruit:papaya"\fP -$ \f(CRexport NETHACKOPTIONS\fP -.ed +to that shell), or the pair of commands +.SD \*(sD +\f(CR$ NETHACKOPTIONS="color,!leg,name:Blue Meanie,fruit:lime"\fP +\f(CR$ export NETHACKOPTIONS\fP +.ED in \fIsh\fP, \fIksh\fP, or \fIbash\fP. .pg Instead of a comma-separated list of options, NETHACKOPTIONS can be set to the full name of a configuration file you want to use. -If that full name doesn't start with a slash, precede it with \(oq@\(cq +If that full name doesn't start with a slash, precede it with \(oq\f(CR@\fP\(cq (at-sign) to let NetHack know that the rest is intended as a file name. -If it does start with \(oq/\(cq, the at-sign is optional. +If it does start with \(oq\f(CR/\fP\(cq, the at-sign is optional. .hn 2 Customization options .pg diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index c9c492165..e2f534dfc 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -283,6 +283,7 @@ understand what {\it NetHack\/} is doing with the screen. The {\it NetHack\/} screen replaces the ``You see \ldots'' descriptions of text adventure games. Figure 1 is a sample of what a {\it NetHack\/} screen might look like. The way the screen looks for you depends on your platform. +%.BR 2 \vbox{ \begin{verbatim} @@ -297,8 +298,8 @@ The way the screen looks for you depends on your platform. - Player the Rambler St:12 Dx:7 Co:18 In:11 Wi:9 Ch:15 Neutral - Dlvl:1 $:0 HP:9(12) Pw:3(3) AC:10 Exp:1/19 T:257 Weak + Player the Rambler St:12 Dx:7 Co:18 In:11 Wi:9 Ch:15 Neutral + Dlvl:1 $:0 HP:9(12) Pw:3(3) AC:10 Exp:1/19 T:257 Weak \end{verbatim} \begin{center} Figure 1 @@ -1620,7 +1621,7 @@ bit), you can invoke many extended commands by meta-ing the first letter of the command. In {\it NT, OS/2, PC\/ {\rm and} ST NetHack}, the `Alt' key can be used in this fashion; -on the {\it Amiga\/}, set the {\it altmeta\/} option to get this behavior. +on the {\it Amiga}, set the {\it altmeta\/} option to get this behavior. On other systems, if typing `Alt' plus another key transmits a two character sequence consisting of an {\tt Escape} followed by the other key, you may set the {\it altmeta\/} @@ -2040,7 +2041,7 @@ location ordinarily wouldn't be seen any more. %.pg When you find something in the dungeon, it is common to want to pick -it up. In {\it NetHack\/}, this is accomplished automatically by walking over +it up. In {\it NetHack}, this is accomplished automatically by walking over the object (unless you turn off the {\it autopickup\/} option (see below), or move with the `{\tt m}' prefix (see above)), or manually by using the `{\tt ,}' command. @@ -2791,7 +2792,7 @@ fire, and kick weapons; use a wand, spell, or other type of item; or fight with your hands and feet. %.pg -In {\it NetHack\/}, a pacifist refuses to cause the death of any other monster +In {\it NetHack}, a pacifist refuses to cause the death of any other monster (i.e. if you would get experience for the death). This is a particularly difficult challenge, although it is still possible to gain experience by other means. @@ -3032,6 +3033,7 @@ Here is a short example of config file contents: OPTIONS=!splash_screen \end{verbatim} %.ed +%.BR 2 %.hn 2 \subsection*{Using the NETHACKOPTIONS environment variable} @@ -3047,25 +3049,29 @@ the option name, a colon or equals sign, and then the value of the string. The value is terminated by the next comma or the end of string. %.pg -For example, to set up an environment variable so that {\it color\/} -is on, {\it autopickup\/} is off, the {\it name\/} is set to ``Blue Meanie'', -and the {\it fruit\/} is set to ``papaya'', you would enter the command -%.sd +For example, to set up an environment variable so that +{\it color\/} is {\tt on}, +{\it legacy\/} is {\tt off}, +character {\it name\/} is set to ``{\tt Blue Meanie}'', +and named {\it fruit\/} is set to ``{\tt lime}'', +you would enter the command +%.SD i \begin{verbatim} - setenv NETHACKOPTIONS "color,\!autopickup,name:Blue Meanie,fruit:papaya" + setenv NETHACKOPTIONS "color,\!leg,name:Blue Meanie,fruit:lime" \end{verbatim} -%.ed +%.ED \nd in {\it csh} -(note the need to escape the `!' since it's special to the shell), or -%.sd +(note the need to escape the `!' since it's special +to that shell), or the pair of commands +%.SD i \begin{verbatim} - NETHACKOPTIONS="color,!autopickup,name:Blue Meanie,fruit:papaya" + NETHACKOPTIONS="color,!leg,name:Blue Meanie,fruit:lime" export NETHACKOPTIONS \end{verbatim} -%.ed +%.ED -\nd in {\it sh\/}, {\it ksh}, or {\it bash}. +\nd in {\it sh}, {\it ksh}, or {\it bash}. %.pg Instead of a comma-separated list of options, @@ -4593,7 +4599,7 @@ percentage or absolute number threshold, or text to match against. ``{\tt always}'' will set the default attributes for that field. %.lp "*" \item{\bb{}} -``{\tt up}'' and ``(\tt down}'' set the field attributes for when the field +``{\tt up}'' and ``{\tt down}'' set the field attributes for when the field value changes upwards or downwards. This attribute times out after {\tt statushilites} turns. %.lp "*" diff --git a/doc/Guidebook.txt b/doc/Guidebook.txt index 2b44d9beb..4f96aae71 100644 --- a/doc/Guidebook.txt +++ b/doc/Guidebook.txt @@ -3154,11 +3154,11 @@ equals sign, and then the value of the string. The value is ter- minated by the next comma or the end of string. - For example, to set up an environment variable so that "col- - or" is on, "autopickup" is off, the name is set to "Blue Meanie", - and the fruit is set to "papaya", you would enter the command + For example, to set up an environment variable so that color + is on, legacy is off, character name is set to "Blue Meanie", and + named fruit is set to "lime", you would enter the command - % setenv NETHACKOPTIONS "color,\!autopickup,name:Blue Meanie,fruit:papaya" + % setenv NETHACKOPTIONS "color,\!leg,name:Blue Meanie,fruit:lime" @@ -3172,11 +3172,11 @@ - in csh (note the need to escape the `!' since it's special to the - shell), or + in csh (note the need to escape the `!' since it's special to + that shell), or the pair of commands - $ NETHACKOPTIONS="color,!autopickup,name:Blue Meanie,fruit:papaya" - $ export NETHACKOPTIONS + $ NETHACKOPTIONS="color,!leg,name:Blue Meanie,fruit:lime" + $ export NETHACKOPTIONS in sh, ksh, or bash. diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 5b5f058ce..f8e4c8b11 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -172,6 +172,10 @@ in Guidebook.mn and Guidebook.txt, the 'I' command mis-described `IX' as displaying inventory items whose bless/curse state is "known" (Guidebook.tex correctly had "unknown") poison gas (stinking cloud) wasn't shown at drawbridge-up spot +prayer result which enhanced strength (fix weakness from hunger) didn't give + a message if a change in encumbrance occurred; it came on next move +add current location within the dungeon to the Background section of ^X and + final disclosure (it's not background but doesn't fit anywhere else) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository @@ -184,6 +188,7 @@ orctown: prevent Bad fruit #0 and some minor tuning make long extended commands list be more navigable simplify #wizidentify; don't rely on having bold menu entries ensure tmp_at() structures are initialized for all code paths when swallowed +trapped-vs-levitation/flying change broke Sting releasing hero from web tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes tty: ensure that current status fields are always copied to prior status diff --git a/doc/tmac.nh b/doc/tmac.nh new file mode 100644 index 000000000..6914d018a --- /dev/null +++ b/doc/tmac.nh @@ -0,0 +1,127 @@ +.\" NetHack 3.6 tmac.nh $NHDT-Date: $ $NHDT-Branch: $:$NHDT-Revision: $ +. +.\" Miscellaneous tmac.n-style macros specifically for nethack's Guidebook. +.\" +.\" Most are modelled after, or variations of, macros in tmac.n whose author +.\" has specified that that file remain unmodified if it gets distributed. +.\" These used to be inline within Guidebook.mn but it was becoming too +.\" cluttered as their number increased. It now uses the '.so' directive +.\" to include this file. (tmac.n is passed to 'roff on the command line.) +. +.\" labeled paragraph start +.\" .PS word +.\" set the width for the label column +.\" .PL word +.\" label for the entry +.\" .PE +.\" clean up +.de PS +.nr PY \\w'\\$1\ -\ 'u \" width of label plus " - " +.nr PX \\w'\ -\ 'u \" width of " - " +.sn \\n(pdu \" tmac.n: inter-paragraph space +.in +\\n(PYu \" additional indent past label (etc) +.si \" tmac.n: start indented section +.. +.\" labeled paragraph label (and first line) +.de PL +.br +\\h'|-\\n(PYu'\\$1\\h'|-\\n(PXu'\ -\ \\c \" back up, output the label, then +. \" skip to width-of(" - ") before the +. \" normal indentation, output the " - " +. \" then attach the next line (the +. \" text) without stopping (\c: nroff +. \" section 4.2) +.. +.\" labeled paragraph end +.de PE +.ei \" tmac.n: end indented section +.in -\\n(PYu \" undo indent past label (etc) +.sn \\n(pdu \" tmac.n: inter-paragraph space +.. +.\" end of labeled paragraph +. +.\" +.\" aligned single character key with SHORT definition (if it overflows one +.\" line, all bets are off) +.\" Usage: +.\" .CC k "definition here" +.nr CZ \w'\fBW' \" width of the key character column +.nr CW \n(CZ/2 \" half the width of the key character column +.de CC +.nr CX \\w'\\fB\\$1'u/2 \" half the width of the key character +.nr CY \\n(CWu-\\n(CXu \" difference between the two half widths +.\" output: move right CR units, print the key letter, move right to +.\" the full width of the column, print " - " and the definition +\\h'|\\n(CYu'\\fB\\$1\\fP\\h'|\\n(CZu'\ -\ \\$2 +.. +. +.\" .SD = .sd with extra choices for argument; pair with .ED +.\" c - centered (original choice; as of this writing, not used by nethack) +.\" i - indented (default if choice is omitted) +.\" n - not indented +.\" SF - set (1=>indent, 0=>no-indent) by .SD, used by .ED unless centering +.de SD \" start display +. \" look for nested displays -- ILLEGAL +.ie \\n(id>0 .er "display within display" +.el \{\ +. nr sf 0 \" don't center by default +. nr SF 1 \" assume indent +. ie '\\$1'c' .nr sf 1 \" center the sucker +. el .if '\\$1'n' .nr SF 0 \" don't indent if 'n' +.\} +.sn \\n(pdu \" a little bit of space +.ev 2 \" switch to display environment +.nf \" what you type is what you get +.if \\n(id=0 .di dd \" start saving text +.rs \" don't eat leading space +.nr id +1 \" increment level of display +.. +.\" .ED = .ed with support for \n(SF (indent vs no-indent); pair with .SD +.de ED \" end display +.br \" flush line +.ie \\n(id<=0 .er "end display has no corresponding begin display" +.el \{\ +. nr id -1 \" decrement level of display +. if \\n(id=0 \{\ +. di \" end diversion +. fi \" resume filling +. in -\\n(piu \" dedent +. ev \" pop environment +. ne \\n(dnu \" be sure you have room +. nf \" don't reprocess display +. rs \" don't eat leading space +. zi \" save indents +. ie \\n(sf .in (\\n(llu-\\n(dlu)/2u \" center +. el .if \\n(SF .in +\\n(piu \" indent +. dd \" drop display +. yi \" restore indents +. \} +.\} +.fi \" resume filling +.sn \\n(pdu \" a little bit of space +.. +. +.\" '.UX' is verbatim copy of tmac.n's '.ux' with the exception that +.\" the trademark owner for "UNIX" has been updated. +.de UX \" print "UNIX" +.ie \\n(ux \\&\\$2\\s-1UNIX\\s0\\$1 +.el \{\ +. nr ux +1 \" mark footnote as dropped +\\&\\$2\\s-1UNIX\\s0\\*(rg\\$1 +. fn \" put out the footnote +\\&\\*(rgUNIX is a registered trademark of The Open Group. +. ef \" short and sweet ... +.\} +.. +. +.\" .BR - hard line break with vertical padding inserted +.\" $1 - repeat count for amount of padding (optional; default is 1) +.de BR +.nr bR (\\$1-0) +.if \\n(bR<1 .nr bR 1 +.nr bR \\n(bR*\\n(pd +.sn \\n(bRu +.br +.. +. +.\"tmac.nh/" diff --git a/include/extern.h b/include/extern.h index cad3170ec..2f2fe7f51 100644 --- a/include/extern.h +++ b/include/extern.h @@ -628,6 +628,7 @@ E void FDECL(room_discovered, (int)); E void FDECL(recbranch_mapseen, (d_level *, d_level *)); E void FDECL(overview_stats, (winid, const char *, long *, long *)); E void FDECL(remdun_mapseen, (int)); +E const char *FDECL(endgamelevelname, (char *, int)); /* ### eat.c ### */ @@ -2420,6 +2421,7 @@ E void NDECL(timer_sanity_check); /* ### topten.c ### */ E void FDECL(formatkiller, (char *, unsigned, int, BOOLEAN_P)); +E int FDECL(observable_depth, (d_level *)); E void FDECL(topten, (int, time_t)); E void FDECL(prscore, (int, char **)); E struct toptenentry *NDECL(get_rnd_toptenentry); diff --git a/include/winX.h b/include/winX.h index b5fcfd34e..1a061fa14 100644 --- a/include/winX.h +++ b/include/winX.h @@ -202,6 +202,7 @@ struct xwindow { XColor nh_colors[CLR_MAX]; XFontStruct *boldfs; /* Bold font */ Display *boldfs_dpy; /* Bold font display */ + char *title; union { struct map_info_t *Map_info; /* map window info */ diff --git a/src/cmd.c b/src/cmd.c index 34d3ee19a..f88247ec7 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1833,6 +1833,41 @@ int final; difalgn ? align_str(u.ualignbase[A_ORIGINAL]) : ""); putstr(en_win, 0, buf); } + + /* 3.6.2: dungeon level, so that ^X really has all status info as + claimed by the comment below; this reveals more information than + the basic status display, but that's one of the purposes of ^X; + similar information is revealed by #overview; the "You died in + " given by really_done() is more rudimentary than this */ + *buf = *tmpbuf = '\0'; + if (In_endgame(&u.uz)) { + int egdepth = observable_depth(&u.uz); + + (void) endgamelevelname(tmpbuf, egdepth); + Sprintf(buf, "in the endgame, on the %s%s", + !strncmp(tmpbuf, "Plane", 5) ? "Elemental " : "", tmpbuf); + } else if (Is_knox(&u.uz)) { + /* this gives away the fact that the knox branch is only 1 level */ + Sprintf(buf, "on the %s level", dungeons[u.uz.dnum].dname); + /* TODO? maybe phrase it differently when actually inside the fort, + if we're able to determine that (not trivial) */ + } else { + char dgnbuf[QBUFSZ]; + + Strcpy(dgnbuf, dungeons[u.uz.dnum].dname); + if (!strncmpi(dgnbuf, "The ", 4)) + *dgnbuf = lowc(*dgnbuf); + Sprintf(tmpbuf, "level %d", + In_quest(&u.uz) ? dunlev(&u.uz) : depth(&u.uz)); + /* TODO? maybe extend this bit to include various other automatic + annotations from the dungeon overview code */ + if (Is_rogue_level(&u.uz)) + Strcat(tmpbuf, ", a primitive area"); + else if (Is_bigroom(&u.uz) && !Blind) + Strcat(tmpbuf, ", a very big room"); + Sprintf(buf, "in %s, on %s", dgnbuf, tmpbuf); + } + you_are(buf, ""); } /* characteristics: expanded version of bottom line strength, dexterity, &c; diff --git a/src/dungeon.c b/src/dungeon.c index 8dbccd974..335ca15da 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -71,7 +71,6 @@ STATIC_DCL void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid, int, int, int *)); STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *)); STATIC_DCL const char *FDECL(br_string2, (branch *)); -STATIC_DCL const char *FDECL(endgamelevelname, (char *, int)); STATIC_DCL const char *FDECL(shop_string, (int)); STATIC_DCL char *FDECL(tunesuffix, (mapseen *, char *)); @@ -2775,7 +2774,7 @@ branch *br; } /* get the name of an endgame level; topten.c does something similar */ -STATIC_OVL const char * +const char * endgamelevelname(outbuf, indx) char *outbuf; int indx; diff --git a/src/eat.c b/src/eat.c index 3e74d435f..40c7a4399 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 eat.c $NHDT-Date: 1502754159 2017/08/14 23:42:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.179 $ */ +/* NetHack 3.6 eat.c $NHDT-Date: 1540596900 2018/10/26 23:35:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.193 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -110,14 +110,18 @@ register struct obj *obj; return (boolean) (obj->oclass == FOOD_CLASS); } +/* used for hero init, life saving (if choking), and prayer results of fix + starving, fix weak from hunger, or golden glow boon (if u.uhunger < 900) */ void init_uhunger() { context.botl = (u.uhs != NOT_HUNGRY || ATEMP(A_STR) < 0); u.uhunger = 900; u.uhs = NOT_HUNGRY; - if (ATEMP(A_STR) < 0) + if (ATEMP(A_STR) < 0) { ATEMP(A_STR) = 0; + (void) encumber_msg(); + } } /* tin types [SPINACH_TIN = -1, overrides corpsenm, nut==600] */ diff --git a/src/hack.c b/src/hack.c index 29261a968..0593bd683 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1518861490 2018/02/17 09:58:10 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.182 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1540591769 2018/10/26 22:09:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.194 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1213,8 +1213,10 @@ struct trap *desttrap; /* nonnull if another trap at */ break; case TT_WEB: if (uwep && uwep->oartifact == ART_STING) { + /* escape trap but don't move and don't destroy it */ + u.utrap = 0; /* caller will call reset_utrap() */ pline("Sting cuts through the web!"); - break; /* escape trap but don't move */ + break; } if (--u.utrap) { if (flags.verbose) { diff --git a/src/pray.c b/src/pray.c index 015f9633b..7ad09455a 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1539804904 2018/10/17 19:35:04 $ $NHDT-Branch: keni-makedefsm $:$NHDT-Revision: 1.103 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1540596912 2018/10/26 23:35:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.104 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1074,7 +1074,11 @@ aligntyp g_align; u.uhp = u.uhpmax; if (Upolyd) u.mh = u.mhmax; - ABASE(A_STR) = AMAX(A_STR); + if (ABASE(A_STR) < AMAX(A_STR)) { + ABASE(A_STR) = AMAX(A_STR); + context.botl = 1; /* before potential message */ + (void) encumber_msg(); + } if (u.uhunger < 900) init_uhunger(); /* luck couldn't have been negative at start of prayer because diff --git a/src/topten.c b/src/topten.c index 4652d42b2..6a226df3f 100644 --- a/src/topten.c +++ b/src/topten.c @@ -62,7 +62,6 @@ struct toptenentry { STATIC_DCL void FDECL(topten_print, (const char *)); STATIC_DCL void FDECL(topten_print_bold, (const char *)); -STATIC_DCL xchar FDECL(observable_depth, (d_level *)); STATIC_DCL void NDECL(outheader); STATIC_DCL void FDECL(outentry, (int, struct toptenentry *, BOOLEAN_P)); STATIC_DCL void FDECL(discardexcess, (FILE *)); @@ -178,7 +177,7 @@ const char *x; putstr(toptenwin, ATR_BOLD, x); } -STATIC_OVL xchar +int observable_depth(lev) d_level *lev; { diff --git a/sys/unix/Makefile.doc b/sys/unix/Makefile.doc index dd3703b01..1d2f53532 100644 --- a/sys/unix/Makefile.doc +++ b/sys/unix/Makefile.doc @@ -1,5 +1,5 @@ # NetHack Documentation Makefile. -# NetHack 3.6 Makefile.doc $NHDT-Date: 1524689449 2018/04/25 20:50:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ +# NetHack 3.6 Makefile.doc $NHDT-Date: 1540625947 2018/10/27 07:39:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. @@ -45,11 +45,11 @@ NHGREP = $(MAKEDEFS) --grep --input - --output - GUIDE_PREFORMAT = cat Guidebook.mn | $(NHGREP) | tbl tmac.n - # the basic guidebook -Guidebook: Guidebook.mn +Guidebook: Guidebook.mn tmac.n tmac.nh $(GUIDECMD) > Guidebook # Fancier output for those with ditroff, psdit and a PostScript printer. -Guidebook.ps: Guidebook.mn +Guidebook.ps: Guidebook.mn tmac.n tmac.nh $(GUIDE_PREFORMAT) | $(PSCMD) > Guidebook.ps # Guidebook.tex is the same as Guidebook.mn but formatted with LaTeX. @@ -95,7 +95,7 @@ DISTRIB = Guidebook.txt nethack.txt lev_comp.txt dgn_comp.txt recover.txt \ distrib: $(DISTRIB) @echo "Plain text documentation is up to date." -Guidebook.txt : Guidebook.mn tmac.n +Guidebook.txt : Guidebook.mn tmac.n tmac.nh $(GUIDECMD) > Guidebook.txt MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD) nethack.txt : nethack.6 diff --git a/win/X11/winX.c b/win/X11/winX.c index f914521f0..0c1016da9 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -164,8 +164,6 @@ static void FDECL(done_button, (Widget, XtPointer, XtPointer)); static void FDECL(getline_delete, (Widget, XEvent *, String *, Cardinal *)); static void FDECL(abort_button, (Widget, XtPointer, XtPointer)); static void NDECL(release_getline_widgets); -static void FDECL(delete_file, (Widget, XEvent *, String *, Cardinal *)); -static void FDECL(dismiss_file, (Widget, XEvent *, String *, Cardinal *)); static void FDECL(yn_delete, (Widget, XEvent *, String *, Cardinal *)); static void FDECL(yn_key, (Widget, XEvent *, String *, Cardinal *)); static void NDECL(release_yn_widgets); @@ -1077,6 +1075,7 @@ int type; wp->nh_colors_inited = FALSE; wp->boldfs = (XFontStruct *) 0; wp->boldfs_dpy = (Display *) 0; + wp->title = (char *) 0; switch (type) { case NHW_MAP: @@ -1227,6 +1226,11 @@ winid window; wp->boldfs_dpy = (Display *) 0; } + if (wp->title) { + free(wp->title); + wp->title = (char *) 0; + } + switch (wp->type) { case NHW_MAP: destroy_map_window(wp); @@ -1369,8 +1373,6 @@ Widget toplevel = (Widget) 0; /* toplevel widget */ Atom wm_delete_window; /* pop down windows */ static XtActionsRec actions[] = { - { nhStr("dismiss_file"), dismiss_file }, /* file viewing widget */ - { nhStr("delete_file"), delete_file }, /* file delete-window */ { nhStr("dismiss_text"), dismiss_text }, /* text widget button action */ { nhStr("delete_text"), delete_text }, /* text widget delete action */ { nhStr("key_dismiss_text"), key_dismiss_text }, /* text key action */ @@ -1917,46 +1919,6 @@ char *input; } /* Display file ----------------------------------------------------------- */ -static const char display_translations[] = "#override\n\ - q: dismiss_file()\n\ - Escape: dismiss_file()\n\ - : dismiss_file()"; - -/* WM_DELETE_WINDOW callback for file dismissal. */ -/*ARGSUSED*/ -static void -delete_file(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; -{ - nhUse(event); - nhUse(params); - nhUse(num_params); - - nh_XtPopdown(w); - XtDestroyWidget(w); -} - -/* Callback for file dismissal. */ -/*ARGSUSED*/ -static void -dismiss_file(w, event, params, num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; -{ - Widget popup = XtParent(w); - - nhUse(event); - nhUse(params); - nhUse(num_params); - - nh_XtPopdown(popup); - XtDestroyWidget(popup); -} void X11_display_file(str, complain) @@ -1964,17 +1926,8 @@ const char *str; boolean complain; { dlb *fp; - Arg args[12]; - Cardinal num_args; - Widget popup, dispfile; - Position top_margin, bottom_margin, left_margin, right_margin; - XFontStruct *fs; - int new_width, new_height; #define LLEN 128 char line[LLEN]; - int num_lines; - char *textlines, *bp; - int charcount; /* Use the port-independent file opener to see if the file exists. */ fp = dlb_fopen(str, RDTMODE); @@ -1985,92 +1938,26 @@ boolean complain; return; /* it doesn't exist, ignore */ } - /* - * Count the number of lines and characters in the file. - */ - num_lines = 0; - charcount = 1; + winid newwin = X11_create_nhwindow(NHW_MENU); + struct xwindow *wp = &window_list[newwin]; + anything any = zeroany; + menu_item *menu_list; + + X11_start_menu(newwin); + while (dlb_fgets(line, LLEN, fp)) { - num_lines++; - charcount += strlen(line); + X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE, line, MENU_UNSELECTED); } (void) dlb_fclose(fp); - /* Ignore empty files */ - if (num_lines == 0) - return; + /* show file name as the window title */ + if (str) + wp->title = dupstr(str); - /* If over the max window size, truncate the window size to the max */ - if (num_lines >= DISPLAY_FILE_SIZE) - num_lines = DISPLAY_FILE_SIZE; - - /* - * Re-open the file and read the data into a buffer. Cannot use - * the XawAsciiFile type of widget, because that is not DLB-aware. - */ - textlines = (char *) alloc((unsigned int) charcount); - textlines[0] = '\0'; - - fp = dlb_fopen(str, RDTMODE); - - bp = textlines; - while (dlb_fgets(line, LLEN, fp)) { - Strcpy((bp = eos(bp)), line); - } - - (void) dlb_fclose(fp); - - num_args = 0; - XtSetArg(args[num_args], nhStr(XtNtitle), str); num_args++; - - popup = XtCreatePopupShell("display_file", topLevelShellWidgetClass, - toplevel, args, num_args); - XtOverrideTranslations(popup, - XtParseTranslationTable("WM_PROTOCOLS: delete_file()")); - - num_args = 0; - XtSetArg(args[num_args], nhStr(XtNscrollHorizontal), - XawtextScrollWhenNeeded); num_args++; - XtSetArg(args[num_args], nhStr(XtNscrollVertical), XawtextScrollAlways); - num_args++; - XtSetArg(args[num_args], nhStr(XtNtype), XawAsciiString); num_args++; - XtSetArg(args[num_args], nhStr(XtNstring), textlines); num_args++; - XtSetArg(args[num_args], nhStr(XtNdisplayCaret), False); num_args++; - XtSetArg(args[num_args], nhStr(XtNtranslations), - XtParseTranslationTable(display_translations)); num_args++; - - dispfile = XtCreateManagedWidget("text", /* name */ - asciiTextWidgetClass, popup, /* parent */ - args, num_args); - - /* Get font and border information. */ - num_args = 0; - XtSetArg(args[num_args], nhStr(XtNfont), &fs); num_args++; - XtSetArg(args[num_args], nhStr(XtNtopMargin), &top_margin); num_args++; - XtSetArg(args[num_args], nhStr(XtNbottomMargin), &bottom_margin); - num_args++; - XtSetArg(args[num_args], nhStr(XtNleftMargin), &left_margin); num_args++; - XtSetArg(args[num_args], nhStr(XtNrightMargin), &right_margin); - num_args++; - XtGetValues(dispfile, args, num_args); - - /* - * The data files are currently set up assuming an 80 char wide window - * and a fixed width font. Soo.. - */ - new_height = - num_lines * nhFontHeight(dispfile) + top_margin + bottom_margin; - new_width = 80 * fs->max_bounds.width + left_margin + right_margin; - - /* Set the new width and height. */ - num_args = 0; - XtSetArg(args[num_args], XtNwidth, new_width); num_args++; - XtSetArg(args[num_args], XtNheight, new_height); num_args++; - XtSetValues(dispfile, args, num_args); - - nh_XtPopup(popup, (int) XtGrabNone, (Widget) 0); - free(textlines); + wp->menu_information->permi = FALSE; + (void) X11_select_menu(newwin, PICK_NONE, &menu_list); + X11_destroy_nhwindow(newwin); } /* yn_function ------------------------------------------------------------ */ diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index e10adcab4..05f0bba36 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -819,6 +819,9 @@ menu_item **menu_list; XtSetArg(args[num_args], nhStr(XtNheight), menu_info->permi_h); num_args++; } + if (wp->title) { + XtSetArg(args[num_args], nhStr(XtNtitle), wp->title); num_args++; + } wp->popup = XtCreatePopupShell((window == WIN_INVEN) ? "inventory" : "menu", (how == PICK_NONE)