]> granicus.if.org Git - nethack/commitdiff
unexplored terrain on Qt map
authorPatR <rankin@nethack.org>
Tue, 15 Sep 2020 14:26:42 +0000 (07:26 -0700)
committerPatR <rankin@nethack.org>
Tue, 15 Sep 2020 14:26:42 +0000 (07:26 -0700)
Qt's map hadn't been updated to draw unexplored locations with
the unexplored glyph so was still using solid stone instead.

Column 0 should be removed but I'll leave that for someone more
adventurous; I did it for curses and for X11 but am going to
pass here.  It's very noticable after magic mapping but is only
"bad" (by wasting space) if clipping is being performed.

doc/fixes37.0
win/Qt/qt_map.cpp

index f03cb46765ff17b5cfd3adeb07049c87099a113e..4e7535c4d72a42590367bd11150f2eaca40fea2a 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.301 $ $NHDT-Date: 1599778430 2020/09/10 22:53:50 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.302 $ $NHDT-Date: 1600179998 2020/09/15 14:26:38 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -404,6 +404,7 @@ Qt: update message window's last message with player's response if it's a
        prompt string for a single-character of input (ynaq or invent letter)
 Qt: for line input, display the prompt+response in the message window
 Qt: enable the popup_dialog WC option (result is a bit flakey but usable)
+Qt: 3.6 catchup - show unexplored locations as unexplored rather than as stone
 Qt+QSX: fix control key
 Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's
        'O' command to "Game->Run-time options" and entry "Game->Qt settings"
index bb208d2438ec3b2766494f9f607ddc7d74ddc4ea..0bb96d673a4477bfc113105a9c5122ce394a1a81 100644 (file)
@@ -31,26 +31,31 @@ namespace nethack_qt_ {
 #ifdef TEXTCOLOR
 static const QPen& nhcolor_to_pen(int c)
 {
-    static QPen* pen=0;
-    if ( !pen ) {
-       pen = new QPen[17];
-       pen[0] = QColor(64,64,64);
-       pen[1] = QColor(Qt::red);
-       pen[2] = QColor(0,191,0);
-       pen[3] = QColor(127,127,0);
-       pen[4] = QColor(Qt::blue);
-       pen[5] = QColor(Qt::magenta);
-       pen[6] = QColor(Qt::cyan);
-       pen[7] = QColor(Qt::gray);
-       pen[8] = QColor(Qt::white); // no color
-       pen[9] = QColor(255,127,0);
-       pen[10] = QColor(127,255,127);
-       pen[11] = QColor(Qt::yellow);
-       pen[12] = QColor(127,127,255);
-       pen[13] = QColor(255,127,255);
-       pen[14] = QColor(127,255,255);
-       pen[15] = QColor(Qt::white);
-       pen[16] = QColor(Qt::black);
+    static QPen *pen = (QPen *) 0;
+    if (!pen) {
+        pen = new QPen[17];
+        //
+        // FIXME:  these are duplicated in qt_menu.cpp
+        //
+        pen[ 0] = QColor(64, 64, 64);    // black
+        pen[ 1] = QColor(Qt::red);
+        pen[ 2] = QColor(0, 191, 0);     // green
+        pen[ 3] = QColor(127, 127, 0);   // brownish
+        pen[ 4] = QColor(Qt::blue);
+        pen[ 5] = QColor(Qt::magenta);
+        pen[ 6] = QColor(Qt::cyan);
+        pen[ 7] = QColor(Qt::gray);
+        // on tty, "light" variations are "bright" instead; here they're paler
+        pen[ 8] = QColor(Qt::white);     // no color
+        pen[ 9] = QColor(255, 127, 0);   // orange
+        pen[10] = QColor(127, 255, 127); // light green
+        pen[11] = QColor(Qt::yellow);
+        pen[12] = QColor(127, 127, 255); // light blue
+        pen[13] = QColor(255, 127, 255); // light magenta
+        pen[14] = QColor(127, 255, 255); // light cyan
+        pen[15] = QColor(Qt::white);
+        // ? out of range for 0..15
+        pen[16] = QColor(Qt::black);
     }
 
     return pen[c];
@@ -502,12 +507,13 @@ void NetHackQtMapViewport::clickCursor()
 
 void NetHackQtMapViewport::Clear()
 {
-    unsigned short stone=cmap_to_glyph(S_stone);
-
-    for (int j=0; j<ROWNO; j++) {
-       for (int i=0; i<COLNO; i++) {
-           Glyph(i,j)=stone;
-       }
+    for (int j = 0; j < ROWNO; ++j) {
+        //
+        // FIXME:  map column 0 should be surpressed from being displayed
+        //
+        Glyph(0, j) = GLYPH_NOTHING;
+        for (int i = 1; i < COLNO; ++i)
+            Glyph(i, j) = GLYPH_UNEXPLORED;
     }
 
     change.clear();
@@ -770,12 +776,10 @@ void NetHackQtMapWindow::Scroll(int dx, int dy)
 
 void NetHackQtMapWindow::Clear()
 {
-    unsigned short stone=cmap_to_glyph(S_stone);
-
-    for (int j=0; j<ROWNO; j++) {
-       for (int i=0; i<COLNO; i++) {
-           Glyph(i,j)=stone;
-       }
+    for (int j = 0; j < ROWNO; ++j) {
+        Glyph(0, j) = GLYPH_NOTHING;
+        for (int i = 1; i < COLNO; ++i)
+            Glyph(i, j) = GLYPH_UNEXPLORED;
     }
 
     change.clear();