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

@@ -560,6 +560,10 @@ typedef unsigned char uchar;
/* #define TTY_TILES_ESCCODES */
/* #define TTY_SOUND_ESCCODES */
/* An experimental minimalist inventory list capability under tty if you have
* at least 28 additional rows beneath the status window on your terminal */
/* #define TTY_PERM_INVENT */
/* NetHack will execute an external program whenever a new message-window
* message is shown. The program to execute is given in environment variable
* NETHACK_MSGHANDLER. It will get the message as the only parameter.

View File

@@ -98,6 +98,7 @@ struct sinfo {
int restoring;
int in_moveloop;
int in_impossible;
int in_docrt; /* in docrt() */
int in_self_recover;
int in_parseoptions; /* in parseoptions */
int config_error_ready; /* config_error_add is ready, available */
@@ -971,6 +972,9 @@ struct instance_globals {
persistent one doesn't get shrunk during filtering for item selection
then regrown to full inventory, possibly being resized in the process */
winid cached_pickinv_win;
#ifdef TTY_PERM_INVENT
winid tty_invent_win;
#endif
/* query objlist callback: return TRUE if obj type matches "this_type" */
int this_type;
const char *this_title; /* title for inventory list of specific type */

View File

@@ -10,6 +10,23 @@
#ifndef WINDOW_STRUCTS
#define WINDOW_STRUCTS
#ifdef TTY_PERM_INVENT
enum { tty_pi_minrow = 28, tty_pi_mincol = 79 };
union ttycellcontent {
char ttychar;
glyph_info *gi;
};
struct tty_perminvent_cell {
Bitfield(refresh, 1);
Bitfield(text, 1);
Bitfield(glyph, 1);
Bitfield(colorbits, 5);
union ttycellcontent content;
int32_t color;
};
extern struct tty_perminvent_cell zerottycell;
#endif
/* menu structure */
typedef struct tty_mi {
struct tty_mi *next;
@@ -45,6 +62,9 @@ struct WinDesc {
long nitems; /* total number of items (MENU) */
short how; /* menu mode - pick 1 or N (MENU) */
char menu_ch; /* menu char (MENU) */
#ifdef TTY_PERM_INVENT
struct tty_perminvent_cell **cells;
#endif
};
/* window flags */
@@ -103,7 +123,11 @@ struct tty_status_fields {
#ifdef NHW_BASE
#undef NHW_BASE
#endif
#define NHW_BASE 6
#define NHW_BASE (NHW_TEXT + 1)
#ifdef TTY_PERM_INVENT
#define NHW_TTYINVENT (NHW_BASE + 1)
#endif
extern struct window_procs tty_procs;
@@ -261,6 +285,10 @@ E void genl_outrip(winid, int, time_t);
E char *tty_getmsghistory(boolean);
E void tty_putmsghistory(const char *, boolean);
#ifdef TTY_PERM_INVENT
E void tty_refresh_inventory(int start, int stop, int y);
#endif
#ifdef NO_TERMS
#ifdef MAC
#ifdef putchar