experimental config option TTY_PERM_INVENT

Add a rudimentary experimental always-up inventory display
capability to tty when the perm_invent option is in effect.
It requires an additional 28 rows available on the terminal
underneath the bottom status line.

It hasn't been optimized for performance as of yet.
This commit is contained in:
nhmall
2022-06-20 10:40:55 -04:00
parent 377be376fe
commit 65659b2cab
10 changed files with 460 additions and 11 deletions

View File

@@ -12,6 +12,10 @@
#include <signal.h>
#endif
#ifdef TTY_PERM_INVENT
#include "wintty.h" /* just for define of NHW_TTYINVENT */
#endif
static void moveloop_preamble(boolean);
static void u_calc_moveamt(int);
#ifdef POSITIONBAR
@@ -631,6 +635,11 @@ display_gamewindows(void)
ever having been used, use it here to pacify the Qt interface */
start_menu(WIN_INVEN, 0U), end_menu(WIN_INVEN, (char *) 0);
#ifdef TTY_PERM_INVENT
if (WINDOWPORT("tty") && iflags.perm_invent) {
g.tty_invent_win = create_nhwindow(NHW_TTYINVENT);
}
#endif
#ifdef MAC
/* This _is_ the right place for this - maybe we will
* have to split display_gamewindows into create_gamewindows
@@ -650,6 +659,10 @@ display_gamewindows(void)
display_nhwindow(WIN_MESSAGE, FALSE);
clear_glyph_buffer();
display_nhwindow(WIN_MAP, FALSE);
#ifdef TTY_PERM_INVENT
if (g.tty_invent_win != WIN_ERR)
display_nhwindow(g.tty_invent_win, FALSE);
#endif
}
void

View File

@@ -435,6 +435,9 @@ const struct instance_globals g_init = {
NULL, /* invbuf */
0, /* inbufsize */
WIN_ERR, /* cached_pickinv_win */
#ifdef TTY_PERM_INVENT
WIN_ERR, /* tty_invent_win */
#endif
0, /* this_type */
NULL, /* this_title */
UNDEFINED_VALUES, /* only (coord) */

View File

@@ -1507,9 +1507,11 @@ docrt(void)
register int x, y;
register struct rm *lev;
if (!u.ux)
if (!u.ux || g.program_state.in_docrt)
return; /* display isn't ready yet */
g.program_state.in_docrt = TRUE;
if (u.uswallow) {
swallowed(1);
goto post_map;
@@ -1552,6 +1554,7 @@ docrt(void)
update_inventory();
g.context.botlx = 1; /* force a redraw of the bottom line */
g.program_state.in_docrt = FALSE;
}
/* for panning beyond a clipped region; resend the current map data to

View File

@@ -109,6 +109,9 @@ extern boolean colors_changed; /* in tos.c */
extern char *shade[3]; /* in sys/msdos/video.c */
extern char ttycolors[CLR_MAX]; /* in sys/msdos/video.c */
#endif
#ifdef TTY_PERM_INVENT
extern void tty_perm_invent_toggled(boolean negated);
#endif
static char empty_optstr[] = { '\0' };
boolean duplicate, using_alias;
@@ -4467,6 +4470,10 @@ optfn_boolean(int optidx, int req, boolean negated, char *opts, char *op)
case opt_use_inverse:
case opt_hilite_pile:
case opt_perm_invent:
#ifdef TTY_PERM_INVENT
if (WINDOWPORT("tty"))
tty_perm_invent_toggled(negated);
#endif
case opt_ascii_map:
case opt_tiled_map:
g.opt_need_redraw = TRUE;