black&white lava

Add MG_BW_LAVA to mapglyph() instead of hijacking MG_DETECT.  Used
to display lava in inverse video if color is disabled and lava is
using the same display character as water (which is the default).
(The use_inverse option must be enabled for tty to honor it.  X11's
text mode doesn't care.  Win32 does care but probably shouldn't--it's
not a case like tty where the hardware might not support it.)

This implements both MG_DETECT and MG_BW_LAVA for X11, but only if
the program is built with TEXTCOLOR enabled.  Those should work even
when color is not supported, but I suspect that configuration is
unlikely to ever be used so didn't want to spend the time to figure
out how to do it.  (The relevant data is overloaded on the color
data, so not available when TEXTCOLOR is disabled.)

The win32 revision is untested.
This commit is contained in:
PatR
2016-05-28 00:51:54 -07:00
parent 4341be8c89
commit 6459b5d301
5 changed files with 27 additions and 19 deletions

View File

@@ -124,8 +124,9 @@ int bkglyph UNUSED;
}
#ifdef TEXTCOLOR
co_ptr = &map_info->text_map.colors[y][x];
colordif = (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_OBJPILE) && iflags.hilite_pile))
colordif = (((special & MG_PET) != 0 && iflags.hilite_pet)
|| ((special & MG_OBJPILE) != 0 && iflags.hilite_pile)
|| ((special & (MG_DETECT | MG_BW_LAVA)) != 0))
? CLR_MAX : 0;
if (*co_ptr != (uchar) (color + colordif)) {
*co_ptr = (uchar) (color + colordif);
@@ -1223,7 +1224,7 @@ XtPointer widget_data; /* expose event from Window widget */
/*
* Do the actual work of the putting characters onto our X window. This
* is called from the expose event routine, the display window (flush)
* routine, and the display cursor routine. The later involves inverting
* routine, and the display cursor routine. The last involves inverting
* the foreground and background colors, which are also inverted when the
* position's color is above CLR_MAX.
*
@@ -1332,7 +1333,7 @@ boolean inverted;
struct text_map_info_t *text_map = &map_info->text_map;
#ifdef TEXTCOLOR
if (iflags.use_color) {
{
register char *c_ptr;
char *t_ptr;
int cur_col, color, win_ystart;
@@ -1359,8 +1360,13 @@ boolean inverted;
}
XDrawImageString(XtDisplay(wp->w), XtWindow(wp->w),
cur_inv ? text_map->inv_color_gcs[color]
: text_map->color_gcs[color],
iflags.use_color
? (cur_inv
? text_map->inv_color_gcs[color]
: text_map->color_gcs[color])
: (cur_inv
? text_map->inv_copy_gc
: text_map->copy_gc),
text_map->square_lbearing
+ (text_map->square_width * cur_col),
win_ystart, t_ptr, count);
@@ -1370,8 +1376,8 @@ boolean inverted;
cur_col += count;
} /* col loop */
} /* row loop */
} else
#endif /* TEXTCOLOR */
}
#else /* !TEXTCOLOR */
{
int win_row, win_xstart;
@@ -1393,6 +1399,7 @@ boolean inverted;
count);
}
}
#endif /* ?TEXTCOLOR */
}
}

View File

@@ -3220,7 +3220,8 @@ int bkglyph UNUSED;
/* must be after color check; term_end_color may turn off inverse too */
if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_OBJPILE) && iflags.hilite_pile)
|| ((special & MG_DETECT) && iflags.use_inverse)) {
|| ((special & MG_DETECT) && iflags.use_inverse)
|| ((special & MG_BW_LAVA) && iflags.use_inverse)) {
term_start_attr(ATR_INVERSE);
reverse_on = TRUE;
}

View File

@@ -682,7 +682,7 @@ onPaint(HWND hWnd)
&special, i, j);
ch = (char) mgch;
if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_DETECT)
|| ((special & (MG_DETECT | MG_BW_LAVA))
&& iflags.use_inverse)) {
back_brush =
CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY));