Merge branch 'NetHack-3.7' into twitch-interact

This commit is contained in:
2026-04-13 15:05:44 -07:00
312 changed files with 15860 additions and 10846 deletions

View File

@@ -198,7 +198,7 @@ ARFLAGS = rcs
# The Qt and Be window systems are written in C++, while the rest of
# NetHack is standard C. If using Qt, uncomment the LINK line here to get
# the C++ libraries linked in.
CXXFLAGS = $(CCXXFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
CXXFLAGS ?= $(CCXXFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
CXX ?= g++
MOC ?= moc
MOCPATH ?= $(QTDIR)/bin/$(MOC)
@@ -502,7 +502,7 @@ TARGET_HACKLIB = $(TARGETPFX)hacklib.a
MAKEDEFS = ../util/makedefs
# -lm required by lua
LUA_VERSION ?=5.4.6
LUA_VERSION ?=5.4.8
LUABASE = liblua-$(LUA_VERSION).a
LUALIB = ../lib/lua/$(LUABASE)
LUALIBS = $(LUALIB) -lm $(DLLIB)
@@ -517,9 +517,9 @@ HACK_H = ../src/hack.h-t
HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
botl.c calendar.c cmd.c coloratt.c dbridge.c decl.c detect.c dig.c display.c \
dlb.c do.c do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c \
drawing.c dungeon.c eat.c end.c engrave.c exper.c explode.c \
drawing.c dungeon.c earlyarg.c eat.c end.c engrave.c exper.c explode.c \
extralev.c files.c fountain.c hack.c hacklib.c \
getpos.c glyphs.c insight.c invent.c isaac64.c light.c \
getpos.c glyphs.c iactions.c insight.c invent.c isaac64.c light.c \
lock.c mail.c makemon.c mcastu.c mdlib.c mhitm.c \
mhitu.c minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \
mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \
@@ -571,6 +571,7 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
color.h config.h config1.h context.h coord.h cstd.h decl.h \
defsym.h display.h dlb.h dungeon.h engrave.h extern.h flag.h \
fnamesiz.h func_tab.h global.h warnings.h hack.h lint.h mextra.h \
mcastu.h \
micro.h mfndpos.h mkroom.h monattk.h mondata.h monflag.h monst.h \
monsters.h nhmd4.h obj.h objects.h objclass.h optlist.h patchlevel.h \
pcconf.h permonst.h prop.h rect.h region.h savefile.h selvar.h sym.h \
@@ -597,21 +598,21 @@ HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
$(TARGETPFX)dlb.o $(TARGETPFX)do.o $(TARGETPFX)do_name.o \
$(TARGETPFX)do_wear.o $(TARGETPFX)dog.o $(TARGETPFX)dogmove.o \
$(TARGETPFX)dokick.o $(TARGETPFX)dothrow.o $(TARGETPFX)drawing.o \
$(TARGETPFX)dungeon.o $(TARGETPFX)eat.o $(TARGETPFX)end.o \
$(TARGETPFX)engrave.o $(TARGETPFX)exper.o $(TARGETPFX)explode.o \
$(TARGETPFX)extralev.o $(TARGETPFX)files.o $(TARGETPFX)fountain.o \
$(TARGETPFX)getpos.o $(TARGETPFX)glyphs.o $(TARGETPFX)hack.o \
$(TARGETPFX)insight.o $(TARGETPFX)invent.o $(TARGETPFX)isaac64.o \
$(TARGETPFX)light.o $(TARGETPFX)lock.o $(TARGETPFX)mail.o \
$(TARGETPFX)makemon.o $(TARGETPFX)mcastu.o $(TARGETPFX)mdlib.o \
$(TARGETPFX)mhitm.o $(TARGETPFX)mhitu.o $(TARGETPFX)minion.o \
$(TARGETPFX)mklev.o $(TARGETPFX)mkmap.o $(TARGETPFX)mkmaze.o \
$(TARGETPFX)mkobj.o $(TARGETPFX)mkroom.o $(TARGETPFX)mon.o \
$(TARGETPFX)mondata.o $(TARGETPFX)monmove.o $(TARGETPFX)monst.o \
$(TARGETPFX)mplayer.o $(TARGETPFX)mthrowu.o $(TARGETPFX)muse.o \
$(TARGETPFX)music.o $(TARGETPFX)nhlua.o $(TARGETPFX)nhlsel.o \
$(TARGETPFX)nhlobj.o $(TARGETPFX)nhmd4.o \
$(TARGETPFX)objects.o $(TARGETPFX)o_init.o \
$(TARGETPFX)dungeon.o $(TARGETPFX)earlyarg.o $(TARGETPFX)eat.o \
$(TARGETPFX)end.o $(TARGETPFX)engrave.o $(TARGETPFX)exper.o \
$(TARGETPFX)explode.o $(TARGETPFX)extralev.o $(TARGETPFX)files.o \
$(TARGETPFX)fountain.o $(TARGETPFX)getpos.o $(TARGETPFX)glyphs.o \
$(TARGETPFX)hack.o $(TARGETPFX)iactions.o $(TARGETPFX)insight.o \
$(TARGETPFX)invent.o $(TARGETPFX)isaac64.o $(TARGETPFX)light.o \
$(TARGETPFX)lock.o $(TARGETPFX)mail.o $(TARGETPFX)makemon.o \
$(TARGETPFX)mcastu.o $(TARGETPFX)mdlib.o $(TARGETPFX)mhitm.o \
$(TARGETPFX)mhitu.o $(TARGETPFX)minion.o $(TARGETPFX)mklev.o \
$(TARGETPFX)mkmap.o $(TARGETPFX)mkmaze.o $(TARGETPFX)mkobj.o \
$(TARGETPFX)mkroom.o $(TARGETPFX)mon.o $(TARGETPFX)mondata.o \
$(TARGETPFX)monmove.o $(TARGETPFX)monst.o $(TARGETPFX)mplayer.o \
$(TARGETPFX)mthrowu.o $(TARGETPFX)muse.o $(TARGETPFX)music.o \
$(TARGETPFX)nhlua.o $(TARGETPFX)nhlsel.o $(TARGETPFX)nhlobj.o \
$(TARGETPFX)nhmd4.o $(TARGETPFX)objects.o $(TARGETPFX)o_init.o \
$(TARGETPFX)objnam.o $(TARGETPFX)options.o $(TARGETPFX)pager.o \
$(TARGETPFX)pickup.o $(TARGETPFX)pline.o $(TARGETPFX)polyself.o \
$(TARGETPFX)potion.o $(TARGETPFX)pray.o $(TARGETPFX)priest.o \
@@ -642,7 +643,11 @@ DATE_O = $(TARGETPFX)date.o
all: $(GAME)
@echo ""
pregame:
create_responsefiles:
echo $(CC_COMPILER_SWITCHES) >$(CC_RESPONSEFILE)
echo $(CXX_COMPILER_SWITCHES) >$(CXX_RESPONSEFILE)
pregame: $(RESPONSEFILES)
$(PREGAME)
$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(WAVS) $(SYSTEM)
@@ -807,7 +812,8 @@ tags: $(CSOURCES)
clean:
-rm -f *.o $(HACK_H) $(CONFIG_H)
-rm -f monstr.c vis_tab.c ../include/vis_tab.h #obsolete generated files
true; $(CLEANMORE)
-true; $(CLEANMORE)
true; $(CLEAN_CC_RESPONSEFILE) $(CLEAN_CXX_RESPONSEFILE)
spotless: clean
-rm -f a.out core $(HACKLIB) $(GAMEBIN) Sys*
@@ -890,6 +896,7 @@ $(HACK_H): $(CONFIG_H) ../include/align.h ../include/artilist.h \
../include/decl.h ../include/defsym.h ../include/display.h \
../include/dungeon.h ../include/engrave.h ../include/flag.h \
../include/hack.h ../include/lint.h ../include/mextra.h \
../include/mcastu.h \
../include/mkroom.h ../include/monattk.h ../include/mondata.h \
../include/monflag.h ../include/monst.h ../include/monsters.h \
../include/nhlua.h ../include/obj.h ../include/objclass.h \
@@ -1158,6 +1165,7 @@ $(TARGETPFX)drawing.o: drawing.c $(CONFIG_H) ../include/defsym.h \
../include/sym.h ../include/wintype.h
$(TARGETPFX)dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h \
../include/dlb.h
$(TARGETPFX)earlyarg.o: earlyarg.c $(HACK_H)
$(TARGETPFX)eat.o: eat.c $(HACK_H)
$(TARGETPFX)end.o: end.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)engrave.o: engrave.c $(HACK_H)
@@ -1171,6 +1179,7 @@ $(TARGETPFX)getpos.o: getpos.c $(HACK_H)
$(TARGETPFX)glyphs.o: glyphs.c $(HACK_H)
$(TARGETPFX)hack.o: hack.c $(HACK_H)
$(TARGETPFX)hacklib.o: hacklib.c $(HACK_H)
$(TARGETPFX)iactions.o: iactions.c $(HACK_H)
$(TARGETPFX)insight.o: insight.c $(HACK_H)
$(TARGETPFX)invent.o: invent.c $(HACK_H)
$(TARGETPFX)isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h
@@ -1178,7 +1187,7 @@ $(TARGETPFX)light.o: light.c $(HACK_H)
$(TARGETPFX)lock.o: lock.c $(HACK_H)
$(TARGETPFX)mail.o: mail.c $(HACK_H) ../include/mail.h
$(TARGETPFX)makemon.o: makemon.c $(HACK_H)
$(TARGETPFX)mcastu.o: mcastu.c $(HACK_H)
$(TARGETPFX)mcastu.o: mcastu.c $(HACK_H) ../include/mcastu.h
$(TARGETPFX)mdlib.o: mdlib.c $(CONFIG_H) ../include/align.h \
../include/artilist.h ../include/attrib.h \
../include/context.h ../include/defsym.h ../include/dlb.h \

View File

@@ -85,7 +85,7 @@ VARDAT = $(VARDATD) $(VARDATND)
#CHGRP = chgrp
# Lua version
LUA_VERSION = 5.4.6
LUA_VERSION = 5.4.8
#
# end of configuration
@@ -440,6 +440,8 @@ update: $(PRECHECK) $(GAME) recover $(VARDAT) spec_levs sys/unix/sysconf
touch $(VARDIR)/perm $(VARDIR)/record
# sysconf, but only if it does not exist
true; $(SYSCONFENSURE)
# other steps from hints file
true; $(POSTUPDATE)
# and a reminder
@echo You may also want to install the man pages via the doc Makefile.

View File

@@ -394,8 +394,10 @@ $(TARGETPFX)sf-version.o: ../src/version.c $(HACK_H)
$(TARGETPFX)sf-worm.o: ../src/worm.c $(HACK_H)
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c
sftags: sftags.o $(HACKLIB)
$(CLINK) $(LFLAGS) -o $@ sftags.o $(HACKLIB) $(LIBS)
sftags: sftags.o $(HACKLIB) $(TARGETPFX)sf-alloc.o $(TARGETPFX)panic.o
$(CLINK) $(LFLAGS) -o $@ sftags.o \
$(TARGETPFX)sf-alloc.o $(TARGETPFX)panic.o \
$(HACKLIB) $(LIBS)
sftags.o: sftags.c $(HACK_H)
$(CC) $(CFLAGS) -c sftags.c
../include/sfproto.h: sf.tags sftags

View File

@@ -202,12 +202,14 @@
BAE8015627B99CAE002B3786 /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = BAE8013427B99CAD002B3786 /* lstrlib.c */; };
BAE8015727B99CAE002B3786 /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = BAE8013527B99CAD002B3786 /* lzio.c */; };
BAE8015A27B9C872002B3786 /* date.c in Sources */ = {isa = PBXBuildFile; fileRef = 5439B3BB275AADC600B8FB2F /* date.c */; };
F50818312F6F564300D2AAFA /* iactions.c in Sources */ = {isa = PBXBuildFile; fileRef = F50818302F6F564300D2AAFA /* iactions.c */; };
F5457B212DED146B00039D83 /* hacklib.c in Sources */ = {isa = PBXBuildFile; fileRef = F5457B202DED146B00039D83 /* hacklib.c */; };
F5457B2C2DED16F200039D83 /* libhacklib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F5457B1C2DED143E00039D83 /* libhacklib.a */; };
F5457B2D2DED171800039D83 /* libhacklib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F5457B1C2DED143E00039D83 /* libhacklib.a */; };
F5857AA22DED026700A8CB4F /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A32721A238010055BD01 /* version.c */; };
F5857AA42DED032D00A8CB4F /* cfgfiles.c in Sources */ = {isa = PBXBuildFile; fileRef = F5857AA32DED032C00A8CB4F /* cfgfiles.c */; };
F5857AA62DED03BB00A8CB4F /* sfbase.c in Sources */ = {isa = PBXBuildFile; fileRef = F5857AA52DED03BB00A8CB4F /* sfbase.c */; };
F5E66A222F7D4B30000E30B7 /* earlyarg.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E66A212F7D4B30000E30B7 /* earlyarg.c */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -561,40 +563,41 @@
54FB2B4A246310A600397C0E /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = symbols.c; path = ../../src/symbols.c; sourceTree = "<group>"; };
54FCE8282223261F00F393C8 /* isaac64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = isaac64.c; path = ../../src/isaac64.c; sourceTree = "<group>"; };
BAE8010A27B97760002B3786 /* libnhlua.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libnhlua.a; sourceTree = BUILT_PRODUCTS_DIR; };
BAE8011427B99CAB002B3786 /* lopcodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = "../../lib/lua-5.4.6/src/lopcodes.c"; sourceTree = "<group>"; };
BAE8011527B99CAB002B3786 /* linit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linit.c; path = "../../lib/lua-5.4.6/src/linit.c"; sourceTree = "<group>"; };
BAE8011627B99CAB002B3786 /* lobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = "../../lib/lua-5.4.6/src/lobject.c"; sourceTree = "<group>"; };
BAE8011727B99CAC002B3786 /* loslib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loslib.c; path = "../../lib/lua-5.4.6/src/loslib.c"; sourceTree = "<group>"; };
BAE8011827B99CAC002B3786 /* lcorolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcorolib.c; path = "../../lib/lua-5.4.6/src/lcorolib.c"; sourceTree = "<group>"; };
BAE8011927B99CAC002B3786 /* lutf8lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lutf8lib.c; path = "../../lib/lua-5.4.6/src/lutf8lib.c"; sourceTree = "<group>"; };
BAE8011A27B99CAC002B3786 /* ltable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = "../../lib/lua-5.4.6/src/ltable.c"; sourceTree = "<group>"; };
BAE8011B27B99CAC002B3786 /* ltablib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = "../../lib/lua-5.4.6/src/ltablib.c"; sourceTree = "<group>"; };
BAE8011C27B99CAC002B3786 /* llex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = llex.c; path = "../../lib/lua-5.4.6/src/llex.c"; sourceTree = "<group>"; };
BAE8011D27B99CAC002B3786 /* lcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = "../../lib/lua-5.4.6/src/lcode.c"; sourceTree = "<group>"; };
BAE8011E27B99CAC002B3786 /* lua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua.c; path = "../../lib/lua-5.4.6/src/lua.c"; sourceTree = "<group>"; };
BAE8011F27B99CAC002B3786 /* ldo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = "../../lib/lua-5.4.6/src/ldo.c"; sourceTree = "<group>"; };
BAE8012027B99CAC002B3786 /* ldump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = "../../lib/lua-5.4.6/src/ldump.c"; sourceTree = "<group>"; };
BAE8012127B99CAC002B3786 /* lparser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = "../../lib/lua-5.4.6/src/lparser.c"; sourceTree = "<group>"; };
BAE8012227B99CAC002B3786 /* lstate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = "../../lib/lua-5.4.6/src/lstate.c"; sourceTree = "<group>"; };
BAE8012327B99CAC002B3786 /* lapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = "../../lib/lua-5.4.6/src/lapi.c"; sourceTree = "<group>"; };
BAE8012427B99CAC002B3786 /* ldebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = "../../lib/lua-5.4.6/src/ldebug.c"; sourceTree = "<group>"; };
BAE8012527B99CAC002B3786 /* lstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = "../../lib/lua-5.4.6/src/lstring.c"; sourceTree = "<group>"; };
BAE8012627B99CAC002B3786 /* ltm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = "../../lib/lua-5.4.6/src/ltm.c"; sourceTree = "<group>"; };
BAE8012727B99CAC002B3786 /* lmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = "../../lib/lua-5.4.6/src/lmem.c"; sourceTree = "<group>"; };
BAE8012827B99CAC002B3786 /* lvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = "../../lib/lua-5.4.6/src/lvm.c"; sourceTree = "<group>"; };
BAE8012927B99CAC002B3786 /* lfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = "../../lib/lua-5.4.6/src/lfunc.c"; sourceTree = "<group>"; };
BAE8012A27B99CAC002B3786 /* lgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = "../../lib/lua-5.4.6/src/lgc.c"; sourceTree = "<group>"; };
BAE8012B27B99CAD002B3786 /* lundump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = "../../lib/lua-5.4.6/src/lundump.c"; sourceTree = "<group>"; };
BAE8012C27B99CAD002B3786 /* lbaselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = "../../lib/lua-5.4.6/src/lbaselib.c"; sourceTree = "<group>"; };
BAE8012D27B99CAD002B3786 /* ldblib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldblib.c; path = "../../lib/lua-5.4.6/src/ldblib.c"; sourceTree = "<group>"; };
BAE8012E27B99CAD002B3786 /* lauxlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = "../../lib/lua-5.4.6/src/lauxlib.c"; sourceTree = "<group>"; };
BAE8012F27B99CAD002B3786 /* liolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = liolib.c; path = "../../lib/lua-5.4.6/src/liolib.c"; sourceTree = "<group>"; };
BAE8013027B99CAD002B3786 /* lctype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lctype.c; path = "../../lib/lua-5.4.6/src/lctype.c"; sourceTree = "<group>"; };
BAE8013127B99CAD002B3786 /* luac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = luac.c; path = "../../lib/lua-5.4.6/src/luac.c"; sourceTree = "<group>"; };
BAE8013227B99CAD002B3786 /* loadlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loadlib.c; path = "../../lib/lua-5.4.6/src/loadlib.c"; sourceTree = "<group>"; };
BAE8013327B99CAD002B3786 /* lmathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmathlib.c; path = "../../lib/lua-5.4.6/src/lmathlib.c"; sourceTree = "<group>"; };
BAE8013427B99CAD002B3786 /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = "../../lib/lua-5.4.6/src/lstrlib.c"; sourceTree = "<group>"; };
BAE8013527B99CAD002B3786 /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = "../../lib/lua-5.4.6/src/lzio.c"; sourceTree = "<group>"; };
BAE8011427B99CAB002B3786 /* lopcodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = "../../lib/lua-5.4.8/src/lopcodes.c"; sourceTree = "<group>"; };
BAE8011527B99CAB002B3786 /* linit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linit.c; path = "../../lib/lua-5.4.8/src/linit.c"; sourceTree = "<group>"; };
BAE8011627B99CAB002B3786 /* lobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = "../../lib/lua-5.4.8/src/lobject.c"; sourceTree = "<group>"; };
BAE8011727B99CAC002B3786 /* loslib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loslib.c; path = "../../lib/lua-5.4.8/src/loslib.c"; sourceTree = "<group>"; };
BAE8011827B99CAC002B3786 /* lcorolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcorolib.c; path = "../../lib/lua-5.4.8/src/lcorolib.c"; sourceTree = "<group>"; };
BAE8011927B99CAC002B3786 /* lutf8lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lutf8lib.c; path = "../../lib/lua-5.4.8/src/lutf8lib.c"; sourceTree = "<group>"; };
BAE8011A27B99CAC002B3786 /* ltable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = "../../lib/lua-5.4.8/src/ltable.c"; sourceTree = "<group>"; };
BAE8011B27B99CAC002B3786 /* ltablib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = "../../lib/lua-5.4.8/src/ltablib.c"; sourceTree = "<group>"; };
BAE8011C27B99CAC002B3786 /* llex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = llex.c; path = "../../lib/lua-5.4.8/src/llex.c"; sourceTree = "<group>"; };
BAE8011D27B99CAC002B3786 /* lcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = "../../lib/lua-5.4.8/src/lcode.c"; sourceTree = "<group>"; };
BAE8011E27B99CAC002B3786 /* lua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua.c; path = "../../lib/lua-5.4.8/src/lua.c"; sourceTree = "<group>"; };
BAE8011F27B99CAC002B3786 /* ldo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = "../../lib/lua-5.4.8/src/ldo.c"; sourceTree = "<group>"; };
BAE8012027B99CAC002B3786 /* ldump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = "../../lib/lua-5.4.8/src/ldump.c"; sourceTree = "<group>"; };
BAE8012127B99CAC002B3786 /* lparser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = "../../lib/lua-5.4.8/src/lparser.c"; sourceTree = "<group>"; };
BAE8012227B99CAC002B3786 /* lstate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = "../../lib/lua-5.4.8/src/lstate.c"; sourceTree = "<group>"; };
BAE8012327B99CAC002B3786 /* lapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = "../../lib/lua-5.4.8/src/lapi.c"; sourceTree = "<group>"; };
BAE8012427B99CAC002B3786 /* ldebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = "../../lib/lua-5.4.8/src/ldebug.c"; sourceTree = "<group>"; };
BAE8012527B99CAC002B3786 /* lstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = "../../lib/lua-5.4.8/src/lstring.c"; sourceTree = "<group>"; };
BAE8012627B99CAC002B3786 /* ltm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = "../../lib/lua-5.4.8/src/ltm.c"; sourceTree = "<group>"; };
BAE8012727B99CAC002B3786 /* lmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = "../../lib/lua-5.4.8/src/lmem.c"; sourceTree = "<group>"; };
BAE8012827B99CAC002B3786 /* lvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = "../../lib/lua-5.4.8/src/lvm.c"; sourceTree = "<group>"; };
BAE8012927B99CAC002B3786 /* lfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = "../../lib/lua-5.4.8/src/lfunc.c"; sourceTree = "<group>"; };
BAE8012A27B99CAC002B3786 /* lgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = "../../lib/lua-5.4.8/src/lgc.c"; sourceTree = "<group>"; };
BAE8012B27B99CAD002B3786 /* lundump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = "../../lib/lua-5.4.8/src/lundump.c"; sourceTree = "<group>"; };
BAE8012C27B99CAD002B3786 /* lbaselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = "../../lib/lua-5.4.8/src/lbaselib.c"; sourceTree = "<group>"; };
BAE8012D27B99CAD002B3786 /* ldblib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldblib.c; path = "../../lib/lua-5.4.8/src/ldblib.c"; sourceTree = "<group>"; };
BAE8012E27B99CAD002B3786 /* lauxlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = "../../lib/lua-5.4.8/src/lauxlib.c"; sourceTree = "<group>"; };
BAE8012F27B99CAD002B3786 /* liolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = liolib.c; path = "../../lib/lua-5.4.8/src/liolib.c"; sourceTree = "<group>"; };
BAE8013027B99CAD002B3786 /* lctype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lctype.c; path = "../../lib/lua-5.4.8/src/lctype.c"; sourceTree = "<group>"; };
BAE8013127B99CAD002B3786 /* luac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = luac.c; path = "../../lib/lua-5.4.8/src/luac.c"; sourceTree = "<group>"; };
BAE8013227B99CAD002B3786 /* loadlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loadlib.c; path = "../../lib/lua-5.4.8/src/loadlib.c"; sourceTree = "<group>"; };
BAE8013327B99CAD002B3786 /* lmathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmathlib.c; path = "../../lib/lua-5.4.8/src/lmathlib.c"; sourceTree = "<group>"; };
BAE8013427B99CAD002B3786 /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = "../../lib/lua-5.4.8/src/lstrlib.c"; sourceTree = "<group>"; };
BAE8013527B99CAD002B3786 /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = "../../lib/lua-5.4.8/src/lzio.c"; sourceTree = "<group>"; };
F50818302F6F564300D2AAFA /* iactions.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = iactions.c; path = ../../src/iactions.c; sourceTree = "<group>"; };
F515A6F32DED074D006E1F63 /* sfctool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = sfctool.c; path = ../../util/sfctool.c; sourceTree = "<group>"; };
F515A6F52DED0916006E1F63 /* date.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = date.c; path = ../../src/date.c; sourceTree = "<group>"; };
F515A6F62DED0916006E1F63 /* sfbase.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = sfbase.c; path = ../../src/sfbase.c; sourceTree = "<group>"; };
@@ -632,6 +635,7 @@
F54C1AE42E43D22A006CAA8E /* sfprocs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = sfprocs.h; path = ../../include/include/sfprocs.h; sourceTree = "<group>"; };
F5857AA32DED032C00A8CB4F /* cfgfiles.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cfgfiles.c; path = ../../src/cfgfiles.c; sourceTree = "<group>"; };
F5857AA52DED03BB00A8CB4F /* sfbase.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = sfbase.c; path = ../../src/sfbase.c; sourceTree = "<group>"; };
F5E66A212F7D4B30000E30B7 /* earlyarg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = earlyarg.c; path = ../../src/earlyarg.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
@@ -691,6 +695,8 @@
3189576821A1FCC100FB2ABE = {
isa = PBXGroup;
children = (
F5E66A212F7D4B30000E30B7 /* earlyarg.c */,
F50818302F6F564300D2AAFA /* iactions.c */,
F515A73B2DED0B47006E1F63 /* hacklib.c */,
F5457B202DED146B00039D83 /* hacklib.c */,
F515A72A2DED0A7C006E1F63 /* sftags.c */,
@@ -1570,6 +1576,7 @@
"$(NH_DAT_DIR)/bigrm-10.lua",
"$(NH_DAT_DIR)/bigrm-11.lua",
"$(NH_DAT_DIR)/bigrm-12.lua",
"$(NH_DAT_DIR)/bigrm-13.lua",
"$(NH_DAT_DIR)/bigrm-2.lua",
"$(NH_DAT_DIR)/bigrm-3.lua",
"$(NH_DAT_DIR)/bigrm-4.lua",
@@ -1872,6 +1879,7 @@
31B8A41321A23F650055BD01 /* version.c in Sources */,
31B8A3BB21A238060055BD01 /* allmain.c in Sources */,
31B8A39521A238060055BD01 /* windows.c in Sources */,
F5E66A222F7D4B30000E30B7 /* earlyarg.c in Sources */,
31B8A38621A238060055BD01 /* mondata.c in Sources */,
31B8A41921A244940055BD01 /* objects.c in Sources */,
31B8A3AA21A238060055BD01 /* wizard.c in Sources */,
@@ -1979,6 +1987,7 @@
31B8A38421A238060055BD01 /* do_name.c in Sources */,
31B8A3C421A238060055BD01 /* apply.c in Sources */,
31B8A3F721A23DD10055BD01 /* unixres.c in Sources */,
F50818312F6F564300D2AAFA /* iactions.c in Sources */,
31B8A3BD21A238060055BD01 /* files.c in Sources */,
31B8A39221A238060055BD01 /* do_wear.c in Sources */,
31B8A3E521A238B30055BD01 /* dlb.c in Sources */,
@@ -2189,7 +2198,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../include";
LUA_VERSION = 5.4.6;
LUA_VERSION = 5.4.8;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@@ -2272,7 +2281,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../include";
LUA_VERSION = 5.4.6;
LUA_VERSION = 5.4.8;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;

View File

@@ -104,7 +104,8 @@ additional interfaces. See below.
| | | | support in your build. |
| | | | |
| | | | One possible way: |
| | | | brew install Qt |
| | | | brew install pkg-config |
| | | | brew install Qt6 |
|----------+-------+-----------------+--------------------------------------|
| Linux | tty | WANT_WIN_TTY | |
| (Ubuntu) | | | |

View File

@@ -49,7 +49,10 @@ make musl=1 Build with settings appropriate for linking with
musl libc, instead of glibc. This causes
NOCRASHREPORT to be defined, and avoids the use
of 'col' during the build.
make resp=1 Place the majority of the compiler switches into
a response file to de-clutter the build compiler
command lines and eliminate some of the
unsightly wrapping that occurs.
make CROSS_TO_MSDOS=1 package Cross-compile for an MSDOS target package.
make CROSS_TO_WASM=1 Cross-compile for a WASM target.
make CROSS_TO_MIPS=1 Cross-compile for a mips target.

View File

@@ -55,6 +55,7 @@ CFLAGS+=-Wall -Wextra \
CFLAGS+=-pedantic
CFLAGS+=-Wmissing-declarations
#CFLAGS+=-Wformat=2
#CFLAGS+=-Wdiscarded-qualifiers
# these are left out of the C++ flags
CFLAGS+=-Wformat-nonliteral
@@ -98,6 +99,7 @@ CXX=clang++ -std=gnu++11
# clang-specific follows
CLANGGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12)
CLANGGTEQ14 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 14)
CLANGGTEQ21 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 21)
ifeq "$(CLANGGTEQ12)" "1"
CFLAGS+=-Wimplicit-fallthrough
endif
@@ -109,6 +111,9 @@ else
# older versions complain about things newer ones don't without this
CFLAGS+=-Wno-missing-field-initializers
endif
ifeq "$(CLANGGTEQ21)" "1"
CFLAGS+=-Wno-deprecated-octal-literals
endif
# none
endif # clang-specific ends here
@@ -230,6 +235,20 @@ ifeq "$(C23)" "1"
HAVECSTD=c2x
endif
ifeq "$(c2x)" "1"
HAVECSTD=c2x
endif
ifeq "$(C2X)" "1"
HAVECSTD=c2x
endif
ifeq "$(c2y)" "1"
HAVECSTD=c2y
endif
ifeq "$(C2Y)" "1"
HAVECSTD=c2y
endif
ifneq "$(HAVECSTD)" ""
CSTD = -std=$(HAVECSTD)
endif

View File

@@ -57,14 +57,14 @@ dospkg: dodata dosfonts $(GAMEBIN) $(TARGETPFX)recover.exe ../dat/nhtiles.bmp
cp ../sys/share/NetHack.cnf $(TARGETPFX)pkg/NETHACK.CNF
cp ../sys/msdos/sysconf $(TARGETPFX)pkg/SYSCONF
cp ../doc/nethack.txt $(TARGETPFX)pkg/NETHACK.TXT
cp $(DOSFONT)/ter-u16b.psf $(TARGETPFX)pkg/TER-U16B.PSF
cp $(DOSFONT)/ter-u16v.psf $(TARGETPFX)pkg/TER-U16V.PSF
cp $(DOSFONT)/ter-u18b.psf $(TARGETPFX)pkg/TER-U18B.PSF
cp $(DOSFONT)/ter-u20b.psf $(TARGETPFX)pkg/TER-U20B.PSF
cp $(DOSFONT)/ter-u22b.psf $(TARGETPFX)pkg/TER-U22B.PSF
cp $(DOSFONT)/ter-u24b.psf $(TARGETPFX)pkg/TER-U24B.PSF
cp $(DOSFONT)/ter-u28b.psf $(TARGETPFX)pkg/TER-U28B.PSF
cp $(DOSFONT)/ter-u32b.psf $(TARGETPFX)pkg/TER-U32B.PSF
-cp $(DOSFONT)/ter-u16b.psf $(TARGETPFX)pkg/TER-U16B.PSF
-cp $(DOSFONT)/ter-u16v.psf $(TARGETPFX)pkg/TER-U16V.PSF
-cp $(DOSFONT)/ter-u18b.psf $(TARGETPFX)pkg/TER-U18B.PSF
-cp $(DOSFONT)/ter-u20b.psf $(TARGETPFX)pkg/TER-U20B.PSF
-cp $(DOSFONT)/ter-u22b.psf $(TARGETPFX)pkg/TER-U22B.PSF
-cp $(DOSFONT)/ter-u24b.psf $(TARGETPFX)pkg/TER-U24B.PSF
-cp $(DOSFONT)/ter-u28b.psf $(TARGETPFX)pkg/TER-U28B.PSF
-cp $(DOSFONT)/ter-u32b.psf $(TARGETPFX)pkg/TER-U32B.PSF
cp ../lib/djgpp/cwsdpmi/bin/CWSDPMI.EXE $(TARGETPFX)pkg/CWSDPMI.EXE
( if [ -f ../lib/djgpp/target/bin/symify.exe ]; then \
cp ../lib/djgpp/target/bin/symify.exe $(TARGETPFX)pkg/SYMIFY.EXE; \
@@ -229,6 +229,113 @@ mipspkg: dodata $(GAMEBIN) $(TARGETPFX)recover
@echo MIPS package zip file $(TARGETPFX)nh370mips.zip
endif # CROSS_TO_MIPS
ifdef CROSS_TO_AMIGA
$(TARGETPFX)amidos.o : ../sys/amiga/amidos.c $(HACK_H)
$(TARGETPFX)amigst.o : ../sys/amiga/amigst.c $(HACK_H)
$(TARGETPFX)amirip.o : ../sys/amiga/amirip.c $(HACK_H)
$(TARGETPFX)amistack.o : ../sys/amiga/amistack.c $(HACK_H)
$(TARGETPFX)amitty.o : ../sys/amiga/amitty.c $(HACK_H)
$(TARGETPFX)amiwind.o : ../sys/amiga/amiwind.c \
../sys/amiga/amimenu.c $(HACK_H)
$(TARGETPFX)winami.o : ../sys/amiga/winami.c $(HACK_H)
$(TARGETPFX)winchar.o : ../sys/amiga/winchar.c tile.c $(HACK_H)
$(TARGETPFX)winfuncs.o : ../sys/amiga/winfuncs.c $(HACK_H)
$(TARGETPFX)winkey.o : ../sys/amiga/winkey.c $(HACK_H)
$(TARGETPFX)winamenu.o : ../sys/amiga/winamenu.c $(HACK_H)
$(TARGETPFX)winreq.o : ../sys/amiga/winreq.c \
../sys/amiga/colorwin.c \
../sys/amiga/clipwin.c $(HACK_H)
$(TARGETPFX)winstr.o : ../sys/amiga/winstr.c $(HACK_H)
$(GAMEBIN) : $(HOBJ) $(LUACROSSLIB)
$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(WINLIB) $(TARGET_LIBS)
#
# Host-side IFF tile conversion tools (run on Linux, produce Amiga IFF files)
#
AMISRC = ../sys/amiga
$(TARGETPFX)xpm2iff_host: $(AMISRC)/xpm2iff_host.c
$(CC) $(CFLAGS) -o $@ $<
$(TARGETPFX)tomb.iff: $(AMISRC)/grave16.xpm $(TARGETPFX)xpm2iff_host
$(TARGETPFX)xpm2iff_host $(AMISRC)/grave16.xpm $@
$(TARGETPFX)bmp2iff_host: $(AMISRC)/bmp2iff_host.c
$(CC) $(CFLAGS) -o $@ $<
$(TARGETPFX)tiles16.iff: ../dat/nhtiles.bmp $(TARGETPFX)bmp2iff_host
$(TARGETPFX)bmp2iff_host -planes 4 ../dat/nhtiles.bmp $@
$(TARGETPFX)tiles32.iff: ../dat/nhtiles.bmp $(TARGETPFX)bmp2iff_host
$(TARGETPFX)bmp2iff_host -planes 5 ../dat/nhtiles.bmp $@
AMITILES = $(TARGETPFX)tiles16.iff $(TARGETPFX)tiles32.iff $(TARGETPFX)tomb.iff
AMIREGEX_URL = https://github.com/garyhouston/regex.git
AMIREGEX_SRCDIR = $(AMISRC)/regex
.PHONY: fetch-regex amigapkg amitiles
fetch-regex:
@DSTDIR=sys/amiga/regex; \
if [ ! -d src ]; then DSTDIR=../$$DSTDIR; fi; \
if [ -f $$DSTDIR/regcomp.c ]; then \
echo "BSD regex already present"; \
else \
echo "Fetching BSD regex from $(AMIREGEX_URL)"; \
tmpdir=$$(mktemp -d) && \
git clone --depth 1 $(AMIREGEX_URL) $$tmpdir && \
cd $$tmpdir && \
sh ./mkh -p regcomp.c > regcomp.ih && \
sh ./mkh -p engine.c > engine.ih && \
sh ./mkh -p regexec.c > regexec.ih && \
sh ./mkh -p regerror.c > regerror.ih && \
sh ./mkh -i _REGEX_H_ regex2.h regcomp.c \
regexec.c regerror.c regfree.c > regex.h && \
cd - > /dev/null && \
mkdir -p $$DSTDIR && \
for f in regcomp.c regexec.c regerror.c regfree.c \
engine.c regex.h regex2.h cclass.h cname.h \
utils.h regcomp.ih engine.ih regexec.ih \
regerror.ih \
COPYRIGHT; do \
cp $$tmpdir/$$f $$DSTDIR/; \
done && \
rm -rf $$tmpdir && \
echo "BSD regex installed in $$DSTDIR"; \
fi
amitiles: $(AMITILES)
UUDECODE = ../util/uudecode
../util/uudecode: ../sys/share/uudecode.c
$(CC) $(CFLAGS) -o $@ $<
amigapkg: $(AMITILES) ../util/uudecode
mkdir -p $(TARGETPFX)pkg/tiles $(TARGETPFX)pkg/hack
cp $(GAMEBIN) $(TARGETPFX)pkg/nethack
cp ../dat/nhdat $(TARGETPFX)pkg/nhdat
cp ../dat/license $(TARGETPFX)pkg/license
cp ../dat/symbols $(TARGETPFX)pkg/symbols
cp $(TARGETPFX)tiles16.iff $(TARGETPFX)pkg/tiles/tiles16.iff
cp $(TARGETPFX)tiles32.iff $(TARGETPFX)pkg/tiles/tiles32.iff
cp $(TARGETPFX)tomb.iff $(TARGETPFX)pkg/tomb.iff
cp ../sys/msdos/sysconf $(TARGETPFX)pkg/sysconf
cp ../doc/nethack.txt $(TARGETPFX)pkg/nethack.txt
( cd $(TARGETPFX)pkg && ../../../util/uudecode ../../../sys/amiga/amifont8.uu && mv 8 hack/8 )
( cd $(TARGETPFX)pkg && ../../../util/uudecode ../../../sys/amiga/amifont.uu )
cp $(AMISRC)/nethack.cnf $(TARGETPFX)pkg/nethack.cnf
-( cd $(TARGETPFX)pkg && test -f ../../../sys/amiga/dflticon.uu && \
../../../util/uudecode ../../../sys/amiga/dflticon.uu )
-( cd $(TARGETPFX)pkg && test -f ../../../sys/amiga/NHinfo.uu && \
../../../util/uudecode ../../../sys/amiga/NHinfo.uu )
-( cd $(TARGETPFX)pkg && test -f ../../../sys/amiga/NewGame.uu && \
../../../util/uudecode ../../../sys/amiga/NewGame.uu )
-( cd $(TARGETPFX)pkg && test -f ../../../sys/amiga/HackWB.uu && \
../../../util/uudecode ../../../sys/amiga/HackWB.uu )
touch $(TARGETPFX)pkg/record
( cd $(TARGETPFX)pkg && zip -9r ../NH370AMI.ZIP * )
@echo amiga package zip file $(TARGETPFX)NH370AMI.ZIP
endif # CROSS_TO_AMIGA
ifdef CROSS_SHARED
# shared file dependencies
$(TARGETPFX)pcmain.o : ../sys/share/pcmain.c $(HACK_H)

View File

@@ -38,6 +38,16 @@ override TARGETPFX = $(TARGETDIR)/
override TARGET_LIBS=
endif
ifdef CROSS_TO_AMIGA
CROSS=1
BUILD_TARGET_LUA=1
CROSS_SHARED=1
override TARGET = amiga
override TARGETDIR=../targets/$(TARGET)
override TARGETPFX = $(TARGETDIR)/
override TARGET_LIBS=
endif
ifdef CROSS
override PREGAME=
override BUILDMORE=

View File

@@ -7,9 +7,9 @@
ifdef BUILD_TARGET_LUA
#===============-=================================================
# LUA library
# Source from http://www.lua.org/ftp/lua-5.4.6.tar.gz
# Source from http://www.lua.org/ftp/lua-5.4.8.tar.gz
#=================================================================
LUA_VERSION ?=5.4.6
LUA_VERSION ?=5.4.8
LUATOP ?= ../lib/lua-$(LUA_VERSION)
LUASRCDIR ?= $(LUATOP)/src
LUAOBJFILES1 = $(TARGETPFX)lapi.o $(TARGETPFX)lauxlib.o \
@@ -119,7 +119,7 @@ ifdef CROSS_TO_MSDOS
# 2. Then
# make CROSS_TO_MSDOS=1 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 all
#
# Source from http://www.lua.org/ftp/lua-5.4.6.tar.gz
# Source from http://www.lua.org/ftp/lua-5.4.8.tar.gz
#=================================================================
CFLAGS += -DCROSSCOMPILE
@@ -188,6 +188,7 @@ MSDOS_TARGET_CXXFLAGS = -c -O $(DBGFLAGS) -I../include -I../sys/msdos -I../win/s
PDCINCL += -I$(PDCPORT)
PDC_TARGET_CFLAGS = $(MSDOS_TARGET_CFLAGS) -Wno-unused-parameter \
-Wno-missing-prototypes
ifndef SKIP_FONTS_IN_CI
FONTVER = terminus-font-4.49.1
FONTTOP = ../lib/$(FONTVER)
DOSFONT = ../sys/msdos/fonts
@@ -195,6 +196,9 @@ FONTTARGETS = $(DOSFONT)/ter-u16b.psf $(DOSFONT)/ter-u16v.psf \
$(DOSFONT)/ter-u18b.psf $(DOSFONT)/ter-u20b.psf \
$(DOSFONT)/ter-u22b.psf $(DOSFONT)/ter-u24b.psf \
$(DOSFONT)/ter-u28b.psf $(DOSFONT)/ter-u32b.psf
else
FONTTARGETS=
endif
LUABIN = ../lib/lua-$(LUA_VERSION)/src/lua
LUA_TARGET_CFLAGS = $(MSDOS_TARGET_CFLAGS)
override TARGET_CFLAGS = $(MSDOS_TARGET_CFLAGS) $(MSDOS_PEDANTIC)
@@ -275,7 +279,7 @@ EMCC_LFLAGS += -s ALLOW_TABLE_GROWTH
EMCC_LFLAGS += -s ASYNCIFY -s ASYNCIFY_IMPORTS='["local_callback"]'
EMCC_LFLAGS += -O3
EMCC_LFLAGS += -s MODULARIZE
EMCC_LFLAGS += -s EXPORTED_FUNCTIONS='["_main", "_shim_graphics_set_callback", "_display_inventory", "_malloc"]'
EMCC_LFLAGS += -s EXPORTED_FUNCTIONS='["_main", "_shim_graphics_set_callback", "_repopulate_perminvent", "_malloc"]'
EMCC_LFLAGS += -s EXPORTED_RUNTIME_METHODS='["cwrap", "ccall", "addFunction", \
"removeFunction", "UTF8ToString", "stringToUTF8", "getValue", \
"setValue", "ENV", "FS", "IDBFS"]'
@@ -456,6 +460,97 @@ NCURSES_PLATFORM=MIPS
endif # CROSS_TO_MIPS
#=================================================================
#=================================================================
ifdef CROSS_TO_AMIGA
#===============-=================================================
# AmigaOS m68k cross-compile recipe
#===============-=================================================
# Uses an Amiga M68K cross-compiler on linux or macOS.
#
# Cross-compiler: https://franke.ms/git/bebbo/amiga-gcc
# Install to /opt/amiga, then:
# sys/unix/setup.sh sys/unix/hints/linux.370
# make fetch-lua
# make CROSS_TO_AMIGA=1 fetch-regex
# make CROSS_TO_AMIGA=1 all
# make CROSS_TO_AMIGA=1 package
#=================================================================
CFLAGS += -DCROSSCOMPILE
#
# Override the build tools and some obj files to
# reflect the amiga-gcc cross-compiler.
#
TOOLTOP = /opt/amiga/bin
TOOLARCH = -m68000
override REGEXOBJ = $(TARGETPFX)posixregex.o
AMIREGEXOBJ = $(TARGETPFX)regcomp.o $(TARGETPFX)regexec.o \
$(TARGETPFX)regerror.o $(TARGETPFX)regfree.o
override TARGET_CC = $(TOOLTOP)/m68k-amigaos-gcc
override TARGET_CXX = $(TOOLTOP)/m68k-amigaos-c++
override TARGET_AR = $(TOOLTOP)/m68k-amigaos-ar
override TARGET_STUBEDIT=
override TARGET_CFLAGS = -c -O2 -noixemul $(TOOLARCH) \
-include sys/types.h \
-I../include \
-I../sys/amiga -I../win/share \
$(LUAINCL) -DAMIGA -DNOTTYGRAPHICS -DNO_TERMS -DNO_SIGNAL \
-DTILES_IN_GLYPHMAP $(PDCURSESDEF) \
-DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_AMIGA \
-DAMIGA_VERSION_STRING=\""VER: NetHack 3.7.0"\"
override TARGET_CXXFLAGS = $(TARGET_CFLAGS)
LUA_TARGET_CFLAGS = $(TARGET_CFLAGS)
ifeq "$(REGEXOBJ)" "$(TARGETPFX)cppregex.o"
override TARGET_LINK = $(TARGET_CXX)
else
override TARGET_LINK = $(TARGET_CC)
endif
override TARGET_LFLAGS= $(TOOLARCH) -noixemul -Wl,--allow-multiple-definition
override TARGET_LIBS += $(LIBLM)
VARDATND += nhtiles.bmp
override SYSSRC = ../sys/amiga/amidos.c ../sys/amiga/amigst.c \
../sys/amiga/amimenu.c ../sys/amiga/amirip.c \
../sys/amiga/amistack.c ../sys/amiga/amitty.c \
../sys/amiga/amiwind.c ../sys/amiga/clipwin.c \
../sys/amiga/colorwin.c \
../sys/amiga/winami.c ../sys/amiga/winchar.c \
../sys/amiga/winfuncs.c ../sys/amiga/winkey.c \
../sys/amiga/winamenu.c ../sys/amiga/winreq.c \
../sys/amiga/winstr.c ../sys/share/pcmain.c \
../win/share/bmptiles.c ../win/share/giftiles.c \
../win/share/tileset.c
override SYSOBJ = $(TARGETPFX)amidos.o $(TARGETPFX)amigst.o \
$(TARGETPFX)amirip.o $(TARGETPFX)amistack.o \
$(TARGETPFX)amitty.o $(TARGETPFX)amiwind.o \
$(TARGETPFX)winami.o $(TARGETPFX)winchar.o \
$(TARGETPFX)winfuncs.o $(TARGETPFX)winkey.o \
$(TARGETPFX)winamenu.o $(TARGETPFX)winreq.o \
$(TARGETPFX)winstr.o $(TARGETPFX)pcmain.o \
$(TARGETPFX)bmptiles.o $(TARGETPFX)giftiles.o \
$(TARGETPFX)tileset.o \
$(AMIREGEXOBJ)
override WINLIB=
override LUALIB=
override LUALIBS=
override TOPLUALIB=
override DLLIB=
override WINOBJ=
override GAMEBIN = $(TARGETPFX)nethack
override PACKAGE = amigapkg
override PREGAME += mkdir -p $(TARGETDIR) ;
override CLEANMORE += rm -r $(TARGETDIR) ;
#
# Rule for files in sys/amiga
$(TARGETPFX)%.o : ../sys/amiga/%.c
$(TARGET_CC) $(TARGET_CFLAGS) -o$@ $<
# Rule for BSD regex in sys/amiga/regex
$(TARGETPFX)%.o : ../sys/amiga/regex/%.c
$(TARGET_CC) $(TARGET_CFLAGS) -I../sys/amiga/regex -o$@ $<
endif # CROSS_TO_AMIGA
#=================================================================
ifdef WANT_WIN_CURSES
ifdef BUILD_PDCURSES
# Rules for PDCurses files

View File

@@ -70,34 +70,38 @@ NROFF = mandoc
MAN2TXTPRE = -T ascii
MAN2TXTPOST= | col -b
else
#detection of groff
NROFFISGROFF := $(shell echo `nroff --version | grep "GNU groff version"`)
#
# Detect groff.
NROFFISGROFF := $(shell echo `nroff --version | grep -c 'GNU.*groff.*version'`)
#$(info NROFFISGROFF=$(NROFFISGROFF))
ifneq "$(NROFFISGROFF)" ""
# get the version of groff and flag if it is gt or eq to 1.23
GROFFGE123 := $(shell expr `echo $(NROFFISGROFF) | cut -f2 -d.` \>= 23)
# or less than 1.24
GROFFLT124 := $(shell expr `echo $(NROFFISGROFF) | cut -f2 -d.` \< 24)
# -Wtab -Wrange are for the sake of tmac.n.
NROFF_FLAGS := -wall -Wtab -Wrange
ifneq "$(GROFFLT124)" ""
NROFF_FLAGS += -Wel -Wscale
endif
endif # NROFFISGROFF
ifneq "$(NROFFISGROFF)" "0"
# Gather groff's minor version number (register `.y`).
GROFFMINORVERSION := $(shell printf '.tm \\n[.y]\n' | nroff 2>&1)
#$(info GROFFMINORVERSION=$(GROFFMINORVERSION))
# Silence warnings produced by tmac.n, which NetHack does not modify.
NROFF_FLAGS := -wall -Wrange -Wscale -Wtab
# groff <= 1.23 also supported an "el" warning category that was buggy.
GROFFLE123 := $(shell expr $(GROFFMINORVERSION) \<= 23)
#$(info GROFFLE123=$(GROFFLE123))
ifeq "$(GROFFLE123)" "1"
NROFF_FLAGS += -Wel
endif # end groff less than 1.23
endif # end NROFFISGROFF
# $(info NROFF_FLAGS=$(NROFF_FLAGS))
ifneq "$(NROFFISGROFF)" "" # It's groff
# add the -Tascii flag used by groff
MAN2TXTPRE += -Tascii
ifneq "$(GROFFGE123)" "" # It's groff 1.23 or greater
#$(info GROFFGE123=$(GROFFGE123))
# nroff in groff 1.23 supports the -P option to pass arguments to the
# output driver. -cbou are flags to grotty(1).
GROFFGE123 := $(shell expr $(GROFFMINORVERSION) \>= 23)
#$(info GROFFGE123=$(GROFFGE123))
ifeq "$(GROFFGE123)" "1"
MAN2TXTPRE += -P -cbou
MAN2TXTPOST=
else
MAN2TXTPRE += -c
# groff less than 1.23
endif
endif # end groff less than 1.23
endif # end groff-specific
endif # not USE_MANDOC

View File

@@ -15,7 +15,7 @@
# - WINOBJ0
#---
# User selections could be specified as combinations of any of the following:
# WIN_WANT_TTY=1, WIN_WANT_CURSES=1, WIN_WANT_QT=1, WIN_WANT_X11=1
# WANT_WIN_TTY=1, WANT_WIN_CURSES=1, WANT_WIN_QT=1, WANT_WIN_X11=1
# The selections will all be linked into the same binary.
#
# Assuming you have the prerequisite packages mentioned above, you can

View File

@@ -0,0 +1,33 @@
#------------------------------------------------------------------------------
# NetHack 3.7 response.370 $NHDT-Date: 1668359835 2022/11/13 17:17:15 $ $NHDT-Branch: NetHack-3.7 $
ifeq "$(RESP)" "1"
USE_RESPONSEFILE=1
endif
ifeq "$(resp)" "1"
USE_RESPONSEFILE=1
endif
ifeq "$(RESPONSE)" "1"
USE_RESPONSEFILE=1
endif
ifeq "$(response)" "1"
USE_RESPONSEFILE=1
endif
ifeq "$(USE_RESPONSEFILE)" "1"
RESPONSEFILES=create_responsefiles
CXXFLAGS = $(CCXXFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
CC_COMPILER_SWITCHES := $(subst \,\\,$(CFLAGS))
CC_COMPILER_SWITCHES := $(subst ",\",$(CC_COMPILER_SWITCHES))
CXX_COMPILER_SWITCHES := $(subst \,\\,$(CXXFLAGS))
CXX_COMPILER_SWITCHES := $(subst ",\",$(CXX_COMPILER_SWITCHES))
CC_RESPONSEFILE=../src/nethack_cc.rsp
CXX_RESPONSEFILE=../src/nethack_cxx.rsp
CFLAGS=@$(CC_RESPONSEFILE)
CXXFLAGS=@$(CXX_RESPONSEFILE)
CLEAN_CC_RESPONSEFILE=rm -f $(CC_RESPONSEFILE);
CLEAN_CXX_RESPONSEFILE=rm -f $(CXX_RESPONSEFILE);
endif
#end of response.370
#------------------------------------------------------------------------------

View File

@@ -390,13 +390,15 @@ endif #?WANT_SOURCE_INSTALL
INSTDIR=$(HACKDIR)
VARDIR = $(HACKDIR)
ifneq "$(CCISCLANG)" ""
# gdb may not be installed if clang is chosen compiler so the game
# won't start in that case due to a sysconf error. Comment out
# relevant lines in sysconf.
POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \
ifdef MAKEFILE_TOP
TESTGDBPATH=/usr/bin/gdb
POSTINSTALL+= test -f $(TESTGDBPATH) || \
sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \
-e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf;
endif
POSTUPDATE+= test -f $(TESTGDBPATH) || \
sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \
-e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf;
endif #MAKEFILE_TOP
ifeq '$(USE_NONOSTATICFN)' '1'
CFLAGS += -DNONOSTATICFN
@@ -448,6 +450,10 @@ MANDIR=/usr/share/man/man6
#-INCLUDE multisnd2-pre.370
#
#
#-INCLUDE response.370
#
#-POST
#

View File

@@ -281,12 +281,12 @@ WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig \
pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
endif # WANT_WIN_QT5
ifdef WANT_WIN_QT6
QTCXXFLAGS += -std=c++17 -I $(QTDIR)/include -I $(QTDIR)/include/QtCore \
-I $(QTDIR)/include/QtMultimedia
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig \
pkg-config Qt6Gui Qt6Widgets Qt6Multimedia --cflags))
MOC = moc
MOCPATH = $(QTDIR)/share/qt/libexec/moc
WINLIB += -F $(QTDIR)/Frameworks -framework QtCore -framework QtGui \
-framework QtWidgets -framework QtMultimedia
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig \
pkg-config Qt6Gui Qt6Widgets Qt6Multimedia --libs)
endif # WANT_WIN_QT6
VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
# XXX if /Developer/qt exists and QTDIR not set, use that
@@ -461,6 +461,9 @@ SYSCONFENSURE = (if ! test -f $(INSTDIR)/sysconf ; then \
#
#-INCLUDE multisnd2-pre.370
#
#
#-INCLUDE response.370
#
ifdef MAKEFILE_TOP
.PHONY: bundle

View File

@@ -26,17 +26,11 @@ extern struct passwd *getpwuid(int);
#endif
extern struct passwd *getpwnam(const char *);
#ifdef CHDIR
static void chdirx(const char *, boolean);
void chdirx(const char *, boolean);
#endif /* CHDIR */
static boolean whoami(void);
static char *lopt(char *, int, const char *, const char *, int *, char ***);
boolean whoami(void);
static void process_options(int, char **);
static void consume_arg(int, int *, char ***);
static void consume_two_args(int, int *, char ***);
static void early_options(int *, char ***, char **);
ATTRNORETURN static void opt_terminate(void) NORETURN;
ATTRNORETURN static void opt_usage(const char *) NORETURN;
ATTRNORETURN static void scores_only(int, char **, const char *) NORETURN;
#ifdef SND_LIB_INTEGRATED
uint32_t soundlibchoice = soundlib_nosound;
#endif
@@ -128,12 +122,14 @@ main(int argc, char *argv[])
if (!dir)
dir = nh_getenv("HACKDIR");
#endif /* CHDIR */
program_state.early_options = 1;
#ifdef ENHANCED_SYMBOLS
if (argcheck(argc, argv, ARG_DUMPGLYPHIDS) == 2)
exit(EXIT_SUCCESS);
#endif
/* handle -dalthackdir, -s <score stuff>, --version, --showpaths */
early_options(&argc, &argv, &dir);
program_state.early_options = 0;
#ifdef CHDIR
/*
* Change directories before we initialize the window system so
@@ -325,93 +321,6 @@ main(int argc, char *argv[])
return 0;
}
static char ArgVal_novalue[] = "[nothing]"; /* note: not 'const' */
enum cmdlinearg {
ArgValRequired = 0, ArgValOptional = 1,
ArgValDisallowed = 2, ArgVal_mask = (1 | 2),
ArgNamOneLetter = 4, ArgNam_mask = 4,
ArgErrSilent = 0, ArgErrComplain = 8, ArgErr_mask = 8
};
/* approximate 'getopt_long()' for one option; all the comments refer to
"-windowtype" but the code isn't specific to that */
static char *
lopt(
char *arg, /* command line token; beginning matches 'optname' */
int lflags, /* cmdlinearg | errorhandling */
const char *optname, /* option's name; "-windowtype" in examples below */
const char *origarg, /* 'arg' might have had a dash prefix removed */
int *argc_p, /* argc that can have changes passed to caller */
char ***argv_p) /* argv[] ditto */
{
int argc = *argc_p;
char **argv = *argv_p;
char *p, *nextarg = (argc > 1 && argv[1][0] != '-') ? argv[1] : 0;
int l, opttype = (lflags & ArgVal_mask);
boolean oneletterok = ((lflags & ArgNam_mask) == ArgNamOneLetter),
complain = ((lflags & ArgErr_mask) == ArgErrComplain);
/* first letter must match */
if (arg[1] != optname[1]) {
loptbail:
if (complain)
config_error_add("Unknown option: %.60s", origarg);
return (char *) 0;
loptnotallowed:
if (complain)
config_error_add("Value not allowed: %.60s", origarg);
return (char *) 0;
loptrequired:
if (complain)
config_error_add("Missing required value: %.60s", origarg);
return (char *) 0;
}
if ((p = strchr(arg, '=')) == 0)
p = strchr(arg, ':');
if (p && opttype == ArgValDisallowed)
goto loptnotallowed;
l = (int) (p ? (long) (p - arg) : (long) strlen(arg));
if ((l > 2 || oneletterok) && !strncmp(arg, optname, l)) {
/* "-windowtype[=foo]" */
if (p)
++p; /* past '=' or ':' */
else if (opttype == ArgValRequired)
p = eos(arg); /* we have "-w[indowtype]" w/o "=foo"
* so we'll take foo from next element */
else
return ArgVal_novalue;
} else if (oneletterok) {
/* "-w..." but not "-w[indowtype[=foo]]" */
if (!p) {
p = &arg[2]; /* past 'w' of "-wfoo" */
#if 0 /* -x:value could work but is not supported (callers don't expect it) */
} else if (p == arg + 2) {
++p; /* past ':' of "-w:foo" */
#endif
} else {
/* "-w...=foo" but not "-w[indowtype]=foo" */
goto loptbail;
}
} else {
goto loptbail;
}
if (!p || !*p) {
/* "-w[indowtype]" w/o '='/':' if there is a next element, use
it for "foo"; if not, supply a non-Null bogus value */
if (nextarg && (opttype == ArgValRequired
|| opttype == ArgValOptional))
p = nextarg, --(*argc_p), ++(*argv_p);
else if (opttype == ArgValRequired)
goto loptrequired;
else
p = ArgVal_novalue; /* there is no next element */
}
return p;
}
/* caveat: argv elements might be arbitrarily long */
static void
process_options(int argc, char *argv[])
@@ -573,272 +482,8 @@ process_options(int argc, char *argv[])
return;
}
/* move argv[ndx] to end of argv[] array, then reduce argc to hide it;
prevents process_options() from encountering it after early_options()
has processed it; elements get reordered but all remain intact */
static void
consume_arg(int ndx, int *ac_p, char ***av_p)
{
char *gone, **av = *av_p;
int i, ac = *ac_p;
/* "-one -two -three -four" -> "-two -three -four -one" */
if (ac > 2) {
gone = av[ndx];
for (i = ndx + 1; i < ac; ++i)
av[i - 1] = av[i];
av[ac - 1] = gone;
}
--(*ac_p);
}
/* consume two tokens for '-argname value' w/o '=' or ':' */
static void
consume_two_args(int ndx, int *ac_p, char ***av_p)
{
/* when consuming "-two arg" from "-two arg -three -four",
the *ac_p manipulation results in "-three -four -two arg"
rather than the "-three -four arg -two" that would happen
with just two ordinary consume_arg() calls */
consume_arg(ndx, ac_p, av_p);
++(*ac_p); /* bring the final slot back into view */
consume_arg(ndx, ac_p, av_p);
--(*ac_p); /* take away restored slot */
}
/* process some command line arguments before loading options */
static void
early_options(int *argc_p, char ***argv_p, char **hackdir_p)
{
char **argv, *arg, *origarg;
int argc, oldargc, ndx = 0, consumed = 0;
config_error_init(FALSE, "command line", FALSE);
/* treat "nethack ?" as a request for usage info; due to shell
processing, player likely has to use "nethack \?" or "nethack '?'"
[won't work if used as "nethack -dpath ?" or "nethack -d path ?"] */
if (*argc_p > 1 && !strcmp((*argv_p)[1], "?"))
opt_usage(*hackdir_p); /* doesn't return */
/*
* Both *argc_p and *argv_p account for the program name as (*argv_p)[0];
* local argc and argv impicitly discard that (by starting 'ndx' at 1).
* argcheck() doesn't mind, prscore() (via scores_only()) does (for the
* number of args it gets passed, not for the value of argv[0]).
*/
for (ndx = 1; ndx < *argc_p; ndx += (consumed ? 0 : 1)) {
consumed = 0;
argc = *argc_p - ndx;
argv = *argv_p + ndx;
arg = origarg = argv[0];
/* skip any args intended for deferred options */
if (*arg != '-')
continue;
/* allow second dash if arg name is longer than one character */
if (arg[0] == '-' && arg[1] == '-' && arg[2] != '\0'
&& (arg[3] != '\0' && arg[3] != '=' && arg[3] != ':'))
++arg;
switch (arg[1]) { /* char after leading dash */
case 'b':
#ifdef CRASHREPORT
// --bidshow
if (argcheck(argc, argv, ARG_BIDSHOW) == 2){
opt_terminate();
/*NOTREACHED*/
}
#endif
break;
case 'd':
if (argcheck(argc, argv, ARG_DEBUG) == 1) {
consume_arg(ndx, argc_p, argv_p), consumed = 1;
#ifndef NODUMPENUMS
} else if (argcheck(argc, argv, ARG_DUMPENUMS) == 2) {
opt_terminate();
/*NOTREACHED*/
#endif
} else if (argcheck(argc, argv, ARG_DUMPMONGEN) == 2) {
opt_terminate();
/*NOTREACHED*/
} else if (argcheck(argc, argv, ARG_DUMPWEIGHTS) == 2) {
opt_terminate();
/*NOTREACHED*/
} else {
#ifdef CHDIR
oldargc = argc;
arg = lopt(arg,
(ArgValRequired | ArgNamOneLetter | ArgErrSilent),
"-directory", origarg, &argc, &argv);
if (!arg)
error("Flag -d must be followed by a directory name.");
if (*arg != 'e') { /* avoid matching -decgraphics or -debug */
*hackdir_p = arg;
if (oldargc == argc)
consume_arg(ndx, argc_p, argv_p), consumed = 1;
else
consume_two_args(ndx, argc_p, argv_p), consumed = 2;
}
#endif /* CHDIR */
}
break;
case 'h':
case '?':
if (lopt(arg, ArgValDisallowed, "-help", origarg, &argc, &argv)
|| lopt(arg, ArgValDisallowed | ArgNamOneLetter, "-?",
origarg, &argc, &argv))
opt_usage(*hackdir_p); /* doesn't return */
break;
case 'n':
oldargc = argc;
if (!strcmp(arg, "-no-nethackrc")) /* no abbreviation allowed */
arg = nhStr("/dev/null");
else
arg = lopt(arg, (ArgValRequired | ArgErrComplain),
"-nethackrc", origarg, &argc, &argv);
if (arg) {
gc.cmdline_rcfile = dupstr(arg);
if (oldargc == argc)
consume_arg(ndx, argc_p, argv_p), consumed = 1;
else
consume_two_args(ndx, argc_p, argv_p), consumed = 2;
}
break;
case 's':
if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) {
gd.deferred_showpaths = TRUE;
gd.deferred_showpaths_dir = *hackdir_p;
config_error_done();
return;
}
/* check for "-s" request to show scores */
if (lopt(arg, ((ArgValDisallowed | ArgErrComplain)
/* only accept one-letter if there is just one
dash; reject "--s" because prscore() via
scores_only() doesn't understand it */
| ((origarg[1] != '-') ? ArgNamOneLetter : 0)),
/* [ought to omit val-disallowed and accept
--scores=foo since -s foo and -sfoo are
allowed, but -s form can take more than one
space-separated argument and --scores=foo
isn't suited for that] */
"-scores", origarg, &argc, &argv)) {
/* at this point, argv[0] contains "-scores" or a leading
substring of it; prscore() (via scores_only()) expects
that to be in argv[1] so we adjust the pointer to make
that be the case; if there are any non-early args waiting
to be passed along to process_options(), the resulting
argv[0] will be one of those rather than the program
name but prscore() doesn't care */
scores_only(argc + 1, argv - 1, *hackdir_p);
/*NOTREACHED*/
}
break;
case 'u':
if (lopt(arg, ArgValDisallowed, "-usage", origarg, &argc, &argv))
opt_usage(*hackdir_p);
break;
case 'v':
if (argcheck(argc, argv, ARG_VERSION) == 2) {
opt_terminate();
/*NOTREACHED*/
}
break;
case 'w': /* windowtype: "-wfoo" or "-w[indowtype]=foo"
* or "-w[indowtype]:foo" or "-w[indowtype] foo" */
arg = lopt(arg,
(ArgValRequired | ArgNamOneLetter | ArgErrComplain),
"-windowtype", origarg, &argc, &argv);
if (gc.cmdline_windowsys)
free((genericptr_t) gc.cmdline_windowsys);
gc.cmdline_windowsys = arg ? dupstr(arg) : NULL;
break;
default:
break;
}
}
/* empty or "N errors on command line" */
config_error_done();
return;
}
/* for command-line options that perform some immediate action and then
terminate the program without starting play, like 'nethack --version'
or 'nethack -s Zelda'; do some cleanup before that termination */
ATTRNORETURN static void
opt_terminate(void)
{
config_error_done(); /* free memory allocated by config_error_init() */
nh_terminate(EXIT_SUCCESS);
/*NOTREACHED*/
}
ATTRNORETURN static void
opt_usage(const char *hackdir)
{
#ifdef CHDIR
chdirx(hackdir, TRUE);
#else
nhUse(hackdir);
#endif
dlb_init();
genl_display_file(USAGEHELP, TRUE);
opt_terminate();
}
/* show the sysconf file name, playground directory, run-time configuration
file name, dumplog file name if applicable, and some other things */
ATTRNORETURN void
after_opt_showpaths(const char *dir)
{
#ifdef CHDIR
chdirx(dir, FALSE);
#else
nhUse(dir);
#endif
opt_terminate();
/*NOTREACHED*/
}
/* handle "-s <score options> [character-names]" to show all the entries
in the high scores file ('record') belonging to particular characters;
nethack will end after doing so without starting play */
ATTRNORETURN static void
scores_only(int argc, char **argv, const char *dir)
{
/* do this now rather than waiting for final termination, in case there
is an error summary coming */
config_error_done();
#ifdef CHDIR
chdirx(dir, FALSE);
#else
nhUse(dir);
#endif
#ifdef SYSCF
iflags.initoptions_noterminate = TRUE;
initoptions(); /* sysconf options affect whether panictrace is enabled */
iflags.initoptions_noterminate = FALSE;
#endif
#ifdef PANICTRACE
ARGV0 = gh.hname; /* save for possible stack trace */
#ifndef NO_SIGNAL
panictrace_setsignals(TRUE);
#endif
#endif
(void) whoami(); /* set up default plname[] */
prscore(argc, argv);
nh_terminate(EXIT_SUCCESS); /* bypass opt_terminate() */
/*NOTREACHED*/
}
#ifdef CHDIR
static void
void
chdirx(const char *dir, boolean wr)
{
if (dir /* User specified directory? */
@@ -905,7 +550,7 @@ chdirx(const char *dir, boolean wr)
#endif /* CHDIR */
/* returns True iff we set plname[] to username which contains a hyphen */
static boolean
boolean
whoami(void)
{
/*