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 flag.h $NHDT-Date: 1514071158 2017/12/23 23:19:18 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.132 $ */
/* NetHack 3.6 flag.h $NHDT-Date: 1553204011 2019/03/21 21:33:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.148 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -367,7 +367,6 @@ struct instance_flags {
boolean wizweight; /* display weight of everything in wizard mode */
boolean cmdassist; /* provide detailed assistance for some commands */
boolean clicklook; /* allow right-clicking for look */
int statuslines; /* default = 2, code support for alternative 3 */
/*
* Window capability support.
*/
@@ -387,10 +386,8 @@ struct instance_flags {
char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */
char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
char *
wc_foregrnd_status; /* points to foregrnd color name for status win */
char *
wc_backgrnd_status; /* points to backgrnd color name for status win */
char *wc_foregrnd_status; /* points to foregrnd color name for status */
char *wc_backgrnd_status; /* points to backgrnd color name for status */
char *wc_foregrnd_text; /* points to foregrnd color name for text win */
char *wc_backgrnd_text; /* points to backgrnd color name for text win */
char *wc_font_map; /* points to font name for the map win */
@@ -418,13 +415,13 @@ struct instance_flags {
boolean wc2_selectsaved; /* display a menu of user's saved games */
boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
boolean wc2_hitpointbar; /* show graphical bar representing hit points */
boolean wc2_guicolor; /* allow colours in gui (outside map) */
int wc_mouse_support; /* allow mouse support */
int wc2_term_cols; /* terminal width, in characters */
int wc2_term_rows; /* terminal height, in characters */
int wc2_statuslines; /* default = 2, curses can handle 3 */
int wc2_windowborders; /* display borders on NetHack windows */
int wc2_petattr; /* text attributes for pet */
boolean wc2_guicolor; /* allow colours in gui (outside map) */
boolean obsolete; /* obsolete options can point at this, it isn't used */
struct autopickup_exception *autopickup_exceptions[2];
#define AP_LEAVE 0
#define AP_GRAB 1
@@ -448,6 +445,7 @@ struct instance_flags {
boolean windowtype_deferred; /* pick a windowport and store it in
chosen_windowport[], but do not switch to
it in the midst of options processing */
boolean obsolete; /* obsolete options can point at this, it isn't used */
};
/*

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