From 174e6f47b30d522c45f2e2b67223b287f74a9216 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 9 Jun 2015 16:54:44 +0300 Subject: [PATCH] TTY: Hilight piles of objects Add MG_OBJPILE flag, which windowports can use to check if a location has more than one object stack. If use_inverse is on, TTY will use inverse to show such piles. If a boulder is the topmost item on a pile, then the object pile flag is not used; mainly because boulders are "solid", boulders dropped by monsters are nearly always over other objects, and so that special levels such a Sokoban can "hide" items under the boulders. TODO: a "pilemark", analogous to "petmark", perhaps a green plus sign, which can be used by windowports with tiles. --- include/hack.h | 1 + src/mapglyph.c | 6 ++++++ win/tty/wintty.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/hack.h b/include/hack.h index aaf671706..1320faccc 100644 --- a/include/hack.h +++ b/include/hack.h @@ -60,6 +60,7 @@ #define MG_PET 0x08 #define MG_RIDDEN 0x10 #define MG_STATUE 0x20 +#define MG_OBJPILE 0x40 /* more than one stack of objects */ /* sellobj_state() states */ #define SELL_NORMAL (0) diff --git a/src/mapglyph.c b/src/mapglyph.c index c4537fe97..23c582762 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -83,6 +83,8 @@ unsigned *ospecial; else obj_color(STATUE); special |= MG_STATUE; + if (level.objects[x][y] && level.objects[x][y]->nexthere) + special |= MG_OBJPILE; } else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */ idx = offset + SYM_OFF_W; @@ -149,6 +151,8 @@ unsigned *ospecial; } } else obj_color(offset); + if (offset != BOULDER && level.objects[x][y] && level.objects[x][y]->nexthere) + special |= MG_OBJPILE; } else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */ idx = mons[offset].mlet + SYM_OFF_M; if (has_rogue_color) @@ -166,6 +170,8 @@ unsigned *ospecial; else mon_color(offset); special |= MG_CORPSE; + if (level.objects[x][y] && level.objects[x][y]->nexthere) + special |= MG_OBJPILE; } else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */ idx = mons[offset].mlet + SYM_OFF_M; if (has_rogue_color) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index df28f485f..50c0ffb67 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3040,7 +3040,7 @@ int glyph, bkglyph; /* must be after color check; term_end_color may turn off inverse too */ if (((special & MG_PET) && iflags.hilite_pet) - || ((special & MG_DETECT) && iflags.use_inverse)) { + || ((special & (MG_DETECT|MG_OBJPILE)) && iflags.use_inverse)) { term_start_attr(ATR_INVERSE); reverse_on = TRUE; }