Merge branch 'NetHack-3.7' into keni-prefix

This commit is contained in:
nhkeni
2024-09-06 15:07:19 -04:00
202 changed files with 8527 additions and 6374 deletions

View File

@@ -8,8 +8,8 @@
# MS Visual Studio Visual C++ compiler
#
# Visual Studio Compilers Tested:
# - Microsoft Visual Studio 2019 Community Edition v 16.11.37
# - Microsoft Visual Studio 2022 Community Edition v 17.10.2
# - Microsoft Visual Studio 2019 Community Edition v 16.11.38
# - Microsoft Visual Studio 2022 Community Edition v 17.11.2
#
#==============================================================================
# This is used for building two distinct executables of NetHack:
@@ -989,7 +989,7 @@ rc=Rc.exe
#
# Recently tested versions:
TESTEDVS2019 = 14.29.30154.0
TESTEDVS2022 = 14.40.33811.0
TESTEDVS2022 = 14.41.34120.0
VS2019CUR = $(TESTEDVS2019:.=)
VS2022CUR = $(TESTEDVS2022:.=)

View File

@@ -4,30 +4,16 @@ Prerequisite Requirements:
o MSYS2
- https://www.msys2.org/
- Download the installer, and start the UCRT64 shell.
- Download and run the installer, and start the UCRT64 shell.
then
pacman -S mingw-w64-ucrt-x86_64-gcc
pacman -S git
pacman -S make
pacman -S vim (or your editor of choice)
pacman -S man (otherwise "git help foo" will not work)
o Lua
NetHack 3.7 for Windows requires 3rd party Lua source that is not part
of the NetHack distribution or repository.
A windows cmd command procedure for fetching prerequisite sources
is available, and can be run as follows from the top of the
NetHack source tree to obtain lua:
sys\windows\fetch.cmd lua
o pdcursesmod (Only required if curses interface support is desired)
If you want to include curses interface support in NetHack 3.7 for
3rd part pdcursesmod source code is required and is not part of the
NetHack distribution or repository.
A windows cmd command procedure for fetching prerequisite
sources is available, and can be run as follows from the top of
the NetHack source tree to obtain pdcursesmod:
sys\windows\fetch.cmd pdcursesmod
Instructions for obtaining these are later in this file.
/---------------------------------------------\
| Directories for a Windows NetHack build |
@@ -81,23 +67,22 @@ Building
Two different versions of NetHack will be built for Windows from the
command line using the Makefile approach:
A tty port utilizing the Win32 Console I/O subsystem Console,
and a curses interface in an executabled called NetHack.exe.
NetHack
and a curses interface in an executable called NetHack.exe.
A Win32 native port built on the Windows API Graphical NetHack,
and graphical curses in an executable called NetHackW.exe.
The Makefile configurations will build both; NetHack.exe and NetHackW.exe
The Makefile configurations will build both NetHack.exe and NetHackW.exe
and will be able to use the same datafiles, save files and bones files.
Since the last official release of NetHack, compilers and computer
architectures have evolved and you can now choose whether to build
a 32-bit x86 version, or a 64-bit x64 version. The default Makefile
is set up for a 32-bit x86 version, but that's only because it will
run on the most number of existing Windows environments. Change it if you
run on the largest number of existing Windows environments. Change it if you
want. Be aware that NetHack's save files and bones files in the 3.7.0
release have not yet evolved enough to allow them to interchange between
the 32-bit version and the 64-bit version (or between different platforms).
That may change in future.
release are not interchangeable between the 32-bit version and the
64-bit version (or between different platforms).
I. Dispelling the Myths:
@@ -147,7 +132,7 @@ Notes:
1. To rebuild NetHack after changing something, change your current directory
to src and issue the appropriate command for your compiler:
For Microsoft compiler:
For gcc:
make -f Makefile.mingw32
2. An alternative to MSYS2 may be MinGW-w64 - winlibs standalone build.

View File

@@ -936,7 +936,7 @@ void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y)
while (dst != sentinel)
*dst++ = *fill;
if ((iflags.debug.immediateflips || !gp.program_state.in_moveloop)
if ((iflags.debug.immediateflips || !program_state.in_moveloop)
&& buffer == console.back_buffer)
back_buffer_flip();
}
@@ -952,7 +952,7 @@ static void buffer_clear_to_end_of_line(cell_t * buffer, int x, int y)
while (dst != sentinel)
*dst++ = clear_cell;
if (iflags.debug.immediateflips || !gp.program_state.in_moveloop)
if (iflags.debug.immediateflips || !program_state.in_moveloop)
back_buffer_flip();
}
@@ -964,7 +964,7 @@ void buffer_write(cell_t * buffer, cell_t * cell, COORD pos)
cell_t * dst = buffer + (console.width * pos.Y) + pos.X;
*dst = *cell;
if ((iflags.debug.immediateflips || !gp.program_state.in_moveloop)
if ((iflags.debug.immediateflips || !program_state.in_moveloop)
&& buffer == console.back_buffer)
back_buffer_flip();
}
@@ -1149,7 +1149,7 @@ tgetch(void)
numpad |= 0x10;
#endif
return (gp.program_state.done_hup)
return (program_state.done_hup)
? '\033'
: keyboard_handling.pCheckInput(
console.hConIn, &ir, &count, numpad, 0, &mod, &cc);
@@ -1177,7 +1177,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
if (gc.Cmd.swap_yz)
numpad |= 0x10;
#endif
ch = (gp.program_state.done_hup)
ch = (program_state.done_hup)
? '\033'
: keyboard_handling.pCheckInput(
console.hConIn, &ir, &count, numpad, 1, mod, &cc);

View File

@@ -704,17 +704,17 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
(*utf8graphics_mode_callback)();
#endif
/* strip role,race,&c suffix; calls askname() if gp.plname[] is empty
/* strip role,race,&c suffix; calls askname() if svp.plname[] is empty
or holds a generic user name like "player" or "games" */
plnamesuffix();
set_playmode(); /* sets gp.plname to "wizard" for wizard mode */
set_playmode(); /* sets svp.plname to "wizard" for wizard mode */
/* until the getlock code is resolved, override askname()'s
setting of renameallowed; when False, player_selection()
won't resent renaming as an option */
iflags.renameallowed = FALSE;
/* Obtain the name of the logged on user and incorporate
* it into the name. */
Sprintf(fnamebuf, "%s", gp.plname);
Sprintf(fnamebuf, "%s", svp.plname);
(void) fname_encode(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',
fnamebuf, encodedfnamebuf, BUFSZ);
@@ -732,8 +732,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if (!nhfp) {
raw_print("Cannot create lock file");
} else {
gh.hackpid = GetCurrentProcessId();
(void) write(nhfp->fd, (genericptr_t) &gh.hackpid, sizeof(gh.hackpid));
svh.hackpid = GetCurrentProcessId();
(void) write(nhfp->fd, (genericptr_t) &svh.hackpid, sizeof(svh.hackpid));
close_nhfile(nhfp);
}
/*
@@ -771,8 +771,8 @@ attempt_restore:
}
}
}
if (gp.program_state.in_self_recover) {
gp.program_state.in_self_recover = FALSE;
if (program_state.in_self_recover) {
program_state.in_self_recover = FALSE;
set_savefile_name(TRUE);
}
}
@@ -923,11 +923,11 @@ process_options(int argc, char * argv[])
#endif
case 'u':
if (argv[0][2])
(void) strncpy(gp.plname, argv[0] + 2, sizeof(gp.plname) - 1);
(void) strncpy(svp.plname, argv[0] + 2, sizeof(svp.plname) - 1);
else if (argc > 1) {
argc--;
argv++;
(void) strncpy(gp.plname, argv[0], sizeof(gp.plname) - 1);
(void) strncpy(svp.plname, argv[0], sizeof(svp.plname) - 1);
} else
raw_print("Player name expected after -u");
break;
@@ -1052,7 +1052,7 @@ port_help(void)
boolean
authorize_wizard_mode(void)
{
if (!strcmp(gp.plname, WIZARD_NAME))
if (!strcmp(svp.plname, WIZARD_NAME))
return TRUE;
return FALSE;
}
@@ -1417,8 +1417,8 @@ gotlock:
gf.fqn_prefix[LEVELPREFIX]);
raw_print(oops);
} else {
if (write(fd, (char *) &gh.hackpid, sizeof(gh.hackpid))
!= sizeof(gh.hackpid)) {
if (write(fd, (char *) &svh.hackpid, sizeof(svh.hackpid))
!= sizeof(svh.hackpid)) {
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
#endif