pmnames mons gender naming plus a window port interface change
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.
This commit is contained in:
+48
-27
@@ -37,8 +37,8 @@ typedef struct mswin_nethack_map_window {
|
||||
|
||||
int map[COLNO][ROWNO]; /* glyph map */
|
||||
int bkmap[COLNO][ROWNO]; /* backround glyph map */
|
||||
unsigned glyphmod[COLNO][ROWNO][NUM_GLYPHMOD];
|
||||
boolean mapDirty[COLNO][ROWNO]; /* dirty flag for map */
|
||||
|
||||
int mapMode; /* current map mode */
|
||||
boolean bAsciiMode; /* switch ASCII/tiled mode */
|
||||
boolean bFitToScreenMode; /* switch Fit map to screen mode on/off */
|
||||
@@ -86,7 +86,7 @@ static void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut);
|
||||
static void paint(PNHMapWindow data, int i, int j);
|
||||
static void dirtyAll(PNHMapWindow data);
|
||||
static void dirty(PNHMapWindow data, int i, int j);
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg);
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg, unsigned *glyphmod);
|
||||
static void clearAll(PNHMapWindow data);
|
||||
|
||||
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
|
||||
@@ -639,7 +639,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
case MSNH_MSG_PRINT_GLYPH: {
|
||||
PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph) lParam;
|
||||
setGlyph(data, msg_data->x, msg_data->y,
|
||||
msg_data->glyph, msg_data->bkglyph);
|
||||
msg_data->glyph, msg_data->bkglyph, msg_data->glyphmod);
|
||||
} break;
|
||||
|
||||
case MSNH_MSG_CLIPAROUND: {
|
||||
@@ -708,8 +708,10 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
PMSNHMsgGetText msg_data = (PMSNHMsgGetText) lParam;
|
||||
size_t index;
|
||||
int col, row;
|
||||
#if 0
|
||||
int color;
|
||||
unsigned special;
|
||||
unsigned special = 0U;
|
||||
#endif
|
||||
int mgch;
|
||||
|
||||
index = 0;
|
||||
@@ -717,13 +719,14 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
for (col = 0; col < COLNO; col++) {
|
||||
if (index >= msg_data->max_size)
|
||||
break;
|
||||
if (data->map[col][row] == NO_GLYPH) {
|
||||
if (data->map[col][row] == NO_GLYPH)
|
||||
mgch = ' ';
|
||||
} else {
|
||||
(void) mapglyph(data->map[col][row], &mgch, &color,
|
||||
&special, col, row, 0);
|
||||
}
|
||||
msg_data->buffer[index] = mgch;
|
||||
|
||||
// } else {
|
||||
// (void) mapglyph(data->map[col][row], &mgch, &color,
|
||||
// &special, col, row, 0);
|
||||
// }
|
||||
msg_data->buffer[index] = data->glyphmod[col][row][GM_TTYCHAR];
|
||||
index++;
|
||||
}
|
||||
if (index >= msg_data->max_size - 1)
|
||||
@@ -785,9 +788,9 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
int glyph, bkglyph;
|
||||
int layer;
|
||||
#ifdef USE_PILEMARK
|
||||
int color;
|
||||
unsigned special;
|
||||
int mgch;
|
||||
// int color;
|
||||
// unsigned special = 0U;
|
||||
// int mgch;
|
||||
#endif
|
||||
layer = 0;
|
||||
glyph = data->map[i][j];
|
||||
@@ -811,8 +814,16 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
layer++;
|
||||
}
|
||||
|
||||
// (void) mapglyph(glyph, &mgch, &color, &special, i, j, 0);
|
||||
// mgch = (int) data.glyphmod[GM_TTYCHAR];
|
||||
// color = (int) data.glyphmod[GM_COLOR];
|
||||
// special = glyphmod[GM_FLAGS];
|
||||
|
||||
if ((glyph != NO_GLYPH) && (glyph != bkglyph)) {
|
||||
/* rely on NetHack core helper routine */
|
||||
ntile = glyph2tile[glyph];
|
||||
if (data->glyphmod[i][j][GM_FLAGS] & MG_FEMALE)
|
||||
ntile++;
|
||||
t_x = TILEBMP_X(ntile);
|
||||
t_y = TILEBMP_Y(ntile);
|
||||
|
||||
@@ -834,9 +845,9 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
|
||||
#ifdef USE_PILEMARK
|
||||
/* rely on NetHack core helper routine */
|
||||
(void) mapglyph(data->map[i][j], &mgch, &color, &special,
|
||||
i, j, 0);
|
||||
if ((glyph != NO_GLYPH) && (special & MG_PET)
|
||||
// (void) mapglyph(data->map[i][j], &mgch, &color, &special,
|
||||
// i, j, 0);
|
||||
if ((glyph != NO_GLYPH) && (data->glyphmod[i][j][GM_FLAGS] & MG_PET)
|
||||
#else
|
||||
if ((glyph != NO_GLYPH) && glyph_is_pet(glyph)
|
||||
#endif
|
||||
@@ -859,7 +870,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
DeleteDC(hdcPetMark);
|
||||
}
|
||||
#ifdef USE_PILEMARK
|
||||
if ((glyph != NO_GLYPH) && (special & MG_OBJPILE)
|
||||
if ((glyph != NO_GLYPH) && (data->glyphmod[i][j][GM_FLAGS] & MG_OBJPILE)
|
||||
&& iflags.hilite_pile) {
|
||||
/* apply pilemark transparently over other image */
|
||||
HDC hdcPileMark;
|
||||
@@ -893,8 +904,8 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
char ch;
|
||||
WCHAR wch;
|
||||
int color;
|
||||
unsigned special;
|
||||
int mgch;
|
||||
// unsigned special;
|
||||
// int mgch;
|
||||
HBRUSH back_brush;
|
||||
COLORREF OldFg;
|
||||
|
||||
@@ -909,11 +920,12 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
OldFg = SetTextColor(hDC, nhcolor_to_RGB(color));
|
||||
#else
|
||||
/* rely on NetHack core helper routine */
|
||||
(void) mapglyph(data->map[i][j], &mgch, &color,
|
||||
&special, i, j, 0);
|
||||
ch = (char) mgch;
|
||||
if (((special & MG_PET) && iflags.hilite_pet)
|
||||
|| ((special & (MG_DETECT | MG_BW_LAVA))
|
||||
// (void) mapglyph(data->map[i][j], &mgch, &color,
|
||||
// &special, i, j, 0);
|
||||
ch = (char) data->glyphmod[i][j][GM_TTYCHAR];
|
||||
color = (int) data->glyphmod[i][j][GM_COLOR];
|
||||
if (((data->glyphmod[i][j][GM_FLAGS] & MG_PET) && iflags.hilite_pet)
|
||||
|| ((data->glyphmod[i][j][GM_FLAGS] & (MG_DETECT | MG_BW_LAVA))
|
||||
&& iflags.use_inverse)) {
|
||||
back_brush =
|
||||
CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY));
|
||||
@@ -972,13 +984,19 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
}
|
||||
}
|
||||
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg)
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg, unsigned *glyphmod)
|
||||
{
|
||||
if ((data->map[i][j] != fg) || (data->bkmap[i][j] != bg)) {
|
||||
int gm;
|
||||
|
||||
if ((data->map[i][j] != fg) || (data->bkmap[i][j] != bg)
|
||||
|| data->glyphmod[i][j][GM_TTYCHAR] != glyphmod[GM_TTYCHAR]
|
||||
|| data->glyphmod[i][j][GM_COLOR] != glyphmod[GM_COLOR]
|
||||
|| data->glyphmod[i][j][GM_FLAGS] != glyphmod[GM_FLAGS]) {
|
||||
data->map[i][j] = fg;
|
||||
data->bkmap[i][j] = bg;
|
||||
data->mapDirty[i][j] = TRUE;
|
||||
|
||||
for (gm = 0; gm < NUM_GLYPHMOD; ++gm)
|
||||
data->glyphmod[i][j][gm] = glyphmod[gm];
|
||||
RECT rect;
|
||||
nhcoord2display(data, i, j, &rect);
|
||||
InvalidateRect(data->hWnd, &rect, FALSE);
|
||||
@@ -991,6 +1009,9 @@ static void clearAll(PNHMapWindow data)
|
||||
for (int y = 0; y < ROWNO; y++) {
|
||||
data->map[x][y] = NO_GLYPH;
|
||||
data->bkmap[x][y] = NO_GLYPH;
|
||||
data->glyphmod[x][y][GM_TTYCHAR] = ' ';
|
||||
data->glyphmod[x][y][GM_COLOR] = NO_COLOR;
|
||||
data->glyphmod[x][y][GM_FLAGS] = 0U;
|
||||
data->mapDirty[x][y] = TRUE;
|
||||
}
|
||||
InvalidateRect(data->hWnd, NULL, FALSE);
|
||||
|
||||
Reference in New Issue
Block a user