Commit Graph

3084 Commits

Author SHA1 Message Date
nhmall
99aa1b9bc5 Merge branch 'master' into NetHack-3.7 2019-06-27 23:15:46 -04:00
nhmall
1509aea758 Merge branch 'NetHack-3.6' 2019-06-27 23:15:07 -04:00
PatR
df8eac79b5 curses erase char and kill char
Support user's terminal settings for erase char and for kill char.
Erase char is typically <delete> or <backspace>, both of which are
already explicitly handled so probably no effect there.  Kill char
(generally ^U these days) will be honored unless it is a printable
character (don't know whether there are any troglodytes out there
who still use '@' for that...).  The current handling for ESC works
the same if there is any input to kill, but yields 'cancelled' when
there isn't.

That's for message window getline(), which operates char-by-char.
The popup getline() uses a curses routine to get an entire string
and already honors kill char but treats ESC as input of ^[.
2019-06-27 17:18:07 -07:00
nhmall
fade914218 Merge branch 'master' into NetHack-3.7 2019-06-25 09:42:49 -04:00
nhmall
78805516be Merge branch 'NetHack-3.6' 2019-06-25 09:42:13 -04:00
PatR
4f0b1262c5 curses clipped map 'scrollbars'
The position bars shown by curses when the map is clipped weren't
being drawn as intended (integer arithmetic).  Changing parentheses
was enough to get it working, but it didn't handle the edge case
where non-zero got rounded to 0 (so when map was panned down, the
uppermost character of the vertical position bar still showed '*',
falsely indicating that top of map was currently within view.
2019-06-25 03:17:47 -07:00
PatR
3bd46a3536 curses cursor
Followup to 1c03d0970115c776d1c4791fea3c33f70b0b5378; that had been
too easy.  When map was clipped and panned to the side, the highlight
for hero's spot was shown next to the '@' instead of on it.
2019-06-25 02:30:27 -07:00
nhmall
eec5d0390f Merge branch 'master' into NetHack-3.7 2019-06-24 23:54:49 -04:00
nhmall
51c232b8f8 Merge branch 'NetHack-3.6' 2019-06-24 23:53:08 -04:00
PatR
6506f769a6 fix #H7840 - curses ':' menu search+toggle
Using ':' to have search string matching toggle items chosen for
selection would show selection highlighting on the current page for
items matched off-page.
2019-06-24 19:28:50 -07:00
PatR
8a9c06f5c1 'sortpack' vs 'perm_invent'
The persistent inventory window wasn't being updated if you toggled
the 'sortpack' option interactively.  (The new setting was honored
once something else triggered a 'perm_invent' update.)

The logic for toggling 'fixinv' seemed backwards.  I hope this "fix"
for that hasn't actually broken it.
2019-06-24 18:54:38 -07:00
PatR
e3af33c9db curses 'perm_invent' fixes
I noticed the wrapping issue while testing out the 'bad fruit' fix,
then the other things while fixing it.

1) inventory entries too wide for narrow persistent inventory window
   wrapped without any control; normally can't be seen except for the
   last entry when the list is short enough to leave at least one line
   available; it looked fairly reasonable with window borders Off, but
   when On the last char of the first line and first char of second
   line were clobbered by the border box;
2) when there were too many entries to fit within the height, those
   after the last one which fit were appended to it for borders Off
   (or written on bottom line and then overwritten by the border box
   for borders On); noticed because the selector letter is highlighted
   with inverse video, even when written at an unexpected place;
3) suppress the inverse video hightlighting of inventory letters since
   they can't be selected from that 'menu';
4) for borders Off, the top line was left blank as if a border was
   going to be drawn there;
5) since the entries are truncated due to the narrow window (on a
   modest sized display), strip off leading "a", "an", or "the" prefix
   for inventory entries (written to curses perm_invent window only);
   lets a couple more characters of more interesting stuff be seen.
2019-06-24 18:39:24 -07:00
nhmall
e34c7daf02 Merge branch 'master' into NetHack-3.7 2019-06-24 19:47:22 -04:00
nhmall
47c5a14ff4 Merge branch 'NetHack-3.6' 2019-06-24 19:38:02 -04:00
PatR
cfc8599e69 fix "Bad fruit #N" warnings when saving bones
savebones() sets all the fruit indices negative, then resets to the
normal positive value for each fruit it actually writes into the bones
file.  But if 'perm_invent' is enabled and something triggers an
update_inventory() while bones saving is in progress, object formatting
for the inventory display won't be able to find any fruits, resulting
in impossible "Bad fruit #N".  Fix is to turn off 'perm_invent' when
the game ends, so it won't be On when bones are written.  Disclosure
uses a popup for inventory so persistent window is obsolete by then
anyway.

[I don't know what is triggering update_inventory() while savebones()
is executing.  Also, I don't see where the fruits whose index stayed
negative--because there aren't any on level being saved--get purged.
Maybe when those bones are loaded by another game?]
2019-06-24 15:11:51 -07:00
nhmall
69c01fb3ec Merge branch 'master' into NetHack-3.7 2019-06-23 21:12:08 -04:00
nhmall
df35f7282a Merge branch 'NetHack-3.6' 2019-06-23 21:11:28 -04:00
PatR
83410a3d4f \#wizidentify bug - 'Not carrying anything.'
when carrying things.  The fuzzer toggled on 'perm_invent' and after
interrupting it I used ^I.  Having 'perm_invent' enabled makes the
inventory code avoid having a totally empty inventory display (by
supplying "Not carrying anything" instead--in the menu rather than
via normal pline) so that interface code will see a change and know
that an update is needed.  But to decide whether the menu was empty,
the inventory code was testing union 'any' field 'a_char' to check
whether some item had used the union (implying that something had
been passed to add_menu()), but wizidentify (^I) uses field 'a_obj'
instead.  Apparently the a_char bits stayed 0 because the menu ended
up with "Not carrying anything" after a list of inventory items.
Switch to a separate variable to track whether anything has been put
into the menu instead of trying to rely on the union.

Unrelated but noticed when checking other "Not carrying anything"
instances, the #adjust command ends early when there's no inventory
but it was asking for a letter to adjust even when the only thing in
inventory was gold in '$' slot, which isn't allowed to be adjusted
away from that slot.  Treat gold-only like no-invent.
2019-06-23 11:31:21 -07:00
nhmall
7054e06e42 NetHack minor release checklist items - savefiles
Make some progress on a couple of next minor release checklist
items, hopefully without introducing too many new bugs. This
is just the initial commit, and work continues.

Checklist items:

Savefiles compatible between Windows versions, whether 64-bit
or 32-bit in little-endian field format.

Selection of file formats:
 historical (structlevel saves),
 lendian (little-endian, fieldlevel saves),
 and just for proof-of-concept, ascii fieldlevel saves
 (the ascii is huge! 10x bigger than little-endian).

For the fieldlevel save, all complex data structures recursively
get broken down until until it is one of the simple types that
can't be broken down any further, and that gets when it gets
written to the output file.

New files needed for this build:

hand-coded:
include/sfprocs.h
src/sfbase.c      - really a dispatcher to one of the
                    output/input format routines.
src/sflendian.c   - little-endian output writer/reader.
src/sfascii.c     - ascii text output writer/reader.

auto-coded (generated):
include/sfproto.h
src/sfdata.c

This is just one approach. I'm sure there are countless others
and they have different pros and cons.

For producing the auto-coded files a utility called
universal-ctags, that is actively maintained and evolving,
was used to do all the heavy-lifting of parsing the
NetHack C sources to tabulate the data fields, and store
them in an intermediate file called util/nethack.tags
(not required for building NetHack if you already have a
generated include/sfproto.h and src/sfdata.c)

util/readtags (also not required for building NetHack
itself) will decipher the nethack.tags file and produce
the functions that can deal with the NetHack struct data
fields.

You can obtain the source for universal-ctags by cloning it
from here:
https://github.com/universal-ctags/ctags.git

The combination universal-ctags + util/readtags has been
tried and tested under both Windows and Linux, so it is
not tied to a particular platform.

Note: util/readtags will work only with universal-ctags
output, so other ctags are unlikely to work as-is.
Universal-ctags can be build from source very easily
under Linux, or under Windows using visual studio.
2019-06-23 00:11:46 -04:00
nhmall
c9e8ae6323 Merge branch 'NetHack-3.6' 2019-06-22 22:03:07 -04:00
PatR
456996509b fix #H8922 - no "you finish eating" message
after being interrupted and then resuming.  Resuming a multi-turn
food when it only had one bite left was the culprit.
2019-06-22 13:03:50 -07:00
nhmall
eaa8c278c8 code in parse_conf_file() to trim trailing blanks/cr was missing them
Observed on a text file with crlf endings on Linux, where the
so-called blank lines weren't being ignored as they should
have been, despite there being a line to remove \r from the
end.

A pointer was being pre-decremented before the check for a
matching whitespace character.
2019-06-22 00:05:16 -04:00
nhmall
7698e27eed Merge branch 'NetHack-3.6' 2019-06-20 22:33:33 -04:00
PatR
2fe57af3f3 fix #H8833 - wishing for "<foo> amulet"
and receiving a random amulet instead of an "amulet of <foo>".
Although the failure to produce the 'right' amulet wasn't a regression
compared to earlier versions as the report indicated, supporting that
wish is straightforward.
2019-06-20 18:42:35 -07:00
PatR
2da552e22f fix #8924 - demonic bribery while hero is deaf
Even though it isn't using verbalize() to make a specific statement,
don't let a demon ask the hero for a bribe when the hero is deaf.

Also, give alternate setup messages in a couple of places where a
divine voice is overriding deafness.
2019-06-20 13:08:47 -07:00
PatR
72afb0d4f6 muse wand/horn feedback for monst zapping at self
Recent commit 5d59b288c9 changed monster
zapping a fire horn at self to cure sliming to not use the wand-zap
feedback routine, but inadvertently did for zaps of wands of fire too.
Use the zap routine for wand and play-instrument routine for horn.
2019-06-20 10:54:59 -07:00
nhmall
2a5d7ed536 Merge branch 'NetHack-3.6' 2019-06-20 10:18:32 -04:00
PatR
8bfe6f82f1 Re-do the formatting for help on menu control keys
and add the non-configurable keys:  space, return, and escape.
2019-06-20 02:26:48 -07:00
PatR
9f6588af49 curses text windows
Most of the entries for '?' looked awful because curses was using
((terminal_width / 2) - 2) for the window width ('- 2' was to make
for for a border around the popup window, regardless of what the
'windowborder' option was set to).  Splitting text that has been
manually formatted for 80 columns "worked" but looked bad when not
required.

Some of the help files are using 79 characters on a few lines,
producing wrapped text when displayed.  Those would look better if
limited them to 78 or if curses can be modified to suppress the
window border when the entire display is being covered by a popup.
2019-06-20 01:14:50 -07:00
nhmall
30cfcf3b12 Merge branch 'NetHack-3.6' 2019-06-18 21:43:54 -04:00
PatR
1c03d09701 curses map window
tty ignores map column #0 (0-based index), like the core, and draws
the map in screen columns 1 (1-based index) through 79, leaving screen
column 80 blank.  curses was drawing all 80 map columns and since #0
was always unused, screen column 1 was blank and the map was shown in
2 through 80.  Change curses to work like tty.

This was too easy; there may be problems lurking.  One known issue: it
should be made smarter about when clipping/panning is necessary since
it thinks that a full 80 columns are needed but 79 suffice.
2019-06-18 03:52:28 -07:00
nhmall
2b754e0c92 Merge branch 'NetHack-3.6' 2019-06-15 18:54:28 -04:00
PatR
820320ba55 EDIT_GETLIN when naming monsters and objects
Like #annotate, #name monster, #name individual object, and #name
object type are places where it makes some sense to have an existing
name be the default for the new name, in case taking off from the end
and/or adding to the end is more convenient than retyping everything.

When there is an existing name used as default, clearing that default
and hitting <return> is not enough to remove the name, you still need
to 'assign a new name' of <space> to do that.
2019-06-15 08:19:32 -07:00
PatR
747981d0c5 take two: tty bug with long 'autodescribe' text
Messages on tty which bypass message history weren't handling long
lines properly.  If the text wrapped to line 2, that continuation
portion was left on the screen after whatever operation that put it
here was finished.  (To reproduce:  assign a long name to a monster
with a long type name so that the combined length exceeds the display
width, then move the cursor over it with ';' or '/' while autodescribe
is On.)

This time prompting isn't adversely affected.
2019-06-15 07:18:47 -07:00
nhmall
938a2c1b64 Merge branch 'NetHack-3.6' 2019-06-15 08:54:45 -04:00
PatR
9cbc8ace42 tty bug with multi-line prompts
This effectively reverts 1ad2415315
because it was interfering with prompts that spanned more than one
line (by inserting '--More-- + erase' between displaying of prompt and
getting input for the answer).

So we're back to the situation where autodescribe feedback when moving
the cursor will leave text on the second line if it generates text too
wide for one line.  (^R redraws the screen correctly.)
2019-06-15 05:11:08 -07:00
PatR
f0633e6541 EDIT_GETLIN vs monpolycontrol
For wizard mode 'monpolycontrol', the getlin() answer buffer for the
"Change <monster> @ <x,y> into what kind of monster?" prompt is also
used to format the coordinate portion of that prompt, so when
EDIT_GETLIN is enabled getlin() was inadvertently given "<x,y>" to use
as default response.  Clear it after the prompt is formatted instead
of via an initializer.  Also, shorten the prompt on the first try:
"Change <monster> @ <x,y> into what?", expanding to the old prompt if
retry is needed.

This also allows specifying 'chameleon' when <monster> is a chameleon,
'doppelganger' when it's a doppelganger, and 'sandestin' when it's one
of those (but not 'doppelganger' when it's a chameleon or sandestin,
and so forth), instead of blanket refusal to accept any non-vampire
shapechanger as the choice.
2019-06-15 04:13:34 -07:00
PatR
1ad2415315 tty bug with displaying long 'autodescribe' text
Messages on tty which bypass message history weren't handling long
lines properly.  If the text wrapped to line 2, that continuation
portion was left on the screen after whatever operation that put it
here was finished.  (To reproduce:  assign a long name to a monster
with a long type name so that the combined length exceeds the display
width, then move the cursor over it with ';' or '/' while autodescribe
is On.)
2019-06-12 17:57:24 -07:00
PatR
9125b5943e 3.7: automatic annotation for vibrating square
Add "Gateway to Moloch's Sanctum" to the vibrating square level if you
step on the square or detect/magic map it as a pseudo-trap, an extra
hint for players who manage to get that far but then don't know what
to do next.  (I think I may also add a randomly placed floor engraving
along the lines of "For a good time, consult the Oracle of Delphi."
as a gag variant of "For a good time, call <name> at <phone number>."
Not very thematic for Gehennom but could conceivably nudge someone in
the right direction.  But it could give away the level for experienced
players who haven't located the vibrating square yet.)

The annotation sticks until the one for "Moloch's Sanctum" gets added.
That happens when the temple on the sanctum level is entered or the
altar there has become mapped (in view or via magic mapping).

Could break existing 3.7.0- save files (but probably won't, since
at least two bits were available unless using an ancient 'Bitfield()
allocates whole bytes' configuration).  That's the reason I didn't
put this into 3.6.2+.
2019-06-11 09:29:14 -07:00
nhmall
fea4fd0e00 Merge branch 'NetHack-3.6' 2019-06-10 18:04:45 -04:00
PatR
9ee6e1c839 wizweight vs globs
The wizard mode runtime option 'wizweight' appends an object's weight
to its formatted description, but that was skipped for globs on the
assumption that it had already been included.  But that inclusion only
happens in shops so most globs lacked weight feedback.
2019-06-10 09:52:34 -07:00
nhmall
f167fe4d7e Merge branch 'NetHack-3.6' 2019-06-10 08:05:46 -04:00
PatR
5d59b288c9 muse wand/horn feedback
One of the claims in #H8849 was that a monster which zapped a wand
that the hero had fully identified made hero's knowledge of it revert
to "a wand".  That doesn't happen; it had to have been a different
wand which hadn't been seen up close yet.  But the hero should lose
track of known number of charges if a wand is zapped outside his/her
view.  When implementing that I noticed that a monster playing a fire
horn to burn away slime was using the routine that gives wand
feedback.  Add a separate, similar routine for magical horn feedback.

Half this diff is due to moving a naming support routine from mhitm.c
to do_name.c.
2019-06-10 03:16:52 -07:00
nhmall
9ac8e07d9e Merge branch 'NetHack-3.6' 2019-06-09 14:09:18 -04:00
PatR
319dcf4746 curses EDIT_GETLIN - discarding preloaded answer
EDIT_GETLIN is more complicated on curses than on tty due to way that
long lines are handled....

Using ESC to get rid of the default response removed it from the
answer buffer but didn't erase back to the end of actual prompt,
making it look as if it was still there.  Fixing that for a one-line
prompt+answer was needed and would have been easy but it also needs to
be prepared to go back to prior lines.  Both the prompt and the answer
could conceivably span lines although in practice it will usually just
be one line or else prompt+answer combined spanning to a second line.

This hasn't been exhaustively tested been seems to be working correctly.
2019-06-09 07:07:34 -07:00
nhmall
797579399c Merge branch 'NetHack-3.6' 2019-06-09 09:45:14 -04:00
PatR
56d16fc7ee more ^G of "hidden <monster>"
Fix a couple of glitches and add an enchancement.  The monster
attributes structure left the 'hidden' field uninitialized unless user
specified "hidden".  Mimics were being flagged with mon->mundetected
because they pass the is_hider() test but they 'hide' by taking on an
appearance rather than being unseen due to mundetected.  hides_under()
monsters fail the is_hider() test, but can become mundetected if there
is at least one object present.  Eels/other fish are neither is_hider()
nor hides_under() but can be mundetected at water locations.  So alter
'hidden' handling to deal with these various circumstances.

Asking for 'hidden' for any type of creature will result in having its
location be highlighted if it can't be actively seen or detected.  So
using '2000 ^G piranha' will fill up the Plane of Water "normally" but
'2000 ^G hidden piranha' will result in a ton of draw-glyph/delay/
draw-other-glyph/delay sequences and take a painfully long time.  Moral
of the story:  don't combine 'hidden' with a large count unless you
want to spend quite a while watching the level's fill pattern.  Turning
off the 'sparkle' option will cut the flashing in half but still take
a long time.  If you really need to fill a level with hidden creatures
and can't bear the flashing/highlighting, use blessed potion of monster
detection or #wizintrinsics to have extended detect.  Then all created
monsters will be seen so none will trigger location highlighting.

If you create a 'stalker' or 'invisible stalker' or 'invisible <other-
mon>' its location won't be highlighted, but for 'hidden stalker' or
'hidden invisible stalker' or 'hidden invisible <other-mon>' it will
(provided you don't actually see it due to See_invisible or sensemon()).
2019-06-09 06:11:09 -07:00
nhmall
26bf4f1e11 Merge branch 'NetHack-3.6' 2019-06-09 08:43:40 -04:00
nhmall
5f676aa56c extend wizard-mode display effect to unseen invisible monsters 2019-06-09 07:46:14 -04:00
nhmall
ea9a385d67 fixes entry and a display effect related to is_hider wishing 2019-06-08 22:40:51 -04:00