new 'showvers' option

Add options 'showvers' (boolean) and 'versinfo' (numeric mask) to
show nethack's version on the status lines during play.  It won't be
particularly interesting to ordinary players but should be useful
when making screenshots or video to be streamed, or for someone who
switches between git branches or between nethack and variants.

I worked on this several months back but it was combined with
unfinished changes to 'hitpointbar'.  I've separated it out so that
it can be put into use.  When enabled, one or more components of
"<name> <branch> <version>" will be shown right justified after
status conditions.  At present the default is "<branch>" if that is
available and overall status isn't 'released', or "<version>" if
'released' or if branch isn't available.  That might need some
refinement.

It works as intended for tty and curses, although some abbreviation
mechanism would be useful if/when the program resorts to abbreviating
status conditions to make things narrow enough to fit.

For X11, it works ok for fancy_status:True (the default, controlled
via NetHack.ad settings) but is messed up for tty-style status.  The
text is positioned correctly but there are gaps in it, making it
appear garbled, similar to what I saw when I tried and failed to
implement statuslines:3 for X11.  [It might be due to having empty
condition widgets be 1 pixel wide instead of being totally removed
but I don't think the situation is that simple.]

For Qt, if the text needs to be truncated in order to fit, the center
portion of the string will be shown, discarding parts from the left
and right.  That ought to discard from left and retain rightmost
portion instead.

For win32|mswin|Win GUI, no attempt to support it has been included.
Things should be ok when 'showvers' is left as False (the default)
but I don't know what will happen if that gets toggled to True.  At a
minimum, the version info won't be right justified.  The information,
or at least some of it, is displayed in the game window's title bar
so there isn't any pressing need to add it to status, but toggling
the option will need to behave sensibly if it doesn't already.
This commit is contained in:
PatR
2024-02-28 11:47:16 -08:00
parent 5c3fd7b485
commit 41a5565403
20 changed files with 713 additions and 178 deletions

View File

@@ -64,6 +64,7 @@ safe_wait require use of 'm' prefix before '.' or 's' to [True]
sanity_check perform data sanity checks [False]
showexp display your accumulated experience points [False]
showrace show yourself by your race rather than by role [False]
showvers show version number on status lines [False]
silent don't use your terminal's bell sound [True]
sortpack group similar kinds of objects in inventory [True]
sparkle display sparkly effect for resisted magical [True]
@@ -289,6 +290,8 @@ suppress_alert disable various version-specific warnings about changes []
for the 'Q' command that quitting is now done via #quit
(e.g., use suppress_alert:3.3.1 to stop that and any other
notifications added in that version or earlier)
versinfo selects what information is displayed when showvers [1 or 4]
is true (default depends on program development status)
whatis_coord controls whether to include map coordinates when [n]
autodescribe is active for the '/' and ';' commands.
Value is the first letter of one of