]> granicus.if.org Git - nethack/commitdiff
X11 hilite_pet
authorcohrs <cohrs>
Sun, 12 Oct 2003 03:55:17 +0000 (03:55 +0000)
committercohrs <cohrs>
Sun, 12 Oct 2003 03:55:17 +0000 (03:55 +0000)
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
src/read.c
win/X11/winmap.c

index 82bfbc23443ffc281150dc22df99f181f90e4a90..8931658e9dce53219923accd754a8621968da3e9 100644 (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
        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
index fe4d73f1e96e4515d4f966e453829c1c255730f8..3fce39ac0679b71f78a3c8b6100ac5b33f5a4d95 100644 (file)
@@ -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);
index cc85399feddf07c3430e11de3bbbcfc94547599a..024ba51fcb7e3d9d3bc89ede40ba4ccac87d43ed 100644 (file)
@@ -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),