Commit Graph

11872 Commits

Author SHA1 Message Date
PatR
946df19ea2 \#perminv, 2 of 2: implementation
Add new '|' command, aka #perminv, which allows the player to
send menu scrolling keystrokes to the persistent inventory window.

Implemented for X11, where its usefulness is limited, and for
curses, where it is more needed and also more fully functional.
The interface can either prompt for one keystroke, act upon it,
and return to normal play, or it can loop for multiple keystrokes
until player types <return> or <escape>.  X11 does the former if
the 'slow' application resource is False so that prompting uses
popups, and the latter when 'slow' is True where prompting is in
a fixed spot and doesn't end up causing the persistent inventory
window to be stacked behind the map window.  curses always does
the loop-until-done approach.  It also accepts up and down arrow
keys to scroll one line at a time.

Also adds two new menu scrolling commands, menu_shift_right (key
'}' by default) and menu_shift_left ('{') if wincap2 flags contain
WC2_MENU_SHIFT.  Shifting allows different substrings of too-long
lines to be seen.

For X11, neither works because their handling requires a horizontal
scrollbar and for some reason that escapes me our menus don't have
one of those.  If they did, shifts could work for all menus but a
shifted window would hide the selection letters.  So shifting would
be most usefully done as:  pan right, read more of any long lines,
immediately pan back to the left.

For curses, they only apply to the persistent inventory window.
Shift right redraws it with class headers and inventory letters
shown normally but the item descriptions omit their leftmost
portion, showing more text towards the end.  Shift left reverses
that and does nothing if the beginning is already in view.  Forward
and backward scrolling while shifted leave the shift in place.
2021-03-13 18:18:53 -08:00
PatR
dd49431296 \#perminv, 1 of 2: groundwork
Give the window-port side of *_update_inventory() an argument.
Calls in the core still omit that; invent.c's update_inventory()
is the only place that cares.
2021-03-13 18:17:00 -08:00
PatR
160344feaa scrollbar handling by X11
Looking up scrollbars did not work as intended.  The code wanted an
ancestor widget that had both horizontal and vertical scrollbars,
but menus either have none or just vertical.  The lookup code found
some top level widget and returned bad data.
2021-03-12 18:06:43 -08:00
PatR
015380fecf remove several obsolete C() and M() macros
The ones moved from cmd.c to global.h suffice.
2021-03-10 13:50:44 -08:00
PatR
fd8529b12a duplicate options parsing for menu keys
I'm sure that this could be improved but it is better than before....
2021-03-10 13:17:19 -08:00
PatR
d8bef90009 options key parsing
OPTIONS=menu_previous_page:\mv
  BINDINGS=M-v:menu_previous_page
both worked, but
  OPTIONS=menu_previous_page:M-v
  BINDINGS=\mv:menu_previous_page
both failed.  Make all four variations work.  Tiny change made large
by the need to move some things around.

The option definition for menu_first_page had a couple of its flag
bits swapped.  I didn't try to figure out whether that had any impact.
2021-03-10 12:28:09 -08:00
PatR
28b7a70b33 fix a couple of options affecting perm_invent
When the 'O' command is used to change either 'menu_headings' or
'sortloot', inventory display can change so persistent inventory
needs to be updated.

Oddly, the flag to indicate initial options processing remained
True after options had been processed, but that ultimately didn't
matter here.  It's fixed now anyway.

Also, sort the WC2_xxx options in a couple of places.
2021-03-10 11:22:22 -08:00
PatR
cc855d6973 signal induced panictrace under curses
When panictrace feedback occurs due to catching a signal rather
than controlled panic, the backtrace is useless when running the
curses interface unless the terminal gets reset first.  Let's
just hope that the signal triggering a panictrace doesn't occur
while resetting the terminal.
2021-03-09 07:45:58 -08:00
PatR
554297dd4a fix #K3274 - applied polearm locates hidden mon
without using any time.  Targetting an apparently empty spot at
valid polearm range where a monster happens to be hiding reports
"Wait!  There's something there you can't see!" and displays the
remembered, unseen monster glyph, then aborts the attack attempt.
It would use a turn if the polearm became wielded in the attempt
but not if it was already wielded.  Make latter case take time.
2021-03-07 15:08:08 -08:00
PatR
1ab3b2a75d window.doc cleanup
Remove a bunch of trailing spaces and shorten some long lines.
2021-03-07 14:04:22 -08:00
PatR
8adb4aa219 blinded Archon gaze bit
From yesterday (old #H3841), the alternate message given when a
monster is being hit by a blind Archon's gaze was checking the
wrong monster for blindness.
2021-03-04 18:07:23 -08:00
PatR
d7be7031a1 Discworld: Sourcery
Include the page number for Sourcery's second passage.  While
in there, add another passage.

For wishing, recognize "sorcery" as an alternate spelling.
2021-03-03 16:38:49 -08:00
PatR
621c9436bc discoveries/#known sorting fix
If the sort order for sortdiscoveries was s ('sortloot' order)
and any artifacts or unique items were discovered, using '\'
to see all discoveries included "Discovered Items" as a spurious
class header between the real header for the last object class with
discoveries and the discoveries for that class:
 |Discoveries, sortloot order (by class with some sub-class groupings)
 |
 |Artifacts
 |  Sunsword [lawful long sword]
 |Potions
 |  water (clear)
 |Gems/Stones
 |Discovered items
 |  diamond (white)
 |  flint stone (gray)

"Discovered items" is supposed to only be shown when sorting
alphabetically across all classes and there are artifacts and/or
unique items before the regular discovered objects.
2021-03-03 15:03:31 -08:00
PatR
cd43027a49 fix #H3841 - inconsistent Archon gaze behavior
From six years ago:  hero is "blinded by the Archon's radiance"
even if the attacking Archon has been blinded, but monsters hit
by same thing were protected from it by that blindness.  Make
monsters attacked by Archons be affected similarly to the hero.

Hypothetical case of hero-as-Archon versus monster is ignored
because hero can't polymorph into that shape.
2021-03-03 14:40:19 -08:00
PatR
10a9d358c5 hypothetical buffer overruns
doprtool() and doprinuse() collect the inventory letters of all
applicable items into a buffer capable of holding 52 letters plus
terminator.  It is possible to have more than 52 items (ignoring
gold) so theoretically possible to have more than 52 separate lit
candles.  Guard against that.

The easiest way to get an item in the overflow slot is to carry
52 non-boulders, polymorph into a giant, and pick up a boulder.
Assigning the latter to one of the three weapon slots would not
impact doprtool() but it will impact doprinuse().  However, that
wasn't enough to cause a crash for me; evidently the overflow
clobbered something innocuous.  (52+boulder is not the only way
to get something into slot '#', just the only guaranteed one I
can think of offhand.)

This also removes a bunch of 'register' type qualifiers.
2021-02-27 17:13:17 -08:00
PatR
a2046669f4 X11 menu handling
In a couple of places, call menu_popdown instead of duplicating
its contents.  I'm fairly sure that executing the is_active bit
that the duplications omitted is safe.

Several minor formatting bits are mixed in.
2021-02-26 17:06:40 -08:00
nhmall
2cf54f54ad bit 2021-02-26 09:47:54 -05:00
nhmall
558b7c27d8 read_simplemail() when SERVER_ADMIN_MSG is defined
Some warnings were mentioned

Add a prototype ahead of the function
Use a non-const copy of SERVER_ADMIN_MSG

quick-tested by:
- uncommenting the following in include/unixconf.h
  /* #define SERVER_ADMIN_MSG "adminmsg" */
- building NetHack
- creating a test message:
  echo "server_admin: system is going down at 2 pm" >~/nh/install/games/lib/nethackdir/adminmsg
- playtested and received the desired message
2021-02-26 09:05:52 -05:00
PatR
05da754b02 fixes37.0 entry about engraving
Revert part of commit f6a30e7b05
that moved a fixes entry from the 'fixes to 3.6.x' section
into the 'post-3.6.x, exposed by git' section.  It wasn't due
to the conversion of engraving from multi-turn action into an
occupation, it was fixing a bug that had been around for 5 or 6
years.  Moot now; the conversion to occupation removed it.
2021-02-26 00:13:22 -08:00
PatR
f6a30e7b05 partly fix github issue #446 - monk gender
The monk role can be either male or female but the monk fake
player monster was flagged as male-only.  Allow both genders.

The male and female monk tiles are identical though and this
doesn't address that.

Fixes #466
2021-02-25 14:11:03 -08:00
PatR
9870399435 tribute bit: Sourcery passage 4
Fix a mistake that led to a bad fix for a perceived mistake that
wasn't really there.

I think having a comma after "moment" would make things clearer,
but style-wise that's optional and leaving it out restores the
book's original wording.
2021-02-24 14:41:51 -08:00
PatR
3be4e49552 [lack of] autopickup inside shops
When being inside a shop inhibits autopickup, menion that in ^X
feedback about autopickup.
2021-02-23 02:42:28 -08:00
PatR
27a0351cd2 fix #H3734 - "see an angry guard" when that guard
is invisible and hero can't see him/her.  Reported for 3.4.3 in
late 2014....
2021-02-23 02:04:21 -08:00
PatR
ed349cd5fe X11 yn_function() again
Widget widths should have type 'Dimension' rather than plain 'int'.

Perform a couple of things once during popup widget creation rather
than every time it gets popped up.
2021-02-22 01:10:14 -08:00
PatR
8195334d65 X11 popup yn_function resizing
When X11_yn_function() re-uses a popup widget to issue a prompt
and get the player's response, make it resize properly.  I'm not
sure why the old hack for that apparently worked for some folks
and not for me, or why this does work for me.  At least it does.

Also, make the minimum popup width be 25 characters so that
really short prompts don't result in tiny popups.  Since the
popup appears at whatever spot the pointer happens to be sitting,
it isn't always immediately noticeable when the player is using
the keyboard rather than the pointer.
2021-02-21 17:30:09 -08:00
PatR
d6d42f56b2 "If you see me running, try to keep up."
Noticed while poking about in read.c for the ^G feedback change:
a relatively recently added apron slogan turns out to be a near
duplicate of an existing T-shirt slogan.  Change the apron one a
little, although they're still nearly identical.
2021-02-20 17:24:25 -08:00
PatR
b9ed4407de ^G feedback
For ^G, if someone replies with empty input to the "Create which
monster?" prompt, give alternate feedback than "I've never heard
of such monsters." before reprompting.
2021-02-20 17:15:58 -08:00
PatR
316a9a1809 X11 getline refinement
X11_getlin() echoing its prompt and response to message window
truncates combined value to maximum allowed pline (rather than
having pline truncate it).  But it was truncating the response
as if the prompt was maximum allowed length instead of its actual
length, so possibly hiding some of the user's text unnecessarily.
2021-02-20 16:25:12 -08:00
nhmall
49c008fcee Windows nmake build - recognize VS 16.8.5 2021-02-20 11:53:17 -05:00
PatR
a32002eb88 X11 getline: log prompt and response
After player has responded to a getline prompt, echo the prompt
and the line of text response to the message window.  Uses pline()
so also gets put into core's message history for dumplog.
2021-02-19 15:38:31 -08:00
PatR
2cedfc9696 X11 update
More issues.  The incorrectly rendered map after panning is one
I haven't seen before.  Normally I only have a clipped map if I
force double size tiles rather and hadn't noticed this behavior
for that case, so manually resizing--and/or the scrollbars which
get added when that occurs--may be what triggers it.
2021-02-19 14:11:32 -08:00
Pasi Kallinen
f9aff476c4 Increment editlevel
Just in case, even though changing joined to boolean shouldn't cause problems.
2021-02-19 17:28:43 +02:00
copperwater
18dc88505d Convert room 'joined' and 'needjoining' into booleans
des.region() accepted booleans for the joined field, whereas des.room
accepted xchars. These were only being used as truth values, so this
converts the room ones into booleans for consistency. I don't think
accidentally using an int or a boolean wrongly would actually crash the
level generator, but consistency is good.

This converts an schar field in struct mkroom into a boolean; on most
systems these are probably 1-byte types and save files won't be broken,
but it might be best to treat this as a save breaker anyway.
2021-02-19 17:09:41 +02:00
copperwater
fa3041c9f9 Make g.coder->lvl_is_joined a boolean
Its value is only used as a boolean, so there's no real need to keep it
as a confusing int.

Shouldn't be a save-breaking change; it doesn't look like g.coder is
saved.
2021-02-19 17:09:41 +02:00
nhmall
7bc8d98ea3 Merge branch 'copperwater-pr464' into NetHack-3.7 2021-02-19 07:50:34 -05:00
nhmall
fb0b535cde fixes37.0 entry for pr#464 2021-02-19 07:49:10 -05:00
nhmall
f716dd8211 Merge branch 'fix-engraving-impossible' of https://github.com/copperwater/NetHack into copperwater-pr464 2021-02-19 07:46:45 -05:00
Patric Mueller
bea69f39f3 Output message when changing fastmove mode while cursor targetting 2021-02-19 10:40:41 +01:00
PatR
bb57bf16f1 'O' feedback for booleans
Give a message for each boolean option toggled via 'O'.  It may
help catch mistakes sooner if/when player types wrong menu letter.

Only applies to 'O', not booleans manipulated during config file
or NETHACKOPTIONS processing.
2021-02-19 00:24:45 -08:00
PatR
f480803970 'wizmgender' flag
"Demote" wizmgender from an obscure wizard mode extended command
to an obscure wizard mode boolean option.  Behaves the same except
that no message is given when the value gets toggled.
2021-02-18 23:54:30 -08:00
copperwater
3219ed1aa8 Fix: engraving with non-blade dulled the weapon anyway
Due to a logic bug introduced when engraving became an occupation - the
code that tests to see whether the player is writing with a weapon that
will get dulled wasn't correctly checking that they were actually
carving an engraving.
2021-02-19 00:25:45 -05:00
PatR
a646764cc7 fix github issue #462 - line not displayed
Fix a latent bug in unreachable code.  As the comment preceding
the cited code states, hero polymorphed into an eel isn't offered
a chance to use #monster to hide, so program execution won't ever
get to the bad code.  Using formatting routine The() where message
delivery routine pline_The() is intended is certainly a bug though.

Fixes #462
2021-02-17 14:27:00 -08:00
PatR
31b0847bd7 X11's yn_function() echoing its response
X11_yn_function() issues a pline() to put the prompt and player's
response into the message window.  Change it to use visctrl() to
make sure that the response character is ledgible when something
like the '&' command allows an arbitrary answer.

This patch adds a leading space and two extra trailing spaces
to the prompt when it's being issued via popup, but that hasn't
affected the issue mentioned next....

The popup prompting when the 'slow' resource is False doesn't
always resize properly.  I saw both too wide and too narrow
[What do you want to throw? [abc] ]b
[       In what direction?        ]
and
[Really quit? [yn] (n) ]y
[Dump core? [ynq] (q) ]n   (size seemed right, but hard to tell)
[Do you want your posses]  (might have shown one more letter;
                            resize doodad in window's bottom right
                            corner on OSX oscures the rightmost
                            column--which is ordinarily a space)
The truncated one did accept responses.  If I answered 'n' then
the next question was truncated too, but for 'y' (plus ensuing
feedback) it would be sized correctly for the question after that.

To be clear:  the popup width issue was present before this change
and is still present after it.  The code already has a hack that's
intended to deal with this but it doesn't do the job for me.
2021-02-15 19:09:00 -08:00
PatR
8fff588ab3 X11 persistent inventory again: initial display
If 'perm_invent' is preset in player's options, have X11 show the
persistent inventory window from the start instead of waiting for
an 'i' command.  moveloop() prolog needed a tweak do deal with it
cleanly.

Require WC_PERM_INVENT in order to honor the perm_invent option.
X11 and curses already set that, tty and curses don't support it,
so only Windows GUI needed to be updated for it.
2021-02-14 00:57:34 -08:00
PatR
36179da82f X11 perm_invent: handle 'O' toggling off perm_invent
When persistent inventory window is up, remove it if 'perm_invent'
option gets set to False.  This has a side-effect of fixing the
end-of-game prompting problem it caused.
2021-02-13 19:17:20 -08:00
PatR
8c0e3b2a8d monster missiles vs sinks
Missiles shot or thrown by monsters already stop at sinks; give
a message if they haven't exhausted their range and hero sees.
2021-02-13 15:16:15 -08:00
PatR
5a8c978b1e scatter() vs sinks
Objects shot, thrown, or kicked by the hero or by monsters stop
short if they try to pass over a sink; make objects launched by
an explosion behave similarly.
2021-02-13 15:15:21 -08:00
Pasi Kallinen
1b7faaf661 Add couple more config tests 2021-02-13 11:51:25 +02:00
nhw_cron
80b82c687b This is cron-daily v1-Jan-20-2020. files updated: Files 2021-02-12 18:36:00 -05:00
PatR
be9a2c2907 X11: persistent inventory issues and hack for OSX
This hack prevents the perm_invent window for X11 on OSX from
creeping every time it gets updated.  It is far from perfect and
at the very least ought be handled via user settable X resources
rather than hardcoded values, but it's as much effort as I'm likely
to spend.

Add a new file containing a list of issues that ought to be fixed.
The initial entries are things I noticed while experimenting with
perm_invent; there is lots of older stuff that could/should be
there too.  I'm not sure whether the first one is OSX-specific; the
others aren't.
2021-02-12 15:07:51 -08:00