]> granicus.if.org Git - nethack/commitdiff
Qt4: Pile mark
authorPasi Kallinen <paxed@alt.org>
Tue, 10 Oct 2017 18:47:35 +0000 (21:47 +0300)
committerPasi Kallinen <paxed@alt.org>
Tue, 10 Oct 2017 18:47:35 +0000 (21:47 +0300)
include/qt_xpms.h
win/Qt4/qt4map.cpp
win/Qt4/qt4map.h

index a91ac5f110a4dd583d1547223cd946b6e64edafc..5667c13c0888bf37f152ae21a31ef8325dca09a7 100644 (file)
@@ -946,6 +946,20 @@ static const char *pet_mark_small_xpm[] = {
 "..X.."
 };
 /* 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[] = {
 /* width height ncolors chars_per_pixel */
 "40 40 23 1",
index 39c915ee5b315ba459c0fe483fa18cdddd27a6a4..f3425bab2887a6a63f793ba7eee7a3435f5657f6 100644 (file)
@@ -71,6 +71,7 @@ NetHackQtMapViewport::NetHackQtMapViewport(NetHackQtClickBuffer& click_sink) :
        change(10)
 {
     pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm);
+    pile_annotation = QPixmap(pile_mark_xpm);
 
     Clear();
     cursor.setX(0);
@@ -157,29 +158,33 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
                        QString(QChar(ch)).left(1)
                    );
                }
-               if (glyph_is_pet(g)
 #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
-               ) {
-                   painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
-               }
-           }
-       }
+            }
+        }
 
        painter.setFont(font());
     } else {
        for (int j=garea.top(); j<=garea.bottom(); j++) {
            for (int i=garea.left(); i<=garea.right(); i++) {
                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);
-               if (glyph_is_pet(g)
 #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
-               ) {
-                   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);
 
     pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm);
+    pile_annotation = QPixmap(pile_mark_xpm);
 
     cursor.setX(0);
     cursor.setY(0);
@@ -835,13 +841,13 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
                    Qt::AlignCenter,
                    QString(QChar(ch)).left(1)
                );
-               if (glyph_is_pet(g)
 #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
-               ) {
-                   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 i=garea.left(); i<=garea.right(); i++) {
                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);
-               if (glyph_is_pet(g)
 #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
-               ) {
-                   painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
-               }
            }
        }
     }
index da2df88adec55facc45539f7142969a4e601d859..337a726aa23728d0ff9711f34584465865e9c102 100644 (file)
@@ -33,6 +33,7 @@ private:
        unsigned short& Glyph(int x, int y) { return glyph[y][x]; }
        QPoint cursor;
        QPixmap pet_annotation;
+        QPixmap pile_annotation;
        NetHackQtClickBuffer& clicksink;
        Clusterizer change;