Qt4: Pile mark
This commit is contained in:
@@ -946,6 +946,20 @@ static const char *pet_mark_small_xpm[] = {
|
|||||||
"..X.."
|
"..X.."
|
||||||
};
|
};
|
||||||
/* XPM */
|
/* XPM */
|
||||||
|
static const char *pile_mark_xpm[] = {
|
||||||
|
/* width height ncolors chars_per_pixel */
|
||||||
|
"5 5 2 1",
|
||||||
|
/* colors */
|
||||||
|
". c None",
|
||||||
|
"X c #00FF00",
|
||||||
|
/* pixels */
|
||||||
|
"..X..",
|
||||||
|
"..X..",
|
||||||
|
"XXXXX",
|
||||||
|
"..X..",
|
||||||
|
"..X.."
|
||||||
|
};
|
||||||
|
/* XPM */
|
||||||
static const char *satiated_xpm[] = {
|
static const char *satiated_xpm[] = {
|
||||||
/* width height ncolors chars_per_pixel */
|
/* width height ncolors chars_per_pixel */
|
||||||
"40 40 23 1",
|
"40 40 23 1",
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ NetHackQtMapViewport::NetHackQtMapViewport(NetHackQtClickBuffer& click_sink) :
|
|||||||
change(10)
|
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();
|
Clear();
|
||||||
cursor.setX(0);
|
cursor.setX(0);
|
||||||
@@ -157,29 +158,33 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
|
|||||||
QString(QChar(ch)).left(1)
|
QString(QChar(ch)).left(1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (glyph_is_pet(g)
|
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
&& ::iflags.hilite_pet
|
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
) {
|
}
|
||||||
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
painter.setFont(font());
|
painter.setFont(font());
|
||||||
} else {
|
} else {
|
||||||
for (int j=garea.top(); j<=garea.bottom(); j++) {
|
for (int j=garea.top(); j<=garea.bottom(); j++) {
|
||||||
for (int i=garea.left(); i<=garea.right(); i++) {
|
for (int i=garea.left(); i<=garea.right(); i++) {
|
||||||
unsigned short g=Glyph(i,j);
|
unsigned short g=Glyph(i,j);
|
||||||
|
int color;
|
||||||
|
int ch;
|
||||||
|
unsigned special;
|
||||||
|
mapglyph(g, &ch, &color, &special, i, j);
|
||||||
qt_settings->glyphs().drawCell(painter, g, i, j);
|
qt_settings->glyphs().drawCell(painter, g, i, j);
|
||||||
if (glyph_is_pet(g)
|
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
&& ::iflags.hilite_pet
|
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
) {
|
|
||||||
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,6 +654,7 @@ NetHackQtMapWindow::NetHackQtMapWindow(NetHackQtClickBuffer& click_sink) :
|
|||||||
viewport.setPalette(palette);
|
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);
|
cursor.setX(0);
|
||||||
cursor.setY(0);
|
cursor.setY(0);
|
||||||
@@ -835,13 +841,13 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
|
|||||||
Qt::AlignCenter,
|
Qt::AlignCenter,
|
||||||
QString(QChar(ch)).left(1)
|
QString(QChar(ch)).left(1)
|
||||||
);
|
);
|
||||||
if (glyph_is_pet(g)
|
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
&& ::iflags.hilite_pet
|
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
) {
|
|
||||||
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,14 +856,18 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
|
|||||||
for (int j=garea.top(); j<=garea.bottom(); j++) {
|
for (int j=garea.top(); j<=garea.bottom(); j++) {
|
||||||
for (int i=garea.left(); i<=garea.right(); i++) {
|
for (int i=garea.left(); i<=garea.right(); i++) {
|
||||||
unsigned short g=Glyph(i,j);
|
unsigned short g=Glyph(i,j);
|
||||||
|
int color;
|
||||||
|
int ch;
|
||||||
|
unsigned special;
|
||||||
|
mapglyph(g, &ch, &color, &special, i, j);
|
||||||
qt_settings->glyphs().drawCell(painter, g, i, j);
|
qt_settings->glyphs().drawCell(painter, g, i, j);
|
||||||
if (glyph_is_pet(g)
|
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
&& ::iflags.hilite_pet
|
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
) {
|
|
||||||
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ private:
|
|||||||
unsigned short& Glyph(int x, int y) { return glyph[y][x]; }
|
unsigned short& Glyph(int x, int y) { return glyph[y][x]; }
|
||||||
QPoint cursor;
|
QPoint cursor;
|
||||||
QPixmap pet_annotation;
|
QPixmap pet_annotation;
|
||||||
|
QPixmap pile_annotation;
|
||||||
NetHackQtClickBuffer& clicksink;
|
NetHackQtClickBuffer& clicksink;
|
||||||
Clusterizer change;
|
Clusterizer change;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user