Honour more WINCAP flags.

This commit is contained in:
warwick
2002-07-29 05:19:49 +00:00
parent 0b7c39a331
commit fb4f19662b
4 changed files with 36 additions and 10 deletions

View 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) */

View 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},

View 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,

View 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;