From 2122506ebe9341b676123683b31effb549fd8299 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 7 Sep 2018 20:26:14 +0300 Subject: [PATCH 01/20] Spiders will occasionally spin webs Idea and code inspired by aosdict --- doc/fixes36.2 | 1 + src/monmove.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 949691dad..ccaa24f4b 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -114,6 +114,7 @@ add window port status_update() value BL_RESET to use as a flag to for hilite_status of string status fields (title, dungeon-level, alignment), the types value-goes-up and -down aren't meaningful; treat them as value-changed if from config file and don't offer as choices with 'O' +spiders will occasionally spin webs when moving around Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/monmove.c b/src/monmove.c index 0abf63b6d..c6babe5ca 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -742,6 +742,18 @@ xchar nix,niy; return FALSE; } +/* returns the number of walls in the four cardinal directions that could hold up a web */ +int +count_webbing_walls(x,y) +xchar x,y; +{ +#define holds_up_web(x,y) ((!isok((x),(y)) \ + || IS_ROCK(levl[(x)][(y)].typ) \ + || levl[(x)][(y)].typ == IRONBARS) ? 1 : 0) + return holds_up_web(x, y-1) + holds_up_web(x+1, y) + holds_up_web(x, y+1) + holds_up_web(x-1, y); +#undef holds_up_web +} + /* Return values: * 0: did not move, but can still attack and do other stuff. * 1: moved, possibly can attack. @@ -1436,6 +1448,19 @@ postmov: } } + /* maybe a spider spun a web */ + if (webmaker(ptr) && !t_at(mtmp->mx, mtmp->my)) { + int prob = ((ptr == &mons[PM_GIANT_SPIDER]) ? 15 : 5) * + (count_webbing_walls(mtmp->mx, mtmp->my) + 1); + if (rn2(1000) < prob) { + struct trap* trap = maketrap(mtmp->mx, mtmp->my, WEB); + if (trap && canspotmon(mtmp)) { + pline("%s spins a web.", upstart(y_monnam(mtmp))); + trap->tseen = 1; + } + } + } + if (hides_under(ptr) || ptr->mlet == S_EEL) { /* Always set--or reset--mundetected if it's already hidden (just in case the object it was hiding under went away); From b572ccb0147bdc192d6bccc20d7a3df9ace8c1cc Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 7 Sep 2018 18:12:03 -0700 Subject: [PATCH 02/20] web spinning This started as some formatting cleanup but I've added a couple of additional terrain features which can act as web support (stairs up and ladder up). The message " spins a web" was given if you could detect or sense rather than see it. I've changed that to only happen if you see the new web appear rather than the critter spinning it (it only becomes an unseen trap if you don't watch it appear). After spinning a web, a spider can't spin another one until 4d4 moves have elapsed. That seems suitable when the spider can be seen but isn't really adequate throttling when the spider is far away--it can end up spinning a lot of webs by the time you get to its vicinity. Perhaps it shouldn't be able to spin a new web if there is already one with N steps of its location? --- src/monmove.c | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/monmove.c b/src/monmove.c index c6babe5ca..90b4f33c1 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -14,8 +14,10 @@ STATIC_DCL int FDECL(disturb, (struct monst *)); STATIC_DCL void FDECL(release_hero, (struct monst *)); STATIC_DCL void FDECL(distfleeck, (struct monst *, int *, int *, int *)); STATIC_DCL int FDECL(m_arrival, (struct monst *)); +STATIC_DCL int FDECL(count_webbing_walls, (XCHAR_P, XCHAR_P)); STATIC_DCL boolean FDECL(stuff_prevents_passage, (struct monst *)); -STATIC_DCL int FDECL(vamp_shift, (struct monst *, struct permonst *, BOOLEAN_P)); +STATIC_DCL int FDECL(vamp_shift, (struct monst *, struct permonst *, + BOOLEAN_P)); /* True if mtmp died */ boolean @@ -742,15 +744,21 @@ xchar nix,niy; return FALSE; } -/* returns the number of walls in the four cardinal directions that could hold up a web */ -int -count_webbing_walls(x,y) -xchar x,y; +/* returns the number of walls in the four cardinal directions that could + hold up a web */ +STATIC_OVL int +count_webbing_walls(x, y) +xchar x, y; { -#define holds_up_web(x,y) ((!isok((x),(y)) \ - || IS_ROCK(levl[(x)][(y)].typ) \ - || levl[(x)][(y)].typ == IRONBARS) ? 1 : 0) - return holds_up_web(x, y-1) + holds_up_web(x+1, y) + holds_up_web(x, y+1) + holds_up_web(x-1, y); +#define holds_up_web(X, Y) ((!isok((X), (Y)) \ + || IS_ROCK(levl[X][Y].typ) \ + || (levl[X][Y].typ == STAIRS \ + && (X) == xupstair && (Y) == yupstair) \ + || (levl[X][Y].typ == LADDER \ + && (X) == xupladder && (Y) == yupladder) \ + || levl[X][Y].typ == IRONBARS) ? 1 : 0) + return (holds_up_web(x, y - 1) + holds_up_web(x + 1, y) + + holds_up_web(x, y + 1) + holds_up_web(x - 1, y)); #undef holds_up_web } @@ -1448,14 +1456,22 @@ postmov: } } - /* maybe a spider spun a web */ - if (webmaker(ptr) && !t_at(mtmp->mx, mtmp->my)) { - int prob = ((ptr == &mons[PM_GIANT_SPIDER]) ? 15 : 5) * - (count_webbing_walls(mtmp->mx, mtmp->my) + 1); - if (rn2(1000) < prob) { - struct trap* trap = maketrap(mtmp->mx, mtmp->my, WEB); - if (trap && canspotmon(mtmp)) { - pline("%s spins a web.", upstart(y_monnam(mtmp))); + /* maybe spin a web -- this needs work; if the spider is far away, + it might spin a lot of webs before hero encounters it */ + if (webmaker(ptr) && !mtmp->mspec_used && !t_at(mtmp->mx, mtmp->my)) { + struct trap *trap; + int prob = ((ptr == &mons[PM_GIANT_SPIDER]) ? 15 : 5) + * (count_webbing_walls(mtmp->mx, mtmp->my) + 1); + + if (rn2(1000) < prob + && (trap = maketrap(mtmp->mx, mtmp->my, WEB)) != 0) { + mtmp->mspec_used = d(4, 4); /* 4..16 */ + if (cansee(mtmp->mx, mtmp->my)) { + char mbuf[BUFSZ]; + + Strcpy(mbuf, + canspotmon(mtmp) ? y_monnam(mtmp) : something); + pline("%s spins a web.", upstart(mbuf)); trap->tseen = 1; } } From 4be2467cc9a972958efbbfff37ecaf1c9fcee966 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 8 Sep 2018 08:54:35 -0400 Subject: [PATCH 03/20] win32 gui bits fix an index out-of-bounds status hitpoint bar behavior at zero hp to match tty --- doc/fixes36.2 | 3 ++- win/win32/mhstatus.c | 36 +++++++++++++++++++----------------- win/win32/mswproc.c | 35 +++++++++++++++++++++++------------ 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index ccaa24f4b..e34ec28fc 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -131,7 +131,8 @@ Platform- and/or Interface-Specific Fixes ----------------------------------------- windows-gui: In nethackw, there could be conflicts between menu accelerators and an extra choice accelerator to fix H7132. -windows-gui: recognize new BL_RESET in status_update; behavior currently the same +windows-gui: recognize new BL_RESET in status_update; no change in behavior yet +windows-gui: align hpbar behavior at zero hit points with tty behavior windows-tty: Specify both width and height when creating font for width testing windows-tty: To counter lag problems that were occuring with the Win32 console port, implement a console back buffer to reduce the number of calls diff --git a/win/win32/mhstatus.c b/win/win32/mhstatus.c index 52d24621a..80799ad82 100644 --- a/win/win32/mhstatus.c +++ b/win/win32/mhstatus.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhstatus.c $NHDT-Date: 1432512810 2015/05/25 00:13:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.6 mhstatus.c $NHDT-Date: 1536411224 2018/09/08 12:53:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.29 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -324,7 +324,7 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) LONG left = rt.left; LONG cy = 0; int vlen; - for (f = *fop; *f != -1; f++) { + for (f = *fop; *f != BL_FLUSH; f++) { int clr, atr; int fntatr = ATR_NONE; HGDIOBJ fnt; @@ -362,7 +362,8 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) SelectObject(hdc, fnt); SetBkMode(hdc, OPAQUE); SetBkColor(hdc, status_bg_color); - SetTextColor(hdc, nhcolor_to_RGB(hpbar_color)); + /* SetTextColor(hdc, nhcolor_to_RGB(hpbar_color)); */ + SetTextColor(hdc, status_fg_color); /* get bounding rectangle */ GetTextExtentPoint32(hdc, wbuf, vlen, &sz); @@ -370,21 +371,22 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) /* first draw title normally */ DrawText(hdc, wbuf, vlen, &rt, DT_LEFT); - /* calc bar length */ - barrect.left = rt.left; - barrect.top = rt.top; - barrect.bottom = sz.cy; - if (hpbar_percent > 0) - barrect.right = (int)((hpbar_percent * sz.cx) / 100); - else - barrect.right = sz.cx; - - /* then draw hpbar on top of title */ - FillRect(hdc, &barrect, back_brush); - SetBkMode(hdc, TRANSPARENT); - SetTextColor(hdc, nBg); - DrawText(hdc, wbuf, vlen, &barrect, DT_LEFT); + if (hpbar_percent > 0) { + /* calc bar length */ + barrect.left = rt.left; + barrect.top = rt.top; + barrect.bottom = sz.cy; + if (hpbar_percent > 0) + barrect.right = (int)((hpbar_percent * sz.cx) / 100); + /* else + barrect.right = sz.cx; */ + /* then draw hpbar on top of title */ + FillRect(hdc, &barrect, back_brush); + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, nBg); + DrawText(hdc, wbuf, vlen, &barrect, DT_LEFT); + } DeleteObject(back_brush); } else { if (atr & HL_INVERSE) { diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index fb9ad0a94..feabf49b2 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mswproc.c $NHDT-Date: 1451611595 2016/01/01 01:26:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.98 $ */ +/* NetHack 3.6 mswproc.c $NHDT-Date: 1536411259 2018/09/08 12:54:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.118 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -2899,10 +2899,21 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color, int ocolor, ochar; unsigned ospecial; long value = -1; + boolean reset_state = FALSE; logDebug("mswin_status_update(%d, %p, %d, %d, %x, %p)\n", idx, ptr, chg, percent, color, colormasks); - if (idx != BL_FLUSH && idx != BL_RESET) { + switch (idx) { + case BL_RESET: + reset_state = TRUE; + /* FALLTHRU */ + case BL_FLUSH: + /* FALLTHRU */ + default: + break; + } + + if (idx >= 0) { if (!_status_activefields[idx]) return; _status_percents[idx] = percent; @@ -2965,18 +2976,18 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color, text); } break; } - } - _status_colors[idx] = color; + _status_colors[idx] = color; - /* send command to status window */ - ZeroMemory(&update_cmd_data, sizeof(update_cmd_data)); - update_cmd_data.n_fields = MAXBLSTATS; - update_cmd_data.vals = _status_vals; - update_cmd_data.activefields = _status_activefields; - update_cmd_data.percents = _status_percents; - update_cmd_data.colors = _status_colors; - SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND, + /* send command to status window */ + ZeroMemory(&update_cmd_data, sizeof(update_cmd_data)); + update_cmd_data.n_fields = MAXBLSTATS; + update_cmd_data.vals = _status_vals; + update_cmd_data.activefields = _status_activefields; + update_cmd_data.percents = _status_percents; + update_cmd_data.colors = _status_colors; + SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND, (WPARAM) MSNH_MSG_UPDATE_STATUS, (LPARAM) &update_cmd_data); + } } From 08ef5ff99f3869b63970f5236ffd37922939abc4 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 22:59:47 -0400 Subject: [PATCH 04/20] Provide Qt 5 configuration on Linux * CXX specifies -std=gnu++11 * WINQT5LIB variable added * Hints file can specify CXX and MOC --- sys/unix/Makefile.src | 26 +++++++++++--------- sys/unix/hints/linux-qt4 | 4 +++- sys/unix/hints/linux-qt5 | 52 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 sys/unix/hints/linux-qt5 diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 98c80a2fd..4f9fa874e 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -163,7 +163,8 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome # NetHack is standard C. If using Qt, uncomment the LINK line here to get # the C++ libraries linked in. CXXFLAGS = $(CFLAGS) -I. -I$(QTDIR)/include -CXX=g++ +CXX ?= g++ +MOC ?= moc #LINK=g++ # For cross-compiling, eg. with gcc on Linux (see also CC further up): #CXX=arm-linux-g++ @@ -277,6 +278,9 @@ WINQTLIB = -L$(QTDIR)/lib -lqt # libraries for Qt 4 WINQT4LIB = `pkg-config QtGui --libs` # +# libraries for Qt 5 (use with WINQT4SRC and WINQT4OBJ) +WINQT5LIB = `pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs` +# # libraries for KDE (with Qt) WINKDELIB = -lkdecore -lkdeui -lXext # @@ -566,25 +570,25 @@ qttableview.moc: ../include/qttableview.h # Qt 4 windowport meta-object-compiler output qt4kde0.moc : ../win/Qt4/qt4kde0.h - $(QTDIR)/bin/moc -o qt4kde0.moc ../win/Qt4/qt4kde0.h + $(QTDIR)/bin/$(MOC) -o qt4kde0.moc ../win/Qt4/qt4kde0.h qt4main.moc : ../win/Qt4/qt4main.h - $(QTDIR)/bin/moc -o qt4main.moc ../win/Qt4/qt4main.h + $(QTDIR)/bin/$(MOC) -o qt4main.moc ../win/Qt4/qt4main.h qt4map.moc : ../win/Qt4/qt4map.h - $(QTDIR)/bin/moc -o qt4map.moc ../win/Qt4/qt4map.h + $(QTDIR)/bin/$(MOC) -o qt4map.moc ../win/Qt4/qt4map.h qt4menu.moc : ../win/Qt4/qt4menu.h - $(QTDIR)/bin/moc -o qt4menu.moc ../win/Qt4/qt4menu.h + $(QTDIR)/bin/$(MOC) -o qt4menu.moc ../win/Qt4/qt4menu.h qt4msg.moc : ../win/Qt4/qt4msg.h - $(QTDIR)/bin/moc -o qt4msg.moc ../win/Qt4/qt4msg.h + $(QTDIR)/bin/$(MOC) -o qt4msg.moc ../win/Qt4/qt4msg.h qt4plsel.moc : ../win/Qt4/qt4plsel.h - $(QTDIR)/bin/moc -o qt4plsel.moc ../win/Qt4/qt4plsel.h + $(QTDIR)/bin/$(MOC) -o qt4plsel.moc ../win/Qt4/qt4plsel.h qt4set.moc : ../win/Qt4/qt4set.h - $(QTDIR)/bin/moc -o qt4set.moc ../win/Qt4/qt4set.h + $(QTDIR)/bin/$(MOC) -o qt4set.moc ../win/Qt4/qt4set.h qt4stat.moc : ../win/Qt4/qt4stat.h - $(QTDIR)/bin/moc -o qt4stat.moc ../win/Qt4/qt4stat.h + $(QTDIR)/bin/$(MOC) -o qt4stat.moc ../win/Qt4/qt4stat.h qt4xcmd.moc : ../win/Qt4/qt4xcmd.h - $(QTDIR)/bin/moc -o qt4xcmd.moc ../win/Qt4/qt4xcmd.h + $(QTDIR)/bin/$(MOC) -o qt4xcmd.moc ../win/Qt4/qt4xcmd.h qt4yndlg.moc : ../win/Qt4/qt4yndlg.h - $(QTDIR)/bin/moc -o qt4yndlg.moc ../win/Qt4/qt4yndlg.h + $(QTDIR)/bin/$(MOC) -o qt4yndlg.moc ../win/Qt4/qt4yndlg.h # build monst.o and objects.o before executing '$(MAKE) makedefs' $(MAKEDEFS): $(FIRSTOBJ) \ diff --git a/sys/unix/hints/linux-qt4 b/sys/unix/hints/linux-qt4 index 34c8863d5..ebf441682 100644 --- a/sys/unix/hints/linux-qt4 +++ b/sys/unix/hints/linux-qt4 @@ -31,11 +31,13 @@ CFLAGS+=-DQT_GRAPHICS -DDEFAULT_WINDOW_SYS=\"Qt\" -DNOTTYGRAPHICS CFLAGS+=`pkg-config QtGui --cflags` LINK=g++ -CXX=g++ +CXX=g++ -std=gnu++11 WINSRC = $(WINQT4SRC) WINOBJ = $(WINQT4OBJ) WINLIB = $(WINQT4LIB) +MOC = moc +#MOC = moc-qt4 VARDATND = nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm diff --git a/sys/unix/hints/linux-qt5 b/sys/unix/hints/linux-qt5 new file mode 100644 index 000000000..8532cc207 --- /dev/null +++ b/sys/unix/hints/linux-qt5 @@ -0,0 +1,52 @@ +# +# NetHack 3.6 linux-qt5 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. +# NetHack may be freely redistributed. See license for details. +# +#-PRE +# Linux hints file +# This hints file provides a single-user Qt5 build for Linux, specifically +# for Fedora 26. + + +#PREFIX=/usr +PREFIX=$(wildcard ~)/nh/install +HACKDIR=$(PREFIX)/games/lib/$(GAME)dir +SHELLDIR = $(PREFIX)/games +INSTDIR=$(HACKDIR) +VARDIR = $(HACKDIR) + + +POSTINSTALL= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); + +CFLAGS=-g -O -I../include -DNOTPARMDECL +CFLAGS+=-DHACKDIR=\"$(HACKDIR)\" +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" +CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\" +CFLAGS+=-DTIMED_DELAY +CFLAGS+=-DDUMPLOG +CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE +CFLAGS+=-DQT_GRAPHICS -DDEFAULT_WINDOW_SYS=\"Qt\" -DNOTTYGRAPHICS +CFLAGS+=`pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags` -fPIC + +LINK=g++ +CXX=g++ -std=gnu++11 + +WINSRC = $(WINQT4SRC) +WINOBJ = $(WINQT4OBJ) +WINLIB = $(WINQT5LIB) +#MOC = moc +MOC = moc-qt5 + +VARDATND = nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm + +QTDIR=/usr + +CHOWN=true +CHGRP=true +VARDIRPERM = 0755 +VARFILEPERM = 0600 +GAMEPERM = 0755 + +# note: needs libxt-dev libxaw7-dev libx11-dev bdftopcf From 249494c8eeb4fc6ad0ae273965bc14cccf379890 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 10 Sep 2018 21:06:34 +0300 Subject: [PATCH 05/20] Qt4 moc is moc-qt4 At least on my Debian, the Qt4 MOC is now called moc-qt4, when it used to be just moc - probably due to Qt5 being moc-qt5 --- sys/unix/hints/linux-qt4 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/unix/hints/linux-qt4 b/sys/unix/hints/linux-qt4 index ebf441682..804118562 100644 --- a/sys/unix/hints/linux-qt4 +++ b/sys/unix/hints/linux-qt4 @@ -36,8 +36,7 @@ CXX=g++ -std=gnu++11 WINSRC = $(WINQT4SRC) WINOBJ = $(WINQT4OBJ) WINLIB = $(WINQT4LIB) -MOC = moc -#MOC = moc-qt4 +MOC = moc-qt4 VARDATND = nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm From 2ef07ad178183b5d14b5186d30198004e5bfa834 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 10 Sep 2018 21:09:58 +0300 Subject: [PATCH 06/20] Qt4: Fix compile warning --- win/Qt4/qt4bind.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win/Qt4/qt4bind.cpp b/win/Qt4/qt4bind.cpp index 2fef131ce..980c9ef9e 100644 --- a/win/Qt4/qt4bind.cpp +++ b/win/Qt4/qt4bind.cpp @@ -565,6 +565,8 @@ char NetHackQtBind::qt_yn_function(const char *question_, const char *choices, C else if (def) message += QString(" %1").arg(def); NetHackQtBind::qt_putstr(WIN_MESSAGE, ATR_BOLD, message); + + return ret; } } From 5e04a6e6cbe1ae7dae4fe3c67d20cf877d6a7242 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:02:06 -0400 Subject: [PATCH 07/20] New hints file for Qt 5 on Mac OS X --- sys/unix/hints/macosx10.10-qt | 343 ++++++++++++++++++++++++++++++++++ 1 file changed, 343 insertions(+) create mode 100644 sys/unix/hints/macosx10.10-qt diff --git a/sys/unix/hints/macosx10.10-qt b/sys/unix/hints/macosx10.10-qt new file mode 100644 index 000000000..ff9869251 --- /dev/null +++ b/sys/unix/hints/macosx10.10-qt @@ -0,0 +1,343 @@ +# +# NetHack 3.6 macosx10.11 $NHDT-Date: 1515549543 2018/01/10 01:59:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $ +# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. +# NetHack may be freely redistributed. See license for details. +# +#-PRE +# Mac OS X (Darwin) hints file +# This is for Mac OS X 10.10 or later, and has been tested on 10.11 +# (El Capitan). If this doesn't work for some other +# version of Mac OS X, make a new file for that OS, don't change this one. +# And let us know about it. +# Useful info: http://www.opensource.apple.com/darwinsource/index.html + +# You'll need to obtain and install XQuartz if you want X11 support. +# (Attempting to run X11.app will describe where to get it.) + +# This hints file can build several different types of installations. +# Edit the next section to match the type of build you need. + +# 1. Which window system(s) should be included in this binary? +WANT_WIN_TTY=1 +#WANT_WIN_X11=1 +WANT_WIN_QT=1 + +# 1a. What is the default window system? +#WANT_DEFAULT=tty +#WANT_DEFAULT=x11 +WANT_DEFAULT=Qt + +# 1b. If you set WANT_WIN_QT, you need to +# A) set QTDIR either here or in the environment to point to the Qt5 +# library installation root. (Qt2 or Qt3 will not work.) +ifdef WANT_WIN_QT +QTDIR=$(shell brew --prefix)/opt/qt +endif # WANT_WIN_QT + +# 2. Is this a build for a binary that will be shared among different users +# or will it be private to you? +# If it is shared: +# - it will be owned by the user and group listed +# - if the user does not exist, you MUST create it before installing +# NetHack +# - if the group does not exist, it will be created. +# NB: if the group already exists and is being used for something +# besides games, you probably want to specify a new group instead +# NB: the group will be created locally; if your computer is centrally +# administered this may not be what you (or your admin) want. +# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead. +# - 'make install' must be run as "sudo make install" +#WANT_SHARE_INSTALL=1 +GAMEUID = $(USER) +GAMEGRP = games +# build to run in the source tree - primarily for development. Build with "make all" +#WANT_SOURCE_INSTALL=1 + +CC=clang +CXX=clang++ -std=gnu++11 + +# At the moment this is just for debugging, but in the future it could be +# useful for other things. Requires SYSCF and an ANSI compiler. +#WANT_WIN_CHAIN=1 + +# +# You shouldn't need to change anything below here. +# + +#CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN +CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic +# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so +# leave it out by default. +#CFLAGS+=-Wunreachable-code + +# XXX -g vs -O should go here, -I../include goes in the makefile +CFLAGS+=-g -I../include +# older binaries use NOCLIPPING, but that disables SIGWINCH +#CFLAGS+=-DNOCLIPPING +CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" +CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB + +CFLAGS+= -DGREPPATH=\"/usr/bin/grep\" + +ifdef WANT_WIN_CHAIN +CFLAGS+= -DWINCHAIN +HINTSRC=$(CHAINSRC) +HINTOBJ=$(CHAINOBJ) +endif + +WINSRC = +WINOBJ0 = +WINLIB = +LINK = $(CC) +VARDATND = + +ifdef WANT_WIN_TTY +WINSRC += $(WINTTYSRC) +WINOBJ0 += $(WINTTYOBJ) +WINLIB += $(WINTTYLIB) +WINTTYLIB=-lncurses +else # !WANT_WIN_TTY +CFLAGS += -DNOTTYGRAPHICS +endif # !WANT_WIN_TTY + +ifdef WANT_WIN_X11 +WINSRC += $(WINX11SRC) +WINOBJ0 += $(WINX11OBJ) +WINLIB += $(WINX11LIB) +LFLAGS += -L/opt/X11/lib +VARDATND += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); +CFLAGS += -DX11_GRAPHICS -I/opt/X11/include +# avoid repeated complaints about _X_NONNULL(args...) in +CFLAGS += -Wno-variadic-macros +endif # WANT_WIN_X11 + +ifdef WANT_WIN_QT +CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS +CFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags) +WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs) +LINK=$(CXX) +WINSRC += $(WINQT4SRC) +WINOBJ0 += $(WINQT4OBJ) +VARDATND += rip.xpm +MOC = moc + +# XXX if /Developer/qt exists and QTDIR not set, use that +ifndef QTDIR +$(error QTDIR not defined in the environment or Makefile) +endif # QTDIR +# XXX make sure QTDIR points to something reasonable +endif # WANT_WIN_QT + +# prevent duplicate tile.o in WINOBJ +WINOBJ = $(sort $(WINOBJ0)) + +ifdef WANT_SHARE_INSTALL +# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise +# we install into ~/nethackdir +ifeq ($(GAMEUID),root) +PREFIX:=/Library/NetHack +SHELLDIR=/usr/local/bin +HACKDIR=$(PREFIX)/nethackdir +CHOWN=chown +CHGRP=chgrp +# We run sgid so the game has access to both HACKDIR and user preferences. +GAMEPERM = 02755 +else # ! root +PREFIX:=/Users/$(GAMEUID) +SHELLDIR=$(PREFIX)/bin +HACKDIR=$(PREFIX)/Library/NetHack/nethackdir +CHOWN=/usr/bin/true +CHGRP=/usr/bin/true +GAMEPERM = 0500 +endif # ! root +VARFILEPERM = 0664 +VARDIRPERM = 0775 +ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1) +# XXX it's nice we don't write over sysconf, but we've already erased it +# make sure we have group GAMEUID and group GAMEGRP +PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR) +POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +else ifdef WANT_SOURCE_INSTALL +PREFIX=$(abspath $(NHSROOT)) +# suppress nethack.sh +#SHELLDIR= +HACKDIR=$(PREFIX)/playground +CHOWN=/usr/bin/true +CHGRP=/usr/bin/true +GAMEPERM = 0700 +VARFILEPERM = 0600 +VARDIRPERM = 0700 +POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; +# We can use "make all" to build the whole thing - but it misses some things: +MOREALL=$(MAKE) install +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +else # !WANT_SOURCE_INSTALL +PREFIX:=$(wildcard ~) +SHELLDIR=$(PREFIX)/bin +HACKDIR=$(PREFIX)/nethackdir +CHOWN=/usr/bin/true +CHGRP=/usr/bin/true +GAMEPERM = 0700 +VARFILEPERM = 0600 +VARDIRPERM = 0700 +ifdef WANT_WIN_X11 +# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +endif # WANT_WIN_X11 +POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +endif # !WANT_SOURCE_INSTALL + +INSTDIR=$(HACKDIR) +VARDIR=$(HACKDIR) + + +# ~/Library/Preferences/NetHack Defaults +# OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp +# OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt +# +# Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary +# package under the docs directory). + +#-POST +ifdef MAKEFILE_TOP +### +### Packaging +### +# Notes: +# 1) The Apple developer utilities must be installed in the default location. +# 2) Do a normal build before trying to package the game. +# 3) This matches the 3.4.3 Term package, but there are some things that should +# be changed. + +ifdef WANT_WIN_TTY +DEVUTIL=/Developer/Applications/Utilities +SVS=$(shell $(NHSROOT)/util/makedefs --svs) +SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .) + +PKGROOT_UG = PKGROOT/$(PREFIX) +PKGROOT_UGLN = PKGROOT/$(HACKDIR) +PKGROOT_BIN = PKGROOT/$(SHELLDIR) +build_tty_pkg: +ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT)) + -echo build_tty_pkg only works for a tty-only build + exit 1 +else + rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg + $(MAKE) build_package_root + rm -rf RESOURCES + mkdir RESOURCES + #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf + sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist + sys/unix/hints/macosx.sh infoplist > Info.plist + + mkdir PKGROOT/Applications + #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \ + # win/macosx/NetHackRecover.applescript + #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir + osacompile -o PKGROOT/Applications/NetHackRecover.app \ + win/macosx/NetHackRecover.applescript + cp win/macosx/recover.pl $(PKGROOT_UGLN) + + osacompile -o PKGROOT/Applications/NetHackTerm.app \ + win/macosx/NetHackTerm.applescript + + # XXX integrate into Makefile.doc + (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \ + | tbl tmac.n - | groff | pstopdf -i -o Guidebook.pdf) + cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf + + osacompile -o PKGROOT/Applications/NetHackGuidebook.app \ + win/macosx/NetHackGuidebook.applescript + + mkdir -p PKG + pkgbuild --root PKGROOT --identifier org.nethack.term --scripts PKGSCRIPTS PKG/NH-Term.pkg + productbuild --synthesize --product Info.plist --package PKG/NH-Term.pkg Distribution.xml + productbuild --distribution Distribution.xml --resources RESOURCES --package-path PKG NetHack-$(SVS)-mac-Term.pkg + hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg + +build_package_root: + cd src/.. # make sure we are at TOP + rm -rf PKGROOT + mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_BIN) $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN) + install -p src/nethack $(PKGROOT_BIN) + # XXX should this be called nethackrecover? + install -p util/recover $(PKGROOT_BIN) + install -p doc/nethack.6 $(PKGROOT_UG)/man/man6 + install -p doc/recover.6 $(PKGROOT_UG)/man/man6 + install -p doc/Guidebook $(PKGROOT_UG)/doc + install -p dat/nhdat $(PKGROOT_UGLN) + sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf + cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN) +# XXX these files should be somewhere else for good Mac form + touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile $(PKGROOT_UGLN)/xlogfile + mkdir $(PKGROOT_UGLN)/save +# XXX what about a news file? + + mkdir -p PKGSCRIPTS + echo '#!/bin/sh' > PKGSCRIPTS/postinstall + echo dseditgroup -o create -r '"Games Group"' -s 3600 $(GAMEGRP) >> PKGSCRIPTS/postinstall + echo $(CHOWN) -R $(GAMEUID) $(HACKDIR) >> PKGSCRIPTS/postinstall + echo $(CHGRP) -R $(GAMEGRP) $(HACKDIR) >> PKGSCRIPTS/postinstall + echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall + echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall + echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall + echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall + echo chmod $(VARDIRPERM) $(HACKDIR) >> PKGSCRIPTS/postinstall + echo chmod $(VARDIRPERM) $(HACKDIR)/save >> PKGSCRIPTS/postinstall + echo chmod $(FILEPERM) $(HACKDIR)/license >> PKGSCRIPTS/postinstall + echo chmod $(FILEPERM) $(HACKDIR)/nhdat >> PKGSCRIPTS/postinstall + echo chmod $(FILEPERM) $(HACKDIR)/symbols >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/perm >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/record >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/logfile >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/xlogfile >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/sysconf >> PKGSCRIPTS/postinstall + echo chmod $(GAMEPERM) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall + echo chmod $(EXEPERM) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall + chmod 0775 PKGSCRIPTS/postinstall + +endif # end of build_tty_pkg +endif # WANT_WIN_TTY for packaging + +ifdef WANT_WIN_QT +# XXX untested and incomplete (see below) +build_qt_pkg: +ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY)) + -echo build_qt_pkg only works for a qt-only build + exit 1 +else + $(MAKE) build_package_root + rm -rf NetHackQt + mkdir -p NetHackQt/NetHackQt.app/nethackdir/save + mkdir NetHackQt/Documentation + cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation + + osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \ + win/macosx/NetHackRecover.applescript + cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir + + mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks + cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks + + mkdir NetHackQt/NetHackQt.app/Contents/MacOS + mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS + + mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir + +# XXX still missing: +#NetHackQt/NetHackQt.app +# /Contents +# Info.plist +# Resources/nethack.icns +#NetHackQt/Documentation +#NetHackQtRecover.txt +#NetHack Defaults.txt +#changes.patch XXX is this still needed? why isn't it part of the tree? +# doesn't go here + hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg +endif # end of build_qt_pkg +endif # WANT_WIN_QT for packaging +endif # MAKEFILE_TOP From e7a3390d741b1e8fe3e646d9b9b2ff398292aa3f Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:12:28 -0400 Subject: [PATCH 08/20] Add build products to make spotless Win32 Makefile.gcc now cleans up all build products except the binary directory. --- sys/winnt/Makefile.gcc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 5be03e2ed..baec24783 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -1035,6 +1035,30 @@ spotless: clean $(subst /,\,if exist $(U)recover.exe del $(U)recover.exe) $(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst) $(subst /,\,if exist nhdat. del nhdat.) + $(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon) + $(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave) + $(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph) + $(subst /,\,if exist $(DAT)/porthelp del $(DAT)/porthelp) + $(subst /,\,if exist $(INCL)/dgn_comp.h del $(INCL)/dgn_comp.h) + $(subst /,\,if exist $(INCL)/lev_comp.h del $(INCL)/lev_comp.h) + $(subst /,\,if exist $(INCL)/win32api.h del $(INCL)/win32api.h) + $(subst /,\,if exist $(MSWSYS)/NetHack.ico del $(MSWSYS)/NetHack.ico) + $(subst /,\,if exist $(U)dgn_flex.c del $(U)dgn_flex.c) + $(subst /,\,if exist $(U)dgn_yacc.c del $(U)dgn_yacc.c) + $(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe) + $(subst /,\,if exist $(U)lev_flex.c del $(U)lev_flex.c) + $(subst /,\,if exist $(U)lev_yacc.c del $(U)lev_yacc.c) + $(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe) + $(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe) + $(subst /,\,if exist $(U)uudecode.exe del $(U)uudecode.exe) + $(subst /,\,if exist $(MSWIN)/NetHack.ico del $(MSWIN)/NetHack.ico) + $(subst /,\,if exist $(MSWIN)/mnsel.bmp del $(MSWIN)/mnsel.bmp) + $(subst /,\,if exist $(MSWIN)/mnselcnt.bmp del $(MSWIN)/mnselcnt.bmp) + $(subst /,\,if exist $(MSWIN)/mnunsel.bmp del $(MSWIN)/mnunsel.bmp) + $(subst /,\,if exist $(MSWIN)/petmark.bmp del $(MSWIN)/petmark.bmp) + $(subst /,\,if exist $(MSWIN)/pilemark.bmp del $(MSWIN)/pilemark.bmp) + $(subst /,\,if exist $(MSWIN)/rip.bmp del $(MSWIN)/rip.bmp) + $(subst /,\,if exist $(MSWIN)/splash.bmp del $(MSWIN)/splash.bmp) ifneq "$(OBJ)" "" $(subst /,\,rmdir $(OBJ)) /s /Q endif From cdfb9cb7446a2aea6cf58f97e43d1feb3032f418 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:14:14 -0400 Subject: [PATCH 09/20] Linux and Mac: ignore .moc files created in src --- src/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.gitignore b/src/.gitignore index 04325af79..514698044 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -7,3 +7,4 @@ Sysunix nethack *.o tiles.bmp +*.moc From 5be0044c62b08e696b38da356c4068663ccb6a2f Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:15:22 -0400 Subject: [PATCH 10/20] Add -lgdi32 to conlibs, needed to link --- sys/winnt/Makefile.gcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index baec24783..41fba8921 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -191,7 +191,7 @@ CFLAGSBASE = -c $(cflags) -I$(INCL) $(WINPINC) $(cdebug) #LFLAGSBASEC = $(linkdebug) #LFLAGSBASEG = $(linkdebug) -mwindows -conlibs = -lwinmm +conlibs = -lgdi32 -lwinmm guilibs = -lcomctl32 -lwinmm #========================================== From 6894e464d4e1a63fe4691a81728a6d350341d793 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:16:12 -0400 Subject: [PATCH 11/20] Win32: delete the o directory only if it exists --- sys/winnt/Makefile.gcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 41fba8921..0adfa46e6 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -1060,7 +1060,7 @@ spotless: clean $(subst /,\,if exist $(MSWIN)/rip.bmp del $(MSWIN)/rip.bmp) $(subst /,\,if exist $(MSWIN)/splash.bmp del $(MSWIN)/splash.bmp) ifneq "$(OBJ)" "" - $(subst /,\,rmdir $(OBJ)) /s /Q + $(subst /,\,if exist $(OBJ) rmdir $(OBJ)) /s /Q endif clean: From 3fc2373ca25f31540626c3ff5192b3e7b91b0cac Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:18:55 -0400 Subject: [PATCH 12/20] Add build configuration for Qt 4 and 5 --- sys/winnt/Makefile.gcc | 141 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 137 insertions(+), 4 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 0adfa46e6..d46b94299 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -33,10 +33,16 @@ #============================================================================== # BUILD DECISIONS SECTION # -# There are currently only 3 decisions that you have to make. +# There are currently only 4 decisions that you have to make. # 1. 32-bit or 64-bit? # 2. Where do you want your build to end up? # 3. Do you want debug information in the executable? +# 4. Do you want additional GUI interfaces in the executable? +# +# Note that additional GUI interfaces may require external libraries. +# Qt is placed where the official installer places it. +# Other libraries are placed in a subdirectory of your home directory, either +# x86libs or x64libs depending on whether you're building for 64 bits. # #============================================================================== # 1. 32-bit or 64-bit? @@ -62,6 +68,26 @@ GAMEDIR = ../binary DEBUGINFO = Y +# +#--------------------------------------------------------------- +# 4. Do you want additional GUI interfaces in the executable? +# Make these Y to enable the GUIs. Win32 is always enabled, +# and is the default. +# + +WANT_WIN_QT4 = N + +# WANT_WIN_QT4 requires Qt 4 or Qt 5, see +# https://www.qt.io/download-open-source/ +# Earlier versions of Qt are not compatible with Windows +# For Qt 5, use: +QT4_DIRECTORY = c:/Qt/Qt5.9.2/5.9.2/mingw53_32 +HAVE_QT5 = Y + +# For Qt 4, comment out the above two lines and use: +#QT4_DIRECTORY = c:/Qt/4.8.6 +#HAVE_QT5 = N + # This marks the end of the BUILD DECISIONS section. #============================================================================== # @@ -97,6 +123,8 @@ MSWSYS = ../sys/winnt TTY = ../win/tty # window port files (WIN32) MSWIN = ../win/win32 +# window port files (Qt4) +QT4 = ../win/Qt4 # Tile support files WSHR = ../win/share @@ -107,8 +135,12 @@ WSHR = ../win/share OBJ = o cc = gcc +cxx = g++ rc = windres link = gcc +ifeq "$(WANT_WIN_QT4)" "Y" + link = g++ +endif # #========================================== @@ -159,6 +191,9 @@ RANDOM = $(OBJ)/random.o #RANDOM = WINPFLAG = -DTILES -DMSWIN_GRAPHICS -DWIN32CON -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0501 +ifeq "$(WANT_WIN_QT4)" "Y" + WINPFLAG += -DQT_GRAPHICS -DPIXMAPDIR='"."' +endif # To store all the level files, # help files, etc. in a single library file. # USE_DLB = Y is left uncommented @@ -193,6 +228,36 @@ CFLAGSBASE = -c $(cflags) -I$(INCL) $(WINPINC) $(cdebug) conlibs = -lgdi32 -lwinmm guilibs = -lcomctl32 -lwinmm +ifeq "$(WANT_WIN_QT4)" "Y" + # Might be either Qt 4 or Qt 5 + ifeq "$(HAVE_QT5)" "Y" + guilibs += $(QT4_DIRECTORY)/lib/libQt5Core.a + guilibs += $(QT4_DIRECTORY)/lib/libQt5Gui.a + guilibs += $(QT4_DIRECTORY)/lib/libQt5Widgets.a + conlibs += $(QT4_DIRECTORY)/lib/libQt5Core.a + else + guilibs += $(QT4_DIRECTORY)/lib/libQtCore4.a + guilibs += $(QT4_DIRECTORY)/lib/libQtGui4.a + conlibs += $(QT4_DIRECTORY)/lib/libQtCore4.a + endif +endif + +#========================================== +# Extra files needed for some ports +#========================================== +EXTRA_FILES = +ifeq "$(WANT_WIN_QT4)" "Y" + ifeq "$(HAVE_QT5)" "Y" + EXTRA_FILES += $(GAMEDIR)/Qt5Core.dll + EXTRA_FILES += $(GAMEDIR)/Qt5Gui.dll + EXTRA_FILES += $(GAMEDIR)/Qt5Widgets.dll + else + # TODO: define QT 4 DLLs here + EXTRA_FILES += $(GAMEDIR)/QtCore4.dll + EXTRA_FILES += $(GAMEDIR)/QtGui4.dll + endif + EXTRA_FILES += $(GAMEDIR)/rip.xpm +endif #========================================== # Util builds @@ -208,6 +273,8 @@ LFLAGSU = $(LFLAGSBASEC) CFLAGS = $(CFLAGSBASE) $(WINPFLAG) $(DLBFLG) lflags = $(LFLAGSBASEC) $(linkdebuf) +CXXFLAGS = $(CFLAGS) + ifeq "$(USE_DLB)" "Y" DLB = nhdat else @@ -320,12 +387,28 @@ GUIOBJ = $(O)mhaskyn.o $(O)mhdlg.o \ $(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \ $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \ $(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o +ifeq "$(WANT_WIN_QT4)" "Y" + GUIOBJ += $(O)qt4bind.o $(O)qt4click.o $(O)qt4clust.o $(O)qt4delay.o \ + $(O)qt4glyph.o $(O)qt4icon.o $(O)qt4inv.o $(O)qt4key.o $(O)qt4line.o \ + $(O)qt4main.o $(O)qt4map.o $(O)qt4menu.o $(O)qt4msg.o $(O)qt4plsel.o \ + $(O)qt4rip.o $(O)qt4set.o $(O)qt4stat.o $(O)qt4str.o $(O)qt4streq.o \ + $(O)qt4svsel.o $(O)qt4win.o $(O)qt4xcmd.o $(O)qt4yndlg.o +endif GUIHDR = $(MSWIN)/mhaskyn.h $(MSWIN)/mhdlg.h $(MSWIN)/mhfont.h \ $(MSWIN)/mhinput.h $(MSWIN)/mhmain.h $(MSWIN)/mhmap.h \ $(MSWIN)/mhmenu.h $(MSWIN)/mhmsg.h $(MSWIN)/mhmsgwnd.h \ $(MSWIN)/mhrip.h $(MSWIN)/mhstatus.h \ $(MSWIN)/mhtext.h $(MSWIN)/resource.h $(MSWIN)/winMS.h +ifeq "$(WANT_WIN_QT4)" "Y" + GUIHDR += $(QT4)/qt4bind.h $(QT4)/qt4click.h $(QT4)/qt4clust.h \ + $(QT4)/qt4delay.h $(QT4)/qt4glyph.h $(QT4)/qt4icon.h $(QT4)/qt4inv.h \ + $(QT4)/qt4kde0.h $(QT4)/qt4key.h $(QT4)/qt4line.h $(QT4)/qt4main.h \ + $(QT4)/qt4map.h $(QT4)/qt4menu.h $(QT4)/qt4msg.h $(QT4)/qt4plsel.h \ + $(QT4)/qt4rip.h $(QT4)/qt4set.h $(QT4)/qt4stat.h $(QT4)/qt4str.h \ + $(QT4)/qt4streq.h $(QT4)/qt4svsel.h $(QT4)/qt4win.h $(QT4)/qt4xcmd.h \ + $(QT4)/qt4yndlg.h +endif KEYDLLS = $(GAMEDIR)/nhdefkey.dll $(GAMEDIR)/nh340key.dll $(GAMEDIR)/nhraykey.dll @@ -385,7 +468,7 @@ DATABASE = $(DAT)/data.base #================ RULES ================== #========================================== -.SUFFIXES: .exe .o .til .uu .c .y .l +.SUFFIXES: .exe .o .til .uu .c .y .l .moc #========================================== # Rules for files in src @@ -405,7 +488,7 @@ $(OBJ)/%.o : $(SSYS)/%.c $(cc) $(CFLAGS) -o$@ $< $(OBJ)/%.o : $(SSYS)/%.cpp - g++ $(CFLAGS) -std=c++11 -o$@ $< + $(cxx) $(CXXFLAGS) -std=c++11 -o$@ $< #========================================== # Rules for files in sys/winnt @@ -451,6 +534,21 @@ $(OBJ)/%.o : $(TTY)/%.c $(OBJ)/%.o : $(MSWIN)/%.c $(cc) $(CFLAGS) -o$@ $< +#========================================== +# Rules for files in win/Qt4 +#========================================== + +ifeq "$(HAVE_QT5)" "Y" +QT4_CXXFLAGS = -std=c++11 +else +QT4_CXXFLAGS = +endif +$(OBJ)/%.o : $(QT4)/%.cpp + $(cxx) $(CXXFLAGS) $(QT4_CXXFLAGS) -I$(MSWIN) -I$(QT4_DIRECTORY)/include -o$@ $< + +$(QT4)/%.moc : $(QT4)/%.h + $(QT4_DIRECTORY)\bin\moc -o $@ $< + #========================================== #=============== TARGETS ================== #========================================== @@ -472,7 +570,7 @@ default : install all : install -install: graphicschk $(O)obj.tag $(GAMEDIR)/NetHack.exe $(GAMEDIR)/NetHackW.exe $(O)install.tag +install: graphicschk $(O)obj.tag $(GAMEDIR)/NetHack.exe $(GAMEDIR)/NetHackW.exe $(O)install.tag $(EXTRA_FILES) @echo NetHack is up to date. @echo Done. @@ -1035,6 +1133,7 @@ spotless: clean $(subst /,\,if exist $(U)recover.exe del $(U)recover.exe) $(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst) $(subst /,\,if exist nhdat. del nhdat.) + $(subst /,\,if exist $(QT4)/*.moc del $(QT4)/*.moc) $(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon) $(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave) $(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph) @@ -1081,6 +1180,40 @@ clean: # OTHER DEPENDENCIES #=================================================================== +# Other files needed by some ports +$(GAMEDIR)/Qt5Core.dll : $(QT4_DIRECTORY)/bin/Qt5Core.dll + $(subst /,\,@copy $< $@ >nul) + +$(GAMEDIR)/Qt5Gui.dll : $(QT4_DIRECTORY)/bin/Qt5Gui.dll + $(subst /,\,@copy $< $@ >nul) + +$(GAMEDIR)/Qt5Widgets.dll : $(QT4_DIRECTORY)/bin/Qt5Widgets.dll + $(subst /,\,@copy $< $@ >nul) + +$(GAMEDIR)/QtCore4.dll : $(QT4_DIRECTORY)/bin/QtCore4.dll + $(subst /,\,@copy $< $@ >nul) + +$(GAMEDIR)/QtGui4.dll : $(QT4_DIRECTORY)/bin/QtGui4.dll + $(subst /,\,@copy $< $@ >nul) + +$(GAMEDIR)/nhtiles.bmp : $(SRC)/tiles.bmp + $(subst /,\,@copy $< $@ >nul) + +$(GAMEDIR)/rip.xpm : ../win/X11/rip.xpm + $(subst /,\,@copy $< $@ >nul) + + +# Dependencies on .moc files (for Qt 4 or 5) +$(OBJ)/qt4main.o : $(QT4)/qt4main.cpp $(QT4)/qt4main.moc $(QT4)/qt4kde0.moc +$(OBJ)/qt4map.o : $(QT4)/qt4map.cpp $(QT4)/qt4map.moc +$(OBJ)/qt4menu.o : $(QT4)/qt4menu.cpp $(QT4)/qt4menu.moc +$(OBJ)/qt4msg.o : $(QT4)/qt4msg.cpp $(QT4)/qt4msg.moc +$(OBJ)/qt4plsel.o : $(QT4)/qt4plsel.cpp $(QT4)/qt4plsel.moc +$(OBJ)/qt4set.o : $(QT4)/qt4set.cpp $(QT4)/qt4set.moc +$(OBJ)/qt4stat.o : $(QT4)/qt4stat.cpp $(QT4)/qt4stat.moc +$(OBJ)/qt4xcmd.o : $(QT4)/qt4xcmd.cpp $(QT4)/qt4xcmd.moc +$(OBJ)/qt4yndlg.o : $(QT4)/qt4yndlg.cpp $(QT4)/qt4yndlg.moc + # # dat dependencies # From 8dbaafbb7b7a49a9fade8377db65fad776462461 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:19:35 -0400 Subject: [PATCH 13/20] Ignore Win32 build products --- include/.gitignore | 1 + src/.gitignore | 3 +++ sys/winnt/.gitignore | 1 + util/.gitignore | 2 ++ win/Qt4/.gitignore | 1 + 5 files changed, 8 insertions(+) create mode 100644 sys/winnt/.gitignore create mode 100644 win/Qt4/.gitignore diff --git a/include/.gitignore b/include/.gitignore index cb5a92532..4906e6ce8 100644 --- a/include/.gitignore +++ b/include/.gitignore @@ -6,3 +6,4 @@ vis_tab.h dgn_comp.h lev_comp.h tile.h +win32api.h diff --git a/src/.gitignore b/src/.gitignore index 514698044..df4310a30 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -8,3 +8,6 @@ nethack *.o tiles.bmp *.moc +graphicschk +nhdat +o diff --git a/sys/winnt/.gitignore b/sys/winnt/.gitignore new file mode 100644 index 000000000..1fe00dd91 --- /dev/null +++ b/sys/winnt/.gitignore @@ -0,0 +1 @@ +NetHack.ico diff --git a/util/.gitignore b/util/.gitignore index 95b7c4db1..c211d0a77 100644 --- a/util/.gitignore +++ b/util/.gitignore @@ -1,6 +1,8 @@ dgn_lex.c +dgn_flex.c dgn_yacc.c lev_lex.c +lev_flex.c lev_yacc.c tiletxt.c makedefs diff --git a/win/Qt4/.gitignore b/win/Qt4/.gitignore new file mode 100644 index 000000000..e978b1085 --- /dev/null +++ b/win/Qt4/.gitignore @@ -0,0 +1 @@ +*.moc From 41fdc79b7b80a371cb51d101b2923c56bb20c98b Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:19:54 -0400 Subject: [PATCH 14/20] Qt on Win32: resolve conflict over boolean type --- include/global.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/global.h b/include/global.h index f92ce3cfc..23183005d 100644 --- a/include/global.h +++ b/include/global.h @@ -58,9 +58,14 @@ * since otherwise comparisons with signed quantities are done incorrectly */ typedef schar xchar; +#if defined(__GNUC__) && defined(WIN32) && defined(__cplusplus) +/* Resolve conflict with Qt 5 and MinGW-w32 */ +typedef uchar boolean; /* 0 or 1 */ +#else #ifndef SKIP_BOOLEAN typedef xchar boolean; /* 0 or 1 */ #endif +#endif #ifndef TRUE /* defined in some systems' native include files */ #define TRUE ((boolean) 1) From 7de9266b049561da957ed6fda25a95464667a21f Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:20:21 -0400 Subject: [PATCH 15/20] Qt on Win32: add stub for Qt window_procs --- sys/winnt/stubs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index 2a0d10e79..64193ce17 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -12,6 +12,10 @@ int GUILaunched; struct window_procs mswin_procs = { "guistubs" }; +#ifdef QT_GRAPHICS +struct window_procs Qt_procs = { "guistubs" }; +int qt_tilewidth, qt_tileheight, qt_fontsize, qt_compact_mode; +#endif void mswin_destroy_reg() { From 3479c471dd79b65ff8721d1cbf820efa64776fde Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:20:47 -0400 Subject: [PATCH 16/20] Qt on Win32: changes needed for Win32 * Fix an include directory * Use strchr instead of index * play_usersound conflicts with another function --- win/Qt4/qt4bind.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/win/Qt4/qt4bind.cpp b/win/Qt4/qt4bind.cpp index 980c9ef9e..27db51868 100644 --- a/win/Qt4/qt4bind.cpp +++ b/win/Qt4/qt4bind.cpp @@ -18,7 +18,7 @@ extern "C" { #undef max #include -#include +#include #if QT_VERSION >= 0x050000 #include #include @@ -350,9 +350,9 @@ void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist) complain = must_exist; } else { while (dlb_fgets(buf, BUFSZ, f)) { - if ((cr = index(buf, '\n')) != 0) *cr = 0; + if ((cr = strchr(buf, '\n')) != 0) *cr = 0; #ifdef MSDOS - if ((cr = index(buf, '\r')) != 0) *cr = 0; + if ((cr = strchr(buf, '\r')) != 0) *cr = 0; #endif window->PutStr(ATR_NONE, tabexpand(buf)); } @@ -508,8 +508,8 @@ char NetHackQtBind::qt_yn_function(const char *question_, const char *choices, C message = QString("%1 [%2] ").arg(question, choicebuf); if (def) message += QString("(%1) ").arg(QChar(def)); // escape maps to 'q' or 'n' or default, in that order - yn_esc_map = (index(choices, 'q') ? 'q' : - (index(choices, 'n') ? 'n' : def)); + yn_esc_map = (strchr(choices, 'q') ? 'q' : + (strchr(choices, 'n') ? 'n' : def)); } else { message = question; } @@ -542,7 +542,7 @@ char NetHackQtBind::qt_yn_function(const char *question_, const char *choices, C char ch=NetHackQtBind::qt_nhgetch(); if (ch=='\033') { result=yn_esc_map; - } else if (choices && !index(choices,ch)) { + } else if (choices && !strchr(choices,ch)) { if (def && (ch==' ' || ch=='\r' || ch=='\n')) { result=def; } else { @@ -800,6 +800,7 @@ struct window_procs Qt_procs = { genl_can_suspend_yes, }; +#ifndef WIN32 extern "C" void play_usersound(const char* filename, int volume) { #ifdef USER_SOUNDS @@ -808,3 +809,4 @@ extern "C" void play_usersound(const char* filename, int volume) #endif #endif } +#endif From 25f770509a7c69de5d11e894f2f9a142749f9353 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Wed, 23 May 2018 23:38:11 -0400 Subject: [PATCH 17/20] -ansi -pedantic can't come after -std=c++11 --- sys/unix/hints/macosx10.10-qt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/unix/hints/macosx10.10-qt b/sys/unix/hints/macosx10.10-qt index ff9869251..3d9747649 100644 --- a/sys/unix/hints/macosx10.10-qt +++ b/sys/unix/hints/macosx10.10-qt @@ -65,7 +65,7 @@ CXX=clang++ -std=gnu++11 # #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN -CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic +CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so # leave it out by default. #CFLAGS+=-Wunreachable-code From c13eed736945dd06a495d65a322f882c8d9eb6c9 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Sun, 27 May 2018 23:32:49 -0400 Subject: [PATCH 18/20] Qt4: Hide buttons not matching typed command There are way too many buttons on the extended command window. Let the user type a letter or two, and hide the buttons that don't match. --- win/Qt4/qt4xcmd.cpp | 14 ++++++++++++++ win/Qt4/qt4xcmd.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/win/Qt4/qt4xcmd.cpp b/win/Qt4/qt4xcmd.cpp index 3e8703e49..7c078f640 100644 --- a/win/Qt4/qt4xcmd.cpp +++ b/win/Qt4/qt4xcmd.cpp @@ -66,6 +66,7 @@ NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(QWidget *parent) : pb->setMinimumSize(butw,pb->sizeHint().height()); group->addButton(pb, i+1); gl->addWidget(pb,i/ncols,i%ncols); + buttons.append(pb); } group->addButton(can, 0); connect(group,SIGNAL(buttonPressed(int)),this,SLOT(done(int))); @@ -92,6 +93,7 @@ void NetHackQtExtCmdRequestor::keyPressEvent(QKeyEvent *event) QString promptstr = prompt->text(); if (promptstr != "#") prompt->setText(promptstr.left(promptstr.size()-1)); + enableButtons(); } else { @@ -111,6 +113,7 @@ void NetHackQtExtCmdRequestor::keyPressEvent(QKeyEvent *event) done(match+1); else if (matches >= 2) prompt->setText(promptstr); + enableButtons(); } } @@ -131,4 +134,15 @@ int NetHackQtExtCmdRequestor::get() return result()-1; } +// Enable only buttons that match the current prompt string +void NetHackQtExtCmdRequestor::enableButtons() +{ + QString typedstr = prompt->text().mid(1); // skip the '#' + std::size_t len = typedstr.size(); + + for (auto b = buttons.begin(); b != buttons.end(); ++b) { + (*b)->setVisible((*b)->text().left(len) == typedstr); + } +} + } // namespace nethack_qt4 diff --git a/win/Qt4/qt4xcmd.h b/win/Qt4/qt4xcmd.h index 29ba23f0d..338ef3370 100644 --- a/win/Qt4/qt4xcmd.h +++ b/win/Qt4/qt4xcmd.h @@ -21,6 +21,8 @@ public: private: QLabel *prompt; + QVector buttons; + void enableButtons(); private slots: void cancel(); From 8210f816182ba52c420de8939acc7d02457be380 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 10 Sep 2018 21:32:30 +0300 Subject: [PATCH 19/20] fixes update --- doc/fixes36.2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index e34ec28fc..ce1523d0a 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -158,6 +158,9 @@ unix: Makefile.src and Makefile.utl inadvertently relied on a 'gnu make' verbose so doesn't use '$<' for multi-prerequisite targets unless specifically requested; use 'make QUIETCC=1 ' to get the 3.6.1 behavior back +Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason) +Qt: enable compiling Qt5 on Windows (Ray Chason) +Qt: entering extended commands, hide non-matching ones General New Features From 59019910b5ad6deb0092e2ea8b82b3fe94acd8f5 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 10 Sep 2018 15:27:05 -0400 Subject: [PATCH 20/20] heed OPTIONS=symset:default in config file in windows and msdos --- doc/fixes36.2 | 1 + src/options.c | 9 +++++++++ sys/share/pcmain.c | 10 ---------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index ce1523d0a..9f76fc3e8 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -148,6 +148,7 @@ windows-tty: Use nhraykey by default if the players keyboard layout is non-english as reported in H4216 windows-tty: We now support changing altkeyhandler in game windows: Added ntassert() mechanism for Windows based port use +windows: heed OPTIONS=symset:default in config file if it is present tty: significant optimizations for performance and per field rendering tty: use WC2_FLUSH_STATUS to buffer changes until BL_FLUSH is received tty: support BL_RESET in status_update to force an update to all status fields diff --git a/src/options.c b/src/options.c index b07c7b818..a283f4283 100644 --- a/src/options.c +++ b/src/options.c @@ -778,6 +778,15 @@ initoptions_init() #endif #endif /* UNIX || VMS */ +#if defined(MSDOS) || defined(WIN32) + /* Use IBM defaults. Can be overridden via config file */ + if (!symset[PRIMARY].name) { + load_symset("IBMGraphics_2", PRIMARY); + } + if (!symset[ROGUESET].name) { + load_symset("RogueEpyx", ROGUESET); + } +#endif #ifdef MAC_GRAPHICS_ENV if (!symset[PRIMARY].name) load_symset("MACGraphics", PRIMARY); diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index cfb7dbf8a..c55805b09 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -497,16 +497,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ #endif #endif -#if defined(MSDOS) || defined(WIN32) - /* Player didn't specify any symbol set so use IBM defaults */ - if (!symset[PRIMARY].name) { - load_symset("IBMGraphics_2", PRIMARY); - } - if (!symset[ROGUESET].name) { - load_symset("RogueEpyx", ROGUESET); - } -#endif - #if defined(MSDOS) || defined(WIN32) init_nhwindows(&argc, argv); #else