diff --git a/.gitignore b/.gitignore index a4bfbe1de..3c766268f 100644 --- a/.gitignore +++ b/.gitignore @@ -50,5 +50,7 @@ Makefile.gcc-orig *.ilk # VS2013 extension to auto-whine about questionable code generates these *.lastcodeanalysissucceeded +# VS 2017 caches data into the hidden directory .vs +.vs # Win32-specific ignores end diff --git a/Files b/Files index a0df2af6e..8f08002ae 100644 --- a/Files +++ b/Files @@ -50,8 +50,9 @@ fixes30.pl08 fixes30.pl09 fixes30.pl10 fixes31.1 fixes31.2 fixes31.3 fixes32.0 fixes32.1 fixes32.2 fixes32.3 fixes33.0 fixes33.1 fixes34.0 fixes34.1 fixes34.2 fixes34.3 fixes35.0 fixes36.0 fixes36.1 fixes36.2 -lev_comp.6 lev_comp.txt makedefs.6 makedefs.txt nethack.6 -nethack.txt recover.6 recover.txt tmac.n window.doc +lev_comp.6 lev_comp.txt makedefs.6 makedefs.txt mn.7 +mnh.7 nethack.6 nethack.txt recover.6 recover.txt +tmac.n tmac.nh window.doc include: (files for GEM versions) @@ -257,7 +258,7 @@ sys/winnt: Install.nt Makefile.gcc Makefile.msc console.rc defaults.nh nethack.def nh340key.c nhdefkey.c nhico.uu nhraykey.c nhsetup.bat ntsound.c nttty.c porthelp stubs.c -sysconf win32api.h winnt.c +sysconf win10.c win10.h win32api.h winnt.c util: (files for all versions) @@ -359,27 +360,23 @@ uudecode.vcxproj win/win32/vs2017: (files for Visual Studio 2017 Community Edition builds) -NetHack.sln NetHack.vcxproj NetHackW.vcxproj -afterdgncomp.proj afterdlb.proj afterlevcomp.proj -aftermakedefs.proj afternethack.proj afterrecover.proj -aftertile2bmp.proj aftertilemap.proj afteruudecode.proj -build.bat common.props config.props -console.props default.props default_dll.props -dgncomp.vcxproj dirs.props dlb.vcxproj -dll.props files.props levcomp.vcxproj -makedefs.vcxproj nh340key.def nh340key.vcxproj -nhdefkey.def nhdefkey.vcxproj nhraykey.def -nhraykey.vcxproj recover.vcxproj tile2bmp.vcxproj -tilemap.vcxproj tiles.vcxproj uudecode.vcxproj +NetHack.sln NetHack.vcxproj NetHackW.exe.manifest +NetHackW.vcxproj afterdgncomp.proj afterdlb.proj +afterlevcomp.proj aftermakedefs.proj afternethack.proj +afterrecover.proj aftertile2bmp.proj aftertilemap.proj +afteruudecode.proj build.bat common.props +config.props console.props default.props +default_dll.props dgncomp.vcxproj dirs.props +dlb.vcxproj dll.props files.props +levcomp.vcxproj makedefs.vcxproj nh340key.def +nh340key.vcxproj nhdefkey.def nhdefkey.vcxproj +nhraykey.def nhraykey.vcxproj recover.vcxproj +tile2bmp.vcxproj tilemap.vcxproj tiles.vcxproj +uudecode.vcxproj This is a list of files produced by auxiliary programs. They can all be regenerated from the files in the distribution. -dat: -(file generated by dgn_comp at playground creation time) -dungeon - -(files generated by lev_comp at playground creation time) Arc-fila.lev Arc-filb.lev Arc-goal.lev Arc-loca.lev Arc-strt.lev Bar-fila.lev Bar-filb.lev Bar-goal.lev Bar-loca.lev Bar-strt.lev Cav-fila.lev Cav-filb.lev Cav-goal.lev Cav-loca.lev Cav-strt.lev @@ -404,25 +401,12 @@ minetn-7.lev oracle.lev orcus.lev sanctum.lev soko1-1.lev soko1-2.lev soko2-1.lev soko2-2.lev soko3-1.lev soko3-2.lev soko4-1.lev soko4-2.lev tower1.lev tower2.lev tower3.lev valley.lev water.lev wizard1.lev wizard2.lev wizard3.lev - -(files generated by makedefs at playground creation time) data dungeon.pdf options oracles quest.dat rumors - -(files generated for Qt interface on Mac OS X) Info.plist nethack.icns - -(files generated for win32 at compile time) dlb.lst porthelp - -(files generated for win32 gui at compile time) guioptions - -(files generated for win32 tty at compile time) ttyoptions - -(tile files optionally generated for X ports at playground creation time) pet_mark.xbm rip.xpm x11tiles - include: (file for tiles support copied from win/share at compile time) tile.h diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 96361d68a..2de78d988 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -192,6 +192,8 @@ attempting to #ride a long worm's tail could trigger impossible "worm_cross avoid "The " in "The falls down stairs." avoid potential buffer overflow if object with very long name knocks other objects down stairs when dropped, thrown, or kicked there +#wizintrinsic for 'flying' didn't update status line when flying ended +#wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index c783a5b2e..b2debe337 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1541631031 2018/11/07 22:50:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1541902950 2018/11/11 02:22:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.301 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1423,7 +1423,19 @@ wiz_intrinsic(VOID_ARGS) make_vomiting(newtimeout, FALSE); pline1(buf); break; + case WARN_OF_MON: + if (!Warn_of_mon) { + context.warntype.speciesidx = PM_GRID_BUG; + context.warntype.species + = &mons[context.warntype.speciesidx]; + } + goto def_feedback; + case LEVITATION: + case FLYING: + float_vs_flight(); + /*FALLTHRU*/ default: + def_feedback: pline("Timeout for %s %s %d.", propertynames[i].prop_name, oldtimeout ? "increased by" : "set to", amt); incr_itimeout(&u.uprops[p].intrinsic, amt); diff --git a/src/end.c b/src/end.c index 9cd4d40a0..a2f8967d0 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1540767809 2018/10/28 23:03:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.148 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1541902951 2018/11/11 02:22:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.150 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2009,10 +2009,10 @@ const char *killername; { struct kinfo *k = find_delayed_killer(id); - if (k == (struct kinfo *) 0) { + if (!k) { /* no match, add a new delayed killer to the list */ - k = (struct kinfo *) alloc(sizeof(struct kinfo)); - (void) memset((genericptr_t)k, 0, sizeof(struct kinfo)); + k = (struct kinfo *) alloc(sizeof (struct kinfo)); + (void) memset((genericptr_t) k, 0, sizeof (struct kinfo)); k->id = id; k->next = killer.next; killer.next = k; diff --git a/src/timeout.c b/src/timeout.c index 4c9be0607..a75fc66b9 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1505214876 2017/09/12 11:14:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1541902953 2018/11/11 02:22:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -45,7 +45,7 @@ const struct propname { { SEE_INVIS, "see invisible" }, { INVIS, "invisible" }, /* properties beyond here don't have timed values during normal play, - so there's no much point in trying to order them sensibly; + so there's not much point in trying to order them sensibly; they're either on or off based on equipment, role, actions, &c */ { FIRE_RES, "fire resistance" }, { COLD_RES, "cold resistance" }, @@ -367,6 +367,7 @@ nh_timeout() { register struct prop *upp; struct kinfo *kptr; + boolean was_flying; int sleeptime; int m_idx; int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0; @@ -431,6 +432,7 @@ nh_timeout() pline("%s stops galloping.", Monnam(u.usteed)); } + was_flying = Flying; for (upp = u.uprops; upp < u.uprops + SIZE(u.uprops); upp++) if ((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) { kptr = find_delayed_killer((int) (upp - u.uprops)); @@ -554,6 +556,25 @@ nh_timeout() case LEVITATION: (void) float_down(I_SPECIAL | TIMEOUT, 0L); break; + case FLYING: + /* timed Flying is via #wizintrinsic only */ + if (was_flying && !Flying) { + context.botl = 1; + You("land."); + spoteffects(TRUE); + } + break; + case WARN_OF_MON: + /* timed Warn_of_mon is via #wizintrinsic only */ + if (!Warn_of_mon) { + context.warntype.speciesidx = NON_PM; + if (context.warntype.species) { + You("are no longer warned about %s.", + makeplural(context.warntype.species->mname)); + context.warntype.species = (struct permonst *) 0; + } + } + break; case PASSES_WALLS: if (!Passes_walls) { if (stuck_in_wall()) diff --git a/sys/share/pcsys.c b/sys/share/pcsys.c index 59a78b927..0286ad50b 100644 --- a/sys/share/pcsys.c +++ b/sys/share/pcsys.c @@ -501,15 +501,6 @@ int code; exit(code); } -#ifdef WIN32 -#ifndef TTY_GRAPHICS -void -synch_cursor() -{ -} -#endif -#endif - /* Chdir back to original directory */ #ifdef TOS diff --git a/sys/winnt/win10.c b/sys/winnt/win10.c new file mode 100644 index 000000000..7eea016e9 --- /dev/null +++ b/sys/winnt/win10.c @@ -0,0 +1,42 @@ +/* NetHack 3.6 win10.c $NHDT-Date: 1432512810 2015/05/25 00:13:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */ +/* Copyright (C) 2018 by Bart House */ +/* NetHack may be freely redistributed. See license for details. */ + +#include +#include "winMS.h" +#include "hack.h" +#include "win10.h" +#include + +Win10 gWin10 = { 0 }; + +void win10_init() +{ + if (IsWindows10OrGreater()) + { + HINSTANCE hUser32 = LoadLibraryA("user32.dll"); + + if (hUser32 == NULL) + panic("Unable to load user32.dll"); + + gWin10.GetThreadDpiAwarenessContext = (GetThreadDpiAwarenessContextProc) GetProcAddress(hUser32, "GetThreadDpiAwarenessContext"); + if (gWin10.GetThreadDpiAwarenessContext == NULL) + panic("Unable to get address of GetThreadDpiAwarenessContext()"); + + gWin10.AreDpiAwarenessContextsEqual = (AreDpiAwarenessContextsEqualProc) GetProcAddress(hUser32, "AreDpiAwarenessContextsEqual"); + if (gWin10.AreDpiAwarenessContextsEqual == NULL) + panic("Unable to get address of AreDpiAwarenessContextsEqual"); + + FreeLibrary(hUser32); + + gWin10.Valid = TRUE; + } + + if (gWin10.Valid) { + if (!gWin10.AreDpiAwarenessContextsEqual( + gWin10.GetThreadDpiAwarenessContext(), + DPI_AWARENESS_CONTEXT_UNAWARE)) + panic("Unexpected DpiAwareness state"); + } + +} diff --git a/sys/winnt/win10.h b/sys/winnt/win10.h new file mode 100644 index 000000000..22065df9f --- /dev/null +++ b/sys/winnt/win10.h @@ -0,0 +1,17 @@ +/* NetHack 3.6 win10.h $NHDT-Date: 1432512810 2015/05/25 00:13:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */ +/* Copyright (C) 2018 by Bart House */ +/* NetHack may be freely redistributed. See license for details. */ + +typedef DPI_AWARENESS_CONTEXT(WINAPI * GetThreadDpiAwarenessContextProc)(VOID); +typedef BOOL (WINAPI *AreDpiAwarenessContextsEqualProc)(DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB); + +typedef struct { + BOOL Valid; + GetThreadDpiAwarenessContextProc GetThreadDpiAwarenessContext; + AreDpiAwarenessContextsEqualProc AreDpiAwarenessContextsEqual; +} Win10; + +extern Win10 gWin10; + +void win10_init(); + diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 451aae2f0..966b268e0 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -4,6 +4,8 @@ /* * WIN32 system functions. + * + * Included in both console and window based clients on the windows platform. * * Initial Creation: Michael Allison - January 31/93 * @@ -229,15 +231,6 @@ Delay(int ms) (void) Sleep(ms); } -#ifdef TTY_GRAPHICS -extern void NDECL(backsp); -#else -void -backsp() -{ -} -#endif - void win32_abort() { @@ -250,9 +243,13 @@ win32_abort() msmsg("Execute debug breakpoint wizard?"); while ((ci = nhgetch()) != '\n') { if (ct > 0) { +#ifdef TTY_GRAPHICS backsp(); /* \b is visible on NT */ +#endif (void) putchar(' '); +#ifdef TTY_GRAPHICS backsp(); +#endif ct = 0; c = 'n'; } diff --git a/win/win32/vs2017/NetHackW.exe.manifest b/win/win32/vs2017/NetHackW.exe.manifest new file mode 100644 index 000000000..3a236519c --- /dev/null +++ b/win/win32/vs2017/NetHackW.exe.manifest @@ -0,0 +1,18 @@ + + + + + unaware + + + + + + + + + + + + + \ No newline at end of file diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index 450210b81..e563bb072 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -20,7 +20,7 @@ Disabled true $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories) - TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;WIN32CONNDEBUG;%(PreprocessorDefinitions) + TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;NOTTYGRAPHICS;%(PreprocessorDefinitions) NDEBUG;%(PreprocessorDefinitions) @@ -30,6 +30,9 @@ Windows comctl32.lib;winmm.lib;%(AdditionalDependencies) + + NethackW.exe.manifest;%(AdditionalManifestFiles) + @@ -152,6 +155,7 @@ TTYSTUB; + @@ -180,4 +184,4 @@ - + \ No newline at end of file diff --git a/win/win32/winhack.c b/win/win32/winhack.c index a85bdc478..2430630ef 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -12,6 +12,7 @@ #include "resource.h" #include "mhmain.h" #include "mhmap.h" +#include "win10.h" /* Borland and MinGW redefine "boolean" in shlwapi.h, so just use the little bit we need */ @@ -88,11 +89,19 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); - sys_early_init(); - - /* ensure that we don't access violate on a panic() */ + /* We must initialize state sufficiently to support calls to panic */ + // We need to support DPI awareness. + // + // BOOL result = SetProcessDpiAwarenessContext( + // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + // windowprocs.win_raw_print = mswin_raw_print; windowprocs.win_raw_print_bold = mswin_raw_print_bold; + windowprocs.win_wait_synch = mswin_wait_synch; + + win10_init(); + + sys_early_init(); /* init applicatio structure */ _nethack_app.hApp = hInstance;