curses options and status groundwork

More groundwork for overhauling the status display for curses, plus
a few functional changes.  It was doing a full status update for
every changed field (except conditions), instead of waiting for a
flush directive after gathering multiple changes at a time.  Since
it already does gather every change, the fix to wait is trivial.

This decouples 'hitpointbar' from 'statushilites'.  When highlighting
is off, it uses inverse video only.  When on, it behaves as before:
using inverse video plus the most recent color used to highlight HP
(which can vary if that has rules to highlight changes or percentage
thresholds) but ignoring any HP attribute(s).  This also enables the
latent 'statuslines' option and changes 'windowborders' option from
being settable at startup only to changeable during play.

'statuslines' can have a value of 2 (the default) or 3 and applies to
'align_status:bottom' or 'top'; it's ignored for 'left' and 'right'.
At the moment, setting it to 3 only allows status condition overflow
to wrap from the end of line to 2 to the beginning of line 3, and if
window borders are drawn they'll clobber the last character on line 2
and first one on line 3.  There's no point in trying to fix that
because it will go away when the main status overhaul changes go in.
Condition wrapping for vertical orientation (left or right placement)
was already subject to the same phenomenon and will be superseded too.

This also changes the meaning of the 'windowborders' value so could
impact players using source from git (or possibly beta binaries for
Windows, but not for OSX where curses interface wasn't included).
Old:
 0 = unspecified, 1 = On, 2 = Off, 3 = Auto (On if display is big
     enough, Off otherwise; reevaluated after dynamic resizing);
 Unspecified got changed to 3 during curses windowing initialization.
New:
 0 = Off, 1 = On, 2 = Auto;
 0 gets changed to 2 for default value at start of options processing.
So old value of 2 is changing meaning and explicit old value of 3 is
becoming invalid.  Implicit 3 changes to default 2.  Explicit 3 could
be the subject of a fixup but there isn't much point since 2 can't
have a similar fix.  Users who are using old 2 or explicit 3 will need
to update their run-time config files.

This adds 'statuslines' to the Guidebook and moves some other recently
added documentation of curses options from among the general options
(section 9.4) to "Window Port Customization options" (section 9.5).
None of them have been added to dat/opthelp which seems to be missing
all the wincap options.

Originally I made a lot of changes (mostly moving C99 declarations to
start of their blocks) to the old '#if 0' code at end of cursstat.c,
but have tossed those, except for one subtle bug that assumed 'int'
and 'long' are the same size.
This commit is contained in:
PatR
2019-03-21 14:33:39 -07:00
parent 7049145712
commit 5efea7115a
10 changed files with 336 additions and 282 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 winprocs.h $NHDT-Date: 1549327479 2019/02/05 00:44:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.46 $ */
/* NetHack 3.6 winprocs.h $NHDT-Date: 1553204011 2019/03/21 21:33:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.47 $ */
/* Copyright (c) David Cohrs, 1992 */
/* NetHack may be freely redistributed. See license for details. */
@@ -217,16 +217,17 @@ extern
#define WC2_RESET_STATUS 0x0100L /* 09 call status_update(BL_RESET) to
* indicate 'draw everything' */
#define WC2_TERM_SIZE 0x0200L /* 10 support setting terminal size */
#define WC2_WINDOWBORDERS 0x0400L /* 11 display borders on nh windows */
#define WC2_PETATTR 0x0800L /* 12 attributes for hilite_pet */
#define WC2_GUICOLOR 0x1000L /* 13 display colours outside map win */
#define WC2_STATUSLINES 0x0400L /* 16 switch between 2 or 3 lines of status */
#define WC2_WINDOWBORDERS 0x0800L /* 11 display borders on nh windows */
#define WC2_PETATTR 0x1000L /* 12 attributes for hilite_pet */
#define WC2_GUICOLOR 0x2000L /* 13 display colours outside map win */
/* pline() can overload the display attributes argument passed to putstr()
with one or more flags and at most one of bold/blink/inverse/&c */
#define WC2_URGENT_MESG 0x2000L /* 14 putstr(WIN_MESSAGE) supports urgency
#define WC2_URGENT_MESG 0x4000L /* 14 putstr(WIN_MESSAGE) supports urgency
* via non-display attribute flag */
#define WC2_SUPPRESS_HIST 0x4000L /* 15 putstr(WIN_MESSAGE) supports history
#define WC2_SUPPRESS_HIST 0x8000L /* 15 putstr(WIN_MESSAGE) supports history
* suppression via non-disp attr */
/* 17 free bits */
/* 16 free bits */
#define ALIGN_LEFT 1
#define ALIGN_RIGHT 2