X11 hilite_pet

Add support for hilite_pet to X11 text map mode (hilite_pet was already
supported when tiles were enabled).  While testing this, I found a missing
newsym() in the code implementing the creation of a "tame" monster.
This commit is contained in:
cohrs
2003-10-12 03:55:17 +00:00
parent 9cca788ef0
commit f6425ee3c5
3 changed files with 13 additions and 5 deletions

View File

@@ -53,6 +53,7 @@ platforms that support hangup: SAFERHANGUP to avoid losing objects in transit
between lists when hangup occurs, and also avoid cheats due to between lists when hangup occurs, and also avoid cheats due to
well-timed hangups to stop a long melee well-timed hangups to stop a long melee
X11: support dynamic switching of map mode via tiled_map option X11: support dynamic switching of map mode via tiled_map option
X11: added support for hilite_pet to text map mode
General New Features General New Features

View File

@@ -1889,6 +1889,7 @@ create_particular()
if (mtmp) { if (mtmp) {
initedog(mtmp); initedog(mtmp);
set_malign(mtmp); set_malign(mtmp);
newsym(mtmp->mx, mtmp->my);
} }
} else { } else {
mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS); mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS);

View File

@@ -120,6 +120,7 @@ X11_print_glyph(window, x, y, glyph)
{ {
*ch_ptr = ch; *ch_ptr = ch;
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if ((special & MG_PET) && iflags.hilite_pet) color += CLR_MAX;
*co_ptr = color; *co_ptr = color;
#endif #endif
if (!map_info->is_tile) update_bbox = TRUE; if (!map_info->is_tile) update_bbox = TRUE;
@@ -1188,10 +1189,9 @@ map_exposed(w, client_data, widget_data)
/* /*
* Do the actual work of the putting characters onto our X window. This * Do the actual work of the putting characters onto our X window. This
* is called from the expose event routine, the display window (flush) * is called from the expose event routine, the display window (flush)
* routine, and the display cursor routine. The later is a kludge that * routine, and the display cursor routine. The later involves inverting
* involves the inverted parameter of this function. A better solution * the foreground and background colors, which are also inverted when the
* would be to double the color count, with any color above CLR_MAX * position's color is above CLR_MAX.
* being inverted.
* *
* This works for rectangular regions (this includes one line rectangles). * This works for rectangular regions (this includes one line rectangles).
* The start and stop columns are *inclusive*. * The start and stop columns are *inclusive*.
@@ -1292,6 +1292,7 @@ map_update(wp, start_row, stop_row, start_col, stop_col, inverted)
register char *c_ptr; register char *c_ptr;
char *t_ptr; char *t_ptr;
int cur_col, color, win_ystart; int cur_col, color, win_ystart;
boolean cur_inv;
for (row = start_row; row <= stop_row; row++) { for (row = start_row; row <= stop_row; row++) {
win_ystart = text_map->square_ascent + win_ystart = text_map->square_ascent +
@@ -1302,14 +1303,19 @@ map_update(wp, start_row, stop_row, start_col, stop_col, inverted)
cur_col = start_col; cur_col = start_col;
while (cur_col <= stop_col) { while (cur_col <= stop_col) {
color = *c_ptr++; color = *c_ptr++;
cur_inv = inverted;
count = 1; count = 1;
while ((cur_col + count) <= stop_col && *c_ptr == color) { while ((cur_col + count) <= stop_col && *c_ptr == color) {
count++; count++;
c_ptr++; c_ptr++;
} }
if (color >= CLR_MAX) {
color -= CLR_MAX;
cur_inv = !cur_inv;
}
XDrawImageString(XtDisplay(wp->w), XtWindow(wp->w), XDrawImageString(XtDisplay(wp->w), XtWindow(wp->w),
inverted ? text_map->inv_color_gcs[color] : cur_inv ? text_map->inv_color_gcs[color] :
text_map->color_gcs[color], text_map->color_gcs[color],
text_map->square_lbearing + text_map->square_lbearing +
(text_map->square_width * cur_col), (text_map->square_width * cur_col),