For a long while, I've noticed that if the first page of corner menu is
quite long, and the second page is much shorter, the content obliterated
by the first page is left missing until the menu is fully dismissed.
This attempts to fix that missing content up.
===========================================================================
BEFORE THIS PATCH - menu Page 1
===========================================================================
Amulets
J - a circular amulet
------------ Weapons
|..........| ------- a - a +0 two-handed sword (weapon in hands)
|..........| |...... b - a +0 axe (alternate weapon; not wielded)
#...........| #....... w - 7 orcish arrows
#|{..........#######|...... G - a battle-axe
#------------ |...... P - 7 ya
### ------- Armor
## c - an uncursed +0 ring mail (being worn)
# E - a splint mail
# Comestibles
------# d - an uncursed food ration
|.....# f - 6 food rations
|....| h - 2 sprigs of wolfsbane
|....| i - a cream pie
|....-### k - 3 tripe rations
|.<..| ###### ############## Scrolls
|.d@..######################## r - a scroll labeled ETAOIN SHRDLU
------ #### u - a scroll labeled PHOL ENDE WODAN
#### z - a scroll labeled XIXAXA XOXAXA XUXAXA
Spellbooks
Wizard the Plunderer St: o - a tan spellbook
Dlvl:1 $:0 HP:16(16) Pw:2(2) AC:7 q - a wrinkled spellbook
v - a thin spellbook
---------------------------------- x - a plain spellbook
|a - +0 two-handed sword (weapon i y - a tan spellbook
|b - +0 axe (alternate weapon; not H - an indigo spellbook
|c - uncursed +0 ring mail (being W - a light blue spellbook
|d - uncursed food ration X - a velvet spellbook
|e - uncursed oil lamp Potions
|f - 6 food rations g - a brilliant blue potion
|g - brilliant blue potion j - a fizzy potion
|h - 2 sprigs of wolfsbane m - an effervescent potion
|i - cream pie B - 2 golden potions
|j - fizzy potion D - a dark green potion
|k - 3 tripe rations I - a bubbly potion
|l - moonstone ring Rings
|m - effervescent potion l - a moonstone ring
|n - tiger eye ring n - a tiger eye ring
|o - tan spellbook Y - a topaz ring
|p - tinning kit Wands
|q - wrinkled spellbook s - a crystal wand
|r - scroll labeled ETAOIN SHRDLU Tools
|s - crystal wand e - an uncursed oil lamp
|t - oil lamp p - a tinning kit
|u - scroll labeled PHOL ENDE WODA t - an oil lamp
|v - thin spellbook A - a stethoscope
|w - 7 orcish arrows C - a bugle
|x - plain spellbook F - an oil lamp
|y - tan spellbook Gems/Stones
|z - scroll labeled XIXAXA XOXAXA L - 4 blue gems
---------------------------------- (1 of 2)
===========================================================================
BEFORE THIS PATCH - menu Page 2
While the second page is displayed, there are gaping missing portions of
the map, status lines, and now the tty perm_invent window.
===========================================================================
V - a white gem
(2 of 2)
------------
|..........| -------
|..........| |......
#...........| #.......
#|{..........#######|......
#------------ |......
### -------
##
#
#
------#
|.....#
|....|
|....|
|....-###
|.<..| ###### ##############
|.d@..########################
------ ####
####
Wizard the Plunderer St:
Dlvl:1 $:0 HP:16(16) Pw:2(2) AC:7
----------------------------------
|a - +0 two-handed sword (weapon i
|b - +0 axe (alternate weapon; not
|c - uncursed +0 ring mail (being
|d - uncursed food ration
|e - uncursed oil lamp
|f - 6 food rations
|g - brilliant blue potion
|h - 2 sprigs of wolfsbane
|i - cream pie
|j - fizzy potion
|k - 3 tripe rations
|l - moonstone ring
|m - effervescent potion
|n - tiger eye ring
|o - tan spellbook
|p - tinning kit
|q - wrinkled spellbook
|r - scroll labeled ETAOIN SHRDLU
|s - crystal wand
|t - oil lamp
|u - scroll labeled PHOL ENDE WODA
|v - thin spellbook
|w - 7 orcish arrows
|x - plain spellbook
|y - tan spellbook
|z - scroll labeled XIXAXA XOXAXA
----------------------------------
===========================================================================
AFTER THIS PATCH - menu Page 2
The obliterated content of the map, status lines, and tty perm_invent
are refreshed prior to displaying menu Page 2.
===========================================================================
V - a white gem
(2 of 2)
------------ ----------------
|..........| --------------- #...............|
|..........| |.............| #|..............|
#...........| #..............| #|........^.....|
#|{..........#######|.........{...| #-+--------------
#------------ |.............| ###############
### -------------.- # #
## # # #####
# ## ----------# --------.-
# # #+........|# |........|
------# # ###|.........# |........|
|.....# # # # |...>....| ####.........|
|....| ----.--######..........#### |........|
|....| |.....|# ---------- |........|
|....-### |.....|# # |........|
|.<..| ###### ###############+......# ----------
|.d@..#########################|.....|#
------ #### -------#
#############
Wizard the Plunderer St:18/01 Dx:16 Co:18 In:8 Wi:8 Ch:6 Chaotic
Dlvl:1 $:0 HP:16(16) Pw:2(2) AC:7 Xp:1 Stressed
------------------------------------------------------------------------------
|a - +0 two-handed sword (weapon in hands|A - stethoscope |
|b - +0 axe (alternate weapon; not wielde|B - 2 golden potions |
|c - uncursed +0 ring mail (being worn) |C - bugle |
|d - uncursed food ration |D - dark green potion |
|e - uncursed oil lamp |E - splint mail |
|f - 6 food rations |F - oil lamp |
|g - brilliant blue potion |G - battle-axe |
|h - 2 sprigs of wolfsbane |H - indigo spellbook |
|i - cream pie |I - bubbly potion |
|j - fizzy potion |J - circular amulet |
|k - 3 tripe rations |L - 4 blue gems |
|l - moonstone ring |P - 7 ya |
|m - effervescent potion |V - white gem |
|n - tiger eye ring |W - light blue spellbook |
|o - tan spellbook |X - velvet spellbook |
|p - tinning kit |Y - topaz ring |
|q - wrinkled spellbook | |
|r - scroll labeled ETAOIN SHRDLU | |
|s - crystal wand | |
|t - oil lamp | |
|u - scroll labeled PHOL ENDE WODAN | |
|v - thin spellbook | |
|w - 7 orcish arrows | |
|x - plain spellbook | |
|y - tan spellbook | |
|z - scroll labeled XIXAXA XOXAXA XUXAXA | |
------------------------------------------------------------------------------
324 lines
9.9 KiB
C
324 lines
9.9 KiB
C
/* NetHack 3.7 wintty.h $NHDT-Date: 1656014599 2022/06/23 20:03:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.55 $ */
|
|
/* Copyright (c) David Cohrs, 1991,1992 */
|
|
/* NetHack may be freely redistributed. See license for details. */
|
|
|
|
#ifndef WINTTY_H
|
|
#define WINTTY_H
|
|
|
|
#define E extern
|
|
|
|
#ifndef WINDOW_STRUCTS
|
|
#define WINDOW_STRUCTS
|
|
|
|
#ifdef TTY_PERM_INVENT
|
|
enum { tty_pi_minrow = 28, tty_pi_mincol = 79 };
|
|
/* for static init of zerottycell, put pointer first */
|
|
union ttycellcontent {
|
|
glyph_info *gi;
|
|
char ttychar;
|
|
};
|
|
struct tty_perminvent_cell {
|
|
Bitfield(refresh, 1);
|
|
Bitfield(text, 1);
|
|
Bitfield(glyph, 1);
|
|
Bitfield(colorbits, 5);
|
|
union ttycellcontent content;
|
|
int32_t color;
|
|
};
|
|
#endif
|
|
|
|
/* menu structure */
|
|
typedef struct tty_mi {
|
|
struct tty_mi *next;
|
|
anything identifier; /* user identifier */
|
|
long count; /* user count */
|
|
char *str; /* description string (including accelerator) */
|
|
int attr; /* string attribute */
|
|
boolean selected; /* TRUE if selected by user */
|
|
unsigned itemflags; /* item flags */
|
|
char selector; /* keyboard accelerator */
|
|
char gselector; /* group accelerator */
|
|
} tty_menu_item;
|
|
|
|
/* descriptor for tty-based windows */
|
|
struct WinDesc {
|
|
int flags; /* window flags */
|
|
xchar type; /* type of window */
|
|
boolean active; /* true if window is active */
|
|
short offx, offy; /* offset from topleft of display */
|
|
long rows, cols; /* dimensions */
|
|
long curx, cury; /* current cursor position */
|
|
long maxrow, maxcol; /* the maximum size used -- for MENU wins */
|
|
unsigned long mbehavior; /* menu behavior flags (MENU) */
|
|
/* maxcol is also used by WIN_MESSAGE for */
|
|
/* tracking the ^P command */
|
|
short *datlen; /* allocation size for *data */
|
|
char **data; /* window data [row][column] */
|
|
char *morestr; /* string to display instead of default */
|
|
tty_menu_item *mlist; /* menu information (MENU) */
|
|
tty_menu_item **plist; /* menu page pointers (MENU) */
|
|
long plist_size; /* size of allocated plist (MENU) */
|
|
long npages; /* number of pages in menu (MENU) */
|
|
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 */
|
|
#define WIN_CANCELLED 1
|
|
#define WIN_STOP 1 /* for NHW_MESSAGE; stops output; sticks until
|
|
* next input request or reversed by WIN_NOSTOP */
|
|
#define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */
|
|
#define WIN_NOSTOP 4 /* current message has been designated as urgent;
|
|
* prevents WIN_STOP from becoming set if current
|
|
* message triggers --More-- and user types ESC
|
|
* (current message won't have been seen yet) */
|
|
|
|
/* topline states */
|
|
#define TOPLINE_EMPTY 0 /* empty */
|
|
#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */
|
|
#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */
|
|
#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */
|
|
|
|
/* descriptor for tty-based displays -- all the per-display data */
|
|
struct DisplayDesc {
|
|
short rows, cols; /* width and height of tty display */
|
|
short curx, cury; /* current cursor position on the screen */
|
|
#ifdef TEXTCOLOR
|
|
int color; /* current color */
|
|
#endif
|
|
int attrs; /* attributes in effect */
|
|
int toplin; /* flag for topl stuff */
|
|
int rawprint; /* number of raw_printed lines since synch */
|
|
int inmore; /* non-zero if more() is active */
|
|
int inread; /* non-zero if reading a character */
|
|
int intr; /* non-zero if inread was interrupted */
|
|
winid lastwin; /* last window used for I/O */
|
|
char dismiss_more; /* extra character accepted at --More-- */
|
|
int topl_utf8; /* non-zero if utf8 in str */
|
|
};
|
|
|
|
#endif /* WINDOW_STRUCTS */
|
|
|
|
#ifdef STATUS_HILITES
|
|
struct tty_status_fields {
|
|
int idx;
|
|
int color;
|
|
int attr;
|
|
int x, y;
|
|
size_t lth;
|
|
boolean valid;
|
|
boolean dirty;
|
|
boolean redraw;
|
|
boolean sanitycheck; /* was 'last_in_row' */
|
|
};
|
|
#endif
|
|
|
|
#define MAXWIN 20 /* maximum number of windows, cop-out */
|
|
|
|
/* tty dependent window types */
|
|
#ifdef NHW_BASE
|
|
#undef NHW_BASE
|
|
#endif
|
|
#define NHW_BASE (NHW_TEXT + 1)
|
|
|
|
#ifdef TTY_PERM_INVENT
|
|
#define NHW_TTYINVENT (NHW_BASE + 1)
|
|
#endif
|
|
|
|
extern struct window_procs tty_procs;
|
|
|
|
/* port specific variable declarations */
|
|
extern winid BASE_WINDOW;
|
|
|
|
extern struct WinDesc *wins[MAXWIN];
|
|
|
|
extern struct DisplayDesc *ttyDisplay; /* the tty display descriptor */
|
|
|
|
extern char morc; /* last character typed to xwaitforspace */
|
|
extern char defmorestr[]; /* default --more-- prompt */
|
|
|
|
/* port specific external function references */
|
|
|
|
/* ### getline.c ### */
|
|
E void xwaitforspace(const char *);
|
|
|
|
/* ### termcap.c, video.c ### */
|
|
|
|
E void tty_startup(int *, int *);
|
|
#ifndef NO_TERMS
|
|
E void tty_shutdown(void);
|
|
#endif
|
|
E int xputc(int);
|
|
E void xputs(const char *);
|
|
#if defined(SCREEN_VGA) || defined(SCREEN_8514)
|
|
E void xputg(const glyph_info *);
|
|
#endif
|
|
E void cl_end(void);
|
|
E void clear_screen(void);
|
|
E void home(void);
|
|
E void standoutbeg(void);
|
|
E void standoutend(void);
|
|
#if 0
|
|
E void revbeg(void);
|
|
E void boldbeg(void);
|
|
E void blinkbeg(void);
|
|
E void dimbeg(void);
|
|
E void m_end(void);
|
|
#endif
|
|
E void backsp(void);
|
|
E void graph_on(void);
|
|
E void graph_off(void);
|
|
E void cl_eos(void);
|
|
|
|
/*
|
|
* termcap.c (or facsimiles in other ports) is the right place for doing
|
|
* strange and arcane things such as outputting escape sequences to select
|
|
* a color or whatever. wintty.c should concern itself with WHERE to put
|
|
* stuff in a window.
|
|
*/
|
|
E int term_attr_fixup(int);
|
|
E void term_start_attr(int attr);
|
|
E void term_end_attr(int attr);
|
|
E void term_start_raw_bold(void);
|
|
E void term_end_raw_bold(void);
|
|
|
|
#ifdef TEXTCOLOR
|
|
E void term_end_color(void);
|
|
E void term_start_color(int color);
|
|
#endif /* TEXTCOLOR */
|
|
#ifdef ENHANCED_SYMBOLS
|
|
extern void term_start_24bitcolor(struct unicode_representation *);
|
|
extern void term_end_24bitcolor(void); /* termcap.c, consoletty.c */
|
|
#endif
|
|
|
|
/* ### topl.c ### */
|
|
|
|
E void show_topl(const char *);
|
|
E void remember_topl(void);
|
|
E void addtopl(const char *);
|
|
E void more(void);
|
|
E void update_topl(const char *);
|
|
E void putsyms(const char *);
|
|
|
|
/* ### wintty.c ### */
|
|
#ifdef CLIPPING
|
|
E void setclipped(void);
|
|
#endif
|
|
E void docorner(int, int, int);
|
|
E void end_glyphout(void);
|
|
E void g_putch(int);
|
|
#ifdef ENHANCED_SYMBOLS
|
|
#if defined(WIN32) || defined(UNIX)
|
|
E void g_pututf8(uint8 *);
|
|
#endif
|
|
#endif /* ENHANCED_SYMBOLS */
|
|
E void win_tty_init(int);
|
|
|
|
/* external declarations */
|
|
E void tty_init_nhwindows(int *, char **);
|
|
E void tty_preference_update(const char *);
|
|
E void tty_player_selection(void);
|
|
E void tty_askname(void);
|
|
E void tty_get_nh_event(void);
|
|
E void tty_exit_nhwindows(const char *);
|
|
E void tty_suspend_nhwindows(const char *);
|
|
E void tty_resume_nhwindows(void);
|
|
E winid tty_create_nhwindow(int);
|
|
E void tty_clear_nhwindow(winid);
|
|
E void tty_display_nhwindow(winid, boolean);
|
|
E void tty_dismiss_nhwindow(winid);
|
|
E void tty_destroy_nhwindow(winid);
|
|
E void tty_curs(winid, int, int);
|
|
E void tty_putstr(winid, int, const char *);
|
|
E void tty_putmixed(winid window, int attr, const char *str);
|
|
E void tty_display_file(const char *, boolean);
|
|
E void tty_start_menu(winid, unsigned long);
|
|
E void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, char,
|
|
int, const char *, unsigned int);
|
|
E void tty_end_menu(winid, const char *);
|
|
E int tty_select_menu(winid, int, MENU_ITEM_P **);
|
|
E char tty_message_menu(char, int, const char *);
|
|
E void tty_mark_synch(void);
|
|
E void tty_wait_synch(void);
|
|
#ifdef CLIPPING
|
|
E void tty_cliparound(int, int);
|
|
#endif
|
|
#ifdef POSITIONBAR
|
|
E void tty_update_positionbar(char *);
|
|
#endif
|
|
E void tty_print_glyph(winid, xchar, xchar, const glyph_info *,
|
|
const glyph_info *);
|
|
E void tty_raw_print(const char *);
|
|
E void tty_raw_print_bold(const char *);
|
|
E int tty_nhgetch(void);
|
|
E int tty_nh_poskey(int *, int *, int *);
|
|
E void tty_nhbell(void);
|
|
E int tty_doprev_message(void);
|
|
E char tty_yn_function(const char *, const char *, char);
|
|
E void tty_getlin(const char *, char *);
|
|
E int tty_get_ext_cmd(void);
|
|
E void tty_number_pad(int);
|
|
E void tty_delay_output(void);
|
|
#ifdef CHANGE_COLOR
|
|
E void tty_change_color(int color, long rgb, int reverse);
|
|
#ifdef MAC
|
|
E void tty_change_background(int white_or_black);
|
|
E short set_tty_font_name(winid, char *);
|
|
#endif
|
|
E char *tty_get_color_string(void);
|
|
#endif
|
|
E void tty_status_enablefield(int, const char *, const char *, boolean);
|
|
E void tty_status_init(void);
|
|
E void tty_status_update(int, genericptr_t, int, int, int, unsigned long *);
|
|
|
|
/* other defs that really should go away (they're tty specific) */
|
|
E void tty_start_screen(void);
|
|
E void tty_end_screen(void);
|
|
|
|
E void genl_outrip(winid, int, time_t);
|
|
|
|
E char *tty_getmsghistory(boolean);
|
|
E void tty_putmsghistory(const char *, boolean);
|
|
E void tty_update_inventory(int);
|
|
E perminvent_info *tty_update_invent_slot(winid, int, perminvent_info *);
|
|
|
|
#ifdef TTY_PERM_INVENT
|
|
E void tty_refresh_inventory(int start, int stop, int y);
|
|
#endif
|
|
|
|
#ifdef NO_TERMS
|
|
#ifdef MAC
|
|
#ifdef putchar
|
|
#undef putchar
|
|
#undef putc
|
|
#endif
|
|
#define putchar term_putc
|
|
#define fflush term_flush
|
|
#define puts term_puts
|
|
E int term_putc(int c);
|
|
E int term_flush(void *desc);
|
|
E int term_puts(const char *str);
|
|
#endif /* MAC */
|
|
#if defined(MSDOS) || defined(WIN32)
|
|
#if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32)
|
|
#undef putchar
|
|
#undef putc
|
|
#undef puts
|
|
#define putchar(x) xputc(x) /* these are in video.c, nttty.c */
|
|
#define putc(x) xputc(x)
|
|
#define puts(x) xputs(x)
|
|
#endif /*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32 */
|
|
#ifdef POSITIONBAR
|
|
E void video_update_positionbar(char *);
|
|
#endif
|
|
#endif /*MSDOS*/
|
|
#endif /*NO_TERMS*/
|
|
|
|
#undef E
|
|
|
|
#endif /* WINTTY_H */
|