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:
@@ -119,16 +119,14 @@ curses_create_main_windows()
|
||||
boolean borders = FALSE;
|
||||
|
||||
switch (iflags.wc2_windowborders) {
|
||||
case 0: /* Off */
|
||||
borders = FALSE;
|
||||
break;
|
||||
case 1: /* On */
|
||||
borders = TRUE;
|
||||
break;
|
||||
case 2: /* Off */
|
||||
borders = FALSE;
|
||||
break;
|
||||
case 3: /* Auto */
|
||||
if ((term_cols > 81) && (term_rows > 25)) {
|
||||
borders = TRUE;
|
||||
}
|
||||
case 2: /* Auto */
|
||||
borders = (term_cols > 81 && term_rows > 25);
|
||||
break;
|
||||
default:
|
||||
borders = FALSE;
|
||||
@@ -208,7 +206,7 @@ curses_create_main_windows()
|
||||
int inv_width = 0;
|
||||
int map_height = (term_rows - border_space);
|
||||
int map_width = (term_cols - border_space);
|
||||
int statusheight = (iflags.statuslines < 3) ? 2 : 3;
|
||||
int statusheight = (iflags.wc2_statuslines < 3) ? 2 : 3;
|
||||
boolean status_vertical = (status_orientation == ALIGN_LEFT
|
||||
|| status_orientation == ALIGN_RIGHT);
|
||||
boolean msg_vertical = (message_orientation == ALIGN_LEFT
|
||||
@@ -221,7 +219,7 @@ curses_create_main_windows()
|
||||
&status_width, &status_height,
|
||||
status_orientation,
|
||||
&map_x, &map_y, &map_width, &map_height,
|
||||
border_space, statusheight, 26);
|
||||
border_space, 20, 26);
|
||||
|
||||
if (iflags.perm_invent) {
|
||||
/* Take up all width unless msgbar is also vertical. */
|
||||
@@ -246,7 +244,7 @@ curses_create_main_windows()
|
||||
&status_width, &status_height,
|
||||
status_orientation,
|
||||
&map_x, &map_y, &map_width, &map_height,
|
||||
border_space, statusheight, 26);
|
||||
border_space, statusheight, 0);
|
||||
|
||||
if (!msg_vertical)
|
||||
set_window_position(&message_x, &message_y,
|
||||
@@ -777,18 +775,13 @@ curses_character_dialog(const char **choices, const char *prompt)
|
||||
void
|
||||
curses_init_options()
|
||||
{
|
||||
set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR
|
||||
| WC_HILITE_PET | WC_POPUP_DIALOG, SET_IN_GAME);
|
||||
|
||||
set_wc2_option_mod_status(WC2_GUICOLOR, SET_IN_GAME);
|
||||
/* change these from DISP_IN_GAME to SET_IN_GAME */
|
||||
set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS, SET_IN_GAME);
|
||||
|
||||
/* Remove a few options that are irrelevant to this windowport */
|
||||
/*set_option_mod_status("DECgraphics", SET_IN_FILE); */
|
||||
set_option_mod_status("eight_bit_tty", SET_IN_FILE);
|
||||
|
||||
/* Add those that are */
|
||||
set_option_mod_status("statuslines", SET_IN_GAME);
|
||||
|
||||
/* Make sure that DECgraphics is not set to true via the config
|
||||
file, as this will cause display issues. We can't disable it in
|
||||
options.c in case the game is compiled with both tty and curses. */
|
||||
@@ -800,15 +793,12 @@ curses_init_options()
|
||||
#ifdef PDCURSES
|
||||
/* PDCurses for SDL, win32 and OS/2 has the ability to set the
|
||||
terminal size programatically. If the user does not specify a
|
||||
size in the config file, we will set it to a nice big 110x32 to
|
||||
size in the config file, we will set it to a nice big 32x110 to
|
||||
take advantage of some of the nice features of this windowport. */
|
||||
if (iflags.wc2_term_cols == 0) {
|
||||
if (iflags.wc2_term_cols == 0)
|
||||
iflags.wc2_term_cols = 110;
|
||||
}
|
||||
|
||||
if (iflags.wc2_term_rows == 0) {
|
||||
if (iflags.wc2_term_rows == 0)
|
||||
iflags.wc2_term_rows = 32;
|
||||
}
|
||||
|
||||
resize_term(iflags.wc2_term_rows, iflags.wc2_term_cols);
|
||||
getmaxyx(base_term, term_rows, term_cols);
|
||||
@@ -825,9 +815,6 @@ curses_init_options()
|
||||
}
|
||||
*/
|
||||
#endif /* PDCURSES */
|
||||
if (!iflags.wc2_windowborders) {
|
||||
iflags.wc2_windowborders = 3; /* Set to auto if not specified */
|
||||
}
|
||||
|
||||
/* fix up pet highlighting */
|
||||
if (iflags.wc2_petattr == -1) /* shouldn't happen */
|
||||
|
||||
Reference in New Issue
Block a user