tty statuslines:3

Implement the 'statuslines' option for tty.  2 and 3 line status are
similar to curses.  Tty's version doesn't include insertion of extra
spaces for enhanced readability, or ignoring 'showexp' when space is
needed for other fields, or right justifying 'score' and suppressing
it when there isn't room for the entire number.  It continues to have
abbreviated condition and encumbrance descriptions that curses lacks
which get used when the normal ones take up too much space.

'statuslines' can be set with 'O' so it is feasible to switch back
and forth between 2 and 3 lines on the fly.  But only if the display
is at least 25 lines (actually ROWNO+4) or else CLIPPING is enabled
at build time.

This fixes the bug where after resorting to abbreviated condition
values it sometimes (always?) wouldn't switch back after more room
became available.  Abbreviated encumbrance values had problems too
(lack of leading space and not changing value if encumbrance changed
to anything other than unencumbered) and this fixes that as well.
This commit is contained in:
PatR
2019-03-29 04:21:18 -07:00
parent 0597eeebe9
commit d1dade164e
7 changed files with 412 additions and 329 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1553480404 2019/03/25 02:20:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.360 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1553858470 2019/03/29 11:21:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.361 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -385,20 +385,23 @@ static struct Comp_Opt {
#ifdef MSDOS
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE },
#endif
#ifdef STATUS_HILITES
{ "statushilites",
#ifdef STATUS_HILITES
"0=no status highlighting, N=show highlights for N turns",
20, SET_IN_GAME },
20, SET_IN_GAME
#else
{ "statushilites", "highlight control", 20, SET_IN_FILE },
"highlight control", 20, SET_IN_FILE
#endif
#ifdef CURSES_GRAPHICS
},
{ "statuslines",
#ifdef CURSES_GRAPHICS
"2 or 3 lines for horizonal (bottom or top) status display",
20, SET_IN_GAME }, /*WC2*/
20, SET_IN_GAME
#else
{ "statuslines", "2 or 3 lines for status display", 20, SET_IN_FILE },
"2 or 3 lines for status display",
20, SET_IN_FILE
#endif
}, /*WC2*/
{ "symset", "load a set of display symbols from the symbols file", 70,
SET_IN_GAME },
{ "roguesymset",
@@ -3703,6 +3706,7 @@ boolean tinitial, tfrom_file;
}
return retval;
}
#endif /* CURSES_GRAPHICS */
/* WINCAP2
* statuslines:n */
@@ -3728,7 +3732,6 @@ boolean tinitial, tfrom_file;
}
return retval;
}
#endif /* CURSES_GRAPHICS */
/* menustyle:traditional or combination or full or partial */
fullname = "menustyle";
@@ -5739,8 +5742,9 @@ char *buf;
iflags.hilite_delta, iflags.hilite_delta);
#endif
} else if (!strcmp(optname,"statuslines")) {
Strcpy(buf, (WINDOWPORT("curses")
&& iflags.wc2_statuslines < 3) ? "2" : "3");
if (wc2_supported(optname))
Strcpy(buf, (iflags.wc2_statuslines < 3) ? "2" : "3");
/* else default to "unknown" */
} else if (!strcmp(optname, "suppress_alert")) {
if (flags.suppress_alert == 0L)
Strcpy(buf, none);