From f6425ee3c5f1254e569c6d9db4e0a1c58efebd3e Mon Sep 17 00:00:00 2001 From: cohrs Date: Sun, 12 Oct 2003 03:55:17 +0000 Subject: [PATCH] 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. --- doc/fixes35.0 | 1 + src/read.c | 1 + win/X11/winmap.c | 16 +++++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 82bfbc234..8931658e9 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 well-timed hangups to stop a long melee X11: support dynamic switching of map mode via tiled_map option +X11: added support for hilite_pet to text map mode General New Features diff --git a/src/read.c b/src/read.c index fe4d73f1e..3fce39ac0 100644 --- a/src/read.c +++ b/src/read.c @@ -1889,6 +1889,7 @@ create_particular() if (mtmp) { initedog(mtmp); set_malign(mtmp); + newsym(mtmp->mx, mtmp->my); } } else { mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS); diff --git a/win/X11/winmap.c b/win/X11/winmap.c index cc85399fe..024ba51fc 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -120,6 +120,7 @@ X11_print_glyph(window, x, y, glyph) { *ch_ptr = ch; #ifdef TEXTCOLOR + if ((special & MG_PET) && iflags.hilite_pet) color += CLR_MAX; *co_ptr = color; #endif 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 * is called from the expose event routine, the display window (flush) - * routine, and the display cursor routine. The later is a kludge that - * involves the inverted parameter of this function. A better solution - * would be to double the color count, with any color above CLR_MAX - * being inverted. + * routine, and the display cursor routine. The later involves inverting + * the foreground and background colors, which are also inverted when the + * position's color is above CLR_MAX. * * This works for rectangular regions (this includes one line rectangles). * 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; char *t_ptr; int cur_col, color, win_ystart; + boolean cur_inv; for (row = start_row; row <= stop_row; row++) { 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; while (cur_col <= stop_col) { color = *c_ptr++; + cur_inv = inverted; count = 1; while ((cur_col + count) <= stop_col && *c_ptr == color) { count++; c_ptr++; } + if (color >= CLR_MAX) { + color -= CLR_MAX; + cur_inv = !cur_inv; + } 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->square_lbearing + (text_map->square_width * cur_col), -- 2.40.0