From b113aa7439a4111c7fff27fc9232b1599a669e18 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 29 Nov 2018 18:02:52 -0800 Subject: [PATCH 01/12] more steed dismount By creating a spot of lava, filling up the whole level, and creating a lurker above, I managed to trigger the impossible "Dismount: can't place former steed on map" that was added earlier today. I also was told that my god was displeased even though the engulfer's attack was responsible. This addresses both situations. I can't trigger that impossible any more, and only voluntary dismount blames the hero if it's killed because there's nowhere to place it. Hero is still blamed for any dismount that kills the steed while flying or levitating over dangerous terrain--hero took steed into jeopardy. --- doc/fixes36.2 | 2 ++ src/steed.c | 48 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 6d64fb8fd..904df729f 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -229,6 +229,8 @@ stinking cloud placed near water could kill underwater creatures applying--rather than wielding--a cursed polearm or weapon-tool didn't report that it had become welded to hero's hand(s) the message when riding a steed into a pit was composed but not shown +dismount that kills steed because there is no room to put it on map blamed the + hero; change that to only blame hero if dismount was voluntary Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/steed.c b/src/steed.c index 91ed935f4..65e5ebbae 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steed.c $NHDT-Date: 1543522486 2018/11/29 20:14:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.58 $ */ +/* NetHack 3.6 steed.c $NHDT-Date: 1543543362 2018/11/30 02:02:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -563,8 +563,17 @@ int reason; /* Player was thrown off etc. */ * be hostile terrain. */ steedcc.x = u.ux, steedcc.y = u.uy; - if (m_at(u.ux, u.uy)) - (void) enexto(&steedcc, u.ux, u.uy, mtmp->data); + if (m_at(u.ux, u.uy)) { + /* hero's spot has a monster in it; hero must have been plucked + from saddle as engulfer moved into his spot--other dismounts + shouldn't run into this situation; find nearest viable spot */ + if (!enexto(&steedcc, u.ux, u.uy, mtmp->data) + /* no spot? must have been engulfed by a lurker-above over + water or lava; try requesting a location for a flyer */ + && !enexto(&steedcc, u.ux, u.uy, &mons[PM_BAT])) + /* still no spot; last resort is any spot within bounds */ + (void) enexto(&steedcc, u.ux, u.uy, &mons[PM_GHOST]); + } if (!m_at(steedcc.x, steedcc.y)) { if (mtmp->mhp < 1) mtmp->mhp = 0; /* make sure it isn't negative */ @@ -576,8 +585,8 @@ int reason; /* Player was thrown off etc. */ } if (!DEADMONSTER(mtmp)) { - /* Set player and steed's position. Try moving the player first - unless we're in the midst of creating a bones file. */ + /* if for bones, there's no reason to place the hero; + we want to make room for potential ghost, so move steed */ if (reason == DISMOUNT_BONES) { /* move the steed to an adjacent square */ if (enexto(&cc, u.ux, u.uy, mtmp->data)) @@ -586,6 +595,8 @@ int reason; /* Player was thrown off etc. */ (void) rloc(mtmp, FALSE); return; } + + /* Set hero's and/or steed's positions. Try moving the hero first. */ if (!u.uswallow && !u.ustuck && have_spot) { struct permonst *mdat = mtmp->data; @@ -639,20 +650,29 @@ int reason; /* Player was thrown off etc. */ if (save_utrap) (void) mintrap(mtmp); } - /* Couldn't... try placing the steed */ + + /* Couldn't move hero... try moving the steed. */ } else if (enexto(&cc, u.ux, u.uy, mtmp->data)) { /* Keep player here, move the steed to cc */ rloc_to(mtmp, cc.x, cc.y); /* Player stays put */ - /* Otherwise, kill the steed */ - } else { - killed(mtmp); - adjalign(-1); - } - } - /* Return the player to the floor */ - if (reason != DISMOUNT_ENGULFED) { + /* Otherwise, kill the steed. */ + } else { + if (reason == DISMOUNT_BYCHOICE) { + /* [un]#ride: hero gets credit/blame for killing steed */ + killed(mtmp); + adjalign(-1); + } else { + /* other dismount: kill former steed with no penalty; + damage type is just "neither AD_DGST nor -AD_RBRE" */ + monkilled(mtmp, "", -AD_PHYS); + } + } + } /* !DEADMONST(mtmp) */ + + /* usually return the hero to the surface */ + if (reason != DISMOUNT_ENGULFED && reason != DISMOUNT_BONES) { in_steed_dismounting = TRUE; (void) float_down(0L, W_SADDLE); in_steed_dismounting = FALSE; From 351c731e06a04ea0bb24cae33d631c4051f58e57 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 29 Nov 2018 18:19:20 -0800 Subject: [PATCH 02/12] downgrade Sting's glow Change "(glowing light blue)" to "(light blue aura)" so that there's less suggestion that it might function as a light source. --- doc/fixes36.2 | 3 +++ src/objnam.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 904df729f..6dc730b5b 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -231,6 +231,9 @@ applying--rather than wielding--a cursed polearm or weapon-tool didn't report the message when riding a steed into a pit was composed but not shown dismount that kills steed because there is no room to put it on map blamed the hero; change that to only blame hero if dismount was voluntary +to emphasize that it's not a light source, change description of wielded Sting + from "(glowing light blue)" to "(light blue aura)" when sighted and + from "(glowing)" to nothing (not warm enough to feel) when blind Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index 3fc3e01d2..af74c3bf0 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1539938837 2018/10/19 08:47:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.214 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1543544340 2018/11/30 02:19:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.226 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1154,11 +1154,11 @@ unsigned doname_flags; (obj->otyp == AKLYS) ? "tethered " : "", hand_s); if (warn_obj_cnt && obj == uwep && (EWarn_of_mon & W_WEP) != 0L) { - /* presumably can be felt when blind */ - Strcat(bp, " (glowing"); + /* this used to be "(glowing )" when sighted or + "(glowing)" when blind (via feeling warmth), but it + isn't a light source so describe something fainter */ if (!Blind) - Sprintf(eos(bp), " %s", glow_color(obj->oartifact)); - Strcat(bp, ")"); + Sprintf(eos(bp), " (%s aura)", glow_color(obj->oartifact)); } } } From 4ffe088a67fbd0f35d3949790a645429897c0193 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 29 Nov 2018 18:33:34 -0800 Subject: [PATCH 03/12] workaround for ^G "senior moment" The less said, the better. --- src/mondata.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mondata.c b/src/mondata.c index 74814bd3d..62dea9a10 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.c $NHDT-Date: 1539938825 2018/10/19 08:47:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */ +/* NetHack 3.6 mondata.c $NHDT-Date: 1543545188 2018/11/30 02:33:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.69 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -739,6 +739,10 @@ const char *in_str; /* Outdated names */ { "invisible stalker", PM_STALKER }, { "high-elf", PM_ELVENKING }, /* PM_HIGH_ELF is obsolete */ + /* other misspellings or incorrect words */ + { "wood-elf", PM_WOODLAND_ELF }, + { "wood elf", PM_WOODLAND_ELF }, + { "woodland nymph", PM_WOOD_NYMPH }, { "halfling", PM_HOBBIT }, /* potential guess for polyself */ { "genie", PM_DJINNI }, /* potential guess for ^G/#wizgenesis */ /* Hyphenated names -- it would be nice to handle these via From bb8ba53ed9962c1ccb731e01ff85138948e593b0 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 29 Nov 2018 18:45:37 -0800 Subject: [PATCH 04/12] vms/Makefile.src Catch up with recent changes to vmsbuild.com and unix/Makefile.src. --- sys/vms/Makefile.src | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/vms/Makefile.src b/sys/vms/Makefile.src index d6e1a9a25..a29367655 100644 --- a/sys/vms/Makefile.src +++ b/sys/vms/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile (VMS) - for building nethack itself. -# NetHack 3.6 Makefile.src $NHDT-Date: 1542388601 2018/11/16 17:16:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.31 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1543545915 2018/11/30 02:45:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.32 $ # Copyright (c) 2011 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. @@ -140,9 +140,9 @@ VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(RANDSRC) $(GENCSRC) HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h color.h \ config.h config1.h context.h coord.h decl.h def_os2.h display.h \ dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h global.h \ - hack.h lev.h macconf.h mextra.h mfndpos.h micro.h \ - mkroom.h monattk.h mondata.h monflag.h monst.h monsym.h obj.h \ - objclass.h os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h \ + hack.h lev.h macconf.h mextra.h mfndpos.h micro.h mkroom.h \ + monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \ + os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h \ region.h rm.h sp_lev.h spell.h sys.h system.h tcap.h timeout.h \ tosconf.h tradstdc.h trampoli.h trap.h unixconf.h vision.h \ vmsconf.h wintty.h winX.h winprocs.h wintype.h you.h youprop.h @@ -206,8 +206,8 @@ nethack.opt : $(MAKEFILE) # this file @ write f f$edit("$(HOBJ5)","COLLAPSE") @ write f f$edit("$(HOBJ6)","COLLAPSE") @ write f "sys$library:starlet.olb/Include=(lib$initialize) - @ write f \ - "psect_attr=lib$initialize, Con,Usr,noPic,Rel,Gbl,noShr,noExe,Rd,noWrt,Long" + @ write f "! psect_attributes Usr, noPic, and Long removed" + @ write f "psect_attr=lib$initialize, Con,Rel,Gbl,noShr,noExe,Rd,noWrt" @ write f "iosegment=128" close f @@ -378,7 +378,7 @@ attrib.obj : attrib.c $(HACK_H) ball.obj : ball.c $(HACK_H) bones.obj : bones.c $(HACK_H) $(INC)lev.h botl.obj : botl.c $(HACK_H) -cmd.obj : cmd.c $(HACK_H) $(INC)func_tab.h +cmd.obj : cmd.c $(HACK_H) $(INC)lev.h $(INC)func_tab.h dbridge.obj : dbridge.c $(HACK_H) decl.obj : decl.c $(HACK_H) detect.obj : detect.c $(HACK_H) $(INC)artifact.h From 3811845dbf9389f1e1e127e9acf665c9371ffadf Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 29 Nov 2018 22:23:17 -0500 Subject: [PATCH 05/12] more Makefile.gcc work Still not completed --- sys/winnt/Makefile.gcc | 74 ++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index e15e22c9c..c5e5083f8 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -91,8 +91,8 @@ TARGET_CPU=x86 # of your PDCurses C files which must already be resident on # your machine. # -#ADD_CURSES=Y -#PDCURSES_TOP=..\..\pdcurses +ADD_CURSES=Y +PDCURSES_TOP=..\..\pdcurses #4b Qt # @@ -207,6 +207,7 @@ endif #ZLIB = zlib.lib # Have windows path styles available for use in commands +W_OBJ =$(subst /,\, $(OBJ)) W_INCL =$(subst /,\, $(INCL)) W_DAT =$(subst /,\, $(DAT)) W_DOC =$(subst /,\, $(DOC)) @@ -494,7 +495,7 @@ cdebug = linkdebug = endif -CFLAGSBASE = -c $(cflags) $(WINPINC) $(cdebug) +CFLAGSBASE = -c $(cflags) $(WINPINC) $(cdebug) $(CURSESDEF) #LFLAGSBASEC = $(linkdebug) #LFLAGSBASEG = $(linkdebug) -mwindows @@ -625,7 +626,7 @@ $(OBJ)/%.o : $(MSWIN)/%.c #========================================== $(OBJ)/%.o : $(WCURSES)/%.c - $(cc) $(CFLAGS) -o$@ $< + $(cc) $(PDCINCL) $(CFLAGS) -o$@ $< #========================================== # Rules for files in PDCurses @@ -820,8 +821,8 @@ $(O)conres.o: $(MSWSYS)/console.rc $(MSWSYS)/NetHack.ico #========================================== gamedir.tag: - test -d $(GAMEDIR) || echo creating directory $(GAMEDIR) - test -d $(GAMEDIR) || mkdir $(GAMEDIR) + test -d $(GAMEDIR) || echo creating directory $(W_GAMEDIR) + test -d $(GAMEDIR) || mkdir $(W_GAMEDIR) test -d $(GAMEDIR) && echo directory created > $@ $(GAMEDIR)/NetHack.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)guistub.o \ @@ -961,7 +962,7 @@ $(O)uudecode.o: $(SSYS)/uudecode.c $(MSWSYS)/NetHack.ico : $(U)uudecode.exe $(MSWSYS)/nhico.uu $(subst /,\,$(U)uudecode.exe $(MSWSYS)/nhico.uu) - copy NetHack.ico $@ + copy NetHack.ico $(W_MSWSYS)\NetHack.ico del NetHack.ico $(MSWIN)/NetHack.ico : $(MSWSYS)/NetHack.ico @@ -1223,9 +1224,11 @@ $(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS) #========================================== spotless: clean - if exist initialchk del initialchk -ifneq "$(OBJ)" "" - if exist $(W_OBJ)\* rmdir $(W_OBJ) /s /Q + if exist o\* del /Q o\* + -test -d o && rd o + if exist objdir.tag del objdir.tag + if exist gamedir.tag del gamedir.tag +ifneq "$(W_GAMEDIR)" "" if exist $(W_GAMEDIR))\nhdefkey.dll del $(W_GAMEDIR))\nhdefkey.dll if exist $(W_GAMEDIR))\nh340key.dll del $(W_GAMEDIR))\nh340key.dll if exist $(W_GAMEDIR))\nhraykey.dll del $(W_GAMEDIR))\nhraykey.dll @@ -1233,14 +1236,13 @@ ifneq "$(OBJ)" "" if exist $(W_GAMEDIR))\NetHack.pdb del $(W_GAMEDIR))\NetHack.pdb if exist $(W_GAMEDIR))\nhdat del $(W_GAMEDIR))\nhdat endif - if exist $(W_INCL)\date.h del $(W_INCL)\date.h - if exist $(W_INCL)\onames.h del $(W_INCL)\onames.h - if exist $(W_INCL)\pm.h del $(W_INCL)\pm.h - if exist $(W_INCL)\vis_tab.h del $(W_INCL)\vis_tab.h +ifneq "$(W_SRC)" "" if exist $(W_SRC)\vis_tab.c del $(W_SRC)\vis_tab.c if exist $(W_SRC)\tile.c del $(W_SRC)\tile.c - if exist $(W_UTIL)\*.lnk del $(W_UTIL)\*.lnk - if exist $(W_UTIL)\*.map del $(W_UTIL)\*.map + if exist $(W_SRC)\vis_tab.c del $(W_SRC)\vis_tab.c + if exist nhdat. del nhdat. +endif +ifneq "$(W_DAT)" "" if exist $(W_DAT)\data del $(W_DAT)\data if exist $(W_DAT)\rumors del $(W_DAT)\rumors if exist $(W_DAT)\engrave del $(W_DAT)\engrave @@ -1282,13 +1284,15 @@ endif if exist $(W_DAT)\wizard?.lev del $(W_DAT)\wizard?.lev if exist $(W_DAT)\dlb.lst del $(W_DAT)\dlb.lst if exist $(W_DAT)\porthelp del $(W_DAT)\porthelp +endif +ifneq "$(W_OBJ)" "" if exist $(W_OBJ)\sp_lev.tag del $(W_OBJ)\sp_lev.tag - if exist $(W_SRC)\vis_tab.c del $(W_SRC)\vis_tab.c - if exist nhdat. del nhdat. if exist $(W_OBJ)\obj.tag del $(W_OBJ)\obj.tag if exist $(W_OBJ)\gamedir.tag del $(W_OBJ)\gamedir.tag if exist $(W_OBJ)\nh*key.lib del $(W_OBJ)\nh*key.lib if exist $(W_OBJ)\nh*key.exp del $(W_OBJ)\nh*key.exp +endif +ifneq "$(W_MSWIN)" "" if exist $(W_MSWIN)\mnsel.bmp del $(W_MSWIN)\mnsel.bmp if exist $(W_MSWIN)\mnselcnt.bmp del $(W_MSWIN)\mnselcnt.bmp if exist $(W_MSWIN)\mnunsel.bmp del $(W_MSWIN)\mnunsel.bmp @@ -1297,23 +1301,52 @@ endif if exist $(W_MSWIN)\rip.bmp del $(W_MSWIN)\rip.bmp if exist $(W_MSWIN)\splash.bmp del $(W_MSWIN)\splash.bmp if exist $(W_MSWIN)\nethack.ico del $(W_MSWIN)\nethack.ico +endif +ifneq "$(W_MSWSYS)" "" if exist $(W_MSWSYS)\nethack.ico del $(W_MSWSYS)\nethack.ico +endif +ifneq "$(W_UTIL)" "" + if exist $(W_UTIL)\*.lnk del $(W_UTIL)\*.lnk + if exist $(W_UTIL)\*.map del $(W_UTIL)\*.map if exist $(W_UTIL)\recover.exe del $(W_UTIL)\recover.exe if exist $(W_UTIL)\tile2bmp.exe del $(W_UTIL)\tile2bmp.exe if exist $(W_UTIL)\tilemap.exe del $(W_UTIL)\tilemap.exe if exist $(W_UTIL)\uudecode.exe del $(W_UTIL)\uudecode.exe if exist $(W_UTIL)\dlb_main.exe del $(W_UTIL)\dlb_main.exe +endif +ifneq "$(W_INCL)" "" + if exist $(W_INCL)\date.h del $(W_INCL)\date.h + if exist $(W_INCL)\onames.h del $(W_INCL)\onames.h + if exist $(W_INCL)\pm.h del $(W_INCL)\pm.h + if exist $(W_INCL)\vis_tab.h del $(W_INCL)\vis_tab.h +endif ifeq "$(ADD_CURSES)" "Y" +ifneq "$(W_OBJ)" "" if exist $(W_OBJ)\pdcurses.lib del $(W_OBJ)\pdcurses.lib endif +endif + if exist $(W_GAMEDIR)\license. del $(W_GAMEDIR)\license. + if exist $(W_GAMEDIR)\nh340key.dll del $(W_GAMEDIR)\nh340key.dll + if exist $(W_GAMEDIR)\nhdefkey.dll del $(W_GAMEDIR)\nhdefkey.dll + if exist $(W_GAMEDIR)\nhraykey.dll del $(W_GAMEDIR)\nhraykey.dll + -test -d ..\binary && rd ..\binary + clean: - if exist $(W_OBJ)\*.o del $(W_OBJ)\*.o - if exist $(W_OBJ)\utility.tag del $(W_OBJ)\utility.tag + if exist initialchk del initialchk + if exist install.tag del install.tag + if exist utility.tag del utility.tag +ifneq "$(W_UTIL)" "" if exist $(W_UTIL)\makedefs.exe del $(W_UTIL)\makedefs.exe if exist $(W_UTIL)\levcomp.exe del $(W_UTIL)\levcomp.exe if exist $(W_UTIL)\dgncomp.exe del $(W_UTIL)\dgncomp.exe +endif +ifneq "$(W_SRC)" "" if exist $(W_SRC)\*.lnk del $(W_SRC)\*.lnk if exist $(W_SRC)\*.map del $(W_SRC)\*.map +endif +ifneq "$(W_OBJ)" "" + if exist $(W_OBJ)\*.o del $(W_OBJ)\*.o + if exist $(W_OBJ)\utility.tag del $(W_OBJ)\utility.tag if exist $(W_OBJ)\install.tag del $(W_OBJ)\install.tag if exist $(W_OBJ)\console.res del $(W_OBJ)\console.res if exist $(W_OBJ)\dgncomp.MAP del $(W_OBJ)\dgncomp.MAP @@ -1346,6 +1379,7 @@ clean: if exist $(W_OBJ)\sp_lev.tag del $(W_OBJ)\sp_lev.tag if exist $(W_OBJ)\uudecode.MAP del $(W_OBJ)\uudecode.MAP if exist $(W_OBJ)\uudecode.PDB del $(W_OBJ)\uudecode.PDB +endif rem rem defer to the steps in ../win/win32/levstuff-mingw32.mak rem From 7495d0f2f47fa2b6bf08dae67593e6f125ed5395 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 29 Nov 2018 22:32:36 -0500 Subject: [PATCH 06/12] more Windows gcc cleanup Still not finished --- include/ntconf.h | 9 +++++++++ sys/winnt/nttty.c | 2 +- sys/winnt/stubs.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/ntconf.h b/include/ntconf.h index 73d421fd8..bf98fec65 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -94,6 +94,15 @@ extern void FDECL(interject, (int)); *=============================================== */ +#ifdef __MINGW32__ +#ifdef strncasecmp +#undef strncasecmp +#endif +#ifdef strcasecmp +#undef strcasecmp +#endif +#endif + #ifdef _MSC_VER #if (_MSC_VER > 1000) /* Visual C 8 warning elimination */ diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 579125867..b71133af2 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -1889,7 +1889,7 @@ void nethack_enter_nttty() error("Unable to load nhraykey.dll"); } } -#endif TTY_GRAPHICS +#endif /* TTY_GRAPHICS */ /* this is used as a printf() replacement when the window * system isn't initialized yet diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index bb5ad82e4..123ae3b72 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -7,7 +7,7 @@ #ifdef GUISTUB #ifdef TTYSTUB -#error You can't compile this with both GUISTUB and TTYSTUB defined. +#error You cannot compile this with both GUISTUB and TTYSTUB defined. #endif int GUILaunched; From ad838f22366875ee22448b2a9b6dab9cfc470812 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 29 Nov 2018 22:37:54 -0500 Subject: [PATCH 07/12] typos --- sys/winnt/Makefile.gcc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index c5e5083f8..e95ec3925 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -1229,12 +1229,13 @@ spotless: clean if exist objdir.tag del objdir.tag if exist gamedir.tag del gamedir.tag ifneq "$(W_GAMEDIR)" "" - if exist $(W_GAMEDIR))\nhdefkey.dll del $(W_GAMEDIR))\nhdefkey.dll - if exist $(W_GAMEDIR))\nh340key.dll del $(W_GAMEDIR))\nh340key.dll - if exist $(W_GAMEDIR))\nhraykey.dll del $(W_GAMEDIR))\nhraykey.dll - if exist $(W_GAMEDIR))\NetHack.exe del $(W_GAMEDIR))\NetHack.exe - if exist $(W_GAMEDIR))\NetHack.pdb del $(W_GAMEDIR))\NetHack.pdb - if exist $(W_GAMEDIR))\nhdat del $(W_GAMEDIR))\nhdat + if exist $(W_GAMEDIR)\NetHack.exe del $(W_GAMEDIR)\NetHack.exe + if exist $(W_GAMEDIR)\nhdefkey.dll del $(W_GAMEDIR)\nhdefkey.dll + if exist $(W_GAMEDIR)\nh340key.dll del $(W_GAMEDIR)\nh340key.dll + if exist $(W_GAMEDIR)\nhraykey.dll del $(W_GAMEDIR)\nhraykey.dll + if exist $(W_GAMEDIR)\NetHack.exe del $(W_GAMEDIR)\NetHack.exe + if exist $(W_GAMEDIR)\NetHack.pdb del $(W_GAMEDIR)\NetHack.pdb + if exist $(W_GAMEDIR)\nhdat del $(W_GAMEDIR)\nhdat endif ifneq "$(W_SRC)" "" if exist $(W_SRC)\vis_tab.c del $(W_SRC)\vis_tab.c From 75bf7c1975714310cdd0912f61638481030e897a Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 30 Nov 2018 15:26:38 +0200 Subject: [PATCH 08/12] X11: Disable menucolors when showing text files --- include/winX.h | 1 + win/X11/winX.c | 1 + win/X11/winmenu.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/winX.h b/include/winX.h index 1a061fa14..a1a560528 100644 --- a/include/winX.h +++ b/include/winX.h @@ -165,6 +165,7 @@ struct menu_info_t { boolean cancelled; /* Menu has been explicitly cancelled. */ boolean counting; /* true when menu_count has a valid value */ boolean permi; + boolean disable_mcolors; /* disable menucolors */ int permi_x, permi_y; /* perm_invent window x,y */ int permi_w, permi_h; /* perm_invent window wid, hei */ diff --git a/win/X11/winX.c b/win/X11/winX.c index 7337e6f04..09d5c7a50 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -1962,6 +1962,7 @@ boolean complain; wp->title = dupstr(str); wp->menu_information->permi = FALSE; + wp->menu_information->disable_mcolors = TRUE; (void) X11_select_menu(newwin, PICK_NONE, &menu_list); X11_destroy_nhwindow(newwin); } diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index 04d75e77f..7ac8d2491 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -1162,7 +1162,7 @@ struct menu *curr_menu; XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++; XtSetArg(args[num_args], nhStr(XtNvertDistance), 0); num_args++; - if (!iflags.use_menu_color + if (!iflags.use_menu_color || wp->menu_information->disable_mcolors || !get_menu_coloring(curr->str, &color, &attr)) attr = curr->attr; From 8a9f98f179789c6455efb67fcbe8a603af5dbeae Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 30 Nov 2018 16:00:24 -0500 Subject: [PATCH 09/12] curses follow-up bits Move the curses global variable defininitions to cursmain.c. Make the references to those global variables extern in include/wincurs.h Get rid of a warning: ../win/curses/cursmesg.c:379:9: warning: declaration shadows a variable in the global scope [-Wshadow] int orig_cursor = curs_set(0); Kludge for Visual Studio compiler: Add a stub- file for use in Windows curses port builds to ensure that a needed #pragma is invoked prior to compiling the file pdcscrn.c in the PDCurses source distribution. All command line options and compile of the file. It is unreasonable to expect a NetHack builder to have to tinker with the PDCurses source files in order to build NetHack. This kludge means the NetHack builder doesn't have to. The file stub-pdcscrn.c contains only two lines: #pragma warning(disable : 4996) #include "pdcscrn.c" Some day, if the PDCurses sources corrects the issue, this can go away. --- include/wincurs.h | 15 +++++---------- sys/winnt/Makefile.msc | 19 +++++++++++-------- sys/winnt/stub-pdcscrn.c | 15 +++++++++++++++ win/curses/cursmain.c | 10 ++++++++++ win/curses/cursmesg.c | 4 ++-- 5 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 sys/winnt/stub-pdcscrn.c diff --git a/include/wincurs.h b/include/wincurs.h index eb07879f4..55e7f1d22 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -7,16 +7,11 @@ /* Global declarations for curses interface */ -int term_rows, term_cols; /* size of underlying terminal */ - -WINDOW *base_term; /* underlying terminal window */ - -WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ - -int orig_cursor; /* Preserve initial cursor state */ - -boolean counting; /* Count window is active */ - +extern int term_rows, term_cols; /* size of underlying terminal */ +extern int orig_cursor; /* Preserve initial cursor state */ +extern WINDOW *base_term; /* underlying terminal window */ +extern boolean counting; /* Count window is active */ +extern WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ #define TEXTCOLOR /* Allow color */ #define NHW_END 19 diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 926eed8ad..4db6936ff 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -73,8 +73,8 @@ DEBUGINFO = Y # PDCurses header (.h) files and PDCURSES_C to the location # of your PDCurses C files. # -#ADD_CURSES=Y -#PDCURSES_TOP=..\..\pdcurses +ADD_CURSES=Y +PDCURSES_TOP=..\..\pdcurses # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -399,7 +399,7 @@ PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \ $(O)pdcsetsc.o $(O)pdcutil.o -PDCLIB = $(O)\pdcurses.lib +PDCLIB = $(O)pdcurses.lib PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCWINCON) @@ -1257,16 +1257,19 @@ $(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h $(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h @$(cc) $(cflagsBuild) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c -#========================================== +#=============================================================================== # PDCurses -#========================================== +#=============================================================================== -$(O)\pdcurses.lib : $(PDCLIBOBJS) $(PDCOBJS) +$(O)pdcurses.lib : $(PDCLIBOBJS) $(PDCOBJS) lib -nologo /out:$@ $(PDCLIBOBJS) $(PDCOBJS) -#========================================== +$(O)pdcscrn.o : $(PDCURSES_HEADERS) $(PDCWINCON)\pdcscrn.c $(MSWSYS)\stub-pdcscrn.c + $(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $(MSWSYS)\stub-pdcscrn.c + +#=============================================================================== # Housekeeping -#========================================== +#=============================================================================== spotless: clean ! IF ("$(OBJ)"!="") diff --git a/sys/winnt/stub-pdcscrn.c b/sys/winnt/stub-pdcscrn.c new file mode 100644 index 000000000..7588a782b --- /dev/null +++ b/sys/winnt/stub-pdcscrn.c @@ -0,0 +1,15 @@ +/* + * Use this stub to insert a needed pragma prior + * to compiling $(PDCWINCON)\pdcscrn.c in the + * PDCurses distribution. + * + * We don't want to ask NetHack builders to + * modify the PDCurses distribution in any way, + * we only ask that they have the original intact + * PDCurses source tree available during the build. + * + */ + +#pragma warning(disable : 4996) +#include "pdcscrn.c" + diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 8e20a31f8..2412def4b 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -80,6 +80,16 @@ struct window_procs curses_procs = { genl_can_suspend_yes, }; +/* + * Global variables for curses interface + */ + +int term_rows, term_cols; /* size of underlying terminal */ +int orig_cursor; /* Preserve initial cursor state */ +WINDOW *base_term; /* underlying terminal window */ +boolean counting; /* Count window is active */ +WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ + /* Track if we're performing an update to the permanent window. Needed since we aren't using the normal menu functions to handle the inventory window. */ diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 69215871a..df45d07b8 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -371,12 +371,12 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) char *tmpstr; /* for free() */ int maxy, maxx; /* linewrap / scroll */ int ch; - WINDOW *win = curses_get_nhwin(MESSAGE_WIN); int border_space = 0; int len = 0; /* of answer string */ boolean border = curses_window_has_border(MESSAGE_WIN); - int orig_cursor = curs_set(0); + + orig_cursor = curs_set(0); curses_get_window_size(MESSAGE_WIN, &height, &width); if (border) { From c0897f2f0d86d4336d2595a2fb66c53d1cf1c849 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 30 Nov 2018 18:44:37 -0500 Subject: [PATCH 10/12] more Windows Makefile synch and gcc Makefile updates The gcc-built tty version builds fully now, but it won't play. The GUI version definitely does not build right now. --- sys/winnt/Makefile.gcc | 56 +++++++------ sys/winnt/Makefile.msc | 186 ++++++++++++++++++++--------------------- 2 files changed, 121 insertions(+), 121 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index e95ec3925..f71953aec 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -456,18 +456,16 @@ DATABASE = $(DAT)/data.base #========================================== # ifeq "$(ADD_CURSES)" "Y" -#CURSESDEF=-D"PDC_DLL_BUILD" -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" else CURSDEF= CURSESLIB= -CURSESINCL= endif ifneq "$(ADD_CURSES)" "Y" INCLDIR=-I../include -I../sys/winnt else -INCLDIR=-I../include -I../sys/winnt -I$(CURSESINCL) +INCLDIR=-I../include -I../sys/winnt endif #========================================== @@ -601,8 +599,8 @@ $(OBJ)/%.o : $(UTIL)/%.c $(OBJ)/%.o : $(WSHR)/%.c $(cc) $(CFLAGS) -o$@ $< -$(INCL)/%.h : $(WSHR)/%.h - @copy $< $@ +#$(INCL)/%.h : $(WSHR)/%.h +# @copy $< $@ #{$(WSHR)}.txt{$(DAT)}.txt: # @copy $< $@ @@ -667,8 +665,6 @@ YACC= #LEX = lex #LEX = flex LEX= -export YACC -export LEX # # - Specify your flex skeleton file (if needed). @@ -681,6 +677,12 @@ YTABC = y_tab.c YTABH = y_tab.h LEXYYC = lexyy.c +export YACC +export LEX +export FLEXSKEL +export YTABC +export YTABH +export LEXYYC #========================================== # Rules for files in win/Qt4 @@ -811,10 +813,10 @@ $(O)winres.o: $(TILEBMP16) $(MSWIN)/winhack.rc $(MSWIN)/mnsel.bmp \ $(MSWIN)/mnselcnt.bmp $(MSWIN)/mnunsel.bmp \ $(MSWIN)/petmark.bmp $(MSWIN)/pilemark.bmp $(MSWIN)/NetHack.ico $(MSWIN)/rip.bmp \ $(MSWIN)/splash.bmp - @$(rc) -o$@ --include-dir $(MSWIN) -i $(MSWIN)/winhack.rc + $(rc) -o$@ --include-dir $(MSWIN) -i $(MSWIN)/winhack.rc $(O)conres.o: $(MSWSYS)/console.rc $(MSWSYS)/NetHack.ico - @$(rc) -o$@ --include-dir $(MSWSYS) -i $(MSWSYS)/console.rc + $(rc) -o$@ --include-dir $(MSWSYS) -i $(MSWSYS)/console.rc #========================================== # The game targets. @@ -886,9 +888,9 @@ initialchk: objdir.tag @echo ---- objdir.tag: - test -d $(OBJ) || echo creating directory $(OBJ) - test -d $(OBJ) || mkdir $(OBJ) - test -d $(OBJ) && echo directory created > $@ + @test -d $(OBJ) || echo creating directory $(OBJ) + @test -d $(OBJ) || mkdir $(OBJ) + @test -d $(OBJ) && echo directory created > $@ #========================================== #=========== SECONDARY TARGETS ============ @@ -899,7 +901,7 @@ objdir.tag: #========================================== $(U)makedefs.exe: $(MAKEOBJS) - @$(link) $(LFLAGSU) -o$@ $(MAKEOBJS) + $(link) $(LFLAGSU) -o$@ $(MAKEOBJS) $(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \ $(INCL)/objclass.h $(INCL)/monsym.h $(INCL)/qtext.h \ @@ -956,7 +958,7 @@ $(DAT)/dungeon: utility.tag $(DAT)/dungeon.def #========================================== $(U)uudecode.exe: $(O)uudecode.o - @$(link) $(LFLAGSU) -o$@ $(O)uudecode.o + $(link) $(LFLAGSU) -o$@ $(O)uudecode.o $(O)uudecode.o: $(SSYS)/uudecode.c @@ -1030,7 +1032,7 @@ $(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) $(U)levcomp.exe: $(LEVCOMPOBJS) @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(LEVCOMPOBJS) + $(link) $(LFLAGSU) -o$@ $(LEVCOMPOBJS) #========================================== # Dungeon Compiler Stuff @@ -1057,7 +1059,7 @@ $(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c $(U)dgncomp.exe: $(DGNCOMPOBJS) @echo Linking $@... @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(DGNCOMPOBJS) + $(link) $(LFLAGSU) -o$@ $(DGNCOMPOBJS) #================================================= # For a couple of devteam utilities @@ -1065,11 +1067,11 @@ $(U)dgncomp.exe: $(DGNCOMPOBJS) $(U)nhsizes.exe: $(O)nhsizes.o @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(O)nhsizes.o $(O)panic.o $(O)alloc.o$(U)nhsizes.exe: $(O)nhsizes.o + $(link) $(LFLAGSU) -o$@ $(O)nhsizes.o $(O)panic.o $(O)alloc.o$(U)nhsizes.exe: $(O)nhsizes.o $(U)nhsize2.exe: $(O)nhsizes2.o @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(O)nhsizes2.o $(O)panic.o $(O)alloc.o + $(link) $(LFLAGSU) -o$@ $(O)nhsizes2.o $(O)panic.o $(O)alloc.o $(O)nhsizes.o: $(CONFIG_H) nhsizes.c $(cc) $(CFLAGSU) -o$@ nhsizes.c @@ -1087,7 +1089,7 @@ $(O)nhsizes2.o: $(CONFIG_H) nhsizes2.c #========================================== $(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o - @$(link) $(LFLAGSU) -o$@ $(O)dlb_main.o $(O)dlb.o $(O)alloc.o $(O)panic.o + $(link) $(LFLAGSU) -o$@ $(O)dlb_main.o $(O)dlb.o $(O)alloc.o $(O)panic.o $(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)/dlb.h @@ -1146,7 +1148,7 @@ $(SRC)/tile.c: $(U)tilemap.exe @$(U)tilemap $(U)tilemap.exe: $(O)tilemap.o - @$(link) $(LFLAGSU) -o$@ $(O)tilemap.o + $(link) $(LFLAGSU) -o$@ $(O)tilemap.o $(O)tilemap.o: $(WSHR)/tilemap.c $(HACK_H) $(cc) $(CFLAGSU) -o$@ $(WSHR)/tilemap.c @@ -1178,16 +1180,16 @@ $(O)tilete32.o: $(WSHR)/tiletext.c $(CONFIG_H) $(TILE_H) $(U)gif2txt.exe: $(GIFREADERS) $(TEXT_IO) @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(GIFREADERS) $(TEXT_IO) + $(link) $(LFLAGSU) -o$@ $(GIFREADERS) $(TEXT_IO) $(U)gif2tx32.exe: $(GIFREADERS32) $(TEXT_IO32) @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(GIFREADERS32) $(TEXT_IO32) + $(link) $(LFLAGSU) -o$@ $(GIFREADERS32) $(TEXT_IO32) $(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO) @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(PPMWRITERS) $(TEXT_IO) + $(link) $(LFLAGSU) -o$@ $(PPMWRITERS) $(TEXT_IO) $(TILEBMP16): $(TILEUTIL16) $(TILEFILES) @@ -1200,11 +1202,11 @@ $(TILEBMP16): $(TILEUTIL16) $(TILEFILES) $(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO) @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(O)tile2bmp.o $(TEXT_IO) + $(link) $(LFLAGSU) -o$@ $(O)tile2bmp.o $(TEXT_IO) $(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32) @echo Linking $@... - @$(link) $(LFLAGSU) -o$@ $(O)til2bm32.o $(TEXT_IO32) + $(link) $(LFLAGSU) -o$@ $(O)til2bm32.o $(TEXT_IO32) $(O)tile2bmp.o: $(WSHR)/tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)/win32api.h $(cc) $(CFLAGS) -mno-ms-bitfields -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c @@ -1421,13 +1423,13 @@ $(O)ntsound.o: $(HACK_H) $(MSWSYS)/ntsound.c #include the following stub for proper linkage. $(O)guistub.o: $(HACK_H) $(MSWSYS)/stubs.c - @$(cc) $(CFLAGS) -DGUISTUB -o$@ $(MSWSYS)/stubs.c + $(cc) $(CFLAGS) -DGUISTUB -o$@ $(MSWSYS)/stubs.c #if you aren't linking in the full tty then #include the following stub for proper linkage. $(O)ttystub.o: $(HACK_H) $(MSWSYS)/stubs.c - @$(cc) $(CFLAGS) -DTTYSTUB -o$@ $(MSWSYS)/stubs.c + $(cc) $(CFLAGS) -DTTYSTUB -o$@ $(MSWSYS)/stubs.c $(O)tile.o: $(SRC)/tile.c $(HACK_H) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 4db6936ff..6763be545 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -118,10 +118,6 @@ WSHR = ..\win\share # Tile support files OBJ = o -cc=cl -link=link -rc=Rc - # #========================================== # Exe File Info. @@ -159,93 +155,6 @@ DLBFLG = #ZLIB = zlib.lib -#========================================== -#========================================== -# Setting up the compiler and linker -#========================================== -#========================================== - -# Before we get started, this section is used to determine the version of -# Visual Studio we are using. We set VSVER to 0000 to flag any version that -# is too old or untested. -# -#NMAKE version 1414264330 is distributed with VS 15.7.5 - -#!MESSAGE $(MAKEFLAGS) -#!MESSAGE $(MAKEDIR) -#!MESSAGE $(MAKE) - -MAKEVERSION=$(_NMAKE_VER:.= ) -MAKEVERSION=$(MAKEVERSION: =) -#!MESSAGE $(_NMAKE_VER) -#!MESSAGE $(MAKEVERSION) - -VSNEWEST=2017 -!IF ($(MAKEVERSION) < 1000000000) -VSVER=0000 #untested ancient version -!ELSEIF ($(MAKEVERSION) > 1000000000) && ($(MAKEVERSION) < 1100000000) -VSVER=2010 -!ELSEIF ($(MAKEVERSION) > 1100000000) && ($(MAKEVERSION) < 1200000000) -VSVER=2012 -!ELSEIF ($(MAKEVERSION) > 1200000000) && ($(MAKEVERSION) < 1400000000) -VSVER=2013 -!ELSEIF ($(MAKEVERSION) > 1400000000) && ($(MAKEVERSION) < 1411000000) -VSVER=2015 -!ELSEIF ($(MAKEVERSION) > 1411000000) && ($(MAKEVERSION) < 1414264331) -VSVER=$(VSNEWEST) -!ELSEIF ($(MAKEVERSION) > 1414264330) -VSVER=2999 #untested future version -!ENDIF - -!IF ($(VSVER) >= 2012) -!MESSAGE Autodetected Visual Studio $(VSVER) -!ELSEIF ($(VSVER) == 2999 -!MESSAGE The version of Visual Studio is newer than the most recent at -!MESSAGE the time this Makefile was crafted (Visual Studio $(VSNEWEST)). -!MESSAGE Because it is newer we'll proceed expecting that the -!MESSAGE VS$(VSNEWEST) processing will still work. -!ELSEIF ($(VSVER) == 0000) -!MESSAGE The version of Visual Studio appears to be quite old, older -!MESSAGE than VS2010 which is the oldest supported version by this -!MESSAGE Makefile, so we'll stop now. -!ERROR Untested old Visual Studio version with NMAKE $(_NMAKE_VER). -!ENDIF - -!IF ($(VSVER) == 2010) -# For VS2010 use "setenv /x86" or "setenv /x64" before invoking make process -# DO NOT DELETE THE FOLLOWING LINE -!include -! ENDIF - -#These will be in the environment variables with one of the VS2017 -#developer command prompts. -#VSCMD_ARG_HOST_ARCH=x64 -#VSCMD_ARG_TGT_ARCH=x86 - -!IFDEF VSCMD_ARG_HOST_ARCH -!MESSAGE Host architecture is $(VSCMD_ARG_HOST_ARCH) -!MESSAGE Target architecture is $(VSCMD_ARG_TGT_ARCH) -! IFNDEF TARGET_CPU -! IF "$(VSCMD_ARG_TGT_ARCH)"=="x64" -TARGET_CPU=x64 -! ELSE -TARGET_CPU=x86 -! ENDIF -! ENDIF -!ENDIF - -!IF "$(TARGET_CPU)" == "" -TARGET_CPU=x86 -!ENDIF - -!IF ($(VSVER) == 2010) -CL_RECENT= -!ELSE -! IF ($(VSVER) > 2010) -CL_RECENT=-sdl -! ENDIF -!ENDIF - #========================================== #================ MACROS ================== @@ -444,18 +353,107 @@ TILE_H = ..\win\share\tile.h DATABASE = $(DAT)\data.base +#========================================== +#========================================== +# Setting up the compiler and linker +#========================================== +#========================================== + +cc=cl +link=link +rc=Rc + +# Before we get started, this section is used to determine the version of +# Visual Studio we are using. We set VSVER to 0000 to flag any version that +# is too old or untested. +# +#NMAKE version 1414264330 is distributed with VS 15.7.5 + +#!MESSAGE $(MAKEFLAGS) +#!MESSAGE $(MAKEDIR) +#!MESSAGE $(MAKE) + +MAKEVERSION=$(_NMAKE_VER:.= ) +MAKEVERSION=$(MAKEVERSION: =) +#!MESSAGE $(_NMAKE_VER) +#!MESSAGE $(MAKEVERSION) + +VSNEWEST=2017 +!IF ($(MAKEVERSION) < 1000000000) +VSVER=0000 #untested ancient version +!ELSEIF ($(MAKEVERSION) > 1000000000) && ($(MAKEVERSION) < 1100000000) +VSVER=2010 +!ELSEIF ($(MAKEVERSION) > 1100000000) && ($(MAKEVERSION) < 1200000000) +VSVER=2012 +!ELSEIF ($(MAKEVERSION) > 1200000000) && ($(MAKEVERSION) < 1400000000) +VSVER=2013 +!ELSEIF ($(MAKEVERSION) > 1400000000) && ($(MAKEVERSION) < 1411000000) +VSVER=2015 +!ELSEIF ($(MAKEVERSION) > 1411000000) && ($(MAKEVERSION) < 1414264331) +VSVER=$(VSNEWEST) +!ELSEIF ($(MAKEVERSION) > 1414264330) +VSVER=2999 #untested future version +!ENDIF + +!IF ($(VSVER) >= 2012) +!MESSAGE Autodetected Visual Studio $(VSVER) +!ELSEIF ($(VSVER) == 2999 +!MESSAGE The version of Visual Studio is newer than the most recent at +!MESSAGE the time this Makefile was crafted (Visual Studio $(VSNEWEST)). +!MESSAGE Because it is newer we'll proceed expecting that the +!MESSAGE VS$(VSNEWEST) processing will still work. +!ELSEIF ($(VSVER) == 0000) +!MESSAGE The version of Visual Studio appears to be quite old, older +!MESSAGE than VS2010 which is the oldest supported version by this +!MESSAGE Makefile, so we'll stop now. +!ERROR Untested old Visual Studio version with NMAKE $(_NMAKE_VER). +!ENDIF + +!IF ($(VSVER) == 2010) +# For VS2010 use "setenv /x86" or "setenv /x64" before invoking make process +# DO NOT DELETE THE FOLLOWING LINE +!include +! ENDIF + +#These will be in the environment variables with one of the VS2017 +#developer command prompts. +#VSCMD_ARG_HOST_ARCH=x64 +#VSCMD_ARG_TGT_ARCH=x86 + +!IFDEF VSCMD_ARG_HOST_ARCH +!MESSAGE Host architecture is $(VSCMD_ARG_HOST_ARCH) +!MESSAGE Target architecture is $(VSCMD_ARG_TGT_ARCH) +! IFNDEF TARGET_CPU +! IF "$(VSCMD_ARG_TGT_ARCH)"=="x64" +TARGET_CPU=x64 +! ELSE +TARGET_CPU=x86 +! ENDIF +! ENDIF +!ENDIF + +!IF "$(TARGET_CPU)" == "" +TARGET_CPU=x86 +!ENDIF + +!IF ($(VSVER) == 2010) +CL_RECENT= +!ELSE +! IF ($(VSVER) > 2010) +CL_RECENT=-sdl +! ENDIF +!ENDIF + #========================================== # More compiler setup post-macros #========================================== #---------------------------------------------------------------- !IF "$(ADD_CURSES)" == "Y" -#CURSESDEF=-D"PDC_DLL_BUILD" -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" !ELSE CURSDEF= CURSESLIB= -CURSESINCL= !ENDIF ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \ @@ -530,7 +528,7 @@ guilibs = $(winlibs) !IFNDEF ADD_CURSES INCLDIR= /I..\include /I..\sys\winnt !ELSE -INCLDIR= /I..\include /I..\sys\winnt /I$(CURSESINCL) +INCLDIR= /I..\include /I..\sys\winnt !ENDIF #========================================== From 028efc7342f0e7f4941be73fd221bc1e8069160a Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 30 Nov 2018 16:02:55 -0800 Subject: [PATCH 11/12] X11 text popup fix Text popups on OSX could be dismissed with or or if user's X resources had 'NetHack*autofocus' set to True, but for the default of False they ignored all keystrokes even if you clicked inside the popup window to set focus explicitly. Clicking on the Close Window button of the popup's title bar was the only way to get the popup to go away. Fix suggested by Pasi. --- doc/fixes36.2 | 3 +++ win/X11/wintext.c | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 6dc730b5b..94986c5b0 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -333,6 +333,9 @@ X11: don't reuse perm_invent window for picking an object X11: obey mouse_support and allow toggling it in game X11: obey menu movement keys X11: enable menu [cancel] button for PICK_NONE menus +X11: text popups on OSX wouldn't accept keyboard input unless the 'autofocus' + resource was enabled; most noticeable when trying to dismiss 'things + that are here' while walking over object piles General New Features diff --git a/win/X11/wintext.c b/win/X11/wintext.c index ada6a398d..1f743766d 100644 --- a/win/X11/wintext.c +++ b/win/X11/wintext.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintext.c $NHDT-Date: 1450453309 2015/12/18 15:41:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.15 $ */ +/* NetHack 3.6 wintext.c $NHDT-Date: 1543622533 2018/12/01 00:02:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.16 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -281,11 +281,9 @@ struct xwindow *wp; #endif num_args = 0; - XtSetArg(args[num_args], XtNallowShellResize, True); - num_args++; + XtSetArg(args[num_args], XtNallowShellResize, True), num_args++; XtSetArg(args[num_args], XtNtranslations, - XtParseTranslationTable(text_translations)); - num_args++; + XtParseTranslationTable(text_translations)), num_args++; #ifdef TRANSIENT_TEXT wp->popup = XtCreatePopupShell("text", transientShellWidgetClass, @@ -299,8 +297,9 @@ struct xwindow *wp; XtParseTranslationTable("WM_PROTOCOLS: delete_text()")); num_args = 0; - XtSetArg(args[num_args], XtNallowShellResize, True); - num_args++; + XtSetArg(args[num_args], XtNallowShellResize, True), num_args++; + XtSetArg(args[num_args], XtNtranslations, + XtParseTranslationTable(text_translations)), num_args++; form = XtCreateManagedWidget("form", formWidgetClass, wp->popup, args, num_args); From 802c22ed98fdba731f67bd6c67a7082d0d3ff673 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 30 Nov 2018 20:17:42 -0500 Subject: [PATCH 12/12] more gcc work for Windows tty builds and executes curses builds but crashes gui - not even trying right now --- sys/share/pcmain.c | 6 ++++-- sys/winnt/stubs.c | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 1c07555cc..20b73f728 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -87,9 +87,12 @@ unsigned _stklen = STKSIZ; * to help MinGW decide which entry point to choose. If both main and * WinMain exist, the resulting executable won't work correctly. */ -#ifndef __MINGW32__ int +#ifndef __MINGW32__ main(argc, argv) +#else +mingw_main(argc, argv) +#endif int argc; char *argv[]; { @@ -115,7 +118,6 @@ char *argv[]; /*NOTREACHED*/ return 0; } -#endif boolean pcmain(argc, argv) diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index 123ae3b72..3e7fa4c20 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -29,6 +29,7 @@ mswin_destroy_reg() */ #ifdef __MINGW32__ extern char default_window_sys[]; +extern int mingw_main(int argc, char **argv); int main(argc, argv) @@ -37,10 +38,7 @@ char *argv[]; { boolean resuming; - sys_early_init(); - Strcpy(default_window_sys, "tty"); - resuming = pcmain(argc, argv); - moveloop(resuming); + resuming = mingw_main(argc, argv); nethack_exit(EXIT_SUCCESS); /*NOTREACHED*/ return 0;