Merge remote-tracking branch 'origin/NetHack-3.6.0'

This commit is contained in:
keni
2018-03-10 19:14:11 -05:00
65 changed files with 1528 additions and 526 deletions

View File

@@ -1,4 +1,4 @@
# NetHack 3.6 Makefile.GCC $NHDT-Date: 1457207036 2016/03/05 19:43:56 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.29 $
# NetHack 3.6 Makefile.GCC $NHDT-Date: 1519600525 2018/02/25 23:15:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.34 $
# Copyright (c) NetHack PC Development Team 1996-2006.
# PC NetHack 3.6 Makefile for djgpp V2
#
@@ -308,6 +308,9 @@ PPMWRITERS = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o
PPMWRIT2 = $(O)ppmwrit2.o $(O)alloc.o $(O)panic.o
endif
#REGEX = $(O)pmatchregex.o
#REGEX = $(O)cppregex.o
REGEX = $(O)posixreg.o
DLBOBJ = $(O)dlb.o
@@ -336,7 +339,7 @@ VOBJ19 = $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o $(O)vision.o
VOBJ20 = $(O)vis_tab.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows.o
VOBJ21 = $(O)wintty.o $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o
VOBJ22 = $(O)zap.o $(O)light.o $(O)dlb.o $(O)dig.o $(O)teleport.o
VOBJ23 = $(O)region.o $(O)sys.o $(O)pmatchre.o $(O)string.o $(O)unicode.o
VOBJ23 = $(O)region.o $(O)sys.o $(REGEX)
SOBJ = $(O)msdos.o $(O)sound.o $(O)pcsys.o $(O)tty.o $(O)unix.o \
$(O)video.o $(O)vidtxt.o $(O)pckeys.o
@@ -648,7 +651,7 @@ $(O)makedefs.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/objclass.h \
#==========================================
$(U)lev_comp.exe: $(SPLEVOBJS)
@rm -f temp.a
-rm -f temp.a
@ar ru temp.a $(SPLEVOBJS)
$(LINK) $(LFLAGS) -o$@ temp.a
@@ -813,17 +816,17 @@ $(DAT)/nhtiles.bmp: $(TILEFILES) $(U)tile2bmp.exe
@$(subst /,\,chdir $(SRC))
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXTIO)
@rm -f temp.a
-rm -f temp.a
@ar ru temp.a $(TEXTIO)
$(LINK) $(LFLAGS) -o$@ $(O)tile2bmp.o temp.a
$(U)tile2bin.exe: $(O)tile2bin.o $(TEXTIO)
@rm -f temp.a
-rm -f temp.a
@ar ru temp.a $(TEXTIO)
$(LINK) $(LFLAGS) -o$@ $(O)tile2bin.o temp.a
$(U)til2bin2.exe: $(O)til2bin2.o $(TEXTIO2)
@rm -f temp.a
-rm -f temp.a
@ar ru temp.a $(TEXTIO2)
$(LINK) $(LFLAGS) -o$@ $(O)til2bin2.o temp.a
@@ -1035,6 +1038,15 @@ $(O)unix.o: $(HACK_H) $(SSHR)/pcunix.c
$(O)pcsys.o : $(HACK_H) $(SSHR)/pcsys.c
$(CC) $(cflags) -o$@ $(SSHR)/pcsys.c
$(O)posixreg.o : $(HACK_H) $(SSHR)/posixreg.c
$(CC) $(cflags) -o$@ $(SSHR)/posixreg.c
$(O)cppregex.o : $(HACK_H) $(SSHR)/cppregex.cpp
gpp $(cflags) -std=c++11 -o$@ $(SSHR)/cppregex.cpp
$(O)pmatchre.o : $(HACK_H) $(SSHR)/pmatchre.c
$(CC) $(cflags) -o$@ $(SSHR)/pmatchre.c
# sys/msdos
$(O)msdos.o : $(HACK_H) $(MSYS)/msdos.c
# $(CC) $(cflags) -o$@ $(MSYS)/msdos.c
@@ -1084,8 +1096,6 @@ $(O)tos.o: ../sys/atari/tos.c $(HACK_H) $(INCL)/tcap.h
$(O)pcmain.o: ../sys/share/pcmain.c $(HACK_H) $(INCL)/dlb.h \
#$(INCL)/win32api.h
$(CC) $(cflags) -o$@ ../sys/share/pcmain.c
$(O)pcsys.o: ../sys/share/pcsys.c $(HACK_H)
$(CC) $(cflags) -o$@ ../sys/share/pcsys.c
$(O)pctty.o: ../sys/share/pctty.c $(HACK_H)
$(CC) $(cflags) -o$@ ../sys/share/pctty.c
$(O)pcunix.o: ../sys/share/pcunix.c $(HACK_H)

View File

@@ -1,10 +1,10 @@
@echo off
REM NetHack 3.6 setup.bat $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $
REM Copyright (c) NetHack PC Development Team 1990 - 2012
REM Copyright (c) NetHack PC Development Team 1990 - 2018
REM NetHack may be freely redistributed. See license for details.
echo.
echo Copyright (c) NetHack PC Development Team 1990 - 2012
echo Copyright (c) NetHack PC Development Team 1990 - 2018
echo NetHack may be freely redistributed. See license for details.
echo.
REM setup batch file for msdos, see Install.dos for details.
@@ -59,6 +59,12 @@ echo "Copying ..\..\include\patchl~1.h -> ..\..\include\patchlev.h"
copy ..\..\include\patchl~1.h ..\..\include\patchlev.h
if exist ..\..\include\patchlev.old del /Q ..\..\include\patchlev.old
ren ..\..\include\patchl~1.h patchlev.old
:long2c
echo "Copying ..\..\sys\share\pmatch~1.c -> ..\..\sys\share\pmatchre.c"
copy ..\..\sys\share\pmatch~1.c ..\..\sys\share\pmatchre.c
:long2d
echo "Copying ..\..\sys\share\posixr~1.c -> ..\..\sys\share\posixreg.c"
copy ..\..\sys\share\posixr~1.c ..\..\sys\share\posixreg.c
:long2ok
REM Missing guidebook is not fatal to the build process

View File

@@ -766,7 +766,7 @@ vesa_Init(void)
*
*/
tile_file = iflags.wc_tile_file;
if (tile_file == NULL || tile_file == '\0') {
if (tile_file == NULL || *tile_file == '\0') {
tile_file = "nhtiles.bmp";
}
if (!read_tiles(tile_file, FALSE))

View File

@@ -758,7 +758,7 @@ vga_Init(void)
*
*/
tile_file = iflags.wc_tile_file;
if (tile_file == NULL || tile_file == '\0') {
if (tile_file == NULL || *tile_file == '\0') {
tile_file = "nhtiles.bmp";
}
if (!read_tiles(tile_file, FALSE))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 ioctl.c $NHDT-Date: 1432512788 2015/05/25 00:13:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */
/* NetHack 3.6 ioctl.c $NHDT-Date: 1520099308 2018/03/03 17:48:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.13 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -63,9 +63,12 @@ struct termio termio;
#include <signal.h>
#endif
#if defined(TIOCGWINSZ) \
&& (defined(BSD) || defined(ULTRIX) || defined(AIX_31) \
|| defined(_BULL_SOURCE) || defined(SVR4))
/* AVOID_WIN_IOCTL can be uncommented in unixconf.h
* to force USE_WIN_IOTCL to remain undefined,
* instead of the restricted explicit opt-in
* logic that used to be here.
*/
#if defined(TIOCGWINSZ) && !defined(AVOID_WIN_IOCTL)
#define USE_WIN_IOCTL
#include "tcap.h" /* for LI and CO */
#endif

View File

@@ -329,6 +329,9 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
Strcpy(hackdir, HACKDIR);
#endif
if (argc > 1) {
if (argcheck(argc, argv, ARG_VERSION))
nethack_exit(EXIT_SUCCESS);
if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
/* avoid matching "-dec" for DECgraphics; since the man page
* says -d directory, hope nobody's using -desomething_else

View File

@@ -169,3 +169,4 @@ spotless:
-rm -f spec_levs quest_levs *.lev $(VARDAT) dungeon dungeon.pdf
-rm -f nhdat x11tiles beostiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm
-rm -f rip.img GEM_RSC.RSC title.img nh16.img NetHack.ad
-rm -f nhsplash.xpm nhtiles.bmp

View File

@@ -1,5 +1,5 @@
# NetHack Makefile.
# NetHack 3.6 Makefile.src $NHDT-Date: 1459122529 2016/03/27 23:48:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.46 $
# NetHack 3.6 Makefile.src $NHDT-Date: 1520201829 2018/03/04 22:17:09 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.52 $
# Root of source tree:
NHSROOT=..
@@ -332,6 +332,14 @@ RANDOBJ =
# used by `make depend' to reconstruct this Makefile; you shouldn't need this
AWK = nawk
# when using 'makedefs -v', also force dat/gitinfo.txt to be up to date;
# changing this to 0 will change the behavior to only make that file if
# it doesn't already exist; to skip it completely, create an empty file
# of that name and also set this to 0; there shouldn't be any need to
# skip it--if nethack's sources don't reside in a git repository than
# the script which creates that file will fail benignly and 'makedefs -v'
# will proceed without it
GITINFO=1
#VERBOSEMAKE = 1
@@ -606,10 +614,13 @@ tile.c: ../win/share/tilemap.c $(HACK_H)
# file far more complex. Since "hack.h" depends on most of the include
# files, we kludge around this by making date.h dependent on hack.h,
# even though it doesn't include this file.
# Do NOT include ../dat/gitinfo.txt as either a prerequisite or target.
# 'makedefs -v' processes it when present and ignores it if not.
#
# hack.h depends on makedefs' output, so we know makedefs will be
# up to date before being executed
../include/date.h: $(VERSOURCES) $(HACK_H)
-$(SHELL) ../sys/unix/gitinfo.sh $(GITINFO) #before 'makedefs -v'
../util/makedefs -v

View File

@@ -481,4 +481,4 @@ spotless: clean
-rm -f ../include/tile.h tiletxt.c
-rm -f makedefs lev_comp dgn_comp recover dlb
-rm -f gif2txt txt2ppm tile2x11 tile2img.ttp xpm2img.ttp \
tilemap tileedit
tilemap tileedit tile2bmp

28
sys/unix/gitinfo.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
# NetHack 3.6 gitinfo.sh $NHDT-Date: 1520201830 2018/03/04 22:17:10 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.0 $
# bring dat/gitinfo.txt up to date; called from Makefile.src
#
# gitinfo.txt is used during development to augment the version number
# (for nethack's 'v' command) with more specific information. That is not
# necessary when building a released version and it is perfectly OK for
# this script to be skipped or to run but fail to generate dat/gitinfo.txt.
#
always=0
if [[ $1 -eq 1 || $1 == "force" || $1 == "always" ]]; then always=1; fi
# try to figure out where we are: top, one level down (expected), or sys/unix
prefix=.
if [ -f ../sys/unix/gitinfo.sh ]; then prefix=..; fi
if [ -f ../../sys/unix/gitinfo.sh ]; then prefix=../..; fi
# try to run a perl script which is part of nethack's git repository
if [[ $always -eq 1 || ! -f $prefix/dat/gitinfo.txt ]]; then
( cd $prefix; \
perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning' \
2> /dev/null ) \
|| true
fi
exit 0

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# NetHack 3.6 macosx.sh $NHDT-Date: 1518800856 2018/02/16 17:07:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.19 $
# NetHack 3.6 macosx.sh $NHDT-Date: 1517231957 2018/01/29 13:19:17 $ $NHDT-Branch: githash $:$NHDT-Revision: 1.20 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#

View File

@@ -110,6 +110,9 @@ char *argv[];
dir = nh_getenv("HACKDIR");
if (argc > 1) {
if (argcheck(argc, argv, ARG_VERSION))
exit(EXIT_SUCCESS);
if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
/* avoid matching "-dec" for DECgraphics; since the man page
* says -d directory, hope nobody's using -desomething_else
@@ -720,4 +723,40 @@ get_login_name()
return buf;
}
#ifdef __APPLE__
extern int errno;
void
port_insert_pastebuf(buf)
char *buf;
{
/* This should be replaced when there is a Cocoa port. */
const char *errfmt;
size_t len;
FILE *PB = popen("/usr/bin/pbcopy","w");
if(!PB){
errfmt = "Unable to start pbcopy (%d)\n";
goto error;
}
len = strlen(buf);
/* Remove the trailing \n, carefully. */
if(buf[len-1] == '\n') len--;
/* XXX Sorry, I'm too lazy to write a loop for output this short. */
if(len!=fwrite(buf,1,len,PB)){
errfmt = "Error sending data to pbcopy (%d)\n";
goto error;
}
if(pclose(PB)!=-1){
return;
}
errfmt = "Error finishing pbcopy (%d)\n";
error:
raw_printf(errfmt,strerror(errno));
}
#endif
/*unixmain.c*/

View File

@@ -1,4 +1,4 @@
# NetHack 3.6 Makefile.msc $NHDT-Date: 1518220654 2018/02/09 23:57:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.105 $ */
# NetHack 3.6 Makefile.msc $NHDT-Date: 1520177858 2018/03/04 15:37:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.111 $ */
# Copyright (c) NetHack PC Development Team 1993-2018
#
#==============================================================================
@@ -569,7 +569,7 @@ default : install
all : install
install: envchk $(O)obj.tag $(O)utility.tag $(GAMEDIR)\NetHack.exe $(GAMEDIR)\NetHackW.exe $(O)install.tag
install: $(O)envchk.tag $(O)obj.tag $(O)utility.tag $(GAMEDIR)\NetHack.exe $(GAMEDIR)\NetHackW.exe $(O)install.tag
@echo Done.
$(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
@@ -913,14 +913,19 @@ $(MSWIN)\splash.bmp: $(U)uudecode.exe $(MSWIN)\splash.uu
# defer to the steps in ..\win\win32\levstuff.mak
#
$(U)lev_yacc.c $(INCL)\lev_comp.h: $(U)lev_comp.y
nmake -nologo -f ..\win\win32\levstuff.mak default
$(U)lev_yacc.c: $(U)lev_comp.y
nmake -nologo -f ..\win\win32\levstuff.mak $(U)lev_yacc.c
$(U)lev_lex.c: $(U)lev_comp.l
nmake -nologo -f ..\win\win32\levstuff.mak $(U)lev_lex.c
$(INCL)\lev_comp.h:
nmake -nologo -f ..\win\win32\levstuff.mak $(INCL)\lev_comp.h
$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c
@$(cc) $(cflagsBuild) -Fo$@ $(U)lev_yacc.c
$(O)lev_lex.o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) \
$(U)lev_lex.c
$(O)lev_lex.o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) $(U)lev_lex.c
@$(cc) $(cflagsBuild) -Fo$@ $(U)lev_lex.c
$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H)
@@ -939,8 +944,14 @@ $(U)levcomp.exe: $(LEVCOMPOBJS)
#
# defer to the steps in ..\win\win32\dgnstuff.mak
#
$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y
nmake -nologo -f ..\win\win32\dgnstuff.mak default
$(U)dgn_yacc.c: $(U)dgn_comp.y
nmake -nologo -f ..\win\win32\dgnstuff.mak $(U)dgn_yacc.c
$(INCL)\dgn_comp.h:
nmake -nologo -f ..\win\win32\dgnstuff.mak $(INCL)\dgn_comp.h
$(U)dgn_lex.c: $(U)dgn_comp.l
nmake -nologo -f ..\win\win32\dgnstuff.mak $(U)dgn_lex.c
$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c
@$(cc) $(cflagsBuild) -Fo$@ $(U)dgn_yacc.c
@@ -974,7 +985,7 @@ $(O)obj.tag:
# options.
#==========================================
envchk:
$(O)envchk.tag: $(O)obj.tag
! IF "$(TARGET_CPU)"=="x64"
@echo Windows x64 64-bit target build
! ELSE
@@ -984,6 +995,7 @@ envchk:
# @echo Warning, the CL Environment variable is defined:
# @echo CL=$(CL)
! ENDIF
echo envchk >$@
#==========================================
#=========== SECONDARY TARGETS ============
@@ -1170,63 +1182,77 @@ spotless: clean
if exist $(GAMEDIR)\NetHack.pdb del $(GAMEDIR)\NetHack.pdb
if exist $(GAMEDIR)\nhdat del $(GAMEDIR)\nhdat
! ENDIF
if exist $(INCL)\date.h del $(INCL)\date.h
if exist $(INCL)\onames.h del $(INCL)\onames.h
if exist $(INCL)\pm.h del $(INCL)\pm.h
if exist $(INCL)\vis_tab.h del $(INCL)\vis_tab.h
if exist $(SRC)\vis_tab.c del $(SRC)\vis_tab.c
if exist $(SRC)\tile.c del $(SRC)\tile.c
if exist $(U)*.lnk del $(U)*.lnk
if exist $(U)*.map del $(U)*.map
if exist $(DAT)\data del $(DAT)\data
if exist $(DAT)\rumors del $(DAT)\rumors
if exist $(DAT)\engrave del $(DAT)\engrave
if exist $(DAT)\epitaph del $(DAT)\epitaph
if exist $(DAT)\bogusmon del $(DAT)\bogusmon
if exist $(DAT)\???-fil?.lev del $(DAT)\???-fil?.lev
if exist $(DAT)\???-goal.lev del $(DAT)\???-goal.lev
if exist $(DAT)\???-loca.lev del $(DAT)\???-loca.lev
if exist $(DAT)\???-strt.lev del $(DAT)\???-strt.lev
if exist $(DAT)\air.lev del $(DAT)\air.lev
if exist $(DAT)\asmodeus.lev del $(DAT)\asmodeus.lev
if exist $(DAT)\astral.lev del $(DAT)\astral.lev
if exist $(DAT)\baalz.lev del $(DAT)\baalz.lev
if exist $(DAT)\bigrm-*.lev del $(DAT)\bigrm-*.lev
if exist $(DAT)\castle.lev del $(DAT)\castle.lev
if exist $(DAT)\data del $(DAT)\data
if exist $(DAT)\dungeon del $(DAT)\dungeon
if exist $(DAT)\dungeon.pdf del $(DAT)\dungeon.pdf
if exist $(DAT)\earth.lev del $(DAT)\earth.lev
if exist $(DAT)\fakewiz?.lev del $(DAT)\fakewiz?.lev
if exist $(DAT)\fire.lev del $(DAT)\fire.lev
if exist $(DAT)\juiblex.lev del $(DAT)\juiblex.lev
if exist $(DAT)\knox.lev del $(DAT)\knox.lev
if exist $(DAT)\medusa-?.lev del $(DAT)\medusa-?.lev
if exist $(DAT)\mine*.lev del $(DAT)\mine*.lev
if exist $(DAT)\options del $(DAT)\options
if exist $(DAT)\ttyoptions del $(DAT)\ttyoptions
if exist $(DAT)\guioptions del $(DAT)\guioptions
if exist $(DAT)\oracle.lev del $(DAT)\oracle.lev
if exist $(DAT)\oracles del $(DAT)\oracles
if exist $(DAT)\orcus.lev del $(DAT)\orcus.lev
if exist $(DAT)\rumors del $(DAT)\rumors
if exist $(DAT)\quest.dat del $(DAT)\quest.dat
if exist $(DAT)\sanctum.lev del $(DAT)\sanctum.lev
if exist $(DAT)\soko?-?.lev del $(DAT)\soko?-?.lev
if exist $(DAT)\tower?.lev del $(DAT)\tower?.lev
if exist $(DAT)\valley.lev del $(DAT)\valley.lev
if exist $(DAT)\water.lev del $(DAT)\water.lev
if exist $(DAT)\wizard?.lev del $(DAT)\wizard?.lev
if exist $(DAT)\dlb.lst del $(DAT)\dlb.lst
if exist $(O)sp_lev.tag del $(O)sp_lev.tag
if exist $(SRC)\monstr.c del $(SRC)\monstr.c
if exist $(SRC)\vis_tab.c del $(SRC)\vis_tab.c
if exist $(U)recover.exe del $(U)recover.exe
if exist nhdat. del nhdat.
if exist $(O)obj.tag del $(O)obj.tag
if exist $(O)gamedir.tag del $(O)gamedir.tag
if exist $(O)nh*key.lib del $(O)nh*key.lib
if exist $(O)nh*key.exp del $(O)nh*key.exp
if exist $(INCL)\date.h del $(INCL)\date.h
if exist $(INCL)\onames.h del $(INCL)\onames.h
if exist $(INCL)\pm.h del $(INCL)\pm.h
if exist $(INCL)\vis_tab.h del $(INCL)\vis_tab.h
if exist $(SRC)\vis_tab.c del $(SRC)\vis_tab.c
if exist $(SRC)\tile.c del $(SRC)\tile.c
if exist $(U)*.lnk del $(U)*.lnk
if exist $(U)*.map del $(U)*.map
if exist $(DAT)\data del $(DAT)\data
if exist $(DAT)\rumors del $(DAT)\rumors
if exist $(DAT)\engrave del $(DAT)\engrave
if exist $(DAT)\epitaph del $(DAT)\epitaph
if exist $(DAT)\bogusmon del $(DAT)\bogusmon
if exist $(DAT)\???-fil?.lev del $(DAT)\???-fil?.lev
if exist $(DAT)\???-goal.lev del $(DAT)\???-goal.lev
if exist $(DAT)\???-loca.lev del $(DAT)\???-loca.lev
if exist $(DAT)\???-strt.lev del $(DAT)\???-strt.lev
if exist $(DAT)\air.lev del $(DAT)\air.lev
if exist $(DAT)\asmodeus.lev del $(DAT)\asmodeus.lev
if exist $(DAT)\astral.lev del $(DAT)\astral.lev
if exist $(DAT)\baalz.lev del $(DAT)\baalz.lev
if exist $(DAT)\bigrm-*.lev del $(DAT)\bigrm-*.lev
if exist $(DAT)\castle.lev del $(DAT)\castle.lev
if exist $(DAT)\data del $(DAT)\data
if exist $(DAT)\dungeon del $(DAT)\dungeon
if exist $(DAT)\dungeon.pdf del $(DAT)\dungeon.pdf
if exist $(DAT)\earth.lev del $(DAT)\earth.lev
if exist $(DAT)\fakewiz?.lev del $(DAT)\fakewiz?.lev
if exist $(DAT)\fire.lev del $(DAT)\fire.lev
if exist $(DAT)\juiblex.lev del $(DAT)\juiblex.lev
if exist $(DAT)\knox.lev del $(DAT)\knox.lev
if exist $(DAT)\medusa-?.lev del $(DAT)\medusa-?.lev
if exist $(DAT)\mine*.lev del $(DAT)\mine*.lev
if exist $(DAT)\options del $(DAT)\options
if exist $(DAT)\ttyoptions del $(DAT)\ttyoptions
if exist $(DAT)\guioptions del $(DAT)\guioptions
if exist $(DAT)\oracle.lev del $(DAT)\oracle.lev
if exist $(DAT)\oracles del $(DAT)\oracles
if exist $(DAT)\orcus.lev del $(DAT)\orcus.lev
if exist $(DAT)\rumors del $(DAT)\rumors
if exist $(DAT)\quest.dat del $(DAT)\quest.dat
if exist $(DAT)\sanctum.lev del $(DAT)\sanctum.lev
if exist $(DAT)\soko?-?.lev del $(DAT)\soko?-?.lev
if exist $(DAT)\tower?.lev del $(DAT)\tower?.lev
if exist $(DAT)\valley.lev del $(DAT)\valley.lev
if exist $(DAT)\water.lev del $(DAT)\water.lev
if exist $(DAT)\wizard?.lev del $(DAT)\wizard?.lev
if exist $(DAT)\dlb.lst del $(DAT)\dlb.lst
if exist $(DAT)\porthelp del $(DAT)\porthelp
if exist $(O)sp_lev.tag del $(O)sp_lev.tag
if exist $(SRC)\monstr.c del $(SRC)\monstr.c
if exist $(SRC)\vis_tab.c del $(SRC)\vis_tab.c
if exist nhdat. del nhdat.
if exist $(O)obj.tag del $(O)obj.tag
if exist $(O)gamedir.tag del $(O)gamedir.tag
if exist $(O)nh*key.lib del $(O)nh*key.lib
if exist $(O)nh*key.exp del $(O)nh*key.exp
if exist $(MSWIN)\mnsel.bmp del $(MSWIN)\mnsel.bmp
if exist $(MSWIN)\mnselcnt.bmp del $(MSWIN)\mnselcnt.bmp
if exist $(MSWIN)\mnunsel.bmp del $(MSWIN)\mnunsel.bmp
if exist $(MSWIN)\petmark.bmp del $(MSWIN)\petmark.bmp
if exist $(MSWIN)\pilemark.bmp del $(MSWIN)\pilemark.bmp
if exist $(MSWIN)\rip.bmp del $(MSWIN)\rip.bmp
if exist $(MSWIN)\splash.bmp del $(MSWIN)\splash.bmp
if exist $(MSWIN)\nethack.ico del $(MSWIN)\nethack.ico
if exist $(MSWSYS)\nethack.ico del $(MSWSYS)\nethack.ico
if exist $(U)recover.exe del $(U)recover.exe
if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe
if exist $(U)tilemap.exe del $(U)tilemap.exe
if exist $(U)uudecode.exe del $(U)uudecode.exe
if exist $(U)dlb_main.exe del $(U)dlb_main.exe
clean:
if exist $(O)*.o del $(O)*.o
if exist $(O)utility.tag del $(O)utility.tag
@@ -1262,6 +1288,7 @@ clean:
if exist $(O)nhraykey.lib del $(O)nhraykey.lib
if exist $(O)nhraykey.map del $(O)nhraykey.map
if exist $(O)nhraykey.PDB del $(O)nhraykey.PDB
if exist $(O)envchk.tag del $(O)envchk.tag
if exist $(O)obj.tag del $(O)obj.tag
if exist $(O)sp_lev.tag del $(O)sp_lev.tag
if exist $(O)uudecode.MAP del $(O)uudecode.MAP
@@ -1274,7 +1301,6 @@ clean:
rem defer to the steps in ..\win\win32\dgnstuff.mak
rem
nmake -nologo -f ..\win\win32\dgnstuff.mak clean
if exist $(TILEBMP16) del $(TILEBMP16)
if exist $(TILEBMP32) del $(TILEBMP32)

View File

@@ -12,8 +12,8 @@
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,5,0,0
PRODUCTVERSION 3,5,0,0
FILEVERSION 3,6,1,0
PRODUCTVERSION 3,6,1,0
FILEFLAGSMASK 0x1fL
#ifdef _DEBUG
FILEFLAGS 0x9L
@@ -29,13 +29,13 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "NetHack for Windows - TTY Interface\0"
VALUE "FileVersion", "3.5.0\0"
VALUE "FileVersion", "3.6.1\0"
VALUE "InternalName", "NetHack\0"
VALUE "LegalCopyright", "Copyright (C) 1985 - 2005. By Stichting Mathematisch Centrum and M. Stephenson. See license for details.\0"
VALUE "LegalCopyright", "Copyright (C) 1985 - 2018. By Stichting Mathematisch Centrum and M. Stephenson. See license for details.\0"
VALUE "OriginalFilename", "NetHack.exe\0"
VALUE "PrivateBuild", "050102\0"
VALUE "ProductName", "NetHack\0"
VALUE "ProductVersion", "3.5.0\0"
VALUE "ProductVersion", "3.6.1\0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,6 +35,9 @@
/* globals required within here */
HANDLE ffhandle = (HANDLE) 0;
WIN32_FIND_DATA ffd;
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
static HWND GetConsoleHandle(void);
static HWND GetConsoleHwnd(void);
/* The function pointer nt_kbhit contains a kbhit() equivalent
* which varies depending on which window port is active.
@@ -316,6 +319,119 @@ int interjection_type;
msmsg(interjection_buf[interjection_type]);
}
#ifdef RUNTIME_PASTEBUF_SUPPORT
void port_insert_pastebuf(buf)
char *buf;
{
/* This implementation will utilize the windows clipboard
* to accomplish this.
*/
char *tmp = buf;
HWND hwndConsole = GetConsoleHandle();
HGLOBAL hglbCopy;
WCHAR *w, w2[2];
int cc, rc, abytes;
LPWSTR lpwstrCopy;
HANDLE hresult;
if (!buf || (hwndConsole == NULL))
return;
cc = strlen(buf);
/* last arg=0 means "tell me the size of the buffer that I need" */
rc = MultiByteToWideChar(GetConsoleOutputCP(), 0, buf, -1, w2, 0);
if (!rc) return;
abytes = rc * sizeof(WCHAR);
w = (WCHAR *)alloc(abytes);
/* Housekeeping need: +free(w) */
rc = MultiByteToWideChar(GetConsoleOutputCP(), 0, buf, -1, w, rc);
if (!rc) {
free(w);
return;
}
if (!OpenClipboard(hwndConsole)) {
free(w);
return;
}
/* Housekeeping need: +CloseClipboard(), free(w) */
EmptyClipboard();
/* allocate global mem obj to hold the text */
hglbCopy = GlobalAlloc(GMEM_MOVEABLE, abytes);
if (hglbCopy == NULL) {
CloseClipboard();
free(w);
return;
}
/* Housekeeping need: +GlobalFree(hglbCopy), CloseClipboard(), free(w) */
lpwstrCopy = (LPWSTR)GlobalLock(hglbCopy);
/* Housekeeping need: +GlobalUnlock(hglbCopy), GlobalFree(hglbCopy),
CloseClipboard(), free(w) */
memcpy(lpwstrCopy, w, abytes);
GlobalUnlock(hglbCopy);
/* Housekeeping need: GlobalFree(hglbCopy), CloseClipboard(), free(w) */
/* put it on the clipboard */
hresult = SetClipboardData(CF_UNICODETEXT, hglbCopy);
if (!hresult) {
raw_printf("Error copying to clipboard.\n");
GlobalFree(hglbCopy); /* only needed if clipboard didn't accept data */
}
/* Housekeeping need: CloseClipboard(), free(w) */
CloseClipboard();
free(w);
return;
}
static HWND
GetConsoleHandle(void)
{
HMODULE hMod = GetModuleHandle("kernel32.dll");
GETCONSOLEWINDOW pfnGetConsoleWindow =
(GETCONSOLEWINDOW) GetProcAddress(hMod, "GetConsoleWindow");
if (pfnGetConsoleWindow)
return pfnGetConsoleWindow();
else
return GetConsoleHwnd();
}
static HWND
GetConsoleHwnd(void)
{
int iterations = 0;
HWND hwndFound = 0;
char OldTitle[1024], NewTitle[1024], TestTitle[1024];
/* Get current window title */
GetConsoleTitle(OldTitle, sizeof OldTitle);
(void) sprintf(NewTitle, "NETHACK%d/%d", GetTickCount(),
GetCurrentProcessId());
SetConsoleTitle(NewTitle);
GetConsoleTitle(TestTitle, sizeof TestTitle);
while (strcmp(TestTitle, NewTitle) != 0) {
iterations++;
/* sleep(0); */
GetConsoleTitle(TestTitle, sizeof TestTitle);
}
hwndFound = FindWindow(NULL, NewTitle);
SetConsoleTitle(OldTitle);
/* printf("%d iterations\n", iterations); */
return hwndFound;
}
#endif
#ifdef RUNTIME_PORT_ID
/*
* _M_IX86 is Defined for x86 processors. This is not defined for x64