]> granicus.if.org Git - nethack/commitdiff
Honour more WINCAP flags.
authorwarwick <warwick>
Mon, 29 Jul 2002 05:19:49 +0000 (05:19 +0000)
committerwarwick <warwick>
Mon, 29 Jul 2002 05:19:49 +0000 (05:19 +0000)
include/config.h
src/options.c
win/Qt/qt_win.cpp
win/tty/termcap.c

index 51268e619144948226279569d261862876eae050..72d6088587beca92ce3961e4ead10f7bc078bd69 100644 (file)
@@ -83,6 +83,7 @@
 #endif
 
 #ifdef QT_GRAPHICS
+# define DEFAULT_WC_TILED_MAP   /* Default to tiles if users doesn't say wc_ascii_map */
 # define USER_SOUNDS           /* Use sounds */
 # define USE_XPM               /* Use XPM format for images (required) */
 # define GRAPHIC_TOMBSTONE     /* Use graphical tombstone (rip.ppm) */
index f8d3f89da34c266cbfd7306c9e0a8ab1b3dcea4c..00bdb7b6abbeff711990c67a903585614484faac 100644 (file)
@@ -17,6 +17,12 @@ NEARDATA struct instance_flags iflags;       /* provide linkage */
 
 #define WINTYPELEN 16
 
+#ifdef DEFAULT_WC_TILED_MAP
+#define PREFER_TILED TRUE
+#else
+#define PREFER_TILED FALSE
+#endif
+
 /*
  *  NOTE:  If you add (or delete) an option, please update the short
  *  options help (option_help()), the long options help (dat/opthelp),
@@ -38,7 +44,7 @@ static struct Bool_Opt
 #else
        {"altmeta", (boolean *)0, TRUE, DISP_IN_GAME},
 #endif
-       {"ascii_map",     &iflags.wc_ascii_map, TRUE, SET_IN_GAME},     /*WC*/
+       {"ascii_map",     &iflags.wc_ascii_map, !PREFER_TILED, SET_IN_GAME},    /*WC*/
 #ifdef MFLOPPY
        {"asksavedisk", &flags.asksavedisk, FALSE, SET_IN_GAME},
 #else
@@ -170,7 +176,7 @@ static struct Bool_Opt
        {"sparkle", &flags.sparkle, TRUE, SET_IN_GAME},
        {"standout", &flags.standout, FALSE, SET_IN_GAME},
        {"splash_screen",     &iflags.wc_splash_screen, TRUE, DISP_IN_GAME},    /*WC*/
-       {"tiled_map",     &iflags.wc_tiled_map, FALSE, DISP_IN_GAME},   /*WC*/
+       {"tiled_map",     &iflags.wc_tiled_map, PREFER_TILED, DISP_IN_GAME},    /*WC*/
        {"time", &flags.time, FALSE, SET_IN_GAME},
 #ifdef TIMED_DELAY
        {"timed_delay", &flags.nap, TRUE, SET_IN_GAME},
index 37cd0b767077687c69d2ba786b1a7e60fcaa875b..b022c7bf34b2424c7f0c28ff8367bdf81593f611 100644 (file)
@@ -1583,8 +1583,13 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
 
     painter.begin(this);
 
+    if (
 #ifdef REINCARNATION
-    if (Is_rogue_level(&u.uz)) {
+       Is_rogue_level(&u.uz) ||
+#endif
+       iflags.wc_ascii_map
+    )
+    {
        // You enter a VERY primitive world!
 
        painter.setClipRect( event->rect() ); // (normally we don't clip)
@@ -1595,8 +1600,16 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
        if ( !rogue_font ) {
            // Find font...
            int pts = 5;
+           QString fontfamily = iflags.wc_font_map
+               ? iflags.wc_font_map : "Courier";
+           bool bold = FALSE;
+           if ( fontfamily.right(5).lower() == "-bold" ) {
+               fontfamily.truncate(fontfamily.length()-5);
+               bold = TRUE;
+           }
            while ( pts < 32 ) {
-               painter.setFont(QFont("Courier", pts));
+               QFont f(fontfamily, pts, bold ? QFont::Bold : QFont::Normal);
+               painter.setFont(QFont(fontfamily, pts));
                QFontMetrics fm = painter.fontMetrics();
                if ( fm.width("M") > qt_settings->glyphs().width() )
                    break;
@@ -1604,7 +1617,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
                    break;
                pts++;
            }
-           rogue_font = new QFont("Courier",pts-1);
+           rogue_font = new QFont(fontfamily,pts-1);
        }
        painter.setFont(*rogue_font);
 
@@ -1641,9 +1654,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
        }
 
        painter.setFont(font());
-    } else
-#endif
-    {
+    } 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);
@@ -4335,7 +4346,7 @@ NetHackQtBind::NetHackQtBind(int& argc, char** argv) :
 #endif
 {
     QPixmap pm("nhsplash.xpm");
-    if ( !pm.isNull() ) {
+    if ( iflags.wc_splash_screen && !pm.isNull() ) {
        QVBox *vb = new QVBox(0,0,
            WStyle_Customize | WStyle_NoBorder | nh_WX11BypassWM | WStyle_StaysOnTop );
        splash = vb;
@@ -5056,7 +5067,10 @@ extern "C" struct window_procs Qt_procs;
 
 struct window_procs Qt_procs = {
     "Qt",
-    WC_COLOR|WC_HILITE_PET,
+    WC_COLOR|WC_HILITE_PET|
+       WC_ASCII_MAP|WC_TILED_MAP|
+       WC_FONT_MAP|WC_TILE_FILE|WC_TILE_WIDTH|WC_TILE_HEIGHT|
+       WC_PLAYER_SELECTION|WC_SPLASH_SCREEN,
     NetHackQtBind::qt_init_nhwindows,
     NetHackQtBind::qt_player_selection,
     NetHackQtBind::qt_askname,
index cb89f9457f3fffcd7b8efbb62ac3119043959c6c..366275df9ad6db8b464030a28591e490217483bd 100644 (file)
@@ -1161,6 +1161,11 @@ int color;
        if (windowprocs.name != NULL &&
            !strcmpi(windowprocs.name, "Gem")) return TRUE;
 #endif
+#ifdef QT_GRAPHICS
+       /* XXX has_color() should be added to windowprocs */
+       if (windowprocs.name != NULL &&
+           !strcmpi(windowprocs.name, "Qt")) return TRUE;
+#endif
 #ifdef AMII_GRAPHICS
        /* hilites[] not used */
        return iflags.use_color;