add MALE, FEMALE, and gender-neutral names for individual monster species
to the mons array. The gender-neutral name (NEUTRAL) is mandatory, the
MALE and FEMALE versions are not.
replace code uses of the mname field of permonst with one of the three
potentially-available gender-specific names.
consolidate some separate mons entries that differed only by species into a
single mons entry (caveman, cavewoman and priest,priestess etc.)
consolidate several "* lord" and "* queen/* king" monst entries into
their single species, and allow both genders on some where it makes some
sense (there is probably more work and cleanup to come out of this at some
point, and the chosen gender-neutral name variations are not cast in stone
if someone has better suggestions).
related function or macro additions:
pmname(pm, gender) to get the gender variation of the permonst name. It
guards against monsters that haven't got anything except NEUTRAL naming
and falls back to the NEUTRAL version if FEMALE and MALE versions are
missing.
Ugender to obtain the current hero gender.
Mgender(mtmp) to obtain the gender of a monster
While the code can safely refer directly to pmnames[NEUTRAL] safely in the
code because it always exists, the other two (pmnames[MALE] and
pmnames[FEMALE] may not exist so use:
pmname(ptr, gidx)
where -ptr is a permonst *
-gidx is an index into the pmnames array field of the
permonst struct
pmname() checks for a valid index and checks for null-pointers for
pmnames[MALE] and pmnames[FEMALE], and will fall back to pmnames[NEUTRAL] if
the pointer requested if the requested variation is unavailable, or if the
gidx is out-of-range.
Allow code to specify makemon flags to request female or male (via MM_MALE
and MM_FEMALE flags respectively)to makedefs, since the species alone doesn't
distinguish male/female anymore. Specifying MM_MALE or MM_FEMALE won't
override the pm M2_MALE and M2_FEMALE flags on a mons[] entry.
male and female tiles have been added to win/share/monsters.txt.
The majority are duplicated placeholders except for those that were
separate mons entries before. Perhaps someone will contribute artwork in the
future to make the male and female variations visually distinguishable.
tilemapping via has the MALE tile indexes in the glyph2tile[]
array produced at build time. If a window port has information that the
FEMALE tile is required, it just has to increment the index returned
from the glyph2tile[] array by 1.
statues already preserved gender of the monster through STATUE_FEMALE
and STATUE_MALE, so ensure that pmnames takes that into consideration.
I expect some refinement will be required after broad play-testing puts it to
the test.
consolidate caveman,cavewoman and priest,priestess monst.c entries etc
This commit will require a bump of editlevel in patchlevel.h because it alters
the index numbers of the monsters due to the consolidation of some. Those
index numbers are saved in some other structures, even though the mons[] array
itself is not part of the savefile.
Window Port Interface Change
Also add a parameter to print_glyph to convey additional information beyond
the glyph to the window ports. Every single window port was calling back to
mapglyph for the information anyway, so just included it in the interface and
produce the information right in the display core.
The mapglyph() function uses will be eliminated, although there are still some
in the code yet to be dealt with.
win32, tty, x11, Qt, msdos window ports have all had adjustments done to
utilize the new parameter instead of calling mapglyph, but some of those
window ports have not been thoroughly tested since the changes.
Interface change additional info:
print_glyph(window, x, y, glyph, bkglyph, *glyphmod)
-- Print the glyph at (x,y) on the given window. Glyphs are
integers at the interface, mapped to whatever the window-
port wants (symbol, font, color, attributes, ...there's
a 1-1 map between glyphs and distinct things on the map).
-- bkglyph is a background glyph for potential use by some
graphical or tiled environments to allow the depiction
to fall against a background consistent with the grid
around x,y. If bkglyph is NO_GLYPH, then the parameter
should be ignored (do nothing with it).
-- glyphmod provides extended information about the glyph
that window ports can use to enhance the display in
various ways.
unsigned int glyphmod[NUM_GLYPHMOD]
where:
glyphmod[GM_TTYCHAR] is the text characters associated
with the original NetHack display.
glyphmod[GM_FLAGS] are the special flags that denote
additional information that window
ports can use.
glyphmod[GM_COLOR] is the text character
color associated with the original
NetHack display.
Support for including the glyphmod info in the display glyph buffer
alongside the glyph itself was added and is the default operation.
That can be turned off by defining UNBUFFERED_GLYPHMOD at compile time.
With UNBUFFERED_GLYPHMOD operation, a call will be placed to map_glyphmod()
immediately prior to every print_glyph() call.
279 lines
8.9 KiB
C
279 lines
8.9 KiB
C
/* NetHack 3.7 wintty.h $NHDT-Date: 1596498572 2020/08/03 23:49:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ */
|
|
/* 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
|
|
|
|
/* 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) */
|
|
};
|
|
|
|
/* window flags */
|
|
#define WIN_CANCELLED 1
|
|
#define WIN_STOP 1 /* for NHW_MESSAGE; stops output */
|
|
#define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */
|
|
|
|
/* 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-- */
|
|
};
|
|
|
|
#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 6
|
|
|
|
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 FDECL(xwaitforspace, (const char *));
|
|
|
|
/* ### termcap.c, video.c ### */
|
|
|
|
E void FDECL(tty_startup, (int *, int *));
|
|
#ifndef NO_TERMS
|
|
E void NDECL(tty_shutdown);
|
|
#endif
|
|
E int FDECL(xputc, (int));
|
|
E void FDECL(xputs, (const char *));
|
|
#if defined(SCREEN_VGA) || defined(SCREEN_8514)
|
|
E void FDECL(xputg, (int, int, unsigned));
|
|
#endif
|
|
E void NDECL(cl_end);
|
|
E void NDECL(clear_screen);
|
|
E void NDECL(home);
|
|
E void NDECL(standoutbeg);
|
|
E void NDECL(standoutend);
|
|
#if 0
|
|
E void NDECL(revbeg);
|
|
E void NDECL(boldbeg);
|
|
E void NDECL(blinkbeg);
|
|
E void NDECL(dimbeg);
|
|
E void NDECL(m_end);
|
|
#endif
|
|
E void NDECL(backsp);
|
|
E void NDECL(graph_on);
|
|
E void NDECL(graph_off);
|
|
E void NDECL(cl_eos);
|
|
|
|
/*
|
|
* 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 FDECL(term_attr_fixup, (int));
|
|
E void FDECL(term_start_attr, (int attr));
|
|
E void FDECL(term_end_attr, (int attr));
|
|
E void NDECL(term_start_raw_bold);
|
|
E void NDECL(term_end_raw_bold);
|
|
|
|
#ifdef TEXTCOLOR
|
|
E void NDECL(term_end_color);
|
|
E void FDECL(term_start_color, (int color));
|
|
#endif /* TEXTCOLOR */
|
|
|
|
/* ### topl.c ### */
|
|
|
|
E void FDECL(show_topl, (const char *));
|
|
E void NDECL(remember_topl);
|
|
E void FDECL(addtopl, (const char *));
|
|
E void NDECL(more);
|
|
E void FDECL(update_topl, (const char *));
|
|
E void FDECL(putsyms, (const char *));
|
|
|
|
/* ### wintty.c ### */
|
|
#ifdef CLIPPING
|
|
E void NDECL(setclipped);
|
|
#endif
|
|
E void FDECL(docorner, (int, int));
|
|
E void NDECL(end_glyphout);
|
|
E void FDECL(g_putch, (int));
|
|
E void FDECL(win_tty_init, (int));
|
|
|
|
/* external declarations */
|
|
E void FDECL(tty_init_nhwindows, (int *, char **));
|
|
E void FDECL(tty_preference_update, (const char *));
|
|
E void NDECL(tty_player_selection);
|
|
E void NDECL(tty_askname);
|
|
E void NDECL(tty_get_nh_event);
|
|
E void FDECL(tty_exit_nhwindows, (const char *));
|
|
E void FDECL(tty_suspend_nhwindows, (const char *));
|
|
E void NDECL(tty_resume_nhwindows);
|
|
E winid FDECL(tty_create_nhwindow, (int));
|
|
E void FDECL(tty_clear_nhwindow, (winid));
|
|
E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P));
|
|
E void FDECL(tty_dismiss_nhwindow, (winid));
|
|
E void FDECL(tty_destroy_nhwindow, (winid));
|
|
E void FDECL(tty_curs, (winid, int, int));
|
|
E void FDECL(tty_putstr, (winid, int, const char *));
|
|
E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
|
|
E void FDECL(tty_start_menu, (winid, unsigned long));
|
|
E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int,
|
|
const char *, unsigned int));
|
|
E void FDECL(tty_end_menu, (winid, const char *));
|
|
E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
|
|
E char FDECL(tty_message_menu, (CHAR_P, int, const char *));
|
|
E void NDECL(tty_update_inventory);
|
|
E void NDECL(tty_mark_synch);
|
|
E void NDECL(tty_wait_synch);
|
|
#ifdef CLIPPING
|
|
E void FDECL(tty_cliparound, (int, int));
|
|
#endif
|
|
#ifdef POSITIONBAR
|
|
E void FDECL(tty_update_positionbar, (char *));
|
|
#endif
|
|
E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int, unsigned *));
|
|
E void FDECL(tty_raw_print, (const char *));
|
|
E void FDECL(tty_raw_print_bold, (const char *));
|
|
E int NDECL(tty_nhgetch);
|
|
E int FDECL(tty_nh_poskey, (int *, int *, int *));
|
|
E void NDECL(tty_nhbell);
|
|
E int NDECL(tty_doprev_message);
|
|
E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P));
|
|
E void FDECL(tty_getlin, (const char *, char *));
|
|
E int NDECL(tty_get_ext_cmd);
|
|
E void FDECL(tty_number_pad, (int));
|
|
E void NDECL(tty_delay_output);
|
|
#ifdef CHANGE_COLOR
|
|
E void FDECL(tty_change_color, (int color, long rgb, int reverse));
|
|
#ifdef MAC
|
|
E void FDECL(tty_change_background, (int white_or_black));
|
|
E short FDECL(set_tty_font_name, (winid, char *));
|
|
#endif
|
|
E char *NDECL(tty_get_color_string);
|
|
#endif
|
|
E void FDECL(tty_status_enablefield,
|
|
(int, const char *, const char *, BOOLEAN_P));
|
|
E void NDECL(tty_status_init);
|
|
E void FDECL(tty_status_update, (int, genericptr_t, int, int, int, unsigned long *));
|
|
|
|
/* other defs that really should go away (they're tty specific) */
|
|
E void NDECL(tty_start_screen);
|
|
E void NDECL(tty_end_screen);
|
|
|
|
E void FDECL(genl_outrip, (winid, int, time_t));
|
|
|
|
E char *FDECL(tty_getmsghistory, (BOOLEAN_P));
|
|
E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P));
|
|
|
|
#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 FDECL(term_putc, (int c));
|
|
E int FDECL(term_flush, (void *desc));
|
|
E int FDECL(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 FDECL(video_update_positionbar, (char *));
|
|
#endif
|
|
#endif /*MSDOS*/
|
|
#endif /*NO_TERMS*/
|
|
|
|
#undef E
|
|
|
|
#endif /* WINTTY_H */
|