Qt: paper doll display of BUC status

When items in the paper doll inventory subset (primary worn and
wielded items) have known BUC state, indicate what that is.  It
now draws a one pixel wide white border around each doll tile,
and if BUC is known, that border gets its color changed (red for
known cursed, yellow for known uncursed, cyan for known blessed).
That isn't very visual so the first pixel inside the tile is
overwritten with the same color, and alternating pixels are also
overwritten for the second rectangle within.  The 2..3 pixel wide
border is visible without cluttering the tile for 'normal' sized
paper doll.  The tiles are allowed to be scrunched down to as
small as 6x6 so there won't be much left after 1 or 2 around the
edge are replaced.

Initially I was going to try to highlight welded items but the
more general BUC highlighting is simpler and usually more useful
to the player.

The qt_map.* bits are just reformatting.  I was looking at pet
and pile annotations as a way to do BUC annotations but decided
not to attempt that.
This commit is contained in:
PatR
2020-08-17 15:41:33 -07:00
parent 3a07880684
commit 26060634f6
6 changed files with 117 additions and 18 deletions

View File

@@ -63,7 +63,8 @@ NetHackQtMapViewport::NetHackQtMapViewport(NetHackQtClickBuffer& click_sink) :
clicksink(click_sink),
change(10)
{
pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm);
pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm
: pet_mark_xpm);
pile_annotation = QPixmap(pile_mark_xpm);
Clear();
@@ -153,9 +154,13 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
}
#ifdef TEXTCOLOR
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pet_annotation);
} else if (((special & MG_OBJPILE) != 0) && ::iflags.hilite_pile) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pile_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pile_annotation);
}
#endif
}
@@ -173,9 +178,13 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
qt_settings->glyphs().drawCell(painter, g, i, j);
#ifdef TEXTCOLOR
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pet_annotation);
} else if (((special & MG_OBJPILE) != 0) && ::iflags.hilite_pile) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pile_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pile_annotation);
}
#endif
}
@@ -646,7 +655,8 @@ NetHackQtMapWindow::NetHackQtMapWindow(NetHackQtClickBuffer& click_sink) :
palette.setColor(viewport.backgroundRole(), Qt::black);
viewport.setPalette(palette);
pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm);
pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm
: pet_mark_xpm);
pile_annotation = QPixmap(pile_mark_xpm);
cursor.setX(0);
@@ -836,9 +846,13 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
);
#ifdef TEXTCOLOR
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pet_annotation);
} else if (((special & MG_OBJPILE) != 0) && ::iflags.hilite_pile) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pile_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pile_annotation);
}
#endif
}
@@ -856,9 +870,13 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
qt_settings->glyphs().drawCell(painter, g, i, j);
#ifdef TEXTCOLOR
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pet_annotation);
} else if (((special & MG_OBJPILE) != 0) && ::iflags.hilite_pile) {
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pile_annotation);
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
j*qt_settings->glyphs().height()),
pile_annotation);
}
#endif
}