Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2018-11-11 10:34:09 -05:00
13 changed files with 162 additions and 63 deletions

2
.gitignore vendored
View File

@@ -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

50
Files
View File

@@ -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

View File

@@ -192,6 +192,8 @@ attempting to #ride a long worm's tail could trigger impossible "worm_cross
avoid "The " in "The <known-artifact-but-not-The-artifact> 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

View File

@@ -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);

View File

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

View File

@@ -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())

View File

@@ -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

42
sys/winnt/win10.c Normal file
View File

@@ -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 <process.h>
#include "winMS.h"
#include "hack.h"
#include "win10.h"
#include <VersionHelpers.h>
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");
}
}

17
sys/winnt/win10.h Normal file
View File

@@ -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();

View File

@@ -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';
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">unaware</dpiAwareness>
<!-- <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> -->
<!-- <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling> -->
</windowsSettings>
</application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> <!-- Windows 7 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 8 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> <!-- Windows 8.1 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> <!-- Windows 10 -->
</application>
</compatibility>
</assembly>

View File

@@ -20,7 +20,7 @@
<Optimization>Disabled</Optimization>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;WIN32CONNDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;NOTTYGRAPHICS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -30,6 +30,9 @@
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<AdditionalManifestFiles>NethackW.exe.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(SrcDir)allmain.c" />
@@ -152,6 +155,7 @@
<PreprocessorDefinitions>TTYSTUB;</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="$(SysWinntDir)winnt.c" />
<ClCompile Include="$(SysWinntDir)win10.c" />
<ClCompile Include="$(WinWin32Dir)mhaskyn.c" />
<ClCompile Include="$(WinWin32Dir)mhdlg.c" />
<ClCompile Include="$(WinWin32Dir)mhfont.c" />
@@ -180,4 +184,4 @@
<Target Name="AfterRebuild">
<MSBuild Projects="afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target>
</Project>
</Project>

View File

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